MCPcopy Create free account
hub / github.com/dfranx/SHADERed / DebugDrawPrimitives

Function DebugDrawPrimitives

src/SHADERed/Objects/RenderEngine.cpp:32–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31namespace ed {
32 void DebugDrawPrimitives(int& vertexStart, int vertexCount, int maxVertexCount, int vertexStrip, GLuint topology, GLuint varLoc, bool instanced, int instanceCount, bool useIndices = false, int vbase = 0)
33 {
34 int actualVertexCount = vertexCount;
35 while (vertexStart < maxVertexCount) {
36 float r = ((vertexStart + vbase) & 0x000000FF) / 255.0f;
37 float g = (((vertexStart + vbase) & 0x0000FF00) >> 8) / 255.0f;
38 float b = (((vertexStart + vbase) & 0x00FF0000) >> 16) / 255.0f;
39 glUniform4f(varLoc, r, g, b, 0.0f);
40
41 actualVertexCount = std::min<int>(vertexCount, maxVertexCount - vertexStart);
42 if (actualVertexCount <= 0) break;
43
44 if (useIndices) {
45 if (instanced)
46 glDrawElementsInstanced(GL_TRIANGLES, actualVertexCount, GL_UNSIGNED_INT, (void*)(vertexStart * sizeof(GLuint)), instanceCount);
47 else
48 glDrawElements(GL_TRIANGLES, actualVertexCount, GL_UNSIGNED_INT, (void*)(vertexStart * sizeof(GLuint)));
49 } else {
50 if (instanced)
51 glDrawArraysInstanced(topology, vertexStart, actualVertexCount, instanceCount);
52 else
53 glDrawArrays(topology, vertexStart, actualVertexCount);
54 }
55 vertexStart += vertexCount - vertexStrip;
56 }
57 }
58 void DebugDrawInstanced(int& iStart, int iStep, int iCount, int vertexCount, GLuint topology, GLuint varLoc, bool useIndices = false)
59 {
60 while (iStart < iCount) {

Callers 1

DebugVertexPickMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected