public bool Frame() { // Do the input frame processing. if (!Input.Frame()) { return(false); } // Check if the user pressed escape and wants to quit. if (Input.IsEscapePressed()) { return(false); } // Update the system stats. Timer.Frame(); FPS.Frame(); CPU.Frame(); // Set the frames per second. if (!Text.SetFps(FPS.Value, D3D.DeviceContext)) { return(false); } // Set the cpu usage. if (!Text.SetCpu(CPU.Value, D3D.DeviceContext)) { return(false); } // Do the frame input processing. if (!HandleInput(Timer.FrameTime)) { return(false); } // Get the position of the camera var position = Camera.GetPosition(); // Get the height of the triangle that is directly underneath the given camera position float height; var foundHeight = QuadTree.GetHeightAtPosition(position.X, position.Z, out height); if (foundHeight) { // If there was a triangle under the camera then position the camera just above it by two units. Camera.SetPosition(position.X, height + 2, position.Z); } // Render the graphics. if (!RenderGraphics()) { return(false); } return(true); }
public bool Frame() { // Do the input frame processing. if (!Input.Frame()) { return(false); } // Check if the user pressed escape and wants to quit. if (Input.IsEscapePressed()) { return(false); } // Update the system stats. Timer.Frame(); FPS.Frame(); CPU.Frame(); // Set the frames per second. if (!Text.SetFps(FPS.Value, D3D.DeviceContext)) { return(false); } // Set the cpu usage. if (!Text.SetCpu(CPU.Value, D3D.DeviceContext)) { return(false); } // Do the frame input processing. if (!HandleInput(Timer.FrameTime)) { return(false); } // Render the graphics. if (!RenderGraphics()) { return(false); } return(true); }