internal void RenderPass2() { // draw chunk if drawbuffer has been calculated if (pass2VertexBuffer.Vertices != null) { t.StartDrawingTiledQuadsPass2(); t.Draw(pass2VertexBuffer); } }
private void RenderCrossHair() { t.ResetTransformation(); t.StartDrawingLines(); Vector4 c = new Vector4(1, 1, 1, 1); Vector4 center = new Vector4(TheGame.Instance.Width / 2, TheGame.Instance.Height / 2, 0, 1); float size = 15; t.AddVertexWithColor(new Vector4(center.X - size, center.Y, 0, 1), c); t.AddVertexWithColor(new Vector4(center.X + size, center.Y, 0, 1), c); t.AddVertexWithColor(new Vector4(center.X, center.Y - size, 0, 1), c); t.AddVertexWithColor(new Vector4(center.X, center.Y + size, 0, 1), c); t.Draw(); }
internal virtual void Render(float partialStep) { t.ResetTransformation(); Vector3 position = Interpolate.Vector(entity.PrevPosition, entity.Position, partialStep); if (entity != World.Instance.Player) { t.StartDrawingColoredQuads(); Camera.Instance.World = Matrix.Multiply(Matrix.RotationYawPitchRoll(entity.Yaw, 0, 0), Matrix.Translation(position)); t.Draw(buffer); } if (typeof(Player) == entity.GetType()) { Player p = World.Instance.Player; Vector3 pos = p.Position + p.EyePosition; int blockId = World.Instance.GetBlock((int)pos.X, (int)pos.Y, (int)pos.Z); if (blockId == BlockRepository.Water.Id) { t.StartDrawingColoredQuads(); Camera.Instance.World = Matrix.Identity; Camera.Instance.World = Matrix.Multiply(Camera.Instance.World, Matrix.Translation(new Vector3(-0.5f, -0.5f, -1.2f))); Camera.Instance.World = Matrix.Multiply(Camera.Instance.World, Matrix.RotationYawPitchRoll(p.Yaw - (float)Math.PI, -p.Pitch, 0)); Camera.Instance.World = Matrix.Multiply(Camera.Instance.World, Matrix.Translation(pos)); Vector3 normal = new Vector3(0, 0, 1); Vector4 c1 = new Vector4(0, 0, 1, 0.5f); t.AddVertexWithColor(new Vector4(0f, 0f, 1f, 1.0f), c1, normal); t.AddVertexWithColor(new Vector4(0f, 1f, 1f, 1.0f), c1, normal); t.AddVertexWithColor(new Vector4(1f, 1f, 1f, 1.0f), c1, normal); t.AddVertexWithColor(new Vector4(1f, 0f, 1f, 1.0f), c1, normal); t.Draw(); } } if (typeof(Player) == entity.GetType() && World.Instance.Player.DestroyProgress > 0) { t.StartDrawingTiledQuads2(); t.Translate.X = World.Instance.Player.BlockAttackPosition.X + 0.5f; t.Translate.Y = World.Instance.Player.BlockAttackPosition.Y + 0.5f; t.Translate.Z = World.Instance.Player.BlockAttackPosition.Z + 0.5f; float s = 1.005f; t.Scale = new Vector3(s, s, s); t.Draw(TileTextures.Instance.GetDestroyBlockVertexBuffer(World.Instance.Player.DestroyProgress)); } }
public void Render() { GenerateHealthBuffer(); GenerateHungerBuffer(); t.ResetTransformation(); float temp = (int)(TheGame.Instance.Width / (frameSize * 13f)); t.Scale = new Vector3(1, 1, 1) * temp; t.Translate = new Vector3(1, 0, 0) * (TheGame.Instance.Width - frameSize * 9f * temp) / 2f; t.Translate.Y = 0; // Draw slot 0-8 in inventory int[] order = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; order[8] = player.SelectedSlotId; order[player.SelectedSlotId] = 8; foreach (int i in order) { if (i == player.SelectedSlotId) { continue; } DrawItem(i); } DrawItem(player.SelectedSlotId); // Draw hearts t.Scale = new Vector3(1, 1, 1) * temp; t.Translate = new Vector3( (TheGame.Instance.Width - frameSize * 9f * temp) / 2f, (frameSize + 8) * temp, 0); t.StartDrawingAlphaTexturedQuads("icons"); t.Draw(healthBuffer); t.StartDrawingAlphaTexturedQuads("icons"); t.Draw(hungerBuffer); }
internal void DrawBatch() { renderBatch = false; t.Draw(); }