| 566 | } |
| 567 | |
| 568 | bool MeshBase::UpdateTriangles(uint32 triangleCount, const void* ib, bool use16BitIndices) |
| 569 | { |
| 570 | uint32 indicesCount = triangleCount * 3; |
| 571 | uint32 ibStride = use16BitIndices ? sizeof(uint16) : sizeof(uint32); |
| 572 | if (!_indexBuffer) |
| 573 | _indexBuffer = GPUDevice::Instance->CreateBuffer(TEXT("DynamicMesh.IB")); |
| 574 | if (_indexBuffer->Init(GPUBufferDescription::Index(ibStride, indicesCount, ib))) |
| 575 | { |
| 576 | _triangles = 0; |
| 577 | return true; |
| 578 | } |
| 579 | |
| 580 | // TODO: update collision proxy |
| 581 | |
| 582 | _triangles = triangleCount; |
| 583 | _use16BitIndexBuffer = use16BitIndices; |
| 584 | return false; |
| 585 | } |
| 586 | |
| 587 | bool MeshBase::Intersects(const Ray& ray, const Matrix& world, Real& distance, Vector3& normal) const |
| 588 | { |
no test coverage detected