From: havoc Date: Mon, 21 Dec 2009 09:01:24 +0000 (+0000) Subject: use floats rather than doubles for view matrix stuff X-Git-Tag: xonotic-v0.1.0preview~1023 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1b5996fa231c4c4e901c911756e1e316edd27d94;p=xonotic%2Fdarkplaces.git use floats rather than doubles for view matrix stuff git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9625 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_backend.c b/gl_backend.c index adf0ad1c..2b33d81c 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -306,10 +306,10 @@ void R_Viewport_TransformToScreen(const r_viewport_t *v, const vec4_t in, vec4_t out[2] = v->z + (out[2] * iw + 1.0f) * v->depth * 0.5f; } -static void R_Viewport_ApplyNearClipPlane(r_viewport_t *v, double normalx, double normaly, double normalz, double dist) +static void R_Viewport_ApplyNearClipPlane(r_viewport_t *v, float normalx, float normaly, float normalz, float dist) { - double q[4]; - double d; + float q[4]; + float d; float clipPlane[4], v3[3], v4[3]; float normal[3]; @@ -354,7 +354,7 @@ static void R_Viewport_ApplyNearClipPlane(r_viewport_t *v, double normalx, doubl v->m[14] = clipPlane[3] * d; } -void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double x1, double y1, double x2, double y2, double nearclip, double farclip, const double *nearplane) +void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float x1, float y1, float x2, float y2, float nearclip, float farclip, const float *nearplane) { float left = x1, right = x2, bottom = y2, top = y1, zNear = nearclip, zFar = farclip; memset(v, 0, sizeof(*v)); @@ -393,7 +393,7 @@ void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int #endif } -void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double frustumx, double frustumy, double nearclip, double farclip, const double *nearplane) +void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, float farclip, const float *nearplane) { matrix4x4_t tempmatrix, basematrix; memset(v, 0, sizeof(*v)); @@ -428,10 +428,10 @@ void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix R_Viewport_ApplyNearClipPlane(v, nearplane[0], nearplane[1], nearplane[2], nearplane[3]); } -void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double frustumx, double frustumy, double nearclip, const double *nearplane) +void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, const float *nearplane) { matrix4x4_t tempmatrix, basematrix; - const double nudge = 1.0 - 1.0 / (1<<23); + const float nudge = 1.0 - 1.0 / (1<<23); memset(v, 0, sizeof(*v)); if(v_flipped.integer) diff --git a/gl_backend.h b/gl_backend.h index be97481d..46fc3e3f 100644 --- a/gl_backend.h +++ b/gl_backend.h @@ -10,9 +10,9 @@ extern int quadelement3i[QUADELEMENTS_MAXQUADS*6]; extern unsigned short quadelement3s[QUADELEMENTS_MAXQUADS*6]; void R_Viewport_TransformToScreen(const r_viewport_t *v, const vec4_t in, vec4_t out); -void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double x1, double y1, double x2, double y2, double zNear, double zFar, const double *nearplane); -void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double frustumx, double frustumy, double zNear, double zFar, const double *nearplane); -void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double frustumx, double frustumy, double zNear, const double *nearplane); +void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float x1, float y1, float x2, float y2, float zNear, float zFar, const float *nearplane); +void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float zNear, float zFar, const float *nearplane); +void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float zNear, const float *nearplane); void R_Viewport_InitCubeSideView(r_viewport_t *v, const matrix4x4_t *cameramatrix, int side, int size, float nearclip, float farclip, const float *nearplane); void R_Viewport_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatrix, int side, int size, int border, float nearclip, float farclip, const float *nearplane); void R_SetViewport(const r_viewport_t *v); diff --git a/gl_rmain.c b/gl_rmain.c index 49065524..7e2308e2 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -4183,8 +4183,8 @@ void R_View_Update(void) void R_SetupView(qboolean allowwaterclippingplane) { - const double *customclipplane = NULL; - double plane[4]; + const float *customclipplane = NULL; + float plane[4]; if (r_refdef.view.useclipplane && allowwaterclippingplane) { // LordHavoc: couldn't figure out how to make this approach the