[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"
|
---|
[440] | 8 |
|
---|
| 9 | class ViewCell;
|
---|
| 10 | class Intersectable;
|
---|
| 11 | class RenderSimulator;
|
---|
[480] | 12 | class Renderer;
|
---|
[440] | 13 | class Mesh;
|
---|
| 14 | struct Triangle3;
|
---|
| 15 | class SimulationStatistics;
|
---|
| 16 | class BspTree;
|
---|
| 17 | class KdTree;
|
---|
| 18 | class VspKdTree;
|
---|
| 19 | class VspBspTree;
|
---|
| 20 | class KdNode;
|
---|
| 21 | class KdLeaf;
|
---|
| 22 | class VspKdTree;
|
---|
| 23 | class AxisAlignedBox3;
|
---|
[448] | 24 | class BspLeaf;
|
---|
[475] | 25 | class ViewCellsStatistics;
|
---|
[482] | 26 | class Exporter;
|
---|
[475] | 27 | struct BspRay;
|
---|
| 28 |
|
---|
[440] | 29 | /**
|
---|
| 30 | Manages different higher order operations on the view cells.
|
---|
| 31 | */
|
---|
| 32 | class ViewCellsManager
|
---|
| 33 | {
|
---|
| 34 |
|
---|
| 35 | public:
|
---|
[467] | 36 | struct PvsStatistics {
|
---|
| 37 | int minPvs;
|
---|
| 38 | int maxPvs;
|
---|
| 39 | float avgPvs;
|
---|
| 40 | int viewcells;
|
---|
| 41 | };
|
---|
[466] | 42 |
|
---|
| 43 | /// view cell container types
|
---|
| 44 | enum {BSP, KD, VSP_KD, VSP_BSP};
|
---|
| 45 |
|
---|
[440] | 46 | /** Constructor taking the maximal number of samples used for construction
|
---|
| 47 | */
|
---|
| 48 | ViewCellsManager(const int constructionSamples);
|
---|
| 49 |
|
---|
| 50 | ViewCellsManager();
|
---|
| 51 |
|
---|
[462] | 52 | virtual ~ViewCellsManager();
|
---|
[440] | 53 |
|
---|
| 54 | /** Constructs view cell container with a given number of samples.
|
---|
| 55 | */
|
---|
| 56 | virtual int Construct(const ObjectContainer &objects,
|
---|
| 57 | const VssRayContainer &rays,
|
---|
| 58 | AxisAlignedBox3 *sceneBbox = NULL) = 0;
|
---|
| 59 |
|
---|
[441] | 60 | /** Computes sample contributions of the rays to the view cells PVS.
|
---|
| 61 |
|
---|
| 62 | @param rays bundle of rays used to find intersections with view cells and
|
---|
| 63 | adding the contribution
|
---|
| 64 | @param castRays true if ray should be cast to gain the information, false if rays
|
---|
| 65 | already hold the view cells intersection information and need not be recast.
|
---|
| 66 | @param sampleContributions returns the number of sample contributions
|
---|
| 67 | @param contributingSamples returns the number of contributingSamples
|
---|
[440] | 68 | */
|
---|
[475] | 69 | void ComputeSampleContributions(const VssRayContainer &rays);
|
---|
[440] | 70 |
|
---|
[441] | 71 |
|
---|
[475] | 72 | /** Computes sample contribution of a simgle ray to the view cells PVS.
|
---|
| 73 | @param ray finds intersections with view cells and holds the contribution
|
---|
| 74 | @param castRay true if ray should be cast to gain the information, false if ray
|
---|
| 75 | is already holding the information and need not be recast.
|
---|
[466] | 76 |
|
---|
[475] | 77 | @returns number of sample contributions
|
---|
| 78 | */
|
---|
| 79 | virtual void ComputeSampleContributions(VssRay &ray);
|
---|
[466] | 80 |
|
---|
[452] | 81 | /** Prints out statistics of the view cells.
|
---|
| 82 | */
|
---|
[475] | 83 | virtual void PrintStatistics(ostream &s) const;
|
---|
[452] | 84 |
|
---|
[440] | 85 | /** Post processes view cells givemŽa number of rays.
|
---|
| 86 | */
|
---|
[475] | 87 | virtual int PostProcess(const ObjectContainer &objects,
|
---|
| 88 | const VssRayContainer &rays) = 0;
|
---|
[440] | 89 |
|
---|
| 90 | /** Show visualization of the view cells.
|
---|
| 91 | */
|
---|
| 92 | virtual void Visualize(const ObjectContainer &objects,
|
---|
[466] | 93 | const VssRayContainer &sampleRays) = 0;
|
---|
[440] | 94 |
|
---|
| 95 | /** type of the view cell container.
|
---|
| 96 | */
|
---|
| 97 | virtual int GetType() const = 0;
|
---|
| 98 |
|
---|
[463] | 99 | /** Load the input viewcells. The input viewcells should be given as a collection
|
---|
| 100 | of meshes. Each mesh is assume to form a bounded polyhedron defining the interior of
|
---|
| 101 | the viewcell. The method then builds a BSP tree of these view cells.
|
---|
| 102 |
|
---|
| 103 | @param filename file to load
|
---|
| 104 | @return true on success
|
---|
| 105 | */
|
---|
[440] | 106 | bool LoadViewCells(const string filename);
|
---|
| 107 |
|
---|
| 108 | /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector.
|
---|
| 109 | @param the base triangle
|
---|
| 110 | @param the height of the newly created view cell
|
---|
| 111 | */
|
---|
| 112 | ViewCell *ExtrudeViewCell(const Triangle3 &baseTri, const float height) const;
|
---|
| 113 |
|
---|
| 114 | /** Merges two view cells.
|
---|
| 115 | @note the piercing rays of the front and back will be ordered
|
---|
| 116 | @returns new view cell based on the merging.
|
---|
| 117 | */
|
---|
[441] | 118 | ViewCell *MergeViewCells(ViewCell &front, ViewCell &back) const;
|
---|
[440] | 119 |
|
---|
| 120 | /** Generates view cell of type specified by this manager
|
---|
| 121 | */
|
---|
| 122 | virtual ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
|
---|
| 123 |
|
---|
| 124 | /** Adds a new view cell to the list of predefined view cells.
|
---|
| 125 | */
|
---|
| 126 | void AddViewCell(ViewCell *viewCell);
|
---|
| 127 |
|
---|
| 128 | /** Derive view cells from objects.
|
---|
| 129 | */
|
---|
| 130 | void DeriveViewCells(const ObjectContainer &objects,
|
---|
| 131 | ViewCellContainer &viewCells,
|
---|
| 132 | const int maxViewCells) const;
|
---|
| 133 |
|
---|
| 134 | /** Sets maximal number of samples used for the
|
---|
| 135 | construction of the view cells.
|
---|
| 136 | */
|
---|
| 137 | void SetVisualizationSamples(const int visSamples);
|
---|
| 138 |
|
---|
| 139 | /** Sets maximal number of samples used for the visualization of the view cells.
|
---|
| 140 | */
|
---|
| 141 | void SetConstructionSamples(const int constructionSamples);
|
---|
| 142 |
|
---|
| 143 | /** Sets maximal number of samples used for the post processing of the view cells.
|
---|
| 144 | */
|
---|
| 145 | void SetPostProcessSamples(const int postProcessingSamples);
|
---|
| 146 |
|
---|
| 147 | /** See set.
|
---|
| 148 | */
|
---|
| 149 | int GetVisualizationSamples() const;
|
---|
| 150 |
|
---|
| 151 | /** See set.
|
---|
| 152 | */
|
---|
| 153 | int GetConstructionSamples() const;
|
---|
| 154 |
|
---|
| 155 | /** See set.
|
---|
| 156 | */
|
---|
| 157 | int GetPostProcessSamples() const;
|
---|
| 158 |
|
---|
| 159 | /** Returns true if view cells wer already constructed.
|
---|
| 160 | */
|
---|
| 161 | virtual bool ViewCellsConstructed() const = 0;
|
---|
[441] | 162 |
|
---|
[477] | 163 | /** cast line segment to get a list of unique viewcells which are intersected
|
---|
| 164 | by this line segment
|
---|
| 165 | */
|
---|
[466] | 166 |
|
---|
[477] | 167 | virtual int CastLineSegment(const Vector3 &origin,
|
---|
[466] | 168 | const Vector3 &termination,
|
---|
| 169 | ViewCellContainer &viewcells
|
---|
| 170 | ) = 0;
|
---|
| 171 |
|
---|
[477] | 172 | virtual void GetPvsStatistics(PvsStatistics &stat);
|
---|
[466] | 173 |
|
---|
[477] | 174 | virtual void PrintPvsStatistics(ostream &s);
|
---|
[467] | 175 |
|
---|
[477] | 176 | /** Returns probability that view point lies in one view cell.
|
---|
| 177 | */
|
---|
| 178 | virtual float GetProbability(ViewCell *viewCell) = 0;
|
---|
[468] | 179 |
|
---|
[477] | 180 | /** Returns render cost of a single view cell given the render cost of an object.
|
---|
| 181 | */
|
---|
| 182 | virtual float GetRendercost(ViewCell *viewCell, float objRendercost) const = 0;
|
---|
[468] | 183 |
|
---|
[477] | 184 | /** Returns vector of loaded / generated view cells.
|
---|
| 185 | */
|
---|
| 186 | ViewCellContainer &GetViewCells();
|
---|
[468] | 187 |
|
---|
[477] | 188 | /** Helper function used to split ray set into one used for view cell
|
---|
| 189 | construction and one cast after construction.
|
---|
| 190 | */
|
---|
| 191 | void GetRaySets(const VssRayContainer &sourceRays,
|
---|
| 192 | VssRayContainer &constructionRays,
|
---|
| 193 | VssRayContainer &savedRays) const;
|
---|
[440] | 194 |
|
---|
[480] | 195 | /** Returns accumulated area of all view cells.
|
---|
| 196 | */
|
---|
| 197 | float GetAccVcArea();
|
---|
[470] | 198 |
|
---|
[480] | 199 | /** Returns area of one view cell.
|
---|
| 200 | */
|
---|
| 201 | virtual float GetArea(ViewCell *viewCell) const;
|
---|
[470] | 202 |
|
---|
[480] | 203 | /** Returns volume of view cells.
|
---|
| 204 | */
|
---|
| 205 | virtual float GetVolume(ViewCell *viewCell) const;
|
---|
[470] | 206 |
|
---|
[480] | 207 | virtual AxisAlignedBox3 GetSceneBbox() const = 0;
|
---|
[477] | 208 |
|
---|
[480] | 209 | /** Sets the current renderer mainly for view cells statistics.
|
---|
| 210 | */
|
---|
| 211 | void SetRenderer(Renderer *renderer);
|
---|
| 212 |
|
---|
| 213 |
|
---|
[469] | 214 | protected:
|
---|
[480] | 215 |
|
---|
[482] | 216 | void ParseEnvironment();
|
---|
| 217 |
|
---|
[480] | 218 | /** Recollects view cells and resets statistics.
|
---|
| 219 | */
|
---|
| 220 | void ResetViewCells();
|
---|
[482] | 221 |
|
---|
[480] | 222 | /** Collects the view cells in the view cell container.
|
---|
| 223 | */
|
---|
| 224 | virtual void CollectViewCells() = 0;
|
---|
[482] | 225 |
|
---|
[479] | 226 | /** Evaluates view cells statistics and stores it in
|
---|
| 227 | mViewCellsStatistics.
|
---|
| 228 | */
|
---|
| 229 | void EvaluateViewCellsStats();
|
---|
[482] | 230 |
|
---|
| 231 |
|
---|
| 232 | //-- helper functions for view cell visualization
|
---|
| 233 |
|
---|
| 234 | /** Exports the view cell partition.
|
---|
| 235 | */
|
---|
| 236 | void ExportViewCells(Exporter *exporter) const;
|
---|
| 237 |
|
---|
| 238 | /** Sets exporter color.
|
---|
| 239 | */
|
---|
| 240 | virtual void ExportColor(Exporter *exporter, ViewCell *vc) const = 0;
|
---|
| 241 |
|
---|
| 242 | /** Exports view cell geometry.
|
---|
| 243 | */
|
---|
| 244 | virtual void ExportGeometry(Exporter *exporter, ViewCell *vc) const = 0;
|
---|
| 245 |
|
---|
[440] | 246 | /// the view cell corresponding to unbounded space
|
---|
| 247 | ViewCell *mUnbounded;
|
---|
| 248 |
|
---|
[480] | 249 | /// Renders the view cells.
|
---|
| 250 | Renderer *mRenderer;
|
---|
[440] | 251 |
|
---|
| 252 | /// Loaded view cells
|
---|
[469] | 253 | ViewCellContainer mViewCells;
|
---|
[440] | 254 |
|
---|
| 255 | /// maximum number of samples taken for construction of the view cells
|
---|
| 256 | int mConstructionSamples;
|
---|
| 257 | int mPostProcessSamples;
|
---|
| 258 | int mVisualizationSamples;
|
---|
[441] | 259 |
|
---|
[463] | 260 | //-- thresholds used for view cells merge
|
---|
| 261 | int mMinPvsDif;
|
---|
| 262 | int mMinPvs;
|
---|
[441] | 263 | int mMaxPvs;
|
---|
[470] | 264 |
|
---|
| 265 | float mTotalAreaValid;
|
---|
| 266 | float mTotalArea;
|
---|
[475] | 267 |
|
---|
[482] | 268 | // visualization color code
|
---|
| 269 | int mColorCode;
|
---|
| 270 |
|
---|
[475] | 271 | ViewCellsStatistics mViewCellsStats;
|
---|
[440] | 272 | };
|
---|
| 273 |
|
---|
[441] | 274 |
|
---|
| 275 |
|
---|
[440] | 276 | /**
|
---|
| 277 | Manages different higher order operations on the view cells.
|
---|
| 278 | */
|
---|
| 279 | class BspViewCellsManager: public ViewCellsManager
|
---|
| 280 | {
|
---|
| 281 |
|
---|
| 282 | public:
|
---|
| 283 |
|
---|
| 284 | BspViewCellsManager(BspTree *tree, int constructionSamples);
|
---|
| 285 |
|
---|
[477] | 286 | ~BspViewCellsManager();
|
---|
| 287 |
|
---|
[440] | 288 | int Construct(const ObjectContainer &objects,
|
---|
| 289 | const VssRayContainer &rays,
|
---|
| 290 | AxisAlignedBox3 *sceneBbox);
|
---|
| 291 |
|
---|
| 292 |
|
---|
| 293 | int PostProcess(const ObjectContainer &objects,
|
---|
[466] | 294 | const VssRayContainer &rays);
|
---|
[440] | 295 |
|
---|
| 296 | void Visualize(const ObjectContainer &objects,
|
---|
[466] | 297 | const VssRayContainer &sampleRays);
|
---|
[440] | 298 |
|
---|
| 299 | int GetType() const;
|
---|
| 300 |
|
---|
| 301 | ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
|
---|
| 302 |
|
---|
| 303 | bool ViewCellsConstructed() const;
|
---|
| 304 |
|
---|
[475] | 305 | //void PrintStatistics(ostream &s) const;
|
---|
[452] | 306 |
|
---|
[468] | 307 | int CastLineSegment(const Vector3 &origin,
|
---|
| 308 | const Vector3 &termination,
|
---|
| 309 | ViewCellContainer &viewcells);
|
---|
| 310 |
|
---|
[471] | 311 | float GetProbability(ViewCell *viewCell);
|
---|
[469] | 312 | float GetRendercost(ViewCell *viewCell, float objRendercost) const;
|
---|
[466] | 313 |
|
---|
[477] | 314 | AxisAlignedBox3 GetSceneBbox() const;
|
---|
| 315 |
|
---|
[440] | 316 | protected:
|
---|
| 317 |
|
---|
[480] | 318 | void CollectViewCells();
|
---|
| 319 |
|
---|
[441] | 320 | /** Merges view cells front and back leaf view cell.
|
---|
| 321 | */
|
---|
| 322 | bool MergeBspLeafViewCells(BspLeaf *front, BspLeaf *back) const;
|
---|
[440] | 323 |
|
---|
[441] | 324 | /** Returns true if front and back leaf should be merged.
|
---|
| 325 | */
|
---|
| 326 | bool ShouldMerge(BspLeaf *front, BspLeaf *back) const;
|
---|
| 327 |
|
---|
[477] | 328 | void ConstructBspRays(const VssRayContainer &rays,
|
---|
| 329 | const int numSamples);
|
---|
[482] | 330 |
|
---|
| 331 | void ExportColor(Exporter *exporter, ViewCell *vc) const;
|
---|
| 332 | void ExportGeometry(Exporter *exporter, ViewCell *vc) const;
|
---|
| 333 |
|
---|
[440] | 334 | /// the BSP tree.
|
---|
| 335 | BspTree *mBspTree;
|
---|
[475] | 336 |
|
---|
| 337 | vector<BspRay *> mBspRays;
|
---|
[440] | 338 |
|
---|
| 339 | private:
|
---|
| 340 |
|
---|
| 341 | /** Exports visualization of the BSP splits.
|
---|
| 342 | */
|
---|
[477] | 343 | void ExportSplits(const ObjectContainer &objects);
|
---|
[440] | 344 |
|
---|
| 345 | /** Exports visualization of the BSP PVS.
|
---|
| 346 | */
|
---|
[477] | 347 | void ExportBspPvs(const ObjectContainer &objects);
|
---|
[440] | 348 |
|
---|
| 349 | };
|
---|
| 350 |
|
---|
| 351 | /**
|
---|
| 352 | Manages different higher order operations on the KD type view cells.
|
---|
| 353 | */
|
---|
| 354 | class KdViewCellsManager: public ViewCellsManager
|
---|
| 355 | {
|
---|
| 356 |
|
---|
| 357 | public:
|
---|
| 358 |
|
---|
| 359 | KdViewCellsManager(KdTree *tree);
|
---|
| 360 |
|
---|
| 361 | int Construct(const ObjectContainer &objects,
|
---|
| 362 | const VssRayContainer &rays,
|
---|
| 363 | AxisAlignedBox3 *sceneBbox);
|
---|
| 364 |
|
---|
[478] | 365 | int CastLineSegment(const Vector3 &origin,
|
---|
| 366 | const Vector3 &termination,
|
---|
| 367 | ViewCellContainer &viewcells);
|
---|
[440] | 368 |
|
---|
| 369 | int PostProcess(const ObjectContainer &objects,
|
---|
[466] | 370 | const VssRayContainer &rays);
|
---|
[440] | 371 |
|
---|
| 372 | void Visualize(const ObjectContainer &objects,
|
---|
[466] | 373 | const VssRayContainer &sampleRays);
|
---|
[440] | 374 |
|
---|
| 375 | int GetType() const;
|
---|
| 376 |
|
---|
| 377 | bool ViewCellsConstructed() const;
|
---|
| 378 |
|
---|
| 379 |
|
---|
[452] | 380 | /** Prints out statistics of this approach.
|
---|
| 381 | */
|
---|
[475] | 382 | //void PrintStatistics(ostream &s) const;
|
---|
[452] | 383 |
|
---|
[471] | 384 | float GetProbability(ViewCell *viewCell);
|
---|
[469] | 385 | float GetRendercost(ViewCell *viewCell, float objRendercost) const;
|
---|
[477] | 386 |
|
---|
| 387 | AxisAlignedBox3 GetSceneBbox() const;
|
---|
[468] | 388 |
|
---|
[440] | 389 | protected:
|
---|
| 390 |
|
---|
[480] | 391 | void CollectViewCells();
|
---|
| 392 | KdNode *GetNodeForPvs(KdLeaf *leaf);
|
---|
[440] | 393 |
|
---|
[482] | 394 | void ExportColor(Exporter *exporter, ViewCell *vc) const;
|
---|
| 395 | void ExportGeometry(Exporter *exporter, ViewCell *vc) const;
|
---|
[440] | 396 |
|
---|
[480] | 397 | /// the BSP tree.
|
---|
| 398 | KdTree *mKdTree;
|
---|
[440] | 399 |
|
---|
[480] | 400 | /// depth of the KD tree nodes with represent the view cells
|
---|
| 401 | int mKdPvsDepth;
|
---|
[440] | 402 | };
|
---|
| 403 |
|
---|
| 404 | /**
|
---|
| 405 | Manages different higher order operations on the view cells
|
---|
| 406 | for vsp kd tree view cells.
|
---|
| 407 | */
|
---|
| 408 | class VspKdViewCellsManager: public ViewCellsManager
|
---|
| 409 | {
|
---|
| 410 |
|
---|
| 411 | public:
|
---|
| 412 |
|
---|
| 413 | VspKdViewCellsManager(VspKdTree *vspKdTree, int constructionSamples);
|
---|
| 414 |
|
---|
| 415 | int Construct(const ObjectContainer &objects,
|
---|
| 416 | const VssRayContainer &rays,
|
---|
| 417 | AxisAlignedBox3 *sceneBbox);
|
---|
| 418 |
|
---|
| 419 |
|
---|
| 420 | int PostProcess(const ObjectContainer &objects,
|
---|
[466] | 421 | const VssRayContainer &rays);
|
---|
[440] | 422 |
|
---|
| 423 | void Visualize(const ObjectContainer &objects,
|
---|
[466] | 424 | const VssRayContainer &sampleRays);
|
---|
[440] | 425 |
|
---|
| 426 | int GetType() const;
|
---|
| 427 |
|
---|
| 428 | bool ViewCellsConstructed() const;
|
---|
| 429 |
|
---|
[475] | 430 | //virtual void PrintStatistics(ostream &s) const;
|
---|
[440] | 431 |
|
---|
[462] | 432 | ViewCell *GenerateViewCell(Mesh *mesh) const;
|
---|
| 433 |
|
---|
[466] | 434 |
|
---|
| 435 | int CastLineSegment(const Vector3 &origin,
|
---|
| 436 | const Vector3 &termination,
|
---|
[468] | 437 | ViewCellContainer &viewcells);
|
---|
[466] | 438 |
|
---|
[471] | 439 | float GetProbability(ViewCell *viewCell);
|
---|
[469] | 440 | float GetRendercost(ViewCell *viewCell, float objRendercost) const;
|
---|
[468] | 441 |
|
---|
[477] | 442 | AxisAlignedBox3 GetSceneBbox() const;
|
---|
| 443 |
|
---|
[440] | 444 | protected:
|
---|
| 445 |
|
---|
[482] | 446 | void ExportLeaves(const ObjectContainer &objects,
|
---|
| 447 | const VssRayContainer &sampleRays);
|
---|
| 448 |
|
---|
[480] | 449 | void CollectViewCells();
|
---|
| 450 |
|
---|
[482] | 451 | void ExportColor(Exporter *exporter, ViewCell *vc) const;
|
---|
| 452 | void ExportGeometry(Exporter *exporter, ViewCell *vc) const;
|
---|
| 453 |
|
---|
| 454 |
|
---|
[440] | 455 | /// the BSP tree.
|
---|
| 456 | VspKdTree *mVspKdTree;
|
---|
| 457 | };
|
---|
| 458 |
|
---|
| 459 |
|
---|
[442] | 460 |
|
---|
| 461 | /**
|
---|
| 462 | Manages different higher order operations on the view cells.
|
---|
| 463 | */
|
---|
| 464 | class VspBspViewCellsManager: public ViewCellsManager
|
---|
| 465 | {
|
---|
| 466 |
|
---|
| 467 | public:
|
---|
| 468 |
|
---|
| 469 | VspBspViewCellsManager(VspBspTree *tree, int constructionSamples);
|
---|
[475] | 470 | ~VspBspViewCellsManager();
|
---|
[442] | 471 |
|
---|
| 472 | int Construct(const ObjectContainer &objects,
|
---|
| 473 | const VssRayContainer &rays,
|
---|
| 474 | AxisAlignedBox3 *sceneBbox);
|
---|
| 475 |
|
---|
| 476 |
|
---|
| 477 | int PostProcess(const ObjectContainer &objects,
|
---|
[466] | 478 | const VssRayContainer &rays);
|
---|
[442] | 479 |
|
---|
| 480 | void Visualize(const ObjectContainer &objects,
|
---|
[466] | 481 | const VssRayContainer &sampleRays);
|
---|
[442] | 482 |
|
---|
| 483 | int GetType() const;
|
---|
| 484 |
|
---|
| 485 | ViewCell *GenerateViewCell(Mesh *mesh = NULL) const;
|
---|
| 486 |
|
---|
| 487 | bool ViewCellsConstructed() const;
|
---|
| 488 |
|
---|
[475] | 489 | //void PrintStatistics(ostream &s) const;
|
---|
[468] | 490 |
|
---|
| 491 | int CastLineSegment(const Vector3 &origin,
|
---|
| 492 | const Vector3 &termination,
|
---|
| 493 | ViewCellContainer &viewcells);
|
---|
[452] | 494 |
|
---|
[471] | 495 | float GetProbability(ViewCell *viewCell);
|
---|
[469] | 496 | float GetRendercost(ViewCell *viewCell, float objRendercost) const;
|
---|
[479] | 497 |
|
---|
[477] | 498 | AxisAlignedBox3 GetSceneBbox() const;
|
---|
| 499 |
|
---|
[442] | 500 | protected:
|
---|
| 501 |
|
---|
[475] | 502 | /** Constructs bsp rays for post processing and visualization.
|
---|
| 503 | */
|
---|
| 504 | void ConstructBspRays(const VssRayContainer &rays, const int numSamples);
|
---|
| 505 |
|
---|
[442] | 506 | /** Merges view cells front and back leaf view cell.
|
---|
| 507 | */
|
---|
[448] | 508 | bool MergeVspBspLeafViewCells(BspLeaf *front, BspLeaf *back) const;
|
---|
[442] | 509 |
|
---|
| 510 | /** Returns true if front and back leaf should be merged.
|
---|
| 511 | */
|
---|
[448] | 512 | bool ShouldMerge(BspLeaf *front, BspLeaf *back) const;
|
---|
[442] | 513 |
|
---|
[480] | 514 | void CollectViewCells();
|
---|
| 515 |
|
---|
[482] | 516 | void ExportColor(Exporter *exporter, ViewCell *vc) const;
|
---|
| 517 | void ExportGeometry(Exporter *exporter, ViewCell *vc) const;
|
---|
| 518 |
|
---|
| 519 | /** Returns maximal depth difference of view cell
|
---|
| 520 | leaves in tree.
|
---|
| 521 | */
|
---|
| 522 | int GetMaxTreeDiff(ViewCell *vc) const;
|
---|
| 523 |
|
---|
[442] | 524 | /// the view space partition BSP tree.
|
---|
| 525 | VspBspTree *mVspBspTree;
|
---|
| 526 |
|
---|
[482] | 527 | /// helper array of rays
|
---|
[475] | 528 | vector<BspRay *> mBspRays;
|
---|
[442] | 529 |
|
---|
| 530 | private:
|
---|
| 531 |
|
---|
| 532 | /** Exports visualization of the BSP splits.
|
---|
| 533 | */
|
---|
[475] | 534 | void ExportSplits(const ObjectContainer &objects);
|
---|
[442] | 535 |
|
---|
| 536 | /** Exports visualization of the BSP PVS.
|
---|
| 537 | */
|
---|
[475] | 538 | void ExportBspPvs(const ObjectContainer &objects);
|
---|
[442] | 539 |
|
---|
| 540 | };
|
---|
| 541 |
|
---|
[440] | 542 | #endif
|
---|