bool cameraBelowCenter; // camera is below the current weather region's center public Weather(SimEngine sim) { this.sim = sim; g = sim.GraphicsDevice; camera = sim.UI.Camera; camera.Moved += new EventHandler(UpdateRegions); }
public void Draw(float worldTime) { if (Visible) { Sim.Interface.Camera c = sim.UI.Camera; // don't write to depth buffer so other objects can be drawn over the skydome sim.GraphicsDevice.RenderState.DepthBufferWriteEnable = false; Matrix[] modelTransforms = new Matrix[skyDome.Bones.Count]; skyDome.CopyAbsoluteBoneTransformsTo(modelTransforms); foreach (ModelMesh mesh in skyDome.Meshes) { foreach (Effect effect in mesh.Effects) { Matrix worldMatrix = modelTransforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(0, -0.15f, 0) * Matrix.CreateScale(100) * Matrix.CreateTranslation(c.Position); effect.Parameters["fTime"].SetValue(worldTime / 80000); effect.Parameters["matWorld"].SetValue(worldMatrix); } mesh.Draw(); } DrawSun(); sim.GraphicsDevice.RenderState.DepthBufferWriteEnable = true; } }
public override void Initialize() { mouse = new UIMouse(); keyboard = new UIKeyboard(); messageLog = new MessageLog(); screenManager = new ScreenManager(this); camera = new Camera(sim); console = new Console(sim); base.Initialize(); }
public override void Draw(GraphicsDevice g, float worldTime, Camera cam, Vector3 color) { Effect.Parameters["fTime"].SetValue(worldTime / 750); Effect.Parameters["vColor"].SetValue(color); Effect.Parameters["vVelocity"].SetValue(new Vector3(Sim.Settings.Graphics.Default.WindX, -200, Sim.Settings.Graphics.Default.WindZ)); g.VertexDeclaration = vDec; g.Indices = iBuffer; g.Vertices[0].SetSource(vBuffer, 0, VertexBillboard.SizeInBytes); g.RenderState.DepthBufferWriteEnable = false; Effect.Begin(); Effect.CurrentTechnique.Passes[0].Begin(); g.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, particles.Length, 0, particles.Length / 3); Effect.CurrentTechnique.Passes[0].End(); Effect.End(); g.RenderState.DepthBufferWriteEnable = true; }
public override void Draw(GraphicsDevice g, float worldTime, Camera cam, Vector3 color) { Sim.Settings.Graphics gs = Sim.Settings.Graphics.Default; Effect.Parameters["matWorld"].SetValue(WorldMatrix); Effect.Parameters["matProjection"].SetValue(cam.Projection); Effect.Parameters["matView"].SetValue(cam.View); Effect.Parameters["fTime"].SetValue(worldTime / 500); Effect.Parameters["fTurbulence"].SetValue(gs.WindTurbulence); Effect.Parameters["vVelocity"].SetValue(new Vector3(gs.WindX, -15, gs.WindZ)); Effect.Parameters["vColor"].SetValue(color); g.RenderState.DepthBufferWriteEnable = false; g.VertexDeclaration = vDec; g.Vertices[0].SetSource(vBuffer, 0, VertexPointSpriteParticle.SizeInBytes); Effect.Begin(); Effect.CurrentTechnique.Passes[0].Begin(); g.DrawPrimitives(PrimitiveType.PointList, 0, particles.Length); Effect.CurrentTechnique.Passes[0].End(); Effect.End(); g.RenderState.DepthBufferWriteEnable = true; }
public Terrain(BuildData data, SimEngine sim) { this.sim = sim; this.heightmap = data.Heightmap; this.scale = data.TerrainScale; this.g = sim.GraphicsDevice; this.camera = sim.UI.Camera; this.smooths = data.Smoothing; hmRatio = (float)heightmap.Height / heightmap.Width; }