}
}
+static int R_CountLeafTriangles(const dp_model_t *model, const mleaf_t *leaf)
+{
+ int i, triangles = 0;
+ for (i = 0;i < leaf->numleafsurfaces;i++)
+ triangles += model->data_surfaces[leaf->firstleafsurface[i]].num_triangles;
+ return triangles;
+}
+
void R_TimeReport_EndFrame(void)
{
int i, j, lines, y;
dpsnprintf(string, sizeof(string),
"%s%s\n"
"%3i renders org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n"
+"%5i viewleaf%5i cluster%2i area%4i brushes%4i surfaces(%7i triangles)\n"
"%7i surfaces%7i triangles %5i entities (%7i surfaces%7i triangles)\n"
"%5i leafs%5i portals%6i/%6i particles%6i/%6i decals %3i%% quality\n"
-"%7i lightmap updates (%7i pixels)%s\n"
+"%7i lightmap updates (%7i pixels)\n"
"%4i lights%4i clears%4i scissored%7i light%7i shadow%7i dynamic\n"
"rendered%6i meshes%8i triangles bloompixels%8i copied%8i drawn\n"
"%s"
, loc ? "Location: " : "", loc ? loc->name : ""
, r_refdef.stats.renders, r_refdef.view.origin[0], r_refdef.view.origin[1], r_refdef.view.origin[2], r_refdef.view.forward[0], r_refdef.view.forward[1], r_refdef.view.forward[2]
+, viewleaf ? (int)(viewleaf - r_refdef.scene.worldmodel->brush.data_leafs) : -1, viewleaf ? viewleaf->clusterindex : -1, viewleaf ? viewleaf->areaindex : -1, viewleaf ? viewleaf->numleafbrushes : 0, viewleaf ? viewleaf->numleafsurfaces : 0, viewleaf ? R_CountLeafTriangles(r_refdef.scene.worldmodel, viewleaf) : 0
, r_refdef.stats.world_surfaces, r_refdef.stats.world_triangles, r_refdef.stats.entities, r_refdef.stats.entities_surfaces, r_refdef.stats.entities_triangles
, r_refdef.stats.world_leafs, r_refdef.stats.world_portals, r_refdef.stats.particles, cl.num_particles, r_refdef.stats.decals, cl.num_decals, (int)(100 * r_refdef.view.quality)
-, r_refdef.stats.lightmapupdates, r_refdef.stats.lightmapupdatepixels, viewleaf ? va(" clusterindex%6i", viewleaf->clusterindex) : ""
+, r_refdef.stats.lightmapupdates, r_refdef.stats.lightmapupdatepixels
, 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
, r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3, r_refdef.stats.bloom_copypixels, r_refdef.stats.bloom_drawpixels
, r_speeds_timestring);
void SCR_CaptureVideo(void)
{
int newframenum;
- if (cl_capturevideo.integer && r_render.integer)
+ if (cl_capturevideo.integer)
{
if (!cls.capturevideo.active)
SCR_CaptureVideo_BeginVideo();
int indices[3] = {0,1,2};
qboolean ret;
- if (!r_render.integer)
- return false;
-
CHECKGLERROR
qglReadPixels (x, y, width, height, jpeg ? GL_RGB : GL_BGR, GL_UNSIGNED_BYTE, buffer1);CHECKGLERROR
qglClearStencil(128);CHECKGLERROR
}
// clear the screen
- if (r_render.integer)
- GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (gl_stencil ? GL_STENCIL_BUFFER_BIT : 0));
+ GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (gl_stencil ? GL_STENCIL_BUFFER_BIT : 0));
// set dithering mode
if (gl_dither.integer)
{
int r_stereo_side;
+extern void Sbar_ShowFPS(void);
void SCR_DrawScreen (void)
{
R_Mesh_Start();
SCR_DrawPause ();
if (!r_letterbox.value)
Sbar_Draw();
+ Sbar_ShowFPS();
SHOWLMP_drawall();
SCR_CheckDrawCenterString();
}
int old_key_consoleactive;
// don't do anything if not initialized yet
- if (vid_hidden || !scr_refresh.integer || cls.state == ca_dedicated)
+ if (vid_hidden || cls.state == ca_dedicated)
return;
if(loadingscreentime == realtime)
extern cvar_t cl_minfps_qualityscale;
static double cl_updatescreen_rendertime = 0;
static double cl_updatescreen_quality = 1;
+extern void Sbar_ShowFPS_Update(void);
void CL_UpdateScreen(void)
{
double rendertime1;
float conwidth, conheight;
float f;
- if (!scr_initialized || !con_initialized)
+ Sbar_ShowFPS_Update();
+
+ if (!scr_initialized || !con_initialized || !scr_refresh.integer)
return; // not initialized yet
if(gamemode == GAME_NEXUIZ)
memcpy(palette_rgb_shirtscoreboard[15], palette_rgb_shirtcolormap[15], sizeof(*palette_rgb_shirtcolormap));
}
- if (vid_hidden || !scr_refresh.integer)
+ if (vid_hidden)
return;
rendertime1 = Sys_DoubleTime();
cvar_t gl_paranoid = {0, "gl_paranoid", "0", "enables OpenGL error checking and other tests"};
cvar_t gl_printcheckerror = {0, "gl_printcheckerror", "0", "prints all OpenGL error checks, useful to identify location of driver crashes"};
-cvar_t r_render = {0, "r_render", "1", "enables rendering calls (you want this on!)"};
+cvar_t r_render = {0, "r_render", "1", "enables rendering 3D views (you want this on!)"};
+cvar_t r_renderview = {0, "r_renderview", "1", "enables rendering 3D views (you want this on!)"};
cvar_t r_waterwarp = {CVAR_SAVE, "r_waterwarp", "1", "warp view while underwater"};
cvar_t gl_polyblend = {CVAR_SAVE, "gl_polyblend", "1", "tints view while underwater, hurt, etc"};
cvar_t gl_dither = {CVAR_SAVE, "gl_dither", "1", "enables OpenGL dithering (16bit looks bad with this off)"};
}
Cvar_RegisterVariable(&r_render);
+ Cvar_RegisterVariable(&r_renderview);
Cvar_RegisterVariable(&r_waterwarp);
Cvar_RegisterVariable(&gl_polyblend);
Cvar_RegisterVariable(&v_flipped);
Cvar_RegisterVariable(&gl_vbo);
Cvar_RegisterVariable(&gl_paranoid);
Cvar_RegisterVariable(&gl_printcheckerror);
-#ifdef NORENDER
- Cvar_SetValue("r_render", 0);
-#endif
Cvar_RegisterVariable(&gl_mesh_drawrangeelements);
Cvar_RegisterVariable(&gl_mesh_testarrayelement);
qglUnlockArraysEXT();
CHECKGLERROR
}
- if (count && gl_supportslockarrays && gl_lockarrays.integer && r_render.integer)
+ if (count && gl_supportslockarrays && gl_lockarrays.integer)
{
gl_state.lockrange_first = first;
gl_state.lockrange_count = count;
}
CHECKGLERROR
}
- if (r_render.integer)
+ if (r_render.integer || r_refdef.draw2dstage)
{
CHECKGLERROR
if (gl_mesh_testmanualfeeding.integer)
return;
}
- if (!r_refdef.scene.entities || r_refdef.view.width * r_refdef.view.height == 0/* || !r_refdef.scene.worldmodel*/)
+ if (!r_refdef.scene.entities || r_refdef.view.width * r_refdef.view.height == 0 || !r_renderview.integer/* || !r_refdef.scene.worldmodel*/)
return; //Host_Error ("R_RenderView: NULL worldmodel");
r_refdef.view.colorscale = r_hdr_scenebrightness.value;
#include "r_lerpanim.h"
extern cvar_t r_render;
+extern cvar_t r_renderview;
extern cvar_t r_waterwarp;
extern cvar_t r_textureunits;
}
}
+static double showfps_nexttime = 0, showfps_lasttime = -1;
+static double showfps_framerate = 0;
+static int showfps_framecount = 0;
+
+void Sbar_ShowFPS_Update(void)
+{
+ double interval = 1;
+ double newtime;
+ newtime = realtime;
+ if (newtime >= showfps_nexttime)
+ {
+ showfps_framerate = showfps_framecount / (newtime - showfps_lasttime);
+ if (showfps_nexttime < newtime - interval * 1.5)
+ showfps_nexttime = newtime;
+ showfps_lasttime = newtime;
+ showfps_nexttime += interval;
+ showfps_framecount = 0;
+ }
+ showfps_framecount++;
+}
+
void Sbar_ShowFPS(void)
{
float fps_x, fps_y, fps_scalex, fps_scaley, fps_height;
topspeedstring[0] = 0;
if (showfps.integer)
{
- float calc;
- static double nexttime = 0, lasttime = 0;
- static double framerate = 0;
- static int framecount = 0;
- double interval = 1;
- double newtime;
- newtime = Sys_DoubleTime();
- if (newtime >= nexttime)
- {
- framerate = framecount / (newtime - lasttime);
- if (nexttime < newtime - interval * 1.5)
- nexttime = newtime;
- lasttime = newtime;
- nexttime += interval;
- framecount = 0;
- }
- framecount++;
- calc = framerate;
- red = (calc < 1.0f);
-
+ red = (showfps_framerate < 1.0f);
if(showfps.integer == 2)
- dpsnprintf(fpsstring, sizeof(fpsstring), "%7.3f mspf", (1000.0 / calc));
+ dpsnprintf(fpsstring, sizeof(fpsstring), "%7.3f mspf", (1000.0 / showfps_framerate));
else if (red)
- dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0 / calc + 0.5));
+ dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0 / showfps_framerate + 0.5));
else
- dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(calc + 0.5));
+ dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(showfps_framerate + 0.5));
}
if (showtime.integer)
strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
}
}
- Sbar_ShowFPS();
-
if (cl.csqc_vidvars.drawcrosshair && crosshair.integer >= 1 && !cl.intermission && !r_letterbox.value)
{
pic = Draw_CachePic (va("gfx/crosshair%i", crosshair.integer));
Con_Printf("ERROR: can't %s vsync\n", vid_usevsync ? "activate" : "deactivate");
}
- if (r_render.integer)
+ if (!vid_hidden)
{
CHECKGLERROR
if (r_speeds.integer == 2 || gl_finish.integer)
Con_Print("glXSwapIntervalSGI didn't accept the vid_vsync change, it will take effect on next vid_restart (GLX_SGI_swap_control does not allow turning off vsync)\n");
}
- if (r_render.integer)
+ if (!vid_hidden)
{
CHECKGLERROR
if (r_speeds.integer == 2 || gl_finish.integer)
VID_UpdateGamma(false, 256);
- if (r_render.integer && !vid_hidden)
+ if (!vid_hidden)
{
CHECKGLERROR
if (r_speeds.integer == 2 || gl_finish.integer)
qwglSwapIntervalEXT (vid_usevsync);
}
- if (r_render.integer && !vid_hidden)
+ if (!vid_hidden)
{
CHECKGLERROR
if (r_speeds.integer == 2 || gl_finish.integer)