| 141 | } |
| 142 | |
| 143 | void Square2d(HRenderContext context, float x0, float y0, float x1, float y1, Vector4 color) |
| 144 | { |
| 145 | if (!context->m_DebugRenderer.m_RenderContext) |
| 146 | return; |
| 147 | DebugRenderTypeData& type_data = context->m_DebugRenderer.m_TypeData[DEBUG_RENDER_TYPE_FACE_3D]; |
| 148 | RenderObject& ro = type_data.m_RenderObject; |
| 149 | const uint32_t vertex_count = 6; |
| 150 | if (ro.m_VertexCount + vertex_count < context->m_DebugRenderer.m_MaxVertexCount) |
| 151 | { |
| 152 | DebugVertex v[vertex_count]; |
| 153 | v[0].m_Position = Vector4(x0, y0, 0.0f, 0.0f); |
| 154 | v[1].m_Position = Vector4(x0, y1, 0.0f, 0.0f); |
| 155 | v[2].m_Position = Vector4(x1, y0, 0.0f, 0.0f); |
| 156 | v[5].m_Position = Vector4(x1, y1, 0.0f, 0.0f); |
| 157 | v[3].m_Position = v[2].m_Position; |
| 158 | v[4].m_Position = v[1].m_Position; |
| 159 | for (uint32_t i = 0; i < vertex_count; ++i) |
| 160 | v[i].m_Color = color; |
| 161 | char* buffer = (char*)type_data.m_ClientBuffer; |
| 162 | memcpy(&buffer[ro.m_VertexCount * sizeof(DebugVertex)], (const void*)v, vertex_count * sizeof(DebugVertex)); |
| 163 | ro.m_VertexCount += vertex_count; |
| 164 | } |
| 165 | else |
| 166 | { |
| 167 | LogVertexWarning(context); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | void Triangle3d(HRenderContext context, Point3 vertices[3], Vector4 color) |
| 172 | { |