0 registered members (),
677
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: changing block texture?
[Re: keilyn3d]
#327213
06/05/10 08:22
06/05/10 08:22
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
I don't think this is possible with standard lite-c functions. You can however use 'ent_getmesh' to grab a DirectX mesh of a specific block and then I guess you can use any of the dx functions to map a texture onto it, eg, SetTexture, SetTextureStageState, etc.
This requires knowledge of DirectX though.
Maybe conitec should add 'ent_for_block' / 'ent_to_block' functions?
Last edited by DJBMASTER; 06/05/10 08:22.
|
|
|
Re: changing block texture?
[Re: DJBMASTER]
#327220
06/05/10 09:46
06/05/10 09:46
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
its possible! and you don't need a shader. but you must have a unique Block texture. try this:
int x = 1;
int y = 1;
var format;
BMAP* tex2 = bmap_create("neueTextur.bmp");
var format2 = bmap_lock(tex2,0);
var format = bmap_lock(bmap_for_texture("metalplain4"),0);
for(y = 0; y < bmap_height(tex2);y++)
{
for(x = 0; x < bmap_width(tex2); x++)
{
var format; var pixel;
pixel = pixel_for_bmap(tex2,x,y);
//pixel = pixel_for_vec(color,100,format);
pixel_to_bmap(bmap_for_texture("metalplain4"),x,y,pixel);
}
}
bmap_unlock(bmap_for_texture("metalplain4"));
bmap_unlock(tex2);
in this code "metalplain4" is the name of the texture. "neueTextur.bmp" is the new texture file. you have to control the size of both textures, because the textures must have the same size! i experimented with this feature some days ago and it is really cool!
|
|
|
Re: changing block texture?
[Re: MasterQ32]
#327245
06/05/10 12:36
06/05/10 12:36
|
Joined: Mar 2009
Posts: 42 Dominican Republic
keilyn3d
OP
Newbie
|
OP
Newbie
Joined: Mar 2009
Posts: 42
Dominican Republic
|
Thanks!!! now it work!! I did had a little problem with the colors but I used bmap_blit and it now work perfect, I didn't know about bmap_for_texture, thanks. here is the code for anyone that want make this:
BMAP* tex2 = bmap_create("madera_01.bmp");//source texture
bmap_blit (bmap_for_texture("piso_01"), tex2, vector(0,0,0), vector(512,512,0 ));
bmap_to_mipmap(bmap_for_texture("piso_01"));//to updates the mipmaps.
|
|
|
|