Example #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spriteFont = Content.Load<SpriteFont>("SpriteFont1");
            camera = new FreeCamera(new Vector3(0, 200, 0), 0, 0, 1f, 1000000.0f, graphicsDevice);
            sky = new SkyDome(game, false, camera, graphicsDevice);
            components = new Components(graphicsDevice);

            terrain.InitializeTerrin(Qtree, (FreeCamera)camera, terrain, Content.Load<Texture2D>("textures//Terrain//BasicTerrain//heightmap"), Vector3.Zero, Content, graphicsDevice);

            terrain.TerrainTextures(Qtree,
                new Texture2D[] {
                    Content.Load<Texture2D>("textures//Terrain//BasicTerrain//GroundMap"),
                }, new Texture2D[] {
                    Content.Load<Texture2D>("textures//Terrain//grass//grass"),
                }, new int[] { 1000, 100, 100, 1000, 1000, 500 }, Content);

            fire = new Fire(game);
            //fire.AddFire(new Vector3(450, Qtree.GetHeight(0, 300), 300), new Vector2(10, 50), 100, new Vector2(50), 1f, new Vector3(0), 1);

            base.LoadContent();
        }
Example #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(graphicsDevice);

            // Effect cubeMapEffect = Content.Load<Effect>("Effects//AlphaBlending");
            //   cubeMapEffect.Parameters["LightDirection"].SetValue(LightDirection);
            //   CubeMapReflectMaterial cubeMat = new CubeMapReflectMaterial(Content.Load<TextureCube>("textures//Skybox//SkyBoxTex"));

            camera = new FreeCamera(new Vector3(0, 5000, 0), 0, 0, 1f, 100000.0f, graphicsDevice);

            models.Add(new Models(Content, Content.Load<Model>("models//model1"), new Vector3(0, 0, 0), Vector3.Zero, new Vector3(20), graphicsDevice));
            // models.Add(new Models(Content.Load<Model>("models//cone"), new Vector3(0, 0, 0), Vector3.Zero, new Vector3(20), graphicsDevice));
            components = new Components(graphicsDevice);

            #region Terrain
            //BasicTerrain//heightmap
            terrain.InitializeTerrin(Qtree, (FreeCamera)camera, terrain, Content.Load<Texture2D>("textures//Terrain//terrain513"), WaterPos, Content, graphicsDevice);
            terrain.TerrainTextures(Qtree,
              new Texture2D[] {
                    Content.Load<Texture2D>("textures//Terrain//grass//GrassMap"),
                    Content.Load<Texture2D>("textures//Terrain//rock//RockMap"),
                    Content.Load<Texture2D>("textures//Terrain//sand//SandMap"),
                    Content.Load<Texture2D>("textures//Terrain//snow//SnowMap"),
                    Content.Load<Texture2D>("textures//Terrain//rocks_sand//Rocks_SandMap"),
                    Content.Load<Texture2D>("textures//Terrain//beach_sand//Beach_SandMap")
                }, new Texture2D[] {
                    Content.Load<Texture2D>("textures//Terrain//grass//grass"),
                    Content.Load<Texture2D>("textures//Terrain//rock//rock"),
                    Content.Load<Texture2D>("textures//Terrain//sand//sand"),
                    Content.Load<Texture2D>("textures//Terrain//snow//snow"),
                    Content.Load<Texture2D>("textures//Terrain//rocks_sand//rocks_sand"),
                    Content.Load<Texture2D>("textures//Terrain//beach_sand//beach_sand")
                }, new int[] { 1000, 100, 100, 1000, 1000, 500 }, Content);

            #endregion

            #region Sky
            //Sky
            sky = new SkyDome(game, false, camera, graphicsDevice);
            sky.GetData(new object[] { Qtree });
            #endregion

            UpdateLight();

            #region BillBoards
            tree = new BillboardsClass(Content, camera, graphicsDevice);
            tree.GetData(new object[] { Qtree, sky });
            tree.Initialize();
            #endregion

            //Water
            water = new Water.Water(WaveLength, WaveHeight, WaveSpeed, WaterPos, WaterSize, Content, graphicsDevice, LightDirection, LightColor, sky.sky.LightIntensity);

            worker.RunWorkerAsync();

            renderer = new Renderer(game, graphicsDevice, Content, 800, 600);
            light = new LightingClass();
            light.AddDirectionalLight(MathHelper.PiOver2, sky.Theta + MathHelper.PiOver2, 0, new Color(LightColor), sky.sky.Parameters.AmbientColor.W, 10000, 0.005f);

            #region Particles
            fire = new Fire(game);
            fire.AddFire(new Vector3(4500, Qtree.GetHeight(4500, -250), -250), new Vector2(10, 10), 200, new Vector2(20), new Vector2(1), 1, new Vector3(10, 0, 0), 1);
            fire.AddFire(new Vector3(543, Qtree.GetHeight(543, -250), -250), new Vector2(10, 10), 200, new Vector2(20), new Vector2(1), 1, new Vector3(0), 1);
            fire.AddLight(ref light);

            groundHit = new GroundHit(game);
            groundHit.AddDust(new Vector3(4000, Qtree.GetHeight(4000, -250), -250), new Vector2(10, 10), 30, new Vector2(20), new Vector2(1), 4, new Vector3(0), 0);
            #endregion

            Random random = new Random();
            for (int i = 0; i < 0; i++)
                light.AddMovingPointLight(100, 1,
                    new Color(((float)random.NextDouble() * 2 - 1) * 255,
                        ((float)random.NextDouble() * 2 - 1) * 255,
                        ((float)random.NextDouble() * 2 - 1) * 255),
                    new Vector3(((float)random.NextDouble() * 2 - 1) * 1000,
                        Qtree.GetHeight(((float)random.NextDouble() * 2 - 1) * 1000, ((float)random.NextDouble() * 2 - 1) * 1000) + 50,
                        ((float)random.NextDouble() * 2 - 1) * 1000),
                    new Vector3(((float)random.NextDouble() * 2 - 1) * 1000,
                        Qtree.GetHeight(((float)random.NextDouble() * 2 - 1) * 1000, ((float)random.NextDouble() * 2 - 1) * 1000) + 50,
                        ((float)random.NextDouble() * 2 - 1) * 1000),
                    ((float)random.NextDouble() * 2 - 1) * 5);

            light.AddSpotLight(2000, 1, 30, MathHelper.PiOver4, -MathHelper.PiOver2 / 4, 0, new Color(255, 255, 255), new Vector3(0, 1000, 100), 0.0005f);
            light.AddSpotLight(2000, 1, 30, 5 * MathHelper.PiOver4, -MathHelper.PiOver2 / 4, 0, new Color(255, 255, 255), new Vector3(0, 1000, 0), 0.0005f);

            playerManager = new PlayerManager(game, graphicsDevice);
            playerManager.GetData(new object[] { Qtree, camera });
            playerManager.Initialize();

            lensFlare = new LensFlareComponent(game, graphicsDevice);
            lensFlare.LoadContent();

            _postProcessingComponent = new PostProcessingComponent();
            _postProcessingComponent.InitComponent(Content, renderer);
            _postProcessingComponent.MainLight = light.DirLight();

            spriteFont = Content.Load<SpriteFont>("SpriteFont1");

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

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

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

            // Initialize our renderer
            DebugShapeRenderer.Initialize(GraphicsDevice);

            base.LoadContent();
        }