MCPcopy Create free account
hub / github.com/defold/defold / Triangle3d

Function Triangle3d

engine/render/src/render/debug_renderer.cpp:171–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169 }
170
171 void Triangle3d(HRenderContext context, Point3 vertices[3], Vector4 color)
172 {
173 if (!context->m_DebugRenderer.m_RenderContext)
174 return;
175 DebugRenderTypeData& type_data = context->m_DebugRenderer.m_TypeData[DEBUG_RENDER_TYPE_FACE_3D];
176 RenderObject& ro = type_data.m_RenderObject;
177 const uint32_t vertex_count = 3;
178 if (ro.m_VertexCount + vertex_count < context->m_DebugRenderer.m_MaxVertexCount)
179 {
180 DebugVertex v[vertex_count];
181 for (uint32_t i = 0; i < vertex_count; ++i)
182 {
183 v[i].m_Position = Vector4(vertices[i]);
184 v[i].m_Color = color;
185 }
186 char* buffer = (char*)type_data.m_ClientBuffer;
187 memcpy(&buffer[ro.m_VertexCount * sizeof(DebugVertex)], (const void*)v, vertex_count * sizeof(DebugVertex));
188 ro.m_VertexCount += vertex_count;
189 }
190 else
191 {
192 LogVertexWarning(context);
193 }
194 }
195
196 void Line2D(HRenderContext context, float x0, float y0, float x1, float y1, Vector4 color0, Vector4 color1)
197 {

Callers 1

DrawTrianglesFunction · 0.85

Calls 2

LogVertexWarningFunction · 0.85
Vector4Class · 0.50

Tested by

no test coverage detected