I have XNA 3.1, how do I load multiple models in xna 3.1 for rendering either from array or button click or switches anything? I just need to load multiple 3d models to render.
This is the link
Where I get code, but this code is in 4.0
Model[ ] modelArray;
protected override void LoadContent()
{
modelArray = new Model[3];
modelArray[0] = Content.Load<Model>("model1");
modelArray[1] = Content.Load<Model>("model2");
modelArray[2] = Content.Load<Model>("model3");
}
protected override void Draw(GameTime time)
{
GraphicsDevice.Clear(Color.LightBlue);
foreach (Model m in modelArray)
{
foreach (BasicEffect be in m.Effects)
{
be.World = YOURWORLDMATRIX;
be.View = YOURVIEWMATRIX;
be.Projection = YOURPROJECTIONMATRIX;
}
m.Draw();
}
base.Draw(time);
}
Errors occur in this line, they show me this error:
ERROR1:'Microsoft.Xna.Framework.Graphics.Model' does not contain a definition for
'effects' and no extension method 'effects' accepting a first argument of type
'Microsoft.Xna.Framework.Graphics.Model' could be found (are you missing a
using directive or an assembly reference?)
and also same error in Draw:
'Microsoft.Xna.Framework.Graphics.Model' does not contain a definition for 'draw'
and no
extension method 'draw' accepting a first argument of type
'Microsoft.Xna.Framework.Graphics.Model' could be found (are you missing a using
directive or an assembly reference?)
in these lines
m.Effects
m.Draw();
Any solution?