source: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h @ 379

Revision 379, 22.7 KB checked in by mattausch, 19 years ago (diff)

worked on pvs heuristics

Line 
1#ifndef _ViewCellBsp_H__
2#define _ViewCellBsp_H__
3
4#include "Mesh.h"
5#include "Containers.h"
6#include <stack>
7
8class ViewCell;
9class BspViewCell;
10class Plane3;
11class BspTree; 
12class BspInterior;
13class Polygon3;
14class AxisAlignedBox3;
15class Ray;
16
17/** Data structure used for optimized ray casting.
18*/
19struct BspRayTraversalData
20{
21    BspNode *mNode;
22    Vector3 mExitPoint;
23    float mMaxT;
24   
25    BspRayTraversalData() {}
26
27    BspRayTraversalData(BspNode *n, const Vector3 &extp, const float maxt):
28    mNode(n), mExitPoint(extp), mMaxT(maxt)
29        {}
30};
31
32/** Data used for passing ray data down the tree.
33*/
34struct BoundedRay
35{
36        Ray *mRay;
37        float mMinT;
38        float mMaxT;
39               
40        BoundedRay(): mMinT(0), mMaxT(1e6), mRay(NULL)
41        {}
42        BoundedRay(Ray *r, float minT, float maxT):
43        mRay(r), mMinT(minT), mMaxT(maxT)
44        {}
45};
46
47typedef vector<BoundedRay *> BoundedRayContainer;
48
49class BspTreeStatistics
50{
51public:
52  // total number of nodes
53  int nodes;
54  // number of splits
55  int splits;
56  // totals number of rays
57  int rays;
58  // maximal reached depth
59  int maxDepth;
60  // minimal depth
61  int minDepth;
62  // max depth nodes
63  int maxDepthNodes;
64  // max number of rays per node
65  int maxObjectRefs;
66   // accumulated depth (used to compute average)
67  int accumDepth;
68  // number of initial polygons
69  int polys;
70  /// samples contributing to pvs
71  int contributingSamples;
72   /// sample contributions to pvs
73  int sampleContributions;
74  /// largest pvs
75  int largestPvs;
76
77  // Constructor
78  BspTreeStatistics()
79  {
80          Reset();
81  }
82
83  int Nodes() const {return nodes;}
84  int Interior() const { return nodes / 2; }
85  int Leaves() const { return (nodes / 2) + 1; }
86  double AvgDepth() const { return accumDepth / (double)Leaves();}; // TODO: computation wrong
87 
88  void Reset()
89  {
90          nodes = 0;
91          splits = 0;
92      maxDepthNodes = 0;
93          maxDepth = 0;
94          minDepth = 99999;
95          polys = 0;
96          accumDepth = 0;
97               
98          contributingSamples = 0;
99          sampleContributions = 0;
100  }
101
102  void
103  Print(ostream &app) const;
104
105  friend ostream &operator<<(ostream &s, const BspTreeStatistics &stat) {
106    stat.Print(s);
107    return s;
108  }
109 
110};
111
112class BspViewCellsStatistics
113{
114public:
115 
116  /// number of view cells
117  int viewCells;
118
119  /// size of the PVS
120  int pvs;
121 
122  /// largest PVS of all view cells
123  int maxPvs;
124
125  /// smallest PVS of all view cells
126  int minPvs;
127
128  /// view cells with empty PVS
129  int emptyPvs;
130
131  /// number of bsp leaves covering the view space
132  int bspLeaves;
133
134  /// largest number of leaves covered by one view cell
135  int maxBspLeaves;
136
137 
138  // Constructor
139  BspViewCellsStatistics()
140  {
141          Reset();
142  }
143
144  double AvgBspLeaves() const {return (double)bspLeaves / (double)viewCells;};
145  double AvgPvs() const {return (double)pvs / (double)viewCells;};
146 
147 
148  void Reset()
149  {
150          viewCells = 0;
151          pvs = 0;
152          maxPvs = 0;
153          minPvs = 999999;
154          emptyPvs = 0;
155          bspLeaves = 0;
156          maxBspLeaves = 0;
157  }
158
159  void
160  Print(ostream &app) const;
161
162  friend ostream &operator<<(ostream &s, const BspViewCellsStatistics &stat) {
163    stat.Print(s);
164    return s;
165  }
166 
167};
168
169/**
170    BspNode abstract class serving for interior and leaf node implementation
171*/
172class BspNode
173{
174        friend class BspTree;
175
176public:
177        BspNode();
178        virtual ~BspNode();
179        BspNode(BspInterior *parent);
180
181        /** Determines whether this node is a leaf or not
182        @return true if leaf
183        */
184        virtual bool IsLeaf() const = 0;
185
186        /** Determines whether this node is a root
187        @return true if root
188        */
189        virtual bool IsRoot() const;
190
191        /** Returns parent node.
192        */
193        BspInterior *GetParent();
194        /** Sets parent node.
195        */
196        void SetParent(BspInterior *parent);
197
198        /** Returns pointer to polygons.
199        */
200        PolygonContainer *GetPolygons();
201        /** Stores polygons in node or discards them according to storePolys.
202        */
203        void ProcessPolygons(PolygonContainer *polys, const bool storePolys);
204
205        static int mailID;
206        int mailbox;
207 
208        void Mail() { mailbox = mailID; }
209        static void NewMail() { mailID++; }
210        bool Mailed() const { return mailbox == mailID; }
211
212//int mViewCellIdx;
213protected:
214
215        /// parent of this node
216        BspInterior *mParent;
217
218        /// store polygons created during BSP splits
219        PolygonContainer *mPolygons;
220};
221
222/** BSP interior node implementation
223*/
224class BspInterior : public BspNode
225{
226        friend class BspTree;
227public:
228        /** Standard contructor taking split plane as argument.
229        */
230        BspInterior(const Plane3 &plane);
231        /** @return false since it is an interior node
232        */
233        bool IsLeaf() const;
234
235        BspNode *GetBack();
236        BspNode *GetFront();
237
238        Plane3 *GetPlane();
239
240        void ReplaceChildLink(BspNode *oldChild, BspNode *newChild);
241        void SetupChildLinks(BspNode *b, BspNode *f);
242
243        /** Splits polygons with respect to the split plane.
244                @param polys the polygons to be split. the polygons are consumed and
245                           distributed to the containers frontPolys, backPolys, coincident.
246                @param frontPolys returns the polygons in the front of the split plane
247                @param backPolys returns the polygons in the back of the split plane
248                @param coincident returns the polygons coincident to the split plane
249                @param storePolys if the polygons should be stored in the node
250               
251                @returns the number of splits   
252        */
253        int SplitPolygons(PolygonContainer &polys,
254                                          PolygonContainer &frontPolys,
255                                          PolygonContainer &backPolys,
256                                          PolygonContainer &coincident,
257                                          const bool storePolys = false);
258
259        /** Stores polygon in node or discards them according to storePolys.
260                @param polys the polygons
261                @param storePolys if the polygons should be stored or discarded
262        */
263        void ProcessPolygon(Polygon3 **poly, const bool storePolys);
264
265        friend ostream &operator<<(ostream &s, const BspInterior &A)
266        {
267                return s << A.mPlane;
268        }
269
270protected:
271
272        /// Splitting plane corresponding to this node
273        Plane3 mPlane;
274        /// back node
275        BspNode *mBack;
276        /// front node
277        BspNode *mFront;
278};
279
280/** BSP leaf node implementation.
281*/
282class BspLeaf : public BspNode
283{
284        friend class BspTree;
285
286public:
287        BspLeaf();
288        BspLeaf(BspViewCell *viewCell);
289        BspLeaf(BspInterior *parent);
290        BspLeaf(BspInterior *parent, BspViewCell *viewCell);
291
292        /** @return true since it is an interior node
293        */
294        bool IsLeaf() const;
295       
296        /** Returns pointer of view cell.
297        */
298        BspViewCell *GetViewCell() const;
299
300        /** Sets pointer to view cell.
301        */
302        void SetViewCell(BspViewCell *viewCell);
303
304        /** Generates new view cell and adds rays to the PVS.
305                @param sampleContributions the number contributions of the sampels
306                @param contributingSampels the number of contributing rays
307               
308        */
309        void GenerateViewCell(const BoundedRayContainer &rays,
310                                              int &sampleContributions,
311                                                  int &contributingSamples);
312
313protected:
314
315        /// if NULL this does not correspond to feasible viewcell
316        BspViewCell *mViewCell;
317};
318
319/** Implementation of the view cell BSP tree.
320*/
321class BspTree
322{
323public:
324       
325        /** Additional data which is passed down the BSP tree during traversal.
326        */
327        struct BspTraversalData
328        { 
329                /// the current node
330                BspNode *mNode;
331                /// polygonal data for splitting
332                PolygonContainer *mPolygons;
333                /// current depth
334                int mDepth;
335                /// the view cell associated with this subdivsion
336                ViewCell *mViewCell;
337                /// rays piercing this node
338                BoundedRayContainer *mRays;
339
340                BspTraversalData():
341                mNode(NULL),
342                mPolygons(NULL),
343                mDepth(0),
344                mViewCell(NULL),
345                mRays(NULL)
346                {}
347               
348                BspTraversalData(BspNode *node,
349                                                 PolygonContainer *polys,
350                                                 const int depth,
351                                                 ViewCell *viewCell,
352                                                 BoundedRayContainer *rays):
353                mNode(node),
354                mPolygons(polys),
355                mDepth(depth),
356                mViewCell(viewCell),
357                mRays(rays)
358                {}
359    };
360       
361        typedef std::stack<BspTraversalData> BspTraversalStack;
362
363        /** Default constructor creating an empty tree.
364                @param viewCell view cell corresponding to unbounded space
365        */
366        BspTree(ViewCell *viewCell);
367
368        ~BspTree();
369
370        const BspTreeStatistics &GetStatistics() const;
371 
372        /** Constructs tree using the given list of view cells.
373            For this type of construction we filter all view cells down the
374                tree. If there is no polygon left, the last split plane
375            decides inside or outside of the viewcell. A pointer to the
376                appropriate view cell is stored within each leaf.
377                Many leafs can point to the same viewcell.
378        */
379        void Construct(const ViewCellContainer &viewCells);
380
381        /** Constructs tree using the given list of objects.
382            @note the objects are not taken as view cells, but the view cells are
383                constructed from the subdivision: Each leaf is taken as one viewcell.
384                @param objects list of objects
385        */
386        void Construct(const ObjectContainer &objects);
387
388        /** Constructs the tree from a given set of rays.
389                @param sampleRays the set of sample rays the construction is based on
390                @param viewCells if not NULL, new view cells are
391                created in the leafs and stored in the conatainer
392        */
393        void Construct(const RayContainer &sampleRays);
394
395        /** Returns list of BSP leaves.
396        */
397        void CollectLeaves(vector<BspLeaf *> &leaves) const;
398
399        /** Returns box which bounds the whole tree.
400        */
401        AxisAlignedBox3 GetBoundingBox()const;
402
403        /** Returns root of BSP tree.
404        */
405        BspNode *GetRoot() const;
406
407        /** Exports Bsp tree to file.
408        */
409        bool Export(const string filename);
410
411        /** Collects the leaf view cells of the tree
412                @param viewCells returns the view cells
413        */
414        void CollectViewCells(ViewCellContainer &viewCells) const;
415
416        /** A ray is cast possible intersecting the tree.
417                @param the ray that is cast.
418                @returns the number of intersections with objects stored in the tree.
419        */
420        int CastRay(Ray &ray);
421
422        /** Set to true if new view cells shall be generated in each leaf.
423        */
424        void SetGenerateViewCells(int generateViewCells);
425
426        /// bsp tree construction types
427        enum {FROM_INPUT_VIEW_CELLS, FROM_SCENE_GEOMETRY, FROM_RAYS};
428
429        /** Returns statistics.
430        */
431        BspTreeStatistics &GetStat();
432
433        /** finds neighbouring leaves of this tree node.
434        */
435        int FindNeighbors(BspNode *n, vector<BspLeaf *> &neighbors,
436                                          const bool onlyUnmailed) const;
437
438        /** Constructs geometry associated with the half space intersections
439                leading to this node.
440        */
441        void ConstructGeometry(BspNode *n, PolygonContainer &cell) const;
442       
443        /** Construct geometry of view cell.
444        */
445        void ConstructGeometry(BspViewCell *vc, PolygonContainer &cell) const;
446
447        /** Returns random leaf of BSP tree.
448                @param halfspace defines the halfspace from which the leaf is taken.
449        */
450        BspLeaf *GetRandomLeaf(const Plane3 &halfspace);
451
452        /** Returns random leaf of BSP tree.
453                @param onlyUnmailed if only unmailed leaves should be returned.
454        */
455        BspLeaf *GetRandomLeaf(const bool onlyUnmailed = false);
456
457        /** Computes new cell based on the old cell definition and a new split plane
458                @param side indicates which side of the halfspace
459                @returns true if plane contributes to the cell.
460        */
461        bool ComputeChildrenGeometry(PolygonContainer &newCell,
462                                                        const PolygonContainer &cell,
463                                                        const vector<Plane3> &planes,
464                                                        const vector<bool> &sides,
465                                                        const Plane3 &splitPlane,
466                                                        const bool side) const;
467
468
469        /** Returns true if merge criteria are reached.
470        */
471    bool ShouldMerge(BspLeaf *front, BspLeaf *back) const;
472
473        /** Merges view cells based on some criteria
474            E.g., empty view cells can pe purged, view cells which have
475                a very similar PVS can be merged to one larger view cell.
476
477                @returns true if merge was successful.
478        */
479        bool MergeViewCells(BspLeaf *front, BspLeaf *back) const;
480
481        /** Traverses tree and counts all view cells as well as their PVS size.
482        */
483        void EvaluateViewCellsStats(BspViewCellsStatistics &stat) const;
484
485protected:
486
487        // --------------------------------------------------------------
488        // For sorting objects
489        // --------------------------------------------------------------
490        struct SortableEntry
491        {
492                enum {POLY_MIN, POLY_MAX};
493   
494                int type;
495                float value;
496                Polygon3 *poly;
497                SortableEntry() {}
498                SortableEntry(const int t, const float v, Polygon3 *poly):
499                type(t), value(v), poly(poly) {}
500               
501                bool operator<(const SortableEntry &b) const
502                {
503                        return value < b.value;
504                } 
505        };
506
507        /** Evaluates tree stats in the BSP tree leafs.
508        */
509        void EvaluateLeafStats(const BspTraversalData &data);
510
511        /** Subdivides node with respect to the traversal data.
512            @param tStack current traversal stack
513                @param tData traversal data also holding node to be subdivided
514                @returns new root of the subtree
515        */
516        BspNode *Subdivide(BspTraversalStack &tStack, BspTraversalData &tData);
517
518        /** Constructs the tree from the given list of polygons and rays.
519                @param polys stores set of polygons on which subdivision may be based
520                @param rays storesset of rays on which subdivision may be based
521        */
522        void Construct(PolygonContainer *polys, BoundedRayContainer *rays);
523
524        /** Selects the best possible splitting plane.
525                @param leaf the leaf to be split
526                @param polys the polygon list on which the split decition is based
527                @param rays ray container on which selection may be based
528                @note the polygons can be reordered in the process
529                @returns the split plane
530        */
531        Plane3 SelectPlane(BspLeaf *leaf,
532                                           PolygonContainer &polys,
533                                           const BoundedRayContainer &ray);
534
535        /** Evaluates the contribution of the candidate split plane.
536               
537                @param canditatePlane the candidate split plane
538                @param polys the polygons the split can be based on
539                @param rays the rays the split can be based on
540                @returns the cost of the candidate split plane
541        */
542        float SplitPlaneCost(const Plane3 &candidatePlane,
543                                                 const PolygonContainer &polys,                                                 
544                                                 const BoundedRayContainer &rays) const;
545
546        /** Strategies where the effect of the split plane is tested
547            on all input rays.
548                @returns the cost of the candidate split plane
549        */
550        float SplitPlaneCost(const Plane3 &candidatePlane,
551                                                 const PolygonContainer &polys) const;
552
553        /** Strategies where the effect of the split plane is tested
554            on all input polygons.
555                @returns the cost of the candidate split plane
556        */
557        float SplitPlaneCost(const Plane3 &candidatePlane,
558                                                 const BoundedRayContainer &polys) const;
559
560        /** Filters next view cell down the tree and inserts it into the appropriate leaves
561                (i.e., possibly more than one leaf).
562        */
563        void InsertViewCell(ViewCell *viewCell);
564        /** Inserts polygons down the tree. The polygons are filtered until a leaf is reached,
565                then further subdivided.
566        */
567        void InsertPolygons(PolygonContainer *polys);
568
569        /** Subdivide leaf.
570                @param leaf the leaf to be subdivided
571               
572                @param polys the polygons to be split
573                @param frontPolys returns the polygons in front of the split plane
574                @param backPolys returns the polygons in the back of the split plane
575               
576                @param rays the polygons to be filtered
577                @param frontRays returns the polygons in front of the split plane
578                @param backRays returns the polygons in the back of the split plane
579
580                @returns the root of the subdivision
581        */
582        BspInterior *SubdivideNode(BspLeaf *leaf,
583                                                           PolygonContainer &polys,
584                                                           PolygonContainer &frontPolys,
585                                                           PolygonContainer &backPolys,
586                                                           PolygonContainer &coincident,
587                                                           BoundedRayContainer &rays,
588                                                           BoundedRayContainer &frontRays,
589                                                           BoundedRayContainer &backRays);
590
591        /** Filters polygons down the tree.
592                @param node the current BSP node
593                @param polys the polygons to be filtered
594                @param frontPolys returns the polygons in front of the split plane
595                @param backPolys returns the polygons in the back of the split plane
596        */
597        void FilterPolygons(BspInterior *node,
598                                                PolygonContainer *polys,
599                                                PolygonContainer *frontPolys,
600                                                PolygonContainer *backPolys);
601
602        /** Selects the split plane in order to construct a tree with
603                certain characteristics (e.g., balanced tree, least splits,
604                2.5d aligned)
605                @param polygons container of polygons
606                @param rays bundle of rays on which the split can be based
607                @param maxPolyCandidates the maximal number of tested polygon candidates
608                @param maxRayCandidates the maximal number of ray candidates
609        */
610        Plane3 SelectPlaneHeuristics(PolygonContainer &polys,
611                                                                 const BoundedRayContainer &rays,
612                                                                 const int maxPolyCandidates,
613                                                                 const int maxRayCandidates);
614
615        /** Extracts the meshes of the objects and adds them to polygons.
616                Adds object aabb to the aabb of the tree.
617                @param maxPolys the maximal number of objects to be stored as polygons
618                @returns the number of polygons
619        */
620        int AddToPolygonSoup(const ObjectContainer &objects,
621                                                 PolygonContainer &polys,
622                                                 int maxObjects = 0);
623
624        /** Extracts the meshes of the view cells and and adds them to polygons.
625                Adds view cell aabb to the aabb of the tree.
626                @param maxPolys the maximal number of objects to be stored as polygons
627                @returns the number of polygons
628        */
629        int AddToPolygonSoup(const ViewCellContainer &viewCells,
630                                                 PolygonContainer &polys,
631                                                 int maxObjects = 0);
632
633        /** Extract polygons of this mesh and add to polygon container.
634                @param mesh the mesh that drives the polygon construction
635                @param parent the parent intersectable this polygon is constructed from
636                @returns number of polygons
637        */
638        int AddMeshToPolygons(Mesh *mesh, PolygonContainer &polys, MeshInstance *parent);
639
640        /** returns next candidate index and reorders polygons so no candidate is chosen two times
641                @param the current candidate index
642                @param max the range of candidates
643        */
644        int GetNextCandidateIdx(int currentIdx, PolygonContainer &polys);
645
646        /** Helper function which extracts a view cell on the front and the back
647                of the split plane.
648                @param backViewCell returns view cell on the back of the split plane
649                @param frontViewCell returns a view cell on the front of the split plane
650                @param coincident container of polygons coincident to the split plane
651                @param splitPlane the split plane which decides about back and front
652                @param extractBack if a back view cell is extracted
653                @param extractFront if a front view cell is extracted
654        */
655        void ExtractViewCells(ViewCell **backViewCell,
656                                                  ViewCell **frontViewCell,
657                                                  const PolygonContainer &coincident,
658                                                  const Plane3 splitPlane,
659                                                  const bool extractBack,
660                                                  const bool extractFront) const;
661       
662        /** Computes best cost ratio for the suface area heuristics for axis aligned
663                splits. This heuristics minimizes the cost for ray traversal.
664                @param polys the polygons guiding the ratio computation
665                @param box the bounding box of the leaf
666                @param axis the current split axis
667                @param position returns the split position
668                @param objectsBack the number of objects in the back of the split plane
669                @param objectsFront the number of objects in the front of the split plane
670        */
671        float BestCostRatio(const PolygonContainer &polys,
672                                                const AxisAlignedBox3 &box,
673                                                const int axis,
674                                                float &position,
675                                                int &objectsBack,
676                                                int &objectsFront) const;
677       
678        /** Sorts split candidates for surface area heuristics for axis aligned splits.
679                @param polys the input for choosing split candidates
680                @param axis the current split axis
681                @param splitCandidates returns sorted list of split candidates
682        */
683        void SortSplitCandidates(const PolygonContainer &polys,
684                                                         const int axis,
685                                                         vector<SortableEntry> &splitCandidates) const;
686
687        /** Selects an axis aligned split plane.
688                Returns true if split is valied
689        */
690        bool SelectAxisAlignedPlane(Plane3 &plane, const PolygonContainer &polys) const;
691
692        /** Bounds ray and returns minT and maxT.
693                @returns true if ray hits BSP tree bounding box
694        */
695        bool BoundRay(const Ray &ray, float &minT, float &maxT) const;
696
697        /** Subdivides the rays into front and back rays according to the split plane.
698               
699                @param plane the split plane
700                @param rays contains the rays to be split. The rays are
701                           distributed into front and back rays.
702                @param frontRays returns rays on the front side of the plane
703                @param backRays returns rays on the back side of the plane
704               
705                @returns the number of splits
706        */
707        int SplitRays(const Plane3 &plane,
708                                  BoundedRayContainer &rays,
709                              BoundedRayContainer &frontRays,
710                                  BoundedRayContainer &backRays);
711
712
713        /** Extracts the split planes representing the space bounded by node n.
714        */
715        void ExtractSplitPlanes(BspNode *n, vector<Plane3 *> &planes, vector<bool> &sides) const;
716
717        /** Computes the pvs of the front and back leaf with a given classification.
718        */
719        void ComputePvs(Intersectable &obj,
720                                        float &frontPvs,
721                                        float &backPvs,
722                                        const int cf,
723                                        const int frontId,
724                                        const int backId,
725                                        const int frontAndBackId) const;
726       
727        /// Pointer to the root of the tree
728        BspNode *mRoot;
729               
730        BspTreeStatistics mStat;
731
732        /// Strategies for choosing next split plane.
733        enum {NO_STRATEGY = 0,
734                  RANDOM_POLYGON = 1,
735                  AXIS_ALIGNED = 2,
736                  LEAST_SPLITS = 4,
737                  BALANCED_POLYS = 8,
738                  BALANCED_VIEW_CELLS = 16,
739                  LARGEST_POLY_AREA = 32,
740                  VERTICAL_AXIS = 64,
741                  BLOCKED_RAYS = 128,
742                  LEAST_RAY_SPLITS = 256,
743                  BALANCED_RAYS = 512,
744                  PVS = 1024
745                };
746
747        /// box around the whole view domain
748        AxisAlignedBox3 mBox;
749
750        /// view cell corresponding to unbounded space
751        ViewCell *mRootCell;
752
753        /// should view cells be stored or generated in the leaves?
754        bool mGenerateViewCells;
755
756        /// if rays should be stored that are piercing this view cell
757        bool mStorePiercingRays;
758
759public:
760        /// Parses the environment and stores the global BSP tree parameters
761        static void ParseEnvironment();
762
763        /// maximal number of polygons before subdivision termination
764        static int sTermMaxPolygons;
765        /// maximal number of rays before subdivision termination
766        static int sTermMaxRays;
767        /// maximal possible depth
768        static int sTermMaxDepth;
769        /// strategy to get the best split plane
770        static int sSplitPlaneStrategy;
771        /// number of candidates evaluated for the next split plane
772        static int sMaxPolyCandidates;
773        static int sMaxRayCandidates;
774        /// BSP tree construction method
775        static int sConstructionMethod;
776        /// maximal number of polygons for axis aligned split
777        static int sTermMaxPolysForAxisAligned;
778        /// maximal number of rays for axis aligned split
779        static int sTermMaxRaysForAxisAligned;
780        /// maximal number of objects for axis aligned split
781        static int sTermMaxObjectsForAxisAligned;
782
783        /// axis aligned split criteria
784        static float sCt_div_ci;
785        static float sSplitBorder;
786        static float sMaxCostRatio;
787
788        // factors guiding the split plane heuristics
789        static float sLeastSplitsFactor;
790        static float sBalancedPolysFactor;
791        static float sBalancedViewCellsFactor;
792        static float sVerticalSplitsFactor;
793        static float sLargestPolyAreaFactor;
794        static float sBlockedRaysFactor;
795        static float sLeastRaySplitsFactor;
796        static float sBalancedRaysFactor;
797        static float sPvsFactor;
798
799        /// if polygons should be stored in the tree
800        static bool sStoreSplitPolys;
801
802        //-- thresholds used for view cells are merging
803        static int sMinPvsDif;
804        static int sMinPvs;
805        static int sMaxPvs;
806
807private:
808        /** Evaluates split plane classification with respect to the plane's
809                contribution for a balanced tree.
810        */
811        static float sLeastPolySplitsTable[4];
812        /** Evaluates split plane classification with respect to the plane's
813                contribution for a minimum number splits in the tree.
814        */
815        static float sBalancedPolysTable[4];
816        /** Evaluates split plane classification with respect to the plane's
817                contribution for a minimum number of ray splits.
818        */
819        static float sLeastRaySplitsTable[5];
820        /** Evaluates split plane classification with respect to the plane's
821                contribution for balanced rays.
822        */
823        static float sBalancedRaysTable[5];
824
825};
826
827#endif
Note: See TracBrowser for help on using the repository browser.