source: GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h @ 1011

Revision 1011, 22.5 KB checked in by mattausch, 18 years ago (diff)
Line 
1#ifndef _VspOspTree_H__
2#define _VspOspTree_H__
3
4#include <stack>
5
6#include "Mesh.h"
7#include "Containers.h"
8#include "Statistics.h"
9#include "VssRay.h"
10#include "RayInfo.h"
11#include "gzstream.h"
12
13
14namespace GtpVisibilityPreprocessor {
15
16class ViewCellLeaf;
17//class VspViewCell;
18class Plane3;
19class AxisAlignedBox3;
20class Ray;
21class ViewCellsStatistics;
22class ViewCellsManager;
23class MergeCandidate;
24class Beam;
25class ViewCellsTree;
26class Environment;
27class VspInterior;
28class VspLeaf;
29class VspNode;
30
31
32/** A definition for an axis aligned plane.
33*/
34struct AxisAlignedPlane
35{
36public:
37
38        int ComputeRayIntersection(const RayInfo &rayData, float &t) const
39        {
40                return rayData.ComputeRayIntersection(mAxis, mPosition, t);
41        }
42
43        int mAxis;
44        float mPosition;
45};
46
47
48class VspTreeStatistics: public StatisticsBase
49{
50public:
51        // total number of nodes
52        int nodes;
53        // number of splits
54        int splits[3];
55       
56        // totals number of rays
57        int rays;
58        // maximal reached depth
59        int maxDepth;
60        // minimal depth
61        int minDepth;
62       
63        // max depth nodes
64        int maxDepthNodes;
65        // minimum depth nodes
66        int minDepthNodes;
67        // max depth nodes
68        int minPvsNodes;
69        // nodes with minimum PVS
70        int minRaysNodes;
71        // max ray contribution nodes
72        int maxRayContribNodes;
73        // minimum area nodes
74        int minProbabilityNodes;
75        /// nodes termination because of max cost ratio;
76        int maxCostNodes;
77        // max number of rays per node
78        int maxObjectRefs;
79        /// samples contributing to pvs
80        int contributingSamples;
81        /// sample contributions to pvs
82        int sampleContributions;
83        /// largest pvs
84        int maxPvs;
85        /// number of invalid leaves
86        int invalidLeaves;
87        /// accumulated number of rays refs
88        int accumRays;
89        int pvs;
90        // accumulated depth (used to compute average)
91        int accumDepth;
92
93        // Constructor
94        VspTreeStatistics()
95        {
96                Reset();
97        }
98
99        int Nodes() const {return nodes;}
100        int Interior() const { return nodes / 2; }
101        int Leaves() const { return (nodes / 2) + 1; }
102       
103        // TODO: computation wrong
104        double AvgDepth() const { return accumDepth / (double)Leaves();};
105        double AvgRays() const { return accumRays / (double)Leaves();};
106
107        void Reset()
108        {
109                nodes = 0;
110                for (int i = 0; i < 3; ++ i)
111                        splits[i] = 0;
112               
113                maxDepth = 0;
114                minDepth = 99999;
115                accumDepth = 0;
116        pvs = 0;
117                maxDepthNodes = 0;
118                minPvsNodes = 0;
119                minRaysNodes = 0;
120                maxRayContribNodes = 0;
121                minProbabilityNodes = 0;
122                maxCostNodes = 0;
123
124                contributingSamples = 0;
125                sampleContributions = 0;
126
127                maxPvs = 0;
128                invalidLeaves = 0;
129                accumRays = 0;
130        }
131
132        void Print(ostream &app) const;
133
134        friend ostream &operator<<(ostream &s, const VspTreeStatistics &stat)
135        {
136                stat.Print(s);
137                return s;
138        }
139};
140
141/**
142    VspNode abstract class serving for interior and leaf node implementation
143*/
144class VspNode
145{
146
147public:
148        VspNode();
149        virtual ~VspNode(){};
150        VspNode(VspInterior *parent);
151
152        /** Determines whether this node is a leaf or not
153        @return true if leaf
154        */
155        virtual bool IsLeaf() const = 0;
156
157        /** Determines whether this node is a root
158        @return true if root
159        */
160        virtual bool IsRoot() const;
161
162        /** Returns parent node.
163        */
164        VspInterior *GetParent();
165
166        /** Sets parent node.
167        */
168        void SetParent(VspInterior *parent);
169
170        /** Returns true if this node is a sibling of node n.
171        */
172        bool IsSibling(VspNode *n) const;
173
174        /** returns depth of the node.
175        */
176        int GetDepth() const;
177
178        /** returns true if the whole subtree is valid
179        */
180        bool TreeValid() const;
181
182        void SetTreeValid(const bool v);
183
184        //-- mailing options
185
186        void Mail() { mMailbox = sMailId; }
187        static void NewMail() { ++ sMailId; }
188        bool Mailed() const { return mMailbox == sMailId; }
189
190        static int sMailId;
191        int mMailbox;
192
193        int mTimeStamp;
194
195protected:
196
197        /// if this sub tree is a completely valid view space region
198        bool mTreeValid;
199        /// parent of this node
200        VspInterior *mParent;
201};
202
203
204/** BSP interior node implementation
205*/
206class VspInterior: public VspNode
207{
208public:
209        /** Standard contructor taking split plane as argument.
210        */
211        VspInterior(const AxisAlignedPlane &plane);
212        ~VspInterior();
213        /** @return false since it is an interior node
214        */
215        bool IsLeaf() const;
216
217        VspNode *GetBack();
218        VspNode *GetFront();
219
220        /** Returns split plane.
221        */
222        AxisAlignedPlane GetPlane() const;
223
224        /** Replace front or back child with new child.
225        */
226        void ReplaceChildLink(VspNode *oldChild, VspNode *newChild);
227        /** Replace front and back child.
228        */
229        void SetupChildLinks(VspNode *b, VspNode *f);
230
231        friend ostream &operator<<(ostream &s, const VspInterior &A)
232        {
233                return s << A.mPlane.mAxis << " " << A.mPlane.mPosition;
234        }
235
236protected:
237
238        /// Splitting plane corresponding to this node
239        AxisAlignedPlane mPlane;
240
241        /// back node
242        VspNode *mBack;
243        /// front node
244        VspNode *mFront;
245};
246
247
248/** BSP leaf node implementation.
249*/
250class VspLeaf: public VspNode
251{
252
253public:
254        VspLeaf();
255        VspLeaf(ViewCellLeaf *viewCell);
256        VspLeaf(VspInterior *parent);
257        VspLeaf(VspInterior *parent, ViewCellLeaf *viewCell);
258
259        ~VspLeaf();
260
261        /** @return true since it is an interior node
262        */
263        bool IsLeaf() const;
264       
265        /** Returns pointer of view cell.
266        */
267        ViewCellLeaf *GetViewCell() const;
268
269        /** Sets pointer to view cell.
270        */
271        void SetViewCell(ViewCellLeaf *viewCell);
272
273        /// Rays piercing this leaf.
274        VssRayContainer mVssRays;
275       
276        /// leaf pvs
277        ObjectPvs *mPvs;
278
279        /// Probability that the view point lies in this leaf
280        float mProbability;
281
282protected:
283       
284        /// if NULL this does not correspond to feasible viewcell
285        ViewCellLeaf *mViewCell;
286};
287
288
289/**
290        This class implements a structure holding two different hierarchies,
291        one for object space partitioning and one for view space partitioning.
292
293        The object space and the view space are subdivided using a cost heuristics.
294        If an object space split or a view space split is chosen is also evaluated
295        based on the heuristics.
296       
297        The view space heuristics is evaluated by weighting and adding the pvss of the back and
298        front node of each specific split. unlike for the standalone method vspbsp tree,
299        the pvs of an object would not be the pvs of single object but that of all objects
300        which are contained in the same leaf of the object subdivision. This could be done
301        by storing the pointer to the object space partition parent, which would allow access to all children.
302        Another possibility is to include traced kd-cells in the ray casing process.
303
304        Accordingly, the object space heuristics is evaluated by storing a pvs of view cells with each object.
305        the contribution to an object to the pvs is the number of view cells it can be seen from.
306
307
308        There is a potential efficiency problem involved in a sense that once a certain type
309        of split is chosen for view space / object space, the candidates for the next split of
310        object space / view space must be reevaluated.
311       
312*/
313class VspOspTree
314{
315        friend class ViewCellsParseHandlers;
316        friend class VspVspViewCellsManager;
317
318public:
319       
320        /** Additional data which is passed down the BSP tree during traversal.
321        */
322        class VspOspTraversalData
323        { 
324        public:
325                /// the current node
326                VspNode *mNode;
327                /// current depth
328                int mDepth;
329                /// rays piercing this node
330                RayInfoContainer *mRays;
331                /// the probability that this node contains view point
332                float mProbability;
333                /// the bounding box of the node
334                AxisAlignedBox3 mBoundingBox;
335                /// pvs size
336                int mPvs;
337                /// how often this branch has missed the max-cost ratio
338                int mMaxCostMisses;
339                // current axis
340                int mAxis;
341                // current priority
342                float mPriority;
343
344               
345                /** Returns average ray contribution.
346                */
347                float GetAvgRayContribution() const
348                {
349                        return (float)mPvs / ((float)mRays->size() + Limits::Small);
350                }
351
352
353                VspOspTraversalData():
354                mNode(NULL),
355                mDepth(0),
356                mRays(NULL),
357                mPvs(0),
358                mProbability(0.0),
359                mMaxCostMisses(0),
360                mPriority(0),
361                mAxis(0)
362                {}
363               
364                VspOspTraversalData(VspNode *node,
365                                                        const int depth,
366                                                        RayInfoContainer *rays,
367                                                        const int pvs,
368                                                        const float p,
369                                                        const AxisAlignedBox3 &box):
370                mNode(node),
371                mDepth(depth),
372                mRays(rays),
373                mPvs(pvs),
374                mProbability(p),
375                mBoundingBox(box),
376                mMaxCostMisses(0),
377                mPriority(0),
378                mAxis(0)
379                {}
380
381                VspOspTraversalData(PolygonContainer *polys,
382                                                        const int depth,
383                                                        RayInfoContainer *rays,
384                                                        const AxisAlignedBox3 &box):
385                mNode(NULL),
386                mDepth(depth),
387                mRays(rays),
388                mPvs(0),
389                mProbability(0),
390                mMaxCostMisses(0),
391                mAxis(0),
392                mBoundingBox(box)
393                {}
394
395                /** Returns cost of the traversal data.
396                */
397                float GetCost() const
398                {
399                        //cout << mPriority << endl;
400                        return mPriority;
401                }
402
403                // deletes contents and sets them to NULL
404                void Clear()
405                {
406                        DEL_PTR(mRays);
407                }
408
409                friend bool operator<(const VspOspTraversalData &a, const VspOspTraversalData &b)
410                {
411                        return a.GetCost() < b.GetCost();
412                }
413    };
414       
415
416        typedef std::priority_queue<VspOspTraversalData> VspOspTraversalQueue;
417       
418       
419        struct VspOspSplitCandidate
420        { 
421                /// the current plane
422                AxisAlignedPlane mSplitPlane;
423                /// the number of misses of max cost ratio until this split
424                int mMaxCostMisses;
425                /// parent data
426                VspOspTraversalData mParentData;
427                /// cost of applying this split
428                float mRenderCost;
429
430                VspOspSplitCandidate(): mRenderCost(0)
431                {};
432
433                VspOspSplitCandidate(const AxisAlignedPlane &plane, const VspOspTraversalData &tData):
434                mSplitPlane(plane), mParentData(tData), mRenderCost(0)
435                {}
436
437                /** Returns cost of the traversal data.
438                */
439                float GetCost() const
440                {
441#if 1
442                        return mRenderCost;
443#else
444                        return (float) (-mDepth); // for kd tree
445#endif
446                }
447
448                friend bool operator<(const VspOspSplitCandidate &a, const VspOspSplitCandidate &b)
449                {
450                        return a.GetCost() < b.GetCost();
451                }
452    };
453
454        typedef std::priority_queue<VspOspSplitCandidate> VspOspSplitQueue;
455
456        /** Default constructor creating an empty tree.
457        */
458        VspOspTree();
459
460        /** Default destructor.
461        */
462        ~VspOspTree();
463
464        /** Returns BSP Tree statistics.
465        */
466        const VspTreeStatistics &GetStatistics() const;
467 
468
469        /** Constructs the tree from a given set of rays.
470                @param sampleRays the set of sample rays the construction is based on
471                @param viewCells if not NULL, new view cells are
472                created in the leafs and stored in the container
473        */
474        void Construct(const VssRayContainer &sampleRays,
475                                   AxisAlignedBox3 *forcedBoundingBox);
476
477        /** Returns list of BSP leaves with pvs smaller than
478                a certain threshold.
479                @param onlyUnmailed if only the unmailed leaves should be considered
480                @param maxPvs the maximal pvs (-1 means unlimited)
481        */
482        void CollectLeaves(vector<VspLeaf *> &leaves,
483                                           const bool onlyUnmailed = false,
484                                           const int maxPvs = -1) const;
485
486        /** Returns box which bounds the whole tree.
487        */
488        AxisAlignedBox3 GetBoundingBox()const;
489
490        /** Returns root of the view space partitioning tree.
491        */
492        VspNode *GetRoot() const;
493
494        /** Collects the leaf view cells of the tree
495                @param viewCells returns the view cells
496        */
497        void CollectViewCells(ViewCellContainer &viewCells, bool onlyValid) const;
498
499        /** A ray is cast possible intersecting the tree.
500                @param the ray that is cast.
501                @returns the number of intersections with objects stored in the tree.
502        */
503        int CastRay(Ray &ray);
504
505
506        /** finds neighbouring leaves of this tree node.
507        */
508        int FindNeighbors(VspNode *n,
509                                          vector<VspLeaf *> &neighbors,
510                                          const bool onlyUnmailed) const;
511
512        /** Returns random leaf of BSP tree.
513                @param halfspace defines the halfspace from which the leaf is taken.
514        */
515        VspLeaf *GetRandomLeaf(const Plane3 &halfspace);
516
517        /** Returns random leaf of BSP tree.
518                @param onlyUnmailed if only unmailed leaves should be returned.
519        */
520        VspLeaf *GetRandomLeaf(const bool onlyUnmailed = false);
521
522        /** Returns epsilon of this tree.
523        */
524        float GetEpsilon() const;
525
526        /** Casts line segment into the tree.
527                @param origin the origin of the line segment
528                @param termination the end point of the line segment
529                @returns view cells intersecting the line segment.
530        */
531    int CastLineSegment(const Vector3 &origin,
532                                                const Vector3 &termination,
533                                                ViewCellContainer &viewcells);
534
535               
536        /** Sets pointer to view cells manager.
537        */
538        void SetViewCellsManager(ViewCellsManager *vcm);
539
540
541        /** Collapses the tree with respect to the view cell partition.
542                @returns number of collapsed nodes
543        */
544        int CollapseTree();
545
546        /** Returns view cell the current point is located in.
547                @param point the current view point
548                @param active if currently active view cells should be returned or
549                elementary view cell
550        */
551        ViewCell *GetViewCell(const Vector3 &point, const bool active = false);
552
553
554        /** Returns true if this view point is in a valid view space,
555                false otherwise.
556        */
557        bool ViewPointValid(const Vector3 &viewPoint) const;
558
559        /** Returns view cell corresponding to
560                the invalid view space.
561        */
562        VspViewCell *GetOutOfBoundsCell();
563
564        /** Writes tree to output stream
565        */
566#if ZIPPED_VIEWCELLS
567        bool Export(ogzstream &stream);
568#else
569        bool Export(ofstream &stream);
570#endif
571
572        /** Casts beam, i.e. a 5D frustum of rays, into tree.
573                Tests conservative using the bounding box of the nodes.
574                @returns number of view cells it intersected
575        */
576        int CastBeam(Beam &beam);
577
578
579        /** Checks if tree validity-flags are right
580                with respect to view cell valitiy.
581                If not, marks subtree as invalid.
582        */
583        void ValidateTree();
584
585        /** Invalid view cells are added to the unbounded space
586        */
587        void CollapseViewCells();
588
589        /** Collects rays stored in the leaves.
590        */
591        void CollectRays(VssRayContainer &rays);
592
593        /** Intersects box with the tree and returns the number of intersected boxes.
594                @returns number of view cells found
595        */
596        int ComputeBoxIntersections(const AxisAlignedBox3 &box, ViewCellContainer &viewCells) const;
597
598        // pointer to the hierarchy of view cells
599        ViewCellsTree *mViewCellsTree;
600
601
602protected:
603
604        // --------------------------------------------------------------
605        // For sorting objects
606        // --------------------------------------------------------------
607        struct SortableEntry
608        {
609                enum EType
610                {
611                        ERayMin,
612                        ERayMax
613                };
614
615                int type;
616                float value;
617                VssRay *ray;
618 
619                SortableEntry() {}
620                SortableEntry(const int t, const float v, VssRay *r):type(t),
621                                          value(v), ray(r)
622                {
623                }
624               
625                friend bool operator<(const SortableEntry &a, const SortableEntry &b)
626                {
627                        return a.value < b.value;
628                }
629        };
630
631        /** faster evaluation of split plane cost for kd axis aligned cells.
632        */
633        float EvalSplitCost(const VspOspTraversalData &data,
634                                                const AxisAlignedBox3 &box,
635                                                const int axis,
636                                                const float &position,
637                                                float &pFront,
638                                                float &pBack) const;
639
640        /** Evaluates candidate for splitting.
641        */
642        void EvalSplitCandidate(VspOspTraversalData &tData, VspOspSplitCandidate &splitData);
643
644        /** Computes priority of the traversal data and stores it in tData.
645        */
646        void EvalPriority(VspOspTraversalData &tData) const;
647
648        /** Evaluates render cost decrease of next split.
649        */
650        float EvalRenderCostDecrease(const AxisAlignedPlane &candidatePlane,
651                                                                 const VspOspTraversalData &data) const;
652
653        /** Constructs tree using the split priority queue.
654        */
655        void Construct(RayInfoContainer *rays);
656
657        /** Collects view cells in the subtree under root.
658        */
659        void CollectViewCells(VspNode *root,
660                                                  bool onlyValid,
661                                                  ViewCellContainer &viewCells,
662                                                  bool onlyUnmailed = false) const;
663
664        /** Returns view cell corresponding to
665                the invalid view space. If it does not exist, it is created.
666        */
667        VspViewCell *GetOrCreateOutOfBoundsCell();
668
669        /** Collapses the tree with respect to the view cell partition,
670                i.e. leaves having the same view cell are collapsed.
671                @param node the root of the subtree to be collapsed
672                @param collapsed returns the number of collapsed nodes
673                @returns node of type leaf if the node could be collapsed,
674                this node otherwise
675        */
676        VspNode *CollapseTree(VspNode *node, int &collapsed);
677
678        /** Helper function revalidating the view cell leaf list after merge.
679        */
680        void RepairViewCellsLeafLists();
681
682        /** Evaluates tree stats in the BSP tree leafs.
683        */
684        void EvaluateLeafStats(const VspOspTraversalData &data);
685
686        /** Subdivides node with respect to the traversal data.
687            @param tStack current traversal stack
688                @param tData traversal data also holding node to be subdivided
689                @returns new root of the subtree
690        */
691        VspNode *Subdivide(VspOspSplitQueue &tQueue,
692                                           VspOspSplitCandidate &splitCandidate);
693
694       
695        /** Subdivides leaf.
696                @param leaf the leaf to be subdivided
697               
698                @param polys the polygons to be split
699                @param frontPolys returns the polygons in front of the split plane
700                @param backPolys returns the polygons in the back of the split plane
701               
702                @param rays the polygons to be filtered
703                @param frontRays returns the polygons in front of the split plane
704                @param backRays returns the polygons in the back of the split plane
705
706                @returns the root of the subdivision
707        */
708
709        VspInterior *SubdivideNode(const AxisAlignedPlane &splitPlane,
710                                                           VspOspTraversalData &tData,
711                                                           VspOspTraversalData &frontData,
712                               VspOspTraversalData &backData);
713
714        /** Selects an axis aligned for the next split.
715                @returns cost for this split
716        */
717        float SelectPlane(const VspOspTraversalData &tData,
718                                          AxisAlignedPlane &plane,
719                                          float &pFront,
720                                          float &pBack);
721
722        /** Sorts split candidates for surface area heuristics for axis aligned splits.
723                @param polys the input for choosing split candidates
724                @param axis the current split axis
725                @param splitCandidates returns sorted list of split candidates
726        */
727        void SortSplitCandidates(const RayInfoContainer &rays,
728                                                         const int axis,
729                                                         float minBand,
730                                                         float maxBand);
731
732        /** Computes best cost for axis aligned planes.
733        */
734        float BestCostRatioHeuristics(const RayInfoContainer &rays,
735                                                                  const AxisAlignedBox3 &box,
736                                                                  const int pvsSize,
737                                                                  const int axis,
738                                                                  float &position);
739
740        /** Subdivides the rays into front and back rays according to the split plane.
741               
742                @param plane the split plane
743                @param rays contains the rays to be split. The rays are
744                           distributed into front and back rays.
745                @param frontRays returns rays on the front side of the plane
746                @param backRays returns rays on the back side of the plane
747               
748                @returns the number of splits
749        */
750        int SplitRays(const AxisAlignedPlane &plane,
751                                  RayInfoContainer &rays,
752                              RayInfoContainer &frontRays,
753                                  RayInfoContainer &backRays) const;
754
755        /** Adds the object to the pvs of the front and back leaf with a given classification.
756
757                @param obj the object to be added
758                @param cf the ray classification regarding the split plane
759                @param frontPvs returns the PVS of the front partition
760                @param backPvs returns the PVS of the back partition
761       
762        */
763        void AddObjToPvs(Intersectable *obj,
764                                         const int cf,
765                                         float &frontPvs,
766                                         float &backPvs,
767                                         float &totalPvs) const;
768       
769        /** Computes PVS size induced by the rays.
770        */
771        int ComputePvsSize(const RayInfoContainer &rays) const;
772
773        /** Returns true if tree can be terminated.
774        */
775        inline bool LocalTerminationCriteriaMet(const VspOspTraversalData &data) const;
776
777        /** Returns true if global tree can be terminated.
778        */
779        inline bool GlobalTerminationCriteriaMet(const VspOspTraversalData &data) const;
780
781        /** Adds ray sample contributions to the PVS.
782                @param sampleContributions the number contributions of the samples
783                @param contributingSampels the number of contributing rays
784               
785        */
786        void AddToPvs(VspLeaf *leaf,
787                                  const RayInfoContainer &rays,
788                                  float &sampleContributions,
789                                  int &contributingSamples);
790
791        /** Propagates valid flag up the tree.
792        */
793        void PropagateUpValidity(VspNode *node);
794
795        /** Writes the node to disk
796                @note: should be implemented as visitor.
797        */
798#if ZIPPED_VIEWCELLS
799        void ExportNode(VspNode *node, ogzstream &stream);
800#else
801        void ExportNode(VspNode *node, ofstream &stream);
802#endif
803
804        /** Returns estimated memory usage of tree.
805        */
806        float GetMemUsage() const;
807
808
809protected:
810
811        ViewCellsManager *mViewCellsManager;
812        vector<SortableEntry> *mSplitCandidates;
813
814        /// Pointer to the root of the tree
815        VspNode *mRoot;
816               
817        VspTreeStatistics mVspStats;
818       
819        /// View cell corresponding to the space outside the valid view space
820        VspViewCell *mOutOfBoundsCell;
821
822        /// box around the whole view domain
823        AxisAlignedBox3 mBox;
824
825
826
827        //-- local termination
828
829        /// minimal number of rays before subdivision termination
830        int mTermMinRays;
831        /// maximal possible depth
832        int mTermMaxDepth;
833        /// mininum probability
834        float mTermMinProbability;
835        /// mininum PVS
836        int mTermMinPvs;
837        /// maximal contribution per ray
838        float mTermMaxRayContribution;
839        /// maximal acceptable cost ratio
840        float mTermMaxCostRatio;
841        /// tolerance value indicating how often the max cost ratio can be failed
842        int mTermMissTolerance;
843
844
845        //-- global criteria
846        float mTermMinGlobalCostRatio;
847        int mTermGlobalCostMissTolerance;
848        int mGlobalCostMisses;
849
850        /// maximal number of view cells
851        int mMaxViewCells;
852        /// maximal tree memory
853        float mMaxMemory;
854        /// the tree is out of memory
855        bool mOutOfMemory;
856
857
858
859        //-- split heuristics based parameters
860       
861        bool mUseCostHeuristics;
862        /// balancing factor for PVS criterium
863        float mCtDivCi;
864        /// if only driving axis should be used for split
865        bool mOnlyDrivingAxis;
866        /// if random split axis should be used
867        bool mUseRandomAxis;
868        /// if vsp bsp tree should simulate octree
869        bool mCirculatingAxis;
870        /// minimal relative position where the split axis can be placed
871        float mMinBand;
872        /// maximal relative position where the split axis can be placed
873        float mMaxBand;
874
875
876        /// current time stamp (used for keeping split history)
877        int mTimeStamp;
878        // if rays should be stored in leaves
879        bool mStoreRays;
880
881        /// epsilon for geometric comparisons
882        float mEpsilon;
883
884        /// if we should use breath first priority for the splits
885        int mNodePriorityQueueType;
886
887        // priority queue strategy
888        enum {BREATH_FIRST, DEPTH_FIRST, COST_BASED};
889
890
891        /// subdivision stats output file
892        ofstream  mSubdivisionStats;
893        /// keeps track of cost during subdivision
894        float mTotalCost;
895        /// keeps track of overall pvs size during subdivision
896        int mTotalPvsSize;
897        /// number of currenly generated view cells
898        int mCreatedViewCells;
899
900private:
901
902        /// Generates unique ids for PVS criterium
903        static void GenerateUniqueIdsForPvs();
904
905        //-- unique ids for PVS criterium
906        static int sFrontId;
907        static int sBackId;
908        static int sFrontAndBackId;
909};
910
911}
912
913
914#endif
Note: See TracBrowser for help on using the repository browser.