Changed Vertex constructors to pass more parameters as plain floats.
This avoids callers having to construct a float2 struct, only to have the Vertex constructor unwrap it into individual components again.
This commit is contained in:
@@ -29,12 +29,13 @@ namespace OpenRA.Graphics
|
||||
|
||||
public static void FastCreateQuad(Vertex[] vertices, float2 a, float2 b, float2 c, float2 d, Sprite r, int palette, int nv)
|
||||
{
|
||||
var attrib = new float2(palette / (float)HardwarePalette.MaxPalettes, channelSelect[(int)r.channel]);
|
||||
var attribP = palette / (float)HardwarePalette.MaxPalettes;
|
||||
var attribC = channelSelect[(int)r.channel];
|
||||
|
||||
vertices[nv] = new Vertex(a, r.TopLeftTextureCoords, attrib);
|
||||
vertices[nv + 1] = new Vertex(b, r.TopRightTextureCoords, attrib);
|
||||
vertices[nv + 2] = new Vertex(c, r.BottomRightTextureCoords, attrib);
|
||||
vertices[nv + 3] = new Vertex(d, r.BottomLeftTextureCoords, attrib);
|
||||
vertices[nv] = new Vertex(a, r.left, r.top, attribP, attribC);
|
||||
vertices[nv + 1] = new Vertex(b, r.right, r.top, attribP, attribC);
|
||||
vertices[nv + 2] = new Vertex(c, r.right, r.bottom, attribP, attribC);
|
||||
vertices[nv + 3] = new Vertex(d, r.left, r.bottom, attribP, attribC);
|
||||
}
|
||||
|
||||
static readonly int[] channelMasks = { 2, 1, 0, 3 }; // yes, our channel order is nuts.
|
||||
|
||||
Reference in New Issue
Block a user