Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
TriangleSplitterFixedLeafSize.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
9
11
15{
16public:
18 TriangleSplitterFixedLeafSize(const VertexList &inVertices, const IndexedTriangleList &inTriangles, uint inLeafSize, uint inMinNumBins = 8, uint inMaxNumBins = 128, uint inNumTrianglesPerBin = 6);
19
20 // See TriangleSplitter::GetStats
21 virtual void GetStats(Stats &outStats) const override
22 {
23 outStats.mSplitterName = "TriangleSplitterFixedLeafSize";
24 outStats.mLeafSize = mLeafSize;
25 }
26
27 // See TriangleSplitter::Split
28 virtual bool Split(const Range &inTriangles, Range &outLeft, Range &outRight) override;
29
30private:
32 Vec3 GetCentroidForGroup(uint inFirstTriangleInGroup);
33
34 // Configuration
35 const uint mLeafSize;
36 const uint mMinNumBins;
37 const uint mMaxNumBins;
38 const uint mNumTrianglesPerBin;
39
40 struct Bin
41 {
42 // Properties of this bin
43 AABox mBounds;
44 float mMinCentroid;
45 uint mNumTriangles;
46
47 // Accumulated data from left most / right most bin to current (including this bin)
48 AABox mBoundsAccumulatedLeft;
49 AABox mBoundsAccumulatedRight;
50 uint mNumTrianglesAccumulatedLeft;
51 uint mNumTrianglesAccumulatedRight;
52 };
53};
54
#define JPH_EXPORT
Definition Core.h:236
unsigned int uint
Definition Core.h:453
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
Axis aligned box.
Definition AABox.h:16
Definition TriangleSplitterFixedLeafSize.h:15
virtual void GetStats(Stats &outStats) const override
Get stats of splitter.
Definition TriangleSplitterFixedLeafSize.h:21
A class that splits a triangle list into two parts for building a tree.
Definition TriangleSplitter.h:14
virtual bool Split(const Range &inTriangles, Range &outLeft, Range &outRight)=0
Definition Vec3.h:17
Definition TriangleSplitter.h:23
int mLeafSize
Definition TriangleSplitter.h:25
const char * mSplitterName
Definition TriangleSplitter.h:24