MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DrawTriangles3D

Method DrawTriangles3D

TombEngine/Renderer/RendererDraw.cpp:1179–1215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1177 }
1178
1179 void Renderer::DrawTriangles3D(RenderView& view)
1180 {
1181 SetBlendMode(BlendMode::Additive);
1182 SetCullMode(CullMode::None);
1183
1184 _shaders.Bind(Shader::Solid);
1185
1186 _context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
1187 _context->IASetInputLayout(_inputLayout.Get());
1188
1189 _primitiveBatch->Begin();
1190
1191 for (const auto& tri : _triangles3DToDraw)
1192 {
1193 auto rVertices = std::vector<Vertex>{};
1194 rVertices.reserve(tri.Vertices.size());
1195
1196 for (const auto& vertex : tri.Vertices)
1197 {
1198 auto rVertex = Vertex{};
1199 rVertex.Position = vertex;
1200 rVertex.Color = VectorColorToRGBA_TempToVector4(tri.Color);
1201
1202 rVertices.push_back(rVertex);
1203 }
1204
1205 _primitiveBatch->DrawTriangle(rVertices[0], rVertices[1], rVertices[2]);
1206
1207 _numLinesDrawCalls++;
1208 _numDrawCalls++;
1209 }
1210
1211 _primitiveBatch->End();
1212
1213 SetBlendMode(BlendMode::Opaque);
1214 SetCullMode(CullMode::CounterClockwise);
1215 }
1216
1217 void Renderer::AddDebugLine(const Vector3& origin, const Vector3& target, const Color& color, RendererDebugPage page)
1218 {

Callers

nothing calls this directly

Calls 6

BindMethod · 0.80
GetMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected