static void R_Envmap_f (void);
// backend
-void R_ClearScreen(void);
+void R_ClearScreen(qboolean fogcolor);
/*
===============================================================================
// scan the number of characters on the line, not counting color codes
char *newline = strchr(start, '\n');
int l = newline ? (newline - start) : (int)strlen(start);
- float width = DrawQ_TextWidth_Font(start, l, 8, 8, false, FONT_CENTERPRINT);
+ float width = DrawQ_TextWidth_Font(start, l, false, FONT_CENTERPRINT) * 8;
x = (vid_conwidth.integer - width)/2;
if (l > 0)
else
dpsnprintf(temp, sizeof(temp), "Downloading %s %3i%% (%i/%i) at %i bytes/s\n", cls.qw_downloadname, cls.qw_downloadpercent, cls.qw_downloadmemorycursize, cls.qw_downloadmemorymaxsize, cls.qw_downloadspeedrate);
len = (int)strlen(temp);
- x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, size, size, 0, FONT_INFOBAR)) / 2;
+ x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, 0, FONT_INFOBAR) * size) / 2;
y = vid_conheight.integer - size - offset;
DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
DrawQ_String_Font(x, y, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
if(addinfo)
{
len = (int)strlen(addinfo);
- x = (vid_conwidth.integer - DrawQ_TextWidth_Font(addinfo, len, size, size, false, FONT_INFOBAR)) / 2;
+ x = (vid_conwidth.integer - DrawQ_TextWidth_Font(addinfo, len, false, FONT_INFOBAR) * size) / 2;
DrawQ_Fill(0, y - size, vid_conwidth.integer, size, 1, 1, 1, cls.signon == SIGNONS ? 0.8 : 1, 0);
DrawQ_String_Font(x, y - size, addinfo, len, size, size, 0, 0, 0, 1, 0, NULL, true, FONT_INFOBAR);
}
else
dpsnprintf(temp, sizeof(temp), "Downloading %s ... %5.1f%% @ %.1f KiB/s\n", downinfo[i].filename, 100.0 * downinfo[i].progress, downinfo[i].speed / 1024.0);
len = (int)strlen(temp);
- x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, size, size, false, FONT_INFOBAR)) / 2;
+ x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, false, FONT_INFOBAR) * size) / 2;
DrawQ_Fill(0, y + i * size, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
DrawQ_String_Font(x, y + i * size, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
}
//=============================================================================
-char r_speeds_string[1024];
+char r_speeds_timestring[1024];
int speedstringcount, r_timereport_active;
double r_timereport_temp = 0, r_timereport_current = 0, r_timereport_start = 0;
+int r_speeds_longestitem = 0;
void R_TimeReport(char *desc)
{
return;
CHECKGLERROR
- qglFinish();CHECKGLERROR
+ if (r_speeds.integer == 2)
+ qglFinish();
+ CHECKGLERROR
r_timereport_temp = r_timereport_current;
r_timereport_current = Sys_DoubleTime();
t = (int) ((r_timereport_current - r_timereport_temp) * 1000000.0 + 0.5);
- dpsnprintf(tempbuf, sizeof(tempbuf), "%8i %-11s", t, desc);
- length = (int)strlen(tempbuf);
+ length = dpsnprintf(tempbuf, sizeof(tempbuf), "%8i %s", t, desc);
+ length = min(length, (int)sizeof(tempbuf) - 1);
+ if (r_speeds_longestitem < length)
+ r_speeds_longestitem = length;
+ for (;length < r_speeds_longestitem;length++)
+ tempbuf[length] = ' ';
+ tempbuf[length] = 0;
+
if (speedstringcount + length > (vid_conwidth.integer / 8))
{
- strlcat(r_speeds_string, "\n", sizeof(r_speeds_string));
+ strlcat(r_speeds_timestring, "\n", sizeof(r_speeds_timestring));
speedstringcount = 0;
}
- strlcat(r_speeds_string, tempbuf, sizeof(r_speeds_string));
+ strlcat(r_speeds_timestring, tempbuf, sizeof(r_speeds_timestring));
speedstringcount += length;
}
-void R_TimeReport_Frame(void)
+void R_TimeReport_BeginFrame(void)
{
- int i, j, lines, y;
- cl_locnode_t *loc;
+ speedstringcount = 0;
+ r_speeds_timestring[0] = 0;
+ r_timereport_active = false;
+ memset(&r_refdef.stats, 0, sizeof(r_refdef.stats));
- if (r_speeds_string[0])
+ if (r_speeds.integer >= 2 && cls.signon == SIGNONS && cls.state == ca_connected)
{
- if (r_timereport_active)
- {
- r_timereport_current = r_timereport_start;
- R_TimeReport("total");
- }
-
- if (r_speeds_string[strlen(r_speeds_string)-1] == '\n')
- r_speeds_string[strlen(r_speeds_string)-1] = 0;
- lines = 1;
- for (i = 0;r_speeds_string[i];i++)
- if (r_speeds_string[i] == '\n')
- lines++;
- y = vid_conheight.integer - sb_lines - lines * 8;
- i = j = 0;
- DrawQ_Fill(0, y, vid_conwidth.integer, lines * 8, 0, 0, 0, 0.5, 0);
- while (r_speeds_string[i])
- {
- j = i;
- while (r_speeds_string[i] && r_speeds_string[i] != '\n')
- i++;
- if (i - j > 0)
- DrawQ_String(0, y, r_speeds_string + j, i - j, 8, 8, 1, 1, 1, 1, 0, NULL, true);
- if (r_speeds_string[i] == '\n')
- i++;
- y += 8;
- }
- r_speeds_string[0] = 0;
- r_timereport_active = false;
+ r_timereport_active = true;
+ r_timereport_start = r_timereport_current = Sys_DoubleTime();
}
+}
+
+void R_TimeReport_EndFrame(void)
+{
+ int i, j, lines, y;
+ cl_locnode_t *loc;
+ char string[2048];
+
+ string[0] = 0;
if (r_speeds.integer && cls.signon == SIGNONS && cls.state == ca_connected)
{
- speedstringcount = 0;
- r_speeds_string[0] = 0;
- r_timereport_active = false;
// put the location name in the r_speeds display as it greatly helps
// when creating loc files
loc = CL_Locs_FindNearest(cl.movement_origin);
if (loc)
- sprintf(r_speeds_string + strlen(r_speeds_string), "Location: %s\n", loc->name);
- sprintf(r_speeds_string + strlen(r_speeds_string), "org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n", r_view.origin[0], r_view.origin[1], r_view.origin[2], r_view.forward[0], r_view.forward[1], r_view.forward[2]);
- sprintf(r_speeds_string + strlen(r_speeds_string), "%7i surfaces%7i triangles %5i entities (%7i surfaces%7i triangles)\n", r_refdef.stats.world_surfaces, r_refdef.stats.world_triangles, r_refdef.stats.entities, r_refdef.stats.entities_surfaces, r_refdef.stats.entities_triangles);
- sprintf(r_speeds_string + strlen(r_speeds_string), "%5ileafs%5i portals%6i particles%6i decals\n", r_refdef.stats.world_leafs, r_refdef.stats.world_portals, r_refdef.stats.particles, r_refdef.stats.decals);
- sprintf(r_speeds_string + strlen(r_speeds_string), "%4i lights%4i clears%4i scissored%7i light%7i shadow%7i dynamic\n", r_refdef.stats.lights, r_refdef.stats.lights_clears, r_refdef.stats.lights_scissored, r_refdef.stats.lights_lighttriangles, r_refdef.stats.lights_shadowtriangles, r_refdef.stats.lights_dynamicshadowtriangles);
+ sprintf(string + strlen(string), "Location: %s\n", loc->name);
+ sprintf(string + strlen(string), "org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n", r_view.origin[0], r_view.origin[1], r_view.origin[2], r_view.forward[0], r_view.forward[1], r_view.forward[2]);
+ sprintf(string + strlen(string), "%7i surfaces%7i triangles %5i entities (%7i surfaces%7i triangles)\n", r_refdef.stats.world_surfaces, r_refdef.stats.world_triangles, r_refdef.stats.entities, r_refdef.stats.entities_surfaces, r_refdef.stats.entities_triangles);
+ sprintf(string + strlen(string), "%5i leafs%5i portals%6i particles%6i decals\n", r_refdef.stats.world_leafs, r_refdef.stats.world_portals, r_refdef.stats.particles, r_refdef.stats.decals);
+ sprintf(string + strlen(string), "%7i lightmap updates (%7i pixels)\n", r_refdef.stats.lightmapupdates, r_refdef.stats.lightmapupdatepixels);
+ sprintf(string + strlen(string), "%4i lights%4i clears%4i scissored%7i light%7i shadow%7i dynamic\n", r_refdef.stats.lights, r_refdef.stats.lights_clears, r_refdef.stats.lights_scissored, r_refdef.stats.lights_lighttriangles, r_refdef.stats.lights_shadowtriangles, r_refdef.stats.lights_dynamicshadowtriangles);
if (r_refdef.stats.bloom)
- sprintf(r_speeds_string + strlen(r_speeds_string), "rendered%6i meshes%8i triangles bloompixels%8i copied%8i drawn\n", r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3, r_refdef.stats.bloom_copypixels, r_refdef.stats.bloom_drawpixels);
+ sprintf(string + strlen(string), "rendered%6i meshes%8i triangles bloompixels%8i copied%8i drawn\n", r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3, r_refdef.stats.bloom_copypixels, r_refdef.stats.bloom_drawpixels);
else
- sprintf(r_speeds_string + strlen(r_speeds_string), "rendered%6i meshes%8i triangles\n", r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3);
+ sprintf(string + strlen(string), "rendered%6i meshes%8i triangles\n", r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3);
+ strlcat(string, r_speeds_timestring, sizeof(string));
memset(&r_refdef.stats, 0, sizeof(r_refdef.stats));
+ speedstringcount = 0;
+ r_speeds_timestring[0] = 0;
+ r_timereport_active = false;
+
if (r_speeds.integer >= 2)
{
r_timereport_active = true;
r_timereport_start = r_timereport_current = Sys_DoubleTime();
}
}
+
+ if (string[0])
+ {
+ if (string[strlen(string)-1] == '\n')
+ string[strlen(string)-1] = 0;
+ lines = 1;
+ for (i = 0;string[i];i++)
+ if (string[i] == '\n')
+ lines++;
+ y = vid_conheight.integer - sb_lines - lines * 8;
+ i = j = 0;
+ DrawQ_Fill(0, y, vid_conwidth.integer, lines * 8, 0, 0, 0, 0.5, 0);
+ while (string[i])
+ {
+ j = i;
+ while (string[i] && string[i] != '\n')
+ i++;
+ if (i - j > 0)
+ DrawQ_String(0, y, string + j, i - j, 8, 8, 1, 1, 1, 1, 0, NULL, true);
+ if (string[i] == '\n')
+ i++;
+ y += 8;
+ }
+ }
}
/*
{
sprintf(filename, "env/%s%s.tga", basename, envmapinfo[j].name);
Matrix4x4_CreateFromQuakeEntity(&r_view.matrix, r_view.origin[0], r_view.origin[1], r_view.origin[2], envmapinfo[j].angles[0], envmapinfo[j].angles[1], envmapinfo[j].angles[2], 1);
- R_ClearScreen();
+ r_view.clear = true;
R_Mesh_Start();
R_RenderView();
R_Mesh_Finish();
//=============================================================================
-void R_ClearScreen(void)
+extern void R_UpdateFogColor(void);
+void R_ClearScreen(qboolean fogcolor)
{
// clear to black
CHECKGLERROR
- if (r_refdef.fogenabled)
+ if (fogcolor)
{
+ R_UpdateFogColor();
qglClearColor(r_refdef.fogcolor[0],r_refdef.fogcolor[1],r_refdef.fogcolor[2],0);CHECKGLERROR
}
else
{
R_Mesh_Start();
- if (r_timereport_active)
- R_TimeReport("screensetup");
+ R_TimeReport_BeginFrame();
R_UpdateVariables();
R_TimeReport("2d");
if (cls.signon == SIGNONS)
- R_TimeReport_Frame();
+ R_TimeReport_EndFrame();
DrawQ_Finish();
R_DrawGamma();
R_Mesh_Finish();
-
- if (r_timereport_active)
- R_TimeReport("meshfinish");
}
void SCR_UpdateLoadingScreen (qboolean clear)
r_view.colormask[1] = 1;
r_view.colormask[2] = 1;
- if (r_timereport_active)
- R_TimeReport("other");
-
SCR_SetUpToDrawConsole();
- if (r_timereport_active)
- R_TimeReport("start");
-
CHECKGLERROR
+ qglDrawBuffer(GL_BACK);CHECKGLERROR
qglViewport(0, 0, vid.width, vid.height);CHECKGLERROR
qglDisable(GL_SCISSOR_TEST);CHECKGLERROR
qglDepthMask(1);CHECKGLERROR
qglColorMask(1,1,1,1);CHECKGLERROR
qglClearColor(0,0,0,0);CHECKGLERROR
- R_ClearScreen();
+ R_ClearScreen(false);
r_view.clear = false;
if(scr_stipple.integer)
else
qglDisable(GL_POLYGON_STIPPLE);
- if (r_timereport_active)
- R_TimeReport("screenclear");
-
- qglDrawBuffer(GL_BACK);
-
if (vid.stereobuffer || r_stereo_redblue.integer || r_stereo_redgreen.integer || r_stereo_redcyan.integer || r_stereo_sidebyside.integer)
{
matrix4x4_t originalmatrix = r_view.matrix;
SCR_CaptureVideo();
VID_Finish(true);
- if (r_timereport_active)
- R_TimeReport("finish");
}
void CL_Screen_NewMap(void)