getDisplayDimensions: Use unsigned ints;

Fixes a warning.
This commit is contained in:
bjorn 2018-10-21 08:40:57 -07:00
parent f9c443d7b3
commit 518d26aad8
8 changed files with 21 additions and 18 deletions

View File

@ -115,24 +115,24 @@ static int l_lovrHeadsetSetMirrored(lua_State* L) {
}
static int l_lovrHeadsetGetDisplayWidth(lua_State* L) {
int width, height;
uint32_t width, height;
lovrHeadsetDriver->getDisplayDimensions(&width, &height);
lua_pushnumber(L, width);
lua_pushinteger(L, width);
return 1;
}
static int l_lovrHeadsetGetDisplayHeight(lua_State* L) {
int width, height;
uint32_t width, height;
lovrHeadsetDriver->getDisplayDimensions(&width, &height);
lua_pushnumber(L, height);
lua_pushinteger(L, height);
return 1;
}
static int l_lovrHeadsetGetDisplayDimensions(lua_State* L) {
int width, height;
uint32_t width, height;
lovrHeadsetDriver->getDisplayDimensions(&width, &height);
lua_pushnumber(L, width);
lua_pushnumber(L, height);
lua_pushinteger(L, width);
lua_pushinteger(L, height);
return 2;
}

View File

@ -113,11 +113,14 @@ static void fakeSetMirrored(bool mirror, HeadsetEye eye) {
state.mirrorEye = eye;
}
static void fakeGetDisplayDimensions(int* width, int* height) {
static void fakeGetDisplayDimensions(uint32_t* width, uint32_t* height) {
updateWindow();
if (state.window) {
glfwGetFramebufferSize(state.window, width, height);
int w, h;
glfwGetFramebufferSize(state.window, &w, &h);
*width = (uint32_t) w;
*height = (uint32_t) h;
}
}
@ -215,7 +218,7 @@ static void fakeRenderTo(void (*callback)(void*), void* userdata) {
return;
}
int width, height;
uint32_t width, height;
fakeGetDisplayDimensions(&width, &height);
bool stereo = state.mirrorEye == EYE_BOTH;
Camera camera = { .canvas = NULL, .viewMatrix = { MAT4_IDENTITY }, .stereo = stereo };

View File

@ -73,7 +73,7 @@ typedef struct {
bool (*isMounted)();
void (*isMirrored)(bool* mirrored, HeadsetEye* eye);
void (*setMirrored)(bool mirror, HeadsetEye eye);
void (*getDisplayDimensions)(int* width, int* height);
void (*getDisplayDimensions)(uint32_t* width, uint32_t* height);
void (*getClipDistance)(float* clipNear, float* clipFar);
void (*setClipDistance)(float clipNear, float clipFar);
void (*getBoundsDimensions)(float* width, float* depth);

View File

@ -171,7 +171,7 @@ static void oculusSetMirrored(bool mirror, HeadsetEye eye) {
state.mirrorEye = eye;
}
static void oculusGetDisplayDimensions(int* width, int* height) {
static void oculusGetDisplayDimensions(uint32_t* width, uint32_t* height) {
ovrHmdDesc desc = ovr_GetHmdDesc(state.session);
ovrSizei size = ovr_GetFovTextureSize(state.session, ovrEye_Left, desc.DefaultEyeFov[0], 1.0f);

View File

@ -295,7 +295,7 @@ static void openvrSetMirrored(bool mirror, HeadsetEye eye) {
state.mirrorEye = eye;
}
static void openvrGetDisplayDimensions(int* width, int* height) {
static void openvrGetDisplayDimensions(uint32_t* width, uint32_t* height) {
state.system->GetRecommendedRenderTargetSize(width, height);
}

View File

@ -12,7 +12,7 @@ extern HeadsetOrigin webvrGetOriginType(void);
extern bool webvrIsMounted(void);
extern bool webvrIsMirrored(void);
extern void webvrSetMirrored(bool mirror);
extern void webvrGetDisplayDimensions(int32_t* width, int32_t* height);
extern void webvrGetDisplayDimensions(uint32_t* width, uint32_t* height);
extern void webvrGetClipDistance(float* near, float* far);
extern void webvrSetClipDistance(float near, float far);
extern void webvrGetBoundsDimensions(float* width, float* depth);

View File

@ -297,7 +297,7 @@ mat4 mat4_orthographic(mat4 m, float left, float right, float top, float bottom,
float rl = right - left;
float tb = top - bottom;
float fn = clipFar - clipNear;
mat4_identity(m);
memset(m, 0, 16 * sizeof(float));
m[0] = 2 / rl;
m[5] = 2 / tb;
m[10] = -2 / fn;
@ -314,7 +314,7 @@ mat4 mat4_perspective(mat4 m, float clipNear, float clipFar, float fovy, float a
float sy = clipNear / range;
float sz = -(clipFar + clipNear) / (clipFar - clipNear);
float pz = (-2.0f * clipFar * clipNear) / (clipFar - clipNear);
mat4_identity(m);
memset(m, 0, 16 * sizeof(float));
m[0] = sx;
m[5] = sy;
m[10] = sz;

View File

@ -152,8 +152,8 @@ var LibraryLOVR = {
},
webvrGetDisplayDimensions: function(width, height) {
HEAP32[width >> 2] = webvr.width;
HEAP32[height >> 2] = webvr.height;
HEAPU32[width >> 2] = webvr.width;
HEAPU32[height >> 2] = webvr.height;
},
webvrGetClipDistance: function(clipNear, clipFar) {