MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / UpdateTriangles

Method UpdateTriangles

Source/Engine/Graphics/Models/MeshBase.cpp:568–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566}
567
568bool 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
587bool MeshBase::Intersects(const Ray& ray, const Matrix& world, Real& distance, Vector3& normal) const
588{

Callers 1

UpdateTrianglesFunction · 0.45

Calls 3

IndexFunction · 0.50
CreateBufferMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected