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

Revision 2705, 38.8 KB checked in by mattausch, 16 years ago (diff)

enabled view cell visualization

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,
[2614]208                                                                                        bool addContributions,
209                                                                                        bool storeViewCells,
210                                                                                        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        */
[2695]364        virtual 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,
[2614]390                                                         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        */
[2705]463        void EvalViewCellHistogram(const string filename, int nViewCells);
[735]464        /** Evaluautes histogram for a given number of view cells.
465        */
[2117]466        void EvalViewCellHistogramForPvsSize(const string filename,
[2705]467                                                                                 int nViewCells);
[2539]468        /** Evaluautes histogram for a given vector of view cells.
469        */
[1919]470        void EvalViewCellHistogramForPvsSize(const string filename,
471                                                                                 ViewCellContainer &viewCells);
[2705]472        float ComputeRenderCost(int tri, 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,
[2705]477                                                         float pvsCost,
478                                                         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
[2690]586        void UpdateStatsForViewCell(ViewCell *viewCell, Intersectable *obj, int numTriangles);
[2199]587
[2625]588
[1294]589        //////////////////////////////////////////////////////////////////
[979]590
[2048]591
[1155]592        /** If true, the kd nodes are stored instead of the object pvs.
593        */
594        void SetStoreKdPvs(const bool storeKdPvs);
595
596        /** Returns true if the kd nodes are stored instead of the object pvs.
597        **/
598        bool GetStoreKdPVs() const;
599
[1570]600        /** Exports single view cells for visualization.
601                @param objects the scene objects
602                @param limit the maximal number of output view cells
603                @param sortViewCells if the view cells should be sorted by pvs size
604                @param exportPvs if the pvs should also be exported
605                @param exportRays if sample rays should be exported as well
[1580]606                @param maxRays maximum number of rays to export
607                @param prefix the prefix for the output file
[1570]608                @param visRays additional rays
609        */
[1686]610        virtual void ExportSingleViewCells(const ObjectContainer &objects,
611                                                                           const int maxViewCells,
612                                                                           const bool sortViewCells,
613                                                                           const bool exportPvs,
614                                                                           const bool exportRays,
615                                                                           const int maxRays,
[2394]616                                                                           const string &prefix,
[2575]617                                                                           VssRayContainer *visRays = NULL) = 0;
[1570]618
[1932]619
[2048]620        void ResetPvs();
[1580]621
[2571]622        Preprocessor *GetPreprocessor() const
623        {
[1932]624                return mPreprocessor;
625        }
[1580]626
[2571]627        void SetPreprocessor(Preprocessor *p)
628        {
[1932]629                mPreprocessor = p;
630        }
[1608]631
[1932]632        void UpdatePvsForEvaluation();
633
[2571]634
635        VizBuffer mVizBuffer;
636
[2638]637        /** Intersects box with the tree and returns the number of intersected boxes.
638                @returns number of view cells found
639        */
640        virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box,
641                                                                                ViewCellContainer &viewCells) const;
[2571]642
[931]643protected:
[1145]644
[2586]645        bool ComputeViewCellContribution(ViewCell *viewCell,
[1932]646                                                                         VssRay &ray,
647                                                                         Intersectable *obj,
648                                                                         const Vector3 &pt,
[2614]649                                                                         bool addRays);
[1932]650
[1787]651        void MergeViewCellsRecursivly(ObjectPvs &pvs,
652                                                                  const ViewCellContainer &viewCells,
[2614]653                                                                  int leftIdx,
654                                                                  int rightIdx) const;
655
[880]656        /** Tests the visibility filter functionality.
657        */
[697]658        virtual void TestFilter(const ObjectContainer &objects) {};
[931]659        /** If the view cells tree was already constructed or not.
[581]660        */
661        bool ViewCellsTreeConstructed() const;
[1294]662        /** Requests preprocessor to cast samplesPerPass samples of a specific type.
663        */
[574]664        int CastPassSamples(const int samplesPerPass,
[1768]665                                                const vector<int> &strategies,
[574]666                                                VssRayContainer &vssRays) const;
[2542]667        /** cast samples for the purpose of evaluating the view cells solution
668        */
[2199]669        int CastEvaluationSamples(const int samplesPerPass,
670                                                          VssRayContainer &passSamples);// const;
[931]671        /** Parse the options from the environment file.
672        */
[482]673        void ParseEnvironment();
[508]674        /** Creates unique view cell ids.
675        */
676        void CreateUniqueViewCellIds();
[551]677        /** Finalizes, i.e., creates mesh, volume, area etc. for the view cell.
678        */
679        virtual void Finalize(ViewCell *viewCell, const bool createMesh);
[480]680        /** Recollects view cells and resets statistics.
681        */
682        void ResetViewCells();
[1707]683        /** Sets this view cell to active.
684        */
685        void SetViewCellActive(ViewCell *vc) const;
[480]686        /** Collects the view cells in the view cell container.
687        */
688        virtual void CollectViewCells() = 0;
[2539]689        /** Evaluates view cells statistics and stores it in mViewCellsStatistics.
[479]690        */
691        void EvaluateViewCellsStats();
[2543]692       
[482]693
[2570]694
[1416]695        ///////////////////////
[482]696        //-- helper functions for view cell visualization
697
698        /** Exports the view cell partition.
699        */
[1686]700        void ExportViewCellsForViz(Exporter *exporter,
701                                                           const AxisAlignedBox3 *box,
[1760]702                                                           const bool colorCode,
[1932]703                                                           const AxisAlignedPlane *clipPlane) const;
[482]704        /** Sets exporter color.
705        */
[1773]706        virtual void ExportColor(Exporter *exporter,
707                                                         ViewCell *vc,
[2394]708                                                         const int colorCode) const;
[1416]709        /** Creates meshes from the view cells.
710        */
711        void CreateViewCellMeshes();
[1932]712        /** Creates clip plane for visualization.
[1416]713        */
714        void CreateClipPlane();
[482]715
[1416]716        AxisAlignedPlane *GetClipPlane();
[1932]717
[1551]718        void ExportMergedViewCells(const ObjectContainer &objects);
719
[2048]720
[1416]721        ///////////////////////
722
[1002]723        /** Returns volume of the view space.
724        */
[557]725        virtual float GetViewSpaceVolume();
[1416]726        /** Prepares the view cells for sampling after loading them from disc.
[503]727        */
[577]728        virtual void PrepareLoadedViewCells() {};
[704]729        /** Constructs local view cell merge hierarchy.
730        */
731        ViewCell *ConstructLocalMergeTree(ViewCell *currentViewCell,
[2539]732                                          const ViewCellContainer &viewCells);
[713]733        /** Constructs local view cell merge hierarchy based solely on similarity with the
[2048]734                current viewcell
[713]735        */
736        ViewCell *ConstructLocalMergeTree2(ViewCell *currentViewCell,
737                                                                           const ViewCellContainer &viewCells);
[860]738        /** Updates pvs of all view cells for statistical evaluation after some more sampling
739        */
[1168]740        void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs);
[2543]741        /** Export statistics of the view cells tree.
742        */
[1679]743        virtual void ExportStats(const string &mergeStats);
[2547]744        /** Loads view cells in binary mode.
745        */
746        static ViewCellsManager *LoadViewCellsBinary(const string &filename,
[2539]747                                                                                                 ObjectContainer &pvsObjects,
748                                                                                                 bool finalizeViewCells,
749                                                 BoundingBoxConverter *bconverter);
[2543]750        /** This helper function loads the bounding boxes for a binary solution.
751        */
[2547]752        static void LoadIndexedBoundingBoxesBinary(IN_STREAM &stream,
753                                                       IndexedBoundingBoxContainer &iboxes);
[2048]754
[2539]755
[752]756
[2543]757        ///////////
758        //-- members
[2048]759
[2199]760        ofstream mStats;
[1145]761        Preprocessor *mPreprocessor;
762        /// if bounding boxes should be exported together with the view cells
[840]763        bool mExportBboxesForPvs;
[1416]764        /// the clip plane for visualization
765        AxisAlignedPlane mClipPlaneForViz;
766        /// if the visualization is using the clip plane
[660]767        bool mUseClipPlaneForViz;
[480]768        /// Renders the view cells.
769        Renderer *mRenderer;
[440]770        /// Loaded view cells
[469]771        ViewCellContainer mViewCells;
[1416]772        /// the view cell hierarchy (i.e., the logical description of view cells)
[580]773        ViewCellsTree *mViewCellsTree;
[1414]774       
[1773]775        std::vector<int> mStrategies;
776
[1416]777        /** if the values in the view cell leaves and the interiors are up to date
778                this is meant for lazy storing of the pvs, where only a scalar indicating
779                pvs size is stored in interiors and not the pvs itself.
780        */
[719]781        bool mViewCellPvsIsUpdated;
[1002]782
[1416]783        /// maximum number of samples for the view cell construction
[440]784        int mConstructionSamples;
[574]785        int mSamplesPerPass;
786        int mInitialSamples;
[440]787        int mPostProcessSamples;
788        int mVisualizationSamples;
[441]789
[2232]790        int mEvaluationSamples;
791
[470]792        float mTotalAreaValid;
793        float mTotalArea;
[475]794
[547]795        int mMaxPvsSize;
[562]796        int mMinPvsSize;
[547]797        float mMaxPvsRatio;
798
[660]799        int mSamplingType;
[722]800        int mEvaluationSamplingType;
[600]801        int mNumActiveViewCells;
[586]802        bool mCompressViewCells;
803
[2598]804        /// Handler for generating and loading random view cells.
805        RandomViewCellsHandler *mRandomViewCellsHandler;
[2048]806
[1002]807        /// holds the current view cell statistics
[660]808        ViewCellsStatistics mCurrentViewCellsStats;
[2048]809
[487]810        /// the scene bounding box
[542]811        AxisAlignedBox3 mViewSpaceBox;
[1001]812       
[508]813        /// if view cells should be exported
814        bool mExportViewCells;
[1002]815        // if only valid view cells should be considered for processing
[564]816        bool mOnlyValidViewCells;
[580]817        /// if rays should be used to collect merge candidates
818        bool mUseRaysForMerge;
[1002]819        /// if there should be an additional merge step after the subdivision
[592]820        bool mMergeViewCells;
[697]821        /// the width of the box filter
822        float mFilterWidth;
[1570]823        /// Maximal size of the filter in terms of contributing view cells
[697]824        int mMaxFilterSize;
[2538]825        /// only for debugging: stores some rays used during view cell construction
[1686]826        VssRayContainer storedRays;
[2538]827        /// if kd node based pvs is used for preprocessing
[1902]828        bool mUseKdPvs;
[2538]829        /// types of distributions used for sampling
[1903]830        MixtureDistribution *mMixtureDistribution;
831
[2048]832
[2571]833
[1545]834        //////////////////
[487]835        //-- visualization options
836       
[1002]837        /// color code for view cells visualization
[1570]838        bool mShowVisualization;
[487]839        int mColorCode;
840        bool mExportGeometry;
841        bool mExportRays;
[517]842        bool mViewCellsFinished;
[664]843        bool mEvaluateViewCells;
[844]844
845        /// if pvs should be exported with view cells
846        bool mExportPvs;
[1155]847
[1703]848        /// if view cells geometry should be used from other sources
[1545]849        bool mUsePredefinedViewCells;
[2538]850        /// the weight for one triangle in the heuristics
[2332]851        float mTriangleWeight;
[2538]852        /// the weight for one object (= one entity issued with one draw call) in the heuristics
[2332]853        float mObjectWeight;
854
855        vector<PerViewCellStat> mPerViewCellStat;
856        SamplesStatistics mSamplesStat;
[440]857};
858
[441]859
[1545]860/** Manages different higher order operations on the view cells.
[440]861*/
862class BspViewCellsManager: public ViewCellsManager
863{
864
865public:
[485]866        /** Constructor taking the bsp tree and the number of samples
867                used to construct the bsp tree.
868        */
[1264]869        BspViewCellsManager(ViewCellsTree *viewCellsTree, BspTree *tree);
[440]870
[477]871        ~BspViewCellsManager();
[1582]872
[574]873        int ConstructSubdivision(const ObjectContainer &objects,
[487]874                                  const VssRayContainer &rays);
[440]875
876        int PostProcess(const ObjectContainer &objects,
[466]877                                        const VssRayContainer &rays);
[440]878
879        void Visualize(const ObjectContainer &objects,
[466]880                                   const VssRayContainer &sampleRays);
[440]881
882        int GetType() const;
883       
884        ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
885
886        bool ViewCellsConstructed() const;
887
[475]888        //void PrintStatistics(ostream &s) const;
[452]889
[468]890        int CastLineSegment(const Vector3 &origin,
891                                                const Vector3 &termination,
892                                                ViewCellContainer &viewcells);
893       
[1294]894        /** Returns the probability that the view point lies
895                in this view cells.
896        */
[471]897        float GetProbability(ViewCell *viewCell);
[466]898
[1294]899        /** Get a viewcell containing the specified point.
[879]900        */
901        ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const;
[492]902
[1294]903        /** Creates mesh for this view cell.
904        */
[503]905        void CreateMesh(ViewCell *vc);
906
[1416]907        void ExportViewCellGeometry(Exporter *exporter,
908                                                                ViewCell *vc,
909                                                                const AxisAlignedBox3 *box,
910                                                                const AxisAlignedPlane *clipPlane = NULL
911                                                                ) const;
[580]912       
[587]913        void CollectMergeCandidates(const VssRayContainer &rays,
914                                                                vector<MergeCandidate> &candidates);
[547]915
[587]916        void Finalize(ViewCell *viewCell, const bool createMesh);
917
[1416]918        bool ExportViewCells(const string filename,
919                                                 const bool exportPvs,
920                                                 const ObjectContainer &objects);
[590]921
[752]922        /** Constructs merge hierarchy which corresponds to the spatial hierarchy.
923        */
[650]924        ViewCell *ConstructSpatialMergeTree(BspNode *root);
[610]925
[1686]926        void ExportSingleViewCells(const ObjectContainer &objects,
927                                                           const int maxViewCells,
928                                                           const bool sortViewCells,
929                                                           const bool exportPvs,
930                                                           const bool exportRays,
931                                                           const int maxRays,
[2394]932                                                           const string &prefix,
[1686]933                                                           VssRayContainer *visRays = NULL);
[1545]934
[1977]935        bool LineSegmentIntersects(const Vector3 &origin,
936                                                           const Vector3 &termination,
937                                                           ViewCell *viewCell);
938
[440]939protected:
940
[480]941        void CollectViewCells();
[547]942       
[440]943        /// the BSP tree.
944        BspTree *mBspTree;
[475]945        vector<BspRay *> mBspRays;
[440]946
947private:
948
[1545]949        /** Constructs a spatial merge tree only 2 levels deep.
950        */
951        ViewCell *ConstructDummyMergeTree(BspNode *root);
[440]952        /** Exports visualization of the BSP splits.
953        */
[477]954        void ExportSplits(const ObjectContainer &objects);
[1002]955        /** test if subdivision is valid in terms of volume / area.
956        */
[693]957        void TestSubdivision();
[440]958};
959
[1545]960
[440]961/**
962        Manages different higher order operations on the KD type view cells.
963*/
964class KdViewCellsManager: public ViewCellsManager
965{
966
967public:
968
[1264]969        KdViewCellsManager(ViewCellsTree *viewCellsTree, KdTree *tree);
[440]970
[574]971        int ConstructSubdivision(const ObjectContainer &objects,
[1686]972                                                         const VssRayContainer &rays);
[440]973
[478]974        int CastLineSegment(const Vector3 &origin,
975                                                const Vector3 &termination,
976                                                ViewCellContainer &viewcells);
[440]977
978        int PostProcess(const ObjectContainer &objects,
[466]979                                        const VssRayContainer &rays);
[440]980
981        void Visualize(const ObjectContainer &objects,
[466]982                                   const VssRayContainer &sampleRays);
[440]983
984        int GetType() const;
985
986        bool ViewCellsConstructed() const;
987
[580]988        ViewCell *GenerateViewCell(Mesh *mesh) const;
[440]989
[452]990        /** Prints out statistics of this approach.
991        */
[503]992        //  virtual void PrintStatistics(ostream &s) const;
[1416]993        ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const
994        { return NULL; }
[452]995
[503]996        float GetProbability(ViewCell *viewCell);
[609]997       
[503]998        void CreateMesh(ViewCell *vc);
999
[1686]1000        void ExportViewCellGeometry(Exporter *exporter,
1001                                                                ViewCell *vc,
1002                                                                const AxisAlignedBox3 *box,
1003                                                                const AxisAlignedPlane *clipPlane = NULL) const;
[547]1004
[1416]1005
[591]1006        void CollectMergeCandidates(const VssRayContainer &rays,
1007                                                                vector<MergeCandidate> &candidates);
[580]1008
[1686]1009        void ExportSingleViewCells(const ObjectContainer &objects,
1010                                                           const int maxViewCells,
1011                                                           const bool sortViewCells,
1012                                                           const bool exportPvs,
1013                                                           const bool exportRays,
1014                                                           const int maxRays,
[2394]1015                                                           const string &prefix,
[1686]1016                                                           VssRayContainer *visRays = NULL);
[752]1017
[1977]1018        bool LineSegmentIntersects(const Vector3 &origin,
1019                                                           const Vector3 &termination,
1020                                                           ViewCell *viewCell);
1021
[440]1022protected:
1023
[580]1024        /** Collects view cells from a hierarchy.
1025        */
[480]1026        void CollectViewCells();
[580]1027
[480]1028        KdNode *GetNodeForPvs(KdLeaf *leaf);
[440]1029
[1570]1030        ////////////////////////////////////////
[440]1031
[480]1032        /// the BSP tree.
1033        KdTree *mKdTree;
[440]1034
[480]1035        /// depth of the KD tree nodes with represent the view cells
1036        int mKdPvsDepth;
[938]1037
1038
[440]1039};
1040
[1570]1041
1042/** Manages different higher order operations on the view cells.
[442]1043*/
1044class VspBspViewCellsManager: public ViewCellsManager
1045{
1046
1047public:
1048
[1264]1049        VspBspViewCellsManager(ViewCellsTree *viewCellsTree, VspBspTree *tree);
[475]1050        ~VspBspViewCellsManager();
[442]1051
[574]1052        int ConstructSubdivision(const ObjectContainer &objects,
[1686]1053                                                         const VssRayContainer &rays);
[442]1054
1055        int PostProcess(const ObjectContainer &objects,
[466]1056                                        const VssRayContainer &rays);
[442]1057
1058        void Visualize(const ObjectContainer &objects,
[466]1059                                   const VssRayContainer &sampleRays);
[442]1060
1061        int GetType() const;
1062       
1063        ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
1064
1065        bool ViewCellsConstructed() const;
[468]1066       
1067        int CastLineSegment(const Vector3 &origin,
1068                                                const Vector3 &termination,
1069                                                ViewCellContainer &viewcells);
[452]1070
[471]1071        float GetProbability(ViewCell *viewCell);
[479]1072       
[879]1073        ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const;
[477]1074
[487]1075        bool GetViewPoint(Vector3 &viewPoint) const;
1076
[490]1077        bool ViewPointValid(const Vector3 &viewPoint) const;
[503]1078
1079        void CreateMesh(ViewCell *vc);
1080
[1686]1081        bool ExportViewCells(const string filename,
1082                                                 const bool exportPvs,
1083                                                 const ObjectContainer &objects);
[508]1084
[532]1085        int CastBeam(Beam &beam);
[1416]1086       
[1686]1087        void ExportViewCellGeometry(Exporter *exporter,
1088                                                                ViewCell *vc,
1089                                                                const AxisAlignedBox3 *box,
1090                                                                const AxisAlignedPlane *clipPlane = NULL) const;
[532]1091
[547]1092
[555]1093        void Finalize(ViewCell *viewCell, const bool createMesh);
[551]1094
[1686]1095        void CollectMergeCandidates(const VssRayContainer &rays,
1096                                                                vector<MergeCandidate> &candidates);
[580]1097
[1686]1098        void ExportSingleViewCells(const ObjectContainer &objects,
1099                                                           const int maxViewCells,
1100                                                           const bool sortViewCells,
1101                                                           const bool exportPvs,
1102                                                           const bool exportRays,               
1103                                                           const int maxRays,
[2394]1104                                                           const string &prefix,
[1686]1105                                                           VssRayContainer *visRays = NULL);
[1570]1106
[1920]1107       
[1977]1108        bool LineSegmentIntersects(const Vector3 &origin,
1109                                                           const Vector3 &termination,
1110                                                           ViewCell *viewCell);
1111
[442]1112protected:
[475]1113
[1686]1114        int ComputeBoxIntersections(const AxisAlignedBox3 &box,
1115                                                                ViewCellContainer &viewCells) const;
[651]1116       
[1021]1117        /** Merges view cells according to some criteria
[442]1118        */
[508]1119        void MergeViewCells(const VssRayContainer &rays,
1120                                                const ObjectContainer &objects);
[503]1121       
[564]1122        void RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects);
[442]1123
[480]1124        void CollectViewCells();
1125
[482]1126        /** Returns maximal depth difference of view cell
1127                leaves in tree.
1128        */
1129        int GetMaxTreeDiff(ViewCell *vc) const;
1130
[752]1131        /** Prepare view cells for use after loading them from disc.
1132        */
[577]1133        void PrepareLoadedViewCells();
1134
[752]1135        /** Constructs merge hierarchy which corresponds to the spatial hierarchy.
1136        */
[650]1137        ViewCell *ConstructSpatialMergeTree(BspNode *root);
[649]1138
[979]1139        /// HACK for testing visibility filter functionality
[697]1140        void TestFilter(const ObjectContainer &objects);
1141
[979]1142        /** Visualization of the pvs difference to exact visubility using
1143                from point queries.
1144        */
1145        void VisualizeWithFromPointQueries();
[697]1146
[991]1147        /** Evaluate from point queries for the current scene.
1148        */
1149        void EvalFromPointQueries();
[979]1150
[1021]1151        /** Exports visualization of the BSP splits.
1152        */
1153        void ExportSplits(const ObjectContainer &objects,
1154                                          const VssRayContainer &rays);
[991]1155
[1686]1156
1157        /////////////////////////
1158
[442]1159        /// the view space partition BSP tree.
1160        VspBspTree *mVspBspTree;
1161
[591]1162
[442]1163private:
1164
[1021]1165        /** test if subdivision is valid in terms of volume / area.
[442]1166        */
[1021]1167        void TestSubdivision();
1168};
[442]1169
[1021]1170
[2353]1171
1172/**     Manages different higher order operations on the view cells.
[1021]1173*/
1174class VspOspViewCellsManager: public ViewCellsManager
1175{
[1740]1176        friend class ViewCellsParseHandlers;
[2542]1177        friend class ViewCellsManager;
[1977]1178
[1021]1179public:
1180
[2542]1181        /** This version takes a view cells tree and a hierarchy
1182                as input.
1183        */
[2113]1184        VspOspViewCellsManager(ViewCellsTree *vcTree,
1185                                                   const string &hierarchyType);
[1278]1186       
[1021]1187        ~VspOspViewCellsManager();
1188
1189        int ConstructSubdivision(const ObjectContainer &objects,
1190                                                         const VssRayContainer &rays);
1191
1192        int PostProcess(const ObjectContainer &objects,
1193                                        const VssRayContainer &rays);
1194
[1686]1195        void Visualize(const ObjectContainer &objects,
[1021]1196                                   const VssRayContainer &sampleRays);
1197
1198        int GetType() const;
1199       
1200        ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
1201
[2539]1202        virtual Intersectable *GetIntersectable(const VssRay &ray,
1203                                                                                        const bool isTermination) const;
[1743]1204
[1021]1205        bool ViewCellsConstructed() const;
1206
1207        int CastLineSegment(const Vector3 &origin,
1208                                                const Vector3 &termination,
1209                                                ViewCellContainer &viewcells);
1210
[1977]1211        bool LineSegmentIntersects(const Vector3 &origin,
1212                                                           const Vector3 &termination,
1213                                                           ViewCell *viewCell);
1214
[1021]1215        float GetProbability(ViewCell *viewCell);
1216       
[2113]1217        ViewCell *GetViewCell(const Vector3 &point,
1218                                                  const bool active = false) const;
[1021]1219
1220        bool GetViewPoint(Vector3 &viewPoint) const;
1221
1222        bool ViewPointValid(const Vector3 &viewPoint) const;
1223
1224        void CreateMesh(ViewCell *vc);
1225
[1027]1226        bool ExportViewCells(const string filename,
1227                                                 const bool exportPvs,
1228                                                 const ObjectContainer &objects);
[1021]1229
1230        int CastBeam(Beam &beam);
1231
1232        void Finalize(ViewCell *viewCell, const bool createMesh);
1233
[1666]1234        void ExportSingleViewCells(const ObjectContainer &objects,
1235                                                           const int maxViewCells,
1236                                                           const bool sortViewCells,
1237                                                           const bool exportPvs,
1238                                                           const bool exportRays,
1239                                                           const int maxRays,
[2394]1240                                                           const string &prefix,
[1666]1241                                                           VssRayContainer *visRays = NULL);
[2539]1242        /** See parent class.
1243        */
[2124]1244        virtual void FinalizeViewCells(const bool createMesh);
1245
[2543]1246        bool ExportViewCellsBinary(const string filename,
[2539]1247                                                           const bool exportPvs,
1248                                                           const ObjectContainer &objects);
1249
[2696]1250       
[2695]1251
[2332]1252#if TEST_PACKETS
1253
[2353]1254        float ComputeSampleContributions(const VssRayContainer &rays,
1255                                             const bool addContributions,
1256                                                                         const bool storeViewCells,
1257                                                                         const bool useHitObjects = false);
[2332]1258#endif
1259
[2539]1260
[1021]1261protected:
[1180]1262
[2539]1263        /** View cells manager taking a view cells tree and a hierarchy as input.
1264        */
[1740]1265        VspOspViewCellsManager(ViewCellsTree *vcTree, HierarchyManager *hm);
1266       
[1709]1267        virtual void EvalViewCellPartition();
[1027]1268        /** Exports view cell geometry.
1269        */
[1666]1270        void ExportViewCellGeometry(Exporter *exporter,
1271                                                                ViewCell *vc,
1272                                                                const AxisAlignedBox3 *box,
1273                                                                const AxisAlignedPlane *clipPlane = NULL) const;
[1027]1274
[1666]1275        int ComputeBoxIntersections(const AxisAlignedBox3 &box,
1276                                                                ViewCellContainer &viewCells) const;
[1021]1277       
1278        void CollectViewCells();
1279
[1845]1280        virtual void CompressViewCells();
[1021]1281        /** Prepare view cells for use after loading them from disc.
1282        */
1283        void PrepareLoadedViewCells();
1284        /** Constructs merge hierarchy which corresponds to the spatial hierarchy.
1285        */
1286        ViewCell *ConstructSpatialMergeTree(VspNode *root);
[1074]1287        /** Exports visualization of the PVS.
[442]1288        */
[1666]1289        void ExportPvs(const ObjectContainer &objects, const VssRayContainer &rays);
[1740]1290        /** Returns a hierarchy manager of the given name.
1291        */
1292        static HierarchyManager *CreateHierarchyManager(const string &name);
[1887]1293        /** collect objects intersecting a given spatial box
[1845]1294        */
1295        virtual void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects);
[2539]1296        /** Update the cost of pvss for hierarchy objects.
1297        */
1298        float UpdateObjectCosts();
[1737]1299
[2539]1300
1301        ////////////////
1302
1303        /** Fast view cell loader in binary mode.
1304        */
[2547]1305        friend ViewCellsManager *ViewCellsManager::
1306                LoadViewCellsBinary(const std::string &filename,
1307                                    ObjectContainer &pvsObjects,
1308                                                        bool finalizeViewCells,
1309                                                        BoundingBoxConverter *bconverter);
[2539]1310
[2547]1311
[2539]1312        /** Print statistics about the view cells compression.
1313        */
[2530]1314        static void PrintCompressionStats(HierarchyManager *hm, const int pvsEntries);
[1887]1315
1316
[2530]1317        ////////////////////
1318
[2547]1319        /// if we the objects are compressed after evaluation
1320        /// this makes only sense for testing purpose
[1887]1321        bool mCompressObjects;
[2547]1322        /// hierarchy manager managing view space / object subdivision.
[1027]1323        HierarchyManager *mHierarchyManager;
[442]1324};
1325
[575]1326
[860]1327}
1328
[440]1329#endif
Note: See TracBrowser for help on using the repository browser.