X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=cl_screen.c;h=a37dfed4d09760a3dce0c5806168025884af3a37;hb=8d7c6efa6bdbfecaa3dbcc39b68c4469d272dc6b;hp=7d47664544f5b85e19e404f681b308ebd803de2b;hpb=7f93c4a0c143db64985895cca15f347bd95b0fcd;p=xonotic%2Fdarkplaces.git diff --git a/cl_screen.c b/cl_screen.c index 7d476645..a37dfed4 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -244,16 +244,16 @@ static void SCR_CheckDrawCenterString (void) SCR_DrawCenterString (); } -static void SCR_DrawNetGraph_DrawGraph (int graphx, int graphy, int graphwidth, int graphheight, float graphscale, const char *label, float textsize, int packetcounter, netgraphitem_t *netgraph) +static void SCR_DrawNetGraph_DrawGraph (int graphx, int graphy, int graphwidth, int graphheight, float graphscale, int graphlimit, const char *label, float textsize, int packetcounter, netgraphitem_t *netgraph) { netgraphitem_t *graph; int j, x, y, numlines; int totalbytes = 0; char bytesstring[128]; - float g[NETGRAPH_PACKETS][6]; + float g[NETGRAPH_PACKETS][7]; float *a; float *b; - r_vertexgeneric_t vertex[(NETGRAPH_PACKETS+2)*5*2]; + r_vertexgeneric_t vertex[(NETGRAPH_PACKETS+2)*6*2]; r_vertexgeneric_t *v; DrawQ_Fill(graphx, graphy, graphwidth, graphheight + textsize * 2, 0, 0, 0, 0.5, 0); // draw the bar graph itself @@ -267,12 +267,16 @@ static void SCR_DrawNetGraph_DrawGraph (int graphx, int graphy, int graphwidth, g[j][3] = 1.0f; g[j][4] = 1.0f; g[j][5] = 1.0f; + g[j][6] = 1.0f; if (graph->unreliablebytes == NETGRAPH_LOSTPACKET) g[j][1] = 0.00f; else if (graph->unreliablebytes == NETGRAPH_CHOKEDPACKET) - g[j][2] = 0.96f; + g[j][2] = 0.90f; else { + if(netgraph[j].time >= netgraph[(j+NETGRAPH_PACKETS-1)%NETGRAPH_PACKETS].time) + if(graph->unreliablebytes + graph->reliablebytes + graph->ackbytes >= graphlimit * (netgraph[j].time - netgraph[(j+NETGRAPH_PACKETS-1)%NETGRAPH_PACKETS].time)) + g[j][2] = 0.98f; g[j][3] = 1.0f - graph->unreliablebytes * graphscale; g[j][4] = g[j][3] - graph->reliablebytes * graphscale; g[j][5] = g[j][4] - graph->ackbytes * graphscale; @@ -280,11 +284,14 @@ static void SCR_DrawNetGraph_DrawGraph (int graphx, int graphy, int graphwidth, if (realtime - graph->time < 1.0f) totalbytes += graph->unreliablebytes + graph->reliablebytes + graph->ackbytes; } + if(graph->cleartime >= 0) + g[j][6] = 0.5f + 0.5f * (2.0 / M_PI) * atan((M_PI / 2.0) * (graph->cleartime - graph->time)); g[j][1] = bound(0.0f, g[j][1], 1.0f); g[j][2] = bound(0.0f, g[j][2], 1.0f); g[j][3] = bound(0.0f, g[j][3], 1.0f); g[j][4] = bound(0.0f, g[j][4], 1.0f); g[j][5] = bound(0.0f, g[j][5], 1.0f); + g[j][6] = bound(0.0f, g[j][6], 1.0f); } // render the lines for the graph numlines = 0; @@ -310,7 +317,10 @@ static void SCR_DrawNetGraph_DrawGraph (int graphx, int graphy, int graphwidth, VectorSet(v->vertex3f, graphx + graphwidth * a[0], graphy + graphheight * a[3], 0.0f);Vector4Set(v->color4f, 1.0f, 0.5f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++; VectorSet(v->vertex3f, graphx + graphwidth * b[0], graphy + graphheight * b[3], 0.0f);Vector4Set(v->color4f, 1.0f, 0.5f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++; - numlines += 5; + VectorSet(v->vertex3f, graphx + graphwidth * a[0], graphy + graphheight * a[6], 0.0f);Vector4Set(v->color4f, 0.0f, 0.0f, 1.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++; + VectorSet(v->vertex3f, graphx + graphwidth * b[0], graphy + graphheight * b[6], 0.0f);Vector4Set(v->color4f, 0.0f, 0.0f, 1.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++; + + numlines += 6; } if (numlines > 0) { @@ -331,7 +341,7 @@ SCR_DrawNetGraph */ static void SCR_DrawNetGraph (void) { - int i, separator1, separator2, graphwidth, graphheight, netgraph_x, netgraph_y, textsize, index, netgraphsperrow; + int i, separator1, separator2, graphwidth, graphheight, netgraph_x, netgraph_y, textsize, index, netgraphsperrow, graphlimit; float graphscale; netconn_t *c; char vabuf[1024]; @@ -349,6 +359,7 @@ static void SCR_DrawNetGraph (void) graphwidth = 120; graphheight = 70; graphscale = 1.0f / 1500.0f; + graphlimit = cl_rate.integer; netgraphsperrow = (vid_conwidth.integer + separator2) / (graphwidth * 2 + separator1 + separator2); netgraphsperrow = max(netgraphsperrow, 1); @@ -357,8 +368,8 @@ static void SCR_DrawNetGraph (void) netgraph_x = (vid_conwidth.integer + separator2) - (1 + (index % netgraphsperrow)) * (graphwidth * 2 + separator1 + separator2); netgraph_y = (vid_conheight.integer - 48 - sbar_info_pos.integer + separator2) - (1 + (index / netgraphsperrow)) * (graphheight + textsize + separator2); c = cls.netcon; - SCR_DrawNetGraph_DrawGraph(netgraph_x , netgraph_y, graphwidth, graphheight, graphscale, "incoming", textsize, c->incoming_packetcounter, c->incoming_netgraph); - SCR_DrawNetGraph_DrawGraph(netgraph_x + graphwidth + separator1, netgraph_y, graphwidth, graphheight, graphscale, "outgoing", textsize, c->outgoing_packetcounter, c->outgoing_netgraph); + SCR_DrawNetGraph_DrawGraph(netgraph_x , netgraph_y, graphwidth, graphheight, graphscale, graphlimit, "incoming", textsize, c->incoming_packetcounter, c->incoming_netgraph); + SCR_DrawNetGraph_DrawGraph(netgraph_x + graphwidth + separator1, netgraph_y, graphwidth, graphheight, graphscale, graphlimit, "outgoing", textsize, c->outgoing_packetcounter, c->outgoing_netgraph); index++; if (sv.active && shownetgraph.integer >= 2) @@ -370,8 +381,8 @@ static void SCR_DrawNetGraph (void) continue; netgraph_x = (vid_conwidth.integer + separator2) - (1 + (index % netgraphsperrow)) * (graphwidth * 2 + separator1 + separator2); netgraph_y = (vid_conheight.integer - 48 + separator2) - (1 + (index / netgraphsperrow)) * (graphheight + textsize + separator2); - SCR_DrawNetGraph_DrawGraph(netgraph_x , netgraph_y, graphwidth, graphheight, graphscale, va(vabuf, sizeof(vabuf), "%s", svs.clients[i].name), textsize, c->outgoing_packetcounter, c->outgoing_netgraph); - SCR_DrawNetGraph_DrawGraph(netgraph_x + graphwidth + separator1, netgraph_y, graphwidth, graphheight, graphscale, "" , textsize, c->incoming_packetcounter, c->incoming_netgraph); + SCR_DrawNetGraph_DrawGraph(netgraph_x , netgraph_y, graphwidth, graphheight, graphscale, graphlimit, va(vabuf, sizeof(vabuf), "%s", svs.clients[i].name), textsize, c->outgoing_packetcounter, c->outgoing_netgraph); + SCR_DrawNetGraph_DrawGraph(netgraph_x + graphwidth + separator1, netgraph_y, graphwidth, graphheight, graphscale, graphlimit, "" , textsize, c->incoming_packetcounter, c->incoming_netgraph); index++; } } @@ -2149,7 +2160,7 @@ static void SCR_DrawScreen (void) r_refdef.view.ortho_x = atan(r_refdef.view.frustum_x) * (360.0 / M_PI); // abused as angle by VM_CL_R_SetView r_refdef.view.ortho_y = atan(r_refdef.view.frustum_y) * (360.0 / M_PI); // abused as angle by VM_CL_R_SetView - if(!CL_VM_UpdateView()) + if(!CL_VM_UpdateView(r_stereo_side ? 0.0 : max(0.0, cl.time - cl.oldtime))) R_RenderView(); } @@ -2597,7 +2608,7 @@ void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) if (qglDrawBuffer) qglDrawBuffer(GL_BACK); SCR_DrawLoadingScreen_SharedSetup(clear); - if (vid.stereobuffer) + if (vid.stereobuffer && qglDrawBuffer) { qglDrawBuffer(GL_BACK_LEFT); SCR_DrawLoadingScreen(clear); @@ -2779,6 +2790,9 @@ void CL_UpdateScreen(void) sb_lines = 24+16+8; } + R_FrameData_NewFrame(); + R_BufferData_NewFrame(); + Matrix4x4_OriginFromMatrix(&r_refdef.view.matrix, vieworigin); R_HDR_UpdateIrisAdaptation(vieworigin);