//
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"};
{
// FIXME: move this to client?
FOG_registercvars();
+ Cvar_RegisterVariable(&r_nearclip);
Cvar_RegisterVariable(&r_showtris);
Cvar_RegisterVariable(&r_showtris_polygonoffset);
Cvar_RegisterVariable(&r_shownormals);
#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;
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]);
// 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]);
}
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 ();
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);
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)
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)