| 264 | } |
| 265 | |
| 266 | void MeshObject::DrawPrimitives(ref_ptr<dp::GraphicsContext> context) |
| 267 | { |
| 268 | if (m_buffers.empty()) |
| 269 | return; |
| 270 | |
| 271 | auto const & buffer = m_buffers[0]; |
| 272 | auto const vertexNum = buffer->GetSizeInBytes() / buffer->GetStrideInBytes(); |
| 273 | #ifdef DEBUG |
| 274 | for (size_t i = 1; i < m_buffers.size(); i++) |
| 275 | { |
| 276 | ASSERT_EQUAL(m_buffers[i]->GetSizeInBytes() / m_buffers[i]->GetStrideInBytes(), vertexNum, |
| 277 | ("All buffers in a mesh must contain the same vertex number")); |
| 278 | } |
| 279 | #endif |
| 280 | |
| 281 | CHECK(m_impl != nullptr, ()); |
| 282 | if (m_indices.empty()) |
| 283 | m_impl->DrawPrimitives(context, vertexNum, 0); |
| 284 | else |
| 285 | m_impl->DrawPrimitivesIndexed(context, static_cast<uint32_t>(m_indices.size()), 0); |
| 286 | } |
| 287 | |
| 288 | void MeshObject::Unbind(ref_ptr<dp::GpuProgram> program) |
| 289 | { |
no test coverage detected