Changeset 1106 for GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
- Timestamp:
- 07/10/06 01:57:41 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
r1101 r1106 181 181 int splits[3]; 182 182 183 // totals number of rays184 int rays;185 183 // maximal reached depth 186 184 int maxDepth; … … 194 192 // max depth nodes 195 193 int minPvsNodes; 196 // nodes with minimum PVS197 int minRaysNodes;198 // max ray contribution nodes199 int maxRayContribNodes;200 194 // minimum area nodes 201 195 int minProbabilityNodes; 202 196 /// nodes termination because of max cost ratio; 203 197 int maxCostNodes; 204 // max number of rays per node198 // max number of objects per node 205 199 int maxObjectRefs; 200 int objectRefs; 206 201 /// samples contributing to pvs 207 202 int contributingSamples; … … 214 209 /// accumulated number of rays refs 215 210 int accumRays; 211 /// potentially visible objects from this leaf 216 212 int pvs; 213 217 214 // accumulated depth (used to compute average) 218 215 int accumDepth; … … 230 227 // TODO: computation wrong 231 228 double AvgDepth() const { return accumDepth / (double)Leaves();}; 232 double AvgRays() const { return accumRays / (double)Leaves();};229 233 230 234 231 void Reset() … … 244 241 maxDepthNodes = 0; 245 242 minPvsNodes = 0; 246 minRaysNodes = 0; 247 maxRayContribNodes = 0; 243 248 244 minProbabilityNodes = 0; 249 245 maxCostNodes = 0; … … 254 250 maxPvs = 0; 255 251 invalidLeaves = 0; 256 accumRays = 0;252 objectRefs = 0; 257 253 } 254 258 255 259 256 void Print(ostream &app) const; … … 558 555 public: 559 556 static VspTree* sVspTree; 560 /// parent data557 /// parent node traversal data 561 558 VspTraversalData mParentData; 562 559 … … 619 616 /** Returns box which bounds the whole tree. 620 617 */ 621 AxisAlignedBox3 GetBoundingBox() const;618 AxisAlignedBox3 GetBoundingBox() const; 622 619 623 620 /** Returns root of the view space partitioning tree. … … 1060 1057 /// number of currenly generated view cells 1061 1058 int mCreatedViewCells; 1062 1063 private:1064 1065 /// Generates unique ids for PVS criterium1066 static void GenerateUniqueIdsForPvs();1067 1068 //-- unique ids for PVS criterium1069 static int sFrontId;1070 static int sBackId;1071 static int sFrontAndBackId;1072 1059 }; 1073 1060 … … 1088 1075 public: 1089 1076 /// the current node 1090 Kd Node*mNode;1077 KdLeaf *mNode; 1091 1078 /// current depth 1092 1079 int mDepth; 1093 1080 /// rays piercing this node 1094 RayInfoContainer *mRays;1081 //RayInfoContainer *mRays; 1095 1082 /// the probability that this node contains view point 1096 1083 float mProbability; … … 1106 1093 float mPriority; 1107 1094 1108 1109 /** Returns average ray contribution.1110 */1111 float GetAvgRayContribution() const1112 {1113 return (float)mPvs / ((float)mRays->size() + Limits::Small);1114 }1115 1116 1095 1117 1096 OspTraversalData(): 1118 1097 mNode(NULL), 1119 1098 mDepth(0), 1120 mRays(NULL),1121 1099 mPvs(0), 1122 1100 mProbability(0.0), … … 1126 1104 {} 1127 1105 1128 OspTraversalData(Kd Node*node,1106 OspTraversalData(KdLeaf *node, 1129 1107 const int depth, 1130 RayInfoContainer *rays,1131 1108 const int pvs, 1132 1109 const float p, … … 1134 1111 mNode(node), 1135 1112 mDepth(depth), 1136 mRays(rays),1137 1113 mPvs(pvs), 1138 1114 mProbability(p), … … 1144 1120 1145 1121 OspTraversalData(const int depth, 1146 RayInfoContainer *rays,1147 1122 const AxisAlignedBox3 &box): 1148 1123 mNode(NULL), 1149 1124 mDepth(depth), 1150 mRays(rays),1151 1125 mPvs(0), 1152 1126 mProbability(0), … … 1167 1141 void Clear() 1168 1142 { 1169 DEL_PTR(mRays);1170 1143 } 1171 1144 … … 1189 1162 {}; 1190 1163 1191 int Type() const { return VIEW_SPACE; }1164 int Type() const { return OBJECT_SPACE; } 1192 1165 1193 1166 void EvalPriority() … … 1231 1204 /** Returns bounding box of the specified node. 1232 1205 */ 1233 AxisAlignedBox3 GetB oundingBox(KdNode *node) const;1234 1235 /** Returns list of BSPleaves with pvs smaller than1206 AxisAlignedBox3 GetBBox(KdNode *node) const; 1207 1208 /** Returns list of leaves with pvs smaller than 1236 1209 a certain threshold. 1237 1210 @param onlyUnmailed if only the unmailed leaves should be considered 1238 1211 @param maxPvs the maximal pvs of a leaf to be added (-1 means unlimited) 1239 1212 */ 1240 void CollectLeaves(vector<VspLeaf *> &leaves,1241 const bool onlyUnmailed = false,1242 const int maxPvs = -1) const; 1243 1244 /** Returns bo x which bounds the whole tree.1213 1214 void CollectLeaves(vector<KdLeaf *> &leaves) const; 1215 1216 1217 /** Returns bounding box of the whole tree (= bbox of root node) 1245 1218 */ 1246 1219 AxisAlignedBox3 GetBoundingBox()const; … … 1406 1379 @returns the root of the subdivision 1407 1380 */ 1381 KdInterior *SubdivideNode(KdLeaf *leaf, 1382 const AxisAlignedPlane &splitPlane, 1383 const AxisAlignedBox3 &box, 1384 OspTraversalData &frontData, 1385 OspTraversalData &backData); 1386 1408 1387 void SplitObjects(const AxisAlignedPlane & splitPlane, 1409 1388 const ObjectContainer &objects, 1410 ObjectContainer &back, 1411 ObjectContainer &front); 1412 1413 KdInterior *SubdivideNode(KdLeaf *leaf, 1414 const AxisAlignedPlane &splitPlane, 1415 const AxisAlignedBox3 &box, 1416 AxisAlignedBox3 &backBBox, 1417 AxisAlignedBox3 &frontBBox); 1389 ObjectContainer &front, 1390 ObjectContainer &back); 1418 1391 1419 1392 void ProcessLeafObjects(KdLeaf *leaf, KdLeaf *parent) const; … … 1439 1412 const int axis, 1440 1413 float &position, 1441 int &objects Back,1442 int &objects Front);1414 int &objectsFront, 1415 int &objectsBack); 1443 1416 1444 1417 /** Subdivides the rays into front and back rays according to the split plane. … … 1553 1526 //-- local termination 1554 1527 1555 /// minimal number of rays before subdivision termination1556 int mTermMinRays;1557 1528 /// maximal possible depth 1558 1529 int mTermMaxDepth; 1559 1530 /// mininum probability 1560 1531 float mTermMinProbability; 1561 /// mini num PVS1562 int mTermMin Pvs;1532 /// minimal number of objects 1533 int mTermMinObjects; 1563 1534 /// maximal contribution per ray 1564 1535 float mTermMaxRayContribution; … … 1569 1540 1570 1541 1542 1571 1543 //-- global criteria 1572 1544 float mTermMinGlobalCostRatio; … … 1575 1547 1576 1548 /// maximal number of view cells 1577 int m MaxViewCells;1549 int mTermMaxLeaves; 1578 1550 /// maximal tree memory 1579 1551 float mMaxMemory; … … 1590 1562 /// if only driving axis should be used for split 1591 1563 bool mOnlyDrivingAxis; 1592 /// if random split axis should be used 1593 bool mUseRandomAxis; 1594 /// if vsp bsp tree should simulate octree 1595 bool mCirculatingAxis; 1596 /// minimal relative position where the split axis can be placed 1597 float mMinBand; 1598 /// maximal relative position where the split axis can be placed 1599 float mMaxBand; 1600 1601 1564 1602 1565 /// current time stamp (used for keeping split history) 1603 1566 int mTimeStamp; … … 1616 1579 int mTotalPvsSize; 1617 1580 /// number of currenly generated view cells 1618 int mCreatedViewCells; 1619 1581 int mCreatedLeaves; 1582 1583 /// represents min and max band for sweep 1620 1584 float mSplitBorder; 1621 1622 1623 private:1624 1625 /// Generates unique ids for PVS criterium1626 static void GenerateUniqueIdsForPvs();1627 1628 //-- unique ids for PVS criterium1629 static int sFrontId;1630 static int sBackId;1631 static int sFrontAndBackId;1632 1585 }; 1633 1586
Note: See TracChangeset
for help on using the changeset viewer.