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

Revision 420, 22.2 KB checked in by mattausch, 19 years ago (diff)
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#include "Statistics.h"
9
10class ViewCell;
11class BspViewCell;
12class Plane3;
13class BspTree; 
14class BspInterior;
15//class Polygon3;
16class AxisAlignedBox3;
17class Ray;
18
19class BspNodeGeometry
20{
21public:
22        BspNodeGeometry()
23        {}; 
24
25        ~BspNodeGeometry();
26
27        float GetArea() const;
28       
29        /** Computes new cell based on the old cell definition and a new split plane
30                @param side indicates which side of the halfspace
31        */
32        void SplitGeometry(BspNodeGeometry &front,
33                                           BspNodeGeometry &back,
34                                           const BspTree &tree,
35                                           const Plane3 &splitPlane) const;
36
37        Polygon3 *SplitPolygon(Polygon3 *poly, const BspTree &tree) const;
38
39        PolygonContainer mPolys;
40};
41
42/** Data structure used for optimized ray casting.
43*/
44struct BspRayTraversalData
45{
46    BspNode *mNode;
47    Vector3 mExitPoint;
48    float mMaxT;
49   
50    BspRayTraversalData() {}
51
52    BspRayTraversalData(BspNode *n, const Vector3 &extp, const float maxt):
53    mNode(n), mExitPoint(extp), mMaxT(maxt)
54        {}
55};
56
57/** Data used for passing ray data down the tree.
58*/
59struct BoundedRay
60{
61        Ray *mRay;
62        float mMinT;
63        float mMaxT;
64               
65        BoundedRay(): mMinT(0), mMaxT(1e6), mRay(NULL)
66        {}
67        BoundedRay(Ray *r, float minT, float maxT):
68        mRay(r), mMinT(minT), mMaxT(maxT)
69        {}
70};
71
72typedef vector<BoundedRay *> BoundedRayContainer;
73
74class BspTreeStatistics: public StatisticsBase
75{
76public:
77        // total number of nodes
78        int nodes;
79        // number of splits
80        int splits;
81        // totals number of rays
82        int rays;
83        // maximal reached depth
84        int maxDepth;
85        // minimal depth
86        int minDepth;
87        // max depth nodes
88        int maxDepthNodes;
89        // max number of rays per node
90        int maxObjectRefs;
91        // accumulated depth (used to compute average)
92        int accumDepth;
93        // number of initial polygons
94        int polys;
95        /// samples contributing to pvs
96        int contributingSamples;
97        /// sample contributions to pvs
98        int sampleContributions;
99        /// largest pvs
100        int largestPvs;
101
102        // Constructor
103        BspTreeStatistics()
104        {
105                Reset();
106        }
107
108        int Nodes() const {return nodes;}
109        int Interior() const { return nodes / 2; }
110        int Leaves() const { return (nodes / 2) + 1; }
111       
112        // TODO: computation wrong
113        double AvgDepth() const { return accumDepth / (double)Leaves();};
114 
115        void Reset()
116        {
117                nodes = 0;
118                splits = 0;
119                maxDepthNodes = 0;
120                maxDepth = 0;
121                minDepth = 99999;
122                polys = 0;
123                accumDepth = 0;
124       
125                contributingSamples = 0;
126                sampleContributions = 0;
127        }
128
129        void Print(ostream &app) const;
130
131        friend ostream &operator<<(ostream &s, const BspTreeStatistics &stat)
132        {
133                stat.Print(s);
134                return s;
135        }
136};
137
138class BspViewCellsStatistics: public StatisticsBase
139{
140public:
141
142        /// number of view cells
143        int viewCells;
144
145        /// size of the PVS
146        int pvs;
147 
148        /// largest PVS of all view cells
149        int maxPvs;
150
151        /// smallest PVS of all view cells
152        int minPvs;
153
154        /// view cells with empty PVS
155        int emptyPvs;
156
157        /// number of bsp leaves covering the view space
158        int bspLeaves;
159
160        /// largest number of leaves covered by one view cell 
161        int maxBspLeaves;
162
163    // Constructor
164        BspViewCellsStatistics()
165        {
166                Reset();
167        }
168
169        double AvgBspLeaves() const {return (double)bspLeaves / (double)viewCells;};
170        double AvgPvs() const {return (double)pvs / (double)viewCells;};
171 
172        void Reset()
173        {
174                viewCells = 0; 
175                pvs = 0; 
176                maxPvs = 0;
177
178                minPvs = 999999;
179                emptyPvs = 0;
180                bspLeaves = 0;
181                maxBspLeaves = 0;
182        }
183
184        void Print(ostream &app) const;
185
186        friend ostream &operator<<(ostream &s, const BspViewCellsStatistics &stat)
187        {
188                stat.Print(s);
189                return s;
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, bool storeLeavesWithRays = false);
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
497        /// BSP tree construction method
498        int mConstructionMethod;
499
500protected:
501
502        // --------------------------------------------------------------
503        // For sorting objects
504        // --------------------------------------------------------------
505        struct SortableEntry
506        {
507                enum {POLY_MIN, POLY_MAX};
508   
509                int type;
510                float value;
511                Polygon3 *poly;
512                SortableEntry() {}
513                SortableEntry(const int t, const float v, Polygon3 *poly):
514                type(t), value(v), poly(poly) {}
515               
516                bool operator<(const SortableEntry &b) const
517                {
518                        return value < b.value;
519                } 
520        };
521
522        /** Evaluates tree stats in the BSP tree leafs.
523        */
524        void EvaluateLeafStats(const BspTraversalData &data);
525
526        /** Subdivides node with respect to the traversal data.
527            @param tStack current traversal stack
528                @param tData traversal data also holding node to be subdivided
529                @returns new root of the subtree
530        */
531        BspNode *Subdivide(BspTraversalStack &tStack, BspTraversalData &tData);
532
533        /** Constructs the tree from the given list of polygons and rays.
534                @param polys stores set of polygons on which subdivision may be based
535                @param rays storesset of rays on which subdivision may be based
536        */
537        void Construct(PolygonContainer *polys, BoundedRayContainer *rays);
538
539        /** Selects the best possible splitting plane.
540                @param leaf the leaf to be split
541                @param polys the polygon list on which the split decition is based
542                @param rays ray container on which selection may be based
543                @note the polygons can be reordered in the process
544                @returns the split plane
545        */
546        Plane3 SelectPlane(BspLeaf *leaf,
547                                           BspTraversalData &data);
548
549        /** Evaluates the contribution of the candidate split plane.
550               
551                @param candidatePlane the candidate split plane
552                @param polys the polygons the split can be based on
553                @param rays the rays the split can be based on
554
555                @returns the cost of the candidate split plane
556        */
557        float SplitPlaneCost(const Plane3 &candidatePlane,
558                                                 BspTraversalData &data) 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) const;
577
578        /** Filters next view cell down the tree and inserts it into the appropriate leaves
579                (i.e., possibly more than one leaf).
580        */
581        void InsertViewCell(ViewCell *viewCell);
582        /** Inserts polygons down the tree. The polygons are filtered until a leaf is reached,
583                then further subdivided.
584        */
585        void InsertPolygons(PolygonContainer *polys);
586
587        /** Subdivide leaf.
588                @param leaf the leaf to be subdivided
589               
590                @param polys the polygons to be split
591                @param frontPolys returns the polygons in front of the split plane
592                @param backPolys returns the polygons in the back of the split plane
593               
594                @param rays the polygons to be filtered
595                @param frontRays returns the polygons in front of the split plane
596                @param backRays returns the polygons in the back of the split plane
597
598                @returns the root of the subdivision
599        */
600
601        BspInterior *SubdivideNode(BspTraversalData &tData,
602                                                           BspTraversalData &frontData,
603                                                           BspTraversalData &backData,
604                                                           PolygonContainer &coincident);
605
606        /** Filters polygons down the tree.
607                @param node the current BSP node
608                @param polys the polygons to be filtered
609                @param frontPolys returns the polygons in front of the split plane
610                @param backPolys returns the polygons in the back of the split plane
611        */
612        void FilterPolygons(BspInterior *node,
613                                                PolygonContainer *polys,
614                                                PolygonContainer *frontPolys,
615                                                PolygonContainer *backPolys);
616
617        /** Selects the split plane in order to construct a tree with
618                certain characteristics (e.g., balanced tree, least splits,
619                2.5d aligned)
620                @param polygons container of polygons
621                @param rays bundle of rays on which the split can be based
622        */
623        Plane3 SelectPlaneHeuristics(BspLeaf *leaf,
624                                                                 BspTraversalData &data);
625
626        /** Extracts the meshes of the objects and adds them to polygons.
627                Adds object aabb to the aabb of the tree.
628                @param maxPolys the maximal number of objects to be stored as polygons
629                @returns the number of polygons
630        */
631        int AddToPolygonSoup(const ObjectContainer &objects,
632                                                 PolygonContainer &polys,
633                                                 int maxObjects = 0);
634
635        /** Extracts the meshes of the view cells and and adds them to polygons.
636                Adds view cell aabb to the aabb of the tree.
637                @param maxPolys the maximal number of objects to be stored as polygons
638                @returns the number of polygons
639        */
640        int AddToPolygonSoup(const ViewCellContainer &viewCells,
641                                                 PolygonContainer &polys,
642                                                 int maxObjects = 0);
643
644        /** Extract polygons of this mesh and add to polygon container.
645                @param mesh the mesh that drives the polygon construction
646                @param parent the parent intersectable this polygon is constructed from
647                @returns number of polygons
648        */
649        int AddMeshToPolygons(Mesh *mesh, PolygonContainer &polys, MeshInstance *parent);
650
651        /** returns next candidate index and reorders polygons so no candidate is chosen two times
652                @param the current candidate index
653                @param max the range of candidates
654        */
655        int GetNextCandidateIdx(int currentIdx, PolygonContainer &polys);
656
657        /** Helper function which extracts a view cell on the front and the back
658                of the split plane.
659                @param backViewCell returns view cell on the back of the split plane
660                @param frontViewCell returns a view cell on the front of the split plane
661                @param coincident container of polygons coincident to the split plane
662                @param splitPlane the split plane which decides about back and front
663                @param extractBack if a back view cell is extracted
664                @param extractFront if a front view cell is extracted
665        */
666        void ExtractViewCells(BspTraversalData &frontData,
667                                                  BspTraversalData &backData,
668                                                  const PolygonContainer &coincident,
669                                                  const Plane3 splitPlane) const;
670       
671        /** Computes best cost ratio for the suface area heuristics for axis aligned
672                splits. This heuristics minimizes the cost for ray traversal.
673                @param polys the polygons guiding the ratio computation
674                @param box the bounding box of the leaf
675                @param axis the current split axis
676                @param position returns the split position
677                @param objectsBack the number of objects in the back of the split plane
678                @param objectsFront the number of objects in the front of the split plane
679        */
680        float BestCostRatio(const PolygonContainer &polys,
681                                                const AxisAlignedBox3 &box,
682                                                const int axis,
683                                                float &position,
684                                                int &objectsBack,
685                                                int &objectsFront) const;
686       
687        /** Sorts split candidates for surface area heuristics for axis aligned splits.
688                @param polys the input for choosing split candidates
689                @param axis the current split axis
690                @param splitCandidates returns sorted list of split candidates
691        */
692        void SortSplitCandidates(const PolygonContainer &polys,
693                                                         const int axis,
694                                                         vector<SortableEntry> &splitCandidates) const;
695
696        /** Selects an axis aligned split plane.
697                Returns true if split is valied
698        */
699        bool SelectAxisAlignedPlane(Plane3 &plane, const PolygonContainer &polys) const;
700
701        /** Bounds ray and returns minT and maxT.
702                @returns true if ray hits BSP tree bounding box
703        */
704        bool BoundRay(const Ray &ray, float &minT, float &maxT) const;
705
706        /** Subdivides the rays into front and back rays according to the split plane.
707               
708                @param plane the split plane
709                @param rays contains the rays to be split. The rays are
710                           distributed into front and back rays.
711                @param frontRays returns rays on the front side of the plane
712                @param backRays returns rays on the back side of the plane
713               
714                @returns the number of splits
715        */
716        int SplitRays(const Plane3 &plane,
717                                  BoundedRayContainer &rays,
718                              BoundedRayContainer &frontRays,
719                                  BoundedRayContainer &backRays);
720
721
722        /** Extracts the split planes representing the space bounded by node n.
723        */
724        void ExtractHalfSpaces(BspNode *n, vector<Plane3> &halfSpaces) const;
725
726        /** Computes the pvs of the front and back leaf with a given classification.
727        */
728        void IncPvs(Intersectable &obj,
729                                  int &frontPvs,
730                                  int &backPvs,
731                                  const int cf,
732                                  const int frontId,
733                                  const int backId,
734                                  const int frontAndBackId) const;
735       
736        int ComputePvsSize(const BoundedRayContainer &rays) const;
737
738        inline bool TerminationCriteriaMet(const BspTraversalData &data) const;
739
740        float AccumulatedRayLength(BoundedRayContainer &rays) const;
741
742        /// Pointer to the root of the tree
743        BspNode *mRoot;
744               
745        BspTreeStatistics mStat;
746
747        /// Strategies for choosing next split plane.
748        enum {NO_STRATEGY = 0,
749                  RANDOM_POLYGON = 1,
750                  AXIS_ALIGNED = 2,
751                  LEAST_SPLITS = 4,
752                  BALANCED_POLYS = 8,
753                  BALANCED_VIEW_CELLS = 16,
754                  LARGEST_POLY_AREA = 32,
755                  VERTICAL_AXIS = 64,
756                  BLOCKED_RAYS = 128,
757                  LEAST_RAY_SPLITS = 256,
758                  BALANCED_RAYS = 512,
759                  PVS = 1024
760                };
761
762        /// box around the whole view domain
763        AxisAlignedBox3 mBox;
764
765        /// view cell corresponding to unbounded space
766        BspViewCell *mRootCell;
767
768        /// should view cells be stored or generated in the leaves?
769        bool mGenerateViewCells;
770
771                /** Parses the environment and stores the global BSP tree parameters
772        */
773        void ParseEnvironment();
774
775        /// maximal number of polygons before subdivision termination
776        int mTermMaxPolygons;
777        /// maximal number of rays before subdivision termination
778        int mTermMaxRays;
779        /// maximal possible depth
780        int mTermMaxDepth;
781        /// mininum area
782        float mTermMinArea;
783        /// mininum PVS
784        int mTermMinPvs;
785        /// strategy to get the best split plane
786        int mSplitPlaneStrategy;
787        /// number of candidates evaluated for the next split plane
788        int mMaxPolyCandidates;
789        /// number of candidates for split planes evaluated using the rays
790        int mMaxRayCandidates;
791       
792        /// maximal number of polygons for axis aligned split
793        int mTermMaxPolysForAxisAligned;
794        /// maximal number of rays for axis aligned split
795        int mTermMaxRaysForAxisAligned;
796        /// maximal number of objects for axis aligned split
797        int mTermMaxObjectsForAxisAligned;
798        /// maximal contribution per ray
799        float mTermMaxRayContribution;
800        /// maximal accumulated ray length
801        float mTermMaxAccRayLength;
802
803        bool mStoreLeavesWithRays;
804
805        /// axis aligned split criteria
806        float mCt_div_ci;
807        float mSplitBorder;
808        float mMaxCostRatio;
809
810        // factors guiding the split plane heuristics
811        float sLeastSplitsFactor;
812        float sBalancedPolysFactor;
813        float sBalancedViewCellsFactor;
814        float sVerticalSplitsFactor;
815        float sLargestPolyAreaFactor;
816        float sBlockedRaysFactor;
817        float sLeastRaySplitsFactor;
818        float sBalancedRaysFactor;
819        float sPvsFactor;
820
821        //-- thresholds used for view cells merge
822        int mMinPvsDif;
823        int mMinPvs;
824        int mMaxPvs;
825        /// if area or accumulated ray lenght should be used for PVS heuristics
826        bool mPvsUseArea;
827
828private:
829        /** Evaluates split plane classification with respect to the plane's
830                contribution for a balanced tree.
831        */
832        static float sLeastPolySplitsTable[4];
833        /** Evaluates split plane classification with respect to the plane's
834                contribution for a minimum number splits in the tree.
835        */
836        static float sBalancedPolysTable[4];
837        /** Evaluates split plane classification with respect to the plane's
838                contribution for a minimum number of ray splits.
839        */
840        static float sLeastRaySplitsTable[5];
841        /** Evaluates split plane classification with respect to the plane's
842                contribution for balanced rays.
843        */
844        static float sBalancedRaysTable[5];
845
846};
847
848#endif
Note: See TracBrowser for help on using the repository browser.