From: sajt Date: Sun, 12 Mar 2006 01:04:12 +0000 (+0000) Subject: r_nearclip cvar X-Git-Tag: xonotic-v0.1.0preview~4208 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=94aada72043bfbc7037b7b8423ceac7763f9273c;p=xonotic%2Fdarkplaces.git r_nearclip cvar git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6110 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 4303a2ac..2f262bc0 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -67,6 +67,7 @@ matrix4x4_t r_view_matrix; // refdef_t r_refdef; +cvar_t r_nearclip = {0, "r_nearclip", "1", "distance from camera of nearclip plane" }; cvar_t r_showtris = {0, "r_showtris", "0", "shows triangle outlines, value controls brightness (can be above 1)"}; cvar_t r_showtris_polygonoffset = {0, "r_showtris_polygonoffset", "-10", "nudges triangle outlines in hardware depth units, used to make outlines appear infront of walls"}; cvar_t r_shownormals = {0, "r_shownormals", "0", "shows per-vertex surface normals and tangent vectors for bumpmapped lighting"}; @@ -450,6 +451,7 @@ void GL_Main_Init(void) { // FIXME: move this to client? FOG_registercvars(); + Cvar_RegisterVariable(&r_nearclip); Cvar_RegisterVariable(&r_showtris); Cvar_RegisterVariable(&r_showtris_polygonoffset); Cvar_RegisterVariable(&r_shownormals); @@ -739,7 +741,7 @@ static void R_SetFrustum(void) #endif #if 0 - zNear = 1.0; + zNear = r_nearclip.value; nudge = 1.0 - 1.0 / (1<<23); frustum[4].normal[0] = 0 - 0; frustum[4].normal[1] = 0 - 0; @@ -800,7 +802,7 @@ static void R_SetFrustum(void) frustum[1].dist = DotProduct (r_vieworigin, frustum[1].normal); frustum[2].dist = DotProduct (r_vieworigin, frustum[2].normal); frustum[3].dist = DotProduct (r_vieworigin, frustum[3].normal); - frustum[4].dist = DotProduct (r_vieworigin, frustum[4].normal) + 1.0f; + frustum[4].dist = DotProduct (r_vieworigin, frustum[4].normal) + r_nearclip.value; PlaneClassify(&frustum[0]); PlaneClassify(&frustum[1]); PlaneClassify(&frustum[2]); @@ -833,7 +835,7 @@ static void R_SetFrustum(void) // nearclip plane //VectorCopy(r_viewforward, frustum[4].normal); - //frustum[4].dist = DotProduct (r_vieworigin, frustum[4].normal) + 1.0f; + //frustum[4].dist = DotProduct (r_vieworigin, frustum[4].normal) + r_nearclip.value; //PlaneClassify(&frustum[4]); } @@ -1164,6 +1166,8 @@ extern void R_DrawLightningBeams (void); extern void VM_AddPolygonsToMeshQueue (void); void R_RenderScene(void) { + float nearclip; + // don't let sound skip if going slow if (r_refdef.extraupdate) S_ExtraUpdate (); @@ -1175,10 +1179,12 @@ void R_RenderScene(void) R_SetFrustum(); r_farclip = R_FarClip(r_vieworigin, r_viewforward, 768.0f) + 256.0f; + nearclip = bound (0.001f, r_nearclip.value, r_farclip - 1.0f); + if (r_rtworldshadows || r_rtdlightshadows) - GL_SetupView_Mode_PerspectiveInfiniteFarClip(r_refdef.frustum_x, r_refdef.frustum_y, 1.0f); + GL_SetupView_Mode_PerspectiveInfiniteFarClip(r_refdef.frustum_x, r_refdef.frustum_y, nearclip); else - GL_SetupView_Mode_Perspective(r_refdef.frustum_x, r_refdef.frustum_y, 1.0f, r_farclip); + GL_SetupView_Mode_Perspective(r_refdef.frustum_x, r_refdef.frustum_y, nearclip, r_farclip); GL_SetupView_Orientation_FromEntity(&r_view_matrix); diff --git a/render.h b/render.h index ee06c0f1..6a9b3f77 100644 --- a/render.h +++ b/render.h @@ -143,6 +143,8 @@ extern qboolean r_rtworldshadows; extern qboolean r_rtdlight; extern qboolean r_rtdlightshadows; +extern cvar_t r_nearclip; + // forces all rendering to draw triangle outlines extern cvar_t r_showtris; extern cvar_t r_showtris_polygonoffset; diff --git a/todo b/todo index e4d8a39f..8867b74a 100644 --- a/todo +++ b/todo @@ -115,7 +115,6 @@ 0 feature darkplaces readme: add documentation about r_lockpvs, r_lockvisibility, r_useportalculling, r_drawportals, r_drawcollisionbrushes, r_showtris, r_speeds, r_shadow_visiblevolumes, and r_shadow_visiblelighting. 0 feature darkplaces readme: add log_file and log_sync documentation (Edward Holness) 0 feature darkplaces readme: document the ctrl-escape hotkey for toggleconsole (LordHavoc) -0 feature darkplaces renderer: add a nearclip cvar (Tomaz) 0 feature darkplaces renderer: add a rtlight flag to disable vis culling, for ambient area lights and such (Kaz) 0 feature darkplaces renderer: add cubemap support to low quality rtlighting path for cards that support >= 2 TMUs and cubemap 0 feature darkplaces renderer: add per-entity PolygonOffset to renderer, to allow zfighting bmodel/world glitches to be fixed, this has to affect all rendering involving the entity, including light/shadow (Tomaz) @@ -1096,6 +1095,7 @@ d feature darkplaces physics: add a sv_ cvar to disable demonland.wav when monst d feature darkplaces playerphysics: add sv_maxairspeed cvar and use it in sv_user.c, default 30 to match quake player physics (Vermeulen) d feature darkplaces protocol: add PRYDON_CLIENTCURSOR extension - clientside mouse with highlighting of selected entities with the EF_SELECTABLE flag, and qc fields on the client entity on the server would indicate which entity the cursor is highlighting as well as where it is (Urre, Harb, FrikaC) d feature darkplaces protocol: allow sending of additional precaches during game, this needs to send a reliable message to all connected clients stating the new filename to load, and also to be sent to new connections (VorteX, Vermeulen) +d feature darkplaces renderer: add a nearclip cvar (Tomaz) d feature darkplaces renderer: add q3bsp water rendering, both scrolling and watershader (Zombie) d feature darkplaces renderer: add r_shadow_visiblelighting cvar which draws redish orange polygons similar to visiblevolumes for measuring number of light passes per pixel (Harbish) d feature darkplaces server: add DP_QC_WRITEUNTERMINATEDSTRING extension (shadowalker)