TriangleGrouper.h 1.1 KB

123456789101112131415161718192021222324252627
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Jolt/Geometry/IndexedTriangle.h>
  6. #include <Jolt/Core/NonCopyable.h>
  7. JPH_NAMESPACE_BEGIN
  8. /// A class that groups triangles in batches of N (according to closeness)
  9. class JPH_EXPORT TriangleGrouper : public NonCopyable
  10. {
  11. public:
  12. /// Virtual destructor
  13. virtual ~TriangleGrouper() = default;
  14. /// Group a batch of indexed triangles
  15. /// @param inVertices The list of vertices
  16. /// @param inTriangles The list of indexed triangles (indexes into inVertices)
  17. /// @param inGroupSize How big each group should be
  18. /// @param outGroupedTriangleIndices An ordered list of indices (indexing into inTriangles), contains groups of inGroupSize large worth of indices to triangles that are grouped together. If the triangle count is not an exact multiple of inGroupSize the last batch will be smaller.
  19. virtual void Group(const VertexList &inVertices, const IndexedTriangleList &inTriangles, int inGroupSize, Array<uint> &outGroupedTriangleIndices) = 0;
  20. };
  21. JPH_NAMESPACE_END