rectangle renderer now has correct corner calculations; switched to vertex buffer for primitive batch. still wip.
This commit is contained in:
@@ -64,12 +64,12 @@ namespace RecrownedAthenaeum.Render
|
||||
|
||||
Vector2[] corners = new Vector2[4];
|
||||
|
||||
double topRightAngleFromOrig = Math.Atan((double)height / width);
|
||||
corners[0] = new Vector2(x, y);
|
||||
corners[1] = new Vector2(x + (float)Math.Cos(rotation) * width, y + (float)Math.Sin(rotation) * width);
|
||||
double topRightAngleFromOrig = Math.Atan(height / (double)width);
|
||||
float origDiagonalHypotenuse = (float)Math.Sqrt(width * width * height * height);
|
||||
float origDiagonalHypotenuse = (float)Math.Sqrt((width * width) + (height * height));
|
||||
corners[2] = new Vector2(x + (float)Math.Cos(topRightAngleFromOrig + rotation) * origDiagonalHypotenuse, y + (float)Math.Sin(topRightAngleFromOrig + rotation) * origDiagonalHypotenuse);
|
||||
corners[3] = new Vector2(x + (float)Math.Cos(rotation + (Math.PI / 4f)) * height, y + (float)Math.Sin(rotation) * height);
|
||||
corners[3] = new Vector2(x - (float)(Math.Cos((Math.PI / 2f) - rotation) * height), y + (float)(Math.Sin((Math.PI / 2f) - rotation) * height));
|
||||
|
||||
if (filled)
|
||||
{
|
||||
|
Reference in New Issue
Block a user