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

Revision 411, 22.3 KB checked in by mattausch, 19 years ago (diff)

worked on view space partition kd tree

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        ~BspInterior();
247        /** @return false since it is an interior node
248        */
249        bool IsLeaf() const;
250
251        BspNode *GetBack();
252        BspNode *GetFront();
253
254        Plane3 *GetPlane();
255
256        void ReplaceChildLink(BspNode *oldChild, BspNode *newChild);
257        void SetupChildLinks(BspNode *b, BspNode *f);
258
259        /** Splits polygons with respect to the split plane.
260                @param polys the polygons to be split. the polygons are consumed and
261                           distributed to the containers frontPolys, backPolys, coincident.
262                @param frontPolys returns the polygons in the front of the split plane
263                @param backPolys returns the polygons in the back of the split plane
264                @param coincident returns the polygons coincident to the split plane
265
266                @returns the number of splits   
267        */
268        int SplitPolygons(PolygonContainer &polys,
269                                          PolygonContainer &frontPolys,
270                                          PolygonContainer &backPolys,
271                                          PolygonContainer &coincident);
272
273        friend ostream &operator<<(ostream &s, const BspInterior &A)
274        {
275                return s << A.mPlane;
276        }
277
278protected:
279
280        /// Splitting plane corresponding to this node
281        Plane3 mPlane;
282        /// back node
283        BspNode *mBack;
284        /// front node
285        BspNode *mFront;
286};
287
288/** BSP leaf node implementation.
289*/
290class BspLeaf : public BspNode
291{
292        friend class BspTree;
293
294public:
295        BspLeaf();
296        BspLeaf(BspViewCell *viewCell);
297        BspLeaf(BspInterior *parent);
298        BspLeaf(BspInterior *parent, BspViewCell *viewCell);
299
300        /** @return true since it is an interior node
301        */
302        bool IsLeaf() const;
303       
304        /** Returns pointer of view cell.
305        */
306        BspViewCell *GetViewCell() const;
307
308        /** Sets pointer to view cell.
309        */
310        void SetViewCell(BspViewCell *viewCell);
311
312        /** Adds rays to the PVS.
313                @param sampleContributions the number contributions of the sampels
314                @param contributingSampels the number of contributing rays
315               
316        */
317        void AddToPvs(const BoundedRayContainer &rays, int &sampleContributions,
318                                  int &contributingSamples);
319
320protected:
321
322        /// if NULL this does not correspond to feasible viewcell
323        BspViewCell *mViewCell;
324};
325
326/** Implementation of the view cell BSP tree.
327*/
328class BspTree
329{
330public:
331       
332        /** Additional data which is passed down the BSP tree during traversal.
333        */
334        struct BspTraversalData
335        { 
336                /// the current node
337                BspNode *mNode;
338                /// polygonal data for splitting
339                PolygonContainer *mPolygons;
340                /// current depth
341                int mDepth;
342                /// the view cell associated with this subdivsion
343                ViewCell *mViewCell;
344                /// rays piercing this node
345                BoundedRayContainer *mRays;
346                /// area of current node
347                float mArea;
348                BspNodeGeometry *mGeometry;
349
350                /// pvs size
351                int mPvs;
352               
353                BspTraversalData():
354                mNode(NULL),
355                mPolygons(NULL),
356                mDepth(0),
357                mViewCell(NULL),
358                mRays(NULL),
359                mPvs(0),
360                mArea(0.0),
361                mGeometry(NULL)
362                {}
363               
364                BspTraversalData(BspNode *node,
365                                                 PolygonContainer *polys,
366                                                 const int depth,
367                                                 ViewCell *viewCell,
368                                                 BoundedRayContainer *rays,
369                                                 int pvs,
370                                                 float area,
371                                                 BspNodeGeometry *cell):
372                mNode(node),
373                mPolygons(polys),
374                mDepth(depth),
375                mViewCell(viewCell),
376                mRays(rays),
377                mPvs(pvs),
378                mArea(area),
379                mGeometry(cell)
380                {}
381    };
382       
383        typedef std::stack<BspTraversalData> BspTraversalStack;
384
385        /** Default constructor creating an empty tree.
386                @param viewCell view cell corresponding to unbounded space
387        */
388        BspTree(BspViewCell *viewCell);
389
390        ~BspTree();
391
392        const BspTreeStatistics &GetStatistics() const;
393 
394        /** Constructs tree using the given list of view cells.
395            For this type of construction we filter all view cells down the
396                tree. If there is no polygon left, the last split plane
397            decides inside or outside of the viewcell. A pointer to the
398                appropriate view cell is stored within each leaf.
399                Many leafs can point to the same viewcell.
400        */
401        void Construct(const ViewCellContainer &viewCells);
402
403        /** Constructs tree using the given list of objects.
404            @note the objects are not taken as view cells, but the view cells are
405                constructed from the subdivision: Each leaf is taken as one viewcell.
406                @param objects list of objects
407        */
408        void Construct(const ObjectContainer &objects);
409
410        /** Constructs the tree from a given set of rays.
411                @param sampleRays the set of sample rays the construction is based on
412                @param viewCells if not NULL, new view cells are
413                created in the leafs and stored in the conatainer
414        */
415        void Construct(const RayContainer &sampleRays);
416
417        /** Returns list of BSP leaves.
418        */
419        void CollectLeaves(vector<BspLeaf *> &leaves) const;
420
421        /** Returns box which bounds the whole tree.
422        */
423        AxisAlignedBox3 GetBoundingBox()const;
424
425        /** Returns root of BSP tree.
426        */
427        BspNode *GetRoot() const;
428
429        /** Exports Bsp tree to file.
430        */
431        bool Export(const string filename);
432
433        /** Collects the leaf view cells of the tree
434                @param viewCells returns the view cells
435        */
436        void CollectViewCells(ViewCellContainer &viewCells) const;
437
438        /** A ray is cast possible intersecting the tree.
439                @param the ray that is cast.
440                @returns the number of intersections with objects stored in the tree.
441        */
442        int CastRay(Ray &ray);
443
444        /** Set to true if new view cells shall be generated in each leaf.
445        */
446        void SetGenerateViewCells(int generateViewCells);
447
448        /// bsp tree construction types
449        enum {FROM_INPUT_VIEW_CELLS, FROM_SCENE_GEOMETRY, FROM_RAYS};
450
451        /** Returns statistics.
452        */
453        BspTreeStatistics &GetStat();
454
455        /** finds neighbouring leaves of this tree node.
456        */
457        int FindNeighbors(BspNode *n, vector<BspLeaf *> &neighbors,
458                                          const bool onlyUnmailed) const;
459
460        /** Constructs geometry associated with the half space intersections
461                leading to this node.
462        */
463        void ConstructGeometry(BspNode *n, PolygonContainer &cell) const;
464       
465        /** Construct geometry of view cell.
466        */
467        void ConstructGeometry(BspViewCell *vc, PolygonContainer &cell) const;
468
469        void ConstructGeometry(BspNode *n, BspNodeGeometry &cell) const;
470
471        /** Returns random leaf of BSP tree.
472                @param halfspace defines the halfspace from which the leaf is taken.
473        */
474        BspLeaf *GetRandomLeaf(const Plane3 &halfspace);
475
476        /** Returns random leaf of BSP tree.
477                @param onlyUnmailed if only unmailed leaves should be returned.
478        */
479        BspLeaf *GetRandomLeaf(const bool onlyUnmailed = false);
480
481        /** Returns true if merge criteria are reached.
482        */
483    bool ShouldMerge(BspLeaf *front, BspLeaf *back) const;
484
485        /** Merges view cells based on some criteria
486            E.g., empty view cells can pe purged, view cells which have
487                a very similar PVS can be merged to one larger view cell.
488
489                @returns true if merge was successful.
490        */
491        bool MergeViewCells(BspLeaf *front, BspLeaf *back) const;
492
493        /** Traverses tree and counts all view cells as well as their PVS size.
494        */
495        void EvaluateViewCellsStats(BspViewCellsStatistics &stat) const;
496
497protected:
498
499        // --------------------------------------------------------------
500        // For sorting objects
501        // --------------------------------------------------------------
502        struct SortableEntry
503        {
504                enum {POLY_MIN, POLY_MAX};
505   
506                int type;
507                float value;
508                Polygon3 *poly;
509                SortableEntry() {}
510                SortableEntry(const int t, const float v, Polygon3 *poly):
511                type(t), value(v), poly(poly) {}
512               
513                bool operator<(const SortableEntry &b) const
514                {
515                        return value < b.value;
516                } 
517        };
518
519        /** Evaluates tree stats in the BSP tree leafs.
520        */
521        void EvaluateLeafStats(const BspTraversalData &data);
522
523        /** Subdivides node with respect to the traversal data.
524            @param tStack current traversal stack
525                @param tData traversal data also holding node to be subdivided
526                @returns new root of the subtree
527        */
528        BspNode *Subdivide(BspTraversalStack &tStack, BspTraversalData &tData);
529
530        /** Constructs the tree from the given list of polygons and rays.
531                @param polys stores set of polygons on which subdivision may be based
532                @param rays storesset of rays on which subdivision may be based
533        */
534        void Construct(PolygonContainer *polys, BoundedRayContainer *rays);
535
536        /** Selects the best possible splitting plane.
537                @param leaf the leaf to be split
538                @param polys the polygon list on which the split decition is based
539                @param rays ray container on which selection may be based
540                @note the polygons can be reordered in the process
541                @returns the split plane
542        */
543        Plane3 SelectPlane(BspLeaf *leaf,
544                                           BspTraversalData &data);
545
546        /** Evaluates the contribution of the candidate split plane.
547               
548                @param candidatePlane the candidate split plane
549                @param polys the polygons the split can be based on
550                @param rays the rays the split can be based on
551
552                @returns the cost of the candidate split plane
553        */
554        float SplitPlaneCost(const Plane3 &candidatePlane,
555                                                 BspTraversalData &data) const;
556
557        /** Strategies where the effect of the split plane is tested
558            on all input rays.
559                @returns the cost of the candidate split plane
560        */
561        float SplitPlaneCost(const Plane3 &candidatePlane,
562                                                 const PolygonContainer &polys) const;
563
564        /** Strategies where the effect of the split plane is tested
565            on all input rays.
566
567                @returns the cost of the candidate split plane
568        */
569        float SplitPlaneCost(const Plane3 &candidatePlane,
570                                                 const BoundedRayContainer &rays,
571                                                 const int pvs,
572                                                 const float area,
573                                                 const BspNodeGeometry &cell) const;
574
575        /** Filters next view cell down the tree and inserts it into the appropriate leaves
576                (i.e., possibly more than one leaf).
577        */
578        void InsertViewCell(ViewCell *viewCell);
579        /** Inserts polygons down the tree. The polygons are filtered until a leaf is reached,
580                then further subdivided.
581        */
582        void InsertPolygons(PolygonContainer *polys);
583
584        /** Subdivide leaf.
585                @param leaf the leaf to be subdivided
586               
587                @param polys the polygons to be split
588                @param frontPolys returns the polygons in front of the split plane
589                @param backPolys returns the polygons in the back of the split plane
590               
591                @param rays the polygons to be filtered
592                @param frontRays returns the polygons in front of the split plane
593                @param backRays returns the polygons in the back of the split plane
594
595                @returns the root of the subdivision
596        */
597
598        BspInterior *SubdivideNode(BspTraversalData &tData,
599                                                           BspTraversalData &frontData,
600                                                           BspTraversalData &backData,
601                                                           PolygonContainer &coincident);
602
603        /** Filters polygons down the tree.
604                @param node the current BSP node
605                @param polys the polygons to be filtered
606                @param frontPolys returns the polygons in front of the split plane
607                @param backPolys returns the polygons in the back of the split plane
608        */
609        void FilterPolygons(BspInterior *node,
610                                                PolygonContainer *polys,
611                                                PolygonContainer *frontPolys,
612                                                PolygonContainer *backPolys);
613
614        /** Selects the split plane in order to construct a tree with
615                certain characteristics (e.g., balanced tree, least splits,
616                2.5d aligned)
617                @param polygons container of polygons
618                @param rays bundle of rays on which the split can be based
619        */
620        Plane3 SelectPlaneHeuristics(BspLeaf *leaf,
621                                                                 BspTraversalData &data);
622
623        /** Extracts the meshes of the objects and adds them to polygons.
624                Adds object aabb to the aabb of the tree.
625                @param maxPolys the maximal number of objects to be stored as polygons
626                @returns the number of polygons
627        */
628        int AddToPolygonSoup(const ObjectContainer &objects,
629                                                 PolygonContainer &polys,
630                                                 int maxObjects = 0);
631
632        /** Extracts the meshes of the view cells and and adds them to polygons.
633                Adds view cell aabb to the aabb of the tree.
634                @param maxPolys the maximal number of objects to be stored as polygons
635                @returns the number of polygons
636        */
637        int AddToPolygonSoup(const ViewCellContainer &viewCells,
638                                                 PolygonContainer &polys,
639                                                 int maxObjects = 0);
640
641        /** Extract polygons of this mesh and add to polygon container.
642                @param mesh the mesh that drives the polygon construction
643                @param parent the parent intersectable this polygon is constructed from
644                @returns number of polygons
645        */
646        int AddMeshToPolygons(Mesh *mesh, PolygonContainer &polys, MeshInstance *parent);
647
648        /** returns next candidate index and reorders polygons so no candidate is chosen two times
649                @param the current candidate index
650                @param max the range of candidates
651        */
652        int GetNextCandidateIdx(int currentIdx, PolygonContainer &polys);
653
654        /** Helper function which extracts a view cell on the front and the back
655                of the split plane.
656                @param backViewCell returns view cell on the back of the split plane
657                @param frontViewCell returns a view cell on the front of the split plane
658                @param coincident container of polygons coincident to the split plane
659                @param splitPlane the split plane which decides about back and front
660                @param extractBack if a back view cell is extracted
661                @param extractFront if a front view cell is extracted
662        */
663        void ExtractViewCells(BspTraversalData &frontData,
664                                                  BspTraversalData &backData,
665                                                  const PolygonContainer &coincident,
666                                                  const Plane3 splitPlane) const;
667       
668        /** Computes best cost ratio for the suface area heuristics for axis aligned
669                splits. This heuristics minimizes the cost for ray traversal.
670                @param polys the polygons guiding the ratio computation
671                @param box the bounding box of the leaf
672                @param axis the current split axis
673                @param position returns the split position
674                @param objectsBack the number of objects in the back of the split plane
675                @param objectsFront the number of objects in the front of the split plane
676        */
677        float BestCostRatio(const PolygonContainer &polys,
678                                                const AxisAlignedBox3 &box,
679                                                const int axis,
680                                                float &position,
681                                                int &objectsBack,
682                                                int &objectsFront) const;
683       
684        /** Sorts split candidates for surface area heuristics for axis aligned splits.
685                @param polys the input for choosing split candidates
686                @param axis the current split axis
687                @param splitCandidates returns sorted list of split candidates
688        */
689        void SortSplitCandidates(const PolygonContainer &polys,
690                                                         const int axis,
691                                                         vector<SortableEntry> &splitCandidates) const;
692
693        /** Selects an axis aligned split plane.
694                Returns true if split is valied
695        */
696        bool SelectAxisAlignedPlane(Plane3 &plane, const PolygonContainer &polys) const;
697
698        /** Bounds ray and returns minT and maxT.
699                @returns true if ray hits BSP tree bounding box
700        */
701        bool BoundRay(const Ray &ray, float &minT, float &maxT) const;
702
703        /** Subdivides the rays into front and back rays according to the split plane.
704               
705                @param plane the split plane
706                @param rays contains the rays to be split. The rays are
707                           distributed into front and back rays.
708                @param frontRays returns rays on the front side of the plane
709                @param backRays returns rays on the back side of the plane
710               
711                @returns the number of splits
712        */
713        int SplitRays(const Plane3 &plane,
714                                  BoundedRayContainer &rays,
715                              BoundedRayContainer &frontRays,
716                                  BoundedRayContainer &backRays);
717
718
719        /** Extracts the split planes representing the space bounded by node n.
720        */
721        void ExtractHalfSpaces(BspNode *n, vector<Plane3> &halfSpaces) const;
722
723        /** Computes the pvs of the front and back leaf with a given classification.
724        */
725        void IncPvs(Intersectable &obj,
726                                  int &frontPvs,
727                                  int &backPvs,
728                                  const int cf,
729                                  const int frontId,
730                                  const int backId,
731                                  const int frontAndBackId) const;
732       
733        int ComputePvsSize(const BoundedRayContainer &rays) const;
734
735        bool TerminationCriteriaMet(const BspTraversalData &data) const;
736
737        float AccumulatedRayLength(BoundedRayContainer &rays) const;
738
739        /// Pointer to the root of the tree
740        BspNode *mRoot;
741               
742        BspTreeStatistics mStat;
743
744        /// Strategies for choosing next split plane.
745        enum {NO_STRATEGY = 0,
746                  RANDOM_POLYGON = 1,
747                  AXIS_ALIGNED = 2,
748                  LEAST_SPLITS = 4,
749                  BALANCED_POLYS = 8,
750                  BALANCED_VIEW_CELLS = 16,
751                  LARGEST_POLY_AREA = 32,
752                  VERTICAL_AXIS = 64,
753                  BLOCKED_RAYS = 128,
754                  LEAST_RAY_SPLITS = 256,
755                  BALANCED_RAYS = 512,
756                  PVS = 1024
757                };
758
759        /// box around the whole view domain
760        AxisAlignedBox3 mBox;
761
762        /// view cell corresponding to unbounded space
763        BspViewCell *mRootCell;
764
765        /// should view cells be stored or generated in the leaves?
766        bool mGenerateViewCells;
767
768        /// if rays should be stored that are piercing this view cell
769        bool mStorePiercingRays;
770
771public:
772        /// Parses the environment and stores the global BSP tree parameters
773        static void ParseEnvironment();
774
775        /// maximal number of polygons before subdivision termination
776        static int sTermMaxPolygons;
777        /// maximal number of rays before subdivision termination
778        static int sTermMaxRays;
779        /// maximal possible depth
780        static int sTermMaxDepth;
781        /// mininum area
782        static float sTermMinArea;
783        /// mininum PVS
784        static int sTermMinPvs;
785        /// strategy to get the best split plane
786        static int sSplitPlaneStrategy;
787        /// number of candidates evaluated for the next split plane
788        static int sMaxPolyCandidates;
789        static int sMaxRayCandidates;
790        /// BSP tree construction method
791        static int sConstructionMethod;
792        /// maximal number of polygons for axis aligned split
793        static int sTermMaxPolysForAxisAligned;
794        /// maximal number of rays for axis aligned split
795        static int sTermMaxRaysForAxisAligned;
796        /// maximal number of objects for axis aligned split
797        static int sTermMaxObjectsForAxisAligned;
798
799        static float sTermMaxRayContribution;
800        static float sTermMaxAccRayLength;
801
802        static bool sStoreLeavesWithRays;
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        static bool sPvsUseArea;
825
826private:
827        /** Evaluates split plane classification with respect to the plane's
828                contribution for a balanced tree.
829        */
830        static float sLeastPolySplitsTable[4];
831        /** Evaluates split plane classification with respect to the plane's
832                contribution for a minimum number splits in the tree.
833        */
834        static float sBalancedPolysTable[4];
835        /** Evaluates split plane classification with respect to the plane's
836                contribution for a minimum number of ray splits.
837        */
838        static float sLeastRaySplitsTable[5];
839        /** Evaluates split plane classification with respect to the plane's
840                contribution for balanced rays.
841        */
842        static float sBalancedRaysTable[5];
843
844};
845
846#endif
Note: See TracBrowser for help on using the repository browser.