source: GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h @ 1580

Revision 1580, 21.9 KB checked in by mattausch, 18 years ago (diff)
Line 
1#ifndef _BvHierarchy_H__
2#define _BvHierarchy_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#include "SubdivisionCandidate.h"
13#include "AxisAlignedBox3.h"
14#include "IntersectableWrapper.h"
15
16
17
18namespace GtpVisibilityPreprocessor {
19
20
21class ViewCellLeaf;
22class Plane3;
23class AxisAlignedBox3;
24class Ray;
25class ViewCellsStatistics;
26class ViewCellsManager;
27class MergeCandidate;
28class Beam;
29class ViewCellsTree;
30class Environment;
31class BvhInterior;
32class BvhLeaf;
33class BvhNode;
34class BvhIntersectable;
35class BvhTree;
36class VspTree;
37class ViewCellsContainer;
38class HierarchyManager;
39
40
41/** View space partition statistics.
42*/
43class BvhStatistics: public StatisticsBase
44{
45public:
46       
47        /// Constructor
48        BvhStatistics()
49        {
50                Reset();
51        }
52
53        int Nodes() const {return nodes;}
54        int Interior() const { return nodes / 2; }
55        int Leaves() const { return (nodes / 2) + 1; }
56       
57        double AvgDepth() const
58        { return accumDepth / (double)Leaves(); }
59
60        double AvgObjectRefs() const
61        { return objectRefs / (double)Leaves(); }
62
63        double AvgRayRefs() const
64        { return rayRefs / (double)Leaves(); }
65
66
67        void Reset()
68        {
69                nodes = 0;
70                splits = 0;
71                maxDepth = 0;
72                minDepth = 99999;
73                accumDepth = 0;
74        maxDepthNodes = 0;
75                minProbabilityNodes = 0;
76                maxCostNodes = 0;
77                       
78                ///////////////////
79                minObjectsNodes = 0;
80                maxObjectRefs = 0;
81                minObjectRefs = 999999999;
82                objectRefs = 0;
83                emptyNodes = 0;
84
85                ///////////////////
86                minRaysNodes = 0;
87                maxRayRefs = 0;
88                minRayRefs = 999999999;
89                rayRefs = 0;
90                maxRayContriNodes = 0;
91                mGlobalCostMisses = 0;
92        }
93
94
95public:
96
97        // total number of nodes
98        int nodes;
99        // number of splits
100        int splits;
101        // maximal reached depth
102        int maxDepth;
103        // minimal depth
104        int minDepth;
105        // max depth nodes
106        int maxDepthNodes;
107        // accumulated depth (used to compute average)
108        int accumDepth;
109        // minimum area nodes
110        int minProbabilityNodes;
111        /// nodes termination because of max cost ratio;
112        int maxCostNodes;
113        // global cost ratio violations
114        int mGlobalCostMisses;
115
116        //////////////////
117        // nodes with minimum objects
118        int minObjectsNodes;
119        // max number of rays per node
120        int maxObjectRefs;
121        // min number of rays per node
122        int minObjectRefs;
123        /// object references
124        int objectRefs;
125        // leaves with no objects
126        int emptyNodes;
127
128        //////////////////////////
129        // nodes with minimum rays
130        int minRaysNodes;
131        // max number of rays per node
132        int maxRayRefs;
133        // min number of rays per node
134        int minRayRefs;
135        /// object references
136        int rayRefs;
137        /// nodes with max ray contribution
138        int maxRayContriNodes;
139
140        void Print(ostream &app) const;
141
142        friend ostream &operator<<(ostream &s, const BvhStatistics &stat)
143        {
144                stat.Print(s);
145                return s;
146        }
147};
148
149
150/**
151    VspNode abstract class serving for interior and leaf node implementation
152*/
153class BvhNode
154{
155public:
156       
157        // types of vsp nodes
158        enum {Interior, Leaf};
159
160        BvhNode();
161        BvhNode(const AxisAlignedBox3 &bbox);
162        BvhNode(const AxisAlignedBox3 &bbox, BvhInterior *parent);
163
164        virtual ~BvhNode(){};
165
166        /** Determines whether this node is a leaf or not
167                @return true if leaf
168        */
169        virtual bool IsLeaf() const = 0;
170
171        /** Determines whether this node is a root
172                @return true if root
173        */
174        virtual bool IsRoot() const;
175
176        /** Returns parent node.
177        */
178        BvhInterior *GetParent();
179
180        /** Sets parent node.
181        */
182        void SetParent(BvhInterior *parent);
183
184        /** The bounding box specifies the node extent.
185        */
186        inline
187        AxisAlignedBox3 GetBoundingBox() const
188        { return mBoundingBox; }
189
190
191        inline
192        void SetBoundingBox(const AxisAlignedBox3 &boundingBox)
193        { mBoundingBox = boundingBox; }
194
195
196        /////////////////////////////////////
197        //-- mailing options
198       
199        static void NewMail(const int reserve = 1) {
200                sMailId += sReservedMailboxes;
201                sReservedMailboxes = reserve;
202        }
203       
204        void Mail() { mMailbox = sMailId; }
205        bool Mailed() const { return mMailbox == sMailId; }
206
207        void Mail(const int mailbox) { mMailbox = sMailId + mailbox; }
208        bool Mailed(const int mailbox) const { return mMailbox == sMailId + mailbox; }
209
210        int IncMail() { return ++ mMailbox - sMailId; }
211
212        static int sMailId;
213        int mMailbox;
214        static int sReservedMailboxes;
215
216        ///////////////////////////////////
217
218protected:
219       
220        /// the bounding box of the node
221        AxisAlignedBox3 mBoundingBox;
222        /// parent of this node
223        BvhInterior *mParent;
224};
225
226
227/** BSP interior node implementation
228*/
229class BvhInterior: public BvhNode
230{
231public:
232        /** Standard contructor taking a bounding box as argument.
233        */
234        BvhInterior(const AxisAlignedBox3 &bbox);
235        BvhInterior(const AxisAlignedBox3 &bbox, BvhInterior *parent);
236
237        ~BvhInterior();
238        /** @return false since it is an interior node
239        */
240        bool IsLeaf() const;
241       
242        BvhNode *GetBack() { return mBack; }
243        BvhNode *GetFront() { return mFront; }
244
245        /** Replace front or back child with new child.
246        */
247        void ReplaceChildLink(BvhNode *oldChild, BvhNode *newChild);
248
249        /** Replace front and back child.
250        */
251        void SetupChildLinks(BvhNode *front, BvhNode *back);
252
253        friend ostream &operator<<(ostream &s, const BvhInterior &A)
254        {
255                return s << A.mBoundingBox;
256        }
257
258protected:
259
260        /// back node
261        BvhNode *mBack;
262        /// front node
263        BvhNode *mFront;
264};
265
266
267/** BSP leaf node implementation.
268*/
269class BvhLeaf: public BvhNode
270{
271public:
272        /** Standard contructor taking a bounding box as argument.
273        */
274        BvhLeaf(const AxisAlignedBox3 &bbox);
275        BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent);
276        BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent, const int numObjects);
277
278        ~BvhLeaf();
279
280        /** @return true since it is an interior node
281        */
282        bool IsLeaf() const;
283       
284        SubdivisionCandidate *GetSubdivisionCandidate()// const
285        {
286                return mSubdivisionCandidate;
287        }
288
289        void SetSubdivisionCandidate(SubdivisionCandidate *candidate)
290        {
291                mSubdivisionCandidate = candidate;
292        }
293
294public:
295
296        /// Rays piercing this leaf.
297        VssRayContainer mVssRays;
298        /// objects
299        ObjectContainer mObjects;
300        /// universal counter
301        int mCounter;
302
303protected:
304
305        /// pointer to a split plane candidate splitting this leaf
306        SubdivisionCandidate *mSubdivisionCandidate;
307};
308
309
310typedef map<BvhNode *, BvhIntersectable *> BvhIntersectableMap;
311
312
313/** View Space Partitioning tree.
314*/
315class BvHierarchy
316{
317        friend class ViewCellsParseHandlers;
318        friend class HierarchyManager;
319
320protected:
321        struct SortableEntry;
322        typedef vector<SortableEntry> SortableEntryContainer;
323
324public:
325       
326        /** Additional data which is passed down the BSP tree during traversal.
327        */
328        class BvhTraversalData
329        { 
330        public:
331               
332                BvhTraversalData():
333                mNode(NULL),
334                mDepth(0),
335                mProbability(0.0),
336                mMaxCostMisses(0),
337                mAxis(0),
338                mNumRays(0)
339                {
340                        mSortedObjects[0] = mSortedObjects[1] = mSortedObjects[2] = NULL;
341                }
342               
343                BvhTraversalData(BvhLeaf *node,
344                                                 const int depth,
345                                                 const float v,
346                                                 const int numRays):
347                mNode(node),
348                mDepth(depth),
349                //mBoundingBox(box),
350                mProbability(v),
351                mMaxCostMisses(0),
352                mAxis(0),
353                mNumRays(numRays)
354                {
355                        mSortedObjects[0] = mSortedObjects[1] = mSortedObjects[2] = NULL;
356                }
357
358                /** Deletes contents and sets them to NULL.
359                */
360                void Clear()
361                {
362                        DEL_PTR(mNode);
363                        DEL_PTR(mSortedObjects[0]);
364                        DEL_PTR(mSortedObjects[1]);
365                        DEL_PTR(mSortedObjects[2]);
366                }
367
368                /// the current node
369                BvhLeaf *mNode;
370                /// current depth
371                int mDepth;
372                /// the probability that this node is seen
373                float mProbability;
374                /// the bounding box of the node
375                //AxisAlignedBox3 mBoundingBox;
376                /// how often this branch has missed the max-cost ratio
377                int mMaxCostMisses;
378                /// current axis
379                int mAxis;
380                /// number of rays
381                int mNumRays;
382                /// the sorted objects for the three dimensions
383                ObjectContainer *mSortedObjects[3];             
384    };
385
386
387        /** Candidate for a object space split.
388        */
389        class BvhSubdivisionCandidate: public SubdivisionCandidate
390        { 
391        public:
392
393        BvhSubdivisionCandidate(const BvhTraversalData &tData): mParentData(tData)
394                {};
395
396                ~BvhSubdivisionCandidate()
397                {
398                        mParentData.Clear();
399                }
400
401                int Type() const { return OBJECT_SPACE; }
402       
403                void EvalPriority()
404                {
405                        sBvHierarchy->EvalSubdivisionCandidate(*this); 
406                }
407
408                bool GlobalTerminationCriteriaMet() const
409                {
410                        return sBvHierarchy->GlobalTerminationCriteriaMet(mParentData);
411                }
412
413                BvhSubdivisionCandidate(
414                        const ObjectContainer &frontObjects,
415                        const ObjectContainer &backObjects,
416                        const BvhTraversalData &tData):
417                mFrontObjects(frontObjects), mBackObjects(backObjects), mParentData(tData)
418                {}
419
420                /// pointer to parent tree.
421                static BvHierarchy *sBvHierarchy;
422                /// parent data
423                BvhTraversalData mParentData;
424                /// the objects on the front of the potential split
425                ObjectContainer mFrontObjects;
426                /// the objects on the back of the potential split
427                ObjectContainer mBackObjects;
428        };
429
430        /** Struct for traversing line segment.
431        */
432        struct LineTraversalData
433        {
434                BvhNode *mNode;
435                Vector3 mExitPoint;
436               
437                float mMaxT;
438   
439                LineTraversalData () {}
440                LineTraversalData (BvhNode *n, const Vector3 &p, const float maxt):
441                mNode(n), mExitPoint(p), mMaxT(maxt) {}
442        };
443
444
445        /** Default constructor creating an empty tree.
446        */
447        BvHierarchy();
448
449        /** Default destructor.
450        */
451        ~BvHierarchy();
452
453        /** Returns tree statistics.
454        */
455        const BvhStatistics &GetStatistics() const;
456 
457        /** Returns bounding box of the specified node.
458        */
459        AxisAlignedBox3 GetBoundingBox(BvhNode *node) const;
460
461        /** Reads parameters from environment singleton.
462        */
463        void ReadEnvironment();
464
465        /** Evaluates candidate for splitting.
466        */
467        void EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitData);
468
469        /** Returns list of leaves with pvs smaller than
470                a certain threshold.
471                @param onlyUnmailed if only the unmailed leaves should be considered
472                @param maxPvs the maximal pvs of a leaf to be added (-1 means unlimited)
473        */
474        void CollectLeaves(vector<BvhLeaf *> &leaves) const;
475
476        /** Returns bounding box of the whole tree (= bbox of root node)
477        */
478        AxisAlignedBox3 GetBoundingBox()const;
479
480        /** Returns root of the view space partitioning tree.
481        */
482        BvhNode *GetRoot() const;
483
484        /** A ray is cast possible intersecting the tree.
485                @param the ray that is cast.
486                @returns the number of intersections with objects stored in the tree.
487        */
488        //int CastRay(Ray &ray);
489
490        /** finds neighbouring leaves of this tree node.
491        */
492        int FindNeighbors(BvhLeaf *n,
493                                          vector<BvhLeaf *> &neighbors,
494                                          const bool onlyUnmailed) const;
495
496        /** Returns random leaf of BSP tree.
497                @param halfspace defines the halfspace from which the leaf is taken.
498        */
499        BvhLeaf *GetRandomLeaf(const Plane3 &halfspace);
500
501        /** Returns random leaf of BSP tree.
502                @param onlyUnmailed if only unmailed leaves should be returned.
503        */
504        BvhLeaf *GetRandomLeaf(const bool onlyUnmailed = false);
505
506        /** Casts line segment into the tree.
507                @param origin the origin of the line segment
508                @param termination the end point of the line segment
509                @returns view cells intersecting the line segment.
510        */
511    int CastLineSegment(const Vector3 &origin,
512                                                const Vector3 &termination,
513                                                ViewCellContainer &viewcells);
514               
515        /** Sets pointer to view cells manager.
516        */
517        void SetViewCellsManager(ViewCellsManager *vcm);
518
519        /** Writes tree to output stream
520        */
521        bool Export(OUT_STREAM &stream);
522
523        /** Returns or creates a new intersectable for use in a kd based pvs.
524                The OspTree is responsible for destruction of the intersectable.
525        */
526        BvhIntersectable *GetOrCreateBvhIntersectable(BvhNode *node);
527
528        /** Collects rays.
529        */
530        void CollectRays(const ObjectContainer &objects, VssRayContainer &rays) const;
531
532        /** Intersects box with the tree and returns the number of intersected boxes.
533                @returns number of view cells found
534        */
535        int ComputeBoxIntersections(
536                const AxisAlignedBox3 &box,
537                ViewCellContainer &viewCells) const;
538
539        /** Returns leaf the point pt lies in, starting from root.
540        */
541        BvhLeaf *GetLeaf(Intersectable *obj, BvhNode *root = NULL) const;
542
543        /** Sets a pointer to the view cells tree.
544        */
545        ViewCellsTree *GetViewCellsTree() const { return mViewCellsTree; }
546        /** See Get
547        */
548        void SetViewCellsTree(ViewCellsTree *vt) { mViewCellsTree = vt; }
549
550
551protected:
552
553        /** Returns true if tree can be terminated.
554        */
555        bool LocalTerminationCriteriaMet(const BvhTraversalData &data) const;
556
557        /** Returns true if global tree can be terminated.
558        */
559        bool GlobalTerminationCriteriaMet(const BvhTraversalData &data) const;
560
561        /** For sorting the objects during the heuristics
562        */
563        struct SortableEntry
564        {
565                Intersectable *mObject;
566                float mPos;
567
568                SortableEntry() {}
569
570                SortableEntry(Intersectable *obj, const float pos):
571                mObject(obj), mPos(pos)
572                {}
573
574                bool operator<(const SortableEntry &b) const
575                {
576                        return mPos < b.mPos;
577                }
578        };
579
580        /** Evaluate balanced object partition.
581        */
582        float EvalLocalObjectPartition(
583                const BvhTraversalData &tData,
584                const int axis,
585                ObjectContainer &objectsFront,
586                ObjectContainer &objectsBack);
587
588        float EvalSah(
589                const BvhTraversalData &tData,
590                const int axis,
591                ObjectContainer &objectsFront,
592                ObjectContainer &objectsBack);
593
594        /** Computes priority of the traversal data and stores it in tData.
595        */
596        void EvalPriority(BvhTraversalData &tData) const;
597
598        /** Evaluates render cost of the bv induced by these objects
599        */
600        float EvalRenderCost(const ObjectContainer &objects) const;
601
602        /** Evaluates tree stats in the BSP tree leafs.
603        */
604        void EvaluateLeafStats(const BvhTraversalData &data);
605
606        /** Subdivides node using a best split priority queue.
607            @param tQueue the best split priority queue
608                @param splitCandidate the candidate for the next split
609                @param globalCriteriaMet if the global termination criteria were already met
610                @returns new root of the subtree
611        */
612        BvhNode *Subdivide(
613                SplitQueue &tQueue,
614                SubdivisionCandidate *splitCandidate,
615                const bool globalCriteriaMet);
616       
617        /** Subdivides leaf.
618                @param sc the subdivisionCandidate holding all necessary data for subdivision           
619               
620                @param frontData returns the traversal data for the front node
621                @param backData returns the traversal data for the back node
622
623                @returns the new interior node = the of the subdivision
624        */
625        BvhInterior *SubdivideNode(
626                const BvhSubdivisionCandidate &sc,
627                BvhTraversalData &frontData,
628                BvhTraversalData &backData);
629
630        /** Splits the objects for the next subdivision.
631                @returns cost for this split
632        */
633        float SelectObjectPartition(
634                const BvhTraversalData &tData,
635                ObjectContainer &frontObjects,
636                ObjectContainer &backObjects);
637       
638        /** Writes the node to disk
639                @note: should be implemented as visitor.
640        */
641        void ExportNode(BvhNode *node, OUT_STREAM &stream);
642
643        void ExportObjects(BvhLeaf *leaf, OUT_STREAM &stream);
644
645        /** Returns estimated memory usage of tree.
646        */
647        float GetMemUsage() const;
648
649        /** Associates the objects with their bvh leaves.
650        */
651        static void AssociateObjectsWithLeaf(BvhLeaf *leaf);
652
653
654        /////////////////////////////
655        // Helper functions for local cost heuristics
656       
657        /** Prepare split candidates for cost heuristics using axis aligned splits.
658                @param node the current node
659                @param axis the current split axis
660        */
661        void PrepareLocalSubdivisionCandidates(
662                const BvhTraversalData &tData,
663                const int axis);
664
665        static void CreateLocalSubdivisionCandidates(
666                const ObjectContainer &objects,
667                SortableEntryContainer **subdivisionCandidates,
668                const bool sort,
669                const int axis);
670
671        /** Computes object partition with the best cost according to the heurisics.
672                @param tData the traversal data
673                @param axis the split axis
674                @param objectsFront the objects in the front child bv
675                @param objectsBack the objects in the back child bv
676                @param backObjectsStart the iterator marking the position where the back objects begin
677
678                @returns relative cost (relative to parent cost)
679        */
680        float EvalLocalCostHeuristics(
681                const BvhTraversalData &tData,
682                const int axis,
683                ObjectContainer &objectsFront,
684                ObjectContainer &objectsBack);
685
686        /** Evaluates the contribution to the front and back volume
687                when this object is changing sides in the bvs.
688
689                @param object the object
690                @param volLeft updates the left pvs
691                @param volPvs updates the right pvs
692        */
693        void EvalHeuristicsContribution(
694                Intersectable *obj,
695                float &volLeft,
696                float &volRight);
697
698        /** Prepares objects for the cost heuristics.
699                @returns sum of volume of associated view cells
700        */
701        float PrepareHeuristics(const BvhTraversalData &tData, const int axis);
702       
703        ////////////////////////////////////////////////
704
705
706        /** Prepares construction for vsp and osp trees.
707        */
708        AxisAlignedBox3 EvalBoundingBox(
709                const ObjectContainer &objects,
710                const AxisAlignedBox3 *parentBox = NULL) const;
711
712        /** Collects list of invalid candidates. Candidates
713                are invalidated by a view space subdivision step
714                that affects this candidate.
715        */
716        void CollectDirtyCandidates(
717                BvhSubdivisionCandidate *sc,
718                vector<SubdivisionCandidate *> &dirtyList);
719
720        /** Collect view cells which see this bvh leaf.
721        */
722        void CollectViewCells(
723                const ObjectContainer &objects,
724                ViewCellContainer &viewCells,
725                const bool setCounter = false) const;
726
727        /** Counts the view cells of this object. note: only
728                counts unmailed objects.
729        */
730        int CountViewCells(Intersectable *obj) const;
731
732        /** Counts the view cells seen by this bvh leaf
733        */
734        int CountViewCells(const ObjectContainer &objects) const;
735
736        /** Collects view cells which see an object.
737        */
738        void CollectViewCells(
739                Intersectable *object,
740                ViewCellContainer &viewCells,
741                const bool useMailBoxing,
742                const bool setCounter = false) const;
743
744        /** Evaluates increase in pvs size.
745        */
746        int EvalPvsEntriesIncr(BvhSubdivisionCandidate &splitCandidate) const;
747
748        /** Rays will be clipped to the bounding box.
749        */
750        void PreprocessRays(
751                BvhLeaf *root,
752                const VssRayContainer &sampleRays,
753                RayInfoContainer &rays);
754
755        /** Print the subdivision stats in the subdivison log.
756        */
757        void PrintSubdivisionStats(const SubdivisionCandidate &tData);
758
759        /** Prints out the stats for this subdivision.
760        */
761        void AddSubdivisionStats(
762                const int viewCells,
763                const float renderCostDecr,
764                const float totalRenderCost);
765
766        /** Stores rays with objects that see the rays.
767        */
768        int AssociateObjectsWithRays(const VssRayContainer &rays) const;
769
770        /** Tests if object is in this leaf.
771                @note: assumes that objects are sorted by their id.
772        */
773        bool IsObjectInLeaf(BvhLeaf *, Intersectable *object) const;
774
775        /** Prepares the construction of the bv hierarchy and returns
776                the first subdivision candidate.
777        */
778        SubdivisionCandidate *PrepareConstruction(
779                const VssRayContainer &sampleRays,
780                const ObjectContainer &objects);
781
782        /** Resets bv hierarchy. E.g. deletes root and resets stats.
783        */
784        SubdivisionCandidate *Reset(
785                const VssRayContainer &rays,
786                const ObjectContainer &objects);
787
788        /** Evaluates volume of view cells that see the objects.
789        */
790        float EvalViewCellsVolume(const ObjectContainer &objects) const;
791
792        /** Assigns or newly creates initial list of sorted objects.
793        */
794        void AssignInitialSortedObjectList(BvhTraversalData &tData);
795
796        /** Assigns sorted objects to front and back data.
797        */
798        void AssignSortedObjects(
799                const BvhSubdivisionCandidate &sc,
800                BvhTraversalData &frontData,
801                BvhTraversalData &backData);
802       
803        /** Creates new root of hierarchy.
804        */
805        void CreateRoot(const ObjectContainer &objects);
806
807protected:
808       
809        /// pre-sorted subdivision candidtes for all three directions.
810        vector<SortableEntry> *mGlobalSubdivisionCandidates[3];
811        /// pointer to the hierarchy of view cells
812        ViewCellsTree *mViewCellsTree;
813        /// The view cells manager
814        ViewCellsManager *mViewCellsManager;
815        /// candidates for placing split planes during cost heuristics
816        vector<SortableEntry> *mSubdivisionCandidates;
817        /// Pointer to the root of the tree
818        BvhNode *mRoot;
819        /// Statistics for the object space partition
820        BvhStatistics mBvhStats;       
821        /// box around the whole view domain
822        AxisAlignedBox3 mBoundingBox;
823        /// the hierarchy manager
824        HierarchyManager *mHierarchyManager;
825
826
827        ////////////////////
828        //-- local termination criteria
829
830        /// maximal possible depth
831        int mTermMaxDepth;
832        /// mininum probability
833        float mTermMinProbability;
834        /// minimal number of objects
835        int mTermMinObjects;
836        /// maximal acceptable cost ratio
837        float mTermMaxCostRatio;
838        /// tolerance value indicating how often the max cost ratio can be failed
839        int mTermMissTolerance;
840        /// minimum number of rays
841        int mTermMinRays;
842
843
844        ////////////////////
845        //-- global termination criteria
846
847        /// the minimal accepted global cost ratio
848        float mTermMinGlobalCostRatio;
849        //// number of accepted misses of the global cost ratio
850        int mTermGlobalCostMissTolerance;
851        /// maximal number of view cells
852        int mTermMaxLeaves;
853        /// maximal tree memory
854        float mMaxMemory;
855        /// the tree is out of memory
856        bool mOutOfMemory;
857
858
859        ////////////////////////////////////////
860        //-- split heuristics based parameters
861       
862        bool mUseCostHeuristics;
863        /// balancing factor for PVS criterium
864        float mCtDivCi;
865        /// if only driving axis should be used for split
866        bool mOnlyDrivingAxis;
867        /// current time stamp (used for keeping split history)
868        int mTimeStamp;
869        // if rays should be stored in leaves
870        bool mStoreRays;
871        // subdivision stats output file
872        ofstream  mSubdivisionStats;
873        /// keeps track of cost during subdivision
874        float mTotalCost;
875        /// keeps track of overall pvs size during subdivision
876        int mTotalPvsSize;
877        /// number of currenly generated view cells
878        int mCreatedLeaves;
879        /// represents min and max band for sweep
880        float mSplitBorder;
881        /// weight between render cost decrease and node render cost
882        float mRenderCostDecreaseWeight;
883        /// stores the kd node intersectables used for pvs
884        BvhIntersectableMap mBvhIntersectables;
885        /// if the objects should be sorted in one global step
886        bool mUseGlobalSorting;
887
888        SortableEntryContainer *mSortedObjects[3];
889};
890
891}
892
893#endif
Note: See TracBrowser for help on using the repository browser.