Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AbrahamR, AndrewAMD, ozgur), 763 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
changing block texture? #327206
06/05/10 06:46
06/05/10 06:46
Joined: Mar 2009
Posts: 42
Dominican Republic
keilyn3d Offline OP
Newbie
keilyn3d  Offline OP
Newbie

Joined: Mar 2009
Posts: 42
Dominican Republic
hi, I like to know if is possible to change the texture of a block in runtime, by script and keeping the light-map.

some idea?

thanks.

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 Offline
Serious User
DJBMASTER  Offline
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] #327216
06/05/10 08:40
06/05/10 08:40
Joined: Mar 2009
Posts: 42
Dominican Republic
keilyn3d Offline OP
Newbie
keilyn3d  Offline OP
Newbie

Joined: Mar 2009
Posts: 42
Dominican Republic
thanks for the reply.

and is not possible to change the texture by modifying the material? I think that the texture is in the skin0 but I don't know how to change the skin0.

and with a shader is not possible??

Re: changing block texture? [Re: keilyn3d] #327218
06/05/10 09:24
06/05/10 09:24
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Well you can access the block base texture and lightmaps in a shader by using the 'entskin1 - entskin4' textures.

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 Offline
Expert
MasterQ32  Offline
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:
Code:
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!


Visit my site: www.masterq32.de
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 Offline OP
Newbie
keilyn3d  Offline 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:
Code:
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.



Re: changing block texture? [Re: keilyn3d] #327278
06/05/10 16:46
06/05/10 16:46
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
i've found bmap_for_texture only in the c# acknex wrapper and in the online manual
think this funtion is cool, you can use it to create special blocks with changing color or so


Visit my site: www.masterq32.de

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1