Add basic ortho and perspective projection APIs to love.graphics.

- Added love.graphics.setOrthoProjection.
- Added love.graphics.setPerspectiveProjection.
- Added love.graphics.resetProjection.

Note that the projection is reset whenever the canvas changes.
This commit is contained in:
Alex Szpakowski
2022-01-08 22:56:21 -04:00
parent 7f3538d2ba
commit ff83ee6a9c
8 changed files with 219 additions and 15 deletions
+11
View File
@@ -23,6 +23,7 @@
// LOVE
#include "math.h"
#include "Vector.h"
namespace love
{
@@ -88,6 +89,11 @@ public:
**/
const float *getElements() const;
void setRow(int r, const Vector4 &v);
Vector4 getRow(int r) const;
void setColumn(int c, const Vector4 &v);
Vector4 getColumn(int c) const;
/**
* Resets this Matrix to the identity matrix.
**/
@@ -222,6 +228,11 @@ public:
**/
static Matrix4 ortho(float left, float right, float bottom, float top, float near, float far);
/**
* Creates a new perspective projection matrix.
**/
static Matrix4 perspective(float verticalfov, float aspect, float near, float far);
private:
/**