From eb6a014f867034bc100661978909770b3d8e2b5c Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 20 Feb 2020 11:59:43 +1100 Subject: [PATCH] Make AxisLinesRenderer use Lock/Unlock vb too --- src/AxisLinesRenderer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AxisLinesRenderer.c b/src/AxisLinesRenderer.c index df3a4418b..e962a12c9 100644 --- a/src/AxisLinesRenderer.c +++ b/src/AxisLinesRenderer.c @@ -26,9 +26,8 @@ void AxisLinesRenderer_Render(void) { }; Vec3 coords[5], pos; - VertexP3fC4b vertices[AXISLINES_NUM_VERTICES]; - VertexP3fC4b* v = vertices; int i, count; + VertexP3fC4b* v; if (!AxisLinesRenderer_Enabled || Gfx.LostContext) return; /* Don't do it in a ContextRecreated handler, because we only want VB recreated if ShowAxisLines in on. */ @@ -46,6 +45,7 @@ void AxisLinesRenderer_Render(void) { Vec3_Add1(&coords[3], &pos, AXISLINES_THICKNESS); Vec3_Add1(&coords[4], &pos, AXISLINES_LENGTH); + v = (VertexP3fC4b*)Gfx_LockDynamicVb(axisLines_vb, VERTEX_FORMAT_P3FC4B, AXISLINES_NUM_VERTICES); for (i = 0; i < count; i++, v++) { v->X = coords[indices[i*3 + 0]].X; v->Y = coords[indices[i*3 + 1]].Y; @@ -54,7 +54,8 @@ void AxisLinesRenderer_Render(void) { } Gfx_SetVertexFormat(VERTEX_FORMAT_P3FC4B); - Gfx_UpdateDynamicVb_IndexedTris(axisLines_vb, vertices, count); + Gfx_UnlockDynamicVb(axisLines_vb); + Gfx_DrawVb_IndexedTris(AXISLINES_NUM_VERTICES); }