0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: save hmp file dll
[Re: sivan]
#450474
04/15/15 11:51
04/15/15 11:51
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
mm I must have missed a line of original width & height code likely.
just to be clear , how are you resizing the images ?
and are you using skip_original_pixels set to 1 or 0
Compulsive compiler
|
|
|
Re: save hmp file dll
[Re: Wjbender]
#450491
04/15/15 20:57
04/15/15 20:57
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
as stated above I found one I missed , and corrected it . if it doesn't save correct now , I would need more details in the methods involved .
Compulsive compiler
|
|
|
Re: save hmp file dll
[Re: Wjbender]
#450492
04/15/15 20:57
04/15/15 20:57
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
as stated above I found one I missed , and corrected it . if it doesn't save correct now , I would need more details in the methods involved .
Compulsive compiler
|
|
|
Re: save hmp file dll
[Re: Wjbender]
#450510
04/16/15 07:29
04/16/15 07:29
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
Expert
|
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
hi, no success, only square skins are saved well, here is the colouring code I used for testing:
void TerEdit_Tx_SetColor()
{
wait(3);
int skin_int = teredit_tx_selected+1+(teredit_tx_set-1)*max_teredit_tx_items;
if (skin_int > teredit_tx_count) return; // protection
if (!ent_getskin(terrain_entity, skin_int))
{
return;
}
TerEdit_Tx_Color( bmap_for_entity(terrain_entity , skin_int) , vector(teredit_tx_blue,teredit_tx_green,teredit_tx_red) );
wait_for(TerEdit_Tx_Color);
}
void TerEdit_Tx_Color(BMAP* bmap_pointer, COLOR* to_color)
{
if (bmap_pointer == NULL)
{
return;
}
var pixel_format = bmap_lock(bmap_pointer,0); // lock and get format
if (pixel_format >= 565)
{
var pixel;
COLOR pixel_color;
var pixel_alpha;
int i,j;
for(i=0;i<bmap_width(bmap_pointer);i++)
{
for(j=0;j<bmap_height(bmap_pointer);j++)
{
pixel = pixel_for_bmap( bmap_pointer , i , j ); // get pixel
pixel_to_vec( pixel_color , pixel_alpha , pixel_format , pixel ); // get color and alpha
pixel = pixel_for_vec( to_color , pixel_alpha , pixel_format ); // set alpha
pixel_to_bmap( bmap_pointer , i , j , pixel ); // set pixel
}
}
}
bmap_unlock(bmap_pointer);
bmap_to_mipmap(bmap_pointer); // @@@ update mipmaps after unlocking, to avoid the original skin to appear from big distance
wait(1);
TerEdit_Tx_UpdateSets32(); // uses bmap_blit to copy skin texture to thumbnail
TerrHmp_Tx_UpdateMaterialSkins(); // sets material skins to entity skins due to shader requirements
wait(1);
}
|
|
|
Re: save hmp file dll
[Re: sivan]
#450512
04/16/15 07:40
04/16/15 07:40
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
okay I wil look at the code , could it be possible that its a limitation ? I remember reading something about width and height being able to support non square values but the engine keeps it a power of 2 , I may be confusing this with something else but if I find it I wil tel you
Compulsive compiler
|
|
|
Re: save hmp file dll
[Re: sivan]
#450519
04/16/15 10:22
04/16/15 10:22
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
in the manual , I found this :
If the texture had no mipmaps before, modified texture content gets lost when creating the mipmap chain the first time. Thus, create the mipmaps before modifying the texture, and call bmap_to_mipmap afterwards a second time for updating the modified content to the other mipmaps. This function can not be applied to compressed (DDS), cubic, normal, tangent, rendertarget, or other special bitmaps. If required, create the mipmaps before converting the bitmap to a special format (for instance bmap_to_cubemap(bmap_to_mipmap(skymap)). Creating mipmaps afterwards will otherwise render the special bitmap unusable.
there's a problem with your code there(if you didn't have mipmaps before ) and I do not save mipmaps out to file yet.
I tested by doing pixel operations , followed by bmap_to_mipmap , which destroyed the modifications and results in behaviour you would not want ,if you were planning on keeping the pixel alterations ..
but still , how are you resizing the bmaps to be non square ? I mean what function ?
Compulsive compiler
|
|
|
Re: save hmp file dll
[Re: Wjbender]
#450529
04/16/15 19:58
04/16/15 19:58
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
Expert
|
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
ahh thanks! a missed info. I can do that mipmap generation on texture editor initialization.
they are pre-made textures, 4 textures are combined into one, to easily access 8 textures from the terrain shader as 4 entity and 4 material skins (global color map, global normal map, rgba blendmap1, rgba blendmap2, 1st 1x4 color map, 1st 1x4 optional normal map, 2nd 1x4 color map, 2nd 1x4 optional normal map), but I could make 2x2 arrangement instead of 1x4, but with Gimp it is easier to create 1x4.
|
|
|
Re: save hmp file dll
[Re: sivan]
#450533
04/16/15 20:35
04/16/15 20:35
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
okay so you made texture atlases ,I understand .
how do you feed the texture parts from the atlas, as new bmap skins , before you save ?
and what format are those bmaps ?
Compulsive compiler
|
|
|
|