2004-08-22 22:29:09 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
// gl_ngraph.c
|
|
|
|
|
|
|
|
#include "quakedef.h"
|
2011-10-27 16:16:29 +00:00
|
|
|
#include "shader.h"
|
2004-08-22 22:29:09 +00:00
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
void Draw_ExpandedString(struct font_s *font, float x, float y, conchar_t *str);
|
2019-01-15 14:12:49 +00:00
|
|
|
static float timehistory[NET_TIMINGS];
|
2014-04-13 04:23:13 +00:00
|
|
|
static int findex;
|
|
|
|
|
2004-08-22 22:29:09 +00:00
|
|
|
#define NET_GRAPHHEIGHT 32
|
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
//#define GRAPHTEX
|
|
|
|
#ifdef GRAPHTEX
|
|
|
|
static texid_t netgraphtexture; // netgraph texture
|
|
|
|
static shader_t *netgraphshader;
|
|
|
|
static unsigned int ngraph_texels[NET_GRAPHHEIGHT][NET_TIMINGS];
|
|
|
|
#else
|
|
|
|
static struct
|
|
|
|
{
|
|
|
|
unsigned int col;
|
|
|
|
float height;
|
|
|
|
} ngraph[NET_TIMINGS];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void R_LineGraph (int x, float h)
|
2004-08-22 22:29:09 +00:00
|
|
|
{
|
|
|
|
int s;
|
2019-01-13 17:56:26 +00:00
|
|
|
unsigned color;
|
2004-08-22 22:29:09 +00:00
|
|
|
|
|
|
|
s = NET_GRAPHHEIGHT;
|
|
|
|
|
2015-05-14 03:06:58 +00:00
|
|
|
if (h == 10000 || h<0)
|
|
|
|
{
|
2019-01-13 16:51:50 +00:00
|
|
|
color = 0xff00ffff; // yellow
|
|
|
|
h=fabs(h);
|
2015-05-14 03:06:58 +00:00
|
|
|
}
|
2004-08-22 22:29:09 +00:00
|
|
|
else if (h == 9999)
|
2019-01-13 16:51:50 +00:00
|
|
|
color = 0xff0000ff; // red
|
2004-08-22 22:29:09 +00:00
|
|
|
else if (h == 9998)
|
2019-01-13 16:51:50 +00:00
|
|
|
color = 0xffff0000; // blue
|
2004-08-22 22:29:09 +00:00
|
|
|
else
|
2019-01-13 16:51:50 +00:00
|
|
|
color = 0xffffffff; // white
|
2004-08-22 22:29:09 +00:00
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
#ifdef GRAPHTEX
|
2004-08-22 22:29:09 +00:00
|
|
|
if (h>s)
|
|
|
|
h = s;
|
|
|
|
|
|
|
|
for (i=0 ; i<h ; i++)
|
|
|
|
if (i & 1)
|
2019-01-13 17:56:26 +00:00
|
|
|
ngraph_texels[NET_GRAPHHEIGHT - i - 1][x] = color&0xffefefef;
|
2004-08-22 22:29:09 +00:00
|
|
|
else
|
2019-01-13 16:51:50 +00:00
|
|
|
ngraph_texels[NET_GRAPHHEIGHT - i - 1][x] = color;
|
2004-08-22 22:29:09 +00:00
|
|
|
|
|
|
|
for ( ; i<s ; i++)
|
2019-01-13 16:51:50 +00:00
|
|
|
ngraph_texels[NET_GRAPHHEIGHT - i - 1][x] = 0x00000000;
|
|
|
|
#else
|
|
|
|
ngraph[x].col = color;
|
|
|
|
if (h > s)
|
|
|
|
ngraph[x].height = 1;
|
|
|
|
else
|
|
|
|
ngraph[x].height = h/(float)s;
|
|
|
|
#endif
|
2004-08-22 22:29:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
R_NetGraph
|
|
|
|
==============
|
|
|
|
*/
|
2012-08-04 11:28:39 +00:00
|
|
|
void R_NetGraph (void)
|
2004-08-22 22:29:09 +00:00
|
|
|
{
|
2019-01-13 16:51:50 +00:00
|
|
|
int a, x, i;
|
|
|
|
float y;
|
2015-04-14 23:12:17 +00:00
|
|
|
float pi, po, bi, bo;
|
2019-08-24 16:09:08 +00:00
|
|
|
int errorbar;
|
2004-08-22 22:29:09 +00:00
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
vec2_t p[4];
|
|
|
|
vec2_t tc[4];
|
|
|
|
vec4_t rgba[4];
|
|
|
|
extern shader_t *shader_draw_fill;
|
|
|
|
conchar_t line[2048];
|
|
|
|
float textheight, graphtop;
|
|
|
|
|
|
|
|
float pings, pings_min, pings_max, pingms_stddev, pingfr, dropped, choked, invalid;
|
|
|
|
int pingfr_min, pingfr_max;
|
|
|
|
|
2004-08-22 22:29:09 +00:00
|
|
|
x = 0;
|
2014-04-13 04:23:13 +00:00
|
|
|
if (r_netgraph.value < 0)
|
|
|
|
{
|
|
|
|
if (!cl.paused)
|
|
|
|
timehistory[++findex&NET_TIMINGSMASK] = (cl.currentpackentities?(cl.currentpackentities->servertime - cl.servertime)*NET_GRAPHHEIGHT*5:0);
|
|
|
|
for (a=0 ; a<NET_TIMINGS ; a++)
|
|
|
|
{
|
|
|
|
i = (findex-a) & NET_TIMINGSMASK;
|
|
|
|
R_LineGraph (NET_TIMINGS-1-a, timehistory[i]<0?10000:timehistory[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2004-08-22 22:29:09 +00:00
|
|
|
{
|
2019-01-13 16:51:50 +00:00
|
|
|
float last = 10000;
|
2019-01-13 17:56:26 +00:00
|
|
|
CL_CalcNet(r_netgraph.value);
|
2014-04-13 04:23:13 +00:00
|
|
|
for (a=0 ; a<NET_TIMINGS ; a++)
|
|
|
|
{
|
|
|
|
i = (cl.movesequence-a) & NET_TIMINGSMASK;
|
2019-08-24 16:09:08 +00:00
|
|
|
// if (packet_latency[i] != 10000)
|
2015-05-14 03:06:58 +00:00
|
|
|
last = packet_latency[i];
|
2019-08-24 16:09:08 +00:00
|
|
|
// else if (last >= 0)
|
|
|
|
// last = -last;
|
2015-05-14 03:06:58 +00:00
|
|
|
R_LineGraph (NET_TIMINGS-1-a, last);
|
2014-04-13 04:23:13 +00:00
|
|
|
}
|
2004-08-22 22:29:09 +00:00
|
|
|
}
|
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
textheight = 4;
|
|
|
|
#ifdef HAVE_SERVER
|
|
|
|
if (sv.state && sv.allocated_client_slots != 1)
|
|
|
|
textheight+=2;
|
|
|
|
#endif
|
|
|
|
textheight = ceil(textheight*Font_CharVHeight(font_console)/8)*8; //might have a small gap underneath
|
2009-04-01 22:03:56 +00:00
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
x = ((vid.width - 320)>>1); //eww
|
2009-04-01 22:03:56 +00:00
|
|
|
x=-x;
|
2019-01-13 16:51:50 +00:00
|
|
|
y = vid.height - sb_lines - textheight - NET_GRAPHHEIGHT - 2*8/*box borders*/;
|
2009-04-01 22:03:56 +00:00
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
M_DrawTextBox (x, y, NET_TIMINGS/8, (NET_GRAPHHEIGHT + textheight)/8);
|
|
|
|
x = 8;
|
2019-01-29 07:18:07 +00:00
|
|
|
if (r_netgraph.ival > 1)
|
|
|
|
CL_ShowTrafficUsage(x + NET_TIMINGS + 8, y);
|
2019-01-13 16:51:50 +00:00
|
|
|
y += 8; //top border
|
|
|
|
graphtop = y+textheight;
|
2009-04-01 22:03:56 +00:00
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
CL_CalcNet2(&pings, &pings_min, &pings_max, &pingms_stddev, &pingfr, &pingfr_min, &pingfr_max, &dropped, &choked, &invalid);
|
|
|
|
{
|
|
|
|
COM_ParseFunString(CON_WHITEMASK, va("%3.0f%% lost, %3.0f%% choked, %3.0f%% bad", dropped*100, choked*100, invalid*100), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
|
|
|
|
COM_ParseFunString(CON_WHITEMASK, va(" ping: %4.1fms %6.2f (%.1f-%.1f)\n", pings*1000, pingms_stddev, pings_min*1000, pings_max*1000), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
}
|
2011-09-05 01:48:23 +00:00
|
|
|
|
2015-04-14 23:12:17 +00:00
|
|
|
if (NET_GetRates(cls.sockets, &pi, &po, &bi, &bo))
|
|
|
|
{
|
2019-01-13 16:51:50 +00:00
|
|
|
COM_ParseFunString(CON_WHITEMASK, va(" in: %.1f %.0fb\n", pi, bi), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
COM_ParseFunString(CON_WHITEMASK, va(" out: %.1f %.0fb\n", po, bo), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
}
|
|
|
|
#ifdef HAVE_SERVER
|
|
|
|
if (sv.state && sv.allocated_client_slots != 1 && NET_GetRates(svs.sockets, &pi, &po, &bi, &bo))
|
|
|
|
{
|
|
|
|
COM_ParseFunString(CON_WHITEMASK, va("sv in: %.1f %.0fb\n", pi, bi), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
COM_ParseFunString(CON_WHITEMASK, va("svout: %.1f %.0fb\n", po, bo), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
2015-04-14 23:12:17 +00:00
|
|
|
}
|
2019-01-13 16:51:50 +00:00
|
|
|
#endif
|
2015-04-14 23:12:17 +00:00
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
y = graphtop; //rounding makes it ugly.
|
|
|
|
|
|
|
|
#ifdef GRAPHTEX
|
|
|
|
Image_Upload(netgraphtexture, TF_RGBA32, ngraph_texels, NULL, NET_TIMINGS, NET_GRAPHHEIGHT, IF_UIPIC|IF_NOMIPMAP|IF_NOPICMIP);
|
2011-10-27 16:16:29 +00:00
|
|
|
R2D_Image(x, y, NET_TIMINGS, NET_GRAPHHEIGHT, 0, 0, 1, 1, netgraphshader);
|
2019-01-13 16:51:50 +00:00
|
|
|
#else
|
2019-04-19 23:55:47 +00:00
|
|
|
Vector2Set(p[2], 0,0);
|
|
|
|
Vector2Set(p[3], 0,0);
|
|
|
|
Vector4Set(rgba[2], 0,0,0,0);
|
|
|
|
Vector4Set(rgba[3], 0,0,0,0);
|
2019-08-24 16:09:08 +00:00
|
|
|
errorbar = 1; //first is discontinuous
|
2019-01-13 16:51:50 +00:00
|
|
|
for (a=0 ; a<NET_TIMINGS ; a++)
|
|
|
|
{
|
|
|
|
Vector2Copy(p[3], p[0]); Vector4Copy(rgba[3], rgba[0]);
|
|
|
|
Vector2Copy(p[2], p[1]); Vector4Copy(rgba[2], rgba[1]);
|
|
|
|
|
|
|
|
Vector2Set(p[2+0], x+a, y+(1-ngraph[a].height)*NET_GRAPHHEIGHT);
|
|
|
|
Vector2Set(p[2+1], x+a, y+NET_GRAPHHEIGHT);
|
|
|
|
|
2019-08-24 16:09:08 +00:00
|
|
|
Vector2Set(tc[2+0], a/(float)NET_TIMINGS, (1-ngraph[a].height));
|
|
|
|
Vector2Set(tc[2+1], a/(float)NET_TIMINGS, 1);
|
2019-01-13 16:51:50 +00:00
|
|
|
Vector4Set(rgba[2+0], ((ngraph[a].col>>0)&0xff)/255.0, ((ngraph[a].col>>8)&0xff)/255.0, ((ngraph[a].col>>16)&0xff)/255.0, ((ngraph[a].col>>24)&0xff)/255.0);
|
|
|
|
Vector4Copy(rgba[2+0], rgba[2+1]);
|
|
|
|
|
2019-08-24 16:09:08 +00:00
|
|
|
if (ngraph[a].height==1)
|
|
|
|
errorbar = 2; //this one and the following should be discontiguous
|
|
|
|
if (errorbar --> 0)
|
|
|
|
{ //if this is a full-height bar, break the smooth curve and just make it discontinuous
|
|
|
|
p[0][1] = p[3][1];
|
|
|
|
p[1][1] = p[2][1];
|
|
|
|
Vector4Copy(rgba[3], rgba[0]);
|
|
|
|
Vector4Copy(rgba[2], rgba[1]);
|
|
|
|
}
|
|
|
|
|
2022-07-28 02:17:45 +00:00
|
|
|
if (a)
|
|
|
|
R2D_Image2dQuad((const vec2_t*)p, (const vec2_t*)tc, (const vec4_t*)rgba, shader_draw_fill);
|
2019-01-13 16:51:50 +00:00
|
|
|
}
|
|
|
|
#endif
|
2009-04-01 22:03:56 +00:00
|
|
|
}
|
|
|
|
|
2020-09-29 07:09:01 +00:00
|
|
|
void R_FrameTimeGraph (float frametime, float scale)
|
2009-04-01 22:03:56 +00:00
|
|
|
{
|
2022-07-28 02:17:45 +00:00
|
|
|
float bias = 0, h, lh;
|
|
|
|
int a, b, x, i, y;
|
|
|
|
|
|
|
|
struct{
|
|
|
|
vec2_t xy[4];
|
|
|
|
vec2_t tc[4];
|
|
|
|
vec4_t rgba[4];
|
|
|
|
} g[3];
|
2019-01-13 16:51:50 +00:00
|
|
|
extern shader_t *shader_draw_fill;
|
2009-04-01 22:03:56 +00:00
|
|
|
|
2020-09-29 07:09:01 +00:00
|
|
|
conchar_t line[128];
|
|
|
|
int textheight;
|
|
|
|
float minv=FLT_MAX, maxv=FLT_MIN, avg=0, dev=0;
|
|
|
|
|
|
|
|
static struct
|
|
|
|
{
|
2022-07-28 02:17:45 +00:00
|
|
|
float time[countof(g)];
|
2020-09-29 07:09:01 +00:00
|
|
|
} history[NET_TIMINGS];
|
|
|
|
static unsigned int findex;
|
|
|
|
|
2020-09-29 09:34:38 +00:00
|
|
|
#ifdef LOADERTHREAD
|
2020-09-29 07:09:01 +00:00
|
|
|
extern int com_hadwork[WG_COUNT];
|
2020-09-29 09:34:38 +00:00
|
|
|
#endif
|
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
|
|
|
extern double r_loaderstalltime;
|
|
|
|
#ifdef HAVE_SERVER
|
|
|
|
extern double server_frametime;
|
|
|
|
#endif
|
2022-07-28 02:17:45 +00:00
|
|
|
|
|
|
|
history[findex&NET_TIMINGSMASK].time[0] = max(0,frametime); //server band
|
|
|
|
#ifdef HAVE_SERVER
|
|
|
|
frametime -= server_frametime; server_frametime = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
history[findex&NET_TIMINGSMASK].time[1] = max(0,frametime); //stalls band
|
|
|
|
frametime -= r_loaderstalltime; r_loaderstalltime = 0;
|
|
|
|
|
|
|
|
history[findex&NET_TIMINGSMASK].time[2] = max(0,frametime); //client band (max is needed because we might have been failing to clear the other timers)
|
2020-09-29 07:09:01 +00:00
|
|
|
|
|
|
|
findex++;
|
|
|
|
|
|
|
|
#ifdef LOADERTHREAD
|
|
|
|
if (com_hadwork[WG_MAIN])
|
|
|
|
{ //recolour the graph red if the main thread processed something from a worker.
|
|
|
|
//show three, because its not so easy to see when its whizzing past.
|
|
|
|
com_hadwork[WG_MAIN] = 0;
|
2022-07-28 02:17:45 +00:00
|
|
|
// history[(findex-1)&NET_TIMINGSMASK].col = 0xff0000ff;
|
|
|
|
// history[(findex-2)&NET_TIMINGSMASK].col = 0xff0000ff;
|
|
|
|
// history[(findex-3)&NET_TIMINGSMASK].col = 0xff0000ff;
|
2020-09-29 07:09:01 +00:00
|
|
|
}
|
|
|
|
#endif
|
2009-04-01 22:03:56 +00:00
|
|
|
|
|
|
|
x = 0;
|
|
|
|
for (a=0 ; a<NET_TIMINGS ; a++)
|
|
|
|
{
|
2022-07-28 02:17:45 +00:00
|
|
|
avg += history[a].time[0];
|
|
|
|
if (minv > history[a].time[0])
|
|
|
|
minv = history[a].time[0];
|
|
|
|
if (maxv < history[a].time[0])
|
|
|
|
maxv = history[a].time[0];
|
2020-09-29 07:09:01 +00:00
|
|
|
}
|
|
|
|
if (!scale)
|
|
|
|
{
|
|
|
|
bias = minv;
|
|
|
|
scale = NET_GRAPHHEIGHT/(maxv-minv);
|
2009-04-01 22:03:56 +00:00
|
|
|
}
|
2020-09-29 07:09:01 +00:00
|
|
|
else
|
|
|
|
scale *= 1000;
|
|
|
|
avg/=a;
|
|
|
|
for (a = 0; a < NET_TIMINGS; a++)
|
2022-07-28 02:17:45 +00:00
|
|
|
dev += 1000*1000*(history[a].time[0] - avg)*(history[a].time[0] - avg);
|
2020-09-29 07:09:01 +00:00
|
|
|
dev /= a;
|
|
|
|
dev = sqrt(dev);
|
|
|
|
|
2009-04-01 22:03:56 +00:00
|
|
|
|
2004-08-22 22:29:09 +00:00
|
|
|
x = ((vid.width - 320)>>1);
|
|
|
|
x=-x;
|
|
|
|
|
2020-09-29 07:09:01 +00:00
|
|
|
textheight = 4;
|
|
|
|
textheight = ceil(textheight*Font_CharVHeight(font_console)/8)*8; //might have a small gap underneath
|
|
|
|
|
|
|
|
y = vid.height - sb_lines - 16 - NET_GRAPHHEIGHT - textheight;
|
|
|
|
|
|
|
|
M_DrawTextBox (x, y, NET_TIMINGS/8, (textheight + NET_GRAPHHEIGHT)/8);
|
2019-01-13 16:51:50 +00:00
|
|
|
x=8;
|
2004-08-22 22:29:09 +00:00
|
|
|
y += 8;
|
2011-09-05 01:48:23 +00:00
|
|
|
|
2020-09-29 07:09:01 +00:00
|
|
|
COM_ParseFunString(CON_WHITEMASK, va("mean: %.3ffps (%.3fms)", 1/avg, 1000*avg), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
COM_ParseFunString(CON_WHITEMASK, va("fastest: %.3ffps (%.3fms)", 1/minv, 1000*minv), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
COM_ParseFunString(CON_WHITEMASK, va("slowest: %.3ffps (%.3fms)", 1/maxv, 1000*maxv), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
COM_ParseFunString(CON_WHITEMASK, va("deviation: %.3fms (max %.3fms)", dev, (maxv-minv)*1000/2), line, sizeof(line), false);
|
|
|
|
Draw_ExpandedString(font_console, x, y, line);
|
|
|
|
y += Font_CharVHeight(font_console);
|
|
|
|
|
2022-07-28 02:17:45 +00:00
|
|
|
for (b = 0; b < countof(g); b++)
|
|
|
|
{
|
|
|
|
Vector2Set(g[b].xy[2], 0,0);
|
|
|
|
Vector2Set(g[b].xy[3], 0,0);
|
|
|
|
}
|
|
|
|
for (a=0 ; a<4 ; a++)
|
|
|
|
{
|
|
|
|
Vector4Set(g[0].rgba[a], 1.0,0.1,0.1,1.0); //server = red
|
|
|
|
Vector4Set(g[1].rgba[a], 0.1,1.0,0.1,1.0); //lightmap/stalls = green
|
|
|
|
Vector4Set(g[2].rgba[a], 1.0,1.0,1.0,1.0); //client/other = white.
|
|
|
|
}
|
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
for (a=0 ; a<NET_TIMINGS ; a++)
|
|
|
|
{
|
2020-09-29 07:09:01 +00:00
|
|
|
i = (findex-NET_TIMINGS+a)&(NET_TIMINGS-1);
|
2022-07-28 02:17:45 +00:00
|
|
|
lh = NET_GRAPHHEIGHT;
|
|
|
|
for (b = countof(g); b-- > 0; lh = h)
|
|
|
|
{
|
|
|
|
h = (history[i].time[b]-bias) * scale;
|
2020-09-29 07:09:01 +00:00
|
|
|
|
2022-07-28 02:17:45 +00:00
|
|
|
if (h > NET_GRAPHHEIGHT)
|
|
|
|
h = NET_GRAPHHEIGHT;
|
|
|
|
h = (NET_GRAPHHEIGHT-h);
|
2019-01-13 16:51:50 +00:00
|
|
|
|
2022-07-28 02:17:45 +00:00
|
|
|
Vector2Copy(g[b].xy[3], g[b].xy[0]); Vector4Copy(g[b].rgba[3], g[b].rgba[0]);
|
|
|
|
Vector2Copy(g[b].xy[2], g[b].xy[1]); Vector4Copy(g[b].rgba[2], g[b].rgba[1]);
|
2019-01-13 16:51:50 +00:00
|
|
|
|
2022-07-28 02:17:45 +00:00
|
|
|
Vector2Set(g[b].xy[2+0], x+a, y+h);
|
|
|
|
Vector2Set(g[b].xy[2+1], x+a, y+lh);
|
2019-01-13 16:51:50 +00:00
|
|
|
|
2022-07-28 02:17:45 +00:00
|
|
|
Vector2Set(g[b].tc[2+0], x/(float)NET_TIMINGS, (NET_GRAPHHEIGHT-h)/NET_GRAPHHEIGHT);
|
|
|
|
Vector2Set(g[b].tc[2+1], x/(float)NET_TIMINGS, 1);
|
|
|
|
|
|
|
|
if (a && (h!=lh || g[b].xy[0][1]!=g[b].xy[1][1]))
|
|
|
|
R2D_Image2dQuad((const vec2_t*)g[b].xy, (const vec2_t*)g[b].tc, (const vec4_t*)g[b].rgba, shader_draw_fill);
|
|
|
|
}
|
2019-01-13 16:51:50 +00:00
|
|
|
}
|
2004-08-22 22:29:09 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 16:16:29 +00:00
|
|
|
void R_NetgraphInit(void)
|
|
|
|
{
|
2019-01-13 16:51:50 +00:00
|
|
|
#ifdef GRAPHTEX
|
|
|
|
TEXASSIGN(netgraphtexture, Image_CreateTexture("***netgraph***", NULL, IF_UIPIC|IF_NOMIPMAP|IF_CLAMP));
|
2013-08-21 07:14:39 +00:00
|
|
|
netgraphshader = R_RegisterShader("netgraph", SUF_NONE,
|
2011-10-27 16:16:29 +00:00
|
|
|
"{\n"
|
2012-04-09 19:12:12 +00:00
|
|
|
"program default2d\n"
|
2011-10-27 16:16:29 +00:00
|
|
|
"{\n"
|
|
|
|
"map $diffuse\n"
|
|
|
|
"blendfunc blend\n"
|
|
|
|
"}\n"
|
|
|
|
"}\n"
|
|
|
|
);
|
2015-05-03 19:57:46 +00:00
|
|
|
netgraphshader->defaulttextures->base = netgraphtexture;
|
2019-01-13 16:51:50 +00:00
|
|
|
#endif
|
2011-10-27 16:16:29 +00:00
|
|
|
}
|