예제 #1
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();
        }
예제 #2
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();
        }