Skip to main content
added 451 characters in body
Source Link
Blau
  • 3.4k
  • 17
  • 19

you are changing the Diffusecolor in the same effect.

so the answerthere is use different effects....no easy way to clone a model

//Initialize method
effect = new BasicEffect() { DiffuseColor = newColor }

foreach (ModelMesh mesh in model.Meshes)
{
    foreach (ModelMeshPart part in mesh.MeshParts)
    {
        part.Effect = effect;
    }
}

orso the answer is before draw set the color properly for each model

// Draw method
foreach (ModelMesh mesh in m.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
       effect.DiffuseColor = newColor;   
    }
    mesh.Draw();    
}

you are changing the Diffusecolor in the same effect.

so the answer is use different effects....

//Initialize method
effect = new BasicEffect() { DiffuseColor = newColor }

foreach (ModelMesh mesh in model.Meshes)
{
    foreach (ModelMeshPart part in mesh.MeshParts)
    {
        part.Effect = effect;
    }
}

or before draw set the color properly for each model

// Draw method
foreach (ModelMesh mesh in m.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
       effect.DiffuseColor = newColor;   
    }
    mesh.Draw();    
}

you are changing the Diffusecolor in the same effect.

there is no easy way to clone a model

so the answer is before draw set the color properly for each model

// Draw method
foreach (ModelMesh mesh in m.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
       effect.DiffuseColor = newColor;   
    }
    mesh.Draw();    
}
added 451 characters in body
Source Link
Blau
  • 3.4k
  • 17
  • 19

you are changing the Diffusecolor in the same effect.

so the answer is use different effects....

//Initialize method
effect = new BasicEffect() { DiffuseColor = newColor }

foreach (ModelMesh mesh in model.Meshes)
{
    foreach (ModelMeshPart part in mesh.MeshParts)
    {
        part.Effect = effect;
    }
}

or before draw set the color properly for each model, and apply the changes in the effect.

// Draw method
foreach (ModelMesh mesh in m.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
       effect.DiffuseColor = newColor;   
    }
    mesh.Draw();    
}

you are changing the Diffusecolor in the same effect.

so the answer is use different effects.... or before draw set the color properly for each model, and apply the changes in the effect.

you are changing the Diffusecolor in the same effect.

so the answer is use different effects....

//Initialize method
effect = new BasicEffect() { DiffuseColor = newColor }

foreach (ModelMesh mesh in model.Meshes)
{
    foreach (ModelMeshPart part in mesh.MeshParts)
    {
        part.Effect = effect;
    }
}

or before draw set the color properly for each model

// Draw method
foreach (ModelMesh mesh in m.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
       effect.DiffuseColor = newColor;   
    }
    mesh.Draw();    
}
Source Link
Blau
  • 3.4k
  • 17
  • 19

you are changing the Diffusecolor in the same effect.

so the answer is use different effects.... or before draw set the color properly for each model, and apply the changes in the effect.