Game Development Community

setSkin for 3D shape

by Gilberto Catarino · in Torque Game Builder · 01/28/2009 (4:28 am) · 5 replies

Hello
I have a t2dshape3d object which is a poker card. how do i use multiple textures on that shape, one for the front other for the back.
Using setSkin function only gets me to change the whole skin.

Thanks

#1
01/29/2009 (3:07 am)
Ok, had to change the setSkin function the source code so i can pass the index of the texture i want to change.
If anyone interested just say it.

Thanks
#2
01/29/2009 (12:59 pm)
Cool, but I remember changing the skin in torqueScript. Not sure what the issue was that you ran into doing that. Glad it's working for you though!
#3
03/07/2009 (1:12 am)
Gilberto,

I would be very interested if you could post how you got the individual DTS textures to change by index number. I have gotten my skin sets to change properly, but it looks like the way it is done in TGB only allows the entire set of textures in the DTS to be changed at once. Looks like from what you have said I will need to upgrade to TGB Pro so I can change the source code.

Thanks,

Brian
#4
03/10/2009 (3:30 am)
Hello Brian
Yes you need to have the source code of TGB in order to make some changes on the t2dshape3d class and then compile it with those changes.

In file t2dshape3d.h
change line 58 to
bool setSkin(const char* pSkinSet, const char* pSkinName, const U32 index);

In file t2shape3d.cc
[b]replace console function at line 247 for this one[/b]

ConsoleMethod(t2dShape3D, setSkin, bool, 5, 5, "( skinSet$, skinName$, textureIndex ) - Changes the skin to the specified texturen"
			  "@param skinSet Set in which desired skin is located.n"
			  "@param Name of desired texture.n"
			  "@index of the desired texture to change.n"
			  "@return Returns true on success, false otherwise.")
{
	// Set Skin.
	//return object->setSkin(argv[2], argv[3]);
	return object->setSkin(argv[2], argv[3], dAtof(argv[4]));
}

[b]at line 258 change to[/b]
bool t2dShape3D::setSkin( const char* pSkinSet, const char* pSkinName, const U32 index )

[b]before the for iteration at line 294[/b]
for ( U32 n = 0; n < materialCount; n++)

[b] add this[/b]
if (index >= materialCount){
return false;
}

[b]at line 319 change[/b]
pMaterialList->mMaterials[n].set( fullFilePathBuffer, MeshTexture, false );


[b]for this[/b]
// Load the texture.
if(n == index){					
   pMaterialList->mMaterials[n].set( fullFilePathBuffer, MeshTexture, false );
}

I don't think i'm missing anything here. It's what i'm using right now and it's working like i wanted to.
#5
03/10/2009 (4:35 am)
Gilberto,

Thanks so much! Looks like I will need to upgrade to Pro to do some of the pretty things I want to do in my TGB game. I am looking at modifying the lighting a bit to pretty things up as well.

Brian