QuickFont.QFont.RenderGlyph C# (CSharp) Метод

RenderGlyph() публичный Метод

public RenderGlyph ( float x, float y, char c, bool isDropShadow ) : void
x float
y float
c char
isDropShadow bool
Результат void
        public void RenderGlyph(float x, float y, char c, bool isDropShadow)
        {
            var glyph = fontData.CharSetMapping[c];

            //note: it's not immediately obvious, but this combined with the paramteters to
            //RenderGlyph for the shadow mean that we render the shadow centrally (despite it being a different size)
            //under the glyph
            if (isDropShadow)
            {
                x -= (int)(glyph.rect.Width * 0.5f);
                y -= (int)(glyph.rect.Height * 0.5f + glyph.yOffset);
            }

            RenderDropShadow(x, y, c, glyph);

            TexturePage sheet = fontData.Pages[glyph.page];

            float tx1 = (float)(glyph.rect.X) / sheet.Width;
            float ty1 = (float)(glyph.rect.Y) / sheet.Height;
            float tx2 = (float)(glyph.rect.X + glyph.rect.Width) / sheet.Width;
            float ty2 = (float)(glyph.rect.Y + glyph.rect.Height) / sheet.Height;

            var tv1 = new Vector2(tx1, ty1);
            var tv2 = new Vector2(tx1, ty2);
            var tv3 = new Vector2(tx2, ty2);
            var tv4 = new Vector2(tx2, ty1);

            var v1 = PrintOffset + new Vector3(x, y + glyph.yOffset, 0);
            var v2 = PrintOffset + new Vector3(x, y + glyph.yOffset + glyph.rect.Height, 0);
            var v3 = PrintOffset + new Vector3(x + glyph.rect.Width, y + glyph.yOffset + glyph.rect.Height, 0);
            var v4 = PrintOffset + new Vector3(x + glyph.rect.Width, y + glyph.yOffset, 0);

            Color color = Options.Colour;
            if(isDropShadow)
                color = Color.FromArgb((int)(Options.DropShadowOpacity * 255f), Color.White);

            if (UsingVertexBuffers)
            {
                var normal = new Vector3(0, 0, -1);

                int argb = Helper.ToRgba(color);

                var vbo = VertexBuffers[glyph.page];

                vbo.AddVertex(v1, normal, tv1, argb);
                vbo.AddVertex(v2, normal, tv2, argb);
                vbo.AddVertex(v3, normal, tv3, argb);

                vbo.AddVertex(v1, normal, tv1, argb);
                vbo.AddVertex(v3, normal, tv3, argb);
                vbo.AddVertex(v4, normal, tv4, argb);
            }

            // else use immediate mode
            else
            {
                GL.Color4(color);
                GL.BindTexture(TextureTarget.Texture2D, sheet.GLTexID);

                GL.Begin(BeginMode.Quads);
                GL.TexCoord2(tv1); GL.Vertex3(v1);
                GL.TexCoord2(tv2); GL.Vertex3(v2);
                GL.TexCoord2(tv3); GL.Vertex3(v3);
                GL.TexCoord2(tv4); GL.Vertex3(v4);
                GL.End();
            }
        }