public void DrawImage(SubTexture image, Vector2 position, Color4 color) { SetTexture(image.Texture); var pos = new Vector2(position.X + image.OffsetX, position.Y + image.OffsetY); v0.Pos = modelMatrix.TransformPoint(pos); v1.Pos = modelMatrix.TransformPoint(pos.X + image.TrimWidth, pos.Y); v2.Pos = modelMatrix.TransformPoint(pos.X + image.TrimWidth, pos.Y + image.TrimHeight); v3.Pos = modelMatrix.TransformPoint(pos.X, pos.Y + image.TrimHeight); image.GetUVs(out v0.Tex, out v1.Tex, out v2.Tex, out v3.Tex); v0.Col = v1.Col = v2.Col = v3.Col = color; mesh.AddQuad(ref v0, ref v1, ref v2, ref v3); }
public void DrawImage(SubTexture image, ref Rectangle position, Color4 color) { SetTexture(image.Texture); float sx = position.W / image.Width; float sy = position.H / image.Height; var pos = new Vector2(position.X + image.OffsetX * sx, position.Y + image.OffsetY * sy); v0.Pos = modelMatrix.TransformPoint(pos); v1.Pos = modelMatrix.TransformPoint(pos.X + image.TrimWidth * sx, pos.Y); v2.Pos = modelMatrix.TransformPoint(pos.X + image.TrimWidth * sx, pos.Y + image.TrimHeight * sy); v3.Pos = modelMatrix.TransformPoint(pos.X, pos.Y + image.TrimHeight * sy); image.GetUVs(out v0.Tex, out v1.Tex, out v2.Tex, out v3.Tex); v0.Col = v1.Col = v2.Col = v3.Col = color; mesh.AddQuad(ref v0, ref v1, ref v2, ref v3); }
public void DrawImage(SubTexture image, Rectangle position, Color4 color) { DrawImage(image, ref position, color); }