void BlitQuad(Rect quad, TGlyph glyph)
{
int index = m_Vertices.Count;
Rect uvs = glyph.rect;
m_Vertices.Add(new Vector3(quad.x, -quad.y, 0f));
m_Vertices.Add(new Vector3(quad.x + quad.width, -quad.y, 0f));
m_Vertices.Add(new Vector3(quad.x + quad.width, -quad.y - quad.height, 0f));
m_Vertices.Add(new Vector3(quad.x, -quad.y - quad.height, 0f));
m_UVs.Add(new Vector2(uvs.x / Font.HScale, 1 - uvs.y / Font.VScale));
m_UVs.Add(new Vector2((uvs.x + uvs.width) / Font.HScale, 1 - uvs.y / Font.VScale));
m_UVs.Add(new Vector2((uvs.x + uvs.width) / Font.HScale, 1 - (uvs.y + uvs.height) / Font.VScale));
m_UVs.Add(new Vector2(uvs.x / Font.HScale, 1 - (uvs.y + uvs.height) / Font.VScale));
switch (FillMode)
{
case TFillMode.SingleColor:
m_Colors.Add(ColorTopLeft);
m_Colors.Add(ColorTopLeft);
m_Colors.Add(ColorTopLeft);
m_Colors.Add(ColorTopLeft);
break;
case TFillMode.VerticalGradient:
m_Colors.Add(ColorTopLeft);
m_Colors.Add(ColorTopLeft);
m_Colors.Add(ColorBottomLeft);
m_Colors.Add(ColorBottomLeft);
break;
case TFillMode.HorizontalGradient:
m_Colors.Add(ColorTopLeft);
m_Colors.Add(ColorBottomLeft);
m_Colors.Add(ColorBottomLeft);
m_Colors.Add(ColorTopLeft);
break;
case TFillMode.QuadGradient:
m_Colors.Add(ColorTopLeft);
m_Colors.Add(ColorTopRight);
m_Colors.Add(ColorBottomRight);
m_Colors.Add(ColorBottomLeft);
break;
case TFillMode.StretchedTexture:
m_UVs2.Add(new Vector2(0f, 1f));
m_UVs2.Add(new Vector2(1f, 1f));
m_UVs2.Add(new Vector2(1f, 0f));
m_UVs2.Add(new Vector2(0f, 0f));
break;
case TFillMode.ProjectedTexture:
float h = uvs.height / Font.LineHeight;
float w = uvs.width / Font.LineHeight;
m_UVs2.Add(new Vector2(glyph.xOffset, h - glyph.yOffset));
m_UVs2.Add(new Vector2(w - glyph.xOffset, h - glyph.yOffset));
m_UVs2.Add(new Vector2(w - glyph.xOffset, glyph.yOffset));
m_UVs2.Add(new Vector2(glyph.xOffset, glyph.yOffset));
break;
default:
break;
}
m_SubmeshTriangles[_currentMaterial].Add(index);
m_SubmeshTriangles[_currentMaterial].Add(index + 1);
m_SubmeshTriangles[_currentMaterial].Add(index + 2);
m_SubmeshTriangles[_currentMaterial].Add(index);
m_SubmeshTriangles[_currentMaterial].Add(index + 2);
m_SubmeshTriangles[_currentMaterial].Add(index + 3);
}