source: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h @ 2604

Revision 2604, 38.8 KB checked in by mattausch, 16 years ago (diff)
RevLine 
[440]1#ifndef _ViewCellsManager_H__
2#define _ViewCellsManager_H__
3
4#include "Ray.h"
[2105]5#include "SimpleRay.h"
[440]6#include "VssRay.h"
7#include "Containers.h"
[475]8#include "ViewCell.h"
[2598]9#include "RandomViewCellsHandler.h"
[440]10
[2598]11
[2332]12#define TEST_PACKETS 0
[2176]13
[860]14namespace GtpVisibilityPreprocessor {
15
[440]16class ViewCell;
17class Intersectable;
18class RenderSimulator;
[480]19class Renderer;
[440]20class Mesh;
21struct Triangle3;
22class SimulationStatistics;
23class BspTree;
24class KdTree;
[1006]25class VspOspTree;
[440]26class VspBspTree;
27class KdNode;
28class KdLeaf;
29class AxisAlignedBox3;
[448]30class BspLeaf;
[475]31class ViewCellsStatistics;
[482]32class Exporter;
[532]33class Beam;
[570]34class Preprocessor;
[580]35class ViewCellsTree;
36class MergeCandidate;
[931]37class BoundingBoxConverter;
[1021]38class VspTree;
39class OspTree;
40class VspNode;
[1027]41class HierarchyManager;
[1259]42class BvHierarchy;
[1264]43class ViewCellsTree;
[1786]44class ViewCell;
[1903]45class MixtureDistribution;
[1047]46struct AxisAlignedPlane;
[475]47struct BspRay;
[2116]48class BspTree;
[2598]49//class RandomViewCellsHandler;
[475]50
[1903]51
[2116]52struct PvsFilterStatistics
53{
[1773]54        PvsFilterStatistics():
[2116]55        mAvgFilterRadius(0.0f), mLocalFilterCount(0), mGlobalFilterCount(0) {}
56       
[1761]57        float mAvgFilterRadius;
58        int mLocalFilterCount;
59        int mGlobalFilterCount;
[2116]60};
61
[1145]62/** Probably Visible Set
63*/
[697]64class PrVs
65{
66public:
[2116]67        /// root of view cells tree
68        ViewCell *mViewCell;
69        // input parameter is the render budget for the PrVs
70        float mRenderBudget;
[677]71};
72
[1786]73
74class LocalMergeNode
75{
76public:
77        virtual ~LocalMergeNode() {};
78        virtual bool IsLeaf() const = 0;
79};
80
81
[2571]82struct VizBuffer
83{
[2604]84        VizBuffer(): mIndex(0), mMaxSize(1000)
[2571]85        {
86        }
87
88        int GetSize() const {return (int)mVizRays.size();}
89
90        void AddRay(VssRay *ray)
91        {
92                if (mVizRays.size() < mMaxSize)
93                        mVizRays.push_back(ray);
94                else
95                        mVizRays[mIndex] = ray;
96               
97                mIndex = (mIndex + 1) % mMaxSize;
98        }
99
100        VssRayContainer &GetRays() { return mVizRays;}
101
102        VssRay *GetRay(int i) { return mVizRays[i % 100];}
103
104protected:
105
106        const int mMaxSize;
107        int mIndex;
108        VssRayContainer mVizRays;
109};
110
111
[850]112/**     Manages different higher order operations on the view cells.
[440]113*/
114class ViewCellsManager
115{
116public:
[1983]117
[2116]118        struct PerViewCellStat
119        {
120                float pvsSize;
121                float relPvsIncrease;
[1983]122        };
123
[2116]124        struct SamplesStatistics
[728]125        {
[2116]126                int mRays;
127                int mViewCells;
128                int mContributingRays;
129                int mPvsContributions;
[2586]130                float mRayLengths;
131
[2116]132                void Reset()
133                {
[2586]134                        mRayLengths = 0.0f;
[2116]135                        mRays = 0;
136                        mViewCells = 0;
137                        mContributingRays = 0;
138                        mPvsContributions = 0;
139                };
140        };
[1974]141
[2116]142        struct PvsStatistics
143        {
144                float minPvs;
145                float maxPvs;
146                float avgPvs;
[2205]147                float renderCost;
[2116]148                float avgPvsEntries;
149
150                float avgFilteredPvs;
151                float avgFilteredPvsEntries;
152
153                float avgFilterContribution;
154                float avgFilterRadius;
155                float avgFilterRatio;
156                float avgRelPvsIncrease;
157                float devRelPvsIncrease;
158                int viewcells;
[2224]159
160                float mem;
[2227]161                float renderCostRatio;
[1545]162        };
[1942]163 
[728]164        /// view cell container types
[1021]165        enum {BSP, KD, VSP_KD, VSP_BSP, VSP_OSP};
[466]166 
[931]167        /// render cost evaluation type
[728]168        enum {PER_OBJECT, PER_TRIANGLE};
169
[1545]170        friend class X3dViewCellsParseHandlers;
[1709]171
[1004]172        /** Default constructor.
[440]173        */
[1264]174        ViewCellsManager(ViewCellsTree *viewCellsTree);
[2539]175        /** Destructor.
176        */
[462]177        virtual ~ViewCellsManager();
[527]178        /** Constructs view cells container taking a preprocessor
[570]179                @returns the output rays (if not null)
180        */
181        int Construct(Preprocessor *preprocessor, VssRayContainer *outRays = NULL);
[527]182
[440]183        /** Constructs view cell container with a given number of samples.
184        */
[1709]185        virtual int ConstructSubdivision(const ObjectContainer &objects,
186                                                                         const VssRayContainer &rays) = 0;
[440]187
[441]188        /** Computes sample contributions of the rays to the view cells PVS.
189       
190                @param rays bundle of rays used to find intersections with view cells and
191                adding the contribution
[563]192                @param addRays true if rays should be added to the PVSs of the viewcells they
[574]193                intersect
194                @param storeViewCells true if view cells should be stored in the ray
195        */
[2332]196        virtual float ComputeSampleContributions(const VssRayContainer &rays,
197                                                     const bool addContributions,
198                                                                                         const bool storeViewCells,
199                                                                                         const bool useHitObject = false);
[440]200
[475]201        /** Computes sample contribution of a simgle ray to the view cells PVS.
202                @param ray finds intersections with view cells and holds the contribution
[1570]203                @param addSample if sample should be added to the pvs
204                 
[475]205                @returns number of sample contributions
206        */
[1159]207        virtual float ComputeSampleContribution(VssRay &ray,
[1981]208                                                                                        const bool addContributions,
[1990]209                                                                                        const bool storeViewCells,
210                                                                                        const bool useHitObject = false);
[1977]211        /** Compute sample contribution only for current view cell.
212        */
213        virtual float ComputeSampleContribution(VssRay &ray,
[1981]214                                                                                        const bool addContributions,
[1990]215                                                                                        ViewCell *currentViewCell,
216                                                                                        const bool useHitObject = false);
[452]217        /** Prints out statistics of the view cells.
218        */
[2176]219        virtual void PrintStatistics(std::ostream &s) const;
[440]220        /** Post processes view cells givemŽa number of rays.
221        */
[475]222        virtual int PostProcess(const ObjectContainer &objects,
223                                                        const VssRayContainer &rays) = 0;
[440]224        /** Show visualization of the view cells.
225        */
226        virtual void Visualize(const ObjectContainer &objects,
[466]227                                                   const VssRayContainer &sampleRays) = 0;
[1982]228        /** collect objects intersecting a given spatial box.
229        */
230        virtual void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects);
[440]231        /** type of the view cell container.
232        */
233        virtual int GetType() const = 0;
[463]234        /** Load the input viewcells. The input viewcells should be given as a collection
[1545]235                of meshes. Each mesh is assume to form a bounded polyhedron
236                defining the interior of the viewcell. The view cells manager
237                is responsible for building a hierarchy over these view cells.
[463]238               
239                @param filename file to load
240                @return true on success
[1982]241        */
242        virtual bool LoadViewCellsGeometry(const string filename, const bool extrudeBaseTriangle);
[440]243        /** Merges two view cells.
244                @note the piercing rays of the front and back will be ordered   
245                @returns new view cell based on the merging.
246        */
[582]247        ViewCellInterior *MergeViewCells(ViewCell *front, ViewCell *back) const;
248        /** Merges a container of view cells.
249                @returns new view cell based on the merging.
250        */
251        ViewCellInterior *MergeViewCells(ViewCellContainer &children) const;
[1545]252        /** Generates view cell of the type specified by this manager
[440]253        */
[580]254        virtual ViewCell *GenerateViewCell(Mesh *mesh = NULL) const = 0;
[1545]255        /** Constructs view cell from base triangle.
256                The view cell is extruded along the normal vector.
257                @param the base triangle
258                @param the height of the newly created view cell
[440]259        */
[1545]260        ViewCell *ExtrudeViewCell(const Triangle3 &baseTri, const float height) const;
[2539]261        /** Returns the intersectable that was hit by the ray.
262        */
[1982]263        virtual Intersectable *GetIntersectable(const VssRay &ray, const bool isTermination) const;
[440]264        /** Sets maximal number of samples used for the
265                construction of the view cells.
266        */
267        void SetVisualizationSamples(const int visSamples);
[574]268        /** Sets maximal number of samples used for the construction of the view cells.
[440]269        */
270        void SetConstructionSamples(const int constructionSamples);
[574]271        /** Sets maximal number of samples used for the visualization of the view cells.
272        */
273        void SetInitialSamples(const int initialSamples);
[440]274        /** Sets maximal number of samples used for the post processing of the view cells.
275        */
276        void SetPostProcessSamples(const int postProcessingSamples);
277        /** See set.
278        */
279        int GetVisualizationSamples() const;
280        /** See set.
281        */
282        int GetConstructionSamples() const;
283        /** See set.
284        */
285        int GetPostProcessSamples() const;
[1002]286        /** Returns true if view cells are already constructed.
[440]287        */
288        virtual bool ViewCellsConstructed() const = 0;
[477]289        /** cast line segment to get a list of unique viewcells which are intersected
290                by this line segment
291        */
[1977]292        virtual int CastLineSegment(const Vector3 &origin,
[2539]293                                                            const Vector3 &termination,
294                                                            ViewCellContainer &viewcells) = 0;
[1977]295        /** Tests if this line segment intersects a particular view cell.
296        */
297        virtual bool LineSegmentIntersects(const Vector3 &origin,
298                                                                           const Vector3 &termination,
299                                                                           ViewCell *viewCell) = 0;
[1294]300        /** Returns a stats about the global pvs.
301        */
[477]302        virtual void GetPvsStatistics(PvsStatistics &stat);
[2539]303        /** Returns the probably visible set of the view space filtered pvs.
304        */
[904]305        virtual void GetPrVS(const Vector3 &viewPoint, PrVs &prvs, const float filterWidth);
[2111]306        /** Get a viewcell containing the specified view point.
[879]307                @param active if the active or elementary view cell should be returned.
[697]308        */
[879]309        virtual ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const = 0;
[2539]310        /** Returns the view cell with the given index (different from the id).
311        */
[1982]312        ViewCell *GetViewCell(const int idx) const {return mViewCells[idx];}
[2539]313        /** Prints the statistics over the view cell pvss.
314        */
[2176]315        virtual void PrintPvsStatistics(std::ostream &s);
[719]316        /** Updates pvs of the view cell hierarchy if necessary.
317        */
318        void UpdatePvs();
[477]319        /** Returns probability that view point lies in one view cell.
320        */
321        virtual float GetProbability(ViewCell *viewCell) = 0;
322        /** Returns render cost of a single view cell given the render cost of an object.
323        */
[728]324        float GetRendercost(ViewCell *viewCell) const;
[720]325        /** Returns reference to container of loaded / generated view cells.
[477]326        */
327        ViewCellContainer &GetViewCells();
[485]328        /** Helper function used to split ray sets uniformly
329                into one that is currently used and the other that
330                is saved for later processing.
331                @param sourceRays the input ray set
332                @param maxSize the maximal number of rays that will be used
333                @param usedRays returns the used ray set
334                @param savedRays if not null, returns the saved ray set
[477]335        */
336        void GetRaySets(const VssRayContainer &sourceRays,
[485]337                                        const int maxSize,
338                                        VssRayContainer &usedRays,
339                                        VssRayContainer *savedRays = NULL) const;
[480]340        /** Returns accumulated area of all view cells.
341        */
342        float GetAccVcArea();
343        /** Returns area of one view cell.
344        */
345        virtual float GetArea(ViewCell *viewCell) const;
[551]346        /** Returns volume of view cell.
[480]347        */
348        virtual float GetVolume(ViewCell *viewCell) const;
349        /** Sets the current renderer mainly for view cells statistics.
350        */
351        void SetRenderer(Renderer *renderer);
[487]352        /** Computes a (random) view point in the valid view space.
353                @returns true if valid view point was found
354        */
355        virtual bool GetViewPoint(Vector3 &viewPoint) const;
[2539]356        /** Returns the current view point given a vector for activating the halton sequence.
357        */
[1982]358        virtual bool GetViewPoint(Vector3 &viewPoint, const Vector3 &params) const;
[490]359        /** Returns true if this view point is in the valid view space.
360        */
361        virtual bool ViewPointValid(const Vector3 &viewPoint) const;
[487]362        /** Sets a view space boundary.
363        */
364        void SetViewSpaceBox(const AxisAlignedBox3 &box);
[2539]365        /** Returns the boundaries of the view space.
366        */
[519]367        AxisAlignedBox3 GetViewSpaceBox() const;
[503]368        /** Creates mesh for this view cell.
369        */
[2575]370        virtual void CreateMesh(ViewCell *vc) = 0;
[508]371        /** Writes view cells to disc.
372        */
[1027]373        virtual bool ExportViewCells(const string filename,
[2575]374                                     const bool exportPvs,
375                                     const ObjectContainer &objects);
[532]376        /** Casts beam to collect view cells.
377        */
378        virtual int CastBeam(Beam &beam);
[547]379        /** Checks if view cell is considered as valid.
380        */
[561]381        virtual bool CheckValidity(ViewCell *vc,
[562]382                                                           int minPvsSize,
383                                                           int maxPvsSize) const;
[2539]384        /** Resort pvss after a pass of the algorithm.
385        */
[2117]386        void  SortViewCellPvs();
[2539]387        /** Map the ray intersection objects from triangles to high level objects.
388        */
[2117]389        void DeterminePvsObjects(VssRayContainer &rays,
390                                                         const bool useHitObjects = false);
[562]391        /** Sets validity of view cell
392        */
393        virtual void SetValidity(ViewCell *vc,
394                                                         int minPvsSize,
395                                                         int maxPvsSize) const;
[710]396        /** sets validy of all viewcells
397        */
[2539]398        virtual void SetValidity(int minPvsSize, int maxPvsSize) const;
[2117]399        /** Set valid viewcells in the range of pvs. sorts the viewcells
400                according to the pvs and then pickups those in the ranges
401        */
[710]402        void SetValidityPercentage(const float minValid, const float maxValid);
[1545]403        /** Returns number of valid view cells.
404        */
[609]405    int CountValidViewcells() const;
[547]406        /** Returns maximal allowed pvs size.
407        */
408        int GetMaxPvsSize() const;
[562]409        /** Returns maximal allowed pvs size.
410        */
411        int GetMinPvsSize() const;
[561]412        /** Returns maximal ratio. i.e., currentPVs / maxPvs,
413                where pvs is still considered valid.
414        */
415        float GetMaxPvsRatio() const;
[547]416        /** Exports view cell geometry.
417        */
[2117]418        virtual void ExportViewCellGeometry(Exporter *exporter,
419                                                                                ViewCell *vc,
420                                                                                const AxisAlignedBox3 *box,
421                                                                                const AxisAlignedPlane *clipPlane = NULL
422                                                                                ) const = 0;
[860]423        /** Brings the view cells into their final state, computes meshes and volume.
424        */
[551]425        virtual void FinalizeViewCells(const bool createMesh);
[579]426        /** Evaluates statistics values on view cells.
427        */
[580]428        void EvaluateRenderStatistics(float &totalRenderCost,
429                                                                  float &expectedRenderCost,
430                                                                  float &deviation,
431                                                                  float &variance,
[1709]432                                                                  float &totalPvs,
[580]433                                                                  float &avgRenderCost);
434        /** Returns hierarchy of the view cells.
435        */
436        ViewCellsTree *GetViewCellsTree();
[1545]437        /** Collect candidates for the view cell merge.
438        */
[581]439        virtual void CollectMergeCandidates(const VssRayContainer &rays,
[1022]440                                                                                vector<MergeCandidate> &candidates);
[1294]441        /** Collects n view cells and stores it as the active view cells.
442        */
[610]443        void CollectViewCells(const int n);
[1686]444        /** Sets current view cells set to active,
445                i.e., the sampling is done in this view cell set.
[660]446        */
447        void SetViewCellsActive();
[1145]448        /** Evaluates render cost statistics of current view cell hierarchy.
[660]449        */
[1178]450        virtual void EvalViewCellPartition();
[728]451        /** Sets maximal size of a view cell filter.
452        */
453        void SetMaxFilterSize(const int size);
[840]454        /** Returns maximal filter size.
455        */
456        int GetMaxFilterSize() const;
[1686]457        /** Deletes interior nodes from the tree which have negative
458                merge cost set (local merge).
[840]459        */ 
460        void DeleteLocalMergeTree(ViewCell *vc) const;
[728]461        /** Evaluautes histogram for a given number of view cells.
462        */
463        void EvalViewCellHistogram(const string filename, const int nViewCells);
[735]464        /** Evaluautes histogram for a given number of view cells.
465        */
[2117]466        void EvalViewCellHistogramForPvsSize(const string filename,
467                                                                                 const int nViewCells);
[2539]468        /** Evaluautes histogram for a given vector of view cells.
469        */
[1919]470        void EvalViewCellHistogramForPvsSize(const string filename,
471                                                                                 ViewCellContainer &viewCells);
[2332]472        float ComputeRenderCost(const int tri, const int obj); //const
[2569]473        /** Sets pvs size of a view cell as a scalar. Used when storing pvs only in the leaves
[1002]474                of the hierarchy.
475        */
[2117]476        void UpdateScalarPvsSize(ViewCell *vc,
477                                                         const float pvsCost,
478                                                         const int entriesInPvs) const;
[2569]479        /** Sets render cost of a view cell as a scalar.
480        */
481        void UpdateScalarPvsCost(ViewCell *vc, const float pvsCost) const;
482
[870]483        /** Returns bounding box of a view cell.
484        */
485        AxisAlignedBox3 GetViewCellBox(ViewCell *vc);
[840]486        /** Exports bounding boxes of objects to file.
487        */
[2117]488        bool ExportBoundingBoxes(const string filename,
489                                                         const ObjectContainer &objects) const;
[850]490        /** Load the bounding boxes into the container.
491        */
[2117]492        bool LoadBoundingBoxes(const string filename,
493                                                  IndexedBoundingBoxContainer &boxes) const;
[1002]494        /** Returns true if pvs should be exported together with the view cells.
495        */
496        bool GetExportPvs() const;
[1786]497        /** Efficiently merges the view cells in the container.
498        */
[1787]499        void MergeViewCellsRecursivly(ObjectPvs &pvs,
500                                                                  const ViewCellContainer &viewCells) const;
[2539]501        /** Compresses the view cells.
[2117]502        */
[1845]503        virtual void CompressViewCells();
[2539]504        /** Returns view cell with the given id.
505        */
[2017]506        ViewCell *GetViewCellById(const int id);
507        /** Returns number of view cells.
508        */
[1982]509        int GetNumViewCells() const;
[2598]510        /** Returns the stored list of view cells and view points.
511        */
512        ViewCellPointsList *GetViewCellPointsList();
513        /** Exports list of random view cells.
514        */
[2048]515        bool ExportRandomViewCells(const string &filename);
[2598]516        /** Imports list of random view cells and view points.
517        */
518        bool ImportViewCellsList(const string &filename);
[2048]519
[2017]520
521        //////////////
[1582]522        // static members
523       
524        /** Loads view cells from file. The view cells manager is created with
525                respect to the loaded view cells.
[870]526
[1582]527                @param filename the filename of the view cells
528                @param objects the scene objects
[2115]529                @param finalizeViewCells if the view cells should be post processed, i.e.,
[2048]530                           a mesh is created representing the geometry
[1582]531                @param bconverter a conversion routine working with the similarities of bounding
[2048]532                           boxes: if there is a certain similarity of overlap between
533                           bounding boxes, two tested candidate objects are considered
534                           to be the same objects
[1582]535                @returns the view cells manager if loading was successful, false otherwise
536        */
537        static ViewCellsManager *LoadViewCells(const string &filename,
[2113]538                                                                                   ObjectContainer &pvsObjects,
539                                                                                   ObjectContainer &preprocessorObjects,
[1676]540                                                                                   bool finalizeViewCells = false,
[1582]541                                                                                   BoundingBoxConverter *bconverter = NULL);
[870]542
[2542]543        /** Convenience function assuming that there are no preprocessor objects.
544        */
[2115]545        static ViewCellsManager *LoadViewCells(const string &filename,
546                                                                                   ObjectContainer &pvsObjects,
547                                                                                   bool finalizeViewCells = false,
548                                                                                   BoundingBoxConverter *bconverter = NULL);
[904]549
[2542]550
[2113]551        ///////////////////////
[2542]552        //-- visiblity filter options
[1294]553
[931]554        // TODO: write own visibiltiy filter class
[2048]555        void ApplyFilter(KdTree *kdTree,
556                                         const float viewSpaceFilterSize,
557                                         const float spatialFilterSize);
[904]558
[2048]559        // new adaptive version of the filter
560        PvsFilterStatistics ApplyFilter2(ViewCell *viewCell,
561                                                                         const bool useViewSpaceFilter,
562                                                                         const float filterSize,
563                                                                         ObjectPvs &pvs,
[2574]564                                                                         vector<AxisAlignedBox3> *filteredBoxes = NULL,
565                                                                         const bool onlyNewObjects = false);
[1715]566
[931]567        void ApplySpatialFilter(KdTree *kdTree,
568                                                        const float spatialFilterSize,
569                                                        ObjectPvs &pvs);
[480]570
[931]571         void ApplyFilter(ViewCell *viewCell,
572                                          KdTree *kdTree,
573                                          const float viewSpaceFilterSize,
574                                          const float spatialFilterSize,
575                                          ObjectPvs &pvs);
576
577        float GetFilterWidth();
578
579        float GetAbsFilterWidth();
[697]580        /** Returns the bounding box of filter width.
581        */
[2117]582        AxisAlignedBox3 GetFilterBBox(const Vector3 &viewPoint,
583                                                                  const float width) const;
[609]584
[2199]585
586
[1294]587        //////////////////////////////////////////////////////////////////
[979]588
[2048]589
[1155]590        /** If true, the kd nodes are stored instead of the object pvs.
591        */
592        void SetStoreKdPvs(const bool storeKdPvs);
593
594        /** Returns true if the kd nodes are stored instead of the object pvs.
595        **/
596        bool GetStoreKdPVs() const;
597
[1570]598        /** Exports single view cells for visualization.
599                @param objects the scene objects
600                @param limit the maximal number of output view cells
601                @param sortViewCells if the view cells should be sorted by pvs size
602                @param exportPvs if the pvs should also be exported
603                @param exportRays if sample rays should be exported as well
[1580]604                @param maxRays maximum number of rays to export
605                @param prefix the prefix for the output file
[1570]606                @param visRays additional rays
607        */
[1686]608        virtual void ExportSingleViewCells(const ObjectContainer &objects,
609                                                                           const int maxViewCells,
610                                                                           const bool sortViewCells,
611                                                                           const bool exportPvs,
612                                                                           const bool exportRays,
613                                                                           const int maxRays,
[2394]614                                                                           const string &prefix,
[2575]615                                                                           VssRayContainer *visRays = NULL) = 0;
[1570]616
[1932]617
[2048]618        void ResetPvs();
[1580]619
[2571]620        Preprocessor *GetPreprocessor() const
621        {
[1932]622                return mPreprocessor;
623        }
[1580]624
[2571]625        void SetPreprocessor(Preprocessor *p)
626        {
[1932]627                mPreprocessor = p;
628        }
[1608]629
[1932]630        void UpdatePvsForEvaluation();
631
[2571]632
633        VizBuffer mVizBuffer;
634
635
[931]636protected:
[1145]637
[2586]638        bool ComputeViewCellContribution(ViewCell *viewCell,
[1932]639                                                                         VssRay &ray,
640                                                                         Intersectable *obj,
641                                                                         const Vector3 &pt,
642                                                                         const bool addRays);
643
[1787]644        void MergeViewCellsRecursivly(ObjectPvs &pvs,
645                                                                  const ViewCellContainer &viewCells,
646                                                                  const int leftIdx,
647                                                                  const int rightIdx) const;
[697]648        /** Intersects box with the tree and returns the number of intersected boxes.
[2539]649                @returns number of view cells found
[697]650        */
[710]651        virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box,
652                                                                                ViewCellContainer &viewCells) const;
[880]653        /** Tests the visibility filter functionality.
654        */
[697]655        virtual void TestFilter(const ObjectContainer &objects) {};
[931]656        /** If the view cells tree was already constructed or not.
[581]657        */
658        bool ViewCellsTreeConstructed() const;
[1294]659        /** Requests preprocessor to cast samplesPerPass samples of a specific type.
660        */
[574]661        int CastPassSamples(const int samplesPerPass,
[1768]662                                                const vector<int> &strategies,
[574]663                                                VssRayContainer &vssRays) const;
[2542]664        /** cast samples for the purpose of evaluating the view cells solution
665        */
[2199]666        int CastEvaluationSamples(const int samplesPerPass,
667                                                          VssRayContainer &passSamples);// const;
[931]668        /** Parse the options from the environment file.
669        */
[482]670        void ParseEnvironment();
[508]671        /** Creates unique view cell ids.
672        */
673        void CreateUniqueViewCellIds();
[551]674        /** Finalizes, i.e., creates mesh, volume, area etc. for the view cell.
675        */
676        virtual void Finalize(ViewCell *viewCell, const bool createMesh);
[480]677        /** Recollects view cells and resets statistics.
678        */
679        void ResetViewCells();
[1707]680        /** Sets this view cell to active.
681        */
682        void SetViewCellActive(ViewCell *vc) const;
[480]683        /** Collects the view cells in the view cell container.
684        */
685        virtual void CollectViewCells() = 0;
[2539]686        /** Evaluates view cells statistics and stores it in mViewCellsStatistics.
[479]687        */
688        void EvaluateViewCellsStats();
[2543]689       
[482]690
[2570]691        void UpdateStatsForViewCell(ViewCell *viewCell, Intersectable *obj);
692
693
[1416]694        ///////////////////////
[482]695        //-- helper functions for view cell visualization
696
697        /** Exports the view cell partition.
698        */
[1686]699        void ExportViewCellsForViz(Exporter *exporter,
700                                                           const AxisAlignedBox3 *box,
[1760]701                                                           const bool colorCode,
[1932]702                                                           const AxisAlignedPlane *clipPlane) const;
[482]703        /** Sets exporter color.
704        */
[1773]705        virtual void ExportColor(Exporter *exporter,
706                                                         ViewCell *vc,
[2394]707                                                         const int colorCode) const;
[1416]708        /** Creates meshes from the view cells.
709        */
710        void CreateViewCellMeshes();
[1932]711        /** Creates clip plane for visualization.
[1416]712        */
713        void CreateClipPlane();
[482]714
[1416]715        AxisAlignedPlane *GetClipPlane();
[1932]716
[1551]717        void ExportMergedViewCells(const ObjectContainer &objects);
718
[2048]719
[1416]720        ///////////////////////
721
[1002]722        /** Returns volume of the view space.
723        */
[557]724        virtual float GetViewSpaceVolume();
[1416]725        /** Prepares the view cells for sampling after loading them from disc.
[503]726        */
[577]727        virtual void PrepareLoadedViewCells() {};
[704]728        /** Constructs local view cell merge hierarchy.
729        */
730        ViewCell *ConstructLocalMergeTree(ViewCell *currentViewCell,
[2539]731                                          const ViewCellContainer &viewCells);
[713]732        /** Constructs local view cell merge hierarchy based solely on similarity with the
[2048]733                current viewcell
[713]734        */
735        ViewCell *ConstructLocalMergeTree2(ViewCell *currentViewCell,
736                                                                           const ViewCellContainer &viewCells);
[860]737        /** Updates pvs of all view cells for statistical evaluation after some more sampling
738        */
[1168]739        void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs);
[2543]740        /** Export statistics of the view cells tree.
741        */
[1679]742        virtual void ExportStats(const string &mergeStats);
[2547]743        /** Loads view cells in binary mode.
744        */
745        static ViewCellsManager *LoadViewCellsBinary(const string &filename,
[2539]746                                                                                                 ObjectContainer &pvsObjects,
747                                                                                                 bool finalizeViewCells,
748                                                 BoundingBoxConverter *bconverter);
[2543]749        /** This helper function loads the bounding boxes for a binary solution.
750        */
[2547]751        static void LoadIndexedBoundingBoxesBinary(IN_STREAM &stream,
752                                                       IndexedBoundingBoxContainer &iboxes);
[2048]753
[2539]754
[752]755
[2543]756        ///////////
757        //-- members
[2048]758
[2199]759        ofstream mStats;
[1145]760        Preprocessor *mPreprocessor;
761        /// if bounding boxes should be exported together with the view cells
[840]762        bool mExportBboxesForPvs;
[1416]763        /// the clip plane for visualization
764        AxisAlignedPlane mClipPlaneForViz;
765        /// if the visualization is using the clip plane
[660]766        bool mUseClipPlaneForViz;
[480]767        /// Renders the view cells.
768        Renderer *mRenderer;
[440]769        /// Loaded view cells
[469]770        ViewCellContainer mViewCells;
[1416]771        /// the view cell hierarchy (i.e., the logical description of view cells)
[580]772        ViewCellsTree *mViewCellsTree;
[1414]773       
[1773]774        std::vector<int> mStrategies;
775
[1416]776        /** if the values in the view cell leaves and the interiors are up to date
777                this is meant for lazy storing of the pvs, where only a scalar indicating
778                pvs size is stored in interiors and not the pvs itself.
779        */
[719]780        bool mViewCellPvsIsUpdated;
[1002]781
[1416]782        /// maximum number of samples for the view cell construction
[440]783        int mConstructionSamples;
[574]784        int mSamplesPerPass;
785        int mInitialSamples;
[440]786        int mPostProcessSamples;
787        int mVisualizationSamples;
[441]788
[2232]789        int mEvaluationSamples;
790
[470]791        float mTotalAreaValid;
792        float mTotalArea;
[475]793
[547]794        int mMaxPvsSize;
[562]795        int mMinPvsSize;
[547]796        float mMaxPvsRatio;
797
[660]798        int mSamplingType;
[722]799        int mEvaluationSamplingType;
[600]800        int mNumActiveViewCells;
[586]801        bool mCompressViewCells;
802
[2598]803        /// Handler for generating and loading random view cells.
804        RandomViewCellsHandler *mRandomViewCellsHandler;
[2048]805
[1002]806        /// holds the current view cell statistics
[660]807        ViewCellsStatistics mCurrentViewCellsStats;
[2048]808
[487]809        /// the scene bounding box
[542]810        AxisAlignedBox3 mViewSpaceBox;
[1001]811       
[508]812        /// if view cells should be exported
813        bool mExportViewCells;
[1002]814        // if only valid view cells should be considered for processing
[564]815        bool mOnlyValidViewCells;
[580]816        /// if rays should be used to collect merge candidates
817        bool mUseRaysForMerge;
[1002]818        /// if there should be an additional merge step after the subdivision
[592]819        bool mMergeViewCells;
[697]820        /// the width of the box filter
821        float mFilterWidth;
[1570]822        /// Maximal size of the filter in terms of contributing view cells
[697]823        int mMaxFilterSize;
[2538]824        /// only for debugging: stores some rays used during view cell construction
[1686]825        VssRayContainer storedRays;
[2538]826        /// if kd node based pvs is used for preprocessing
[1902]827        bool mUseKdPvs;
[2538]828        /// types of distributions used for sampling
[1903]829        MixtureDistribution *mMixtureDistribution;
830
[2048]831
[2571]832
[1545]833        //////////////////
[487]834        //-- visualization options
835       
[1002]836        /// color code for view cells visualization
[1570]837        bool mShowVisualization;
[487]838        int mColorCode;
839        bool mExportGeometry;
840        bool mExportRays;
[517]841        bool mViewCellsFinished;
[664]842        bool mEvaluateViewCells;
[844]843
844        /// if pvs should be exported with view cells
845        bool mExportPvs;
[1155]846
[1703]847        /// if view cells geometry should be used from other sources
[1545]848        bool mUsePredefinedViewCells;
[2538]849        /// the weight for one triangle in the heuristics
[2332]850        float mTriangleWeight;
[2538]851        /// the weight for one object (= one entity issued with one draw call) in the heuristics
[2332]852        float mObjectWeight;
853
854        vector<PerViewCellStat> mPerViewCellStat;
855        SamplesStatistics mSamplesStat;
[440]856};
857
[441]858
[1545]859/** Manages different higher order operations on the view cells.
[440]860*/
861class BspViewCellsManager: public ViewCellsManager
862{
863
864public:
[485]865        /** Constructor taking the bsp tree and the number of samples
866                used to construct the bsp tree.
867        */
[1264]868        BspViewCellsManager(ViewCellsTree *viewCellsTree, BspTree *tree);
[440]869
[477]870        ~BspViewCellsManager();
[1582]871
[574]872        int ConstructSubdivision(const ObjectContainer &objects,
[487]873                                  const VssRayContainer &rays);
[440]874
875        int PostProcess(const ObjectContainer &objects,
[466]876                                        const VssRayContainer &rays);
[440]877
878        void Visualize(const ObjectContainer &objects,
[466]879                                   const VssRayContainer &sampleRays);
[440]880
881        int GetType() const;
882       
883        ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
884
885        bool ViewCellsConstructed() const;
886
[475]887        //void PrintStatistics(ostream &s) const;
[452]888
[468]889        int CastLineSegment(const Vector3 &origin,
890                                                const Vector3 &termination,
891                                                ViewCellContainer &viewcells);
892       
[1294]893        /** Returns the probability that the view point lies
894                in this view cells.
895        */
[471]896        float GetProbability(ViewCell *viewCell);
[466]897
[1294]898        /** Get a viewcell containing the specified point.
[879]899        */
900        ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const;
[492]901
[1294]902        /** Creates mesh for this view cell.
903        */
[503]904        void CreateMesh(ViewCell *vc);
905
[1416]906        void ExportViewCellGeometry(Exporter *exporter,
907                                                                ViewCell *vc,
908                                                                const AxisAlignedBox3 *box,
909                                                                const AxisAlignedPlane *clipPlane = NULL
910                                                                ) const;
[580]911       
[587]912        void CollectMergeCandidates(const VssRayContainer &rays,
913                                                                vector<MergeCandidate> &candidates);
[547]914
[587]915        void Finalize(ViewCell *viewCell, const bool createMesh);
916
[1416]917        bool ExportViewCells(const string filename,
918                                                 const bool exportPvs,
919                                                 const ObjectContainer &objects);
[590]920
[752]921        /** Constructs merge hierarchy which corresponds to the spatial hierarchy.
922        */
[650]923        ViewCell *ConstructSpatialMergeTree(BspNode *root);
[610]924
[1686]925        void ExportSingleViewCells(const ObjectContainer &objects,
926                                                           const int maxViewCells,
927                                                           const bool sortViewCells,
928                                                           const bool exportPvs,
929                                                           const bool exportRays,
930                                                           const int maxRays,
[2394]931                                                           const string &prefix,
[1686]932                                                           VssRayContainer *visRays = NULL);
[1545]933
[1977]934        bool LineSegmentIntersects(const Vector3 &origin,
935                                                           const Vector3 &termination,
936                                                           ViewCell *viewCell);
937
[440]938protected:
939
[480]940        void CollectViewCells();
[547]941       
[440]942        /// the BSP tree.
943        BspTree *mBspTree;
[475]944        vector<BspRay *> mBspRays;
[440]945
946private:
947
[1545]948        /** Constructs a spatial merge tree only 2 levels deep.
949        */
950        ViewCell *ConstructDummyMergeTree(BspNode *root);
[440]951        /** Exports visualization of the BSP splits.
952        */
[477]953        void ExportSplits(const ObjectContainer &objects);
[1002]954        /** test if subdivision is valid in terms of volume / area.
955        */
[693]956        void TestSubdivision();
[440]957};
958
[1545]959
[440]960/**
961        Manages different higher order operations on the KD type view cells.
962*/
963class KdViewCellsManager: public ViewCellsManager
964{
965
966public:
967
[1264]968        KdViewCellsManager(ViewCellsTree *viewCellsTree, KdTree *tree);
[440]969
[574]970        int ConstructSubdivision(const ObjectContainer &objects,
[1686]971                                                         const VssRayContainer &rays);
[440]972
[478]973        int CastLineSegment(const Vector3 &origin,
974                                                const Vector3 &termination,
975                                                ViewCellContainer &viewcells);
[440]976
977        int PostProcess(const ObjectContainer &objects,
[466]978                                        const VssRayContainer &rays);
[440]979
980        void Visualize(const ObjectContainer &objects,
[466]981                                   const VssRayContainer &sampleRays);
[440]982
983        int GetType() const;
984
985        bool ViewCellsConstructed() const;
986
[580]987        ViewCell *GenerateViewCell(Mesh *mesh) const;
[440]988
[452]989        /** Prints out statistics of this approach.
990        */
[503]991        //  virtual void PrintStatistics(ostream &s) const;
[1416]992        ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const
993        { return NULL; }
[452]994
[503]995        float GetProbability(ViewCell *viewCell);
[609]996       
[503]997        void CreateMesh(ViewCell *vc);
998
[1686]999        void ExportViewCellGeometry(Exporter *exporter,
1000                                                                ViewCell *vc,
1001                                                                const AxisAlignedBox3 *box,
1002                                                                const AxisAlignedPlane *clipPlane = NULL) const;
[547]1003
[1416]1004
[591]1005        void CollectMergeCandidates(const VssRayContainer &rays,
1006                                                                vector<MergeCandidate> &candidates);
[580]1007
[1686]1008        void ExportSingleViewCells(const ObjectContainer &objects,
1009                                                           const int maxViewCells,
1010                                                           const bool sortViewCells,
1011                                                           const bool exportPvs,
1012                                                           const bool exportRays,
1013                                                           const int maxRays,
[2394]1014                                                           const string &prefix,
[1686]1015                                                           VssRayContainer *visRays = NULL);
[752]1016
[1977]1017        bool LineSegmentIntersects(const Vector3 &origin,
1018                                                           const Vector3 &termination,
1019                                                           ViewCell *viewCell);
1020
[440]1021protected:
1022
[580]1023        /** Collects view cells from a hierarchy.
1024        */
[480]1025        void CollectViewCells();
[580]1026
[480]1027        KdNode *GetNodeForPvs(KdLeaf *leaf);
[440]1028
[1570]1029        ////////////////////////////////////////
[440]1030
[480]1031        /// the BSP tree.
1032        KdTree *mKdTree;
[440]1033
[480]1034        /// depth of the KD tree nodes with represent the view cells
1035        int mKdPvsDepth;
[938]1036
1037
[440]1038};
1039
[1570]1040
1041/** Manages different higher order operations on the view cells.
[442]1042*/
1043class VspBspViewCellsManager: public ViewCellsManager
1044{
1045
1046public:
1047
[1264]1048        VspBspViewCellsManager(ViewCellsTree *viewCellsTree, VspBspTree *tree);
[475]1049        ~VspBspViewCellsManager();
[442]1050
[574]1051        int ConstructSubdivision(const ObjectContainer &objects,
[1686]1052                                                         const VssRayContainer &rays);
[442]1053
1054        int PostProcess(const ObjectContainer &objects,
[466]1055                                        const VssRayContainer &rays);
[442]1056
1057        void Visualize(const ObjectContainer &objects,
[466]1058                                   const VssRayContainer &sampleRays);
[442]1059
1060        int GetType() const;
1061       
1062        ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
1063
1064        bool ViewCellsConstructed() const;
[468]1065       
1066        int CastLineSegment(const Vector3 &origin,
1067                                                const Vector3 &termination,
1068                                                ViewCellContainer &viewcells);
[452]1069
[471]1070        float GetProbability(ViewCell *viewCell);
[479]1071       
[879]1072        ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const;
[477]1073
[487]1074        bool GetViewPoint(Vector3 &viewPoint) const;
1075
[490]1076        bool ViewPointValid(const Vector3 &viewPoint) const;
[503]1077
1078        void CreateMesh(ViewCell *vc);
1079
[1686]1080        bool ExportViewCells(const string filename,
1081                                                 const bool exportPvs,
1082                                                 const ObjectContainer &objects);
[508]1083
[532]1084        int CastBeam(Beam &beam);
[1416]1085       
[1686]1086        void ExportViewCellGeometry(Exporter *exporter,
1087                                                                ViewCell *vc,
1088                                                                const AxisAlignedBox3 *box,
1089                                                                const AxisAlignedPlane *clipPlane = NULL) const;
[532]1090
[547]1091
[555]1092        void Finalize(ViewCell *viewCell, const bool createMesh);
[551]1093
[1686]1094        void CollectMergeCandidates(const VssRayContainer &rays,
1095                                                                vector<MergeCandidate> &candidates);
[580]1096
[1686]1097        void ExportSingleViewCells(const ObjectContainer &objects,
1098                                                           const int maxViewCells,
1099                                                           const bool sortViewCells,
1100                                                           const bool exportPvs,
1101                                                           const bool exportRays,               
1102                                                           const int maxRays,
[2394]1103                                                           const string &prefix,
[1686]1104                                                           VssRayContainer *visRays = NULL);
[1570]1105
[1920]1106       
[1977]1107        bool LineSegmentIntersects(const Vector3 &origin,
1108                                                           const Vector3 &termination,
1109                                                           ViewCell *viewCell);
1110
[442]1111protected:
[475]1112
[1686]1113        int ComputeBoxIntersections(const AxisAlignedBox3 &box,
1114                                                                ViewCellContainer &viewCells) const;
[651]1115       
[1021]1116        /** Merges view cells according to some criteria
[442]1117        */
[508]1118        void MergeViewCells(const VssRayContainer &rays,
1119                                                const ObjectContainer &objects);
[503]1120       
[564]1121        void RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects);
[442]1122
[480]1123        void CollectViewCells();
1124
[482]1125        /** Returns maximal depth difference of view cell
1126                leaves in tree.
1127        */
1128        int GetMaxTreeDiff(ViewCell *vc) const;
1129
[752]1130        /** Prepare view cells for use after loading them from disc.
1131        */
[577]1132        void PrepareLoadedViewCells();
1133
[752]1134        /** Constructs merge hierarchy which corresponds to the spatial hierarchy.
1135        */
[650]1136        ViewCell *ConstructSpatialMergeTree(BspNode *root);
[649]1137
[979]1138        /// HACK for testing visibility filter functionality
[697]1139        void TestFilter(const ObjectContainer &objects);
1140
[979]1141        /** Visualization of the pvs difference to exact visubility using
1142                from point queries.
1143        */
1144        void VisualizeWithFromPointQueries();
[697]1145
[991]1146        /** Evaluate from point queries for the current scene.
1147        */
1148        void EvalFromPointQueries();
[979]1149
[1021]1150        /** Exports visualization of the BSP splits.
1151        */
1152        void ExportSplits(const ObjectContainer &objects,
1153                                          const VssRayContainer &rays);
[991]1154
[1686]1155
1156        /////////////////////////
1157
[442]1158        /// the view space partition BSP tree.
1159        VspBspTree *mVspBspTree;
1160
[591]1161
[442]1162private:
1163
[1021]1164        /** test if subdivision is valid in terms of volume / area.
[442]1165        */
[1021]1166        void TestSubdivision();
1167};
[442]1168
[1021]1169
[2353]1170
1171/**     Manages different higher order operations on the view cells.
[1021]1172*/
1173class VspOspViewCellsManager: public ViewCellsManager
1174{
[1740]1175        friend class ViewCellsParseHandlers;
[2542]1176        friend class ViewCellsManager;
[1977]1177
[1021]1178public:
1179
[2542]1180        /** This version takes a view cells tree and a hierarchy
1181                as input.
1182        */
[2113]1183        VspOspViewCellsManager(ViewCellsTree *vcTree,
1184                                                   const string &hierarchyType);
[1278]1185       
[1021]1186        ~VspOspViewCellsManager();
1187
1188        int ConstructSubdivision(const ObjectContainer &objects,
1189                                                         const VssRayContainer &rays);
1190
1191        int PostProcess(const ObjectContainer &objects,
1192                                        const VssRayContainer &rays);
1193
[1686]1194        void Visualize(const ObjectContainer &objects,
[1021]1195                                   const VssRayContainer &sampleRays);
1196
1197        int GetType() const;
1198       
1199        ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
1200
[2539]1201        virtual Intersectable *GetIntersectable(const VssRay &ray,
1202                                                                                        const bool isTermination) const;
[1743]1203
[1021]1204        bool ViewCellsConstructed() const;
1205
1206        int CastLineSegment(const Vector3 &origin,
1207                                                const Vector3 &termination,
1208                                                ViewCellContainer &viewcells);
1209
[1977]1210        bool LineSegmentIntersects(const Vector3 &origin,
1211                                                           const Vector3 &termination,
1212                                                           ViewCell *viewCell);
1213
[1021]1214        float GetProbability(ViewCell *viewCell);
1215       
[2113]1216        ViewCell *GetViewCell(const Vector3 &point,
1217                                                  const bool active = false) const;
[1021]1218
1219        bool GetViewPoint(Vector3 &viewPoint) const;
1220
1221        bool ViewPointValid(const Vector3 &viewPoint) const;
1222
1223        void CreateMesh(ViewCell *vc);
1224
[1027]1225        bool ExportViewCells(const string filename,
1226                                                 const bool exportPvs,
1227                                                 const ObjectContainer &objects);
[1021]1228
1229        int CastBeam(Beam &beam);
1230
1231        void Finalize(ViewCell *viewCell, const bool createMesh);
1232
[1666]1233        void ExportSingleViewCells(const ObjectContainer &objects,
1234                                                           const int maxViewCells,
1235                                                           const bool sortViewCells,
1236                                                           const bool exportPvs,
1237                                                           const bool exportRays,
1238                                                           const int maxRays,
[2394]1239                                                           const string &prefix,
[1666]1240                                                           VssRayContainer *visRays = NULL);
[2539]1241        /** See parent class.
1242        */
[2124]1243        virtual void FinalizeViewCells(const bool createMesh);
1244
[2543]1245        bool ExportViewCellsBinary(const string filename,
[2539]1246                                                           const bool exportPvs,
1247                                                           const ObjectContainer &objects);
1248
[2332]1249#if TEST_PACKETS
1250
[2353]1251        float ComputeSampleContributions(const VssRayContainer &rays,
1252                                             const bool addContributions,
1253                                                                         const bool storeViewCells,
1254                                                                         const bool useHitObjects = false);
[2332]1255#endif
1256
[2539]1257
[1021]1258protected:
[1180]1259
[2539]1260        /** View cells manager taking a view cells tree and a hierarchy as input.
1261        */
[1740]1262        VspOspViewCellsManager(ViewCellsTree *vcTree, HierarchyManager *hm);
1263       
[1709]1264        virtual void EvalViewCellPartition();
[1027]1265        /** Exports view cell geometry.
1266        */
[1666]1267        void ExportViewCellGeometry(Exporter *exporter,
1268                                                                ViewCell *vc,
1269                                                                const AxisAlignedBox3 *box,
1270                                                                const AxisAlignedPlane *clipPlane = NULL) const;
[1027]1271
[1666]1272        int ComputeBoxIntersections(const AxisAlignedBox3 &box,
1273                                                                ViewCellContainer &viewCells) const;
[1021]1274       
1275        void CollectViewCells();
1276
[1845]1277        virtual void CompressViewCells();
[1021]1278        /** Prepare view cells for use after loading them from disc.
1279        */
1280        void PrepareLoadedViewCells();
1281        /** Constructs merge hierarchy which corresponds to the spatial hierarchy.
1282        */
1283        ViewCell *ConstructSpatialMergeTree(VspNode *root);
[1074]1284        /** Exports visualization of the PVS.
[442]1285        */
[1666]1286        void ExportPvs(const ObjectContainer &objects, const VssRayContainer &rays);
[1740]1287        /** Returns a hierarchy manager of the given name.
1288        */
1289        static HierarchyManager *CreateHierarchyManager(const string &name);
[1887]1290        /** collect objects intersecting a given spatial box
[1845]1291        */
1292        virtual void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects);
[2539]1293        /** Update the cost of pvss for hierarchy objects.
1294        */
1295        float UpdateObjectCosts();
[1737]1296
[2539]1297
1298        ////////////////
1299
1300        /** Fast view cell loader in binary mode.
1301        */
[2547]1302        friend ViewCellsManager *ViewCellsManager::
1303                LoadViewCellsBinary(const std::string &filename,
1304                                    ObjectContainer &pvsObjects,
1305                                                        bool finalizeViewCells,
1306                                                        BoundingBoxConverter *bconverter);
[2539]1307
[2547]1308
[2539]1309        /** Print statistics about the view cells compression.
1310        */
[2530]1311        static void PrintCompressionStats(HierarchyManager *hm, const int pvsEntries);
[1887]1312
1313
[2530]1314        ////////////////////
1315
[2547]1316        /// if we the objects are compressed after evaluation
1317        /// this makes only sense for testing purpose
[1887]1318        bool mCompressObjects;
[2547]1319        /// hierarchy manager managing view space / object subdivision.
[1027]1320        HierarchyManager *mHierarchyManager;
[442]1321};
1322
[575]1323
[860]1324}
1325
[440]1326#endif
Note: See TracBrowser for help on using the repository browser.