Example #1
0
        // Called when the game should load its content
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            models.Add(new CModel(Content.Load <Model>("teapot"),
                                  new Vector3(0, 60, 0), Vector3.Zero, new Vector3(60),
                                  GraphicsDevice));

            models.Add(new CModel(Content.Load <Model>("ground"),
                                  Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice));

            Effect effect = Content.Load <Effect>("ProjectedTexture");

            models[0].SetModelEffect(effect, true);
            models[1].SetModelEffect(effect, true);

            ProjectedTextureMaterial mat = new ProjectedTextureMaterial(
                Content.Load <Texture2D>("projected texture"), GraphicsDevice);

            mat.ProjectorPosition = new Vector3(0, 4500, 4500);
            mat.ProjectorTarget   = new Vector3(0, 0, 0);
            mat.Scale             = 2;

            models[0].Material = mat;
            models[1].Material = mat;

            camera = new FreeCamera(new Vector3(0, 300, 1600),
                                    MathHelper.ToRadians(0), // Turned around 153 degrees
                                    MathHelper.ToRadians(5), // Pitched up 13 degrees
                                    GraphicsDevice);

            renderer        = new PrelightingRenderer(GraphicsDevice, Content);
            renderer.Models = models;
            renderer.Camera = camera;
            renderer.Lights = new List <PPPointLight>()
            {
                new PPPointLight(new Vector3(-1000, 1000, 0), Color.Red * .85f, 2000),
                new PPPointLight(new Vector3(1000, 1000, 0), Color.Blue * .85f, 2000),
            };

            lastMouseState = Mouse.GetState();
        }
Example #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            models.Add(new CModel(Content.Load <Model>("Content/teapot__cv1"),
                                  new Vector3(0, 60, 0), Vector3.Zero, new Vector3(60),
                                  GraphicsDevice));

            models.Add(new CModel(Content.Load <Model>("Content/ground"),
                                  Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice, false));

            Effect effect = Content.Load <Effect>("Content/PPModel");

            models[0].SetModelEffect(effect, true);
            //models[1].SetModelEffect(effect, true);

            camera = new FreeCamera(new Vector3(0, 200, 600),
                                    MathHelper.ToRadians(0), // Turned around 153 degrees
                                    MathHelper.ToRadians(5), // Pitched up 13 degrees
                                    GraphicsDevice);

            renderer        = new PrelightingRenderer(GraphicsDevice, Content);
            renderer.Models = models;
            renderer.Camera = camera;
            renderer.Lights = new List <PPPointLight>()
            {
                new PPPointLight(new Vector3(-1000, 1000, 0), Color.Red * .85f, 2000),
                new PPPointLight(new Vector3(1000, 1000, 0), Color.Orange * .85f, 2000),
                new PPPointLight(new Vector3(0, 1000, 1000), Color.Yellow * .85f, 2000),
                new PPPointLight(new Vector3(0, 1000, -1000), Color.Green * .85f, 2000),
                new PPPointLight(new Vector3(1000, 1000, 1000), Color.Blue * .85f, 2000),
                new PPPointLight(new Vector3(-1000, 1000, 1000), Color.Indigo * .85f, 2000),
                new PPPointLight(new Vector3(1000, 1000, -1000), Color.Violet * .85f, 2000),
                new PPPointLight(new Vector3(-1000, 1000, -1000), Color.White * .85f, 2000)
            };

            lastMouseState = Mouse.GetState();
        }
Example #3
0
        // Called when the game should load its content
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            models.Add(new CModel(Content.Load <Model>("Content/teapot__cv1"),
                                  Vector3.Zero, Vector3.Zero, new Vector3(60),
                                  GraphicsDevice));

            models.Add(new CModel(Content.Load <Model>("Content/Ground"),
                                  Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice, false));

            Effect effect = Content.Load <Effect>("Content/VSM");

            models[0].SetModelEffect(effect, true);
            //models[1].SetModelEffect(effect, true);

            camera = new FreeCamera(new Vector3(0, 2200, -200),
                                    MathHelper.ToRadians(0),
                                    MathHelper.ToRadians(-90),
                                    GraphicsDevice);

            renderer        = new PrelightingRenderer(GraphicsDevice, Content);
            renderer.Models = models;
            renderer.Camera = camera;
            renderer.Lights = new List <PPPointLight>()
            {
                new PPPointLight(new Vector3(0, 1000, -1000), Color.White * .85f, 20000),
                new PPPointLight(new Vector3(0, 1000, 1000), Color.White * .85f, 20000),
            };
            renderer.ShadowLightPosition = new Vector3(1500, 1500, 2000);
            renderer.ShadowLightTarget   = new Vector3(0, 150, 0);
            renderer.DoShadowMapping     = true;
            renderer.ShadowMult          = 0.3f;

            lastMouseState = Mouse.GetState();
        }