示例#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>("Content/ground"),
                                  Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice, false));

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

            LightingMaterial mat = new LightingMaterial();

            mat.SpecularColor = Color.Black.ToVector3();

            //models[0].SetModelEffect(effect, true);
            //models[0].Material = mat;

            camera = new FreeCamera(new Vector3(0, 700, 3000),
                                    MathHelper.ToRadians(0),
                                    MathHelper.ToRadians(5),
                                    GraphicsDevice);

            ps = new ParticleSystem(GraphicsDevice, Content, Content.Load <Texture2D>("Content/fire"),
                                    400, new Vector2(400), 1, Vector3.Zero, 0.5f);

            smoke = new ParticleSystem(GraphicsDevice, Content, Content.Load <Texture2D>("Content/smoke"),
                                       400, new Vector2(800), 6, new Vector3(500, 0, 0), 5f);

            lastMouseState = Mouse.GetState();
        }
示例#2
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 simpleEffect = Content.Load <Effect>("LightingEffect");

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

            LightingMaterial mat = new LightingMaterial();

            mat.AmbientColor = Color.Red.ToVector3() * .15f;
            mat.LightColor   = Color.Blue.ToVector3() * .85f;

            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);

            lastMouseState = Mouse.GetState();
        }
示例#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/grass_ground"),
                                  Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice, false));

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

            LightingMaterial mat = new LightingMaterial();

            mat.SpecularColor = Color.Black.ToVector3();

            //models[0].SetModelEffect(effect, true);
            //models[0].Material = mat;

            camera = new FreeCamera(new Vector3(0, 700, 3000),
                                    MathHelper.ToRadians(0),
                                    MathHelper.ToRadians(5),
                                    GraphicsDevice);

            // Generate random tree positions
            Random r = new Random();

            Vector3[] positions = new Vector3[200];

            for (int i = 0; i < positions.Length; i++)
            {
                positions[i] = new Vector3(
                    (float)r.NextDouble() * 20000 - 10000,
                    400,
                    (float)r.NextDouble() * 20000 - 10000
                    );
            }

            trees = new BillboardCross(GraphicsDevice, Content,
                                       Content.Load <Texture2D>("Content/tree_billboard"), new Vector2(800),
                                       positions);

            //trees.Mode = BillboardSystem.BillboardMode.Cylindrical;

            Vector3[] cloudPositions = new Vector3[350];

            for (int i = 0; i < cloudPositions.Length; i++)
            {
                cloudPositions[i] = new Vector3(
                    r.Next(-6000, 6000),
                    r.Next(2000, 3000),
                    r.Next(-6000, 6000));
            }

            clouds = new BillboardSystem(GraphicsDevice, Content,
                                         Content.Load <Texture2D>("Content/cloud2"), new Vector2(1000),
                                         cloudPositions);

            clouds.EnsureOcclusion = false;

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

            camera = new FreeCamera(new Vector3(1000, 650, 1000),
                                    MathHelper.ToRadians(45),
                                    MathHelper.ToRadians(-30),
                                    GraphicsDevice);

            Effect           effect = Content.Load <Effect>("Content/LightingEffect");
            LightingMaterial mat    = new LightingMaterial();

            for (int z = -1; z <= 1; z++)
            {
                for (int x = -1; x <= 1; x++)
                {
                    CModel model = new CModel(Content.Load <Model>("Content/teapot__cv1"),
                                              new Vector3(x * 500, 0, z * 500), Vector3.Zero,
                                              Vector3.One * 50, GraphicsDevice);

                    model.SetModelEffect(effect, true);
                    model.SetModelMaterial(mat);

                    model.Model.Meshes[0].MeshParts[0].Effect.Parameters["BasicTexture"].SetValue(
                        Content.Load <Texture2D>("Content/brick_texture_map"));
                    model.Model.Meshes[0].MeshParts[0].Effect.Parameters["TextureEnabled"].SetValue(true);

                    models.Add(model);
                }
            }

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

            //ground.SetModelEffect(effect, true);
            //ground.SetModelMaterial(mat);

            models.Add(ground);

            renderCapture = new RenderCapture(GraphicsDevice);
            postprocessor = new GaussianBlur(GraphicsDevice, Content, 2);

            depthEffect = Content.Load <Effect>("Content/DepthEffect");
            //depthCapture = new RenderCapture(GraphicsDevice, SurfaceFormat.HalfSingle);
            depthCapture = new RenderCapture(GraphicsDevice);

            blurCapture = new RenderCapture(GraphicsDevice, SurfaceFormat.Color);
            dof         = new DepthOfField(GraphicsDevice, Content);

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

            camera = new FreeCamera(new Vector3(1000, 650, 1000),
                                    MathHelper.ToRadians(45),
                                    MathHelper.ToRadians(-30),
                                    GraphicsDevice);

            Effect           effect = Content.Load <Effect>("Content/LightingEffect");
            LightingMaterial mat    = new LightingMaterial();

            for (int z = -1; z <= 1; z++)
            {
                for (int x = -1; x <= 1; x++)
                {
                    CModel model = new CModel(Content.Load <Model>("Content/glow_teapot__cv1"),
                                              new Vector3(x * 500, 0, z * 500), Vector3.Zero,
                                              Vector3.One * 5, GraphicsDevice);

                    model.SetModelEffect(effect, true);
                    model.SetModelMaterial(mat);

                    models.Add(model);
                }
            }

            CModel ground = new CModel(Content.Load <Model>("Content/glow_plane__cv1"),
                                       Vector3.Zero, Vector3.Zero, Vector3.One * 6, GraphicsDevice);

            ground.SetModelEffect(effect, true);
            ground.SetModelMaterial(mat);

            models.Add(ground);

            renderCapture = new RenderCapture(GraphicsDevice);
            glowCapture   = new RenderCapture(GraphicsDevice);

            glowEffect = Content.Load <Effect>("Content/GlowEffect");
            glowEffect.Parameters["GlowTexture"].SetValue(
                Content.Load <Texture2D>("Content/glow_map"));

            blur = new GaussianBlur(GraphicsDevice, Content, 4);

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

            camera = new FreeCamera(new Vector3(100, 65, 100),
                                    MathHelper.ToRadians(45),
                                    MathHelper.ToRadians(-30),
                                    GraphicsDevice);

            Effect lit    = Content.Load <Effect>("Content/LightingEffect");
            Effect normal = Content.Load <Effect>("Content/NormalMapEffect");

            LightingMaterial marble = new LightingMaterial();

            marble.SpecularColor = Color.White.ToVector3();

            LightingMaterial steel = new LightingMaterial();

            steel.SpecularColor = Color.Gray.ToVector3();

            NormalMapMaterial brick = new NormalMapMaterial(
                Content.Load <Texture2D>("Content/brick_normal_map"));

            NormalMapMaterial wood = new NormalMapMaterial(
                Content.Load <Texture2D>("Content/wood_normal"));

            CModel model = new CModel(Content.Load <Model>("Content/multimesh__cv1"),
                                      Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice);

            model.SetMeshEffect("Box01", normal, true);
            model.SetMeshMaterial("Box01", wood);

            model.SetMeshEffect("Pyramid01", normal, true);
            model.SetMeshMaterial("Pyramid01", brick);

            model.SetMeshEffect("Sphere01", lit, true);
            model.SetMeshMaterial("Sphere01", marble);

            model.SetMeshEffect("Plane01", lit, true);
            model.SetMeshMaterial("Plane01", steel);

            models.Add(model);

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

            camera = new FreeCamera(new Vector3(1000, 650, 1000),
                                    MathHelper.ToRadians(45),
                                    MathHelper.ToRadians(-30),
                                    GraphicsDevice);

            Effect           effect = Content.Load <Effect>("LightingEffect");
            LightingMaterial mat    = new LightingMaterial();

            for (int z = -1; z <= 1; z++)
            {
                for (int x = -1; x <= 1; x++)
                {
                    CModel model = new CModel(Content.Load <Model>("teapot"),
                                              new Vector3(x * 500, 0, z * 500), Vector3.Zero,
                                              Vector3.One * 50, GraphicsDevice);

                    model.SetModelEffect(effect, true);
                    model.SetModelMaterial(mat);

                    model.Model.Meshes[0].MeshParts[0].Effect.Parameters["BasicTexture"].SetValue(
                        Content.Load <Texture2D>("brick_texture_map"));
                    model.Model.Meshes[0].MeshParts[0].Effect.Parameters["TextureEnabled"].SetValue(true);

                    models.Add(model);
                }
            }

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

            ground.SetModelEffect(effect, true);
            ground.SetModelMaterial(mat);

            models.Add(ground);

            renderCapture = new RenderCapture(GraphicsDevice);
            postprocessor = new PostProcessor(Content.Load <Effect>("BWPostProcessor"),
                                              GraphicsDevice);

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

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

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

            Effect           lightingEffect = Content.Load <Effect>("LightingEffect");
            LightingMaterial lightingMat    = new LightingMaterial();

            Effect            normalMapEffect = Content.Load <Effect>("NormalMapEffect");
            NormalMapMaterial normalMat       = new NormalMapMaterial(
                Content.Load <Texture2D>("brick_normal_map"));

            lightingMat.LightDirection = new Vector3(.5f, .5f, 1);
            lightingMat.LightColor     = Vector3.One;

            normalMat.LightDirection = new Vector3(.5f, .5f, 1);
            normalMat.LightColor     = Vector3.One;

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

            models[0].Material = lightingMat;
            models[1].Material = normalMat;

            camera = new FreeCamera(new Vector3(0, 400, 1400),
                                    MathHelper.ToRadians(0),
                                    MathHelper.ToRadians(0),
                                    GraphicsDevice);

            sky = new SkySphere(Content, GraphicsDevice,
                                Content.Load <TextureCube>("clouds"));

            lastMouseState = Mouse.GetState();
        }