Game Development Community

How to override a texture?

by J "hplus" W · in Torque Game Engine · 09/11/2006 (10:16 pm) · 6 replies

OK, so I have a DTS model, and a TSShapeConstructor datablock to pre-load it and its animations.

In my PlayerData datablock, I call out the shapeFile. However, I can't figure out how to override the texture for the dts -- surely I don't need to export a separate dts for each re-skin of a character?

Looking at TSShapeInstance, there's a funciton setOverrideTexture(), but it has no documentation, and it says nothing about where a TextureHandle might be coming from, or how I could create one in a script.

Help!

#1
09/11/2006 (10:25 pm)
OK, answered my own question. There appears to be NO SUPPORT for this highly necessary feature. What!?!?

So I implemented it, and posted as a resource. Might be okayed by moderators sometime.

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=11250
#2
09/11/2006 (10:33 pm)
Unless I'm misreading your post, this feature already exists in the engine.

%player.setSkinName("someOtherTexture");

You need to set your dts to have a texture named base.myDts first. Then all other textures are named accordingly: texture1.myDts, texture2.myDts and so forth.
#3
09/12/2006 (10:16 am)
Thank you. That's slightly different from what I want, though -- I want the datablock data to specify the texture name (or, ideally, multiple texture names, but I didn't implement that).
#4
09/12/2006 (11:08 am)
Normal practice within stock Torque is basically what Tim said, and you export multiple skins into a single dts, then swap between them.

The RTS-SK does have a function called "setOverrideTexture()", but I'm honestly not sure if this is RTS-SK only, or a stock TGE function that isn't currently exposed to script.
#5
09/12/2006 (2:07 pm)
TGE 1.4 also has setOverrideTexture(), but with zero documentation. However, I ended up using it in my posted resource, and it worked fine (after some looking). It's also used by the "cloaking" ability of ShapeBase, btw.

I don't want to store the skins in the model, because I don't want to re-export the model when trying things out in the world; hence the ability to choose between textures in datablocks instead. The patch was very small.

The resouce I created for this got approved by the way.
#6
09/12/2006 (2:27 pm)
This is outstanding, just put in and test it. Work perfectly. Now I dont reexport the model that is brought or made. Yes! Thank you!