]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
GL_TransformToScreen now properly calculates out[2], thanks to Vic for pointing out...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 20 May 2004 23:05:55 +0000 (23:05 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 20 May 2004 23:05:55 +0000 (23:05 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4206 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c
gl_rmain.c
render.h

index 889aa0ef4f2ce9f530225ab2204dd75a6d221ae7..c5cd70aeade7815fb45b292462bcdb6301ec006a 100644 (file)
@@ -696,7 +696,7 @@ void GL_TransformToScreen(const vec4_t in, vec4_t out)
        iw = 1.0f / out[3];
        out[0] = r_view_x + (out[0] * iw + 1.0f) * r_view_width * 0.5f;
        out[1] = r_view_y + (out[1] * iw + 1.0f) * r_view_height * 0.5f;
        iw = 1.0f / out[3];
        out[0] = r_view_x + (out[0] * iw + 1.0f) * r_view_width * 0.5f;
        out[1] = r_view_y + (out[1] * iw + 1.0f) * r_view_height * 0.5f;
-       out[2] = out[2] * iw;
+       out[2] = r_view_z + (out[2] * iw + 1.0f) * r_view_depth * 0.5f;
 }
 
 // called at beginning of frame
 }
 
 // called at beginning of frame
index bf8e978bade964672e43d53417030598456caad9..53f424335d6c7db7f30beac5b9747766d80d1c45 100644 (file)
@@ -50,8 +50,10 @@ vec3_t r_viewright;
 vec3_t r_viewup;
 int r_view_x;
 int r_view_y;
 vec3_t r_viewup;
 int r_view_x;
 int r_view_y;
+int r_view_z;
 int r_view_width;
 int r_view_height;
 int r_view_width;
 int r_view_height;
+int r_view_depth;
 float r_view_fov_x;
 float r_view_fov_y;
 matrix4x4_t r_view_matrix;
 float r_view_fov_x;
 float r_view_fov_y;
 matrix4x4_t r_view_matrix;
@@ -617,8 +619,10 @@ void R_RenderView(void)
        
        r_view_width = bound(0, r_refdef.width, vid.realwidth);
        r_view_height = bound(0, r_refdef.height, vid.realheight);
        
        r_view_width = bound(0, r_refdef.width, vid.realwidth);
        r_view_height = bound(0, r_refdef.height, vid.realheight);
+       r_view_depth = 1;
        r_view_x = bound(0, r_refdef.x, vid.realwidth - r_refdef.width);
        r_view_y = bound(0, r_refdef.y, vid.realheight - r_refdef.height);
        r_view_x = bound(0, r_refdef.x, vid.realwidth - r_refdef.width);
        r_view_y = bound(0, r_refdef.y, vid.realheight - r_refdef.height);
+       r_view_z = 0;
        r_view_fov_x = bound(1, r_refdef.fov_x, 170);
        r_view_fov_y = bound(1, r_refdef.fov_y, 170);
        r_view_matrix = r_refdef.viewentitymatrix;
        r_view_fov_x = bound(1, r_refdef.fov_x, 170);
        r_view_fov_y = bound(1, r_refdef.fov_y, 170);
        r_view_matrix = r_refdef.viewentitymatrix;
index 339333ae0864306390786839ff59e797c883de54..8829913932f21bd3b6aa1c75a5ad1721dc9ad4d8 100644 (file)
--- a/render.h
+++ b/render.h
@@ -100,8 +100,10 @@ extern vec3_t r_viewright;
 extern vec3_t r_viewup;
 extern int r_view_x;
 extern int r_view_y;
 extern vec3_t r_viewup;
 extern int r_view_x;
 extern int r_view_y;
+extern int r_view_z;
 extern int r_view_width;
 extern int r_view_height;
 extern int r_view_width;
 extern int r_view_height;
+extern int r_view_depth;
 extern float r_view_fov_x;
 extern float r_view_fov_y;
 extern matrix4x4_t r_view_matrix;
 extern float r_view_fov_x;
 extern float r_view_fov_y;
 extern matrix4x4_t r_view_matrix;