rectangle renderer now has correct corner calculations; switched to vertex buffer for primitive batch. still wip.

This commit is contained in:
2019-02-13 07:43:35 -06:00
parent de93e35b07
commit 68345ada3c
2 changed files with 34 additions and 18 deletions

View File

@@ -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)
{