This pc can run doom3 at 60FPS at that resolution and a program i wrote in MDX that draws about 1000 detailed spheres with specular lighting runs at over 100FPS
Here is the code I'm using:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
namespace WindowsGame1
{
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
CaptureZoneSystem captureZoneSystem;
ContentManager content;
Effect effect;
FirstPersonCamera camera;
float aspectRatio = 640.0f / 480.0f;
Model cubeModel;
Vector3 modelPosition = Vector3.Zero;
Vector3 cameraPosition = new Vector3(0.0f,10.0f,10.0f);
public Game1()
{
graphics = new GraphicsDeviceManager(this);
content = new ContentManager(Services);
}
private void SetUpXNADevice()
{
graphics.PreferredBackBufferWidth = 640;
graphics.PreferredBackBufferHeight = 480;
graphics.IsFullScreen = false;
graphics.ApplyChanges();
Window.Title = "XNA Test";
IsMouseVisible = true;
}
private void SetUpCamera()
{
camera = new FirstPersonCamera(this);
camera.Initialize();
}
protected override void Initialize()
{
base.Initialize();
SetUpXNADevice();
captureZoneSystem = new CaptureZoneSystem(this, content);
SetUpCamera();
}
protected override void LoadGraphicsContent(bool loadAllContent)
{
if (loadAllContent)
{
CubeMesh.Model = content.Load<Model>("Content\\Models\\cube");
}
// TODO: Load any ResourceManagementMode.Manual content
}
protected override void UnloadGraphicsContent(bool unloadAllContent)
{
if (unloadAllContent == true)
{
content.Unload();
}
}
protected override void Update(GameTime gameTime)
{
// Allows the default game to exit on Xbox 360 and Windows
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
captureZoneSystem.Update(gameTime);
camera.Update(gameTime);
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
foreach (CubeMesh cube in captureZoneSystem.capturePoints)
{
Matrix[] transforms = new Matrix[CubeMesh.Model.Bones.Count];
CubeMesh.Model.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in CubeMesh.Model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.DirectionalLight0.Direction = new Vector3(0.0f, -1.0f, -0.4f);
effect.DirectionalLight0.Enabled = true;
effect.DirectionalLight0.DiffuseColor = new Vector3(1.0f, 1.0f, 1.0f);
effect.LightingEnabled = true;
effect.AmbientLightColor = new Vector3(0.2f, 0.2f, 0.2f);
effect.DiffuseColor = cube.Color.ToVector3();
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateScale(cube.Scaling) *
Matrix.Identity *
Matrix.CreateTranslation(cube.Position) *
Matrix.CreateRotationX(MathHelper.ToRadians(captureZoneSystem.XRotation)) *
Matrix.CreateRotationY(MathHelper.ToRadians(captureZoneSystem.YRotation));
effect.View = camera.View;
effect.Projection = Matrix.CreatePerspectiveOffCenter(-1.0f * aspectRatio, 1.0f * aspectRatio, -1.0f, 1.0f, 1.0f, 1000.0f);
}
mesh.Draw();
}
}
}
}
}
All the cubes are held in a class called CaptureZoneSystem, which simply contains an arraylist CubeMesh which is shown below:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
namespace WindowsGame1
{
public class CubeMesh
{
private Vector3 myPosition;
public Vector3 Position { get { return myPosition; } set { myPosition = value; } }
private Vector3 myRotation;
public Vector3 Rotation { get { return myRotation; } set { myRotation = value; } }
private Vector3 myScaling;
public Vector3 Scaling { get { return myScaling; } set { myScaling = value; } }
private Color myColor;
public Color Color { get { return myColor; } set { myColor = value; } }
public static Model Model;
public CubeMesh()
{
myPosition = Vector3.Zero;
myRotation = Vector3.Zero;
myScaling = new Vector3(1, 1, 1);
myColor = Color.Gold;
}
public CubeMesh(Vector3 position)
{
myPosition = position;
myRotation = Vector3.Zero;
myScaling = new Vector3(1, 1, 1);
myColor = Color.Gold;
}
public CubeMesh(Vector3 position, Vector3 scaling)
{
myPosition = position;
myRotation = Vector3.Zero;
myScaling = scaling;
myColor = Color.Red;
}
}
}
The cube model is loaded in from a .x file and stored in a static member of the CubeMesh class.
Any clues as to what is causing such poor performance