public virtual void Draw(Tessellator par1Tessellator, float par2) { Vec3D vec3d = VertexPositions[1].Vector3D.Subtract(VertexPositions[0].Vector3D); Vec3D vec3d1 = VertexPositions[1].Vector3D.Subtract(VertexPositions[2].Vector3D); Vec3D vec3d2 = vec3d1.CrossProduct(vec3d).Normalize(); par1Tessellator.StartDrawingQuads(); if (InvertNormal) { par1Tessellator.SetNormal(-(float)vec3d2.XCoord, -(float)vec3d2.YCoord, -(float)vec3d2.ZCoord); } else { par1Tessellator.SetNormal((float)vec3d2.XCoord, (float)vec3d2.YCoord, (float)vec3d2.ZCoord); } for (int i = 0; i < 4; i++) { PositionTextureVertex positiontexturevertex = VertexPositions[i]; par1Tessellator.AddVertexWithUV((float)positiontexturevertex.Vector3D.XCoord * par2, (float)positiontexturevertex.Vector3D.YCoord * par2, (float)positiontexturevertex.Vector3D.ZCoord * par2, positiontexturevertex.TexturePositionX, positiontexturevertex.TexturePositionY); } par1Tessellator.Draw(); }
internal void Render(float partialStep) { if (!Visible) { return; } if (!CustomRendering) { t.StartDrawingColoredQuads(); t.AddVertexWithColor(new Vector4(GlobalLocation.X, GlobalLocation.Y, 0f, 1f), Color); t.AddVertexWithColor(new Vector4(GlobalLocation.X, GlobalLocation.Y + Size.Y, 0f, 1f), Color); t.AddVertexWithColor(new Vector4(GlobalLocation.X + Size.X, GlobalLocation.Y + Size.Y, 0f, 1f), Color); t.AddVertexWithColor(new Vector4(GlobalLocation.X + Size.X, GlobalLocation.Y, 0f, 1f), Color); t.Draw(); } else { OnRender(partialStep); } if (RenderControl != null) { RenderControl(this, new EventArgs()); } foreach (GuiControl control in controls) { control.Render(partialStep); } }
public void Render(float partialStep) { t.ResetTransformation(); string cursorText = "+"; FontRenderer f = FontRenderer.Instance; t.StartDrawingAlphaTexturedQuads("ascii"); Vector2 textSize = f.TextSize(cursorText); Vector2 Location = Input.Instance.InterpolatedMouseLocation(partialStep); f.RenderTextShadow(cursorText, Location.X - textSize.X / 2f, Location.Y - textSize.Y / 2f); t.Draw(); }
public void Render() { if (string.IsNullOrEmpty(text)) { return; } if (changed) { Rebuild(); } changed = false; t.StartDrawingAlphaTexturedQuads("ascii"); t.Draw(bufferText); }
protected override void OnLoad(EventArgs e) { GL.ClearColor(0.2f, 0.3f, 0.3f, 1.0f); WindowState = WindowState.Maximized; GL.Viewport(ClientRectangle); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); _shader = new Shader("assets/shaders/sprite/vertex.glsl", "assets/shaders/sprite/fragment.glsl"); _shader.SetInt("image", 0); // _shader.SetMatrix4("matrix", Matrix4.Identity); _shader.SetMatrix4("matrix", Matrix4.CreateTranslation(500, 500, 0)); //_shader.SetMatrix4("projection",Matrix4.CreateOrthographicOffCenter(0, 800, 600, 0, -1, 1)); _shader.Use(); //_texture = new Texture2D("Resources/container.png"); _texture = new Texture2D("assets/sprites/sheet.png"); _texture.Use(); var tesselactor = new Tessellator(_texture); var dirt = new Rectangle(32, 0, 32, 32); for (var z = 0; z < 10; z++) { for (var x = 0; x < 10; x++) { for (int y = 0; y < 10; y++) { var ax = x * 16.0f; var ay = y * 16.0f; var aax = ax - ay; var aay = (ax + ay) / 2; tesselactor.Draw(new Vector3(aax, aay - (z * 16.0f), 0), dirt, Color.White); } } } // _buffer = tesselactor.GenerateBuffer(); base.OnLoad(e); }