Game Development Community

Dynamic Texture on a DTS object

by James Terry · in Torque Game Engine · 11/13/2006 (3:15 pm) · 6 replies

I am having one heck of a time trying to figure out where to start on dynamically changing a texture for a DTS object I have in my world.


Here's my setup:

I have a Cube I generated and exported in Blender, it has a UV mapped texture to its 6 faces. Currently each of those faces is a different color. I have a tileset that I want to use to make up each of the 6 faces of the cube. Each face of the cube will use 16 of these tiles in differing orders.

I would like to be able to generate this image in memory based on the images I have for each of the tiles. I was looking at the Dynamic Texture Object at www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4410 but I don't even know how to use it as the documentation is sparse and there is no sample code or exposed functions.

I was looking around at PNGWriter as a way to read in a bunch of files, composite them together, output it and then read in the new file as a different skin for my cube. Only problem with this is I have to have file I/O (slow) and I'd have to create a new skin each time (since as far as I know, changing from skin "blue" to skin "green" then changing the image for "blue" and setting the skin back to "blue" will not have any changed you had in the image.

If anyone could help me find a resource, or a good tutorial, it would be greatly appreciated. My project is at a standstill until I can get my head wrapped around something that could feasibly work.

Thanks,

James Terry

#1
11/14/2006 (1:37 pm)
Your asking how to use multiple skins right?
put in your shapes datablock:

base.mySkinName.png
skin0.mySkinName.png
skin1.mySkinName.png


then call something like this to change the skin.
%obj.setSkinName("skin0");

or you can use IFL's
#2
11/14/2006 (6:18 pm)
No clue how to do IFLs, but what I want to do is this.

I have a 3x3 grid of tiles on each side of the cube. I want to click on one of those tiles on the face of the cube and change the tile to a different one. If I did this with skins, I'd need every permutation of possible sides/tiles/etc.
#3
11/14/2006 (7:00 pm)
What if you made your cube out of nine dts shapes, and then changed the skins on each one.
You can just make one dts shape and make instances of it. Then assign a skin to each one as needed.
You could even mount them to each other if needed.
#4
11/14/2006 (7:04 pm)
Yeah, thats what I'm working on right now. I have the rotations set up for a base Cube and I'm attacking other objects to it. Its a long process creating all the mount points in blender, but I'm getting better at it.

Rotations was great fun though, got to learn all about Euler and quartenions and other fun stuff.
#5
11/27/2006 (10:32 am)
Not sure quite what you are looking for but here's info on IFL and a resource that might be interesting to you:

An "IFL" stands for "Image File List". It is, simply, a text file that contains the names of a series of image files.
To create one, just open Notepad (or other simple text file creator) and type in something like this:

texture01.jpg
texture02.jpg
texture03.jpg

Just list out your image files in the order you want them to play and you are done. There are additional parameters you can add, but I don't ever use them - you can put in numbers to specify how long you want the image to "hold" before changing to the next one.

When you are done, save the text file as "somename.ifl" instead of "somename.txt", and you are done. FYI: It is useful to tell WindowsXP to open IFL files with a text editor as a conveniance.

In your 3d app, you then use the "somename.IFL" file as the texture for your item, instead of the actual images. IFL's are fun.

------------------------------------------------------

I saw a resource the other day that lets you put a GUI on an object, that might work for your clicky surfaces....
#6
11/27/2006 (10:39 am)
Maybe you could have an IFL that only plays when you click a side of your cube? Like, you could use the GUI resource to maybe have it just play the ifl when its clicked.

The ifl would just advance one frame and stop, til the next click...