public ModelWrapper(Game game, Model model) { _model = model; _bones = new Matrix[_model.Bones.Count]; _model.CopyAbsoluteBoneTransformsTo(_bones); foreach (var mesh in _model.Meshes) { foreach (var part in mesh.MeshParts) { if (part.Effect is BasicEffect) { var oldBe = part.Effect as BasicEffect; var newBe = new StockEffects.BasicEffect(game.GraphicsDevice); newBe.CopyBasicEffect(oldBe); newBe.SpecularPower = 32; newBe.OriginalDiffuseColor = oldBe.DiffuseColor; newBe.EnableDefaultLighting(); //newBe.DiffuseColor = oldBe.DiffuseColor; //newBe.OriginalDiffuseColor = oldBe.DiffuseColor; //newBe.EmissiveColor = oldBe.EmissiveColor; //newBe.AmbientLightColor = oldBe.AmbientLightColor; part.Effect = newBe; } } } }
public ModelWrapper( Game game, Model model) { _model = model; _bones = new Matrix[_model.Bones.Count]; _model.CopyAbsoluteBoneTransformsTo(_bones); foreach (var mesh in _model.Meshes) foreach (var part in mesh.MeshParts) if (part.Effect is BasicEffect) { var oldBe = part.Effect as BasicEffect; var newBe = new StockEffects.BasicEffect(game.GraphicsDevice); newBe.CopyBasicEffect(oldBe); newBe.SpecularPower = 32; newBe.OriginalDiffuseColor = oldBe.DiffuseColor; newBe.EnableDefaultLighting(); //newBe.DiffuseColor = oldBe.DiffuseColor; //newBe.OriginalDiffuseColor = oldBe.DiffuseColor; //newBe.EmissiveColor = oldBe.EmissiveColor; //newBe.AmbientLightColor = oldBe.AmbientLightColor; part.Effect = newBe; } }