[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 |
|
---|
[1001] | 172 | /** Derive view cells from objects. The view ells are created by taking the object
|
---|
| 173 | geometry into account.
|
---|
[440] | 174 | */
|
---|
| 175 | void DeriveViewCells(const ObjectContainer &objects,
|
---|
| 176 | ViewCellContainer &viewCells,
|
---|
| 177 | const int maxViewCells) const;
|
---|
| 178 |
|
---|
| 179 | /** Sets maximal number of samples used for the
|
---|
| 180 | construction of the view cells.
|
---|
| 181 | */
|
---|
| 182 | void SetVisualizationSamples(const int visSamples);
|
---|
| 183 |
|
---|
[574] | 184 | /** Sets maximal number of samples used for the construction of the view cells.
|
---|
[440] | 185 | */
|
---|
| 186 | void SetConstructionSamples(const int constructionSamples);
|
---|
| 187 |
|
---|
[574] | 188 | /** Sets maximal number of samples used for the visualization of the view cells.
|
---|
| 189 | */
|
---|
| 190 | void SetInitialSamples(const int initialSamples);
|
---|
| 191 |
|
---|
[440] | 192 | /** Sets maximal number of samples used for the post processing of the view cells.
|
---|
| 193 | */
|
---|
| 194 | void SetPostProcessSamples(const int postProcessingSamples);
|
---|
| 195 |
|
---|
| 196 | /** See set.
|
---|
| 197 | */
|
---|
| 198 | int GetVisualizationSamples() const;
|
---|
| 199 |
|
---|
| 200 | /** See set.
|
---|
| 201 | */
|
---|
| 202 | int GetConstructionSamples() const;
|
---|
| 203 |
|
---|
| 204 | /** See set.
|
---|
| 205 | */
|
---|
| 206 | int GetPostProcessSamples() const;
|
---|
| 207 |
|
---|
| 208 | /** Returns true if view cells wer already constructed.
|
---|
| 209 | */
|
---|
| 210 | virtual bool ViewCellsConstructed() const = 0;
|
---|
[441] | 211 |
|
---|
[477] | 212 | /** cast line segment to get a list of unique viewcells which are intersected
|
---|
| 213 | by this line segment
|
---|
| 214 | */
|
---|
[466] | 215 |
|
---|
[477] | 216 | virtual int CastLineSegment(const Vector3 &origin,
|
---|
[466] | 217 | const Vector3 &termination,
|
---|
| 218 | ViewCellContainer &viewcells
|
---|
| 219 | ) = 0;
|
---|
| 220 |
|
---|
[477] | 221 | virtual void GetPvsStatistics(PvsStatistics &stat);
|
---|
[466] | 222 |
|
---|
[904] | 223 | virtual void GetPrVS(const Vector3 &viewPoint, PrVs &prvs, const float filterWidth);
|
---|
[677] | 224 |
|
---|
[697] | 225 | /** Get a viewcell containing the specified point
|
---|
[879] | 226 | @param active if the active or elementary view cell should be returned.
|
---|
[697] | 227 | */
|
---|
[879] | 228 | virtual ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const = 0;
|
---|
[492] | 229 |
|
---|
[503] | 230 | virtual void PrintPvsStatistics(ostream &s);
|
---|
[467] | 231 |
|
---|
[719] | 232 | /** Updates pvs of the view cell hierarchy if necessary.
|
---|
| 233 | */
|
---|
| 234 | void UpdatePvs();
|
---|
| 235 |
|
---|
[477] | 236 | /** Returns probability that view point lies in one view cell.
|
---|
| 237 | */
|
---|
| 238 | virtual float GetProbability(ViewCell *viewCell) = 0;
|
---|
[468] | 239 |
|
---|
[477] | 240 | /** Returns render cost of a single view cell given the render cost of an object.
|
---|
| 241 | */
|
---|
[728] | 242 | float GetRendercost(ViewCell *viewCell) const;
|
---|
[468] | 243 |
|
---|
[720] | 244 | /** Returns reference to container of loaded / generated view cells.
|
---|
[477] | 245 | */
|
---|
| 246 | ViewCellContainer &GetViewCells();
|
---|
[468] | 247 |
|
---|
[485] | 248 | /** Helper function used to split ray sets uniformly
|
---|
| 249 | into one that is currently used and the other that
|
---|
| 250 | is saved for later processing.
|
---|
| 251 | @param sourceRays the input ray set
|
---|
| 252 | @param maxSize the maximal number of rays that will be used
|
---|
| 253 | @param usedRays returns the used ray set
|
---|
| 254 | @param savedRays if not null, returns the saved ray set
|
---|
[477] | 255 | */
|
---|
| 256 | void GetRaySets(const VssRayContainer &sourceRays,
|
---|
[485] | 257 | const int maxSize,
|
---|
| 258 | VssRayContainer &usedRays,
|
---|
| 259 | VssRayContainer *savedRays = NULL) const;
|
---|
| 260 |
|
---|
[480] | 261 | /** Returns accumulated area of all view cells.
|
---|
| 262 | */
|
---|
| 263 | float GetAccVcArea();
|
---|
[470] | 264 |
|
---|
[480] | 265 | /** Returns area of one view cell.
|
---|
| 266 | */
|
---|
| 267 | virtual float GetArea(ViewCell *viewCell) const;
|
---|
[470] | 268 |
|
---|
[551] | 269 | /** Returns volume of view cell.
|
---|
[480] | 270 | */
|
---|
| 271 | virtual float GetVolume(ViewCell *viewCell) const;
|
---|
[470] | 272 |
|
---|
[480] | 273 | /** Sets the current renderer mainly for view cells statistics.
|
---|
| 274 | */
|
---|
| 275 | void SetRenderer(Renderer *renderer);
|
---|
| 276 |
|
---|
[487] | 277 | /** Computes a (random) view point in the valid view space.
|
---|
| 278 | @returns true if valid view point was found
|
---|
| 279 | */
|
---|
| 280 | virtual bool GetViewPoint(Vector3 &viewPoint) const;
|
---|
| 281 |
|
---|
[490] | 282 | /** Returns true if this view point is in the valid view space.
|
---|
| 283 | */
|
---|
| 284 | virtual bool ViewPointValid(const Vector3 &viewPoint) const;
|
---|
| 285 |
|
---|
[487] | 286 | /** Sets a view space boundary.
|
---|
| 287 | */
|
---|
| 288 | void SetViewSpaceBox(const AxisAlignedBox3 &box);
|
---|
| 289 |
|
---|
[519] | 290 | AxisAlignedBox3 GetViewSpaceBox() const;
|
---|
| 291 |
|
---|
[503] | 292 | /** Creates mesh for this view cell.
|
---|
| 293 | */
|
---|
| 294 | virtual void CreateMesh(ViewCell *vc) = NULL;
|
---|
[487] | 295 |
|
---|
[508] | 296 | /** Writes view cells to disc.
|
---|
| 297 | */
|
---|
[931] | 298 | virtual bool ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects);
|
---|
[508] | 299 |
|
---|
[532] | 300 | /** Casts beam to collect view cells.
|
---|
| 301 | */
|
---|
| 302 | virtual int CastBeam(Beam &beam);
|
---|
| 303 |
|
---|
[547] | 304 | /** Checks if view cell is considered as valid.
|
---|
| 305 | */
|
---|
[561] | 306 | virtual bool CheckValidity(ViewCell *vc,
|
---|
[562] | 307 | int minPvsSize,
|
---|
| 308 | int maxPvsSize) const;
|
---|
[547] | 309 |
|
---|
[562] | 310 |
|
---|
| 311 | /** Sets validity of view cell
|
---|
| 312 | */
|
---|
| 313 | virtual void SetValidity(ViewCell *vc,
|
---|
| 314 | int minPvsSize,
|
---|
| 315 | int maxPvsSize) const;
|
---|
| 316 |
|
---|
[710] | 317 | /** sets validy of all viewcells
|
---|
| 318 | */
|
---|
[810] | 319 | virtual void SetValidity(int minPvsSize,
|
---|
[569] | 320 | int maxPvsSize) const;
|
---|
| 321 |
|
---|
[609] | 322 |
|
---|
| 323 | /** set valid viewcells in the range of pvs. sorts the viewcells
|
---|
[710] | 324 | according to the pvs and then pickups those in the ranges
|
---|
| 325 | */
|
---|
| 326 | void SetValidityPercentage(const float minValid, const float maxValid);
|
---|
[569] | 327 |
|
---|
[609] | 328 | int CountValidViewcells() const;
|
---|
| 329 |
|
---|
[547] | 330 | /** Returns maximal allowed pvs size.
|
---|
| 331 | */
|
---|
| 332 | int GetMaxPvsSize() const;
|
---|
| 333 |
|
---|
[562] | 334 | /** Returns maximal allowed pvs size.
|
---|
| 335 | */
|
---|
| 336 | int GetMinPvsSize() const;
|
---|
| 337 |
|
---|
[561] | 338 | /** Returns maximal ratio. i.e., currentPVs / maxPvs,
|
---|
| 339 | where pvs is still considered valid.
|
---|
| 340 | */
|
---|
| 341 | float GetMaxPvsRatio() const;
|
---|
| 342 |
|
---|
[547] | 343 | /** Exports view cell geometry.
|
---|
| 344 | */
|
---|
[591] | 345 | virtual void ExportViewCellGeometry(Exporter *exporter,
|
---|
| 346 | ViewCell *vc,
|
---|
[660] | 347 | const Plane3 *clipPlane = NULL) const = 0;
|
---|
[547] | 348 |
|
---|
[860] | 349 | /** Brings the view cells into their final state, computes meshes and volume.
|
---|
| 350 | */
|
---|
[551] | 351 | virtual void FinalizeViewCells(const bool createMesh);
|
---|
| 352 |
|
---|
[579] | 353 | /** Evaluates statistics values on view cells.
|
---|
| 354 | */
|
---|
[580] | 355 | void EvaluateRenderStatistics(float &totalRenderCost,
|
---|
| 356 | float &expectedRenderCost,
|
---|
| 357 | float &deviation,
|
---|
| 358 | float &variance,
|
---|
| 359 | int &totalPvs,
|
---|
| 360 | float &avgRenderCost);
|
---|
[579] | 361 |
|
---|
[580] | 362 |
|
---|
| 363 | /** Returns hierarchy of the view cells.
|
---|
| 364 | */
|
---|
| 365 | ViewCellsTree *GetViewCellsTree();
|
---|
| 366 |
|
---|
[581] | 367 | virtual void CollectMergeCandidates(const VssRayContainer &rays,
|
---|
| 368 | vector<MergeCandidate> &candidates) = 0;
|
---|
[580] | 369 |
|
---|
[610] | 370 | void CollectViewCells(const int n);
|
---|
| 371 |
|
---|
[660] | 372 | /** Returns true if this (logical) view cell is equal to a spatial node.
|
---|
| 373 | */
|
---|
[710] | 374 | virtual bool EqualToSpatialNode(ViewCell *viewCell) const;
|
---|
[580] | 375 |
|
---|
[660] | 376 | /** Sets current view cells set to active, i.e., the sampling is done in this view cell set.
|
---|
| 377 | */
|
---|
| 378 | void SetViewCellsActive();
|
---|
[599] | 379 |
|
---|
[660] | 380 | /** Evaluates worth of current view cell hierarchy.
|
---|
| 381 | */
|
---|
[664] | 382 | void EvalViewCellPartition(Preprocessor *preprocessor);
|
---|
[660] | 383 |
|
---|
[728] | 384 | /** Sets maximal size of a view cell filter.
|
---|
| 385 | */
|
---|
| 386 | void SetMaxFilterSize(const int size);
|
---|
[697] | 387 |
|
---|
[840] | 388 | /** Returns maximal filter size.
|
---|
| 389 | */
|
---|
| 390 | int GetMaxFilterSize() const;
|
---|
[746] | 391 |
|
---|
[840] | 392 | /** Deletes interior nodes from the tree which have negative merge cost set (local merge).
|
---|
| 393 | */
|
---|
| 394 | void DeleteLocalMergeTree(ViewCell *vc) const;
|
---|
[713] | 395 |
|
---|
[728] | 396 | /** Evaluautes histogram for a given number of view cells.
|
---|
| 397 | */
|
---|
| 398 | void EvalViewCellHistogram(const string filename, const int nViewCells);
|
---|
| 399 |
|
---|
[735] | 400 | /** Evaluautes histogram for a given number of view cells.
|
---|
| 401 | */
|
---|
| 402 | void EvalViewCellHistogramForPvsSize(const string filename, const int nViewCells);
|
---|
| 403 |
|
---|
[728] | 404 | /** Evaluates the render cost of a view cell.
|
---|
| 405 | */
|
---|
| 406 | float EvalRenderCost(Intersectable *obj) const;
|
---|
| 407 |
|
---|
[931] | 408 |
|
---|
[884] | 409 |
|
---|
[870] | 410 | /** Returns bounding box of a view cell.
|
---|
| 411 | */
|
---|
| 412 | AxisAlignedBox3 GetViewCellBox(ViewCell *vc);
|
---|
[859] | 413 |
|
---|
[840] | 414 | /** Exports bounding boxes of objects to file.
|
---|
| 415 | */
|
---|
| 416 | bool ExportBoundingBoxes(const string filename, const ObjectContainer &objects) const;
|
---|
[931] | 417 |
|
---|
[850] | 418 | /** Load the bounding boxes into the container.
|
---|
| 419 | */
|
---|
| 420 | bool LoadBoundingBoxes(const string filename, IndexedBoundingBoxContainer &boxes) const;
|
---|
[840] | 421 |
|
---|
[931] | 422 | bool GetExportPvs() const
|
---|
| 423 | {
|
---|
| 424 | return mExportPvs;
|
---|
| 425 | }
|
---|
[870] | 426 |
|
---|
| 427 | /** Loads view cells from file. The view cells manager is created with
|
---|
| 428 | respect to the loaded view cells.
|
---|
| 429 |
|
---|
| 430 | @returns the view cells manager if loading was successful, false otherwise
|
---|
| 431 | */
|
---|
[938] | 432 | static ViewCellsManager *LoadViewCells(const string &filename,
|
---|
[931] | 433 | ObjectContainer *objects,
|
---|
[938] | 434 | Environment *env,
|
---|
[944] | 435 | const bool finalizeViewCells,
|
---|
[931] | 436 | BoundingBoxConverter *bconverter = NULL);
|
---|
[870] | 437 |
|
---|
[904] | 438 |
|
---|
[931] | 439 | ////////////////////////////////////////////////////////7
|
---|
| 440 | // visiblity filter options
|
---|
| 441 | // TODO: write own visibiltiy filter class
|
---|
| 442 | void ApplyFilter(KdTree *kdTree,
|
---|
| 443 | const float viewSpaceFilterSize,
|
---|
| 444 | const float spatialFilterSize);
|
---|
[904] | 445 |
|
---|
[931] | 446 | void ApplySpatialFilter(KdTree *kdTree,
|
---|
| 447 | const float spatialFilterSize,
|
---|
| 448 | ObjectPvs &pvs);
|
---|
[480] | 449 |
|
---|
[931] | 450 | void ApplyFilter(ViewCell *viewCell,
|
---|
| 451 | KdTree *kdTree,
|
---|
| 452 | const float viewSpaceFilterSize,
|
---|
| 453 | const float spatialFilterSize,
|
---|
| 454 | ObjectPvs &pvs);
|
---|
| 455 |
|
---|
| 456 | float GetFilterWidth();
|
---|
| 457 |
|
---|
| 458 | float GetAbsFilterWidth();
|
---|
| 459 |
|
---|
| 460 |
|
---|
[697] | 461 | /** Returns the bounding box of filter width.
|
---|
| 462 | */
|
---|
| 463 | AxisAlignedBox3 GetFilterBBox(const Vector3 &viewPoint, const float width) const;
|
---|
[609] | 464 |
|
---|
[979] | 465 |
|
---|
[931] | 466 | protected:
|
---|
| 467 | /** Exports bounding boxes as xml stream
|
---|
| 468 | */
|
---|
[955] | 469 | //bool ExportBoundingBoxes(ofstream &xmlstream, const ObjectContainer &objects) const;
|
---|
[931] | 470 |
|
---|
[697] | 471 | /** Intersects box with the tree and returns the number of intersected boxes.
|
---|
| 472 | @returns number of view cells found
|
---|
| 473 | */
|
---|
[710] | 474 | virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box,
|
---|
| 475 | ViewCellContainer &viewCells) const;
|
---|
[697] | 476 |
|
---|
[880] | 477 | /** Tests the visibility filter functionality.
|
---|
| 478 | */
|
---|
[697] | 479 | virtual void TestFilter(const ObjectContainer &objects) {};
|
---|
| 480 |
|
---|
[931] | 481 | /** If the view cells tree was already constructed or not.
|
---|
[581] | 482 | */
|
---|
| 483 | bool ViewCellsTreeConstructed() const;
|
---|
| 484 |
|
---|
[574] | 485 | int CastPassSamples(const int samplesPerPass,
|
---|
| 486 | const int sampleType,
|
---|
| 487 | VssRayContainer &vssRays) const;
|
---|
[573] | 488 |
|
---|
[931] | 489 | /** Parse the options from the environment file.
|
---|
| 490 | */
|
---|
[482] | 491 | void ParseEnvironment();
|
---|
| 492 |
|
---|
[508] | 493 | /** Creates unique view cell ids.
|
---|
| 494 | */
|
---|
| 495 | void CreateUniqueViewCellIds();
|
---|
[547] | 496 |
|
---|
[551] | 497 | /** Finalizes, i.e., creates mesh, volume, area etc. for the view cell.
|
---|
| 498 | */
|
---|
| 499 | virtual void Finalize(ViewCell *viewCell, const bool createMesh);
|
---|
| 500 |
|
---|
[480] | 501 | /** Recollects view cells and resets statistics.
|
---|
| 502 | */
|
---|
| 503 | void ResetViewCells();
|
---|
[482] | 504 |
|
---|
[480] | 505 | /** Collects the view cells in the view cell container.
|
---|
| 506 | */
|
---|
| 507 | virtual void CollectViewCells() = 0;
|
---|
[482] | 508 |
|
---|
[479] | 509 | /** Evaluates view cells statistics and stores it in
|
---|
| 510 | mViewCellsStatistics.
|
---|
| 511 | */
|
---|
| 512 | void EvaluateViewCellsStats();
|
---|
[482] | 513 |
|
---|
| 514 | //-- helper functions for view cell visualization
|
---|
| 515 |
|
---|
| 516 | /** Exports the view cell partition.
|
---|
| 517 | */
|
---|
[508] | 518 | void ExportViewCellsForViz(Exporter *exporter) const;
|
---|
[482] | 519 |
|
---|
| 520 | /** Sets exporter color.
|
---|
| 521 | */
|
---|
| 522 | virtual void ExportColor(Exporter *exporter, ViewCell *vc) const = 0;
|
---|
| 523 |
|
---|
[556] | 524 |
|
---|
[557] | 525 | virtual float GetViewSpaceVolume();
|
---|
| 526 |
|
---|
[503] | 527 | /** Creates meshes from the view cells.
|
---|
| 528 | */
|
---|
[517] | 529 | void CreateViewCellMeshes();
|
---|
[503] | 530 |
|
---|
[610] | 531 | /** Takes different measures to prepares the view cells after loading them from disc.
|
---|
[577] | 532 | */
|
---|
| 533 | virtual void PrepareLoadedViewCells() {};
|
---|
| 534 |
|
---|
[704] | 535 | /** Constructs local view cell merge hierarchy.
|
---|
| 536 | */
|
---|
| 537 | ViewCell *ConstructLocalMergeTree(ViewCell *currentViewCell,
|
---|
| 538 | const ViewCellContainer &viewCells);
|
---|
| 539 |
|
---|
[713] | 540 | /** Constructs local view cell merge hierarchy based solely on similarity with the
|
---|
| 541 | current viewcell
|
---|
| 542 | */
|
---|
| 543 | ViewCell *ConstructLocalMergeTree2(ViewCell *currentViewCell,
|
---|
| 544 | const ViewCellContainer &viewCells);
|
---|
| 545 |
|
---|
| 546 |
|
---|
[660] | 547 | /** Creates clip plane for visualization.
|
---|
| 548 | */
|
---|
| 549 | void CreateClipPlane();
|
---|
[591] | 550 |
|
---|
[860] | 551 | /** Updates pvs of all view cells for statistical evaluation after some more sampling
|
---|
| 552 | */
|
---|
[752] | 553 | virtual void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs) = 0;
|
---|
| 554 |
|
---|
| 555 |
|
---|
[979] | 556 | ////////////////////////////////////////////////
|
---|
[752] | 557 |
|
---|
[840] | 558 | /// if bounding boxes should also be exported
|
---|
| 559 | bool mExportBboxesForPvs;
|
---|
| 560 |
|
---|
[938] | 561 | Environment *environment;
|
---|
[660] | 562 | Plane3 mClipPlane;
|
---|
[837] | 563 |
|
---|
[660] | 564 | bool mUseClipPlaneForViz;
|
---|
[591] | 565 |
|
---|
| 566 |
|
---|
[480] | 567 | /// Renders the view cells.
|
---|
| 568 | Renderer *mRenderer;
|
---|
[440] | 569 |
|
---|
| 570 | /// Loaded view cells
|
---|
[469] | 571 | ViewCellContainer mViewCells;
|
---|
[440] | 572 |
|
---|
[580] | 573 | ViewCellsTree *mViewCellsTree;
|
---|
| 574 |
|
---|
[710] | 575 | bool mPruneEmptyViewCells;
|
---|
[706] | 576 |
|
---|
[719] | 577 | bool mViewCellPvsIsUpdated;
|
---|
[440] | 578 | /// maximum number of samples taken for construction of the view cells
|
---|
| 579 | int mConstructionSamples;
|
---|
[574] | 580 | int mSamplesPerPass;
|
---|
| 581 | int mInitialSamples;
|
---|
[440] | 582 | int mPostProcessSamples;
|
---|
| 583 | int mVisualizationSamples;
|
---|
[441] | 584 |
|
---|
[470] | 585 | float mTotalAreaValid;
|
---|
| 586 | float mTotalArea;
|
---|
[475] | 587 |
|
---|
[547] | 588 | int mMaxPvsSize;
|
---|
[562] | 589 | int mMinPvsSize;
|
---|
[547] | 590 | float mMaxPvsRatio;
|
---|
| 591 |
|
---|
[660] | 592 | int mSamplingType;
|
---|
[722] | 593 | int mEvaluationSamplingType;
|
---|
[600] | 594 | int mNumActiveViewCells;
|
---|
[586] | 595 | bool mCompressViewCells;
|
---|
| 596 |
|
---|
[660] | 597 | ViewCellsStatistics mCurrentViewCellsStats;
|
---|
[487] | 598 | /// the scene bounding box
|
---|
[542] | 599 | AxisAlignedBox3 mViewSpaceBox;
|
---|
[1001] | 600 |
|
---|
[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 |
|
---|
[991] | 975 | /** Evaluate from point queries for the current scene.
|
---|
| 976 | */
|
---|
| 977 | void EvalFromPointQueries();
|
---|
[979] | 978 |
|
---|
[991] | 979 |
|
---|
[442] | 980 | /// the view space partition BSP tree.
|
---|
| 981 | VspBspTree *mVspBspTree;
|
---|
| 982 |
|
---|
[591] | 983 |
|
---|
[442] | 984 | private:
|
---|
| 985 |
|
---|
| 986 | /** Exports visualization of the BSP splits.
|
---|
| 987 | */
|
---|
[485] | 988 | void ExportSplits(const ObjectContainer &objects,
|
---|
| 989 | const VssRayContainer &rays);
|
---|
[442] | 990 |
|
---|
| 991 | /** Exports visualization of the BSP PVS.
|
---|
| 992 | */
|
---|
[485] | 993 | void ExportBspPvs(const ObjectContainer &objects,
|
---|
| 994 | const VssRayContainer &rays);
|
---|
[442] | 995 |
|
---|
[693] | 996 | void TestSubdivision();
|
---|
[442] | 997 | };
|
---|
| 998 |
|
---|
[575] | 999 |
|
---|
| 1000 | class ViewCellsManagerFactory
|
---|
| 1001 | {
|
---|
| 1002 |
|
---|
| 1003 | public:
|
---|
| 1004 |
|
---|
| 1005 | ViewCellsManager *Create(const string mName);
|
---|
| 1006 |
|
---|
| 1007 | };
|
---|
| 1008 |
|
---|
[860] | 1009 | }
|
---|
| 1010 |
|
---|
[440] | 1011 | #endif
|
---|