[client] egl: simplify EGL torus code

This commit is contained in:
Quantum 2021-12-27 16:13:55 -05:00 committed by Geoffrey McRae
parent 95987a9c91
commit 136737f25b

View File

@ -33,12 +33,12 @@ void egl_drawTorus(EGL_Model * model, unsigned int pts, float x, float y,
const float angle = (i / (float)pts) * M_PI * 2.0f; const float angle = (i / (float)pts) * M_PI * 2.0f;
const float c = cos(angle); const float c = cos(angle);
const float s = sin(angle); const float s = sin(angle);
*dst = x + (inner * c); ++dst; *dst++ = x + (inner * c);
*dst = y + (inner * s); ++dst; *dst++ = y + (inner * s);
*dst = 0.0f; ++dst; *dst++ = 0.0f;
*dst = x + (outer * c); ++dst; *dst++ = x + (outer * c);
*dst = y + (outer * s); ++dst; *dst++ = y + (outer * s);
*dst = 0.0f; ++dst; *dst++ = 0.0f;
} }
egl_modelAddVerts(model, v, NULL, (pts + 1) * 2); egl_modelAddVerts(model, v, NULL, (pts + 1) * 2);
@ -56,12 +56,12 @@ void egl_drawTorusArc(EGL_Model * model, unsigned int pts, float x, float y,
const float angle = s + ((i / (float)pts) * e); const float angle = s + ((i / (float)pts) * e);
const float c = cos(angle); const float c = cos(angle);
const float s = sin(angle); const float s = sin(angle);
*dst = x + (inner * c); ++dst; *dst++ = x + (inner * c);
*dst = y + (inner * s); ++dst; *dst++ = y + (inner * s);
*dst = 0.0f; ++dst; *dst++ = 0.0f;
*dst = x + (outer * c); ++dst; *dst++ = x + (outer * c);
*dst = y + (outer * s); ++dst; *dst++ = y + (outer * s);
*dst = 0.0f; ++dst; *dst++ = 0.0f;
} }
egl_modelAddVerts(model, v, NULL, (pts + 1) * 2); egl_modelAddVerts(model, v, NULL, (pts + 1) * 2);