public void Render(Camera <OrthographicProjection> camera, PlayerEntity player, IChunkAccess chunk) { var topLeft = Vector3.Transform(new Vector3(camera.Projection.Left, camera.Projection.Top, 0), camera.ModelViewMatrix.Inverted()); var bottomRight = Vector3.Transform(new Vector3(camera.Projection.Right, camera.Projection.Bottom, 0), camera.ModelViewMatrix.Inverted()); var minX = (int)Math.Floor(topLeft.X); var maxX = (int)Math.Ceiling(bottomRight.X); var minY = (int)Math.Floor(topLeft.Y); var maxY = (int)Math.Ceiling(bottomRight.Y); _tessellator.BindColor(Color.White); _tessellator.LoadIdentity(); _tessellator.Begin(PrimitiveType.Quads); RenderLayer(_tessellator, chunk, ChunkLayer.Background, minX, maxX, minY, maxY); RenderLayer(_tessellator, chunk, ChunkLayer.Floor, minX, maxX, minY, maxY); RenderEntities(_tessellator, chunk, minX, maxX, minY, maxY); RenderLayer(_tessellator, chunk, ChunkLayer.Blocking, minX, maxX, minY, maxY); RenderLayer(_tessellator, chunk, ChunkLayer.Ceiling, minX, maxX, minY, maxY); var fov = CalculateFieldOfView(_tessellator, camera, player, chunk, minX, maxX, minY, maxY); RenderFieldOfView(fov, _tessellator, camera, chunk, minX, maxX, minY, maxY); _tessellator.End(); }
public override void Render() { base.Render(); _hudCamera.Apply(); _tessellator.Begin(PrimitiveType.Quads); _tessellator.LoadIdentity(); _tessellator.Translate(0, 0, -10); _tessellator.BindTexture(null); _tessellator.BindColor(Color.FromArgb(64, Color.Black)); _tessellator.AddPoint(_hudCamera.Projection.Left, _hudCamera.Projection.Top); _tessellator.AddPoint(_hudCamera.Projection.Left, _hudCamera.Projection.Bottom); _tessellator.AddPoint(_hudCamera.Projection.Right, _hudCamera.Projection.Bottom); _tessellator.AddPoint(_hudCamera.Projection.Right, _hudCamera.Projection.Top); _tessellator.BindColor(Color.White); var scale = new Vector2(_ascii.Width, _ascii.Height) * 4; _tessellator.Scale(scale.X, scale.Y); _tessellator.Translate(-scale.X * PAUSE_MESSAGE.Length / 2, -scale.Y / 2); _ascii.RenderText(_tessellator, PAUSE_MESSAGE); _tessellator.End(); //_writer.Write(PAUSE_MESSAGE); }
public override void Render() { base.Render(); _hudCamera.Apply(); _tessellator.Begin(PrimitiveType.Quads); _tessellator.LoadIdentity(); _tessellator.Translate(0, 0, 10); var scale = new Vector2(_ascii.Width, _ascii.Height) * 2; _tessellator.Scale(scale.X, scale.Y); var alpha = 255; _tessellator.Translate(_hudCamera.Projection.Left, _hudCamera.Projection.Bottom - scale.Y); foreach (var message in _progressMessages) { _tessellator.BindColor(Color.FromArgb(alpha, Color.White)); _ascii.RenderText(_tessellator, message); _tessellator.Translate(0, -scale.Y); alpha = MathHelper.Clamp(alpha - 8, 0, 255); } _tessellator.End(); }
public void Render() { _hudCamera.Apply(); _tessellator.LoadIdentity(); _tessellator.Translate(0, 0, -10); // hud render layer _tessellator.Begin(PrimitiveType.Quads); foreach (var child in _children) { child.Render(_tessellator); } _tessellator.End(); }
public override void Render() { base.Render(); GL.ClearColor(Color.FromArgb(48, 48, 48)); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); _worldManager.Render(); if (!_uiManager.HasMouseHover) { if (_worldManager.Player.CanReach((int)_mouseBlockPosition.X, (int)_mouseBlockPosition.Y)) { _tessellator.Begin(PrimitiveType.Quads); _tessellator.LoadIdentity(); _tessellator.Translate(0, 0, -9); // map overlay render layer // Render the tile selector. _tessellator.BindTexture(null); _tessellator.BindColor(Color.FromArgb(64, Color.Black)); _tessellator.Translate(_mouseBlockPosition.X, _mouseBlockPosition.Y); _tessellator.AddPoint(0, 0); _tessellator.AddPoint(0, 1); _tessellator.AddPoint(1, 1); _tessellator.AddPoint(1, 0); if (_uiManager.SelectedToolbarSlot != null) { _tessellator.BindColor(Color.FromArgb(128, Color.White)); ItemRenderManager.Instance.Render(_tessellator, _uiManager.SelectedToolbarSlot.GetItem()); } _tessellator.End(); } } _uiManager.Render(); }