mirror of https://github.com/bjornbytes/lovr.git
Add lovr.graphics.setProjection;
It's not very good. It only takes Transforms and sets the projection for both eyes. And the projection gets reset at the beginning and end of lovr.headset.renderTo. It's meant to be a backdoor.
This commit is contained in:
parent
f6d5bf325a
commit
654b894ded
|
@ -13,6 +13,7 @@
|
|||
#include "data/textureData.h"
|
||||
#include "data/vertexData.h"
|
||||
#include "filesystem/filesystem.h"
|
||||
#include "math/transform.h"
|
||||
#include "util.h"
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
@ -584,6 +585,12 @@ static int l_lovrGraphicsTransform(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsSetProjection(lua_State* L) {
|
||||
Transform* transform = luax_checktype(L, 1, Transform);
|
||||
lovrGraphicsSetProjection(transform->matrix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Rendering
|
||||
|
||||
static int l_lovrGraphicsClear(lua_State* L) {
|
||||
|
@ -1302,6 +1309,7 @@ static const luaL_Reg lovrGraphics[] = {
|
|||
{ "rotate", l_lovrGraphicsRotate },
|
||||
{ "scale", l_lovrGraphicsScale },
|
||||
{ "transform", l_lovrGraphicsTransform },
|
||||
{ "setProjection", l_lovrGraphicsSetProjection },
|
||||
|
||||
// Rendering
|
||||
{ "clear", l_lovrGraphicsClear },
|
||||
|
|
|
@ -361,6 +361,11 @@ void lovrGraphicsMatrixTransform(mat4 transform) {
|
|||
mat4_multiply(state.transforms[state.transform], transform);
|
||||
}
|
||||
|
||||
void lovrGraphicsSetProjection(mat4 projection) {
|
||||
mat4_set(state.camera.projection[0], projection);
|
||||
mat4_set(state.camera.projection[1], projection);
|
||||
}
|
||||
|
||||
// Rendering
|
||||
|
||||
VertexPointer lovrGraphicsGetVertexPointer(uint32_t count) {
|
||||
|
|
|
@ -206,6 +206,7 @@ void lovrGraphicsTranslate(float x, float y, float z);
|
|||
void lovrGraphicsRotate(float angle, float ax, float ay, float az);
|
||||
void lovrGraphicsScale(float x, float y, float z);
|
||||
void lovrGraphicsMatrixTransform(mat4 transform);
|
||||
void lovrGraphicsSetProjection(mat4 projection);
|
||||
|
||||
// Rendering
|
||||
VertexPointer lovrGraphicsGetVertexPointer(uint32_t capacity);
|
||||
|
|
Loading…
Reference in New Issue