[440] | 1 | #ifndef _ViewCellsManager_H__
|
---|
| 2 | #define _ViewCellsManager_H__
|
---|
| 3 |
|
---|
| 4 | #include "Ray.h"
|
---|
| 5 | #include "VssRay.h"
|
---|
| 6 | #include "Containers.h"
|
---|
[475] | 7 | #include "ViewCell.h"
|
---|
[610] | 8 | #include "ViewCellBsp.h"
|
---|
[440] | 9 |
|
---|
[860] | 10 | namespace GtpVisibilityPreprocessor {
|
---|
| 11 |
|
---|
[440] | 12 | class ViewCell;
|
---|
| 13 | class Intersectable;
|
---|
| 14 | class RenderSimulator;
|
---|
[480] | 15 | class Renderer;
|
---|
[440] | 16 | class Mesh;
|
---|
| 17 | struct Triangle3;
|
---|
| 18 | class SimulationStatistics;
|
---|
| 19 | class BspTree;
|
---|
| 20 | class KdTree;
|
---|
| 21 | class VspKdTree;
|
---|
| 22 | class VspBspTree;
|
---|
| 23 | class KdNode;
|
---|
| 24 | class KdLeaf;
|
---|
| 25 | class VspKdTree;
|
---|
| 26 | class AxisAlignedBox3;
|
---|
[448] | 27 | class BspLeaf;
|
---|
[475] | 28 | class ViewCellsStatistics;
|
---|
[482] | 29 | class Exporter;
|
---|
[532] | 30 | class Beam;
|
---|
[570] | 31 | class Preprocessor;
|
---|
[580] | 32 | class ViewCellsTree;
|
---|
| 33 | class MergeCandidate;
|
---|
[503] | 34 |
|
---|
[475] | 35 | struct BspRay;
|
---|
| 36 |
|
---|
[677] | 37 |
|
---|
| 38 | /** Probably Visible Set */
|
---|
[697] | 39 | class PrVs
|
---|
| 40 | {
|
---|
| 41 | public:
|
---|
[704] | 42 | /// root of view cells tree
|
---|
| 43 | ViewCell *mViewCell;
|
---|
| 44 |
|
---|
[880] | 45 | // input parameter is the render budget for the PrVs
|
---|
[677] | 46 | float mRenderBudget;
|
---|
| 47 |
|
---|
| 48 | /// some characteristic values could be here
|
---|
| 49 |
|
---|
| 50 | };
|
---|
| 51 |
|
---|
[850] | 52 |
|
---|
| 53 | struct IndexedBoundingBox: public std::pair<int, AxisAlignedBox3>
|
---|
| 54 | {
|
---|
| 55 | typedef std::pair<int, AxisAlignedBox3> IndexedBoundingBoxParent;
|
---|
| 56 |
|
---|
| 57 | IndexedBoundingBox(int idx, const AxisAlignedBox3 &box): IndexedBoundingBoxParent(idx, box)
|
---|
| 58 | {
|
---|
| 59 |
|
---|
| 60 | }
|
---|
| 61 | };
|
---|
| 62 |
|
---|
| 63 | /** Manages different higher order operations on the view cells.
|
---|
[440] | 64 | */
|
---|
| 65 | class ViewCellsManager
|
---|
| 66 | {
|
---|
| 67 | public:
|
---|
[728] | 68 | struct PvsStatistics
|
---|
| 69 | {
|
---|
| 70 | int minPvs;
|
---|
| 71 | int maxPvs;
|
---|
| 72 | float avgPvs;
|
---|
| 73 | int viewcells;
|
---|
[467] | 74 | };
|
---|
[697] | 75 |
|
---|
[728] | 76 | /// view cell container types
|
---|
| 77 | enum {BSP, KD, VSP_KD, VSP_BSP};
|
---|
[466] | 78 |
|
---|
[728] | 79 | /// view cells evaluation type
|
---|
| 80 | enum {PER_OBJECT, PER_TRIANGLE};
|
---|
| 81 |
|
---|
[574] | 82 | /** Constructor taking the initial and construction samples.
|
---|
| 83 | @param initialSamples the maximal number of samples used for creating the hierarchy
|
---|
| 84 | of view cells
|
---|
| 85 | @param constructionSamples the maximal number of samples used for construction
|
---|
[440] | 86 | */
|
---|
[574] | 87 | ViewCellsManager(const int initialSamples, const int constructionSamples);
|
---|
[440] | 88 |
|
---|
| 89 | ViewCellsManager();
|
---|
| 90 |
|
---|
[462] | 91 | virtual ~ViewCellsManager();
|
---|
[440] | 92 |
|
---|
[527] | 93 | /** Constructs view cells container taking a preprocessor
|
---|
[570] | 94 | @returns the output rays (if not null)
|
---|
| 95 | */
|
---|
| 96 | int Construct(Preprocessor *preprocessor, VssRayContainer *outRays = NULL);
|
---|
[527] | 97 |
|
---|
[440] | 98 | /** Constructs view cell container with a given number of samples.
|
---|
| 99 | */
|
---|
[574] | 100 | virtual int ConstructSubdivision(const ObjectContainer &objects,
|
---|
[487] | 101 | const VssRayContainer &rays) = 0;
|
---|
[440] | 102 |
|
---|
[441] | 103 | /** Computes sample contributions of the rays to the view cells PVS.
|
---|
| 104 |
|
---|
| 105 | @param rays bundle of rays used to find intersections with view cells and
|
---|
| 106 | adding the contribution
|
---|
[563] | 107 | @param addRays true if rays should be added to the PVSs of the viewcells they
|
---|
[574] | 108 | intersect
|
---|
| 109 | @param storeViewCells true if view cells should be stored in the ray
|
---|
| 110 | */
|
---|
[697] | 111 | float ComputeSampleContributions(const VssRayContainer &rays,
|
---|
[574] | 112 | const bool addContributions,
|
---|
| 113 | const bool storeViewCells);
|
---|
[440] | 114 |
|
---|
[697] | 115 | /** Add sample contributions to the viewcells they intersect */
|
---|
| 116 | void AddSampleContributions(const VssRayContainer &rays);
|
---|
[563] | 117 |
|
---|
[441] | 118 |
|
---|
[475] | 119 | /** Computes sample contribution of a simgle ray to the view cells PVS.
|
---|
| 120 | @param ray finds intersections with view cells and holds the contribution
|
---|
| 121 | @param castRay true if ray should be cast to gain the information, false if ray
|
---|
| 122 | is already holding the information and need not be recast.
|
---|
[466] | 123 |
|
---|
[475] | 124 | @returns number of sample contributions
|
---|
| 125 | */
|
---|
[591] | 126 | virtual float ComputeSampleContributions(VssRay &ray,
|
---|
| 127 | const bool addRays,
|
---|
| 128 | const bool storeViewCells);
|
---|
[563] | 129 |
|
---|
[591] | 130 | virtual void AddSampleContributions(VssRay &ray);
|
---|
[563] | 131 |
|
---|
[452] | 132 | /** Prints out statistics of the view cells.
|
---|
| 133 | */
|
---|
[475] | 134 | virtual void PrintStatistics(ostream &s) const;
|
---|
[452] | 135 |
|
---|
[440] | 136 | /** Post processes view cells givemŽa number of rays.
|
---|
| 137 | */
|
---|
[475] | 138 | virtual int PostProcess(const ObjectContainer &objects,
|
---|
| 139 | const VssRayContainer &rays) = 0;
|
---|
[440] | 140 |
|
---|
| 141 | /** Show visualization of the view cells.
|
---|
| 142 | */
|
---|
| 143 | virtual void Visualize(const ObjectContainer &objects,
|
---|
[466] | 144 | const VssRayContainer &sampleRays) = 0;
|
---|
[440] | 145 |
|
---|
| 146 | /** type of the view cell container.
|
---|
| 147 | */
|
---|
| 148 | virtual int GetType() const = 0;
|
---|
| 149 |
|
---|
[463] | 150 | /** Load the input viewcells. The input viewcells should be given as a collection
|
---|
| 151 | of meshes. Each mesh is assume to form a bounded polyhedron defining the interior of
|
---|
| 152 | the viewcell. The method then builds a BSP tree of these view cells.
|
---|
| 153 |
|
---|
| 154 | @param filename file to load
|
---|
| 155 | @return true on success
|
---|
| 156 | */
|
---|
[577] | 157 | virtual bool LoadViewCellsGeometry(const string filename);
|
---|
[440] | 158 |
|
---|
[577] | 159 |
|
---|
[440] | 160 | /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector.
|
---|
| 161 | @param the base triangle
|
---|
| 162 | @param the height of the newly created view cell
|
---|
| 163 | */
|
---|
| 164 | ViewCell *ExtrudeViewCell(const Triangle3 &baseTri, const float height) const;
|
---|
| 165 |
|
---|
| 166 | /** Merges two view cells.
|
---|
| 167 | @note the piercing rays of the front and back will be ordered
|
---|
| 168 | @returns new view cell based on the merging.
|
---|
| 169 | */
|
---|
[582] | 170 | ViewCellInterior *MergeViewCells(ViewCell *front, ViewCell *back) const;
|
---|
| 171 |
|
---|
| 172 | /** Merges a container of view cells.
|
---|
| 173 | @returns new view cell based on the merging.
|
---|
| 174 | */
|
---|
| 175 | ViewCellInterior *MergeViewCells(ViewCellContainer &children) const;
|
---|
[440] | 176 |
|
---|
| 177 | /** Generates view cell of type specified by this manager
|
---|
| 178 | */
|
---|
[580] | 179 | virtual ViewCell *GenerateViewCell(Mesh *mesh = NULL) const = 0;
|
---|
[440] | 180 |
|
---|
| 181 | /** Adds a new view cell to the list of predefined view cells.
|
---|
| 182 | */
|
---|
| 183 | void AddViewCell(ViewCell *viewCell);
|
---|
| 184 |
|
---|
| 185 | /** Derive view cells from objects.
|
---|
| 186 | */
|
---|
| 187 | void DeriveViewCells(const ObjectContainer &objects,
|
---|
| 188 | ViewCellContainer &viewCells,
|
---|
| 189 | const int maxViewCells) const;
|
---|
| 190 |
|
---|
| 191 | /** Sets maximal number of samples used for the
|
---|
| 192 | construction of the view cells.
|
---|
| 193 | */
|
---|
| 194 | void SetVisualizationSamples(const int visSamples);
|
---|
| 195 |
|
---|
[574] | 196 | /** Sets maximal number of samples used for the construction of the view cells.
|
---|
[440] | 197 | */
|
---|
| 198 | void SetConstructionSamples(const int constructionSamples);
|
---|
| 199 |
|
---|
[574] | 200 | /** Sets maximal number of samples used for the visualization of the view cells.
|
---|
| 201 | */
|
---|
| 202 | void SetInitialSamples(const int initialSamples);
|
---|
| 203 |
|
---|
[440] | 204 | /** Sets maximal number of samples used for the post processing of the view cells.
|
---|
| 205 | */
|
---|
| 206 | void SetPostProcessSamples(const int postProcessingSamples);
|
---|
| 207 |
|
---|
| 208 | /** See set.
|
---|
| 209 | */
|
---|
| 210 | int GetVisualizationSamples() const;
|
---|
| 211 |
|
---|
| 212 | /** See set.
|
---|
| 213 | */
|
---|
| 214 | int GetConstructionSamples() const;
|
---|
| 215 |
|
---|
| 216 | /** See set.
|
---|
| 217 | */
|
---|
| 218 | int GetPostProcessSamples() const;
|
---|
| 219 |
|
---|
| 220 | /** Returns true if view cells wer already constructed.
|
---|
| 221 | */
|
---|
| 222 | virtual bool ViewCellsConstructed() const = 0;
|
---|
[441] | 223 |
|
---|
[477] | 224 | /** cast line segment to get a list of unique viewcells which are intersected
|
---|
| 225 | by this line segment
|
---|
| 226 | */
|
---|
[466] | 227 |
|
---|
[477] | 228 | virtual int CastLineSegment(const Vector3 &origin,
|
---|
[466] | 229 | const Vector3 &termination,
|
---|
| 230 | ViewCellContainer &viewcells
|
---|
| 231 | ) = 0;
|
---|
| 232 |
|
---|
[477] | 233 | virtual void GetPvsStatistics(PvsStatistics &stat);
|
---|
[466] | 234 |
|
---|
[697] | 235 | virtual void GetPrVS(const Vector3 &viewPoint, PrVs &prvs);
|
---|
[677] | 236 |
|
---|
[697] | 237 | /** Get a viewcell containing the specified point
|
---|
[879] | 238 | @param active if the active or elementary view cell should be returned.
|
---|
[697] | 239 | */
|
---|
[879] | 240 | virtual ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const = 0;
|
---|
[492] | 241 |
|
---|
[503] | 242 | virtual void PrintPvsStatistics(ostream &s);
|
---|
[467] | 243 |
|
---|
[719] | 244 | /** Updates pvs of the view cell hierarchy if necessary.
|
---|
| 245 | */
|
---|
| 246 | void UpdatePvs();
|
---|
| 247 |
|
---|
[477] | 248 | /** Returns probability that view point lies in one view cell.
|
---|
| 249 | */
|
---|
| 250 | virtual float GetProbability(ViewCell *viewCell) = 0;
|
---|
[468] | 251 |
|
---|
[477] | 252 | /** Returns render cost of a single view cell given the render cost of an object.
|
---|
| 253 | */
|
---|
[728] | 254 | float GetRendercost(ViewCell *viewCell) const;
|
---|
[468] | 255 |
|
---|
[720] | 256 | /** Returns reference to container of loaded / generated view cells.
|
---|
[477] | 257 | */
|
---|
| 258 | ViewCellContainer &GetViewCells();
|
---|
[468] | 259 |
|
---|
[485] | 260 | /** Helper function used to split ray sets uniformly
|
---|
| 261 | into one that is currently used and the other that
|
---|
| 262 | is saved for later processing.
|
---|
| 263 | @param sourceRays the input ray set
|
---|
| 264 | @param maxSize the maximal number of rays that will be used
|
---|
| 265 | @param usedRays returns the used ray set
|
---|
| 266 | @param savedRays if not null, returns the saved ray set
|
---|
[477] | 267 | */
|
---|
| 268 | void GetRaySets(const VssRayContainer &sourceRays,
|
---|
[485] | 269 | const int maxSize,
|
---|
| 270 | VssRayContainer &usedRays,
|
---|
| 271 | VssRayContainer *savedRays = NULL) const;
|
---|
| 272 |
|
---|
[480] | 273 | /** Returns accumulated area of all view cells.
|
---|
| 274 | */
|
---|
| 275 | float GetAccVcArea();
|
---|
[470] | 276 |
|
---|
[480] | 277 | /** Returns area of one view cell.
|
---|
| 278 | */
|
---|
| 279 | virtual float GetArea(ViewCell *viewCell) const;
|
---|
[470] | 280 |
|
---|
[551] | 281 | /** Returns volume of view cell.
|
---|
[480] | 282 | */
|
---|
| 283 | virtual float GetVolume(ViewCell *viewCell) const;
|
---|
[470] | 284 |
|
---|
[480] | 285 | /** Sets the current renderer mainly for view cells statistics.
|
---|
| 286 | */
|
---|
| 287 | void SetRenderer(Renderer *renderer);
|
---|
| 288 |
|
---|
[487] | 289 | /** Computes a (random) view point in the valid view space.
|
---|
| 290 | @returns true if valid view point was found
|
---|
| 291 | */
|
---|
| 292 | virtual bool GetViewPoint(Vector3 &viewPoint) const;
|
---|
| 293 |
|
---|
[490] | 294 | /** Returns true if this view point is in the valid view space.
|
---|
| 295 | */
|
---|
| 296 | virtual bool ViewPointValid(const Vector3 &viewPoint) const;
|
---|
| 297 |
|
---|
[487] | 298 | /** Sets a view space boundary.
|
---|
| 299 | */
|
---|
| 300 | void SetViewSpaceBox(const AxisAlignedBox3 &box);
|
---|
| 301 |
|
---|
[519] | 302 | AxisAlignedBox3 GetViewSpaceBox() const;
|
---|
| 303 |
|
---|
[503] | 304 | /** Creates mesh for this view cell.
|
---|
| 305 | */
|
---|
| 306 | virtual void CreateMesh(ViewCell *vc) = NULL;
|
---|
[487] | 307 |
|
---|
[508] | 308 | /** Writes view cells to disc.
|
---|
| 309 | */
|
---|
[871] | 310 | virtual bool ExportViewCells(const string filename, const bool exportPvs);
|
---|
[508] | 311 |
|
---|
[532] | 312 | /** Casts beam to collect view cells.
|
---|
| 313 | */
|
---|
| 314 | virtual int CastBeam(Beam &beam);
|
---|
| 315 |
|
---|
[547] | 316 | /** Checks if view cell is considered as valid.
|
---|
| 317 | */
|
---|
[561] | 318 | virtual bool CheckValidity(ViewCell *vc,
|
---|
[562] | 319 | int minPvsSize,
|
---|
| 320 | int maxPvsSize) const;
|
---|
[547] | 321 |
|
---|
[562] | 322 |
|
---|
| 323 | /** Sets validity of view cell
|
---|
| 324 | */
|
---|
| 325 | virtual void SetValidity(ViewCell *vc,
|
---|
| 326 | int minPvsSize,
|
---|
| 327 | int maxPvsSize) const;
|
---|
| 328 |
|
---|
[710] | 329 | /** sets validy of all viewcells
|
---|
| 330 | */
|
---|
[810] | 331 | virtual void SetValidity(int minPvsSize,
|
---|
[569] | 332 | int maxPvsSize) const;
|
---|
| 333 |
|
---|
[609] | 334 |
|
---|
| 335 | /** set valid viewcells in the range of pvs. sorts the viewcells
|
---|
[710] | 336 | according to the pvs and then pickups those in the ranges
|
---|
| 337 | */
|
---|
| 338 | void SetValidityPercentage(const float minValid, const float maxValid);
|
---|
[569] | 339 |
|
---|
[609] | 340 | int CountValidViewcells() const;
|
---|
| 341 |
|
---|
[547] | 342 | /** Returns maximal allowed pvs size.
|
---|
| 343 | */
|
---|
| 344 | int GetMaxPvsSize() const;
|
---|
| 345 |
|
---|
[562] | 346 | /** Returns maximal allowed pvs size.
|
---|
| 347 | */
|
---|
| 348 | int GetMinPvsSize() const;
|
---|
| 349 |
|
---|
[561] | 350 | /** Returns maximal ratio. i.e., currentPVs / maxPvs,
|
---|
| 351 | where pvs is still considered valid.
|
---|
| 352 | */
|
---|
| 353 | float GetMaxPvsRatio() const;
|
---|
| 354 |
|
---|
[547] | 355 | /** Exports view cell geometry.
|
---|
| 356 | */
|
---|
[591] | 357 | virtual void ExportViewCellGeometry(Exporter *exporter,
|
---|
| 358 | ViewCell *vc,
|
---|
[660] | 359 | const Plane3 *clipPlane = NULL) const = 0;
|
---|
[547] | 360 |
|
---|
[860] | 361 | /** Brings the view cells into their final state, computes meshes and volume.
|
---|
| 362 | */
|
---|
[551] | 363 | virtual void FinalizeViewCells(const bool createMesh);
|
---|
| 364 |
|
---|
[579] | 365 | /** Evaluates statistics values on view cells.
|
---|
| 366 | */
|
---|
[580] | 367 | void EvaluateRenderStatistics(float &totalRenderCost,
|
---|
| 368 | float &expectedRenderCost,
|
---|
| 369 | float &deviation,
|
---|
| 370 | float &variance,
|
---|
| 371 | int &totalPvs,
|
---|
| 372 | float &avgRenderCost);
|
---|
[579] | 373 |
|
---|
[580] | 374 |
|
---|
| 375 | /** Returns hierarchy of the view cells.
|
---|
| 376 | */
|
---|
| 377 | ViewCellsTree *GetViewCellsTree();
|
---|
| 378 |
|
---|
[581] | 379 | virtual void CollectMergeCandidates(const VssRayContainer &rays,
|
---|
| 380 | vector<MergeCandidate> &candidates) = 0;
|
---|
[580] | 381 |
|
---|
[610] | 382 | void CollectViewCells(const int n);
|
---|
| 383 |
|
---|
[660] | 384 | /** Returns true if this (logical) view cell is equal to a spatial node.
|
---|
| 385 | */
|
---|
[710] | 386 | virtual bool EqualToSpatialNode(ViewCell *viewCell) const;
|
---|
[580] | 387 |
|
---|
[660] | 388 | /** Sets current view cells set to active, i.e., the sampling is done in this view cell set.
|
---|
| 389 | */
|
---|
| 390 | void SetViewCellsActive();
|
---|
[599] | 391 |
|
---|
[660] | 392 | /** Evaluates worth of current view cell hierarchy.
|
---|
| 393 | */
|
---|
[664] | 394 | void EvalViewCellPartition(Preprocessor *preprocessor);
|
---|
[660] | 395 |
|
---|
[728] | 396 | /** Sets maximal size of a view cell filter.
|
---|
| 397 | */
|
---|
| 398 | void SetMaxFilterSize(const int size);
|
---|
[697] | 399 |
|
---|
[840] | 400 | /** Returns maximal filter size.
|
---|
| 401 | */
|
---|
| 402 | int GetMaxFilterSize() const;
|
---|
[746] | 403 |
|
---|
[840] | 404 | /** Deletes interior nodes from the tree which have negative merge cost set (local merge).
|
---|
| 405 | */
|
---|
| 406 | void DeleteLocalMergeTree(ViewCell *vc) const;
|
---|
[713] | 407 |
|
---|
[728] | 408 | /** Evaluautes histogram for a given number of view cells.
|
---|
| 409 | */
|
---|
| 410 | void EvalViewCellHistogram(const string filename, const int nViewCells);
|
---|
| 411 |
|
---|
[735] | 412 | /** Evaluautes histogram for a given number of view cells.
|
---|
| 413 | */
|
---|
| 414 | void EvalViewCellHistogramForPvsSize(const string filename, const int nViewCells);
|
---|
| 415 |
|
---|
[728] | 416 | /** Evaluates the render cost of a view cell.
|
---|
| 417 | */
|
---|
| 418 | float EvalRenderCost(Intersectable *obj) const;
|
---|
| 419 |
|
---|
[859] | 420 | void
|
---|
| 421 | ApplyFilter(KdTree *kdTree,
|
---|
| 422 | const float viewSpaceFilterSize,
|
---|
| 423 | const float spatialFilterSize
|
---|
| 424 | );
|
---|
| 425 |
|
---|
[884] | 426 | void
|
---|
| 427 | ApplySpatialFilter(
|
---|
| 428 | KdTree *kdTree,
|
---|
| 429 | const float spatialFilterSize,
|
---|
| 430 | ObjectPvs &pvs
|
---|
| 431 | );
|
---|
| 432 |
|
---|
[870] | 433 | /** Returns bounding box of a view cell.
|
---|
| 434 | */
|
---|
| 435 | AxisAlignedBox3 GetViewCellBox(ViewCell *vc);
|
---|
[859] | 436 |
|
---|
[840] | 437 | /** Exports bounding boxes of objects to file.
|
---|
| 438 | */
|
---|
| 439 | bool ExportBoundingBoxes(const string filename, const ObjectContainer &objects) const;
|
---|
| 440 |
|
---|
[850] | 441 | /** Load the bounding boxes into the container.
|
---|
| 442 | */
|
---|
| 443 | bool LoadBoundingBoxes(const string filename, IndexedBoundingBoxContainer &boxes) const;
|
---|
[840] | 444 |
|
---|
[871] | 445 | bool GetExportPvs() const {
|
---|
| 446 | return mExportPvs;
|
---|
| 447 | }
|
---|
[870] | 448 |
|
---|
| 449 | /** Loads view cells from file. The view cells manager is created with
|
---|
| 450 | respect to the loaded view cells.
|
---|
| 451 |
|
---|
| 452 | @returns the view cells manager if loading was successful, false otherwise
|
---|
| 453 | */
|
---|
| 454 | static ViewCellsManager *LoadViewCells(const string filename, ObjectContainer *objects);
|
---|
| 455 |
|
---|
[884] | 456 | float GetFilterWidth() {
|
---|
| 457 | return Magnitude(mViewSpaceBox.Size())*mFilterWidth;
|
---|
| 458 | }
|
---|
| 459 |
|
---|
[469] | 460 | protected:
|
---|
[859] | 461 | void
|
---|
| 462 | ApplyFilter(ViewCell *viewCell,
|
---|
| 463 | KdTree *kdTree,
|
---|
| 464 | const float viewSpaceFilterSize,
|
---|
| 465 | const float spatialFilterSize,
|
---|
| 466 | ObjectPvs &pvs
|
---|
| 467 | );
|
---|
[480] | 468 |
|
---|
[859] | 469 |
|
---|
[697] | 470 | /** Returns the bounding box of filter width.
|
---|
| 471 | */
|
---|
| 472 | AxisAlignedBox3 GetFilterBBox(const Vector3 &viewPoint, const float width) const;
|
---|
[609] | 473 |
|
---|
[697] | 474 | /** Intersects box with the tree and returns the number of intersected boxes.
|
---|
| 475 | @returns number of view cells found
|
---|
| 476 | */
|
---|
[710] | 477 | virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box,
|
---|
| 478 | ViewCellContainer &viewCells) const;
|
---|
[697] | 479 |
|
---|
[880] | 480 | /** Tests the visibility filter functionality.
|
---|
| 481 | */
|
---|
[697] | 482 | virtual void TestFilter(const ObjectContainer &objects) {};
|
---|
| 483 |
|
---|
[581] | 484 | /**
|
---|
| 485 | if the view cells tree was already constructed or not.
|
---|
| 486 | */
|
---|
| 487 | bool ViewCellsTreeConstructed() const;
|
---|
| 488 |
|
---|
[574] | 489 | int CastPassSamples(const int samplesPerPass,
|
---|
| 490 | const int sampleType,
|
---|
| 491 | VssRayContainer &vssRays) const;
|
---|
[573] | 492 |
|
---|
[482] | 493 | void ParseEnvironment();
|
---|
| 494 |
|
---|
[508] | 495 | /** Creates unique view cell ids.
|
---|
| 496 | */
|
---|
| 497 | void CreateUniqueViewCellIds();
|
---|
[547] | 498 |
|
---|
[551] | 499 | /** Finalizes, i.e., creates mesh, volume, area etc. for the view cell.
|
---|
| 500 | */
|
---|
| 501 | virtual void Finalize(ViewCell *viewCell, const bool createMesh);
|
---|
| 502 |
|
---|
[480] | 503 | /** Recollects view cells and resets statistics.
|
---|
| 504 | */
|
---|
| 505 | void ResetViewCells();
|
---|
[482] | 506 |
|
---|
[480] | 507 | /** Collects the view cells in the view cell container.
|
---|
| 508 | */
|
---|
| 509 | virtual void CollectViewCells() = 0;
|
---|
[482] | 510 |
|
---|
[479] | 511 | /** Evaluates view cells statistics and stores it in
|
---|
| 512 | mViewCellsStatistics.
|
---|
| 513 | */
|
---|
| 514 | void EvaluateViewCellsStats();
|
---|
[482] | 515 |
|
---|
| 516 | //-- helper functions for view cell visualization
|
---|
| 517 |
|
---|
| 518 | /** Exports the view cell partition.
|
---|
| 519 | */
|
---|
[508] | 520 | void ExportViewCellsForViz(Exporter *exporter) const;
|
---|
[482] | 521 |
|
---|
| 522 | /** Sets exporter color.
|
---|
| 523 | */
|
---|
| 524 | virtual void ExportColor(Exporter *exporter, ViewCell *vc) const = 0;
|
---|
| 525 |
|
---|
[556] | 526 |
|
---|
[557] | 527 | virtual float GetViewSpaceVolume();
|
---|
| 528 |
|
---|
[503] | 529 | /** Creates meshes from the view cells.
|
---|
| 530 | */
|
---|
[517] | 531 | void CreateViewCellMeshes();
|
---|
[503] | 532 |
|
---|
[610] | 533 | /** Takes different measures to prepares the view cells after loading them from disc.
|
---|
[577] | 534 | */
|
---|
| 535 | virtual void PrepareLoadedViewCells() {};
|
---|
| 536 |
|
---|
[704] | 537 | /** Constructs local view cell merge hierarchy.
|
---|
| 538 | */
|
---|
| 539 | ViewCell *ConstructLocalMergeTree(ViewCell *currentViewCell,
|
---|
| 540 | const ViewCellContainer &viewCells);
|
---|
| 541 |
|
---|
[713] | 542 | /** Constructs local view cell merge hierarchy based solely on similarity with the
|
---|
| 543 | current viewcell
|
---|
| 544 | */
|
---|
| 545 | ViewCell *ConstructLocalMergeTree2(ViewCell *currentViewCell,
|
---|
| 546 | const ViewCellContainer &viewCells);
|
---|
| 547 |
|
---|
| 548 |
|
---|
[660] | 549 | /** Creates clip plane for visualization.
|
---|
| 550 | */
|
---|
| 551 | void CreateClipPlane();
|
---|
[591] | 552 |
|
---|
[860] | 553 | /** Updates pvs of all view cells for statistical evaluation after some more sampling
|
---|
| 554 | */
|
---|
[752] | 555 | virtual void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs) = 0;
|
---|
| 556 |
|
---|
| 557 |
|
---|
| 558 |
|
---|
[840] | 559 | /// if bounding boxes should also be exported
|
---|
| 560 | bool mExportBboxesForPvs;
|
---|
| 561 |
|
---|
| 562 |
|
---|
[660] | 563 | Plane3 mClipPlane;
|
---|
[837] | 564 |
|
---|
[660] | 565 | bool mUseClipPlaneForViz;
|
---|
[591] | 566 |
|
---|
| 567 |
|
---|
[480] | 568 | /// Renders the view cells.
|
---|
| 569 | Renderer *mRenderer;
|
---|
[440] | 570 |
|
---|
| 571 | /// Loaded view cells
|
---|
[469] | 572 | ViewCellContainer mViewCells;
|
---|
[440] | 573 |
|
---|
[580] | 574 | ViewCellsTree *mViewCellsTree;
|
---|
| 575 |
|
---|
[710] | 576 | bool mPruneEmptyViewCells;
|
---|
[706] | 577 |
|
---|
[719] | 578 | bool mViewCellPvsIsUpdated;
|
---|
[440] | 579 | /// maximum number of samples taken for construction of the view cells
|
---|
| 580 | int mConstructionSamples;
|
---|
[574] | 581 | int mSamplesPerPass;
|
---|
| 582 | int mInitialSamples;
|
---|
[440] | 583 | int mPostProcessSamples;
|
---|
| 584 | int mVisualizationSamples;
|
---|
[441] | 585 |
|
---|
[470] | 586 | float mTotalAreaValid;
|
---|
| 587 | float mTotalArea;
|
---|
[475] | 588 |
|
---|
[547] | 589 | int mMaxPvsSize;
|
---|
[562] | 590 | int mMinPvsSize;
|
---|
[547] | 591 | float mMaxPvsRatio;
|
---|
| 592 |
|
---|
[660] | 593 | int mSamplingType;
|
---|
[722] | 594 | int mEvaluationSamplingType;
|
---|
[600] | 595 | int mNumActiveViewCells;
|
---|
[586] | 596 | bool mCompressViewCells;
|
---|
| 597 |
|
---|
[660] | 598 | ViewCellsStatistics mCurrentViewCellsStats;
|
---|
[487] | 599 | /// the scene bounding box
|
---|
[542] | 600 | AxisAlignedBox3 mViewSpaceBox;
|
---|
[508] | 601 | /// holds the view cell meshes
|
---|
[503] | 602 | MeshContainer mMeshContainer;
|
---|
[508] | 603 | /// if view cells should be exported
|
---|
| 604 | bool mExportViewCells;
|
---|
[547] | 605 |
|
---|
[591] | 606 | //bool mMarchTree);
|
---|
[564] | 607 | bool mOnlyValidViewCells;
|
---|
[547] | 608 |
|
---|
[580] | 609 | /// if rays should be used to collect merge candidates
|
---|
| 610 | bool mUseRaysForMerge;
|
---|
[697] | 611 | /// merge the view cells?
|
---|
[592] | 612 | bool mMergeViewCells;
|
---|
[697] | 613 |
|
---|
| 614 | /// the width of the box filter
|
---|
| 615 | float mFilterWidth;
|
---|
| 616 | int mMaxFilterSize;
|
---|
| 617 |
|
---|
[487] | 618 | //-- visualization options
|
---|
| 619 |
|
---|
| 620 | /// color code for view cells
|
---|
| 621 | int mColorCode;
|
---|
| 622 | bool mExportGeometry;
|
---|
| 623 | bool mExportRays;
|
---|
[517] | 624 |
|
---|
| 625 | bool mViewCellsFinished;
|
---|
[664] | 626 |
|
---|
| 627 | bool mEvaluateViewCells;
|
---|
[666] | 628 |
|
---|
[693] | 629 | bool mShowVisualization;
|
---|
| 630 |
|
---|
| 631 | // HACK in order to detect empty view cells
|
---|
| 632 | void CollectEmptyViewCells();
|
---|
[694] | 633 | void TestEmptyViewCells(const ObjectContainer &obj);
|
---|
[693] | 634 |
|
---|
| 635 | ViewCellContainer mEmptyViewCells;
|
---|
[728] | 636 |
|
---|
| 637 | int mRenderCostEvaluationType;
|
---|
[844] | 638 |
|
---|
| 639 | /// if pvs should be exported with view cells
|
---|
| 640 | bool mExportPvs;
|
---|
[440] | 641 | };
|
---|
| 642 |
|
---|
[441] | 643 |
|
---|
| 644 |
|
---|
[440] | 645 | /**
|
---|
| 646 | Manages different higher order operations on the view cells.
|
---|
| 647 | */
|
---|
| 648 | class BspViewCellsManager: public ViewCellsManager
|
---|
| 649 | {
|
---|
| 650 |
|
---|
| 651 | public:
|
---|
[485] | 652 | /** Constructor taking the bsp tree and the number of samples
|
---|
| 653 | used to construct the bsp tree.
|
---|
| 654 | */
|
---|
[574] | 655 | BspViewCellsManager(BspTree *tree);
|
---|
[440] | 656 |
|
---|
[477] | 657 | ~BspViewCellsManager();
|
---|
| 658 |
|
---|
[574] | 659 | int ConstructSubdivision(const ObjectContainer &objects,
|
---|
[487] | 660 | const VssRayContainer &rays);
|
---|
[440] | 661 |
|
---|
| 662 | int PostProcess(const ObjectContainer &objects,
|
---|
[466] | 663 | const VssRayContainer &rays);
|
---|
[440] | 664 |
|
---|
| 665 | void Visualize(const ObjectContainer &objects,
|
---|
[466] | 666 | const VssRayContainer &sampleRays);
|
---|
[440] | 667 |
|
---|
| 668 | int GetType() const;
|
---|
| 669 |
|
---|
| 670 | ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
|
---|
| 671 |
|
---|
| 672 | bool ViewCellsConstructed() const;
|
---|
| 673 |
|
---|
[475] | 674 | //void PrintStatistics(ostream &s) const;
|
---|
[452] | 675 |
|
---|
[468] | 676 | int CastLineSegment(const Vector3 &origin,
|
---|
| 677 | const Vector3 &termination,
|
---|
| 678 | ViewCellContainer &viewcells);
|
---|
| 679 |
|
---|
[471] | 680 | float GetProbability(ViewCell *viewCell);
|
---|
[605] | 681 |
|
---|
[466] | 682 |
|
---|
[879] | 683 | /** Get a viewcell containing the specified point
|
---|
| 684 | */
|
---|
| 685 | ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const;
|
---|
[492] | 686 |
|
---|
[503] | 687 | void CreateMesh(ViewCell *vc);
|
---|
| 688 |
|
---|
[591] | 689 | void ExportViewCellGeometry(Exporter *exporter,
|
---|
| 690 | ViewCell *vc,
|
---|
[660] | 691 | const Plane3 *clipPlane = NULL) const;
|
---|
[580] | 692 |
|
---|
[587] | 693 | void CollectMergeCandidates(const VssRayContainer &rays,
|
---|
| 694 | vector<MergeCandidate> &candidates);
|
---|
[547] | 695 |
|
---|
[587] | 696 | void Finalize(ViewCell *viewCell, const bool createMesh);
|
---|
| 697 |
|
---|
[871] | 698 | bool ExportViewCells(const string filename, const bool exportPvs);
|
---|
[590] | 699 |
|
---|
[752] | 700 | /** Constructs merge hierarchy which corresponds to the spatial hierarchy.
|
---|
| 701 | */
|
---|
[650] | 702 | ViewCell *ConstructSpatialMergeTree(BspNode *root);
|
---|
[610] | 703 |
|
---|
[752] | 704 | /** Updates the pvs in the view cells tree.
|
---|
| 705 | */
|
---|
| 706 | void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs);
|
---|
[610] | 707 |
|
---|
[859] | 708 |
|
---|
[440] | 709 | protected:
|
---|
| 710 |
|
---|
[610] | 711 |
|
---|
[480] | 712 | void CollectViewCells();
|
---|
| 713 |
|
---|
[482] | 714 | void ExportColor(Exporter *exporter, ViewCell *vc) const;
|
---|
[547] | 715 |
|
---|
[440] | 716 | /// the BSP tree.
|
---|
| 717 | BspTree *mBspTree;
|
---|
[475] | 718 |
|
---|
| 719 | vector<BspRay *> mBspRays;
|
---|
[440] | 720 |
|
---|
| 721 | private:
|
---|
| 722 |
|
---|
| 723 | /** Exports visualization of the BSP splits.
|
---|
| 724 | */
|
---|
[477] | 725 | void ExportSplits(const ObjectContainer &objects);
|
---|
[440] | 726 |
|
---|
| 727 | /** Exports visualization of the BSP PVS.
|
---|
| 728 | */
|
---|
[477] | 729 | void ExportBspPvs(const ObjectContainer &objects);
|
---|
[440] | 730 |
|
---|
[693] | 731 | void TestSubdivision();
|
---|
[440] | 732 | };
|
---|
| 733 |
|
---|
| 734 | /**
|
---|
| 735 | Manages different higher order operations on the KD type view cells.
|
---|
| 736 | */
|
---|
| 737 | class KdViewCellsManager: public ViewCellsManager
|
---|
| 738 | {
|
---|
| 739 |
|
---|
| 740 | public:
|
---|
| 741 |
|
---|
| 742 | KdViewCellsManager(KdTree *tree);
|
---|
| 743 |
|
---|
[574] | 744 | int ConstructSubdivision(const ObjectContainer &objects,
|
---|
[487] | 745 | const VssRayContainer &rays);
|
---|
[440] | 746 |
|
---|
[478] | 747 | int CastLineSegment(const Vector3 &origin,
|
---|
| 748 | const Vector3 &termination,
|
---|
| 749 | ViewCellContainer &viewcells);
|
---|
[440] | 750 |
|
---|
| 751 | int PostProcess(const ObjectContainer &objects,
|
---|
[466] | 752 | const VssRayContainer &rays);
|
---|
[440] | 753 |
|
---|
| 754 | void Visualize(const ObjectContainer &objects,
|
---|
[466] | 755 | const VssRayContainer &sampleRays);
|
---|
[440] | 756 |
|
---|
| 757 | int GetType() const;
|
---|
| 758 |
|
---|
| 759 | bool ViewCellsConstructed() const;
|
---|
| 760 |
|
---|
[580] | 761 | ViewCell *GenerateViewCell(Mesh *mesh) const;
|
---|
[440] | 762 |
|
---|
[452] | 763 | /** Prints out statistics of this approach.
|
---|
| 764 | */
|
---|
[503] | 765 | // virtual void PrintStatistics(ostream &s) const;
|
---|
[879] | 766 | ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const { return NULL; }
|
---|
[452] | 767 |
|
---|
[503] | 768 | float GetProbability(ViewCell *viewCell);
|
---|
[609] | 769 |
|
---|
[468] | 770 |
|
---|
[503] | 771 | void CreateMesh(ViewCell *vc);
|
---|
| 772 |
|
---|
[591] | 773 | void ExportViewCellGeometry(Exporter *exporter,
|
---|
| 774 | ViewCell *vc,
|
---|
[660] | 775 | const Plane3 *clipPlane = NULL) const;
|
---|
[547] | 776 |
|
---|
[591] | 777 | void CollectMergeCandidates(const VssRayContainer &rays,
|
---|
| 778 | vector<MergeCandidate> &candidates);
|
---|
[580] | 779 |
|
---|
[752] | 780 |
|
---|
[440] | 781 | protected:
|
---|
| 782 |
|
---|
[752] | 783 | virtual void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs) {};
|
---|
[580] | 784 | /** Collects view cells from a hierarchy.
|
---|
| 785 | */
|
---|
[480] | 786 | void CollectViewCells();
|
---|
[580] | 787 |
|
---|
[480] | 788 | KdNode *GetNodeForPvs(KdLeaf *leaf);
|
---|
[440] | 789 |
|
---|
[482] | 790 | void ExportColor(Exporter *exporter, ViewCell *vc) const;
|
---|
[440] | 791 |
|
---|
[547] | 792 |
|
---|
[480] | 793 | /// the BSP tree.
|
---|
| 794 | KdTree *mKdTree;
|
---|
[440] | 795 |
|
---|
[480] | 796 | /// depth of the KD tree nodes with represent the view cells
|
---|
| 797 | int mKdPvsDepth;
|
---|
[440] | 798 | };
|
---|
| 799 |
|
---|
| 800 | /**
|
---|
| 801 | Manages different higher order operations on the view cells
|
---|
| 802 | for vsp kd tree view cells.
|
---|
| 803 | */
|
---|
| 804 | class VspKdViewCellsManager: public ViewCellsManager
|
---|
| 805 | {
|
---|
| 806 |
|
---|
| 807 | public:
|
---|
| 808 |
|
---|
[574] | 809 | VspKdViewCellsManager(VspKdTree *vspKdTree);
|
---|
[440] | 810 |
|
---|
[574] | 811 | int ConstructSubdivision(const ObjectContainer &objects,
|
---|
[487] | 812 | const VssRayContainer &rays);
|
---|
[440] | 813 |
|
---|
| 814 |
|
---|
| 815 | int PostProcess(const ObjectContainer &objects,
|
---|
[466] | 816 | const VssRayContainer &rays);
|
---|
[440] | 817 |
|
---|
| 818 | void Visualize(const ObjectContainer &objects,
|
---|
[466] | 819 | const VssRayContainer &sampleRays);
|
---|
[440] | 820 |
|
---|
| 821 | int GetType() const;
|
---|
| 822 |
|
---|
| 823 | bool ViewCellsConstructed() const;
|
---|
| 824 |
|
---|
[475] | 825 | //virtual void PrintStatistics(ostream &s) const;
|
---|
[440] | 826 |
|
---|
[462] | 827 | ViewCell *GenerateViewCell(Mesh *mesh) const;
|
---|
| 828 |
|
---|
[466] | 829 |
|
---|
| 830 | int CastLineSegment(const Vector3 &origin,
|
---|
| 831 | const Vector3 &termination,
|
---|
[468] | 832 | ViewCellContainer &viewcells);
|
---|
[466] | 833 |
|
---|
[879] | 834 | ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const { return NULL; }
|
---|
[492] | 835 |
|
---|
[471] | 836 | float GetProbability(ViewCell *viewCell);
|
---|
[468] | 837 |
|
---|
[609] | 838 |
|
---|
[503] | 839 | void CreateMesh(ViewCell *vc);
|
---|
| 840 |
|
---|
[591] | 841 | void ExportViewCellGeometry(Exporter *exporter,
|
---|
| 842 | ViewCell *vc,
|
---|
[660] | 843 | const Plane3 *clipPlane = NULL) const;
|
---|
[547] | 844 |
|
---|
[580] | 845 | void CollectMergeCandidates(const VssRayContainer &rays, vector<MergeCandidate> &candidates);
|
---|
| 846 |
|
---|
[752] | 847 | virtual void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs) {};
|
---|
[440] | 848 | protected:
|
---|
| 849 |
|
---|
[482] | 850 | void ExportLeaves(const ObjectContainer &objects,
|
---|
| 851 | const VssRayContainer &sampleRays);
|
---|
| 852 |
|
---|
[480] | 853 | void CollectViewCells();
|
---|
| 854 |
|
---|
[482] | 855 | void ExportColor(Exporter *exporter, ViewCell *vc) const;
|
---|
| 856 |
|
---|
| 857 |
|
---|
[547] | 858 |
|
---|
[440] | 859 | /// the BSP tree.
|
---|
| 860 | VspKdTree *mVspKdTree;
|
---|
| 861 | };
|
---|
| 862 |
|
---|
| 863 |
|
---|
[442] | 864 |
|
---|
| 865 | /**
|
---|
| 866 | Manages different higher order operations on the view cells.
|
---|
| 867 | */
|
---|
| 868 | class VspBspViewCellsManager: public ViewCellsManager
|
---|
| 869 | {
|
---|
| 870 |
|
---|
| 871 | public:
|
---|
| 872 |
|
---|
[574] | 873 | VspBspViewCellsManager(VspBspTree *tree);
|
---|
[475] | 874 | ~VspBspViewCellsManager();
|
---|
[442] | 875 |
|
---|
[574] | 876 | int ConstructSubdivision(const ObjectContainer &objects,
|
---|
[487] | 877 | const VssRayContainer &rays);
|
---|
[442] | 878 |
|
---|
| 879 | int PostProcess(const ObjectContainer &objects,
|
---|
[466] | 880 | const VssRayContainer &rays);
|
---|
[442] | 881 |
|
---|
| 882 | void Visualize(const ObjectContainer &objects,
|
---|
[466] | 883 | const VssRayContainer &sampleRays);
|
---|
[442] | 884 |
|
---|
| 885 | int GetType() const;
|
---|
| 886 |
|
---|
| 887 | ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
|
---|
| 888 |
|
---|
| 889 | bool ViewCellsConstructed() const;
|
---|
| 890 |
|
---|
[468] | 891 |
|
---|
| 892 | int CastLineSegment(const Vector3 &origin,
|
---|
| 893 | const Vector3 &termination,
|
---|
| 894 | ViewCellContainer &viewcells);
|
---|
[452] | 895 |
|
---|
[471] | 896 | float GetProbability(ViewCell *viewCell);
|
---|
[479] | 897 |
|
---|
[879] | 898 | ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const;
|
---|
[477] | 899 |
|
---|
[487] | 900 | bool GetViewPoint(Vector3 &viewPoint) const;
|
---|
| 901 |
|
---|
[490] | 902 | bool ViewPointValid(const Vector3 &viewPoint) const;
|
---|
[503] | 903 |
|
---|
| 904 | void CreateMesh(ViewCell *vc);
|
---|
| 905 |
|
---|
[871] | 906 | bool ExportViewCells(const string filename, const bool exportPvs);
|
---|
[508] | 907 |
|
---|
[532] | 908 | int CastBeam(Beam &beam);
|
---|
| 909 |
|
---|
[591] | 910 | void ExportViewCellGeometry(Exporter *exporter,
|
---|
| 911 | ViewCell *vc,
|
---|
[660] | 912 | const Plane3 *clipPlane = NULL) const;
|
---|
[547] | 913 |
|
---|
[551] | 914 | //float GetVolume(ViewCell *viewCell) const;
|
---|
| 915 |
|
---|
[555] | 916 | void Finalize(ViewCell *viewCell, const bool createMesh);
|
---|
[551] | 917 |
|
---|
[580] | 918 | void CollectMergeCandidates(const VssRayContainer &rays, vector<MergeCandidate> &candidates);
|
---|
| 919 |
|
---|
[697] | 920 | /** Returns true if this view cell is equivavalent to a spatial node.
|
---|
| 921 | */
|
---|
[609] | 922 | bool EqualToSpatialNode(ViewCell *viewCell) const;
|
---|
[607] | 923 |
|
---|
[697] | 924 |
|
---|
[442] | 925 | protected:
|
---|
[475] | 926 |
|
---|
[697] | 927 | int ComputeBoxIntersections(const AxisAlignedBox3 &box, ViewCellContainer &viewCells) const;
|
---|
[651] | 928 |
|
---|
[610] | 929 | /** Returns node of the spatial hierarchy corresponding to the view cell
|
---|
| 930 | if such a node exists.
|
---|
| 931 | */
|
---|
[609] | 932 | BspNode *GetSpatialNode(ViewCell *viewCell) const;
|
---|
[610] | 933 |
|
---|
[503] | 934 | /** Merges the view cells.
|
---|
[442] | 935 | */
|
---|
[508] | 936 | void MergeViewCells(const VssRayContainer &rays,
|
---|
| 937 | const ObjectContainer &objects);
|
---|
[503] | 938 |
|
---|
[564] | 939 | void RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects);
|
---|
[442] | 940 |
|
---|
[480] | 941 | void CollectViewCells();
|
---|
| 942 |
|
---|
[482] | 943 | /** Returns maximal depth difference of view cell
|
---|
| 944 | leaves in tree.
|
---|
| 945 | */
|
---|
| 946 | int GetMaxTreeDiff(ViewCell *vc) const;
|
---|
[485] | 947 |
|
---|
[482] | 948 |
|
---|
[485] | 949 | void ExportColor(Exporter *exporter, ViewCell *vc) const;
|
---|
| 950 |
|
---|
[752] | 951 | /** Prepare view cells for use after loading them from disc.
|
---|
| 952 | */
|
---|
[577] | 953 | void PrepareLoadedViewCells();
|
---|
| 954 |
|
---|
[752] | 955 | /** Constructs merge hierarchy which corresponds to the spatial hierarchy.
|
---|
| 956 | */
|
---|
[650] | 957 | ViewCell *ConstructSpatialMergeTree(BspNode *root);
|
---|
[649] | 958 |
|
---|
[752] | 959 | void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs);
|
---|
| 960 |
|
---|
| 961 |
|
---|
| 962 | // HACK
|
---|
[697] | 963 | void TestFilter(const ObjectContainer &objects);
|
---|
| 964 |
|
---|
| 965 |
|
---|
| 966 |
|
---|
[442] | 967 | /// the view space partition BSP tree.
|
---|
| 968 | VspBspTree *mVspBspTree;
|
---|
| 969 |
|
---|
[591] | 970 |
|
---|
[442] | 971 | private:
|
---|
| 972 |
|
---|
| 973 | /** Exports visualization of the BSP splits.
|
---|
| 974 | */
|
---|
[485] | 975 | void ExportSplits(const ObjectContainer &objects,
|
---|
| 976 | const VssRayContainer &rays);
|
---|
[442] | 977 |
|
---|
| 978 | /** Exports visualization of the BSP PVS.
|
---|
| 979 | */
|
---|
[485] | 980 | void ExportBspPvs(const ObjectContainer &objects,
|
---|
| 981 | const VssRayContainer &rays);
|
---|
[442] | 982 |
|
---|
[693] | 983 | void TestSubdivision();
|
---|
[442] | 984 | };
|
---|
| 985 |
|
---|
[575] | 986 |
|
---|
| 987 | class ViewCellsManagerFactory
|
---|
| 988 | {
|
---|
| 989 |
|
---|
| 990 | public:
|
---|
| 991 |
|
---|
| 992 | ViewCellsManager *Create(const string mName);
|
---|
| 993 |
|
---|
| 994 | };
|
---|
| 995 |
|
---|
[860] | 996 | }
|
---|
| 997 |
|
---|
[440] | 998 | #endif
|
---|