Пример #1
0
 public static VertexPositionColorTex[] GetQuadPoints2(RectangleF destination, RectangleF texture, SizeF texureSize, Color4 color)
 {
     VertexPositionColorTex[] result = new VertexPositionColorTex[6];
     result[0] = new VertexPositionColorTex(new Vector3(destination.X, destination.Y, 0f), color, new Vector2((texture.X) / texureSize.Width, (texture.Y) / texureSize.Height));
     result[1] = new VertexPositionColorTex(new Vector3(destination.X, destination.Y - destination.Height, 0f), color, new Vector2((texture.X) / texureSize.Width, (texture.Y + texture.Height) / texureSize.Height));
     result[2] = new VertexPositionColorTex(new Vector3(destination.X + destination.Width, destination.Y, 0f), color, new Vector2((texture.X + texture.Width) / texureSize.Width, (texture.Y) / texureSize.Height));
     result[3] = result[2];
     result[4] = result[1];
     result[5] = new VertexPositionColorTex(new Vector3(destination.X + destination.Width, destination.Y - destination.Height, 0f), color, new Vector2((texture.X + texture.Width) / texureSize.Width, (texture.Y + texture.Height) / texureSize.Height));
     return result;
 }
Пример #2
0
 // Used for sprites.. generates 6 vertex points
 public static VertexPositionColorTex[] GetQuadPoints(RectangleF destination, RectangleF texture, SizeF texureSize, Color4 color)
 {
     VertexPositionColorTex[] result = new VertexPositionColorTex[6];
     Size renderSize = Renderer.Instance.RenderSize;
     float fWidth5 = (0.5f / (float)renderSize.Width);// (float)rtDescr.Width - 1f;
     float fHeight5 = (-0.5f / (float)renderSize.Height);//(float)rtDescr.Height -1f;
     result[0] = new VertexPositionColorTex(GetTransformed2DPoint(destination.X, renderSize.Height - destination.Y, renderSize), color, new Vector2((texture.X) / texureSize.Width, (texture.Y) / texureSize.Height));
     result[1] = new VertexPositionColorTex(GetTransformed2DPoint(destination.X, renderSize.Height - destination.Y - destination.Height, renderSize), color, new Vector2((texture.X) / texureSize.Width, (texture.Y + texture.Height) / texureSize.Height));
     result[2] = new VertexPositionColorTex(GetTransformed2DPoint(destination.X + destination.Width, renderSize.Height - destination.Y, renderSize), color, new Vector2((texture.X + texture.Width) / texureSize.Width, (texture.Y) / texureSize.Height));
     result[3] = result[2];
     result[4] = result[1];
     result[5] = new VertexPositionColorTex(GetTransformed2DPoint(destination.X + destination.Width, renderSize.Height - destination.Y - destination.Height, renderSize), color, new Vector2((texture.X + texture.Width) / texureSize.Width, (texture.Y + texture.Height) / texureSize.Height));
     return result;
 }