Multiple textures on a mesh created in blender and imported in xna

Posted by alecnash on Game Development See other posts from Game Development or by alecnash
Published on 2012-10-26T07:42:58Z Indexed on 2012/10/26 11:18 UTC
Read the original article Hit count: 291

Filed under:
|
|

I created a cube in blender which has multiple images applied to its faces. I am trying to import the model into xna and get the same results as shown when rendering the model in blender. I go through every mesh (for the cube its only one) and through every part but only the first image used in blender is displayed in every face. The code I am using to fetch the texture looks like that:

foreach (ModelMesh m in model.Meshes)
{                   
   foreach (Effect e in m.Effects)
   {
      foreach (var part in m.MeshParts)                   
      {
         e.CurrentTechnique = e.Techniques["Lambert"];                 
         e.Parameters["view"].SetValue(camera.viewMatrix);
         e.Parameters["projection"].SetValue(camera.projectionMatrix);
         e.Parameters["colorMap"].SetValue(modelTextures[part.GetHashCode()]);

      }
   }
   m.Draw();
}

Am I missing something?

© Game Development or respective owner

Related posts about XNA

Related posts about textures