How many (low poly) models can XNA handle?

I'm aware that the following is a vague question, but I'm hitting performance problems that I did not anticipate in XNA.

I have a low poly model (It has 18 faces and 14 vertices) that I'm trying to draw to the screen a (high!) number of times. I get over 60 FPS (on a decent machine) until I draw this model 5000+ times. Am I asking too much here? I'd very much like to double or triple that number (10-15k) at least.

My code for actually drawing the models is given below. I have tried to eliminate as much computation from the draw cycle as possible, is there more I can squeeze from it, or better alternatives all together?

Note: tile.Offset is computed once during initialisation, not every cycle.

foreach (var tile in Tiles)
        {
            var myModel = tile.Model;
            Matrix[] transforms = new Matrix[myModel.Bones.Count];
            myModel.CopyAbsoluteBoneTransformsTo(transforms);

            foreach (ModelMesh mesh in myModel.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    // effect.EnableDefaultLighting();
                    effect.World = transforms[mesh.ParentBone.Index] 
                                 * Matrix.CreateTranslation(tile.Offset);
                    effect.View = CameraManager.ViewMatrix;
                    effect.Projection = CameraManager.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
6
задан Necrototem 11 March 2011 в 02:04
поделиться