Jump to content
  • Advertisement
Sign in to follow this  

Getting Textures from a Mesh

This topic is 3873 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using XNA to create some basic simulation. I created a model using 3D World Studio. Which I then exported to a .X file. I am using an effect file i created to light the scene. One of the parameters of the effect file is the texture that needs to be drawn. What is the best way to get the textures associated with a mesh during my drawn method? Here is the loop of my draw method:
foreach (ModelMesh mesh in buildingModel.Meshes)
                roomLighting.Parameters["World"].SetValue(transforms[mesh.ParentBone.Index] * Matrix.Identity);
                roomLighting.Parameters["modelTexture"].SetValue(currentTexture);  // <---- how do i get currentTexture

                foreach (ModelMeshPart meshPart in mesh.MeshParts)

                    graphics.GraphicsDevice.Vertices[0].SetSource(mesh.VertexBuffer, meshPart.StreamOffset, meshPart.VertexStride);
                    graphics.GraphicsDevice.VertexDeclaration = meshPart.VertexDeclaration;
                    graphics.GraphicsDevice.Indices = mesh.IndexBuffer;

                    foreach (EffectPass pass in roomLighting.CurrentTechnique.Passes)
                             meshPart.BaseVertex, 0, meshPart.NumVertices, meshPart.StartIndex, meshPart.PrimitiveCount);

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!