mirror of https://github.com/bjornbytes/lovr.git
Make window mono by default;
The window is now mono by default to make the error screen better and better enable non-stereo uses. The Camera can now request that the window be treated as stereo.
This commit is contained in:
parent
e2d7310914
commit
ce2dfb523e
|
@ -137,6 +137,7 @@ void lovrGraphicsSetCamera(Camera* camera, bool clear) {
|
|||
|
||||
if (!camera) {
|
||||
state.camera.canvas = NULL;
|
||||
state.camera.stereo = false;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mat4_identity(state.camera.viewMatrix[i]);
|
||||
mat4_perspective(state.camera.projection[i], .01f, 100.f, 67 * M_PI / 180., (float) state.width / state.height);
|
||||
|
@ -414,7 +415,7 @@ void lovrGraphicsDraw(DrawOptions* draw) {
|
|||
}
|
||||
|
||||
Canvas* canvas = state.pipelines[state.pipeline].canvas ? state.pipelines[state.pipeline].canvas : state.camera.canvas;
|
||||
bool stereo = !draw->forceMono && (!canvas || lovrCanvasIsStereo(canvas));
|
||||
bool stereo = !draw->forceMono && (canvas ? lovrCanvasIsStereo(canvas) : state.camera.stereo);
|
||||
float w = (canvas ? lovrCanvasGetWidth(canvas) : state.width) >> stereo;
|
||||
float h = canvas ? lovrCanvasGetHeight(canvas) : state.height;
|
||||
int viewportCount = 1 + stereo;
|
||||
|
|
|
@ -95,6 +95,7 @@ typedef struct {
|
|||
} GraphicsStats;
|
||||
|
||||
typedef struct {
|
||||
bool stereo;
|
||||
Canvas* canvas;
|
||||
float viewMatrix[2][16];
|
||||
float projection[2][16];
|
||||
|
|
|
@ -282,7 +282,7 @@ static void fakeRenderTo(void (*callback)(void*), void* userdata) {
|
|||
|
||||
int width, height;
|
||||
fakeGetDisplayDimensions(&width, &height);
|
||||
Camera camera = { .canvas = NULL };
|
||||
Camera camera = { .canvas = NULL, .stereo = true };
|
||||
mat4_perspective(camera.projection[0], state.clipNear, state.clipFar, 67 * M_PI / 180., (float) width / 2 / height);
|
||||
mat4_identity(camera.viewMatrix[0]);
|
||||
mat4_translate(camera.viewMatrix[0], 0, state.offset, 0);
|
||||
|
|
|
@ -90,7 +90,7 @@ static void onFrame(float* leftView, float* rightView, float* leftProjection, fl
|
|||
int width, height;
|
||||
webvrGetDisplayDimensions(&width, &height);
|
||||
|
||||
Camera camera = { .canvas = NULL };
|
||||
Camera camera = { .canvas = NULL, .stereo = true };
|
||||
memcpy(camera.projection[0], leftProjection, 16 * sizeof(float));
|
||||
memcpy(camera.projection[1], rightProjection, 16 * sizeof(float));
|
||||
memcpy(camera.viewMatrix[0], leftView, 16 * sizeof(float));
|
||||
|
|
Loading…
Reference in New Issue