public override void Update(float dtime) { renderer.PreRender(dtime); Device9.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.LightGray, 1.0f, 0); if (sceneQuadtree != null) { sceneRendererConnector.CullScene(sceneQuadtree); } sceneRendererConnector.UpdateAnimations(dtime); Device9.BeginScene(); if (wireframe) { Device9.SetRenderState(RenderState.FillMode, FillMode.Wireframe); } else { Device9.SetRenderState(RenderState.FillMode, FillMode.Solid); } renderer.Render(dtime); Device9.EndScene(); var time = (DateTime.Now - startTime); Application.MainWindow.Text = "running for: " + time.Hours + ":" + time.Minutes.ToString().PadLeft(2, '0') + ":" + time.Seconds.ToString().PadLeft(2, '0') + ", " + FPS + " fps, " + nEntitiesInScene + " entities"; }
public override void Update(float dtime) { sceneRendererConnector.CullScene(null); sceneRendererConnector.UpdateAnimations(dtime); renderer.PreRender(dtime); Device9.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.LightGray, 1.0f, 0); Device9.BeginScene(); if (wireframe) { Device9.SetRenderState(RenderState.FillMode, FillMode.Wireframe); } else { Device9.SetRenderState(RenderState.FillMode, FillMode.Solid); } renderer.Render(dtime); Device9.EndScene(); Application.MainWindow.Text = FPS + " fps"; }
public override void Update(float dtime) { sceneRendererConnector.UpdateAnimations(dtime); sceneRendererConnector.CullScene(null); renderer.PreRender(dtime); Device9.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.LightGray, 1.0f, 0); Device9.BeginScene(); Device9.SetRenderState(RenderState.FillMode, wireframe ? FillMode.Wireframe : FillMode.Solid); renderer.Render(dtime); Device9.EndScene(); }
public override void Update(float dtime) { Renderer.Settings.WaterLevel = MainWindow.Instance.CurrentMap.Settings.WaterHeight; Renderer.Settings.AmbientColor = MainWindow.Instance.CurrentMap.Settings.AmbientColor; Renderer.Settings.DiffuseColor = MainWindow.Instance.CurrentMap.Settings.DiffuseColor; Renderer.Settings.FogColor = MainWindow.Instance.CurrentMap.Settings.FogColor; Renderer.Settings.SpecularColor = MainWindow.Instance.CurrentMap.Settings.SpecularColor; Renderer.Settings.LightDirection = MainWindow.Instance.CurrentMap.Settings.LightDirection; if (FogEnabled) { Renderer.Settings.FogDistance = MainWindow.Instance.CurrentMap.Settings.FogDistance; Renderer.Settings.FogExponent = MainWindow.Instance.CurrentMap.Settings.FogExponent; } else { Renderer.Settings.FogDistance = 100000; Renderer.Settings.FogExponent = 100000; } Renderer.CalcShadowmapCamera(Renderer.Settings.LightDirection, 0); if (sceneQuadtree != null) { SceneRendererConnector.CullScene(sceneQuadtree); } SceneRendererConnector.UpdateAnimations(dtime); if (InputHandler != null) { InputHandler.ProcessMessage(MessageType.Update, new UpdateEventArgs { Dtime = dtime }); } Renderer.PreRender(dtime); Device9.Clear(ClearFlags.Target | ClearFlags.ZBuffer, new Color4(Renderer.Settings.FogColor), 1.0f, 0); Device9.BeginScene(); if (Wireframe) { Device9.SetRenderState(RenderState.FillMode, FillMode.Wireframe); } else { Device9.SetRenderState(RenderState.FillMode, FillMode.Solid); } Renderer.Render(dtime); state.OnRender(); bvRenderer.Begin(Scene.Camera); if (Program.Settings.DisplayGroundBoundings) { foreach (var v in MainWindow.Instance.CurrentMap.Ground.quadtree.All) { var b = MainWindow.Instance.CurrentMap.Ground.quadtree.GetBounding(v); bvRenderer.Draw(Matrix.Identity, b, Color.Yellow); } } if (MainWindow.Instance.placementBoundingsToolStripMenuItem.Checked) { foreach (var v in PlacementBoundings.All) { var b = ((Client.Game.Map.GameEntity)v).EditorPlacementWorldBounding; bvRenderer.Draw(Matrix.Identity, b, Color.Yellow); } } helperVisualizations.Settings.PhysicsBoundings = MainWindow.Instance.physicsBoundingsToolStripMenuItem.Checked; helperVisualizations.Settings.PhysicsBoundingsFullChains = MainWindow.Instance.showFullChainsToolStripMenuItem.Checked; helperVisualizations.Settings.PhysicsBoundingsHideGround = MainWindow.Instance.physicsBoundingsHideGroundToolStripMenuItem.Checked; helperVisualizations.Settings.AggroRange = MainWindow.Instance.aggroRangeToolStripMenuItem.Checked; helperVisualizations.Settings.VisualBoundings = MainWindow.Instance.visualBoundingsToolStripMenuItem.Checked; helperVisualizations.Render(bvRenderer, this, Scene, MainWindow.Instance.CurrentMap.NavMesh, Renderer.Frame); if (MainWindow.Instance.mapBoundsToolStripMenuItem.Checked) { float border = 20; bvRenderer.Draw(Matrix.Identity, new BoundingBox( new Vector3(border, border, 0), new Vector3(MainWindow.Instance.CurrentMap.Settings.Size.Width - border, MainWindow.Instance.CurrentMap.Settings.Size.Height - border, 0) ), Color.Black); } if (MainWindow.Instance.pickingBoundingsToolStripMenuItem.Checked) { foreach (var v in Scene.AllEntities) { if (v is Client.Game.Map.GameEntity) { bvRenderer.Draw(Matrix.Identity, v.PickingWorldBounding, Color.Orange); } } } bvRenderer.End(); Device9.EndScene(); Device9.Present(); }