/// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>

        protected override void Initialize()
        {
            mModels = new List <BaseMesh>();

            // Create our camera

            camera = new Camera();
            camera.LookAt(new Vector3(0, 5, 20), new Vector3(0, 0, 0));
            float aspect = (float)graphics.PreferredBackBufferWidth / (float)graphics.PreferredBackBufferHeight;

            camera.SetLens(MathHelper.ToRadians(45.0f), aspect, .1f, 1000.0f);
            camera.BuildView();

            // Setup our dual-paraboloid camera

            dualParaCamera = new Camera();
            dualParaCamera.LookAt(new Vector3(0.0f, 0.0f, 0.0f), Vector3.UnitZ * 6);
            dualParaCamera.SetLens(MathHelper.ToRadians(90.0f), aspect, .1f, 1000.0f);

            // Make sure to set the projection matrix to the identity matrix sence we won't be using it

            dualParaCamera.Projection = Matrix.Identity;
            dualParaCamera.BuildView();

            List <Light> lights = createLights();

            // Initialize the reflective model

            mReflector             = new BaseMesh(this);
            mReflector.MeshAsset   = "Models/Dragon";
            mReflector.EffectAsset = "Shaders/DPMReflect";
            mReflector.Position    = dualParaCamera.View.Translation;
            mReflector.Scale       = Vector3.One * 3.0f;

            mModels.Add(mReflector);

            // Initialize the Environment box

            BaseMesh mesh = new Environment(this);

            mesh.MeshAsset               = "Models/SphereHighPoly";
            mesh.Scale                   = Vector3.One * 500.0f;
            mesh.EffectAsset             = "Shaders/EnvironmentMap";
            mesh.TextureAsset            = "Textures/whitetex";
            mesh.EnvironmentTextureAsset = "Textures/graceCUBE";

            mModels.Add(mesh);

            // Initialize the impostors

            BaseMesh quadMesh = new BaseMesh(this);

            quadMesh.Position       = new Vector3(0, -5f, 0);
            quadMesh.Rotation       = 0f;
            quadMesh.Scale          = new Vector3(1.5f);
            quadMesh.MeshAsset      = "Models/Ground";
            quadMesh.EffectAsset    = "Shaders/Texture";
            quadMesh.TextureAsset   = "Textures/wood";
            quadMesh.EnableLighting = false;

            mModels.Add(quadMesh);

            float p = 0.0f, y = 0.0f;

            for (int i = 0; i < 8; i++)
            {
                Vector3 pos = Vector3.Zero;
                pos.Y = y;

                p += 1.0f / 8.0f;
                Vector2 pos2 = Utils.GetVector2FromPolarCoord(p) * 8.0f;
                pos.X = pos2.X;
                pos.Z = pos2.Y;

                mesh              = new BaseMesh(this);
                mesh.Position     = pos;
                mesh.Scale        = Vector3.One * 1.0f;
                mesh.RotationAxis = Vector3.UnitY;
                mesh.Rotation     = 1.0f;
                mesh.EffectAsset  = "Shaders/Phong";
                mesh.MeshAsset    = "Models/SphereHighPoly";
                mesh.TextureAsset = "Textures/whitetex";
                mesh.Lights       = lights;

                mModels.Add(mesh);
            }

            // Initialize the render targets for the paraboloid maps

            int width  = graphics.PreferredBackBufferWidth;
            int height = graphics.PreferredBackBufferHeight;

            mDPMapFront = new RenderTarget2D(GraphicsDevice, width, height, true,
                                             SurfaceFormat.Color, DepthFormat.Depth24);
            mDPMapBack = new RenderTarget2D(GraphicsDevice, width, height, true,
                                            SurfaceFormat.Color, DepthFormat.Depth24);

            // Finally, initialize the models

            foreach (BaseMesh model in mModels)
            {
                model.Initialize();
            }

            base.Initialize();
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>

        protected override void Initialize()
        {
            mModels = new List<BaseMesh>();

            // Create our camera

            camera = new Camera();
            camera.LookAt(new Vector3(0, 5, 20), new Vector3(0, 0, 0));
			float aspect = (float)graphics.PreferredBackBufferWidth / (float)graphics.PreferredBackBufferHeight;
            camera.SetLens(MathHelper.ToRadians(45.0f), aspect, .1f, 1000.0f);
            camera.BuildView();

            // Setup our dual-paraboloid camera

            dualParaCamera = new Camera();
            dualParaCamera.LookAt(new Vector3(0.0f, 0.0f, 0.0f), Vector3.UnitZ * 6);
            dualParaCamera.SetLens(MathHelper.ToRadians(90.0f), aspect, .1f, 1000.0f);

            // Make sure to set the projection matrix to the identity matrix sence we won't be using it

            dualParaCamera.Projection = Matrix.Identity;
            dualParaCamera.BuildView(); 

            List<Light> lights = createLights();

			// Initialize the reflective model

            mReflector = new BaseMesh(this);
			mReflector.MeshAsset = "Models/Dragon";
            mReflector.EffectAsset = "Shaders/DPMReflect";
			mReflector.Position = dualParaCamera.View.Translation;
            mReflector.Scale = Vector3.One * 3.0f;

            mModels.Add(mReflector);
			
            // Initialize the Environment box

            BaseMesh mesh = new Environment(this);
			mesh.MeshAsset = "Models/SphereHighPoly";
            mesh.Scale = Vector3.One * 500.0f;
            mesh.EffectAsset = "Shaders/EnvironmentMap";
            mesh.TextureAsset = "Textures/whitetex";
            mesh.EnvironmentTextureAsset = "Textures/graceCUBE";

            mModels.Add(mesh);

            // Initialize the impostors

			BaseMesh quadMesh = new BaseMesh(this);
			quadMesh.Position = new Vector3(0, -5f, 0);
			quadMesh.Rotation = 0f;
			quadMesh.Scale = new Vector3(1.5f);
			quadMesh.MeshAsset = "Models/Ground";
			quadMesh.EffectAsset = "Shaders/Texture";
			quadMesh.TextureAsset = "Textures/wood";
			quadMesh.EnableLighting = false;

			mModels.Add(quadMesh);

            float p = 0.0f, y = 0.0f;

            for (int i = 0; i < 8; i++)
            {
                Vector3 pos = Vector3.Zero;
                pos.Y = y;

                p += 1.0f / 8.0f;
                Vector2 pos2 = Utils.GetVector2FromPolarCoord(p) * 8.0f;
                pos.X = pos2.X;
                pos.Z = pos2.Y;

                mesh = new BaseMesh(this);
                mesh.Position = pos;
                mesh.Scale = Vector3.One * 1.0f;
                mesh.RotationAxis = Vector3.UnitY;
                mesh.Rotation = 1.0f;
                mesh.EffectAsset = "Shaders/Phong";
				mesh.MeshAsset = "Models/SphereHighPoly";
                mesh.TextureAsset = "Textures/whitetex";
                mesh.Lights = lights;

                mModels.Add(mesh);
            }

			// Initialize the render targets for the paraboloid maps

			int width = graphics.PreferredBackBufferWidth;
			int height = graphics.PreferredBackBufferHeight;
            mDPMapFront = new RenderTarget2D(GraphicsDevice, width, height, true, 
				SurfaceFormat.Color, DepthFormat.Depth24);
            mDPMapBack = new RenderTarget2D(GraphicsDevice, width, height, true, 
				SurfaceFormat.Color, DepthFormat.Depth24);

            // Finally, initialize the models

            foreach (BaseMesh model in mModels)
			{
                model.Initialize();
			}

            base.Initialize();
        }