{
if (gl_state.blendfunc1 != blendfunc1 || gl_state.blendfunc2 != blendfunc2)
{
- if (r_showtrispass)
- return;
qglBlendFunc(gl_state.blendfunc1 = blendfunc1, gl_state.blendfunc2 = blendfunc2);CHECKGLERROR
if (gl_state.blendfunc2 == GL_ZERO)
{
{
if (gl_state.depthmask != state)
{
- if (r_showtrispass)
- return;
qglDepthMask(gl_state.depthmask = state);CHECKGLERROR
}
}
{
if (gl_state.depthtest != state)
{
- if (r_showtrispass && r_showdisabledepthtest.integer)
- return;
gl_state.depthtest = state;
if (gl_state.depthtest)
{
{
if (gl_state.pointer_color || gl_state.color4f[0] != cr || gl_state.color4f[1] != cg || gl_state.color4f[2] != cb || gl_state.color4f[3] != ca)
{
- if (r_showtrispass)
- return;
gl_state.color4f[0] = cr;
gl_state.color4f[1] = cg;
gl_state.color4f[2] = cb;
}
}
-void GL_ShowTrisColor(float cr, float cg, float cb, float ca)
-{
- if (!r_showtrispass)
- return;
- r_showtrispass = 0;
- GL_Color(cr * r_showtris.value, cg * r_showtris.value, cb * r_showtris.value, ca);
- r_showtrispass = 1;
-}
-
-
void GL_LockArrays(int first, int count)
{
if (gl_state.lockrange_count != count || gl_state.lockrange_first != first)
void GL_Clear(int mask)
{
- // in showtris rendering, don't clear the color buffer as that would hide
- // the accumulated lines
- if (r_showtrispass)
- mask &= ~GL_COLOR_BUFFER_BIT;
qglClear(mask);CHECKGLERROR
}
return;
}
//CHECKGLERROR
- if (r_showtrispass)
- {
- R_Mesh_Draw_ShowTris(firstvertex, numvertices, numtriangles, elements);
- return;
- }
renderstats.meshes++;
renderstats.meshes_elements += numelements;
if (gl_paranoid.integer)
void R_Mesh_ColorPointer(const float *color4f)
{
- if (r_showtrispass)
- return;
if (gl_state.pointer_color != color4f)
{
CHECKGLERROR
void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord)
{
gltextureunit_t *unit = gl_state.units + unitnum;
- if (r_showtrispass)
- return;
// update array settings
if (texcoord)
{
gltextureunit_t *unit = gl_state.units + unitnum;
if (unitnum >= backendimageunits)
return;
- if (r_showtrispass)
- return;
// update 1d texture binding
if (unit->t1d != tex1d)
{
gltextureunit_t *unit = gl_state.units + unitnum;
if (unitnum >= backendimageunits)
return;
- if (r_showtrispass)
- return;
// update 1d texture binding
if (unit->t1d != texnum)
{
gltextureunit_t *unit = gl_state.units + unitnum;
if (unitnum >= backendimageunits)
return;
- if (r_showtrispass)
- return;
// update 1d texture binding
if (unit->t1d)
{
gltextureunit_t *unit = gl_state.units + unitnum;
if (unitnum >= backendimageunits)
return;
- if (r_showtrispass)
- return;
// update 1d texture binding
if (unit->t1d)
{
gltextureunit_t *unit = gl_state.units + unitnum;
if (unitnum >= backendimageunits)
return;
- if (r_showtrispass)
- return;
// update 1d texture binding
if (unit->t1d)
{
void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix)
{
gltextureunit_t *unit = gl_state.units + unitnum;
- if (r_showtrispass)
- return;
if (matrix->m[3][3])
{
// texmatrix specified, check if it is different
void R_Mesh_TexCombine(unsigned int unitnum, int combinergb, int combinealpha, int rgbscale, int alphascale)
{
gltextureunit_t *unit = gl_state.units + unitnum;
- if (r_showtrispass)
- return;
if (gl_combine.integer)
{
// GL_ARB_texture_env_combine
qboolean r_rtdlightshadows;
-// forces all rendering to draw triangle outlines
-int r_showtrispass;
-
// view origin
vec3_t r_vieworigin;
vec3_t r_viewforward;
int r_view_height;
int r_view_depth;
matrix4x4_t r_view_matrix;
-
+float r_polygonfactor;
+float r_polygonoffset;
+float r_shadowpolygonfactor;
+float r_shadowpolygonoffset;
//
// screen size info
//
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"};
cvar_t r_showlighting = {0, "r_showlighting", "0", "shows areas lit by lights, useful for finding out why some areas of a map render slowly (bright orange = lots of passes = slow), a value of 2 disables depth testing which can be interesting but not very useful"};
cvar_t r_showshadowvolumes = {0, "r_showshadowvolumes", "0", "shows areas shadowed by lights, useful for finding out why some areas of a map render slowly (bright blue = lots of passes = slow), a value of 2 disables depth testing which can be interesting but not very useful"};
FOG_registercvars(); // FIXME: move this fog stuff to client?
Cvar_RegisterVariable(&r_nearclip);
Cvar_RegisterVariable(&r_showtris);
- Cvar_RegisterVariable(&r_showtris_polygonoffset);
Cvar_RegisterVariable(&r_shownormals);
Cvar_RegisterVariable(&r_showlighting);
Cvar_RegisterVariable(&r_showshadowvolumes);
r_rtdlight = (r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer) && !gl_flashblend.integer;
r_rtdlightshadows = r_rtdlight && (r_rtworld ? r_shadow_realtime_world_dlightshadows.integer : r_shadow_realtime_dlight_shadows.integer) && gl_stencil;
r_lightmapintensity = r_rtworld ? r_shadow_realtime_world_lightmaps.value : 1;
+ r_polygonfactor = 0;
+ r_polygonoffset = 0;
+ r_shadowpolygonfactor = r_polygonfactor + r_shadow_shadow_polygonfactor.value;
+ r_shadowpolygonoffset = r_polygonoffset + r_shadow_shadow_polygonoffset.value;
// GL is weird because it's bottom to top, r_view_y is top to bottom
qglViewport(r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height);
R_TimeReport("setup");
qglDepthFunc(GL_LEQUAL);
- qglPolygonOffset(0, 0);
+ qglPolygonOffset(r_polygonfactor, r_polygonoffset);
qglEnable(GL_POLYGON_OFFSET_FILL);
R_RenderScene();
- qglPolygonOffset(0, 0);
+ qglPolygonOffset(r_polygonfactor, r_polygonoffset);
qglDisable(GL_POLYGON_OFFSET_FILL);
R_BlendView();
void CSQC_R_RenderScene (void)
{
qglDepthFunc(GL_LEQUAL);
- qglPolygonOffset(0, 0);
+ qglPolygonOffset(r_polygonfactor, r_polygonoffset);
qglEnable(GL_POLYGON_OFFSET_FILL);
R_RenderScene();
- qglPolygonOffset(0, 0);
+ qglPolygonOffset(r_polygonfactor, r_polygonoffset);
qglDisable(GL_POLYGON_OFFSET_FILL);
R_BlendView();
R_Shadow_UpdateWorldLightSelection();
- for (r_showtrispass = 0;r_showtrispass <= (r_showtris.value > 0);r_showtrispass++)
+ if (cl.csqc_vidvars.drawworld)
{
- if (r_showtrispass)
- {
- rmeshstate_t m;
- r_showtrispass = 0;
- GL_BlendFunc(GL_ONE, GL_ONE);
- GL_DepthTest(!r_showdisabledepthtest.integer);
- GL_DepthMask(GL_FALSE);
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
- //qglEnable(GL_LINE_SMOOTH);
- qglEnable(GL_POLYGON_OFFSET_LINE);
- qglPolygonOffset(0, r_showtris_polygonoffset.value);
- r_showtrispass = 1;
- }
-
- if (cl.csqc_vidvars.drawworld)
- {
- // don't let sound skip if going slow
- if (r_refdef.extraupdate)
- S_ExtraUpdate ();
-
- if (r_showtrispass)
- GL_ShowTrisColor(0.025, 0.025, 0, 1);
- if (r_refdef.worldmodel && r_refdef.worldmodel->DrawSky)
- {
- r_refdef.worldmodel->DrawSky(r_refdef.worldentity);
- if (r_timereport_active)
- R_TimeReport("worldsky");
- }
-
- if (R_DrawBrushModelsSky() && r_timereport_active)
- R_TimeReport("bmodelsky");
-
- if (r_showtrispass)
- GL_ShowTrisColor(0.05, 0.05, 0.05, 1);
- if (r_refdef.worldmodel && r_refdef.worldmodel->Draw)
- {
- r_refdef.worldmodel->Draw(r_refdef.worldentity);
- if (r_timereport_active)
- R_TimeReport("world");
- }
- }
-
// don't let sound skip if going slow
if (r_refdef.extraupdate)
S_ExtraUpdate ();
- if (r_showtrispass)
- GL_ShowTrisColor(0, 0.015, 0, 1);
-
- R_DrawModels();
- if (r_timereport_active)
- R_TimeReport("models");
+ if (r_refdef.worldmodel && r_refdef.worldmodel->DrawSky)
+ {
+ r_refdef.worldmodel->DrawSky(r_refdef.worldentity);
+ if (r_timereport_active)
+ R_TimeReport("worldsky");
+ }
- // don't let sound skip if going slow
- if (r_refdef.extraupdate)
- S_ExtraUpdate ();
+ if (R_DrawBrushModelsSky() && r_timereport_active)
+ R_TimeReport("bmodelsky");
- if (r_showtrispass)
- GL_ShowTrisColor(0, 0, 0.033, 1);
- R_ShadowVolumeLighting(false);
- if (r_timereport_active)
- R_TimeReport("rtlights");
+ if (r_refdef.worldmodel && r_refdef.worldmodel->Draw)
+ {
+ r_refdef.worldmodel->Draw(r_refdef.worldentity);
+ if (r_timereport_active)
+ R_TimeReport("world");
+ }
+ }
- // don't let sound skip if going slow
- if (r_refdef.extraupdate)
- S_ExtraUpdate ();
+ // don't let sound skip if going slow
+ if (r_refdef.extraupdate)
+ S_ExtraUpdate ();
- if (r_showtrispass)
- GL_ShowTrisColor(0.1, 0, 0, 1);
+ R_DrawModels();
+ if (r_timereport_active)
+ R_TimeReport("models");
- if (cl.csqc_vidvars.drawworld)
- {
- R_DrawLightningBeams();
- if (r_timereport_active)
- R_TimeReport("lightning");
+ // don't let sound skip if going slow
+ if (r_refdef.extraupdate)
+ S_ExtraUpdate ();
- R_DrawParticles();
- if (r_timereport_active)
- R_TimeReport("particles");
+ R_ShadowVolumeLighting(false);
+ if (r_timereport_active)
+ R_TimeReport("rtlights");
- R_DrawExplosions();
- if (r_timereport_active)
- R_TimeReport("explosions");
- }
+ // don't let sound skip if going slow
+ if (r_refdef.extraupdate)
+ S_ExtraUpdate ();
- R_MeshQueue_RenderTransparent();
+ if (cl.csqc_vidvars.drawworld)
+ {
+ R_DrawLightningBeams();
if (r_timereport_active)
- R_TimeReport("drawtrans");
+ R_TimeReport("lightning");
- if (cl.csqc_vidvars.drawworld)
- {
- R_DrawCoronas();
- if (r_timereport_active)
- R_TimeReport("coronas");
- }
- if(cl.csqc_vidvars.drawcrosshair)
- {
- R_DrawWorldCrosshair();
- if (r_timereport_active)
- R_TimeReport("crosshair");
- }
+ R_DrawParticles();
+ if (r_timereport_active)
+ R_TimeReport("particles");
- VM_AddPolygonsToMeshQueue();
+ R_DrawExplosions();
+ if (r_timereport_active)
+ R_TimeReport("explosions");
+ }
- R_MeshQueue_Render();
+ R_MeshQueue_RenderTransparent();
+ if (r_timereport_active)
+ R_TimeReport("drawtrans");
- if (r_showtrispass)
- {
- //qglDisable(GL_LINE_SMOOTH);
- qglDisable(GL_POLYGON_OFFSET_LINE);
- }
+ if (cl.csqc_vidvars.drawworld)
+ {
+ R_DrawCoronas();
+ if (r_timereport_active)
+ R_TimeReport("coronas");
}
+ if(cl.csqc_vidvars.drawcrosshair)
+ {
+ R_DrawWorldCrosshair();
+ if (r_timereport_active)
+ R_TimeReport("crosshair");
+ }
+
+ VM_AddPolygonsToMeshQueue();
- r_showtrispass = 0;
+ R_MeshQueue_Render();
R_MeshQueue_EndScene();
}
}
}
- if (r_shownormals.integer && !r_showtrispass)
- {
- int j, k;
- float v[3];
- GL_DepthTest(!r_showdisabledepthtest.integer);
- GL_DepthMask(texture->currentlayers->depthmask);
- GL_BlendFunc(texture->currentlayers->blendfunc1, texture->currentlayers->blendfunc2);
- memset(&m, 0, sizeof(m));
- R_Mesh_State(&m);
- for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
- {
- surface = texturesurfacelist[texturesurfaceindex];
- RSurf_SetVertexPointer(ent, texture, surface, modelorg, false, true);
- GL_Color(1, 0, 0, 1);
- qglBegin(GL_LINES);
- for (j = 0, k = surface->num_firstvertex;j < surface->num_vertices;j++, k++)
- {
- VectorCopy(rsurface_vertex3f + k * 3, v);
- qglVertex3f(v[0], v[1], v[2]);
- VectorMA(v, 8, rsurface_svector3f + k * 3, v);
- qglVertex3f(v[0], v[1], v[2]);
- }
- GL_Color(0, 0, 1, 1);
- for (j = 0, k = surface->num_firstvertex;j < surface->num_vertices;j++, k++)
- {
- VectorCopy(rsurface_vertex3f + k * 3, v);
- qglVertex3f(v[0], v[1], v[2]);
- VectorMA(v, 8, rsurface_tvector3f + k * 3, v);
- qglVertex3f(v[0], v[1], v[2]);
- }
- GL_Color(0, 1, 0, 1);
- for (j = 0, k = surface->num_firstvertex;j < surface->num_vertices;j++, k++)
- {
- VectorCopy(rsurface_vertex3f + k * 3, v);
- qglVertex3f(v[0], v[1], v[2]);
- VectorMA(v, 8, rsurface_normal3f + k * 3, v);
- qglVertex3f(v[0], v[1], v[2]);
- }
- qglEnd();
- }
- }
}
if ((texture->textureflags & Q3TEXTUREFLAG_TWOSIDED) || (ent->flags & RENDER_NOCULLFACE))
qglEnable(GL_CULL_FACE);
}
if (numsurfacelist)
R_QueueTextureSurfaceList(ent, texture, numsurfacelist, surfacelist, modelorg);
- if (!r_showtrispass)
- renderstats.entities_triangles += counttriangles;
+ renderstats.entities_triangles += counttriangles;
if (gl_support_fragment_shader)
qglUseProgramObjectARB(0);
+
+ if (r_showtris.integer || r_shownormals.integer)
+ {
+ int k, l;
+ const int *elements;
+ rmeshstate_t m;
+ vec3_t v;
+ GL_DepthTest(true);
+ GL_DepthMask(true);
+ if (r_showdisabledepthtest.integer)
+ qglDepthFunc(GL_ALWAYS);
+ GL_BlendFunc(GL_ONE, GL_ZERO);
+ memset(&m, 0, sizeof(m));
+ R_Mesh_State(&m);
+ for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++)
+ {
+ if (ent == r_refdef.worldentity && !r_worldsurfacevisible[j])
+ continue;
+ texture = surface->texture->currentframe;
+ if ((texture->currentmaterialflags & flagsmask) && surface->num_triangles)
+ {
+ RSurf_SetVertexPointer(ent, texture, surface, modelorg, false, r_shownormals.integer != 0);
+ if (r_showtris.integer)
+ {
+ if (!texture->currentlayers->depthmask)
+ GL_Color(r_showtris.value, 0, 0, 1);
+ else if (ent == r_refdef.worldentity)
+ GL_Color(r_showtris.value, r_showtris.value, r_showtris.value, 1);
+ else
+ GL_Color(0, r_showtris.value, 0, 1);
+ elements = (surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle);
+ qglBegin(GL_LINES);
+ for (k = 0;k < surface->num_triangles;k++, elements += 3)
+ {
+ qglArrayElement(elements[0]);qglArrayElement(elements[1]);
+ qglArrayElement(elements[1]);qglArrayElement(elements[2]);
+ qglArrayElement(elements[2]);qglArrayElement(elements[0]);
+ }
+ qglEnd();
+ }
+ if (r_shownormals.integer)
+ {
+ GL_Color(r_shownormals.value, 0, 0, 1);
+ qglBegin(GL_LINES);
+ for (k = 0, l = surface->num_firstvertex;k < surface->num_vertices;k++, l++)
+ {
+ VectorCopy(rsurface_vertex3f + l * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ VectorMA(v, 8, rsurface_svector3f + l * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ }
+ qglEnd();
+ GL_Color(0, 0, r_shownormals.value, 1);
+ qglBegin(GL_LINES);
+ for (k = 0, l = surface->num_firstvertex;k < surface->num_vertices;k++, l++)
+ {
+ VectorCopy(rsurface_vertex3f + l * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ VectorMA(v, 8, rsurface_tvector3f + l * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ }
+ qglEnd();
+ GL_Color(0, r_shownormals.value, 0, 1);
+ qglBegin(GL_LINES);
+ for (k = 0, l = surface->num_firstvertex;k < surface->num_vertices;k++, l++)
+ {
+ VectorCopy(rsurface_vertex3f + l * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ VectorMA(v, 8, rsurface_normal3f + l * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ }
+ qglEnd();
+ }
+ }
+ }
+ if (r_showdisabledepthtest.integer)
+ qglDepthFunc(GL_LEQUAL);
+ }
}
-d (Black) bug darkplaces console: $* expansion should not include $0 (Black)
-d (Carni) bug darkplaces client: prydon cursor highlighting of EF_SELECTABLE entities flickers with lower server framerate than client framerate (carni)
-d (Edward Holness) feature darkplaces console: add condump command to output recent console history (note: wordwrap will remain, trailing spaces will be stripped though), and add it to the readme (Edward Holness)
--d (FrikaC) bug darkplaces console: alias test "echo 1";test;echo 2 should print 1 then 2, not 2 then 1 or an error (div0, FrikaC)
--d (FrikaC) bug darkplaces server: call checkvelocity (to clear NaNs) every time velocity is set in physics, to fix frikbot (tell FrikaC)
--d (FrikaC) bug hmap2: make sure seconds reports in all tools don't print secondssss when they're printing shorter and shorter updates (FrikaC)
-d (Gilgamesh) feature darkplaces protocol: add back colormod extension (FrikaC, Uffe, Gilgamesh, Wazat)
-d (Gleeb) feature darkplaces server: add sv_playerphysicsqc cvar to allow engine to ignore SV_PlayerPhysics function, this would also have to change the reported extensions (Gleeb)
-d (HellToupee) feature darkplaces client: add a dot crosshair texture (HellToupee)
0 feature darkplaces website: add q1source.zip to downloads page and suggest that mingw/Dev-C++ users may need the dx headers from it (cpuforbrain)
0 feature darkplaces: .vis files - like .lit but replacement vis data, note this also requires .leaf files (knghtbrd)
0 feature dpmaster: don't filter by protocol version if query is for protocol version 0, this way server browsers can see multiple versions of a single game, should probably also add a 'any' gamename that disables gamename filtering (Angst, Elric)
+0 feature dpmod: add a g_spawnprotectiontime cvar which would default to 1 (invulnerable for 1 second after spawn) to prevent mining the spawn points
0 feature dpmod: add a summon command using KRIMZON_SV_PARSECLIENTCOMMAND which would summon the specified monster infront of you (Kedhrin)
0 feature dpmod: add knight/hell knight swords as player weapons (TimeServ)
0 feature dpmod: add mode with respawning monsters
d bug darkplaces collision: check Urre's sltest.bsp and slopestuck.dem and fix the sticking bug, which only happens with sv_newflymove 1 (Urre)
d bug darkplaces commands: say command is not posting to server console (Vermeulen)
d bug darkplaces console: $variable expansion is not working on forwarded commands like "say I'm $_cl_name", it does work on local commands like set (esteel, Black)
+d bug darkplaces console: alias test "echo 1";test;echo 2 should print 1 then 2, not 2 then 1 or an error (div0, FrikaC)
d bug darkplaces console: chat messages are showing up in brown quake characters and having ^7 and such printed literally
d bug darkplaces console: console script lines that are too long (1024+ characters) crash (NecroPhil, Black)
d bug darkplaces console: inserting characters in the commandline is not adding a nul terminator to the commandline, resulting in lots of trash from older commandlines suddenly showing up (Spike)
d bug darkplaces server: SV_SpawnServer should send reconnect command using per-client reliable messages, because sv.reliable_datagram is being cleared
d bug darkplaces server: add TE_FLAMEJET builtin and add extension (Supajoe)
d bug darkplaces server: add color code to start of chat message to prevent nick colors from messing up the text color
+d bug darkplaces server: call checkvelocity (to clear NaNs) every time velocity is set in physics, to fix frikbot (tell FrikaC)
d bug darkplaces server: cl_movement 0 clients can pogostick jump and do quake2 style double jumps... why? answer: id1 qc move was clearing self.button2 each time it jumped, which causes it to pogostick when client input rate is lower than server framerate, fixed. (div)
d bug darkplaces server: don't clear player entity when loading a savegame
d bug darkplaces server: dropclient() is not calling ClientDisconnect on bots during the first level they exist in, it is called on later levels (Urre)
d bug dpmod: items aren't respawning in coop, they should
d bug dpmod: shouldn't get double kill for killing something and its corpse (Sajt)
d bug dpmodel: scale parameter isn't affecting animations (Ghostface)
+d bug hmap2: make sure seconds reports in all tools don't print secondssss when they're printing shorter and shorter updates (FrikaC)
d bug hmap2: strip .map extension from filename if present
d bug zmodel: makefile should support mingw
d change darkplaces client: add some particles to teleportsplash (Uffe)