Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
TriangleSplitterBinning.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
14{
15public:
17 TriangleSplitterBinning(const VertexList &inVertices, const IndexedTriangleList &inTriangles, uint inMinNumBins = 8, uint inMaxNumBins = 128, uint inNumTrianglesPerBin = 6);
18
19 // See TriangleSplitter::GetStats
20 virtual void GetStats(Stats &outStats) const override
21 {
22 outStats.mSplitterName = "TriangleSplitterBinning";
23 }
24
25 // See TriangleSplitter::Split
26 virtual bool Split(const Range &inTriangles, Range &outLeft, Range &outRight) override;
27
28private:
29 // Configuration
30 const uint mMinNumBins;
31 const uint mMaxNumBins;
32 const uint mNumTrianglesPerBin;
33
34 struct Bin
35 {
36 // Properties of this bin
37 AABox mBounds;
38 float mMinCentroid;
39 uint mNumTriangles;
40
41 // Accumulated data from left most / right most bin to current (including this bin)
42 AABox mBoundsAccumulatedLeft;
43 AABox mBoundsAccumulatedRight;
44 uint mNumTrianglesAccumulatedLeft;
45 uint mNumTrianglesAccumulatedRight;
46 };
47
48 // Scratch area to store the bins
49 Array<Bin> mBins;
50};
51
#define JPH_EXPORT
Definition: Core.h:236
unsigned int uint
Definition: Core.h:452
#define JPH_NAMESPACE_END
Definition: Core.h:378
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
Axis aligned box.
Definition: AABox.h:16
Binning splitter approach taken from: Realtime Ray Tracing on GPU with BVH-based Packet Traversal by ...
Definition: TriangleSplitterBinning.h:14
virtual void GetStats(Stats &outStats) const override
Get stats of splitter.
Definition: TriangleSplitterBinning.h:20
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: TriangleSplitter.h:23
const char * mSplitterName
Definition: TriangleSplitter.h:24