Line | |
---|
1 | #ifndef __BVHCONSTRUCTOR_H
|
---|
2 | #define __BVHCONSTRUCTOR_H
|
---|
3 |
|
---|
4 | #include "Bvh.h"
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 | namespace CHCDemoEngine
|
---|
9 | {
|
---|
10 |
|
---|
11 | /** This class represents a bvh construction algorithm
|
---|
12 | */
|
---|
13 | class BvhConstructor
|
---|
14 | {
|
---|
15 | public:
|
---|
16 |
|
---|
17 | BvhConstructor(SceneEntity **entities, int first, int last);
|
---|
18 |
|
---|
19 | /** Constructs a bvh and returns the root and the number of bvh nodes.
|
---|
20 | */
|
---|
21 | BvhNode *Construct(int &nodes);
|
---|
22 |
|
---|
23 |
|
---|
24 | protected:
|
---|
25 |
|
---|
26 | int SortTriangles(BvhLeaf *leaf, int axis, float position);
|
---|
27 |
|
---|
28 | int SortTrianglesSpatialMedian(BvhLeaf *leaf, int axis);
|
---|
29 |
|
---|
30 | BvhNode *SubdivideLeaf(BvhLeaf *leaf, int parentAxis);
|
---|
31 |
|
---|
32 | inline bool TerminationCriteriaMet(BvhLeaf *leaf) const;
|
---|
33 |
|
---|
34 |
|
---|
35 | /////////////////
|
---|
36 |
|
---|
37 | SceneEntity **mEntities;
|
---|
38 |
|
---|
39 | int mFirst;
|
---|
40 | int mLast;
|
---|
41 |
|
---|
42 | int mMaxDepth;
|
---|
43 | int mMaxObjects;
|
---|
44 | int mNumNodes;
|
---|
45 | };
|
---|
46 |
|
---|
47 | }
|
---|
48 |
|
---|
49 | #endif // __BVH_H |
---|
Note: See
TracBrowser
for help on using the repository browser.