BasicPaletteEffect should be derived from BasicEffect

Topics: Developer Forum
Apr 1, 2008 at 4:53 PM
Edited Apr 2, 2008 at 6:59 PM
The implementation of the BasicPaletteEffect in the Animation Componenet Library would probably be simpler to use if it was derived from the Microsoft.Xna.Framework.Graphics.BasicEffect rather than from Effect.

As to whether or not it's feasible....

This would simplify the updating the view and projection properties on all meshes w/in all models that are currently displayed.

for example...

foreach ( Model model in this.Models)
{
foreach (ModelMesh mesh in model.Meshes)
{
if(( mesh.Effects0 as BasicEffect) != null)
{
// assume that all effects are of the same type...
foreach (BasicEffect effect in mesh.Effects)
{
effect.View = this.View;
effect.Projection = this.Projection;
}
}
else if(( mesh.Effects0 as Xclna.Xna.Animation.BasicPaletteEffect) != null)
{
// assume that all effects are of the same type...
foreach (Xclna.Xna.Animation.BasicPaletteEffect effect in mesh.Effects)
{
effect.View = this.View;
effect.Projection = this.Projection;
}
}
}
}
}


could be simplified to

foreach ( CModelCollision model in this.AffectedModels)
{
model.Visible = true;

foreach (ModelMesh mesh in model.Model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.View = this.View;
effect.Projection = this.Projection;
}
}
}