Exemplo n.º 1
0
        protected override void LoadContent()
        {
            spriteBatch          = new SpriteBatch(GraphicsDevice);
            device               = graphics.GraphicsDevice;
            texturedEffect       = Content.Load <Effect>("effect");
            billboardGrassEffect = Content.Load <Effect>("billboardgrass");
            grassEffect          = Content.Load <Effect>("nonbillboardgrass");
            skyEffect            = Content.Load <Effect>("sky");
            pointSpriteEffect    = Content.Load <Effect>("PointSprite");
            waterEffect          = Content.Load <Effect>("watereffect");
            shadowMapEffect      = Content.Load <Effect>("shadowmap");

            enviro   = new Enviroment();
            terrain  = new TextureTerrain(this, enviro.map, enviro.texture);
            cam      = new Camera(this, new Vector3(terrain.terrainWidth / 2, 15, terrain.terrainLength / 2));
            controls = new Controls(this);
            if (enviro.billboardedGrass)
            {
                bbgrass = new BBGrass(this, terrain, enviro.grassTexture);
            }
            else
            {
                grass = new Grass(this, terrain, enviro.grassTexture);
            }
            fps   = new FrameRate();
            text  = new TextWriter(this, "font");
            sky   = new SkyBox(this, Vector3.Zero, "sky/dome2/dome");
            car   = new ModelLoader(this, "car/car", new Vector3(250, terrain.heightData[250, 230], 230), 1, 7);
            human = new ModelLoader(this, "human", new Vector3(terrain.terrainLength / 2, terrain.heightData[terrain.terrainLength / 2, terrain.terrainWidth / 2], terrain.terrainWidth / 2), 0.2f);
            moon  = new PointSprites_Single(this, new Vector3(-10000, 20000, -10000), Content.Load <Texture2D>("moon"), 5000);
            snow  = new PointSprites_Multi(this, cam.cameraPosition, Content.Load <Texture2D>("snow"), enviro.weatherParticles, 0.2f, rand);
            rain  = new PointSprites_Multi(this, cam.cameraPosition, Content.Load <Texture2D>("rain"), enviro.weatherParticles, 0.2f, rand);
            water = new Water(this, terrain.terrainWidth / 10, terrain.terrainLength / 10, 10, Content.Load <Texture2D>("water"), Content.Load <Texture2D>("waterbump"));


            for (int i = 0; i < cloudTextures.Length; i++)
            {
                cloudTextures[i] = Content.Load <Texture2D>("clouds/cloud" + i);
            }
            clouds = new PointSprites_Single[500];
            for (int i = 0; i < clouds.Length; i++)
            {
                clouds[i] = new PointSprites_Single(this, new Vector3(terrain.terrainLength / 2f + (float)(rand.NextDouble() * 2 - 1) * 10000, rand.Next(400, 600), terrain.terrainWidth / 2f + (float)(rand.NextDouble() * 2 - 1) * 10000), cloudTextures[rand.Next(0, 5)], 1000);
            }



            shadowMap = new RenderTarget2D(device, 2048, 2048);
        }
Exemplo n.º 2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            device = graphics.GraphicsDevice;
            texturedEffect = Content.Load<Effect>("effect");
            billboardGrassEffect = Content.Load<Effect>("billboardgrass");
            grassEffect = Content.Load<Effect>("nonbillboardgrass");
            skyEffect = Content.Load<Effect>("sky");
            pointSpriteEffect = Content.Load<Effect>("PointSprite");
            waterEffect = Content.Load<Effect>("watereffect");
            shadowMapEffect = Content.Load<Effect>("shadowmap");

            enviro = new Enviroment();
            terrain = new TextureTerrain(this, enviro.map, enviro.texture);
            cam = new Camera(this,new Vector3(terrain.terrainWidth/2,15,terrain.terrainLength/2));
            controls = new Controls(this);
            if (enviro.billboardedGrass)
                bbgrass = new BBGrass(this, terrain, enviro.grassTexture);
            else
                grass = new Grass(this, terrain, enviro.grassTexture);
            fps = new FrameRate();
            text = new TextWriter(this, "font");
            sky = new SkyBox(this, Vector3.Zero, "sky/dome2/dome");
            car = new ModelLoader(this, "car/car", new Vector3(250, terrain.heightData[250, 230], 230), 1, 7);
            human = new ModelLoader(this, "human", new Vector3(terrain.terrainLength / 2, terrain.heightData[terrain.terrainLength / 2, terrain.terrainWidth / 2], terrain.terrainWidth / 2), 0.2f);
            moon = new PointSprites_Single(this, new Vector3(-10000, 20000, -10000), Content.Load<Texture2D>("moon"), 5000);
            snow = new PointSprites_Multi(this, cam.cameraPosition, Content.Load<Texture2D>("snow"), enviro.weatherParticles, 0.2f, rand);
            rain = new PointSprites_Multi(this, cam.cameraPosition, Content.Load<Texture2D>("rain"), enviro.weatherParticles, 0.2f, rand);
            water = new Water(this, terrain.terrainWidth / 10, terrain.terrainLength / 10, 10, Content.Load<Texture2D>("water"), Content.Load<Texture2D>("waterbump"));

            for (int i = 0; i < cloudTextures.Length; i++)
            {
                cloudTextures[i] = Content.Load<Texture2D>("clouds/cloud" + i);
            }
            clouds = new PointSprites_Single[500];
            for (int i = 0; i < clouds.Length; i++)
            {
                clouds[i] = new PointSprites_Single(this, new Vector3(terrain.terrainLength / 2f + (float)(rand.NextDouble() * 2 - 1) * 10000, rand.Next(400, 600), terrain.terrainWidth / 2f + (float)(rand.NextDouble() * 2 - 1) * 10000), cloudTextures[rand.Next(0,5)], 1000);
            }

            shadowMap = new RenderTarget2D(device, 2048, 2048);
        }