예제 #1
0
파일: Level1.cs 프로젝트: pentiumx/HLSLTest
        public override void Load()
        {
            base.Load();

            PrelightingRenderer.game = game;
            debug = new Debug();

            Sky = new SkySphere(content, graphicsDevice, content.Load<TextureCube>("Textures\\SkyBox\\SkyBoxTex"), 10000);

            terrain = new Terrain(content.Load<Texture2D>("Textures\\Terrain\\terrain"), 100, 8000, -6000,
                content.Load<Texture2D>("Textures\\Terrain\\grass"), 6, new Vector3(1, -1, 0), graphicsDevice, content);
            terrain.WeightMap = content.Load<Texture2D>("Textures\\color1");
            terrain.RTexture = content.Load<Texture2D>("Textures\\Terrain\\sand");
            terrain.GTexture = content.Load<Texture2D>("Textures\\Terrain\\grass");
            terrain.BTexture = content.Load<Texture2D>("Textures\\Terrain\\stone");
            terrain.DetailTexture = content.Load<Texture2D>("Textures\\detail0");

            Water.game = game;
            water = new Water(content, graphicsDevice, new Vector3(0, -1800, -4000), new Vector2(5000, 5000));
            //water = new Water(content, device, new Vector3(0, 0, 0), new Vector2(1000, 1000), renderer);
            water.Objects.Add(Sky);
            water.Objects.Add(terrain);
            //water.Objects.Add(models[0]); water.Objects.Add(models[1]);
            foreach (Object o in Models) {
                water.Objects.Add(o);
            }
            water.Initialize();
        }
예제 #2
0
파일: Level0.cs 프로젝트: pentiumx/HLSLTest
        public override void Load()
        {
            base.Load();

            //sky = new SkySphere(content, device, content.Load<TextureCube>("OutputCube0"));//("OutputCube0"));
            //sky = new SkySphere(content, device, content.Load<TextureCube>("Cross"));//("OutputCube0"));
            Sky = new SkySphere(content, graphicsDevice, content.Load<TextureCube>("Textures\\SkyBox\\space4"), 10000);
            //Sky = new SkySphere(content, device, content.Load<TextureCube>("Textures\\Terrain\\CubeWrap"));

            // setup skymap reflection effect
            Effect cubeMapEffect = content.Load<Effect>("CubeMapReflect");
            CubeMapReflectMaterial cubeMat = new CubeMapReflectMaterial(Sky.TextureCube);
            Teapot.SetModelEffect(cubeMapEffect, false);
            Teapot.Material = cubeMat;/**/
            /*Models[3].SetModelEffect(cubeMapEffect, false);
            Models[3].Material = cubeMat;
            Models[3].Scale = 50;*/

            // projection
            /*Effect effect = content.Load<Effect>("TextureProjectionEffect");
            models[0].SetModelEffect(effect, true);
            models[1].SetModelEffect(effect, true);
            //t = content.Load<Texture2D>("Checker");//("projectedTexture");
            t = content.Load<Texture2D>("projectedTexture");
            ProjectedTextureMaterial mat = new ProjectedTextureMaterial(content.Load<Texture2D>("projectedTexture")
                , device);
            mat.ProjectorPosition = new Vector3(0, 100, 0);
            mat.ProjectorTarget = new Vector3(0, 0, 0);
            mat.Scale = 0.05f;//2
            models[0].Material = mat;
            models[1].Material = mat;*/

            // light map
            Effect shadowEffect = content.Load<Effect>("ProjectShadowDepthEffectV4");
            Effect lightingEffect = content.Load<Effect>("PPModel");	// load Prelighting Effect
            foreach (Object o in Models) {
                o.RenderBoudingSphere = false;
                o.SetModelEffect(shadowEffect, true);
            }

            renderer = new PrelightingRenderer(graphicsDevice, content);
            renderer.Models = Models;
            renderer.Camera = camera;
            renderer.Lights = new List<PointLight>() {
                new PointLightCircle(new Vector3(0, 200, 0), 200, Color.White, 2000),
                new PointLight(new Vector3(0, 500, 0), Color.White * .85f, 2000),

                /*new PointLight(new Vector3(-100, 100, 0), Color.Red * .85f,	2000),
                new PointLight(new Vector3(100, 100, 0), Color.Blue * .85f,	2000),
                new PointLight(new Vector3(0, 100, 100), Color.Green * .85f, 2000),*/
                /*new PointLight(new Vector3(-1000, 100, 0), Color.Red * .85f,	2000),
                new PointLight(new Vector3(1000, 1000, 0), Color.Blue * .85f,	2000),
                new PointLight(new Vector3(0, 1000, 1000), Color.Green * .85f, 2000),*/

                /*new PPPointLight(new Vector3(0, 200, 0), Color.White * .85f,//ew Vector3(0, 100, -100),
                20000),
                new PPPointLight(new Vector3(0, -200, 0), Color.White * .85f,//ew Vector3(0, 100, -100),
                20000)*/
            };

            // setup shadows
            /*//renderer.ShadowLightPosition = new Vector3(200, 100, 0);//new Vector3(1500, 1500, 2000);
            //renderer.ShadowLightTarget = new Vector3(-50, -50, 0);//new Vector3(0, 150, 0)
            renderer.ShadowLightPosition = new Vector3(0, 150, 0);//new Vector3(1500, 1500, 2000);
            renderer.ShadowLightTarget = new Vector3(0, 0, 0);//new Vector3(0, 150, 0)

            renderer.ShadowLightPosition = new Vector3(500, 500, 0);//new Vector3(1500, 1500, 2000);
            renderer.ShadowLightTarget = new Vector3(0, 300, 0);//new Vector3(0, 150, 0)*/
            renderer.ShadowLightPosition = new Vector3(500, 500, 0);
            renderer.ShadowLightTarget = new Vector3(0, 0, 0);

            renderer.DoShadowMapping = true;
            renderer.ShadowMult = 0.3f;//0.01f;//0.3f;

            Water.game = game;
            water = new Water(content, graphicsDevice, new Vector3(0, 0, 0), new Vector2(1000, 1000));
            //water = new Water(content, device, new Vector3(0, 0, 0), new Vector2(1000, 1000), renderer);
            water.Objects.Add(Sky);
            //water.Objects.Add(models[0]); water.Objects.Add(models[1]);
            foreach (Object o in Models) {
                water.Objects.Add(o);
            }
            water.Initialize();

            /*GlassEffect.game = this;
            glassEffect = new GlassEffect(content, device, new Vector3(0, 100, 0), 50);
            glassEffect.Objects.Add(Sky);
            foreach (Object o in Models) {
                glassEffect.Objects.Add(o);
            }
            glassEffect.Initialize();

            // 静的なオブジェクトを全て含めた環境マップ生成
            PreDrawScene(new GameTime());
            EnvironmentalMap = RenderCubeMap(new Vector3(0, 100, 0));*/

            // discoid effect : Skyの後に初期化
            EnergyRingEffect.game = game;
            discoidEffect = new EnergyRingEffect(content, graphicsDevice, new Vector3(0, 50, 0), new Vector2(300));

            // Terrain
            //terrain = new Terrain(content.Load<Texture2D>("Textures\\heightmap_01"), 30, 4800,				content.Load<Texture2D>("Textures\\Grass"), 6, new Vector3(1, -1, 0), device, content);
            //terrain = new Terrain(content.Load<Texture2D>("Textures\\terrain"), 30, 380, -200,				content.Load<Texture2D>("Textures\\Grass"), 6, new Vector3(1, -1, 0), device, content);
            //terrain = new Terrain(content.Load<Texture2D>("Textures\\terrain"), 100, 2500, -1500,				content.Load<Texture2D>("Textures\\Grass"), 6, new Vector3(1, -1, 0), device, content);
            terrain = new Terrain(content.Load<Texture2D>("Textures\\Terrain\\terrain"), 100, 2500, -1500,
                content.Load<Texture2D>("Textures\\Terrain\\grass"), 6, new Vector3(1, -1, 0), graphicsDevice, content);
            terrain.WeightMap = content.Load<Texture2D>("Textures\\color1");
            terrain.RTexture = content.Load<Texture2D>("Textures\\Terrain\\sand");
            terrain.GTexture = content.Load<Texture2D>("Textures\\Terrain\\grass");
            terrain.BTexture = content.Load<Texture2D>("Textures\\Terrain\\stone");
            terrain.DetailTexture = content.Load<Texture2D>("Textures\\detail0");

            // Planet test
            debugModel = content.Load<Model>("Models\\sphere2");
            WaterPlanet waterPlanet = new WaterPlanet(Vector3.Zero, graphicsDevice, content);
            IcePlanet icePlanet = new IcePlanet(graphicsDevice, content);
            GasGiant gasGiant = new GasGiant(graphicsDevice, content);
            RockPlanet rockPlanet = new RockPlanet(graphicsDevice, content);
            planet = rockPlanet;

            // Spherical terrain test
            sphericalTerrain = new SphericalTerrain2(content.Load<Texture2D>("Textures\\Terrain\\terrain"), 1, 50, 0,
                content.Load<Texture2D>("Textures\\Terrain\\grass"), 6, new Vector3(1, -1, 0), graphicsDevice, content);
            sphericalTerrain.WeightMap = content.Load<Texture2D>("Textures\\color1");
            sphericalTerrain.RTexture = content.Load<Texture2D>("Textures\\Terrain\\sand");
            sphericalTerrain.GTexture = content.Load<Texture2D>("Textures\\Terrain\\grass");
            sphericalTerrain.BTexture = content.Load<Texture2D>("Textures\\Terrain\\stone");
            sphericalTerrain.DetailTexture = content.Load<Texture2D>("Textures\\detail0");

            debug = new Debug();
        }