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

Revision 397, 22.4 KB checked in by mattausch, 19 years ago (diff)

worked on bsp view cells, fixed some bugs

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