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

Revision 463, 22.9 KB checked in by bittner, 19 years ago (diff)

removed mT from vss ray

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