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?
EDIT:
Here is the code for getting the texture from the blender and use it in the XNA:
foreach (ModelMesh mesh in model.Meshes)
{
foreach (ModelMeshPart part in mesh.MeshParts)
{
BasicEffect basicEffect = part.Effect as BasicEffect;
if (basicEffect != null)
modelTextures[part.GetHashCode()] = basicEffect.Texture;
part.Effect = material.effect;
}
}