This is more a theoretical question,
during runtime, my game runs smooth without any hickups. But as standard game-objects, my game contains collectibles such as coins (which are rotating Models).
I can (again, during runtime) load 10 of those coins without getting any hickups. But as soon as I load 50 coins, the runtime freezes for some ticks and continues then.
How could I generally preload a 50-Coin case, so that the game has done all loading during load-time?
This is how I draw a single Coin (and every of those 50 get drawn like this)
public override void Draw(RenderContext renderContext)
{
var transforms = new Matrix[_model.Bones.Count];
_model.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in _model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.View = renderContext.Camera.View;
effect.Projection = renderContext.Camera.Projection;
effect.World = transforms[mesh.ParentBone.Index] * WorldMatrix;
}
mesh.Draw();
}
base.Draw(renderContext);
}
How could I draw one Model in x: 10, x: 20 and x:30 (with the other values like Y,Z or scale untouched) for instance?