MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / GetTriangleCount

Method GetTriangleCount

src/Nazara/Utility/SubMesh.cpp:167–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165 }
166
167 unsigned int SubMesh::GetTriangleCount() const
168 {
169 const IndexBuffer* indexBuffer = GetIndexBuffer();
170 unsigned int indexCount;
171 if (indexBuffer)
172 indexCount = indexBuffer->GetIndexCount();
173 else
174 indexCount = GetVertexCount();
175
176 switch (m_primitiveMode)
177 {
178 case PrimitiveMode_LineList:
179 case PrimitiveMode_LineStrip:
180 case PrimitiveMode_PointList:
181 return 0;
182
183 case PrimitiveMode_TriangleFan:
184 return (indexCount - 1) / 2;
185
186 case PrimitiveMode_TriangleList:
187 return indexCount / 3;
188
189 case PrimitiveMode_TriangleStrip:
190 return indexCount - 2;
191 }
192
193 NazaraError("Primitive mode not handled (0x" + String::Number(m_primitiveMode, 16) + ')');
194 return 0;
195 }
196
197 UInt32 SubMesh::GetMaterialIndex() const
198 {

Callers

nothing calls this directly

Calls 1

GetIndexCountMethod · 0.80

Tested by

no test coverage detected