Changeset 489 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 01/02/06 13:42:43 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r487 r489 155 155 height 5.0 156 156 maxViewCells 100 157 maxPvs 70157 maxPvs 130 158 158 159 159 … … 168 168 Visualization { 169 169 # how much samples are be used for visualization 170 samples 90000170 samples 1000 171 171 #colorCode PVS 172 172 #colorCode MergedLeaves … … 219 219 # maximal cost for merging a view cell 220 220 PostProcess { 221 <<<<<<< .mine222 221 maxCostRatio 0.005 223 222 minViewCells 200 224 225 223 maxPvsSize 50000 226 224 } … … 289 287 maxCostRatio 0.1 290 288 minViewCells 200 291 292 289 maxPvsSize 500 293 290 useRaysForMerge false -
trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp
r487 r489 1680 1680 RegisterOption("VspBspTree.Termination.maxViewCells", 1681 1681 optInt, 1682 "-vsp_bsp_term_ axis_aligned_max_view_cells=",1682 "-vsp_bsp_term_max_view_cells=", 1683 1683 "1000"); 1684 1684 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r487 r489 39 39 int BspTree::sFrontAndBackId = 0; 40 40 41 41 42 /****************************************************************/ 42 43 /* class BspNode implementation */ 43 44 /****************************************************************/ 44 45 46 45 47 BspNode::BspNode(): 46 mParent(NULL) 48 mParent(NULL), mTreeValid(true) 47 49 {} 48 50 49 51 BspNode::BspNode(BspInterior *parent): 50 mParent(parent) 52 mParent(parent), mTreeValid(true) 51 53 {} 52 54 … … 210 212 mGenerateViewCells(true) 211 213 { 212 213 214 214 Randomize(); // initialise random generator for heuristics 215 215 … … 428 428 DEL_PTR(mRoot); 429 429 430 // root cell not used430 // HACK: view cells not generated => root cell not used 431 431 if (mGenerateViewCells) 432 432 DEL_PTR(mRootCell); -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r487 r489 45 45 environment->GetBoolValue("ViewCells.Visualization.exportGeometry", mExportGeometry); 46 46 47 //Debug << "export rays: " << mExportRays << endl; 48 //Debug << "export geometry: " << mExportGeometry << endl; 47 49 char buf[50]; 48 50 … … 1732 1734 } 1733 1735 1736 1734 1737 // matt TODO: remove 1735 1738 int VspBspViewCellsManager::MergeViewCells(const VssRayContainer &rays) const … … 1875 1878 Debug << ss << endl; 1876 1879 1877 cout << "Refining the view cells ... ";1880 cout << "Refining the merged view cells ... "; 1878 1881 startTime = GetTime(); 1879 1882 … … 1922 1925 if (mExportGeometry) 1923 1926 exporter->ExportGeometry(objects); 1927 1928 // export rays 1929 /*if (mExportRays) 1930 { 1931 exporter->SetWireframe(); 1932 exporter->ExportRays(visRays, RgbColor(1, 1, 0)); 1933 exporter->SetFilled(); 1934 }*/ 1924 1935 ExportViewCells(exporter); 1925 1936 delete exporter; … … 1931 1942 //-- visualization of the BSP splits 1932 1943 bool exportSplits = false; 1933 environment->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits); 1934 1944 environment->GetBoolValue("VspBspTree.Visualization.exportSplits", exportSplits); 1945 Debug << "export splits: " << exportSplits << endl; 1946 1935 1947 if (exportSplits) 1936 1948 { … … 1950 1962 return ViewCellsManager::GetViewPoint(viewPoint); 1951 1963 1964 // TODO: set reasonable limit 1952 1965 const int limit = 10; 1953 1966 cout << "===" << endl; 1954 1967 for (int i = 0; i < limit; ++ i) 1955 1968 { 1969 cout << i << " " << endl; 1956 1970 viewPoint = mSceneBox.GetRandomPoint(); 1957 1971 if (mVspBspTree->ViewPointValid(viewPoint)) -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
r488 r489 258 258 virtual void ExportVcGeometry(Exporter *exporter, ViewCell *vc) const = 0; 259 259 260 /// the view cell corresponding to unboundedspace261 //ViewCell *m Unbounded;260 /// the view cell corresponding to space ouside the valid view space 261 //ViewCell *mOutOfBoundsCell; 262 262 263 263 /// Renders the view cells. -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r487 r489 45 45 mViewCellsManager(NULL), 46 46 mStoreRays(false), 47 mOnlyDrivingAxis(false) 47 mOnlyDrivingAxis(false), 48 mOutOfBoundsCell(NULL) 48 49 { 49 50 bool randomize = false; … … 128 129 } 129 130 131 130 132 mSplitCandidates = new vector<SortableEntry>; 131 133 132 134 Debug << endl; 135 } 136 137 138 BspViewCell *VspBspTree::GetOrCreateOutOfBoundsCell() 139 { 140 if (!mOutOfBoundsCell) 141 mOutOfBoundsCell = new BspViewCell(); 142 143 return mOutOfBoundsCell; 133 144 } 134 145 … … 401 412 { 402 413 BspLeaf *leaf = dynamic_cast<BspLeaf *>(newNode); 414 BspViewCell *viewCell; 403 415 404 416 if (!CheckValid(tData)) … … 406 418 leaf->SetTreeValid(false); 407 419 PropagateUpValidity(leaf); 408 } 409 410 // create new view cell for this leaf 411 BspViewCell *viewCell = new BspViewCell(); 420 // view cell for invalid view space 421 viewCell = GetOrCreateOutOfBoundsCell(); 422 } 423 else 424 { 425 // create new view cell for this leaf 426 viewCell = new BspViewCell(); 427 } 428 412 429 leaf->SetViewCell(viewCell); 413 430 … … 1206 1223 { 1207 1224 BspNode *node = nodeStack.top(); 1208 1209 1225 nodeStack.pop(); 1226 1227 // this subtree is not valid view space 1228 if (!node->TreeValid()) 1229 continue; 1210 1230 1211 1231 if (node->IsLeaf()) … … 1224 1244 } 1225 1245 1246 1226 1247 AxisAlignedBox3 VspBspTree::GetBoundingBox() const 1227 1248 { … … 1229 1250 } 1230 1251 1252 1231 1253 BspNode *VspBspTree::GetRoot() const 1232 1254 { 1233 1255 return mRoot; 1234 1256 } 1257 1258 1259 BspViewCell *VspBspTree::GetOutOfBoundsCell() const 1260 { 1261 return mOutOfBoundsCell; 1262 } 1263 1235 1264 1236 1265 void VspBspTree::EvaluateLeafStats(const VspBspTraversalData &data) … … 1399 1428 BspNode *node = nodeStack.top(); 1400 1429 nodeStack.pop(); 1430 // this subtree is not valid view space 1431 if (!node->TreeValid()) 1432 continue; 1401 1433 1402 1434 if (node->IsLeaf()) … … 1635 1667 nodeStack.pop(); 1636 1668 1669 // view space not valid 1670 if (!node->TreeValid()) 1671 continue; 1672 1637 1673 if (node->IsLeaf()) 1638 1674 { … … 1687 1723 return (int)neighbors.size(); 1688 1724 } 1725 1689 1726 1690 1727 BspLeaf *VspBspTree::GetRandomLeaf(const Plane3 &halfspace) … … 2002 2039 2003 2040 BspLeaf *leaf = new BspLeaf(interior->GetParent(), vc); 2041 leaf->SetTreeValid(frontLeaf->TreeValid()); 2004 2042 2005 2043 // replace a link from node's parent … … 2170 2208 2171 2209 iit = ray->intersections.begin(); 2172 BspLeaf * prevLeaf = (*(iit ++)).mLeaf;2210 BspLeaf *leaf = (*(iit ++)).mLeaf; 2173 2211 2174 2212 // create leaf pvs (needed for post processing) 2175 if (! prevLeaf->mPvs)2176 { 2177 prevLeaf->mPvs =2178 new ObjectPvs( prevLeaf->GetViewCell()->GetPvs());2213 if (!leaf->mPvs) 2214 { 2215 leaf->mPvs = 2216 new ObjectPvs(leaf->GetViewCell()->GetPvs()); 2179 2217 2180 2218 BspMergeCandidate::sOverallCost += 2181 prevLeaf->mArea * prevLeaf->mPvs->GetSize();2219 leaf->mArea * leaf->mPvs->GetSize(); 2182 2220 2183 2221 ++ leaves; … … 2185 2223 2186 2224 // traverse intersections 2187 // consecutive leaves are neighbors => 2188 // add them to queue 2225 // consecutive leaves are neighbors => add them to queue 2189 2226 for (; iit != ray->intersections.end(); ++ iit) 2190 2227 { 2191 BspLeaf *leaf = (*iit).mLeaf; 2192 2228 // next pair 2229 BspLeaf *prevLeaf = leaf; 2230 leaf = (*iit).mLeaf; 2231 2232 // view space does not correspond to valid space 2233 if (!leaf->TreeValid() || !prevLeaf->TreeValid()) 2234 continue; 2235 2236 // create leaf pvs (needed for post processing) 2193 2237 if (!leaf->mPvs) 2194 2238 { … … 2229 2273 mMergeQueue.push(BspMergeCandidate(leaf, prevLeaf)); 2230 2274 } 2231 2232 prevLeaf = leaf;2233 2275 } 2234 2276 } -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
r487 r489 278 278 bool ViewPointValid(const Vector3 &viewPoint) const; 279 279 280 /** Returns the view cell corresponding to 281 the space outside the valid view space. 282 */ 283 BspViewCell *GetOutOfBoundsCell() const; 280 284 281 285 protected: … … 550 554 */ 551 555 void PropagateUpValidity(BspNode *node); 556 557 /** Creates or returns view cell corresponding to 558 the space outside the valid view space. 559 */ 560 BspViewCell *GetOrCreateOutOfBoundsCell(); 552 561 553 562 /// Pointer to the root of the tree … … 644 653 int mMaxPvs; 645 654 655 /// View cell corresponding to the space outside the valid view space 656 BspViewCell *mOutOfBoundsCell; 646 657 647 658 private: -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r487 r489 12 12 #include "RenderSimulator.h" 13 13 14 bool useViewSpaceBox = true; //true;14 bool useViewSpaceBox = true; 15 15 bool use2dSampling = false; 16 bool useViewspacePlane = true; //true;16 bool useViewspacePlane = true; 17 17 18 18 VssPreprocessor::VssPreprocessor():
Note: See TracChangeset
for help on using the changeset viewer.