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