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