public void ResetColors() { normalColor = new Vector4(0.2f, 0.6f, 0.8f, 0.8f); selectedColor = new Vector4(1f, 0.5f, 0.1f, 0.8f); selectedObjectColor = new Vector4(1f, 0.4f, 0.4f, 1f); backgroundColor = new Color4(0.05f, 0.05f, 0.15f, 1f); VisibilityFunctions.ResetSelectedChunkColor(); }
public static void RunMainLoop(Panel Panel) { RenderLoop.Run(Panel, () => { if (dontRender) { return; } //Resizing if (device.MustResize) { device.Resize(); aspectRatio = (float)Panel.Width / Panel.Height; } Program.mainForm.KeyboardController(); sharpFPS.Update(); Program.mainForm.SetToolStripStatusLabel(Camera.GetInformation() + " FPS: " + sharpFPS.FPS.ToString()); //clear color device.Clear(backgroundColor); //Set matrices viewProjection = Camera.GenerateLookAtRH() * Matrix.PerspectiveFovRH(fovAngle, aspectRatio, near, far); frustum = new BoundingFrustum(viewProjection); if (showCollision) { CollisionRendering.RenderCollisionModel(viewProjection, -Camera.GetForward(), Camera.GetUp()); BSPRenderer.RenderShadowCollisionModel(viewProjection); } else { BSPRenderer.RenderLevelModel(viewProjection); } if (showChunkBoxes) { VisibilityFunctions.RenderChunkModels(viewProjection); } if (showObjects == CheckState.Checked) { Program.layoutEditor.layoutSystem.RenderAllSetObjects(true); } else if (showObjects == CheckState.Indeterminate) { Program.layoutEditor.layoutSystem.RenderAllSetObjects(false); } if (showCameras) { Program.cameraEditor.RenderAllCameras(); } if (showStartPositions) { Program.configEditor.RenderStartPositions(); } if (showSplines) { Program.splineEditor.RenderSplines(); } if (showQuadtree) { CollisionRendering.RenderQuadTree(); } //present device.Present(); }); //release resources foreach (RenderWareModelFile r in BSPRenderer.BSPStream) { foreach (SharpMesh mesh in r.meshList) { mesh.Dispose(); } } foreach (RenderWareModelFile r in BSPRenderer.ShadowCollisionBSPStream) { foreach (SharpMesh mesh in r.meshList) { mesh.Dispose(); } } foreach (RenderWareModelFile r in DFFRenderer.DFFStream.Values) { foreach (SharpMesh mesh in r.meshList) { mesh.Dispose(); } } CollisionRendering.Dispose(); if (BSPRenderer.whiteDefault != null) { BSPRenderer.whiteDefault.Dispose(); } foreach (ShaderResourceView texture in BSPRenderer.TextureStream.Values) { texture.Dispose(); } Cube.Dispose(); Pyramid.Dispose(); Cylinder.Dispose(); basicBuffer.Dispose(); basicShader.Dispose(); defaultBuffer.Dispose(); defaultShader.Dispose(); collisionBuffer.Dispose(); collisionShader.Dispose(); device.Dispose(); }