This project is read-only.

xen can make model Texture animation?

May 11, 2009 at 5:56 AM

For example, 

model.x use texture_x.tga 

texture_x.tga = texture_1.tga ->texture_2.tga ->texture_3.tga ->texture_4.tga ->......->loop->texture_1.tga->....

How do I Make, the use of shader?

May 11, 2009 at 6:03 AM
Edited May 11, 2009 at 6:06 AM

You can change the texture a model is using at runtime by editing the material shader it is using.

Each ModelInstance references a ModelData class. In each ModelData there is a number of MeshData classes, and in each of those, there are GeometryData classes. In GeometryData, there is a MaterialShader property - this is the default shader used when drawing the geometry for a mesh. You can set the 'TextureMap' property of the material at runtime.

So, for example, to set every texture on a model:


Texture2D myNewTexture = ...; // the texture to use
ModelInstance model = ...; // the model to change

foreach (MeshData mesh in model.ModelData.Meshes)
	foreach (GeometryData geometry in mesh.Geometry)
		geometry.MaterialShader.TextureMap = myNewTexture;