[1237] | 1 | #ifndef _BvHierarchy_H__
|
---|
| 2 | #define _BvHierarchy_H__
|
---|
| 3 |
|
---|
| 4 | #include <stack>
|
---|
| 5 |
|
---|
| 6 | #include "Mesh.h"
|
---|
| 7 | #include "Containers.h"
|
---|
| 8 | #include "Statistics.h"
|
---|
| 9 | #include "VssRay.h"
|
---|
| 10 | #include "RayInfo.h"
|
---|
| 11 | #include "gzstream.h"
|
---|
[1239] | 12 | #include "SubdivisionCandidate.h"
|
---|
[1237] | 13 | #include "AxisAlignedBox3.h"
|
---|
[1315] | 14 | #include "IntersectableWrapper.h"
|
---|
[1667] | 15 | #include "HierarchyManager.h"
|
---|
[1237] | 16 |
|
---|
| 17 |
|
---|
| 18 | namespace GtpVisibilityPreprocessor {
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | class ViewCellLeaf;
|
---|
| 22 | class Plane3;
|
---|
| 23 | class AxisAlignedBox3;
|
---|
| 24 | class Ray;
|
---|
| 25 | class ViewCellsStatistics;
|
---|
| 26 | class ViewCellsManager;
|
---|
| 27 | class MergeCandidate;
|
---|
| 28 | class Beam;
|
---|
| 29 | class ViewCellsTree;
|
---|
| 30 | class Environment;
|
---|
| 31 | class BvhInterior;
|
---|
| 32 | class BvhLeaf;
|
---|
| 33 | class BvhNode;
|
---|
| 34 | class BvhIntersectable;
|
---|
| 35 | class BvhTree;
|
---|
| 36 | class VspTree;
|
---|
| 37 | class ViewCellsContainer;
|
---|
[1370] | 38 | class HierarchyManager;
|
---|
[1237] | 39 |
|
---|
[1297] | 40 |
|
---|
[1237] | 41 | /** View space partition statistics.
|
---|
| 42 | */
|
---|
| 43 | class BvhStatistics: public StatisticsBase
|
---|
| 44 | {
|
---|
| 45 | public:
|
---|
[1370] | 46 |
|
---|
| 47 | /// Constructor
|
---|
[1237] | 48 | BvhStatistics()
|
---|
| 49 | {
|
---|
| 50 | Reset();
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | int Nodes() const {return nodes;}
|
---|
| 54 | int Interior() const { return nodes / 2; }
|
---|
| 55 | int Leaves() const { return (nodes / 2) + 1; }
|
---|
| 56 |
|
---|
| 57 | double AvgDepth() const
|
---|
| 58 | { return accumDepth / (double)Leaves(); }
|
---|
| 59 |
|
---|
[1370] | 60 | double AvgObjectRefs() const
|
---|
| 61 | { return objectRefs / (double)Leaves(); }
|
---|
| 62 |
|
---|
| 63 | double AvgRayRefs() const
|
---|
| 64 | { return rayRefs / (double)Leaves(); }
|
---|
| 65 |
|
---|
| 66 |
|
---|
[1237] | 67 | void Reset()
|
---|
| 68 | {
|
---|
| 69 | nodes = 0;
|
---|
| 70 | splits = 0;
|
---|
| 71 | maxDepth = 0;
|
---|
| 72 | minDepth = 99999;
|
---|
| 73 | accumDepth = 0;
|
---|
| 74 | maxDepthNodes = 0;
|
---|
| 75 | minProbabilityNodes = 0;
|
---|
| 76 | maxCostNodes = 0;
|
---|
[1370] | 77 |
|
---|
| 78 | ///////////////////
|
---|
| 79 | minObjectsNodes = 0;
|
---|
[1237] | 80 | maxObjectRefs = 0;
|
---|
[1370] | 81 | minObjectRefs = 999999999;
|
---|
[1237] | 82 | objectRefs = 0;
|
---|
[1408] | 83 | emptyNodes = 0;
|
---|
[1370] | 84 |
|
---|
| 85 | ///////////////////
|
---|
| 86 | minRaysNodes = 0;
|
---|
| 87 | maxRayRefs = 0;
|
---|
| 88 | minRayRefs = 999999999;
|
---|
| 89 | rayRefs = 0;
|
---|
| 90 | maxRayContriNodes = 0;
|
---|
[1449] | 91 | mGlobalCostMisses = 0;
|
---|
[1237] | 92 | }
|
---|
| 93 |
|
---|
[1370] | 94 |
|
---|
| 95 | public:
|
---|
| 96 |
|
---|
| 97 | // total number of nodes
|
---|
| 98 | int nodes;
|
---|
| 99 | // number of splits
|
---|
| 100 | int splits;
|
---|
| 101 | // maximal reached depth
|
---|
| 102 | int maxDepth;
|
---|
| 103 | // minimal depth
|
---|
| 104 | int minDepth;
|
---|
| 105 | // max depth nodes
|
---|
| 106 | int maxDepthNodes;
|
---|
| 107 | // accumulated depth (used to compute average)
|
---|
| 108 | int accumDepth;
|
---|
| 109 | // minimum area nodes
|
---|
| 110 | int minProbabilityNodes;
|
---|
| 111 | /// nodes termination because of max cost ratio;
|
---|
| 112 | int maxCostNodes;
|
---|
[1449] | 113 | // global cost ratio violations
|
---|
| 114 | int mGlobalCostMisses;
|
---|
[1370] | 115 |
|
---|
[1449] | 116 | //////////////////
|
---|
[1370] | 117 | // nodes with minimum objects
|
---|
| 118 | int minObjectsNodes;
|
---|
| 119 | // max number of rays per node
|
---|
| 120 | int maxObjectRefs;
|
---|
| 121 | // min number of rays per node
|
---|
| 122 | int minObjectRefs;
|
---|
| 123 | /// object references
|
---|
| 124 | int objectRefs;
|
---|
[1408] | 125 | // leaves with no objects
|
---|
| 126 | int emptyNodes;
|
---|
[1370] | 127 |
|
---|
| 128 | //////////////////////////
|
---|
| 129 | // nodes with minimum rays
|
---|
| 130 | int minRaysNodes;
|
---|
| 131 | // max number of rays per node
|
---|
| 132 | int maxRayRefs;
|
---|
| 133 | // min number of rays per node
|
---|
| 134 | int minRayRefs;
|
---|
| 135 | /// object references
|
---|
| 136 | int rayRefs;
|
---|
| 137 | /// nodes with max ray contribution
|
---|
| 138 | int maxRayContriNodes;
|
---|
| 139 |
|
---|
[1237] | 140 | void Print(ostream &app) const;
|
---|
| 141 |
|
---|
| 142 | friend ostream &operator<<(ostream &s, const BvhStatistics &stat)
|
---|
| 143 | {
|
---|
| 144 | stat.Print(s);
|
---|
| 145 | return s;
|
---|
| 146 | }
|
---|
| 147 | };
|
---|
| 148 |
|
---|
| 149 |
|
---|
| 150 | /**
|
---|
| 151 | VspNode abstract class serving for interior and leaf node implementation
|
---|
| 152 | */
|
---|
| 153 | class BvhNode
|
---|
| 154 | {
|
---|
| 155 | public:
|
---|
| 156 |
|
---|
| 157 | // types of vsp nodes
|
---|
| 158 | enum {Interior, Leaf};
|
---|
| 159 |
|
---|
[1297] | 160 | BvhNode();
|
---|
[1237] | 161 | BvhNode(const AxisAlignedBox3 &bbox);
|
---|
| 162 | BvhNode(const AxisAlignedBox3 &bbox, BvhInterior *parent);
|
---|
| 163 |
|
---|
| 164 | virtual ~BvhNode(){};
|
---|
| 165 |
|
---|
| 166 | /** Determines whether this node is a leaf or not
|
---|
| 167 | @return true if leaf
|
---|
| 168 | */
|
---|
| 169 | virtual bool IsLeaf() const = 0;
|
---|
| 170 |
|
---|
| 171 | /** Determines whether this node is a root
|
---|
| 172 | @return true if root
|
---|
| 173 | */
|
---|
| 174 | virtual bool IsRoot() const;
|
---|
| 175 |
|
---|
| 176 | /** Returns parent node.
|
---|
| 177 | */
|
---|
| 178 | BvhInterior *GetParent();
|
---|
| 179 |
|
---|
| 180 | /** Sets parent node.
|
---|
| 181 | */
|
---|
| 182 | void SetParent(BvhInterior *parent);
|
---|
| 183 |
|
---|
[1666] | 184 | /** collects all objects under this node.
|
---|
| 185 | */
|
---|
[1614] | 186 | virtual void CollectObjects(ObjectContainer &objects) = 0;
|
---|
[1666] | 187 |
|
---|
[1237] | 188 | /** The bounding box specifies the node extent.
|
---|
| 189 | */
|
---|
[1357] | 190 | inline
|
---|
[1237] | 191 | AxisAlignedBox3 GetBoundingBox() const
|
---|
| 192 | { return mBoundingBox; }
|
---|
| 193 |
|
---|
[1666] | 194 | /** Sets bouding box of this node.
|
---|
| 195 | */
|
---|
[1357] | 196 | inline
|
---|
[1237] | 197 | void SetBoundingBox(const AxisAlignedBox3 &boundingBox)
|
---|
| 198 | { mBoundingBox = boundingBox; }
|
---|
| 199 |
|
---|
[1679] | 200 | /** Cost of mergin this node.
|
---|
| 201 | */
|
---|
| 202 | float GetMergeCost() {return (float)-mTimeStamp; }
|
---|
[1237] | 203 |
|
---|
[1679] | 204 | int mTimeStamp;
|
---|
[1666] | 205 |
|
---|
[1679] | 206 | int mPvsEntriesIncr;
|
---|
| 207 | float mMemoryIncr;
|
---|
| 208 | float mRenderCostDecr;
|
---|
| 209 |
|
---|
[1291] | 210 | /////////////////////////////////////
|
---|
[1237] | 211 | //-- mailing options
|
---|
[1291] | 212 |
|
---|
| 213 | static void NewMail(const int reserve = 1) {
|
---|
| 214 | sMailId += sReservedMailboxes;
|
---|
| 215 | sReservedMailboxes = reserve;
|
---|
| 216 | }
|
---|
| 217 |
|
---|
[1237] | 218 | void Mail() { mMailbox = sMailId; }
|
---|
| 219 | bool Mailed() const { return mMailbox == sMailId; }
|
---|
| 220 |
|
---|
[1291] | 221 | void Mail(const int mailbox) { mMailbox = sMailId + mailbox; }
|
---|
| 222 | bool Mailed(const int mailbox) const { return mMailbox == sMailId + mailbox; }
|
---|
| 223 |
|
---|
| 224 | int IncMail() { return ++ mMailbox - sMailId; }
|
---|
| 225 |
|
---|
[1237] | 226 | static int sMailId;
|
---|
| 227 | int mMailbox;
|
---|
[1291] | 228 | static int sReservedMailboxes;
|
---|
[1237] | 229 |
|
---|
| 230 | ///////////////////////////////////
|
---|
| 231 |
|
---|
| 232 | protected:
|
---|
| 233 |
|
---|
| 234 | /// the bounding box of the node
|
---|
| 235 | AxisAlignedBox3 mBoundingBox;
|
---|
| 236 | /// parent of this node
|
---|
| 237 | BvhInterior *mParent;
|
---|
| 238 | };
|
---|
| 239 |
|
---|
| 240 |
|
---|
| 241 | /** BSP interior node implementation
|
---|
| 242 | */
|
---|
| 243 | class BvhInterior: public BvhNode
|
---|
| 244 | {
|
---|
| 245 | public:
|
---|
| 246 | /** Standard contructor taking a bounding box as argument.
|
---|
| 247 | */
|
---|
| 248 | BvhInterior(const AxisAlignedBox3 &bbox);
|
---|
| 249 | BvhInterior(const AxisAlignedBox3 &bbox, BvhInterior *parent);
|
---|
| 250 |
|
---|
| 251 | ~BvhInterior();
|
---|
| 252 | /** @return false since it is an interior node
|
---|
| 253 | */
|
---|
| 254 | bool IsLeaf() const;
|
---|
[1294] | 255 |
|
---|
[1237] | 256 | BvhNode *GetBack() { return mBack; }
|
---|
| 257 | BvhNode *GetFront() { return mFront; }
|
---|
| 258 |
|
---|
| 259 | /** Replace front or back child with new child.
|
---|
| 260 | */
|
---|
| 261 | void ReplaceChildLink(BvhNode *oldChild, BvhNode *newChild);
|
---|
| 262 |
|
---|
| 263 | /** Replace front and back child.
|
---|
| 264 | */
|
---|
| 265 | void SetupChildLinks(BvhNode *front, BvhNode *back);
|
---|
| 266 |
|
---|
| 267 | friend ostream &operator<<(ostream &s, const BvhInterior &A)
|
---|
| 268 | {
|
---|
| 269 | return s << A.mBoundingBox;
|
---|
| 270 | }
|
---|
[1679] | 271 |
|
---|
| 272 | virtual void CollectObjects(ObjectContainer &objects);
|
---|
[1684] | 273 |
|
---|
[1237] | 274 | protected:
|
---|
| 275 |
|
---|
| 276 | /// back node
|
---|
| 277 | BvhNode *mBack;
|
---|
| 278 | /// front node
|
---|
| 279 | BvhNode *mFront;
|
---|
| 280 | };
|
---|
| 281 |
|
---|
| 282 |
|
---|
| 283 | /** BSP leaf node implementation.
|
---|
| 284 | */
|
---|
| 285 | class BvhLeaf: public BvhNode
|
---|
| 286 | {
|
---|
| 287 | public:
|
---|
| 288 | /** Standard contructor taking a bounding box as argument.
|
---|
| 289 | */
|
---|
| 290 | BvhLeaf(const AxisAlignedBox3 &bbox);
|
---|
| 291 | BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent);
|
---|
| 292 | BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent, const int numObjects);
|
---|
| 293 |
|
---|
| 294 | ~BvhLeaf();
|
---|
| 295 |
|
---|
| 296 | /** @return true since it is an interior node
|
---|
| 297 | */
|
---|
| 298 | bool IsLeaf() const;
|
---|
| 299 |
|
---|
[1297] | 300 | SubdivisionCandidate *GetSubdivisionCandidate()// const
|
---|
[1237] | 301 | {
|
---|
| 302 | return mSubdivisionCandidate;
|
---|
| 303 | }
|
---|
| 304 |
|
---|
[1297] | 305 | void SetSubdivisionCandidate(SubdivisionCandidate *candidate)
|
---|
| 306 | {
|
---|
| 307 | mSubdivisionCandidate = candidate;
|
---|
| 308 | }
|
---|
[1684] | 309 |
|
---|
| 310 | virtual void CollectObjects(ObjectContainer &objects);
|
---|
| 311 |
|
---|
[1237] | 312 | public:
|
---|
| 313 |
|
---|
| 314 | /// Rays piercing this leaf.
|
---|
| 315 | VssRayContainer mVssRays;
|
---|
| 316 | /// objects
|
---|
| 317 | ObjectContainer mObjects;
|
---|
[1259] | 318 | /// universal counter
|
---|
| 319 | int mCounter;
|
---|
[1287] | 320 |
|
---|
[1237] | 321 | protected:
|
---|
| 322 |
|
---|
| 323 | /// pointer to a split plane candidate splitting this leaf
|
---|
| 324 | SubdivisionCandidate *mSubdivisionCandidate;
|
---|
| 325 | };
|
---|
| 326 |
|
---|
| 327 |
|
---|
| 328 | typedef map<BvhNode *, BvhIntersectable *> BvhIntersectableMap;
|
---|
| 329 |
|
---|
| 330 |
|
---|
| 331 | /** View Space Partitioning tree.
|
---|
| 332 | */
|
---|
| 333 | class BvHierarchy
|
---|
| 334 | {
|
---|
| 335 | friend class ViewCellsParseHandlers;
|
---|
| 336 | friend class HierarchyManager;
|
---|
| 337 |
|
---|
[1379] | 338 | protected:
|
---|
[1345] | 339 | struct SortableEntry;
|
---|
| 340 | typedef vector<SortableEntry> SortableEntryContainer;
|
---|
| 341 |
|
---|
[1379] | 342 | public:
|
---|
| 343 |
|
---|
[1237] | 344 | /** Additional data which is passed down the BSP tree during traversal.
|
---|
| 345 | */
|
---|
| 346 | class BvhTraversalData
|
---|
| 347 | {
|
---|
| 348 | public:
|
---|
[1294] | 349 |
|
---|
[1237] | 350 | BvhTraversalData():
|
---|
| 351 | mNode(NULL),
|
---|
| 352 | mDepth(0),
|
---|
[1287] | 353 | mProbability(0.0),
|
---|
[1237] | 354 | mMaxCostMisses(0),
|
---|
[1370] | 355 | mAxis(0),
|
---|
| 356 | mNumRays(0)
|
---|
[1357] | 357 | {
|
---|
| 358 | mSortedObjects[0] = mSortedObjects[1] = mSortedObjects[2] = NULL;
|
---|
| 359 | }
|
---|
[1237] | 360 |
|
---|
| 361 | BvhTraversalData(BvhLeaf *node,
|
---|
| 362 | const int depth,
|
---|
[1370] | 363 | const float v,
|
---|
| 364 | const int numRays):
|
---|
[1237] | 365 | mNode(node),
|
---|
| 366 | mDepth(depth),
|
---|
[1370] | 367 | //mBoundingBox(box),
|
---|
[1287] | 368 | mProbability(v),
|
---|
[1237] | 369 | mMaxCostMisses(0),
|
---|
[1370] | 370 | mAxis(0),
|
---|
| 371 | mNumRays(numRays)
|
---|
[1357] | 372 | {
|
---|
| 373 | mSortedObjects[0] = mSortedObjects[1] = mSortedObjects[2] = NULL;
|
---|
| 374 | }
|
---|
[1237] | 375 |
|
---|
[1357] | 376 | /** Deletes contents and sets them to NULL.
|
---|
| 377 | */
|
---|
[1237] | 378 | void Clear()
|
---|
| 379 | {
|
---|
[1294] | 380 | DEL_PTR(mNode);
|
---|
[1370] | 381 | DEL_PTR(mSortedObjects[0]);
|
---|
[1357] | 382 | DEL_PTR(mSortedObjects[1]);
|
---|
[1370] | 383 | DEL_PTR(mSortedObjects[2]);
|
---|
[1237] | 384 | }
|
---|
| 385 |
|
---|
[1294] | 386 | /// the current node
|
---|
| 387 | BvhLeaf *mNode;
|
---|
| 388 | /// current depth
|
---|
| 389 | int mDepth;
|
---|
| 390 | /// the probability that this node is seen
|
---|
| 391 | float mProbability;
|
---|
| 392 | /// the bounding box of the node
|
---|
[1370] | 393 | //AxisAlignedBox3 mBoundingBox;
|
---|
[1294] | 394 | /// how often this branch has missed the max-cost ratio
|
---|
| 395 | int mMaxCostMisses;
|
---|
| 396 | /// current axis
|
---|
| 397 | int mAxis;
|
---|
[1370] | 398 | /// number of rays
|
---|
| 399 | int mNumRays;
|
---|
[1357] | 400 | /// the sorted objects for the three dimensions
|
---|
| 401 | ObjectContainer *mSortedObjects[3];
|
---|
[1237] | 402 | };
|
---|
| 403 |
|
---|
[1357] | 404 |
|
---|
| 405 | /** Candidate for a object space split.
|
---|
[1237] | 406 | */
|
---|
| 407 | class BvhSubdivisionCandidate: public SubdivisionCandidate
|
---|
| 408 | {
|
---|
| 409 | public:
|
---|
| 410 |
|
---|
[1294] | 411 | BvhSubdivisionCandidate(const BvhTraversalData &tData): mParentData(tData)
|
---|
[1237] | 412 | {};
|
---|
| 413 |
|
---|
[1305] | 414 | ~BvhSubdivisionCandidate()
|
---|
| 415 | {
|
---|
| 416 | mParentData.Clear();
|
---|
| 417 | }
|
---|
[1294] | 418 |
|
---|
[1237] | 419 | int Type() const { return OBJECT_SPACE; }
|
---|
| 420 |
|
---|
[1667] | 421 | void EvalCandidate(bool computeSplitplane = true)
|
---|
[1237] | 422 | {
|
---|
[1695] | 423 | mDirty = false;
|
---|
[1667] | 424 | sBvHierarchy->EvalSubdivisionCandidate(*this, computeSplitplane);
|
---|
[1237] | 425 | }
|
---|
| 426 |
|
---|
[1633] | 427 | bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet)
|
---|
[1632] | 428 | {
|
---|
[1667] | 429 | BvhNode *n = sBvHierarchy->Subdivide(splitQueue, this, terminationCriteriaMet);
|
---|
| 430 |
|
---|
[1632] | 431 | // local or global termination criteria failed
|
---|
| 432 | return !n->IsLeaf();
|
---|
[1633] | 433 | }
|
---|
[1632] | 434 |
|
---|
[1633] | 435 | void CollectDirtyCandidates(SubdivisionCandidateContainer &dirtyList,
|
---|
| 436 | const bool onlyUnmailed)
|
---|
| 437 | {
|
---|
| 438 | sBvHierarchy->CollectDirtyCandidates(this, dirtyList, onlyUnmailed);
|
---|
| 439 | }
|
---|
| 440 |
|
---|
[1237] | 441 | bool GlobalTerminationCriteriaMet() const
|
---|
| 442 | {
|
---|
| 443 | return sBvHierarchy->GlobalTerminationCriteriaMet(mParentData);
|
---|
| 444 | }
|
---|
| 445 |
|
---|
[1667] | 446 | BvhSubdivisionCandidate(const ObjectContainer &frontObjects,
|
---|
| 447 | const ObjectContainer &backObjects,
|
---|
| 448 | const BvhTraversalData &tData):
|
---|
[1237] | 449 | mFrontObjects(frontObjects), mBackObjects(backObjects), mParentData(tData)
|
---|
| 450 | {}
|
---|
[1294] | 451 |
|
---|
[1667] | 452 | float GetPriority() const
|
---|
| 453 | {
|
---|
| 454 | HierarchyManager *hm = sBvHierarchy->mHierarchyManager;
|
---|
[1673] | 455 |
|
---|
[1667] | 456 | if (hm->ConsiderMemory())
|
---|
| 457 | {
|
---|
[1679] | 458 | const float rc = mRenderCostDecrease / (hm->mInitialRenderCost - hm->GetHierarchyStats().mTotalCost + 1.0f);
|
---|
[1676] | 459 | //const float mc = mMemoryIncr / / hm->GetHierarchyStats().mMemory;
|
---|
[1679] | 460 | //const float rc = mPriority / (hm->mInitialRenderCost - hm->GetHierarchyStats().mTotalCost + 1.0f);
|
---|
[1676] | 461 | const float mc = (float)mPvsEntriesIncr / (float)hm->GetHierarchyStats().mPvsEntries;
|
---|
[1679] | 462 |
|
---|
| 463 | //cout << "\np: " << mPriority << " i: " << hm->mInitialRenderCost << " t: " << hm->GetHierarchyStats().mTotalCost << endl;
|
---|
| 464 | //cout << "osp rc: " << rc << " mc: " << mc << endl;
|
---|
| 465 |
|
---|
[1677] | 466 | return hm->GetMemoryConst() * rc - (1.0f - hm->GetMemoryConst()) * mc;
|
---|
[1667] | 467 | }
|
---|
| 468 | else
|
---|
| 469 | {
|
---|
| 470 | return mPriority;
|
---|
| 471 | }
|
---|
| 472 | }
|
---|
| 473 |
|
---|
[1305] | 474 | /// pointer to parent tree.
|
---|
[1294] | 475 | static BvHierarchy *sBvHierarchy;
|
---|
[1680] | 476 |
|
---|
[1294] | 477 | /// parent data
|
---|
| 478 | BvhTraversalData mParentData;
|
---|
[1305] | 479 | /// the objects on the front of the potential split
|
---|
[1294] | 480 | ObjectContainer mFrontObjects;
|
---|
[1305] | 481 | /// the objects on the back of the potential split
|
---|
[1294] | 482 | ObjectContainer mBackObjects;
|
---|
[1237] | 483 | };
|
---|
| 484 |
|
---|
| 485 | /** Struct for traversing line segment.
|
---|
| 486 | */
|
---|
| 487 | struct LineTraversalData
|
---|
| 488 | {
|
---|
| 489 | BvhNode *mNode;
|
---|
| 490 | Vector3 mExitPoint;
|
---|
| 491 |
|
---|
| 492 | float mMaxT;
|
---|
| 493 |
|
---|
| 494 | LineTraversalData () {}
|
---|
| 495 | LineTraversalData (BvhNode *n, const Vector3 &p, const float maxt):
|
---|
| 496 | mNode(n), mExitPoint(p), mMaxT(maxt) {}
|
---|
| 497 | };
|
---|
| 498 |
|
---|
| 499 |
|
---|
| 500 | /** Default constructor creating an empty tree.
|
---|
| 501 | */
|
---|
| 502 | BvHierarchy();
|
---|
| 503 |
|
---|
| 504 | /** Default destructor.
|
---|
| 505 | */
|
---|
| 506 | ~BvHierarchy();
|
---|
| 507 |
|
---|
| 508 | /** Returns tree statistics.
|
---|
| 509 | */
|
---|
| 510 | const BvhStatistics &GetStatistics() const;
|
---|
| 511 |
|
---|
| 512 | /** Returns bounding box of the specified node.
|
---|
| 513 | */
|
---|
| 514 | AxisAlignedBox3 GetBoundingBox(BvhNode *node) const;
|
---|
| 515 |
|
---|
| 516 | /** Reads parameters from environment singleton.
|
---|
| 517 | */
|
---|
| 518 | void ReadEnvironment();
|
---|
| 519 |
|
---|
| 520 | /** Evaluates candidate for splitting.
|
---|
| 521 | */
|
---|
[1680] | 522 | void EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitData,
|
---|
| 523 | bool computeSplitPlane = true);
|
---|
[1237] | 524 |
|
---|
| 525 | /** Returns list of leaves with pvs smaller than
|
---|
| 526 | a certain threshold.
|
---|
| 527 | @param onlyUnmailed if only the unmailed leaves should be considered
|
---|
| 528 | @param maxPvs the maximal pvs of a leaf to be added (-1 means unlimited)
|
---|
| 529 | */
|
---|
| 530 | void CollectLeaves(vector<BvhLeaf *> &leaves) const;
|
---|
| 531 |
|
---|
| 532 | /** Returns bounding box of the whole tree (= bbox of root node)
|
---|
| 533 | */
|
---|
| 534 | AxisAlignedBox3 GetBoundingBox()const;
|
---|
| 535 |
|
---|
| 536 | /** Returns root of the view space partitioning tree.
|
---|
| 537 | */
|
---|
| 538 | BvhNode *GetRoot() const;
|
---|
| 539 |
|
---|
| 540 | /** finds neighbouring leaves of this tree node.
|
---|
| 541 | */
|
---|
| 542 | int FindNeighbors(BvhLeaf *n,
|
---|
| 543 | vector<BvhLeaf *> &neighbors,
|
---|
| 544 | const bool onlyUnmailed) const;
|
---|
| 545 |
|
---|
| 546 | /** Returns random leaf of BSP tree.
|
---|
| 547 | @param halfspace defines the halfspace from which the leaf is taken.
|
---|
| 548 | */
|
---|
| 549 | BvhLeaf *GetRandomLeaf(const Plane3 &halfspace);
|
---|
| 550 |
|
---|
| 551 | /** Returns random leaf of BSP tree.
|
---|
| 552 | @param onlyUnmailed if only unmailed leaves should be returned.
|
---|
| 553 | */
|
---|
| 554 | BvhLeaf *GetRandomLeaf(const bool onlyUnmailed = false);
|
---|
| 555 |
|
---|
| 556 | /** Casts line segment into the tree.
|
---|
| 557 | @param origin the origin of the line segment
|
---|
| 558 | @param termination the end point of the line segment
|
---|
| 559 | @returns view cells intersecting the line segment.
|
---|
| 560 | */
|
---|
| 561 | int CastLineSegment(const Vector3 &origin,
|
---|
| 562 | const Vector3 &termination,
|
---|
| 563 | ViewCellContainer &viewcells);
|
---|
| 564 |
|
---|
| 565 | /** Sets pointer to view cells manager.
|
---|
| 566 | */
|
---|
| 567 | void SetViewCellsManager(ViewCellsManager *vcm);
|
---|
| 568 |
|
---|
| 569 | /** Writes tree to output stream
|
---|
| 570 | */
|
---|
| 571 | bool Export(OUT_STREAM &stream);
|
---|
| 572 |
|
---|
| 573 | /** Returns or creates a new intersectable for use in a kd based pvs.
|
---|
| 574 | The OspTree is responsible for destruction of the intersectable.
|
---|
| 575 | */
|
---|
| 576 | BvhIntersectable *GetOrCreateBvhIntersectable(BvhNode *node);
|
---|
| 577 |
|
---|
[1640] | 578 | /** Collects rays associated with the objects.
|
---|
[1237] | 579 | */
|
---|
| 580 | void CollectRays(const ObjectContainer &objects, VssRayContainer &rays) const;
|
---|
| 581 |
|
---|
| 582 | /** Intersects box with the tree and returns the number of intersected boxes.
|
---|
| 583 | @returns number of view cells found
|
---|
| 584 | */
|
---|
[1640] | 585 | int ComputeBoxIntersections(const AxisAlignedBox3 &box,
|
---|
| 586 | ViewCellContainer &viewCells) const;
|
---|
[1237] | 587 |
|
---|
| 588 | /** Returns leaf the point pt lies in, starting from root.
|
---|
| 589 | */
|
---|
| 590 | BvhLeaf *GetLeaf(Intersectable *obj, BvhNode *root = NULL) const;
|
---|
| 591 |
|
---|
[1370] | 592 | /** Sets a pointer to the view cells tree.
|
---|
| 593 | */
|
---|
[1237] | 594 | ViewCellsTree *GetViewCellsTree() const { return mViewCellsTree; }
|
---|
[1370] | 595 | /** See Get
|
---|
| 596 | */
|
---|
[1237] | 597 | void SetViewCellsTree(ViewCellsTree *vt) { mViewCellsTree = vt; }
|
---|
| 598 |
|
---|
[1640] | 599 | /** Returns estimated memory usage of tree.
|
---|
| 600 | */
|
---|
| 601 | float GetMemUsage() const;
|
---|
[1237] | 602 |
|
---|
[1680] | 603 |
|
---|
[1684] | 604 | ///////////////////////////
|
---|
| 605 | // hacks in order to provide interleaved heurisitcs
|
---|
| 606 |
|
---|
[1686] | 607 | BvhNode *SubdivideAndCopy(SplitQueue &tQueue, SubdivisionCandidate *splitCandidate);
|
---|
[1684] | 608 |
|
---|
| 609 | /////////////////////////////////
|
---|
| 610 |
|
---|
[1698] | 611 | float EvalAbsCost(const ObjectContainer &objects) const;
|
---|
| 612 |
|
---|
[1237] | 613 | protected:
|
---|
| 614 |
|
---|
| 615 | /** Returns true if tree can be terminated.
|
---|
| 616 | */
|
---|
[1251] | 617 | bool LocalTerminationCriteriaMet(const BvhTraversalData &data) const;
|
---|
[1237] | 618 |
|
---|
| 619 | /** Returns true if global tree can be terminated.
|
---|
| 620 | */
|
---|
[1251] | 621 | bool GlobalTerminationCriteriaMet(const BvhTraversalData &data) const;
|
---|
[1237] | 622 |
|
---|
[1287] | 623 | /** For sorting the objects during the heuristics
|
---|
| 624 | */
|
---|
[1237] | 625 | struct SortableEntry
|
---|
| 626 | {
|
---|
[1287] | 627 | Intersectable *mObject;
|
---|
[1237] | 628 | float mPos;
|
---|
| 629 |
|
---|
| 630 | SortableEntry() {}
|
---|
| 631 |
|
---|
[1287] | 632 | SortableEntry(Intersectable *obj, const float pos):
|
---|
| 633 | mObject(obj), mPos(pos)
|
---|
[1237] | 634 | {}
|
---|
| 635 |
|
---|
| 636 | bool operator<(const SortableEntry &b) const
|
---|
| 637 | {
|
---|
| 638 | return mPos < b.mPos;
|
---|
| 639 | }
|
---|
| 640 | };
|
---|
[1345] | 641 |
|
---|
[1287] | 642 | /** Evaluate balanced object partition.
|
---|
[1237] | 643 | */
|
---|
[1640] | 644 | float EvalLocalObjectPartition(const BvhTraversalData &tData,
|
---|
| 645 | const int axis,
|
---|
| 646 | ObjectContainer &objectsFront,
|
---|
| 647 | ObjectContainer &objectsBack);
|
---|
[1237] | 648 |
|
---|
[1640] | 649 | /** Evaluate surface area heuristic for the node.
|
---|
| 650 | */
|
---|
| 651 | float EvalSah(const BvhTraversalData &tData,
|
---|
| 652 | const int axis,
|
---|
| 653 | ObjectContainer &objectsFront,
|
---|
| 654 | ObjectContainer &objectsBack);
|
---|
[1323] | 655 |
|
---|
[1237] | 656 | /** Computes priority of the traversal data and stores it in tData.
|
---|
| 657 | */
|
---|
| 658 | void EvalPriority(BvhTraversalData &tData) const;
|
---|
| 659 |
|
---|
[1379] | 660 | /** Evaluates render cost of the bv induced by these objects
|
---|
[1237] | 661 | */
|
---|
[1379] | 662 | float EvalRenderCost(const ObjectContainer &objects) const;
|
---|
[1237] | 663 |
|
---|
| 664 | /** Evaluates tree stats in the BSP tree leafs.
|
---|
| 665 | */
|
---|
| 666 | void EvaluateLeafStats(const BvhTraversalData &data);
|
---|
| 667 |
|
---|
| 668 | /** Subdivides node using a best split priority queue.
|
---|
| 669 | @param tQueue the best split priority queue
|
---|
| 670 | @param splitCandidate the candidate for the next split
|
---|
| 671 | @param globalCriteriaMet if the global termination criteria were already met
|
---|
| 672 | @returns new root of the subtree
|
---|
| 673 | */
|
---|
[1640] | 674 | BvhNode *Subdivide(SplitQueue &tQueue,
|
---|
| 675 | SubdivisionCandidate *splitCandidate,
|
---|
| 676 | const bool globalCriteriaMet);
|
---|
[1237] | 677 |
|
---|
| 678 | /** Subdivides leaf.
|
---|
[1345] | 679 | @param sc the subdivisionCandidate holding all necessary data for subdivision
|
---|
[1237] | 680 |
|
---|
[1345] | 681 | @param frontData returns the traversal data for the front node
|
---|
| 682 | @param backData returns the traversal data for the back node
|
---|
[1237] | 683 |
|
---|
[1345] | 684 | @returns the new interior node = the of the subdivision
|
---|
[1237] | 685 | */
|
---|
[1640] | 686 | BvhInterior *SubdivideNode(const BvhSubdivisionCandidate &sc,
|
---|
| 687 | BvhTraversalData &frontData,
|
---|
| 688 | BvhTraversalData &backData);
|
---|
[1237] | 689 |
|
---|
| 690 | /** Splits the objects for the next subdivision.
|
---|
| 691 | @returns cost for this split
|
---|
| 692 | */
|
---|
[1640] | 693 | float SelectObjectPartition(const BvhTraversalData &tData,
|
---|
| 694 | ObjectContainer &frontObjects,
|
---|
[1676] | 695 | ObjectContainer &backObjects,
|
---|
| 696 | bool useVisibilityBasedHeuristics);
|
---|
[1237] | 697 |
|
---|
| 698 | /** Writes the node to disk
|
---|
| 699 | @note: should be implemented as visitor.
|
---|
| 700 | */
|
---|
| 701 | void ExportNode(BvhNode *node, OUT_STREAM &stream);
|
---|
| 702 |
|
---|
[1640] | 703 | /** Exports objects associated with this leaf.
|
---|
| 704 | */
|
---|
[1286] | 705 | void ExportObjects(BvhLeaf *leaf, OUT_STREAM &stream);
|
---|
| 706 |
|
---|
[1548] | 707 | /** Associates the objects with their bvh leaves.
|
---|
[1294] | 708 | */
|
---|
[1486] | 709 | static void AssociateObjectsWithLeaf(BvhLeaf *leaf);
|
---|
| 710 |
|
---|
| 711 |
|
---|
[1237] | 712 | /////////////////////////////
|
---|
| 713 | // Helper functions for local cost heuristics
|
---|
| 714 |
|
---|
[1357] | 715 | /** Prepare split candidates for cost heuristics using axis aligned splits.
|
---|
[1237] | 716 | @param node the current node
|
---|
| 717 | @param axis the current split axis
|
---|
| 718 | */
|
---|
[1640] | 719 | void PrepareLocalSubdivisionCandidates(const BvhTraversalData &tData,
|
---|
| 720 | const int axis);
|
---|
[1237] | 721 |
|
---|
[1640] | 722 | static void CreateLocalSubdivisionCandidates(const ObjectContainer &objects,
|
---|
| 723 | SortableEntryContainer **subdivisionCandidates,
|
---|
| 724 | const bool sort,
|
---|
| 725 | const int axis);
|
---|
[1357] | 726 |
|
---|
| 727 | /** Computes object partition with the best cost according to the heurisics.
|
---|
| 728 | @param tData the traversal data
|
---|
| 729 | @param axis the split axis
|
---|
| 730 | @param objectsFront the objects in the front child bv
|
---|
| 731 | @param objectsBack the objects in the back child bv
|
---|
| 732 | @param backObjectsStart the iterator marking the position where the back objects begin
|
---|
| 733 |
|
---|
| 734 | @returns relative cost (relative to parent cost)
|
---|
[1237] | 735 | */
|
---|
[1640] | 736 | float EvalLocalCostHeuristics(const BvhTraversalData &tData,
|
---|
| 737 | const int axis,
|
---|
| 738 | ObjectContainer &objectsFront,
|
---|
| 739 | ObjectContainer &objectsBack);
|
---|
[1237] | 740 |
|
---|
[1287] | 741 | /** Evaluates the contribution to the front and back volume
|
---|
| 742 | when this object is changing sides in the bvs.
|
---|
[1237] | 743 |
|
---|
[1287] | 744 | @param object the object
|
---|
| 745 | @param volLeft updates the left pvs
|
---|
| 746 | @param volPvs updates the right pvs
|
---|
[1237] | 747 | */
|
---|
[1640] | 748 | void EvalHeuristicsContribution(Intersectable *obj,
|
---|
| 749 | float &volLeft,
|
---|
| 750 | float &volRight);
|
---|
[1237] | 751 |
|
---|
| 752 | /** Prepares objects for the cost heuristics.
|
---|
| 753 | @returns sum of volume of associated view cells
|
---|
| 754 | */
|
---|
[1287] | 755 | float PrepareHeuristics(const BvhTraversalData &tData, const int axis);
|
---|
[1237] | 756 |
|
---|
[1633] | 757 |
|
---|
[1237] | 758 | ////////////////////////////////////////////////
|
---|
| 759 |
|
---|
| 760 |
|
---|
| 761 | /** Prepares construction for vsp and osp trees.
|
---|
| 762 | */
|
---|
[1640] | 763 | AxisAlignedBox3 EvalBoundingBox(const ObjectContainer &objects,
|
---|
| 764 | const AxisAlignedBox3 *parentBox = NULL) const;
|
---|
[1237] | 765 |
|
---|
[1370] | 766 | /** Collects list of invalid candidates. Candidates
|
---|
| 767 | are invalidated by a view space subdivision step
|
---|
| 768 | that affects this candidate.
|
---|
| 769 | */
|
---|
[1640] | 770 | void CollectDirtyCandidates(BvhSubdivisionCandidate *sc,
|
---|
| 771 | vector<SubdivisionCandidate *> &dirtyList,
|
---|
| 772 | const bool onlyUnmailed);
|
---|
[1237] | 773 |
|
---|
[1287] | 774 | /** Collect view cells which see this bvh leaf.
|
---|
[1237] | 775 | */
|
---|
[1640] | 776 | void CollectViewCells(const ObjectContainer &objects,
|
---|
| 777 | ViewCellContainer &viewCells,
|
---|
| 778 | const bool setCounter = false) const;
|
---|
[1237] | 779 |
|
---|
[1576] | 780 | /** Counts the view cells of this object. note: only
|
---|
| 781 | counts unmailed objects.
|
---|
| 782 | */
|
---|
| 783 | int CountViewCells(Intersectable *obj) const;
|
---|
| 784 |
|
---|
| 785 | /** Counts the view cells seen by this bvh leaf
|
---|
| 786 | */
|
---|
| 787 | int CountViewCells(const ObjectContainer &objects) const;
|
---|
| 788 |
|
---|
[1287] | 789 | /** Collects view cells which see an object.
|
---|
| 790 | */
|
---|
[1640] | 791 | void CollectViewCells(Intersectable *object,
|
---|
| 792 | ViewCellContainer &viewCells,
|
---|
| 793 | const bool useMailBoxing,
|
---|
| 794 | const bool setCounter = false) const;
|
---|
[1287] | 795 |
|
---|
[1576] | 796 | /** Evaluates increase in pvs size.
|
---|
| 797 | */
|
---|
| 798 | int EvalPvsEntriesIncr(BvhSubdivisionCandidate &splitCandidate) const;
|
---|
| 799 |
|
---|
[1237] | 800 | /** Rays will be clipped to the bounding box.
|
---|
| 801 | */
|
---|
[1640] | 802 | void PreprocessRays(BvhLeaf *root,
|
---|
| 803 | const VssRayContainer &sampleRays,
|
---|
| 804 | RayInfoContainer &rays);
|
---|
[1237] | 805 |
|
---|
[1287] | 806 | /** Print the subdivision stats in the subdivison log.
|
---|
| 807 | */
|
---|
| 808 | void PrintSubdivisionStats(const SubdivisionCandidate &tData);
|
---|
[1237] | 809 |
|
---|
[1370] | 810 | /** Prints out the stats for this subdivision.
|
---|
| 811 | */
|
---|
[1640] | 812 | void AddSubdivisionStats(const int viewCells,
|
---|
| 813 | const float renderCostDecr,
|
---|
| 814 | const float totalRenderCost);
|
---|
[1237] | 815 |
|
---|
[1370] | 816 | /** Stores rays with objects that see the rays.
|
---|
| 817 | */
|
---|
| 818 | int AssociateObjectsWithRays(const VssRayContainer &rays) const;
|
---|
[1237] | 819 |
|
---|
[1370] | 820 | /** Tests if object is in this leaf.
|
---|
| 821 | @note: assumes that objects are sorted by their id.
|
---|
| 822 | */
|
---|
[1237] | 823 | bool IsObjectInLeaf(BvhLeaf *, Intersectable *object) const;
|
---|
| 824 |
|
---|
[1370] | 825 | /** Prepares the construction of the bv hierarchy and returns
|
---|
| 826 | the first subdivision candidate.
|
---|
| 827 | */
|
---|
[1640] | 828 | SubdivisionCandidate *PrepareConstruction(const VssRayContainer &sampleRays,
|
---|
| 829 | const ObjectContainer &objects);
|
---|
[1237] | 830 |
|
---|
[1548] | 831 | /** Resets bv hierarchy. E.g. deletes root and resets stats.
|
---|
| 832 | */
|
---|
[1640] | 833 | SubdivisionCandidate *Reset(const VssRayContainer &rays,
|
---|
| 834 | const ObjectContainer &objects);
|
---|
[1548] | 835 |
|
---|
[1370] | 836 | /** Evaluates volume of view cells that see the objects.
|
---|
| 837 | */
|
---|
[1287] | 838 | float EvalViewCellsVolume(const ObjectContainer &objects) const;
|
---|
[1237] | 839 |
|
---|
[1580] | 840 | /** Assigns or newly creates initial list of sorted objects.
|
---|
[1370] | 841 | */
|
---|
[1580] | 842 | void AssignInitialSortedObjectList(BvhTraversalData &tData);
|
---|
[1259] | 843 |
|
---|
[1370] | 844 | /** Assigns sorted objects to front and back data.
|
---|
| 845 | */
|
---|
[1640] | 846 | void AssignSortedObjects(const BvhSubdivisionCandidate &sc,
|
---|
| 847 | BvhTraversalData &frontData,
|
---|
| 848 | BvhTraversalData &backData);
|
---|
[1548] | 849 |
|
---|
[1640] | 850 | /** Creates new root of hierarchy and computes bounding box.
|
---|
| 851 | Has to be called before the preparation of the subdivision.
|
---|
[1548] | 852 | */
|
---|
[1640] | 853 | void Initialise(const ObjectContainer &objects);
|
---|
| 854 |
|
---|
| 855 |
|
---|
[1237] | 856 | protected:
|
---|
| 857 |
|
---|
[1345] | 858 | /// pre-sorted subdivision candidtes for all three directions.
|
---|
| 859 | vector<SortableEntry> *mGlobalSubdivisionCandidates[3];
|
---|
[1237] | 860 | /// pointer to the hierarchy of view cells
|
---|
| 861 | ViewCellsTree *mViewCellsTree;
|
---|
| 862 | /// The view cells manager
|
---|
| 863 | ViewCellsManager *mViewCellsManager;
|
---|
| 864 | /// candidates for placing split planes during cost heuristics
|
---|
| 865 | vector<SortableEntry> *mSubdivisionCandidates;
|
---|
| 866 | /// Pointer to the root of the tree
|
---|
| 867 | BvhNode *mRoot;
|
---|
| 868 | /// Statistics for the object space partition
|
---|
[1370] | 869 | BvhStatistics mBvhStats;
|
---|
[1237] | 870 | /// box around the whole view domain
|
---|
| 871 | AxisAlignedBox3 mBoundingBox;
|
---|
[1370] | 872 | /// the hierarchy manager
|
---|
| 873 | HierarchyManager *mHierarchyManager;
|
---|
[1237] | 874 |
|
---|
| 875 |
|
---|
[1449] | 876 | ////////////////////
|
---|
[1357] | 877 | //-- local termination criteria
|
---|
[1237] | 878 |
|
---|
| 879 | /// maximal possible depth
|
---|
| 880 | int mTermMaxDepth;
|
---|
| 881 | /// mininum probability
|
---|
[1287] | 882 | float mTermMinProbability;
|
---|
[1237] | 883 | /// minimal number of objects
|
---|
| 884 | int mTermMinObjects;
|
---|
| 885 | /// maximal acceptable cost ratio
|
---|
| 886 | float mTermMaxCostRatio;
|
---|
| 887 | /// tolerance value indicating how often the max cost ratio can be failed
|
---|
| 888 | int mTermMissTolerance;
|
---|
[1370] | 889 | /// minimum number of rays
|
---|
| 890 | int mTermMinRays;
|
---|
[1237] | 891 |
|
---|
| 892 |
|
---|
[1449] | 893 | ////////////////////
|
---|
[1357] | 894 | //-- global termination criteria
|
---|
[1237] | 895 |
|
---|
[1580] | 896 | /// the minimal accepted global cost ratio
|
---|
[1237] | 897 | float mTermMinGlobalCostRatio;
|
---|
[1580] | 898 | //// number of accepted misses of the global cost ratio
|
---|
[1237] | 899 | int mTermGlobalCostMissTolerance;
|
---|
| 900 | /// maximal number of view cells
|
---|
| 901 | int mTermMaxLeaves;
|
---|
| 902 | /// maximal tree memory
|
---|
| 903 | float mMaxMemory;
|
---|
| 904 | /// the tree is out of memory
|
---|
| 905 | bool mOutOfMemory;
|
---|
| 906 |
|
---|
| 907 |
|
---|
[1357] | 908 | ////////////////////////////////////////
|
---|
[1237] | 909 | //-- split heuristics based parameters
|
---|
| 910 |
|
---|
[1643] | 911 | /// if a heuristics should be used for finding a split plane
|
---|
| 912 | bool mUseCostHeuristics;
|
---|
| 913 | /// if sah heuristcs should be used for finding a split plane
|
---|
| 914 | bool mUseSah;
|
---|
| 915 | /// balancing factor for PVS criterium
|
---|
[1237] | 916 | float mCtDivCi;
|
---|
| 917 | /// if only driving axis should be used for split
|
---|
| 918 | bool mOnlyDrivingAxis;
|
---|
| 919 | /// current time stamp (used for keeping split history)
|
---|
| 920 | int mTimeStamp;
|
---|
| 921 | // if rays should be stored in leaves
|
---|
| 922 | bool mStoreRays;
|
---|
[1357] | 923 | // subdivision stats output file
|
---|
[1237] | 924 | ofstream mSubdivisionStats;
|
---|
| 925 | /// keeps track of cost during subdivision
|
---|
| 926 | float mTotalCost;
|
---|
[1662] | 927 | int mPvsEntries;
|
---|
[1237] | 928 | /// keeps track of overall pvs size during subdivision
|
---|
| 929 | int mTotalPvsSize;
|
---|
| 930 | /// number of currenly generated view cells
|
---|
| 931 | int mCreatedLeaves;
|
---|
| 932 | /// represents min and max band for sweep
|
---|
| 933 | float mSplitBorder;
|
---|
| 934 | /// weight between render cost decrease and node render cost
|
---|
| 935 | float mRenderCostDecreaseWeight;
|
---|
| 936 | /// stores the kd node intersectables used for pvs
|
---|
| 937 | BvhIntersectableMap mBvhIntersectables;
|
---|
[1580] | 938 | /// if the objects should be sorted in one global step
|
---|
| 939 | bool mUseGlobalSorting;
|
---|
[1237] | 940 |
|
---|
[1662] | 941 | bool mUseBboxAreaForSah;
|
---|
| 942 |
|
---|
[1580] | 943 | SortableEntryContainer *mSortedObjects[3];
|
---|
[1676] | 944 |
|
---|
| 945 | int mMinRaysForVisibility;
|
---|
[1237] | 946 | };
|
---|
| 947 |
|
---|
| 948 | }
|
---|
| 949 |
|
---|
| 950 | #endif
|
---|