source: GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h @ 694

Revision 694, 22.6 KB checked in by mattausch, 18 years ago (diff)

added means for rotating scene

Line 
1#ifndef _VspBspTree_H__
2#define _VspBspTree_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#include "RayInfo.h"
11#include "ViewCellBsp.h"
12
13class ViewCell;
14//class BspViewCell;
15class Plane3;
16class VspBspTree; 
17class BspInterior;
18class BspNode;
19class AxisAlignedBox3;
20class Ray;
21class ViewCellsStatistics;
22class ViewCellsManager;
23class MergeCandidate;
24class Beam;
25class ViewCellsTree;
26
27
28struct BspRay;
29
30//#define OCTREE_HACK 0
31/**
32        This is a view space partitioning specialised BSPtree. 
33        There are no polygon splits, but we split the sample rays.
34        The candidates for the next split plane are evaluated only
35        by checking the sampled visibility information.
36        The polygons are employed merely as candidates for the next split planes.
37*/
38class VspBspTree
39{
40        friend class ViewCellsParseHandlers;
41        friend class VspBspViewCellsManager;
42public:
43       
44        /** Additional data which is passed down the BSP tree during traversal.
45        */
46        class VspBspTraversalData
47        { 
48        public:
49                /// the current node
50                BspNode *mNode;
51                /// polygonal data for splitting
52                PolygonContainer *mPolygons;
53                /// current depth
54                int mDepth;
55                /// rays piercing this node
56                RayInfoContainer *mRays;
57                /// the probability that this node contains view point
58                float mProbability;
59                /// geometry of node as induced by planes
60                BspNodeGeometry *mGeometry;
61                /// pvs size
62                int mPvs;
63                /// how often this branch has missed the max-cost ratio
64                int mMaxCostMisses;
65                /// if this node is a kd-node (i.e., boundaries are axis aligned
66                bool mIsKdNode;
67                // hack for octree
68                int mAxis;
69                float mPriority;
70
71               
72                /** Returns average ray contribution.
73                */
74                float GetAvgRayContribution() const
75                {
76                        return (float)mPvs / ((float)mRays->size() + Limits::Small);
77                }
78
79
80                VspBspTraversalData():
81                mNode(NULL),
82                mPolygons(NULL),
83                mDepth(0),
84                mRays(NULL),
85                mPvs(0),
86                mProbability(0.0),
87                mGeometry(NULL),
88                mMaxCostMisses(0),
89                mIsKdNode(false),
90                mPriority(0)
91                {}
92               
93                VspBspTraversalData(BspNode *node,
94                                                        PolygonContainer *polys,
95                                                        const int depth,
96                                                        RayInfoContainer *rays,
97                                                        const int pvs,
98                                                        const float p,
99                                                        BspNodeGeometry *geom):
100                mNode(node),
101                mPolygons(polys),
102                mDepth(depth),
103                mRays(rays),
104                mPvs(pvs),
105                mProbability(p),
106                mGeometry(geom),
107                mMaxCostMisses(0),
108                mIsKdNode(false),
109                mPriority(0)
110                {}
111
112                VspBspTraversalData(PolygonContainer *polys,
113                                                        const int depth,
114                                                        RayInfoContainer *rays,
115                                                        BspNodeGeometry *geom):
116                mNode(NULL),
117                mPolygons(polys),
118                mDepth(depth),
119                mRays(rays),
120                mPvs(0),
121                mProbability(0),
122                mGeometry(geom),
123                mMaxCostMisses(0),
124                mIsKdNode(false)
125                {}
126
127                /** Returns cost of the traversal data.
128                */
129                float GetCost() const
130                {
131                        //cout << mPriority << endl;
132                        return mPriority;
133                }
134
135                // deletes contents and sets them to NULL
136                void Clear()
137                {
138                        DEL_PTR(mPolygons);
139                        DEL_PTR(mRays);
140                        DEL_PTR(mGeometry);
141                }
142
143                friend bool operator<(const VspBspTraversalData &a, const VspBspTraversalData &b)
144                {
145                        return a.GetCost() < b.GetCost();
146                }
147    };
148       
149
150        typedef std::priority_queue<VspBspTraversalData> VspBspTraversalQueue;
151       
152       
153        struct VspBspSplitCandidate
154        { 
155                /// the current node
156                Plane3 mSplitPlane;
157                /// split axis of this plane (0, 1, 2, or 3 if non-axis-aligned)
158                int mSplitAxis;
159                /// the number of misses of max cost ratio until this split
160                int mMaxCostMisses;
161
162                // parent data
163                VspBspTraversalData mParentData;
164                // cost of applying this split
165                float mRenderCost;
166
167                VspBspSplitCandidate(): mRenderCost(0)
168                {};
169
170                VspBspSplitCandidate(const Plane3 &plane, const VspBspTraversalData &tData):
171                mSplitPlane(plane), mParentData(tData), mRenderCost(0)
172                {}
173
174                /** Returns cost of the traversal data.
175                */
176                float GetCost() const
177                {
178#if 1
179                        return mRenderCost;
180#endif
181#if 0
182                        return (float) (-mDepth); // for kd tree
183#endif
184                }
185
186                friend bool operator<(const VspBspSplitCandidate &a, const VspBspSplitCandidate &b)
187                {
188                        return a.GetCost() < b.GetCost();
189                }
190    };
191
192        typedef std::priority_queue<VspBspSplitCandidate> VspBspSplitQueue;
193
194        /** Default constructor creating an empty tree.
195        */
196        VspBspTree();
197
198        /** Default destructor.
199        */
200        ~VspBspTree();
201
202        /** Returns BSP Tree statistics.
203        */
204        const BspTreeStatistics &GetStatistics() const;
205 
206
207        /** Constructs the tree from a given set of rays.
208                @param sampleRays the set of sample rays the construction is based on
209                @param viewCells if not NULL, new view cells are
210                created in the leafs and stored in the container
211        */
212        void Construct(const VssRayContainer &sampleRays,
213                                   AxisAlignedBox3 *forcedBoundingBox);
214
215        /** Returns list of BSP leaves with pvs smaller than
216                a certain threshold.
217                @param onlyUnmailed if only the unmailed leaves should be considered
218                @param maxPvs the maximal pvs (-1 means unlimited)
219        */
220        void CollectLeaves(vector<BspLeaf *> &leaves,
221                                           const bool onlyUnmailed = false,
222                                           const int maxPvs = -1) const;
223
224        /** Returns box which bounds the whole tree.
225        */
226        AxisAlignedBox3 GetBoundingBox()const;
227
228        /** Returns root of BSP tree.
229        */
230        BspNode *GetRoot() const;
231
232        /** Collects the leaf view cells of the tree
233                @param viewCells returns the view cells
234        */
235        void CollectViewCells(ViewCellContainer &viewCells, bool onlyValid) const;
236
237        /** A ray is cast possible intersecting the tree.
238                @param the ray that is cast.
239                @returns the number of intersections with objects stored in the tree.
240        */
241        int CastRay(Ray &ray);
242
243        /// bsp tree construction types
244        enum {FROM_INPUT_VIEW_CELLS, FROM_SCENE_GEOMETRY, FROM_SAMPLES};
245
246        /** finds neighbouring leaves of this tree node.
247        */
248        int FindNeighbors(BspNode *n,
249                                          vector<BspLeaf *> &neighbors,
250                                          const bool onlyUnmailed) const;
251
252        /** Constructs geometry associated with the half space intersections
253                leading to this node.
254        */
255        void ConstructGeometry(BspNode *n, BspNodeGeometry &geom) const;
256       
257        /** Construct geometry of view cell.
258        */
259        void ConstructGeometry(ViewCell *vc, BspNodeGeometry &geom) const;
260
261        /** Returns random leaf of BSP tree.
262                @param halfspace defines the halfspace from which the leaf is taken.
263        */
264        BspLeaf *GetRandomLeaf(const Plane3 &halfspace);
265
266        /** Returns random leaf of BSP tree.
267                @param onlyUnmailed if only unmailed leaves should be returned.
268        */
269        BspLeaf *GetRandomLeaf(const bool onlyUnmailed = false);
270
271        /** Returns epsilon of this tree.
272        */
273        float GetEpsilon() const;
274
275        /** Casts line segment into the tree.
276                @param origin the origin of the line segment
277                @param termination the end point of the line segment
278                @returns view cells intersecting the line segment.
279        */
280    int CastLineSegment(const Vector3 &origin,
281                                                const Vector3 &termination,
282                                                ViewCellContainer &viewcells);
283
284               
285        /** Sets pointer to view cells manager.
286        */
287        void SetViewCellsManager(ViewCellsManager *vcm);
288
289        /** Returns distance from node 1 to node 2.
290        */
291        int TreeDistance(BspNode *n1, BspNode *n2) const;
292
293        /** Collapses the tree with respect to the view cell partition.
294                @returns number of collapsed nodes
295        */
296        int CollapseTree();
297
298        /** Returns view cell the current point is located in.
299        */
300        ViewCell *GetViewCell(const Vector3 &point);
301
302
303        /** Returns true if this view point is in a valid view space,
304                false otherwise.
305        */
306        bool ViewPointValid(const Vector3 &viewPoint) const;
307
308        /** Returns view cell corresponding to
309                the invalid view space.
310        */
311        BspViewCell *GetOutOfBoundsCell();
312
313        /** Writes tree to output stream
314        */
315        bool Export(ofstream &stream);
316
317        /** Casts beam, i.e. a 5D frustum of rays, into tree.
318                Tests conservative using the bounding box of the nodes.
319                @returns number of view cells it intersected
320        */
321        int CastBeam(Beam &beam);
322
323        void CollectViewCells(BspNode *root,
324                                                  bool onlyValid,
325                                                  ViewCellContainer &viewCells,
326                                                  bool onlyUnmailed = false) const;
327
328       
329        int FindApproximateNeighbors(BspNode *n,
330                                                             vector<BspLeaf *> &neighbors,
331                                                                 const bool onlyUnmailed) const;
332
333        /** Checks if tree validity-flags are right
334                with respect to view cell valitiy.
335                If not, marks subtree as invalid.
336        */
337        void ValidateTree();
338
339        /** Invalid view cells are added to the unbounded space
340        */
341        void CollapseViewCells();
342
343        /** Collects rays stored in the leaves.
344        */
345        void CollectRays(VssRayContainer &rays);
346
347
348        ViewCellsTree *mViewCellsTree;
349
350
351protected:
352
353        // --------------------------------------------------------------
354        // For sorting objects
355        // --------------------------------------------------------------
356        struct SortableEntry
357        {
358                enum EType
359                {
360                        ERayMin,
361                        ERayMax
362                };
363
364                int type;
365                float value;
366                VssRay *ray;
367 
368                SortableEntry() {}
369                SortableEntry(const int t, const float v, VssRay *r):type(t),
370                                          value(v), ray(r)
371                {
372                }
373               
374                friend bool operator<(const SortableEntry &a, const SortableEntry &b)
375                {
376                        return a.value < b.value;
377                }
378        };
379
380        /** faster evaluation of split plane cost for kd axis aligned cells.
381        */
382        float EvalAxisAlignedSplitCost(const VspBspTraversalData &data,
383                                                                   const AxisAlignedBox3 &box,
384                                                                   const int axis,
385                                                                   const float &position,
386                                                                   float &pFront,
387                                                                   float &pBack) const;
388
389        /** Evaluates candidate for splitting.
390        */
391        void EvalSplitCandidate(VspBspTraversalData &tData, VspBspSplitCandidate &splitData);
392
393        /** Computes priority of the traversal data and stores it in tData.
394        */
395        void EvalPriority(VspBspTraversalData &tData) const;
396
397        float EvalRenderCostDecrease(const Plane3 &candidatePlane,
398                                                                 const VspBspTraversalData &data) const;
399
400        void ConstructWithSplitQueue(const PolygonContainer &polys, RayInfoContainer *rays);
401
402
403        /** Returns view cell corresponding to
404                the invalid view space. If it does not exist, it is created.
405        */
406        BspViewCell *GetOrCreateOutOfBoundsCell();
407
408        /** Collapses the tree with respect to the view cell partition,
409                i.e. leaves having the same view cell are collapsed.
410                @param node the root of the subtree to be collapsed
411                @param collapsed returns the number of collapsed nodes
412                @returns node of type leaf if the node could be collapsed,
413                this node otherwise
414        */
415        BspNode *CollapseTree(BspNode *node, int &collapsed);
416
417        /** Helper function revalidating the view cell leaf list after merge.
418        */
419        void RepairViewCellsLeafLists();
420
421        /** Evaluates tree stats in the BSP tree leafs.
422        */
423        void EvaluateLeafStats(const VspBspTraversalData &data);
424
425        /** Subdivides node with respect to the traversal data.
426            @param tStack current traversal stack
427                @param tData traversal data also holding node to be subdivided
428                @returns new root of the subtree
429        */
430        BspNode *Subdivide(VspBspTraversalQueue &tStack,
431                                           VspBspTraversalData &tData);
432
433        BspNode *Subdivide(VspBspSplitQueue &tQueue,
434                                           VspBspSplitCandidate &splitCandidate);
435
436        /** Constructs the tree from the given traversal data.
437                @param polys stores set of polygons on which subdivision may be based
438                @param rays storesset of rays on which subdivision may be based
439        */
440        void Construct(const PolygonContainer &polys, RayInfoContainer *rays);
441
442        /** Selects the best possible splitting plane.
443                @param plane returns the split plane
444                @param leaf the leaf to be split
445                @param polys the polygon list on which the split decition is based
446                @param rays ray container on which selection may be based
447                @note the polygons can be reordered in the process
448                @returns true if the cost of the split is under maxCostRatio
449
450        */
451        bool SelectPlane(Plane3 &plane,
452                                         BspLeaf *leaf,
453                                         VspBspTraversalData &data,
454                                         VspBspTraversalData &frontData,
455                                         VspBspTraversalData &backData,
456                                         int &splitAxis);
457       
458        /** Strategies where the effect of the split plane is tested
459            on all input rays.
460
461                @returns the cost of the candidate split plane
462        */
463        float EvalSplitPlaneCost(const Plane3 &candidatePlane,
464                                                         const VspBspTraversalData &data,
465                                                         BspNodeGeometry &geomFront,
466                                                         BspNodeGeometry &geomBack,
467                                                         float &pFront,
468                                                         float &pBack) const;
469
470        /** Subdivides leaf.
471                @param leaf the leaf to be subdivided
472               
473                @param polys the polygons to be split
474                @param frontPolys returns the polygons in front of the split plane
475                @param backPolys returns the polygons in the back of the split plane
476               
477                @param rays the polygons to be filtered
478                @param frontRays returns the polygons in front of the split plane
479                @param backRays returns the polygons in the back of the split plane
480
481                @returns the root of the subdivision
482        */
483
484        BspInterior *SubdivideNode(const Plane3 &splitPlane,
485                                                           VspBspTraversalData &tData,
486                                                           VspBspTraversalData &frontData,
487                               VspBspTraversalData &backData,
488                                                           PolygonContainer &coincident);
489
490        /** Extracts the meshes of the objects and adds them to polygons.
491                Adds object aabb to the aabb of the tree.
492                @param maxPolys the maximal number of objects to be stored as polygons
493                @returns the number of polygons
494        */
495        int AddToPolygonSoup(const ObjectContainer &objects,
496                                                 PolygonContainer &polys,
497                                                 int maxObjects = 0);
498
499        /** Extracts the meshes of the view cells and and adds them to polygons.
500                Adds view cell aabb to the aabb of the tree.
501                @param maxPolys the maximal number of objects to be stored as polygons
502                @returns the number of polygons
503        */
504        int AddToPolygonSoup(const ViewCellContainer &viewCells,
505                                                 PolygonContainer &polys,
506                                                 int maxObjects = 0);
507
508        /** Extract polygons of this mesh and add to polygon container.
509                @param mesh the mesh that drives the polygon construction
510                @param parent the parent intersectable this polygon is constructed from
511                @returns number of polygons
512        */
513        int AddMeshToPolygons(Mesh *mesh, PolygonContainer &polys, MeshInstance *parent);
514
515        /** Selects an axis aligned for the next split.
516                @returns cost for this split
517        */
518        float SelectAxisAlignedPlane(Plane3 &plane,
519                                                                 const VspBspTraversalData &tData,
520                                                                 int &axis,
521                                                                 BspNodeGeometry **frontGeom,
522                                                                 BspNodeGeometry **backGeom,
523                                                                 float &pFront,
524                                                                 float &pBack,
525                                                                 const bool useKdSplit);
526
527        /** Sorts split candidates for surface area heuristics for axis aligned splits.
528                @param polys the input for choosing split candidates
529                @param axis the current split axis
530                @param splitCandidates returns sorted list of split candidates
531        */
532        void SortSplitCandidates(const RayInfoContainer &rays, const int axis);
533
534        /** Computes best cost for axis aligned planes.
535        */
536        float BestCostRatioHeuristics(const RayInfoContainer &rays,
537                                                                  const AxisAlignedBox3 &box,
538                                                                  const int pvsSize,
539                                                                  const int &axis,
540                                                                  float &position);
541
542        /** Selects an axis aligned split plane.
543                @Returns true if split is valied
544        */
545        bool SelectAxisAlignedPlane(Plane3 &plane, const PolygonContainer &polys) const;
546
547        /** Subdivides the rays into front and back rays according to the split plane.
548               
549                @param plane the split plane
550                @param rays contains the rays to be split. The rays are
551                           distributed into front and back rays.
552                @param frontRays returns rays on the front side of the plane
553                @param backRays returns rays on the back side of the plane
554               
555                @returns the number of splits
556        */
557        int SplitRays(const Plane3 &plane,
558                                  RayInfoContainer &rays,
559                              RayInfoContainer &frontRays,
560                                  RayInfoContainer &backRays) const;
561
562
563        /** Extracts the split planes representing the space bounded by node n.
564        */
565        void ExtractHalfSpaces(BspNode *n, vector<Plane3> &halfSpaces) const;
566
567        /** Adds the object to the pvs of the front and back leaf with a given classification.
568
569                @param obj the object to be added
570                @param cf the ray classification regarding the split plane
571                @param frontPvs returns the PVS of the front partition
572                @param backPvs returns the PVS of the back partition
573       
574        */
575        void AddObjToPvs(Intersectable *obj,
576                                         const int cf,
577                                         int &frontPvs,
578                                         int &backPvs,
579                                         int &totalPvs) const;
580       
581        /** Computes PVS size induced by the rays.
582        */
583        int ComputePvsSize(const RayInfoContainer &rays) const;
584
585        /** Returns true if tree can be terminated.
586        */
587        inline bool LocalTerminationCriteriaMet(const VspBspTraversalData &data) const;
588
589        /** Returns true if global tree can be terminated.
590        */
591        inline bool GlobalTerminationCriteriaMet(const VspBspTraversalData &data) const;
592
593        /** Computes accumulated ray lenght of this rays.
594        */
595        float AccumulatedRayLength(const RayInfoContainer &rays) const;
596
597        /** Splits polygons with respect to the split plane.
598
599                @param plane the split plane
600                @param polys the polygons to be split. the polygons are consumed and
601                           distributed to the containers frontPolys, backPolys, coincident.
602                @param frontPolys returns the polygons in the front of the split plane
603                @param backPolys returns the polygons in the back of the split plane
604                @param coincident returns the polygons coincident to the split plane
605
606                @returns the number of splits   
607        */
608        int SplitPolygons(const Plane3 &plane,
609                                          PolygonContainer &polys,
610                                          PolygonContainer &frontPolys,
611                                          PolygonContainer &backPolys,
612                                          PolygonContainer &coincident) const;
613
614        /** Adds ray sample contributions to the PVS.
615                @param sampleContributions the number contributions of the samples
616                @param contributingSampels the number of contributing rays
617               
618        */
619        void AddToPvs(BspLeaf *leaf,
620                                  const RayInfoContainer &rays,
621                                  float &sampleContributions,
622                                  int &contributingSamples);
623
624
625
626
627
628       
629        /** Take 3 ray endpoints, where two are minimum and one a maximum
630                point or the other way round.
631        */
632        Plane3 ChooseCandidatePlane(const RayInfoContainer &rays) const;
633
634        /** Take plane normal as plane normal and the midpoint of the ray.
635                PROBLEM: does not resemble any point where visibility is
636                likely to change
637        */
638        Plane3 ChooseCandidatePlane2(const RayInfoContainer &rays) const;
639
640        /** Fit the plane between the two lines so that the plane
641                has equal shortest distance to both lines.
642        */
643        Plane3 ChooseCandidatePlane3(const RayInfoContainer &rays) const;
644 
645        /** Collects candidates for merging.
646                @param leaves the leaves to be merged
647                @returns number of leaves in queue
648        */
649        int CollectMergeCandidates(const vector<BspLeaf *> leaves, vector<MergeCandidate> &candidates);
650
651        /** Collects candidates for the merge in the merge queue.
652                @returns number of leaves in queue
653        */
654        int CollectMergeCandidates(const VssRayContainer &rays, vector<MergeCandidate> &candidates);
655       
656        /** Preprocesses polygons and throws out all polygons which are coincident to
657                the view space box faces (they can be problematic).
658        */
659        void PreprocessPolygons(PolygonContainer &polys);
660       
661        /** Propagates valid flag up the tree.
662        */
663        void PropagateUpValidity(BspNode *node);
664
665        /** Writes the node to disk
666                @note: should be implemented as visitor
667        */
668        void ExportNode(BspNode *node, ofstream &stream);
669
670        /** Returns estimated memory usage of tree.
671        */
672        //float GetMemUsage(const VspBspTraversalQueue &tstack) const;
673        float GetMemUsage() const;
674
675
676
677        /// Pointer to the root of the tree
678        BspNode *mRoot;
679               
680        BspTreeStatistics mBspStats;
681
682        /// Strategies for choosing next split plane.
683        enum {NO_STRATEGY = 0,
684                  RANDOM_POLYGON = 1,
685                  AXIS_ALIGNED = 2,
686                  LEAST_RAY_SPLITS = 256,
687                  BALANCED_RAYS = 512,
688                  PVS = 1024
689                };
690
691        /// box around the whole view domain
692        AxisAlignedBox3 mBox;
693
694        bool mUseCostHeuristics;
695
696        /// minimal number of rays before subdivision termination
697        int mTermMinRays;
698        /// maximal possible depth
699        int mTermMaxDepth;
700        /// mininum probability
701        float mTermMinProbability;
702        /// mininum PVS
703        int mTermMinPvs;
704        /// maximal contribution per ray
705        float mTermMaxRayContribution;
706        /// minimal accumulated ray length
707        float mTermMinAccRayLength;
708
709        //HACK
710        int mTermMinPolygons;
711
712        float mTermMinGlobalCostRatio;
713        int mTermGlobalCostMissTolerance;
714
715        int mGlobalCostMisses;
716
717        bool mUseSplitCostQueue;
718        //-- termination criteria for axis aligned split
719
720        /// minimal number of rays for axis aligned split
721        int mTermMinRaysForAxisAligned;
722        // max ray contribution
723        float mTermMaxRayContriForAxisAligned;
724
725        /// strategy to get the best split plane
726        int mSplitPlaneStrategy;
727        /// number of candidates evaluated for the next split plane
728        int mMaxPolyCandidates;
729        /// number of candidates for split planes evaluated using the rays
730        int mMaxRayCandidates;
731        /// balancing factor for PVS criterium
732        float mCtDivCi;
733
734        //-- axis aligned split criteria
735        float mAxisAlignedCtDivCi;
736        /// spezifies the split border of the axis aligned split
737        float mAxisAlignedSplitBorder;
738
739        /// maximal acceptable cost ratio
740        float mTermMaxCostRatio;
741        /// tolerance value indicating how often the max cost ratio can be failed
742        int mTermMissTolerance;
743
744        //-- factors guiding the split plane heuristics
745        float mLeastRaySplitsFactor;
746        float mBalancedRaysFactor;
747        float mPvsFactor;
748
749        /// if area or volume should be used for PVS heuristics
750        bool mUseAreaForPvs;
751        /// tolerance for polygon split
752        float mEpsilon;
753        /// maximal number of test rays used to evaluate candidate split plane
754        int mMaxTests;
755        /// normalizes different bsp split plane criteria
756        float mCostNormalizer;
757        /// maximal number of view cells
758        int mMaxViewCells;
759       
760        ofstream  mSubdivisionStats;
761
762        // if rays should be stored in leaves
763        bool mStoreRays;
764       
765        /// if only driving axis should be used for split
766        bool mOnlyDrivingAxis;
767
768        ViewCellsManager *mViewCellsManager;
769
770        vector<SortableEntry> *mSplitCandidates;
771
772       
773        float mRenderCostWeight;
774        /// View cell corresponding to the space outside the valid view space
775        BspViewCell *mOutOfBoundsCell;
776
777        /// maximal tree memory
778        float mMaxMemory;
779        /// the tree is out of memory
780        bool mOutOfMemory;
781       
782        float mTotalCost;
783        int mTotalPvsSize;
784
785        //int mSplits;
786        /// subdivision stats output file
787        ofstream mSubdivsionStats;
788        /// if random split axis should be used
789        bool mUseRandomAxis;
790        /// use polygon split whenever there are polys left
791        bool mUsePolygonSplitIfAvailable;
792        /// current time stamp (used for keeping split history)
793        int mTimeStamp;
794        /// number of currenly generated view cells
795        int mCreatedViewCells;
796        /// if vsp bsp tree should simulate octree
797        bool mSimulateOctree;
798
799        /// if we should use breath first priority for the splits
800        bool mBreathFirstSplits;
801
802        bool mEmptyViewCellsMergeAllowed;
803
804private:
805
806        /// Generates unique ids for PVS criterium
807        static void GenerateUniqueIdsForPvs();
808
809        //-- unique ids for PVS criterium
810        static int sFrontId;
811        static int sBackId;
812        static int sFrontAndBackId;
813};
814
815
816
817
818#endif
Note: See TracBrowser for help on using the repository browser.