//SphericalTerrain2 sphericalTerrain; protected override void Initialize() { base.Initialize(); camera = new ArcBallCamera(); //camera.Initialize(game, Vector3.Zero); ParticleEmitter.camera = camera; }
/// <param name="camera">main camera instance</param> public void renderReflection(ArcBallCamera camera) { // Reflect the camera's properties across the water plane Vector3 reflectedCameraPosition = camera.Position; reflectedCameraPosition.Y = -reflectedCameraPosition.Y + glassMesh.Position.Y * 2; Vector3 reflectedCameraTarget = camera.Target; reflectedCameraTarget.Y = -reflectedCameraTarget.Y - camera.LookAtOffset.Y/**/ + glassMesh.Position.Y * 2; // Create a temporary camera to render the reflected scene // ArcBallCameraのLookAtOffsetの関係でずれたりするから、出来れば同じ型のクラスのほうがいいだろう TargetCamera reflectionCamera = new TargetCamera(reflectedCameraPosition, reflectedCameraTarget, graphics); reflectionCamera.Update();// 上方ベクトルは-Yになってた //ArcBallCamera reflectionCamera = new ArcBallCamera(reflectedCameraPosition, reflectedCameraTarget, Vector3.Down); // reflectionのviewがおかしいのか...?? // これ、ネットから拾ってきたmatrixだったのを忘れてた /*Matrix reflectionMatrix = Matrix.Identity //Matrix.CreateTranslation(0f, -waterMesh.Position.Y, 0f) * //Matrix.CreateScale(1f, -1f, 1f) //Matrix.CreateTranslation(0f, -waterMesh.Position.Y, 0f) ; Matrix reflectedViewMatrix = reflectionMatrix * camera.View;*/ // Set the reflection camera's view matrix to the water effect glassEffect.Parameters["ReflectedView"].SetValue(reflectionCamera.View); //waterEffect.Parameters["ReflectedView"].SetValue(reflectedViewMatrix); // Create the clip plane Vector4 clipPlane = new Vector4(0, 1, 0, -glassMesh.Position.Y);// w成分は法線方向を表す? // lt, stを使うmodelsのために初期化:light map, shadow mapを作り直す。(めんどくさい) //models[1].RotationMatrix = Matrix.Identity * Matrix.CreateRotationZ(MathHelper.ToRadians(90))* Matrix.CreateRotationX(MathHelper.ToRadians(-90)); // あー分かった、モデルの回転が異常なのではなくて、BlendStateなどがおかしい!(だから透過して見えるので、表面が見えて回転しているようにみえる) /*var depthNormal = renderer.drawDepthNormalMap(models //, reflectedViewMatrix, reflectionCamera.Projection, reflectionCamera.Position); , reflectionCamera.View, reflectionCamera.Projection, reflectionCamera.Position); RenderTarget2D lt = renderer.drawLightMap(models, depthNormal.dt, depthNormal.nt , reflectionCamera.View, reflectionCamera.Projection, reflectionCamera.Position); //, reflectedViewMatrix, reflectionCamera.Projection, reflectionCamera.Position); //RenderTarget2D st = renderer.drawShadowDepthMap(models); renderer.drawShadowDepthMap(); renderer.prepareMainPass(models, lt);*/ // Set the render target graphics.SetRenderTarget(reflectionTarget); graphics.Clear(Color.Black); // Draw all objects with clip plane // ここを弄ると面白い演出が出来るかも foreach (IRenderable renderable in Objects) { renderable.SetClipPlane(clipPlane); string cullState = graphics.RasterizerState.ToString(); if (renderable is Object) { (renderable as Object).Update(new GameTime()); } // ここでreflectionCameraを設定しているはずなのだが... //renderable.Draw(reflectedViewMatrix, reflectionCamera.Projection, reflectedCameraPosition); //renderable.Draw(camera.View, camera.Projection, camera.Position);// ここでreflectionCameraを設定しているはずなのだが... renderable.Draw(reflectionCamera.View, reflectionCamera.Projection, reflectedCameraPosition); renderable.SetClipPlane(null); } graphics.SetRenderTarget(null); graphics.RasterizerState = RasterizerState.CullCounterClockwise; /*// Set the render target //graphics.SetRenderTarget(reflectionTarg); graphics.Clear(Color.Black); foreach (IRenderable renderable in Objects) { renderable.SetClipPlane(clipPlane); if (renderable is Object) { (renderable as Object).Update(new GameTime()); //continue; } // ここでreflectionCameraを設定しているはずなのだが... //renderable.Draw(reflectedViewMatrix, reflectionCamera.Projection, reflectedCameraPosition); //renderable.Draw(camera.View, camera.Projection, camera.Position);// ここでreflectionCameraを設定しているはずなのだが... renderable.Draw(reflectionCamera.View, reflectionCamera.Projection, reflectedCameraPosition); renderable.SetClipPlane(null); }*/ /*if (!hasSaved) { using (Stream stream = File.OpenWrite("reflection_map.png")) { reflectionTarg.SaveAsPng(stream, reflectionTarg.Width, reflectionTarg.Height); stream.Position = 0; //MediaLibrary media = new MediaLibrary(); //media.SavePicture("shadowDepth.jpg", stream); hasSaved = true; // 下でfalseに } }*/ // Set the reflected scene to its effect parameter in // the water effect glassEffect.Parameters["ReflectionMap"].SetValue(reflectionTarget); }
public void RenderRefraction(ArcBallCamera camera) { // Reflect the camera's properties across the water plane /*Vector3 reflectedCameraPosition = camera.Position; reflectedCameraPosition.Y = -reflectedCameraPosition.Y + glassMesh.Position.Y * 2; Vector3 reflectedCameraTarget = camera.ChasePosition; reflectedCameraTarget.Y = -reflectedCameraTarget.Y - camera.LookAtOffset.Y + glassMesh.Position.Y * 2; // Create a temporary camera to render the reflected scene TargetCamera reflectionCamera = new TargetCamera(reflectedCameraPosition, reflectedCameraTarget, graphics); reflectionCamera.Update(); // Set the reflection camera's view matrix to the water effect glassEffect.Parameters["ReflectedView"].SetValue(reflectionCamera.View);*/ // Create the clip plane Vector3 planeNormalDirection = Vector3.Normalize(camera.CameraPosition - glassMesh.Position); //Vector4 clipPlane = new Vector4(planeNormalDirection, 1.0f); //Vector4 clipPlane = new Vector4(planeNormalDirection, (camera.CameraPosition - glassMesh.Position).Length());// 手前にあるものは屈折しないのでクリップ Vector4 clipPlane = new Vector4(planeNormalDirection, 20000); /*var depthNormal = renderer.drawDepthNormalMap(models , camera.View, camera.Projection, camera.Position); RenderTarget2D lt = renderer.drawLightMap(models, depthNormal.dt, depthNormal.nt , camera.View, camera.Projection, camera.Position); renderer.drawShadowDepthMap(); renderer.prepareMainPass(models, lt);*/ // Set the render target graphics.SetRenderTarget(refractionTarget); graphics.Clear(Color.Black); // Draw all objects with clip plane foreach (IRenderable renderable in Objects) { //renderable.SetClipPlane(clipPlane); string cullState = graphics.RasterizerState.ToString(); if (renderable is Object) { (renderable as Object).Update(new GameTime()); } renderable.Draw(camera.View, camera.Projection, camera.Position); //renderable.SetClipPlane(null); } graphics.SetRenderTarget(null); graphics.RasterizerState = RasterizerState.CullCounterClockwise; // デバッグ用に直接画面に描画する /*graphics.Clear(Color.Black); foreach (IRenderable renderable in Objects) { renderable.SetClipPlane(clipPlane); if (renderable is Object) { (renderable as Object).Update(new GameTime()); } // ここでreflectionCameraを設定しているはずなのだが... renderable.Draw(camera.View, camera.Projection, camera.Position); renderable.SetClipPlane(null); }*/ //if (KeyInput.IsOnKeyDown(Keys.Z)) { /*if (!hasSaved) {//if (JoyStick.IsOnKeyDown(1)) { using (Stream stream = File.OpenWrite("refraction_map.png")) { refractionTarget.SaveAsPng(stream, refractionTarget.Width, refractionTarget.Height); stream.Position = 0; //MediaLibrary media = new MediaLibrary(); //media.SavePicture("shadowDepth.jpg", stream); hasSaved = true; // 下でfalseに } }*/ // Set the reflected scene to its effect parameter in the water effect //glassEffect.Parameters["RefractionMap"].SetValue(refractionTarget);// 屈折マップ生成 //glassEffect.Parameters["RefractionMap"].SetValue(game.Sky.TextureCube);// 屈折マップ生成 //Update(); //glassEffect.Parameters["RefractionMap"].SetValue(level.EnvironmentalMap);// シーンが映り込んだマップを使う場合 }
public void PreDraw(ArcBallCamera camera, GameTime gameTime) { //renderReflection(camera); RenderRefraction(camera); //glassEffect.Parameters["Time"].SetValue((float)gameTime.TotalGameTime.TotalSeconds); }
protected override void Initialize() { base.Initialize(); enemyManager = new EnemyManager(this); new DebugOverlay(graphicsDevice, content); // Entities Models = new List<Object>(); Ground = new Object(new Vector3(0, -500, 0), 1f, "Models\\ground");//-200 Ground.RenderBoudingSphere = false; Models.Add(Ground); Target = new Object(new Vector3(0, 20, 0), 20, "Models\\cube"); //Models.Add(Target); // Initializes camera //camera = new ArcBallCamera(Vector3.Zero); camera = new ArcBallCamera(Vector3.Zero); //camera.Initialize(game, Vector3.Zero); ParticleEmitter.camera = camera; // Set up the reference grid grid = new GridRenderer(); grid.GridColor = Color.DarkSeaGreen;//Color.LimeGreen; grid.GridScale = 300f;//100f; grid.GridSize = 64;;//32; // Set the grid to draw on the x/z plane around the origin grid.WorldMatrix = Matrix.Identity; }
protected override void Initialize() { base.Initialize(); // Entities Models = new List<Object>(); Ground = new Object(new Vector3(0, -200, 0), 1f, "Models\\ground"); Models.Add(Ground); Target = new Object(new Vector3(0, 20, 0), 20, "Models\\cube"); //Models.Add(Target); // Initializes camera camera = new ArcBallCamera(); //camera.Initialize(game, Vector3.Zero); ParticleEmitter.camera = camera; // Set up the reference grid grid = new GridRenderer(); grid.GridColor = Color.DarkSeaGreen;//Color.LimeGreen; grid.GridScale = 100f; grid.GridSize = 32;//32; // Set the grid to draw on the x/z plane around the origin grid.WorldMatrix = Matrix.Identity; }
protected override void Initialize() { base.Initialize(); PrelightingRenderer.game = game; 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), 0.05f, "Models\\ground"); Teapot = new Object(new Vector3(-100, 0, 0), "Models\\UtahTeapotDef"); Target.Direction = Vector3.UnitX; 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(game, 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(device, content, content.Load<Texture2D>("tree"), new Vector2(800), positions); trees = new BillboardSystem(graphicsDevice, content, content.Load<Texture2D>("Textures\\Billboard\\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\\Billboard\\cloud"), new Vector2(500), cloudPositions); clouds.EnsureOcclusion = false; // Generate particles ps = new FlameParticleEmitter(graphicsDevice, content, content.Load<Texture2D>("Textures\\Particle\\fire"), Vector3.Zero, 1000, new Vector2(10), 10, Vector3.Zero, 0.01f);// 0.1f /*eps = new ExplosionParticleEmitter(device, content, content.Load<Texture2D>("Textures\\explosion"), Vector3.Zero, 2000, new Vector2(50), 20, 5f); discoid = new DiscoidParticleEmitter(device, content, content.Load<Texture2D>("Textures\\sun_1"), Vector3.Zero, 10000, new Vector2(5), 20, 5f);*/ eps = new ExplosionParticleEmitter(graphicsDevice, content, Vector3.Zero, content.Load<Texture2D>("Textures\\Particle\\nova_2"), 2000, new Vector2(10), 20, 5f); discoid = new DiscoidParticleEmitter(graphicsDevice, content, content.Load<Texture2D>("Textures\\Particle\\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\\Beam2"), new Vector3(0, 50, 0), 100, new Vector2(10), 3, 0.1f, BillboardMode.Line, true); //beamEmitter = new ParticleEmitter(device, content, BillboardMode.Line, content.Load<Texture2D>("Textures\\Laser2"), new Vector3(0, 50, 0), 100, new Vector2(10, 5), 3, 0.1f, true); shockWaveEmitter = new ShockWaveParticleEmitter(graphicsDevice, content, new Vector3(0, 50, 0), content.Load<Texture2D>("Textures\\Particle\\GlowRing"), 1, new Vector2(50), 3, 0, 0, 10, true); shockWaveEmitter.Run(); softParticle = new BillboardSystem(graphicsDevice, content, content.Load<Texture2D>("Textures\\Particle\\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(device, 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(device, content, content.Load<Texture2D>("Textures\\Laser2"), new Vector2(300, 3), start, end); lb = new LaserBillboard(graphicsDevice, content, content.Load<Texture2D>("Textures\\Laser2"), new Vector2(300, 50), start, end); s = content.Load<Model>("Models\\Ship"); e = content.Load<Model>("Models\\Ship"); treesCross = new BillboardCross(graphicsDevice, content, content.Load<Texture2D>("Textures\\Billboard\\tree"), new Vector2(10), positions); }
/// <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"); }