Exemplo n.º 1
0
        // Constructor
        public GlassEffect(ContentManager content, GraphicsDevice graphics, Vector3 position, float Scale)
        {
            this.content = content;
            this.graphics = graphics;
            //waterMesh = new Object(content.Load<Model>("plane"), position, Vector3.Zero, new Vector3(size.X, 1, size.Y), graphics);
            glassMesh = new Object(position, "Models\\SkySphereMesh");
            glassMesh.Scale = Scale;
            //glassMesh.ScaleVector = new Vector3(size.X, size.Y, 1);// 元々Blenderで作成した素材なので傾いている。それに合わせて、rescaleする成分を調整
            /*glassMesh.RotationMatrix = Matrix.Identity * Matrix.CreateRotationZ(MathHelper.ToRadians(90))
                * Matrix.CreateRotationX(MathHelper.ToRadians(-90));*/

            glassEffect = content.Load<Effect>("Lights\\GlassEffectV2");
            glassMesh.SetModelEffect(glassEffect, false);
            //glassEffect.Parameters["viewportWidth"].SetValue(graphics.Viewport.Width);
            //glassEffect.Parameters["viewportHeight"].SetValue(graphics.Viewport.Height);

            //reflectionTarg = new RenderTarget2D(graphics, graphics.Viewport.Width, graphics.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24);
            reflectionTarget = new RenderTarget2D(graphics, graphics.Viewport.Width, graphics.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24);
            refractionTarget = new RenderTarget2D(graphics, graphics.Viewport.Width, graphics.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24);
            //PresentationParameters pp = graphics.PresentationParameters;
            //reflectionTarg = new RenderTarget2D(graphics, pp.BackBufferWidth, pp.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24);
            //reflectionTarg = new RenderTarget2D(graphics, 2048, 2048, false, SurfaceFormat.Color, DepthFormat.Depth24);

            //glassEffect.Parameters["WaterNormalMap"].SetValue(content.Load<Texture2D>("waterbump"));
            //glassEffect.Parameters["Mask"].SetValue(content.Load<Texture2D>("Textures\\cloud_mask2"));

            if (renderer == null) {
                renderer = new PrelightingRenderer(graphics, content);
            }
            renderer = new PrelightingRenderer(graphics, content);
            renderer.Models = level.Models;
            renderer.Lights = new List<PointLight>() {
                new PointLight(new Vector3(0, 200, 0), Color.White * .85f,//ew Vector3(0, 100, -100),
                20000),
                new PointLight(new Vector3(0, -200, 0), Color.White * .85f,//ew Vector3(0, 100, -100),
                20000)
            };
            // setup shadows
            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.DoShadowMapping = true;
            renderer.ShadowMult = 0.3f;//0.01f;//0.3f;
        }
Exemplo n.º 2
0
        public override void Load()
        {
            base.Load();

            // Set up the reference grid and sample camera
            grid.LoadGraphicsContent(graphicsDevice);

            Sky = new SkySphere(content, graphicsDevice, content.Load<TextureCube>("Textures\\SkyBox\\space4"), 100);// set 11 for debug

            // Load stars
            star = new Star(new Vector3(-500, 100, 500), graphicsDevice, content, StarType.G);
            //star = new Star(-LightPosition, device, content, StarType.G);
            LightPosition = star.Position;
            //sun = new Sun(new Vector3(-500, 100, 500), graphicsDevice, content, spriteBatch);
            sun = new Sun(new Vector3(-2000, 500, 2000), graphicsDevice, content, spriteBatch);
            sunCircle = new Sun(LightPosition, graphicsDevice, content, spriteBatch);

            // Load planets
            Planets = new List<Planet>();
            TargetPlanets = new List<DamageablePlanet>();
            //WaterPlanet waterPlanet = new WaterPlanet(new Vector3(-1000, 0, -1000), -LightPosition, device, content);
            WaterPlanet waterPlanet = new WaterPlanet(new Vector3(-100, 100, -100), LightPosition, graphicsDevice, content);
            IcePlanet icePlanet = new IcePlanet(new Vector3(-100, 100, -800), LightPosition, graphicsDevice, content);
            GasGiant gasGiant = new GasGiant(new Vector3(-100, 100, -2500), LightPosition, graphicsDevice, content);
            RockPlanet rockPlanet = new RockPlanet(graphicsDevice, content);
            MoltenPlanet moltenPlanet = new MoltenPlanet(graphicsDevice, content);

            //planet = moltenPlanet;
            //planet = gasGiant;
            //planet = icePlanet;
            planet = waterPlanet;
            //Planets.Add(waterPlanet);
            TargetPlanets.Add(waterPlanet);
            Planets.Add(icePlanet);
            Planets.Add(gasGiant);

            // Load asteroids
            random = new Random();
            Asteroids = new List<Asteroid>();
            AddAsteroids(5, 2000);
            /*foreach (Asteroid o in Asteroids) {
                Models.Add(o);
            }*/
            foreach (Object o in Asteroids) {
                Enemies.Add(o);
            }
            spawned = true;

            // Load satellites
            //Satellite = new ArmedSatellite(new Vector3(300, 50, 300), star.Position, 5, "Models\\ISS", "SoundEffects\\laser1");
            Satellite = new ArmedSatellite(new Vector3(300, 50, 300), sun.Position, 5, "Models\\ISS", "SoundEffects\\laser0");
            Models.Add(Satellite);
            //Models.Add(new Satellite(false, waterPlanet.Position + new Vector3(400, 100, 600), waterPlanet.Position, 100f, "Models\\spacestation4"));
            Models.Add(new SpaceStation(false, waterPlanet.Position + new Vector3(400, 100, 600), waterPlanet.Position, 100f, "Models\\spacestation4"));

            //Models.Add(new ArmedSatellite(waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 0.01f, "Models\\TDRS", "SoundEffects\\License\\LAAT0"));
            Models.Add(new ArmedSatellite(SatelliteWeapon.Missile, waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 10f, "Models\\Dawn", "SoundEffects\\missile0"));// deepspace,10 / rosetta,10

            //Models.Add(new ArmedSatellite(waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 0.01f, "Models\\TDRS", "SoundEffects\\laser0"));

            // Load fighters
            //Models.Add(new Fighter(new Vector3(2000, 50, 1000), waterPlanet.Position, 20f, "Models\\fighter0"));
            //Enemies.Add(Models[Models.Count - 1]);
            Fighters = new List<Fighter>();
            Fighters.Add(new Fighter(new Vector3(2000, 50, 1000), waterPlanet.Position, 20f, "Models\\fighter0"));
            Fighters.Add(new Fighter(new Vector3(100, 1000, 100), waterPlanet.Position, 20f, "Models\\fighter0"));
            Fighters.Add(new Fighter(new Vector3(-100, -1000, -100), waterPlanet.Position, 20f, "Models\\fighter0"));
            Fighters.Add(new Fighter(new Vector3(-2000, 50, -1000), waterPlanet.Position, 20f, "Models\\fighter0"));
            foreach (Fighter f in Fighters) {
                Enemies.Add(f);
            }
            foreach (Object o in Enemies) {
                Models.Add(o);
            }

            // Set up light effects !!
            shadowEffect = content.Load<Effect>("ProjectShadowDepthEffectV4");
            Effect lightingEffect = content.Load<Effect>("PPModel");	// load Prelighting Effect
            foreach (Object o in Models) {
                o.RenderBoudingSphere = false;
                if (!(o is Asteroid)) {
                    o.SetModelEffect(shadowEffect, true);
                }
            }
            foreach (Planet p in Planets) {
                p.RenderBoudingSphere = false;
                //p.SetModelEffect(shadowEffect, true);
                Models.Add(p);
            }
            foreach (DamageablePlanet p in TargetPlanets) {
                p.RenderBoudingSphere = false;
                //p.SetModelEffect(shadowEffect, true);
                Models.Add(p);
            }

            renderer = new PrelightingRenderer(graphicsDevice, content);
            renderer.Models = Models;
            renderer.Camera = camera;
            renderer.Lights = new List<PointLight>() {
                //new PointLightCircle(new Vector3(0, 1000, 0), 2000, Color.White, 2000),	// 影のデバッグ用
                //new PointLight(new Vector3(0, 500, 0), Color.White, 2000),				// 太陽の光源
                new PointLight(sun.Position, Color.White, 5000),							// 太陽の光源
                new PointLight(new Vector3(0, 10000, 0), Color.White * .85f, 100000),		// シーン全体を照らす巨大なライトにする
            };
            renderer.ShadowLightPosition = new Vector3(300, 500, 300);//LightPosition;
            renderer.ShadowLightTarget = new Vector3(0, 0, 0);
            renderer.DoShadowMapping = true;
            renderer.ShadowMult = 0.3f;//0.01f;//0.3f;
            LightPosition = renderer.Lights[0].Position;

            // Special effects
            EnergyRingEffect.game = game;
            discoidEffect = new EnergyRingEffect(content, graphicsDevice, new Vector3(0, 0, 0), new Vector2(300));
            EnergyShieldEffect.game = game;
            shieldEffect = new EnergyShieldEffect(content, graphicsDevice, Satellite.Position, new Vector2(300), 250);
            explosionTest = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, true, "Xml\\Particle\\particleExplosion0.xml", true);
            smallExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion0.xml", false);
            //smallExplosion = new ExplosionEffect(content, device, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion0.xml", true);
            bigExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion1.xml", false);
            midExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion2.xml", false);

            lb = new LaserBillboard(graphicsDevice, content, content.Load<Texture2D>("Textures\\Laser2"), new Vector2(300, 50), new Vector3(0, 50, 0), new Vector3(100, 60, -100));
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        public override void Load()
        {
            base.Load();

            // Set up the reference grid and sample camera
            grid.LoadGraphicsContent(graphicsDevice);

            Sky = new SkySphere(content, graphicsDevice, content.Load<TextureCube>("Textures\\SkyBox\\space4"), 100);// set 11 for debug

            // Load stars
            star = new Star(new Vector3(-500, 100, 500), graphicsDevice, content, StarType.G);
            //star = new Star(-LightPosition, device, content, StarType.G);
            LightPosition = star.Position;
            sun = new Sun(new Vector3(-500, 100, 500), graphicsDevice, content, spriteBatch);
            sunCircle = new Sun(LightPosition, graphicsDevice, content, spriteBatch);

            // Load planets
            Planets = new List<Planet>();
            //WaterPlanet waterPlanet = new WaterPlanet(new Vector3(-1000, 0, -1000), -LightPosition, device, content);
            WaterPlanet waterPlanet = new WaterPlanet(new Vector3(-100, 100, -100), LightPosition, graphicsDevice, content);
            IcePlanet icePlanet = new IcePlanet(new Vector3(-100, 100, -800), LightPosition, graphicsDevice, content);
            GasGiant gasGiant = new GasGiant(new Vector3(-100, 100, -2500), LightPosition, graphicsDevice, content);
            RockPlanet rockPlanet = new RockPlanet(graphicsDevice, content);
            MoltenPlanet moltenPlanet = new MoltenPlanet(graphicsDevice, content);

            //planet = moltenPlanet;
            //planet = gasGiant;
            //planet = icePlanet;
            planet = waterPlanet;
            Planets.Add(waterPlanet);
            Planets.Add(icePlanet);
            Planets.Add(gasGiant);

            // Asteroids
            random = new Random();
            Asteroids = new List<Asteroid>();
            AddAsteroids(5, 2000);
            foreach (Object o in Asteroids) {
                Models.Add(o);
            }
            spawned = true;

            // Load satellites
            //Satellite = new ArmedSatellite(new Vector3(300, 50, 300), star.Position, 5, "Models\\ISS", "SoundEffects\\laser1");
            Satellite = new ArmedSatellite(new Vector3(300, 50, 300), star.Position, 5, "Models\\ISS", "SoundEffects\\laser0");
            Models.Add(Satellite);
            Models.Add(new ArmedSatellite(waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 0.01f, "Models\\TDRS", "SoundEffects\\License\\LAAT0"));
            //Models.Add(new ArmedSatellite(waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 0.01f, "Models\\TDRS", "SoundEffects\\laser0"));

            // Set up light effects !!
            shadowEffect = content.Load<Effect>("ProjectShadowDepthEffectV4");
            Effect lightingEffect = content.Load<Effect>("PPModel");	// load Prelighting Effect
            foreach (Object o in Models) {
                if (o is Satellite) {
                    string d = "";
                }
                o.RenderBoudingSphere = false;
                o.SetModelEffect(shadowEffect, true);
            }
            foreach (Planet p in Planets) {
                p.RenderBoudingSphere = false;
                //p.SetModelEffect(shadowEffect, true);
                Models.Add(p);
            }

            renderer = new PrelightingRenderer(graphicsDevice, content);
            renderer.Models = Models;
            renderer.Camera = camera;
            renderer.Lights = new List<PointLight>() {
                new PointLightCircle(new Vector3(0, 1000, 0), 2000, Color.White, 2000),
                new PointLight(new Vector3(0, 500, 0), Color.LightBlue, 2000),
                new PointLight(new Vector3(0, 10000, 0), Color.White * .85f, 100000),// シーン全体を照らす巨大なライトにする
                //new PointLightCircle(new Vector3(0, 200, 0), 200, Color.White, 2000),
                //new PointLight(LightPosition, Color.White * .85f, 2000000),
                //new PointLight(new Vector3(0, 200, 0), Color.White * .85f, 100000),
            };
            renderer.ShadowLightPosition = new Vector3(300, 500, 300);//LightPosition;
            renderer.ShadowLightTarget = new Vector3(0, 0, 0);
            renderer.DoShadowMapping = true;
            renderer.ShadowMult = 0.3f;//0.01f;//0.3f;
            LightPosition = renderer.Lights[0].Position;

            // Special effects
            EnergyRingEffect.game = game;
            discoidEffect = new EnergyRingEffect(content, graphicsDevice, new Vector3(0, 0, 0), new Vector2(300));
            EnergyShieldEffect.game = game;
            shieldEffect = new EnergyShieldEffect(content, graphicsDevice, Satellite.Position, new Vector2(300), 250);
            explosionTest = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, true, "Xml\\Particle\\particleExplosion0.xml", true);
            smallExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion0.xml", false);
            //smallExplosion = new ExplosionEffect(content, device, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion0.xml", true);
            bigExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion1.xml", false);

            // pre-load
            //setting = new ParticleSettings("Xml\\Particle\\particleExplosion0");

            lb = new LaserBillboard(graphicsDevice, content, content.Load<Texture2D>("Textures\\Laser2"), new Vector2(300, 50), new Vector3(0, 50, 0), new Vector3(100, 60, -100));
        }
Exemplo n.º 5
0
        /// <summary>
        /// ゲームの開始前に実行する必要がある初期化を実行できるようにします。
        /// ここで、要求されたサービスを問い合わせて、非グラフィック関連のコンテンツを読み込むことができます。
        /// base.Initialize を呼び出すと、任意のコンポーネントが列挙され、
        /// 初期化もされます。
        /// </summary>
        protected override void Initialize()
        {
            // TODO: ここに初期化ロジックを追加します。
            KeyConfig.LoadXML("KeyConfig", "Xml\\KeyConfig.xml");

            Object.game = this;
            Object.content = Content;

            Target = new Object(new Vector3(0, 20, 0), "Models\\cube");
            Target.Scale = 20;
            //Target = new Object(new Vector3(0, 0, 0), "Models\\tank");
            //Target.Scale = 0.1f;
            Ground = new Object(new Vector3(0, -50, 0), "Models\\ground");
            Teapot = new Object(new Vector3(-100, 0, 0), "Models\\UtahTeapotDef");

            Target.Direction = Vector3.UnitX;
            Ground.Scale = 0.05f;
            Teapot.Scale = 10;
            //Teapot.RotationMatrix = Matrix.CreateRotationZ(MathHelper.ToRadians(-180));
            Teapot.RotationMatrix = Matrix.Identity * Matrix.CreateRotationZ(MathHelper.ToRadians(90))
                * Matrix.CreateRotationX(MathHelper.ToRadians(-90));
            Models = new List<Object>();
            Models.Add(Ground);
            Models.Add(Target);
            Models.Add(Teapot);
            Models.Add(new Object(new Vector3(0, 150, 0), "Models\\SkySphereMesh"));

            camera = new ArcBallCamera();
            camera.Initialize(this, Target);
            ParticleEmitter.camera = camera;

            // Generate random tree positions
            Random r = new Random();
            Vector3[] positions = new Vector3[100];
            for (int i = 0; i < positions.Length; i++) {
                //positions[i] = new Vector3((float)r.NextDouble() * 20000 - 10000, 400, (float)r.NextDouble() * 20000 - 10000);
                //positions[i] = new Vector3((float)r.NextDouble() * 200 - 100, 256, (float)r.NextDouble() * 200 - 100);
                positions[i] = new Vector3((float)r.NextDouble() * 200 - 100, 10, (float)r.NextDouble() * 200 - 100);
            }
            //trees = new BillboardSystem(GraphicsDevice, Content, Content.Load<Texture2D>("tree"), new Vector2(800), positions);
            trees = new BillboardSystem(GraphicsDevice, Content, Content.Load<Texture2D>("tree"), new Vector2(10), positions);

            // Generate clouds
            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));
                    r.Next(-6000, 6000), r.Next(2000, 3000), r.Next(-6000, 6000));
            }
            clouds = new BillboardSystem(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\cloud"), new Vector2(500), cloudPositions);
            clouds.EnsureOcclusion = false;

            // Generate particles
            ps = new FlameParticleEmitter(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\fire"), Vector3.Zero, 1000, new Vector2(10), 10, Vector3.Zero, 0.01f);// 0.1f
            /*eps = new ExplosionParticleEmitter(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\explosion"), Vector3.Zero, 2000, new Vector2(50), 20, 5f);
            discoid = new DiscoidParticleEmitter(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\sun_1"), Vector3.Zero, 10000, new Vector2(5), 20, 5f);*/
            eps = new ExplosionParticleEmitter(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\nova_2"), Vector3.Zero, 2000, new Vector2(10), 20, 5f);
            discoid = new DiscoidParticleEmitter(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\nova_2"), Vector3.Zero, 10000, new Vector2(5), 20, 5f);
            basicEmitter = new ParticleEmitter(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\Mercury\\Star"), new Vector3(0, 50, 0), 100, new Vector2(3), 3, 0.1f);
            beamEmitter = new ParticleEmitter(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\Mercury\\Beam"), new Vector3(0, 50, 0), 100, new Vector2(10), 3, 0.1f);
            softParticle = new BillboardSystem(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\nova_2"), 1, Models, new Vector2(100), new Vector3[] { new Vector3(0, 30, 0), new Vector3(-100, 0, 0) });

            // Generate lasers
            lbs = new BillboardSystem(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\Laser"), new Vector2(10, 1000), new Vector3[] { Vector3.Zero });
            /*lb = new LaserBillboard(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\Laser2"), new Vector2(300, 3),
                new Vector3(50, 50, 0), new Vector3(-50, -50, 0), new Vector3[] { Vector3.Zero });*/
            lb = new LaserBillboard(GraphicsDevice, Content, Content.Load<Texture2D>("Textures\\Laser2"), new Vector2(300, 3), start, end);/**/
            s = Content.Load<Model>("Models\\Ship"); e = Content.Load<Model>("Models\\Ship");

            treesCross = new BillboardCross(GraphicsDevice, Content, Content.Load<Texture2D>("tree"), new Vector2(10), positions);

            base.Initialize();
        }

        /// <summary>
        /// LoadContent はゲームごとに 1 回呼び出され、ここですべてのコンテンツを
        /// 読み込みます。
        /// </summary>
        protected override void LoadContent()
        {
            // 新規の SpriteBatch を作成します。これはテクスチャーの描画に使用できます。
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Debug.game = this;
            Debug.spriteBatch = this.spriteBatch;
            PrelightingRenderer._gameInstance = this;
            debug = new Debug();

            // skymap reflect
            Effect cubeMapEffect = Content.Load<Effect>("CubeMapReflect");
            CubeMapReflectMaterial cubeMat = new CubeMapReflectMaterial(Content.Load<TextureCube>("SkyBoxTex"));
            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")
                , GraphicsDevice);
            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
            //models[0].SetModelEffect(lightingEffect, true);			// set effect to each modelmeshpart
            //models[1].SetModelEffect(lightingEffect, true);
            Models[0].SetModelEffect(shadowEffect, true);				// set effect to each modelmeshpart
            Models[1].SetModelEffect(shadowEffect, true);
            Ground.SetModelEffect(shadowEffect, true);

            renderer = new PrelightingRenderer(GraphicsDevice, Content);
            renderer.Models = Models;
            renderer.Camera = camera;
            renderer.Lights = new List<PPPointLight>() {
                /*new PPPointLight(new Vector3(-100, 100, 0), Color.Red * .85f,
                200),
                new PPPointLight(new Vector3(100, 100, 0), Color.Blue * .85f,
                200),
                new PPPointLight(new Vector3(0, 100, 100), Color.Green * .85f,
                200),*/
                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(500, 500, 0);//new Vector3(1500, 1500, 2000);
            renderer.ShadowLightTarget = new Vector3(0, 300, 0);//new Vector3(0, 150, 0)
            //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.DoShadowMapping = true;
            renderer.ShadowMult = 0.3f;//0.01f;//0.3f;

            //sky = new SkySphere(Content, GraphicsDevice, Content.Load<TextureCube>("OutputCube0"));//("OutputCube0"));
            //sky = new SkySphere(Content, GraphicsDevice, Content.Load<TextureCube>("Cross"));//("OutputCube0"));
            Sky = new SkySphere(Content, GraphicsDevice, Content.Load<TextureCube>("SkyBoxTex"));
            //Sky = new SkySphere(Content, GraphicsDevice, Content.Load<TextureCube>("Textures\\Terrain\\CubeWrap"));

            Water.game = this;
            water = new Water(Content, GraphicsDevice, new Vector3(0, 0, 0), new Vector2(1000, 1000));
            //water = new Water(Content, GraphicsDevice, 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, GraphicsDevice, 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の後に初期化
            DiscoidEffect.game = this;
            discoidEffect = new DiscoidEffect(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), GraphicsDevice, Content);
            //terrain = new Terrain(Content.Load<Texture2D>("Textures\\terrain"), 30, 380, -200,				Content.Load<Texture2D>("Textures\\Grass"), 6, new Vector3(1, -1, 0), GraphicsDevice, Content);
            //terrain = new Terrain(Content.Load<Texture2D>("Textures\\terrain"), 100, 2500, -1500,				Content.Load<Texture2D>("Textures\\Grass"), 6, new Vector3(1, -1, 0), GraphicsDevice, Content);
            terrain = new Terrain(Content.Load<Texture2D>("Textures\\terrain"), 100, 2500, -1500,
                Content.Load<Texture2D>("Textures\\Grass"), 6, new Vector3(1, -1, 0), GraphicsDevice, Content);
            terrain.WeightMap = Content.Load<Texture2D>("Textures\\color1");
            terrain.RTexture = Content.Load<Texture2D>("Textures\\sand");
            terrain.GTexture = Content.Load<Texture2D>("Textures\\grass");
            terrain.BTexture = Content.Load<Texture2D>("Textures\\stone");
            terrain.DetailTexture = Content.Load<Texture2D>("Textures\\detail0");

            // Planet test
            debugModel = Content.Load<Model>("Models\\sphere2");
            WaterPlanet waterPlanet = new WaterPlanet(GraphicsDevice);
            waterPlanet.LoadContent(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"), 1, 50, 0,
                Content.Load<Texture2D>("Textures\\Grass"), 6, new Vector3(1, -1, 0), GraphicsDevice, Content);
            sphericalTerrain.WeightMap = Content.Load<Texture2D>("Textures\\color1");
            sphericalTerrain.RTexture = Content.Load<Texture2D>("Textures\\sand");
            sphericalTerrain.GTexture = Content.Load<Texture2D>("Textures\\grass");
            sphericalTerrain.BTexture = Content.Load<Texture2D>("Textures\\stone");
            sphericalTerrain.DetailTexture = Content.Load<Texture2D>("Textures\\detail0");
        }