public void Render(GameClient gameClient, RenderInfo renderInfo) { _currentFrameTime = GameTime.Now(); GL.ClearColor(0.5f, 0.6f, 0.9f, 1f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.CullFace); var offset = gameClient.PositionData.Placement.Pos - EntityPos.Origin; SetProjectionMatrix(renderInfo); _modelViewMatrix = Matrix4.Identity * Matrix4.CreateTranslation((float)-offset.X, (float)-offset.Y - gameClient.PhysicsValues.PlayerEyeHeight, (float)-offset.Z) * Matrix4.CreateRotationY((float)-gameClient.PositionData.Placement.Orientation.Horizontal) * Matrix4.CreateRotationX((float)gameClient.PositionData.Placement.Orientation.Vertical); _textureAtlas.Bind(); RenderHighlightedFace(gameClient); RenderBlocks(gameClient); RenderEntities(gameClient); _outlineRenderer.RenderOutlines(renderInfo); }
/// <summary> /// Updates the referenced frameTime to the current time, and returns the precise duration that has passed since then. /// </summary> /// <param name="frameTime">The frame time to update.</param> /// <returns>The duration between the old value of frameTime and the current time.</returns> public static GameDuration Update(ref GameTime frameTime) { var now = Now(); var elapsedDuration = now - frameTime; frameTime = now; return elapsedDuration; }