mplane_t frustum[5];
-matrix4x4_t r_identitymatrix;
+matrix4x4_t identitymatrix;
renderstats_t renderstats;
void GL_Main_Init(void)
{
- Matrix4x4_CreateIdentity(&r_identitymatrix);
// FIXME: move this to client?
FOG_registercvars();
Cvar_RegisterVariable(&r_showtris);
Cvar_RegisterVariable(&developer_texturelogging);
Cvar_RegisterVariable(&gl_lightmaps);
Cvar_RegisterVariable(&r_test);
- if (gamemode == GAME_NEHAHRA || gamemode == GAME_NEXUIZ || gamemode == GAME_TENEBRAE)
+ if (gamemode == GAME_NEHAHRA || gamemode == GAME_TENEBRAE)
Cvar_SetValue("r_fullbrights", 0);
R_RegisterModule("GL_Main", gl_main_start, gl_main_shutdown, gl_main_newmap);
}
GL_SetupView_Mode_Ortho(0, 0, 1, 1, -10, 100);
GL_DepthMask(true);
GL_DepthTest(false);
- R_Mesh_Matrix(&r_identitymatrix);
+ R_Mesh_Matrix(&identitymatrix);
// vertex coordinates for a quad that covers the screen exactly
varray_vertex3f[0] = 0;varray_vertex3f[1] = 0;varray_vertex3f[2] = 0;
varray_vertex3f[3] = 1;varray_vertex3f[4] = 0;varray_vertex3f[5] = 0;
R_ClearScreen();
R_Textures_Frame();
R_UpdateFog();
- R_TimeReport("setup");
+ if (r_timereport_active)
+ R_TimeReport("setup");
qglDepthFunc(GL_LEQUAL);
qglPolygonOffset(0, 0);
qglDisable(GL_POLYGON_OFFSET_FILL);
R_BlendView();
- R_TimeReport("blendview");
+ if (r_timereport_active)
+ R_TimeReport("blendview");
GL_Scissor(0, 0, vid.width, vid.height);
GL_ScissorTest(false);
R_ClearScreen();
R_Textures_Frame();
R_UpdateFog();
- R_TimeReport("setup");
+ if (r_timereport_active)
+ R_TimeReport("setup");
}
//[515]: csqc
qglDisable(GL_POLYGON_OFFSET_FILL);
R_BlendView();
- R_TimeReport("blendview");
+ if (r_timereport_active)
+ R_TimeReport("blendview");
GL_Scissor(0, 0, vid.width, vid.height);
GL_ScissorTest(false);
R_SkyStartFrame();
R_WorldVisibility();
- R_TimeReport("worldvis");
+ if (r_timereport_active)
+ R_TimeReport("worldvis");
R_MarkEntities();
- R_TimeReport("markentity");
+ if (r_timereport_active)
+ R_TimeReport("markentity");
R_Shadow_UpdateWorldLightSelection();
if (r_refdef.extraupdate)
S_ExtraUpdate ();
- GL_ShowTrisColor(0.025, 0.025, 0, 1);
+ 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);
- R_TimeReport("worldsky");
+ if (r_timereport_active)
+ R_TimeReport("worldsky");
}
- if (R_DrawBrushModelsSky())
+ if (R_DrawBrushModelsSky() && r_timereport_active)
R_TimeReport("bmodelsky");
- GL_ShowTrisColor(0.05, 0.05, 0.05, 1);
+ 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);
- R_TimeReport("world");
+ if (r_timereport_active)
+ R_TimeReport("world");
}
}
if (r_refdef.extraupdate)
S_ExtraUpdate ();
- GL_ShowTrisColor(0, 0.015, 0, 1);
+ if (r_showtrispass)
+ GL_ShowTrisColor(0, 0.015, 0, 1);
R_DrawModels();
- R_TimeReport("models");
+ if (r_timereport_active)
+ R_TimeReport("models");
// don't let sound skip if going slow
if (r_refdef.extraupdate)
S_ExtraUpdate ();
- GL_ShowTrisColor(0, 0, 0.033, 1);
+ if (r_showtrispass)
+ GL_ShowTrisColor(0, 0, 0.033, 1);
R_ShadowVolumeLighting(false);
- R_TimeReport("rtlights");
+ if (r_timereport_active)
+ R_TimeReport("rtlights");
// don't let sound skip if going slow
if (r_refdef.extraupdate)
S_ExtraUpdate ();
- GL_ShowTrisColor(0.1, 0, 0, 1);
+ if (r_showtrispass)
+ GL_ShowTrisColor(0.1, 0, 0, 1);
if (cl.csqc_vidvars.drawworld)
{
R_DrawLightningBeams();
- R_TimeReport("lightning");
+ if (r_timereport_active)
+ R_TimeReport("lightning");
R_DrawParticles();
- R_TimeReport("particles");
+ if (r_timereport_active)
+ R_TimeReport("particles");
R_DrawExplosions();
- R_TimeReport("explosions");
+ if (r_timereport_active)
+ R_TimeReport("explosions");
}
R_MeshQueue_RenderTransparent();
- R_TimeReport("drawtrans");
+ if (r_timereport_active)
+ R_TimeReport("drawtrans");
if (cl.csqc_vidvars.drawworld)
{
R_DrawCoronas();
- R_TimeReport("coronas");
+ if (r_timereport_active)
+ R_TimeReport("coronas");
}
if(cl.csqc_vidvars.drawcrosshair)
{
R_DrawWorldCrosshair();
- R_TimeReport("crosshair");
+ if (r_timereport_active)
+ R_TimeReport("crosshair");
}
VM_AddPolygonsToMeshQueue();
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
GL_DepthTest(true);
- R_Mesh_Matrix(&r_identitymatrix);
+ R_Mesh_Matrix(&identitymatrix);
vertex3f[ 0] = mins[0];vertex3f[ 1] = mins[1];vertex3f[ 2] = mins[2];
vertex3f[ 3] = maxs[0];vertex3f[ 4] = mins[1];vertex3f[ 5] = mins[2];
fog = VERTEXFOGTABLE(VectorDistance(origin, r_vieworigin));
ifog = 1 - fog;
- R_Mesh_Matrix(&r_identitymatrix);
+ R_Mesh_Matrix(&identitymatrix);
GL_BlendFunc(blendfunc1, blendfunc2);
GL_DepthMask(false);
GL_DepthTest(!depthdisable);
{
if (planenum2 == planenum)
continue;
- PolygonF_Divide(tempnumpoints, temppoints[w], plane2->normal[0], plane2->normal[1], plane2->normal[2], plane2->dist, 1.0/32.0, 0, NULL, NULL, 256, temppoints[!w], &tempnumpoints);
+ PolygonF_Divide(tempnumpoints, temppoints[w], plane2->normal[0], plane2->normal[1], plane2->normal[2], plane2->dist, 1.0/32.0, 0, NULL, NULL, 256, temppoints[!w], &tempnumpoints, NULL);
w = !w;
}
if (tempnumpoints < 3)
if (t->currentmaterialflags & MATERIALFLAG_WATER && r_waterscroll.value != 0)
t->currenttexmatrix = r_waterscrollmatrix;
else
- t->currenttexmatrix = r_identitymatrix;
+ t->currenttexmatrix = identitymatrix;
t->currentnumlayers = 0;
if (!(t->currentmaterialflags & MATERIALFLAG_NODRAW))
{
if (gl_lightmaps.integer)
- R_Texture_AddLayer(t, true, GL_ONE, GL_ZERO, TEXTURELAYERTYPE_LITTEXTURE_MULTIPASS, r_texture_white, &r_identitymatrix, 1, 1, 1, 1);
+ R_Texture_AddLayer(t, true, GL_ONE, GL_ZERO, TEXTURELAYERTYPE_LITTEXTURE_MULTIPASS, r_texture_white, &identitymatrix, 1, 1, 1, 1);
else if (t->currentmaterialflags & MATERIALFLAG_SKY)
{
// transparent sky would be ridiculous
if (!(t->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
- R_Texture_AddLayer(t, true, GL_ONE, GL_ZERO, TEXTURELAYERTYPE_SKY, r_texture_white, &r_identitymatrix, fogcolor[0], fogcolor[1], fogcolor[2], 1);
+ R_Texture_AddLayer(t, true, GL_ONE, GL_ZERO, TEXTURELAYERTYPE_SKY, r_texture_white, &identitymatrix, fogcolor[0], fogcolor[1], fogcolor[2], 1);
}
else
{
// were darkened by fog already, and we should not add fog color
// (because the background was not darkened, there is no fog color
// that was lost behind it).
- R_Texture_AddLayer(t, false, GL_SRC_ALPHA, (t->currentmaterialflags & MATERIALFLAG_TRANSPARENT) ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA, TEXTURELAYERTYPE_FOG, t->skin.fog, &r_identitymatrix, fogcolor[0], fogcolor[1], fogcolor[2], t->currentalpha);
+ R_Texture_AddLayer(t, false, GL_SRC_ALPHA, (t->currentmaterialflags & MATERIALFLAG_TRANSPARENT) ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA, TEXTURELAYERTYPE_FOG, t->skin.fog, &identitymatrix, fogcolor[0], fogcolor[1], fogcolor[2], t->currentalpha);
}
}
}