- Timestamp:
- 01/22/07 23:35:03 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r2005 r2017 490 490 { 491 491 BvhSubdivisionCandidate *sc = 492 dynamic_cast<BvhSubdivisionCandidate *>(splitCandidate);492 static_cast<BvhSubdivisionCandidate *>(splitCandidate); 493 493 BvhTraversalData &tData = sc->mParentData; 494 494 … … 1994 1994 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1995 1995 { 1996 VspViewCell *vc = dynamic_cast<VspViewCell *>(*vit);1996 VspViewCell *vc = static_cast<VspViewCell *>(*vit); 1997 1997 VspLeaf *leaf = vc->mLeaves[0]; 1998 1998 … … 2060 2060 if (node->IsLeaf()) 2061 2061 { 2062 leaf = dynamic_cast<BvhLeaf *>(node);2062 leaf = static_cast<BvhLeaf *>(node); 2063 2063 2064 2064 if (IsObjectInLeaf(leaf, object)) … … 2070 2070 { 2071 2071 // find point 2072 BvhInterior *interior = dynamic_cast<BvhInterior *>(node);2072 BvhInterior *interior = static_cast<BvhInterior *>(node); 2073 2073 2074 2074 if (interior->GetBack()->GetBoundingBox().Includes(object->GetBox())) … … 2112 2112 if (node->IsLeaf()) 2113 2113 { 2114 BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(node);2114 BvhLeaf *leaf = static_cast<BvhLeaf *>(node); 2115 2115 const AxisAlignedBox3 box = leaf->GetBoundingBox(); 2116 2116 stream << "<Leaf" … … 2127 2127 else 2128 2128 { 2129 BvhInterior *interior = dynamic_cast<BvhInterior *>(node);2129 BvhInterior *interior = static_cast<BvhInterior *>(node); 2130 2130 const AxisAlignedBox3 box = interior->GetBoundingBox(); 2131 2131 … … 2215 2215 2216 2216 // root and bounding box was already constructed 2217 BvhLeaf *bvhLeaf = dynamic_cast<BvhLeaf *>(mRoot);2217 BvhLeaf *bvhLeaf = static_cast<BvhLeaf *>(mRoot); 2218 2218 2219 2219 // only rays intersecting objects in node are interesting … … 2226 2226 // create bvh traversal data 2227 2227 BvhTraversalData oData(bvhLeaf, 0, prop, nRays); 2228 cout << "here4" << endl; 2229 2228 2230 2229 // create sorted object lists for the first data 2231 2230 if (mUseGlobalSorting) … … 2234 2233 } 2235 2234 2236 cout << "here6" << endl;2237 2235 /////////////////// 2238 2236 //-- add first candidate for object space partition … … 2267 2265 for (cit = candidateContainer.begin(); cit != cit_end; ++ cit) 2268 2266 { 2269 BvhSubdivisionCandidate *sCandidate = dynamic_cast<BvhSubdivisionCandidate *>(*cit);2267 BvhSubdivisionCandidate *sCandidate = static_cast<BvhSubdivisionCandidate *>(*cit); 2270 2268 2271 2269 // reevaluate priority … … 2295 2293 for (int i = 0; i < 3; ++ i) 2296 2294 { 2297 cout << "here2 " << endl;2298 2295 SortableEntryContainer *sortedObjects = new SortableEntryContainer(); 2299 2296 … … 2316 2313 delete sortedObjects; 2317 2314 } 2318 cout << "here102" << endl; 2315 2319 2316 // last sorted list: by size 2320 2317 tData.mSortedObjects[3] = new ObjectContainer(); … … 2390 2387 2391 2388 const int nRays = CountRays(objects); 2392 BvhLeaf *bvhLeaf = dynamic_cast<BvhLeaf *>(mRoot);2389 BvhLeaf *bvhLeaf = static_cast<BvhLeaf *>(mRoot); 2393 2390 2394 2391 // create bvh traversal data … … 2517 2514 { 2518 2515 BvhSubdivisionCandidate *sc = 2519 dynamic_cast<BvhSubdivisionCandidate *>(splitCandidate);2516 static_cast<BvhSubdivisionCandidate *>(splitCandidate); 2520 2517 BvhTraversalData &tData = sc->mParentData; 2521 2518 … … 2531 2528 BvhTraversalData tBackData; 2532 2529 2533 BvhInterior *oldInterior = dynamic_cast<BvhInterior *>(oldNode);2530 BvhInterior *oldInterior = static_cast<BvhInterior *>(oldNode); 2534 2531 2535 2532 sc->mFrontObjects.clear(); … … 2667 2664 2668 2665 BvhSubdivisionCandidate *bsc = 2669 dynamic_cast<BvhSubdivisionCandidate *>(candidate);2666 static_cast<BvhSubdivisionCandidate *>(candidate); 2670 2667 2671 2668 if (!InitialTerminationCriteriaMet(bsc->mParentData)) … … 2767 2764 if (node->IsLeaf()) 2768 2765 { 2769 BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(node);2766 BvhLeaf *leaf = static_cast<BvhLeaf *>(node); 2770 2767 node->mRenderCost = EvalAbsCost(leaf->mObjects); 2771 2768 } 2772 2769 else 2773 2770 { 2774 BvhInterior *interior = dynamic_cast<BvhInterior *>(node);2771 BvhInterior *interior = static_cast<BvhInterior *>(node); 2775 2772 2776 2773 node->mRenderCost = GetRenderCostIncrementially(interior->GetFront()) + -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r2003 r2017 86 86 { 87 87 // eyport leaf pvs 88 KdLeaf *leaf = dynamic_cast<KdLeaf *>(node);88 KdLeaf *leaf = static_cast<KdLeaf *>(node); 89 89 90 90 ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); … … 171 171 break; 172 172 case Intersectable::TRANSFORMED_MESH_INSTANCE: 173 ExportTransformedMeshInstance( dynamic_cast<TransformedMeshInstance *>(object));173 ExportTransformedMeshInstance(static_cast<TransformedMeshInstance *>(object)); 174 174 break; 175 175 case Intersectable::VIEW_CELL: 176 ExportViewCell( dynamic_cast<ViewCell *>(object));176 ExportViewCell(static_cast<ViewCell *>(object)); 177 177 break; 178 178 case Intersectable::KD_INTERSECTABLE: 179 ExportKdIntersectable(*( dynamic_cast<KdIntersectable *>(object)));179 ExportKdIntersectable(*(static_cast<KdIntersectable *>(object))); 180 180 break; 181 181 case Intersectable::TRIANGLE_INTERSECTABLE: 182 182 { 183 183 // if (mClampToBox && !Overlap(mBoundingBox, object->GetBox())) return; 184 const Triangle3 triangle = dynamic_cast<TriangleIntersectable *>(object)->GetItem();184 const Triangle3 triangle = static_cast<TriangleIntersectable *>(object)->GetItem(); 185 185 186 186 Polygon3 poly(triangle); … … 190 190 case Intersectable::BVH_INTERSECTABLE: 191 191 { 192 BvhNode *node = dynamic_cast<BvhNode *>(object);192 BvhNode *node = static_cast<BvhNode *>(object); 193 193 194 194 if (node->IsLeaf()) 195 195 { 196 ExportGeometry( dynamic_cast<BvhLeaf *>(node)->mObjects, true);196 ExportGeometry(static_cast<BvhLeaf *>(node)->mObjects, true); 197 197 } 198 198 … … 275 275 case Intersectable::TRIANGLE_INTERSECTABLE: 276 276 { 277 TriangleIntersectable *ti = dynamic_cast<TriangleIntersectable *>(obj);277 TriangleIntersectable *ti = static_cast<TriangleIntersectable *>(obj); 278 278 polys.push_back(new Polygon3(ti->GetItem())); 279 279 break; … … 281 281 case Intersectable::MESH_INSTANCE: 282 282 { 283 MeshInstance *mi = dynamic_cast<MeshInstance *>(obj);283 MeshInstance *mi = static_cast<MeshInstance *>(obj); 284 284 ExportMesh(mi->GetMesh()); 285 285 break; -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2006 r2017 139 139 break; 140 140 case Intersectable::VIEW_CELL: 141 RenderViewCell( dynamic_cast<ViewCell *>(object));141 RenderViewCell(static_cast<ViewCell *>(object)); 142 142 break; 143 143 case Intersectable::TRANSFORMED_MESH_INSTANCE: 144 RenderTransformedMeshInstance( dynamic_cast<TransformedMeshInstance *>(object));144 RenderTransformedMeshInstance(static_cast<TransformedMeshInstance *>(object)); 145 145 break; 146 146 case Intersectable::TRIANGLE_INTERSECTABLE: 147 RenderTriangle( dynamic_cast<TriangleIntersectable *>(object));147 RenderTriangle(static_cast<TriangleIntersectable *>(object)); 148 148 break; 149 149 case Intersectable::BVH_INTERSECTABLE: { 150 150 151 BvhNode *node = dynamic_cast<BvhNode *>(object);151 BvhNode *node = static_cast<BvhNode *>(object); 152 152 153 153 if (mRenderBoxes) … … 158 158 } 159 159 case Intersectable::KD_INTERSECTABLE: { 160 KdNode *node = ( dynamic_cast<KdIntersectable *>(object))->GetItem();160 KdNode *node = (static_cast<KdIntersectable *>(object))->GetItem(); 161 161 162 162 if (mRenderBoxes) -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r2008 r2017 195 195 }; 196 196 friend class GlobalLinesRenderer; 197 friend class ViewCellsManager; 198 197 199 protected: 198 200 -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2005 r2017 25 25 }; 26 26 27 static const float MIN_DIST = 0.0 1f;27 static const float MIN_DIST = 0.001f; 28 28 29 29 static vector<VizStruct> vizContainer; … … 286 286 const VssRay &ray2, 287 287 const VssRay &oldRay) 288 { 288 {//cout <<"x"<<Magnitude(p1 - p2) << " "; 289 289 int castRays = 0; 290 290 … … 293 293 castRays += CheckDiscontinuity(ray2, hitTriangle, oldRay); 294 294 295 if (EqualVisibility(ray1, ray2) || ( Magnitude(p1 - p2) <= MIN_DIST))295 if (EqualVisibility(ray1, ray2) || (SqrMagnitude(p1 - p2) <= MIN_DIST)) 296 296 { 297 297 return castRays; … … 300 300 // the new subdivision point 301 301 const Vector3 p = (p1 + p2) * 0.5f; 302 302 //cout << "p: " << p << " " << p1 << " " << p2 << endl; 303 303 // cast ray into the new point 304 304 SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin, SamplingStrategy::GVS, 1.0f); … … 335 335 if (tObj->Type() == Intersectable::TRIANGLE_INTERSECTABLE) 336 336 { 337 hitTriangle = dynamic_cast<TriangleIntersectable *>(tObj)->GetItem();337 hitTriangle = static_cast<TriangleIntersectable *>(tObj)->GetItem(); 338 338 } 339 339 else … … 427 427 428 428 CLEAR_CONTAINER(invalidSamples); 429 429 //cout << "***********"<< endl; 430 430 return castRays; 431 431 } … … 495 495 // other types not implemented yet 496 496 if (tObj->Type() == Intersectable::TRIANGLE_INTERSECTABLE) 497 occluder = dynamic_cast<TriangleIntersectable *>(tObj)->GetItem();497 occluder = static_cast<TriangleIntersectable *>(tObj)->GetItem(); 498 498 else 499 499 cout << "not yet implemented" << endl; … … 828 828 break; 829 829 } 830 830 //if (viewCell->GetId() == 36658) 831 //{ 831 832 mViewCells.push_back(viewCell); 833 // return; 834 //} 832 835 } 833 836 … … 859 862 for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 860 863 { 861 TriangleIntersectable *triObj = dynamic_cast<TriangleIntersectable *>(*oit);864 TriangleIntersectable *triObj = static_cast<TriangleIntersectable *>(*oit); 862 865 863 866 if (box.Intersects(triObj->GetItem())) … … 1065 1068 } 1066 1069 1067 cout << "here4 " << mKdTree->GetBox() << endl;1068 cout << "here5 " << mViewCellsManager->GetViewSpaceBox() << endl;1069 1070 mGvsStats.Stop(); 1070 1071 mGvsStats.Print(mGvsStatsStream); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1933 r2017 1724 1724 if (!mNode->IsLeaf()) 1725 1725 { 1726 VspInterior *interior = dynamic_cast<VspInterior *>(mNode);1726 VspInterior *interior = static_cast<VspInterior *>(mNode); 1727 1727 1728 1728 tQueue.push(new VspNodeWrapper(interior->GetFront())); … … 1750 1750 if (!mNode->IsLeaf()) 1751 1751 { 1752 BvhInterior *interior = dynamic_cast<BvhInterior *>(mNode);1752 BvhInterior *interior = static_cast<BvhInterior *>(mNode); 1753 1753 1754 1754 tQueue.push(new BvhNodeWrapper(interior->GetFront())); … … 1777 1777 if (!mViewCell->IsLeaf()) 1778 1778 { 1779 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(mViewCell);1779 ViewCellInterior *interior = static_cast<ViewCellInterior *>(mViewCell); 1780 1780 1781 1781 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 1819 1819 { 1820 1820 //cout << "1"; 1821 ViewCellWrapper *viewCellWrapper = dynamic_cast<ViewCellWrapper *>(nodeWrapper);1821 ViewCellWrapper *viewCellWrapper = static_cast<ViewCellWrapper *>(nodeWrapper); 1822 1822 viewCells.push_back(viewCellWrapper->mViewCell); 1823 1823 } … … 1825 1825 { 1826 1826 //cout << "0"; 1827 BvhNodeWrapper *bvhNodeWrapper = dynamic_cast<BvhNodeWrapper *>(nodeWrapper);1827 BvhNodeWrapper *bvhNodeWrapper = static_cast<BvhNodeWrapper *>(nodeWrapper); 1828 1828 bvhNodes.push_back(bvhNodeWrapper->mNode); 1829 1829 } … … 1854 1854 cout << "error " << entry.mObject->Type() << endl; 1855 1855 1856 BvhNode *intersect = dynamic_cast<BvhNode *>(entry.mObject);1856 BvhNode *intersect = static_cast<BvhNode *>(entry.mObject); 1857 1857 BvhNode *activeNode; 1858 1858 … … 1861 1861 { 1862 1862 activeNode = 1863 dynamic_cast<BvhLeaf *>(intersect)->GetActiveNode();1863 static_cast<BvhLeaf *>(intersect)->GetActiveNode(); 1864 1864 } 1865 1865 else … … 1921 1921 else if (!vc->IsLeaf()) // interior cells: go down to leaf level 1922 1922 { 1923 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);1923 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 1924 1924 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1925 1925 … … 1958 1958 { 1959 1959 //cout <<" t"; 1960 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);1960 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 1961 1961 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1962 1962 … … 2000 2000 { 2001 2001 //cout <<" t"; 2002 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);2002 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 2003 2003 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 2004 2004 … … 2024 2024 else 2025 2025 { 2026 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);2026 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 2027 2027 #if 0 2028 2028 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); -
GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp
r2004 r2017 75 75 if (castDoubleRay) 76 76 { 77 //cerr<<"HERE"<<endl;78 77 Vector3 dir = -simpleRay.mDirection; 79 78 hittriangle = mlrtaIntersectAS( -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r2015 r2017 744 744 { 745 745 int hits = 0; 746 746 747 float mint = 0.0f, maxt = 1.0f; 747 748 const Vector3 dir = termination - origin; … … 764 765 while (1) 765 766 { 766 if (!node->IsLeaf()) { 767 KdInterior *in = (KdInterior *)node; 768 position = in->mPosition; 769 axis = in->mAxis; 770 771 if (entp[axis] <= position) 772 { 773 if (extp[axis] <= position) 774 { 775 node = in->mBack; 776 // cases N1,N2,N3,P5,Z2,Z3 777 continue; 778 } 767 if (!node->IsLeaf()) 768 { 769 KdInterior *in = static_cast<KdInterior *>(node); 770 position = in->mPosition; 771 axis = in->mAxis; 772 773 if (entp[axis] <= position) 774 { 775 if (extp[axis] <= position) 776 { 777 node = in->mBack; 778 // cases N1,N2,N3,P5,Z2,Z3 779 continue; 780 } 781 else 782 { 783 // case N4 784 node = in->mBack; 785 farChild = in->mFront; 786 } 787 } 779 788 else 780 { 781 // case N4 782 node = in->mBack; 783 farChild = in->mFront; 784 } 785 } 789 { 790 if (position <= extp[axis]) 791 { 792 node = in->mFront; 793 // cases P1,P2,P3,N5,Z1 794 continue; 795 } 796 else 797 { 798 node = in->mFront; 799 farChild = in->mBack; 800 // case P4 801 } 802 } 803 804 // $$ modification 3.5.2004 - hints from Kamil Ghais 805 // case N4 or P4 806 float tdist = (position - origin[axis]) / dir[axis]; 807 //tStack.push(RayTraversalData(farChild, extp, maxt)); //TODO 808 extp = origin + dir * tdist; 809 maxt = tdist; 810 } 786 811 else 787 {788 if (position <= extp[axis])789 {790 node = in->mFront;791 // cases P1,P2,P3,N5,Z1792 continue;793 }794 else795 {796 node = in->mFront;797 farChild = in->mBack;798 // case P4799 }800 }801 802 // $$ modification 3.5.2004 - hints from Kamil Ghais803 // case N4 or P4804 float tdist = (position - origin[axis]) / dir[axis];805 //tStack.push(RayTraversalData(farChild, extp, maxt)); //TODO806 extp = origin + dir * tdist;807 maxt = tdist;808 }809 else810 812 { 811 // compute intersection with all objects in this leaf 812 KdLeaf *leaf = (KdLeaf *)node; 813 814 // add view cell to intersections 815 ViewCell *vc = leaf->mViewCell; 816 817 if (!vc->Mailed()) { 818 vc->Mail(); 819 viewcells.push_back(vc); 820 ++ hits; 821 } 822 823 // get the next node from the stack 824 if (tStack.empty()) 825 break; 826 827 entp = extp; 828 mint = maxt; 829 830 RayTraversalData &s = tStack.top(); 831 node = s.mNode; 832 extp = s.mExitPoint; 833 maxt = s.mMaxT; 834 tStack.pop(); 813 // compute intersection with all objects in this leaf 814 KdLeaf *leaf = static_cast<KdLeaf *>(node); 815 816 // add view cell to intersections 817 ViewCell *vc = leaf->mViewCell; 818 819 if (!vc->Mailed()) 820 { 821 vc->Mail(); 822 viewcells.push_back(vc); 823 ++ hits; 824 } 825 826 // get the next node from the stack 827 if (tStack.empty()) 828 break; 829 830 entp = extp; 831 mint = maxt; 832 833 RayTraversalData &s = tStack.top(); 834 node = s.mNode; 835 extp = s.mExitPoint; 836 maxt = s.mMaxT; 837 tStack.pop(); 835 838 } 836 839 } 837 840 838 841 return hits; 839 842 } … … 1323 1326 { 1324 1327 //Debug << "l"; 1325 ExportBinLeaf(stream, dynamic_cast<KdLeaf *>(node));1328 ExportBinLeaf(stream, static_cast<KdLeaf *>(node)); 1326 1329 } 1327 1330 else 1328 1331 { 1329 1332 //Debug << "i"; 1330 KdInterior *interior = dynamic_cast<KdInterior *>(node);1333 KdInterior *interior = static_cast<KdInterior *>(node); 1331 1334 1332 1335 ExportBinInterior(stream, interior); … … 1350 1353 if (nodeType == TYPE_LEAF) 1351 1354 { 1352 return ImportBinLeaf(stream, dynamic_cast<KdInterior *>(parent), objects);1355 return ImportBinLeaf(stream, static_cast<KdInterior *>(parent), objects); 1353 1356 } 1354 1357 1355 1358 if (nodeType == TYPE_INTERIOR) 1356 1359 { 1357 return ImportBinInterior(stream, dynamic_cast<KdInterior *>(parent));1360 return ImportBinInterior(stream, static_cast<KdInterior *>(parent)); 1358 1361 } 1359 1362 … … 1409 1412 1410 1413 //Debug << "i" ; 1411 KdInterior *interior = dynamic_cast<KdInterior *>(node);1414 KdInterior *interior = static_cast<KdInterior *>(node); 1412 1415 interior->mBox = tData.mBox; 1413 1416 … … 1554 1557 if (node->IsLeaf()) 1555 1558 { 1556 leaves.push_back( dynamic_cast<KdLeaf *>(node));1559 leaves.push_back(static_cast<KdLeaf *>(node)); 1557 1560 } 1558 1561 else // interior 1559 1562 { 1560 KdInterior *interior = dynamic_cast<KdInterior *>(node);1563 KdInterior *interior = static_cast<KdInterior *>(node); 1561 1564 1562 1565 if (box.Max(interior->mAxis) >= interior->mPosition) -
GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp
r1779 r2017 418 418 const bool globalCriteriaMet) 419 419 { 420 OspSubdivisionCandidate *sc = dynamic_cast<OspSubdivisionCandidate *>(splitCandidate);420 OspSubdivisionCandidate *sc = static_cast<OspSubdivisionCandidate *>(splitCandidate); 421 421 OspTraversalData &tData = sc->mParentData; 422 422 … … 475 475 if (mStoreRays) 476 476 { 477 KdLeaf *leaf = dynamic_cast<KdLeaf *>(newNode);477 KdLeaf *leaf = static_cast<KdLeaf *>(newNode); 478 478 479 479 RayInfoContainer::const_iterator it, it_end = tData.mRays->end(); … … 1509 1509 if (!node->IsLeaf()) 1510 1510 { 1511 return ( dynamic_cast<KdInterior *>(node))->mBox;1512 } 1513 1514 KdInterior *parent = dynamic_cast<KdInterior *>(node->mParent);1511 return (static_cast<KdInterior *>(node))->mBox; 1512 } 1513 1514 KdInterior *parent = static_cast<KdInterior *>(node->mParent); 1515 1515 1516 1516 AxisAlignedBox3 box(parent->mBox); … … 1575 1575 for (vit = tmpViewCells.begin(); vit != vit_end; ++ vit) 1576 1576 { 1577 VspViewCell *vc = dynamic_cast<VspViewCell *>(*vit);1577 VspViewCell *vc = static_cast<VspViewCell *>(*vit); 1578 1578 1579 1579 if (!vc->Mailed()) … … 1590 1590 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1591 1591 { 1592 VspViewCell *vc = dynamic_cast<VspViewCell *>(*vit);1592 VspViewCell *vc = static_cast<VspViewCell *>(*vit); 1593 1593 1594 1594 VspLeaf *leaf = vc->mLeaves[0]; … … 1630 1630 if (node->IsLeaf()) 1631 1631 { 1632 leaf = dynamic_cast<KdLeaf *>(node);1632 leaf = static_cast<KdLeaf *>(node); 1633 1633 } 1634 1634 else 1635 1635 { 1636 1636 // find point 1637 KdInterior *interior = dynamic_cast<KdInterior *>(node);1637 KdInterior *interior = static_cast<KdInterior *>(node); 1638 1638 1639 1639 if (interior->mPosition > pt[interior->mAxis]) … … 2283 2283 if (node->IsLeaf()) 2284 2284 { 2285 KdLeaf *leaf = dynamic_cast<KdLeaf *>(node);2285 KdLeaf *leaf = static_cast<KdLeaf *>(node); 2286 2286 2287 2287 stream << "<Leaf "; … … 2295 2295 else 2296 2296 { 2297 KdInterior *interior = dynamic_cast<KdInterior *>(node);2297 KdInterior *interior = static_cast<KdInterior *>(node); 2298 2298 2299 2299 stream << "<Interior plane=\"" << interior->mPosition << " " … … 2328 2328 if (node->IsLeaf()) 2329 2329 { 2330 KdLeaf *leaf = dynamic_cast<KdLeaf *>(node);2330 KdLeaf *leaf = static_cast<KdLeaf *>(node); 2331 2331 2332 2332 ObjectContainer::const_iterator oit, oit_end = tData.objects->end(); … … 2340 2340 { 2341 2341 KdObjectsTraversalData frontData, backData; 2342 KdInterior *interior = dynamic_cast<KdInterior *>(node);2342 KdInterior *interior = static_cast<KdInterior *>(node); 2343 2343 2344 2344 frontData.objects = new ObjectContainer(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2012 r2017 208 208 cout << "done.\n"; 209 209 210 cout << "deleting render simulator ... \n"; 210 211 DEL_PTR(mRenderSimulator); 212 mRenderSimulator = NULL; 213 cout << "deleting renderer ... \n"; 211 214 DEL_PTR(renderer); 215 renderer = NULL; 216 cout << "deleting ray caster ... \n"; 212 217 DEL_PTR(mRayCaster); 213 218 214 219 #ifdef USE_CG 220 cout << "deleting global lines renderer ... \n"; 215 221 DEL_PTR(mGlobalLinesRenderer); 216 222 #endif 223 cout << "finished" << endl; 217 224 } 218 225 … … 336 343 if (obj->Type() == Intersectable::TRIANGLE_INTERSECTABLE) 337 344 { 338 Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem();345 Triangle3 tri = static_cast<TriangleIntersectable *>(obj)->GetItem(); 339 346 340 347 samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 0), sizeof(Vector3)); … … 370 377 if (obj->Type() == Intersectable::TRIANGLE_INTERSECTABLE) 371 378 { 372 Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem();379 Triangle3 tri = static_cast<TriangleIntersectable *>(obj)->GetItem(); 373 380 //if (!(bbox.IsInside(tri.mVertices[0]) && bbox.IsInside(tri.mVertices[1]) && bbox.IsInside(tri.mVertices[2])))continue; 374 381 … … 391 398 if (obj->Type() == Intersectable::TRIANGLE_INTERSECTABLE) 392 399 { 393 //Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem();400 //Triangle3 tri = static_cast<TriangleIntersectable *>(obj)->GetItem(); 394 401 //if (!(bbox.IsInside(tri.mVertices[0]) && bbox.IsInside(tri.mVertices[1]) && bbox.IsInside(tri.mVertices[2]))) continue; 395 402 396 Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem();403 Triangle3 tri = static_cast<TriangleIntersectable *>(obj)->GetItem(); 397 404 samplesOut << "f " << i << " " << i + 1 << " " << i + 2 << endl; 398 405 i += 3; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2012 r2017 262 262 ///////////////////////// 263 263 264 GlobalLinesRenderer *mGlobalLinesRenderer; 265 RayCaster *mRayCaster; 266 /// samples used for construction of the BSP view cells tree. 264 GlobalLinesRenderer *mGlobalLinesRenderer; 265 266 RayCaster *mRayCaster; 267 /// samples used for construction of the BSP view cells tree. 267 268 int mBspConstructionSamples; 268 269 /// samples used for construction of the VSP OSP tree. … … 281 282 }; 282 283 283 284 extern Preprocessor *preprocessor; 284 285 285 286 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r1977 r2017 213 213 Name="VCCLCompilerTool" 214 214 Optimization="3" 215 GlobalOptimizations="TRUE" 215 216 InlineFunctionExpansion="0" 216 FavorSizeOrSpeed="0" 217 EnableIntrinsicFunctions="TRUE" 218 FavorSizeOrSpeed="1" 219 OmitFramePointers="TRUE" 220 EnableFiberSafeOptimizations="TRUE" 217 221 OptimizeForProcessor="3" 218 222 OptimizeForWindowsApplication="TRUE" … … 221 225 ExceptionHandling="TRUE" 222 226 RuntimeLibrary="2" 227 EnableEnhancedInstructionSet="2" 223 228 DisableLanguageExtensions="FALSE" 224 229 ForceConformanceInForLoopScope="FALSE" 225 RuntimeTypeInfo=" TRUE"230 RuntimeTypeInfo="FALSE" 226 231 UsePrecompiledHeader="0" 227 232 BrowseInformation="1" -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.cpp
r1785 r2017 42 42 if (node->IsLeaf()) 43 43 { 44 KdLeaf *leaf = dynamic_cast<KdLeaf *>(node);44 KdLeaf *leaf = static_cast<KdLeaf *>(node); 45 45 46 46 // add #objects exclusivly in this node … … 64 64 else // traverse tree 65 65 { 66 KdInterior *interior = dynamic_cast<KdInterior *>(node);66 KdInterior *interior = static_cast<KdInterior *>(node); 67 67 68 68 tStack.push(interior->mFront); … … 85 85 // hack for choosing which node to account for 86 86 if (bvhObj->IsLeaf()) 87 node = dynamic_cast<BvhLeaf *>(bvhObj)->GetActiveNode();87 node = static_cast<BvhLeaf *>(bvhObj)->GetActiveNode(); 88 88 else 89 89 node = bvhObj; … … 92 92 if (node->IsLeaf()) 93 93 { 94 BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(node);94 BvhLeaf *leaf = static_cast<BvhLeaf *>(node); 95 95 // objects already accounted for 96 96 if (leaf->Mailed()) … … 118 118 if (node->IsLeaf()) 119 119 { 120 BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(node);120 BvhLeaf *leaf = static_cast<BvhLeaf *>(node); 121 121 122 122 // add #objects exclusivly in this node … … 125 125 else // traverse tree 126 126 { 127 BvhInterior *interior = dynamic_cast<BvhInterior *>(node);127 BvhInterior *interior = static_cast<BvhInterior *>(node); 128 128 129 129 tStack.push(interior->GetFront()); … … 156 156 { 157 157 // found kd node 158 KdIntersectable *kdObj = dynamic_cast<KdIntersectable *>(obj);158 KdIntersectable *kdObj = static_cast<KdIntersectable *>(obj); 159 159 pvs += EvalKdNodeContribution(kdObj); 160 160 break; … … 162 162 case Intersectable::BVH_INTERSECTABLE: 163 163 { 164 BvhNode *bvhObj = dynamic_cast<BvhNode *>(obj);164 BvhNode *bvhObj = static_cast<BvhNode *>(obj); 165 165 pvs += EvalBvhNodeContribution(bvhObj); 166 166 break; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.h
r1984 r2017 12 12 { 13 13 14 Q_OBJECT14 //Q_OBJECT 15 15 16 16 friend class QtGlRendererWidget; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtInterface.vcproj
r1969 r2017 180 180 Name="VCMIDLTool"/> 181 181 <Tool 182 Name="VCPostBuildEventTool" 183 Description=""copy dll to preprocessor dir"" 184 CommandLine="copy Release\*.dll ..\..\bin\"/> 182 Name="VCPostBuildEventTool"/> 185 183 <Tool 186 184 Name="VCPreBuildEventTool"/> -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r2005 r2017 189 189 GlobalOptimizations="TRUE" 190 190 InlineFunctionExpansion="2" 191 FavorSizeOrSpeed="1" 191 EnableIntrinsicFunctions="TRUE" 192 FavorSizeOrSpeed="1" 193 OmitFramePointers="TRUE" 192 194 EnableFiberSafeOptimizations="TRUE" 193 195 OptimizeForProcessor="3" 194 196 OptimizeForWindowsApplication="TRUE" 195 197 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(QTDIR)\include\QtOpenGl";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtCore";"$(QTDIR)\include";QtInterface" 196 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT3" 197 RuntimeLibrary="2" 198 RuntimeTypeInfo="TRUE" 198 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT" 199 RuntimeLibrary="2" 200 EnableEnhancedInstructionSet="2" 201 RuntimeTypeInfo="FALSE" 199 202 UsePrecompiledHeader="0" 200 203 WarningLevel="3" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r2015 r2017 471 471 else 472 472 { 473 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);473 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 474 474 475 475 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 504 504 else 505 505 { 506 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);506 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 507 507 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 508 508 … … 1274 1274 1275 1275 1276 ViewCellInterior *p = dynamic_cast<ViewCellInterior *>(leaf->GetParent());1276 ViewCellInterior *p = static_cast<ViewCellInterior *>(leaf->GetParent()); 1277 1277 1278 1278 p->RemoveChildLink(leaf); … … 1285 1285 float cost1, cost2; 1286 1286 1287 ViewCellInterior *vc1 = dynamic_cast<ViewCellInterior *>(mc.GetLeftViewCell());1288 ViewCellInterior *vc2 = dynamic_cast<ViewCellInterior *>(mc.GetRightViewCell());1287 ViewCellInterior *vc1 = static_cast<ViewCellInterior *>(mc.GetLeftViewCell()); 1288 ViewCellInterior *vc2 = static_cast<ViewCellInterior *>(mc.GetRightViewCell()); 1289 1289 1290 1290 ViewCell *leaf1 = mc.GetInitialLeftViewCell(); … … 1480 1480 if (!root->IsLeaf()) 1481 1481 { 1482 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(root);1482 ViewCellInterior *interior = static_cast<ViewCellInterior *>(root); 1483 1483 1484 1484 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 1577 1577 if (!vc->IsLeaf()) 1578 1578 { 1579 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);1579 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 1580 1580 1581 1581 const float parentCost = GetPvsCost(interior); … … 1651 1651 else 1652 1652 { 1653 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);1653 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 1654 1654 1655 1655 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 1789 1789 if (!vc->IsLeaf()) // interior cells: go down to leaf level 1790 1790 { 1791 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);1791 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 1792 1792 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1793 1793 … … 1925 1925 if (!vc->IsLeaf()) 1926 1926 { 1927 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);1927 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 1928 1928 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1929 1929 … … 1976 1976 if (!vc->IsLeaf()) 1977 1977 { 1978 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);1978 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 1979 1979 1980 1980 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 2068 2068 if (!root->IsLeaf()) 2069 2069 { 2070 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(root);2070 ViewCellInterior *interior = static_cast<ViewCellInterior *>(root); 2071 2071 2072 2072 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 2126 2126 if (!viewCell->IsLeaf()) 2127 2127 { 2128 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(viewCell);2128 ViewCellInterior *interior = static_cast<ViewCellInterior *>(viewCell); 2129 2129 2130 2130 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 2156 2156 if (!vc->IsLeaf()) 2157 2157 { 2158 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);2158 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 2159 2159 2160 2160 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 2219 2219 if (!vc->IsLeaf()) 2220 2220 { 2221 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);2221 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 2222 2222 2223 2223 const float parentCost = GetPvsCost(interior); … … 2284 2284 if (!vc->IsLeaf()) 2285 2285 { 2286 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);2286 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 2287 2287 2288 2288 const float parentPvsCost = GetPvsCost(interior); … … 2372 2372 if (!vc->IsLeaf()) 2373 2373 { 2374 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);2374 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 2375 2375 2376 2376 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 2397 2397 { 2398 2398 ObjectContainer objects; 2399 BvhNode *node = dynamic_cast<BvhNode *>(obj);2399 BvhNode *node = static_cast<BvhNode *>(obj); 2400 2400 node->CollectObjects(objects); 2401 2401 … … 2422 2422 stream << "<Leaf "; 2423 2423 stream << "id=\"" << viewCell->GetId() << "\" "; 2424 stream << "active=\"" << dynamic_cast<ViewCellLeaf *>(viewCell)->GetActiveViewCell()->GetId() << "\" ";2424 stream << "active=\"" << static_cast<ViewCellLeaf *>(viewCell)->GetActiveViewCell()->GetId() << "\" "; 2425 2425 stream << "mergecost=\"" << viewCell->GetMergeCost() << "\" "; 2426 2426 stream << "pvs=\""; … … 2435 2435 else 2436 2436 { 2437 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(viewCell);2437 ViewCellInterior *interior = static_cast<ViewCellInterior *>(viewCell); 2438 2438 2439 2439 stream << "<Interior "; … … 2481 2481 if (!vc->IsLeaf()) 2482 2482 { 2483 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);2483 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 2484 2484 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 2485 2485 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r1923 r2017 498 498 if (!tData.mNode->IsLeaf()) 499 499 { 500 BspInterior *interior = dynamic_cast<BspInterior *>(tData.mNode);500 BspInterior *interior = static_cast<BspInterior *>(tData.mNode); 501 501 502 502 /////////////////// … … 636 636 { 637 637 case Intersectable::MESH_INSTANCE: 638 mesh = dynamic_cast<MeshInstance *>(object)->GetMesh();638 mesh = static_cast<MeshInstance *>(object)->GetMesh(); 639 639 break; 640 640 case Intersectable::VIEW_CELL: 641 mesh = dynamic_cast<ViewCell *>(object)->GetMesh();641 mesh = static_cast<ViewCell *>(object)->GetMesh(); 642 642 break; 643 643 case Intersectable::TRANSFORMED_MESH_INSTANCE: 644 644 { 645 TransformedMeshInstance *mi = dynamic_cast<TransformedMeshInstance *>(object);645 TransformedMeshInstance *mi = static_cast<TransformedMeshInstance *>(object); 646 646 647 647 if (!mi->GetMesh()) … … 801 801 if (!ray->intersections.empty()) 802 802 { 803 MeshInstance *obj = dynamic_cast<MeshInstance *>(ray->intersections[0].mObject);803 MeshInstance *obj = static_cast<MeshInstance *>(ray->intersections[0].mObject); 804 804 805 805 Mesh *mesh; … … 807 807 { 808 808 TransformedMeshInstance *tmobj = 809 dynamic_cast<TransformedMeshInstance *>(obj);809 static_cast<TransformedMeshInstance *>(obj); 810 810 811 811 mesh = new Mesh(); … … 1006 1006 if (TerminationCriteriaMet(tData)) 1007 1007 { 1008 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode);1008 BspLeaf *leaf = static_cast<BspLeaf *>(tData.mNode); 1009 1009 1010 1010 BspViewCell *viewCell; … … 1017 1017 { 1018 1018 // add predefined view cell to leaf 1019 viewCell = dynamic_cast<BspViewCell *>(tData.mViewCell);1019 viewCell = static_cast<BspViewCell *>(tData.mViewCell); 1020 1020 1021 1021 // out of bounds cell can be handled as any other view cell, … … 1154 1154 if (DotProd((*it)->GetNormal(), splitPlane.mNormal) > 0) 1155 1155 { 1156 backData.mViewCell = dynamic_cast<ViewCellLeaf *>((*it)->mParent);1156 backData.mViewCell = static_cast<ViewCellLeaf *>((*it)->mParent); 1157 1157 foundBack = true; 1158 1158 } 1159 1159 else 1160 1160 { 1161 frontData.mViewCell = dynamic_cast<ViewCellLeaf *>((*it)->mParent);1161 frontData.mViewCell = static_cast<ViewCellLeaf *>((*it)->mParent); 1162 1162 foundFront = true; 1163 1163 } … … 1173 1173 mStat.nodes += 2; 1174 1174 1175 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode);1175 BspLeaf *leaf = static_cast<BspLeaf *>(tData.mNode); 1176 1176 1177 1177 // select subdivision plane … … 1972 1972 else 1973 1973 { 1974 BspInterior *interior = dynamic_cast<BspInterior *>(node);1974 BspInterior *interior = static_cast<BspInterior *>(node); 1975 1975 1976 1976 nodeStack.push(interior->GetBack()); … … 1990 1990 { 1991 1991 // the node became a leaf -> evaluate stats for leafs 1992 BspLeaf *leaf = dynamic_cast<BspLeaf *>(data.mNode);1992 BspLeaf *leaf = static_cast<BspLeaf *>(data.mNode); 1993 1993 1994 1994 // store maximal and minimal depth … … 2055 2055 if (!node->IsLeaf()) 2056 2056 { 2057 BspInterior *in = dynamic_cast<BspInterior *>(node);2057 BspInterior *in = static_cast<BspInterior *>(node); 2058 2058 2059 2059 Plane3 splitPlane = in->GetPlane(); … … 2097 2097 } else // reached leaf => intersection with view cell 2098 2098 { 2099 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);2099 BspLeaf *leaf = static_cast<BspLeaf *>(node); 2100 2100 2101 2101 if (!leaf->mViewCell->Mailed()) … … 2154 2154 if (!node->IsLeaf()) 2155 2155 { 2156 BspInterior *in = dynamic_cast<BspInterior *>(node);2156 BspInterior *in = static_cast<BspInterior *>(node); 2157 2157 2158 2158 Plane3 splitPlane = in->GetPlane(); … … 2202 2202 { 2203 2203 // reached leaf => intersection with view cell 2204 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);2204 BspLeaf *leaf = static_cast<BspLeaf *>(node); 2205 2205 2206 2206 if (!leaf->mViewCell->Mailed()) … … 2246 2246 if (node->IsLeaf()) 2247 2247 { 2248 ViewCellLeaf *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell;2248 ViewCellLeaf *viewCell = static_cast<BspLeaf *>(node)->mViewCell; 2249 2249 2250 2250 if (!viewCell->Mailed()) … … 2256 2256 else 2257 2257 { 2258 BspInterior *interior = dynamic_cast<BspInterior *>(node);2258 BspInterior *interior = static_cast<BspInterior *>(node); 2259 2259 2260 2260 nodeStack.push(interior->GetFront()); … … 2372 2372 if (n) 2373 2373 { 2374 BspInterior *interior = dynamic_cast<BspInterior *>(n);2375 Plane3 halfSpace = dynamic_cast<BspInterior *>(interior)->GetPlane();2374 BspInterior *interior = static_cast<BspInterior *>(n); 2375 Plane3 halfSpace = static_cast<BspInterior *>(interior)->GetPlane(); 2376 2376 2377 2377 if (interior->GetBack() != lastNode) … … 2403 2403 continue; 2404 2404 2405 BspViewCell *bspVc = dynamic_cast<BspViewCell *>(*it);2405 BspViewCell *bspVc = static_cast<BspViewCell *>(*it); 2406 2406 vector<BspLeaf *>::const_iterator bit, bit_end = bspVc->mLeaves.end(); 2407 2407 … … 2592 2592 if (isAdjacent) 2593 2593 { 2594 neighbors.push_back( dynamic_cast<BspLeaf *>(node));2594 neighbors.push_back(static_cast<BspLeaf *>(node)); 2595 2595 } 2596 2596 } … … 2598 2598 else 2599 2599 { 2600 BspInterior *interior = dynamic_cast<BspInterior *>(node);2600 BspInterior *interior = static_cast<BspInterior *>(node); 2601 2601 2602 2602 const int cf = Polygon3::ClassifyPlane(nodeGeom.GetPolys(), … … 2660 2660 { 2661 2661 if ( (!onlyUnmailed || !node->Mailed()) ) 2662 return dynamic_cast<BspLeaf *>(node);2662 return static_cast<BspLeaf *>(node); 2663 2663 } 2664 2664 else 2665 2665 { 2666 BspInterior *interior = dynamic_cast<BspInterior *>(node);2666 BspInterior *interior = static_cast<BspInterior *>(node); 2667 2667 2668 2668 // random decision … … 2829 2829 2830 2830 iit = ray->mViewCells.begin(); 2831 BspViewCell *bspVc = dynamic_cast<BspViewCell *>(*(iit ++));2831 BspViewCell *bspVc = static_cast<BspViewCell *>(*(iit ++)); 2832 2832 BspLeaf *leaf = bspVc->mLeaves[0]; 2833 2833 … … 2838 2838 // next pair 2839 2839 BspLeaf *prevLeaf = leaf; 2840 bspVc = dynamic_cast<BspViewCell *>(*iit);2840 bspVc = static_cast<BspViewCell *>(*iit); 2841 2841 leaf = bspVc->mLeaves[0]; 2842 2842 … … 3340 3340 if (node->IsLeaf()) 3341 3341 { 3342 viewcell = dynamic_cast<BspLeaf *>(node)->mViewCell;3342 viewcell = static_cast<BspLeaf *>(node)->mViewCell; 3343 3343 break; 3344 3344 } … … 3346 3346 { 3347 3347 3348 BspInterior *interior = dynamic_cast<BspInterior *>(node);3348 BspInterior *interior = static_cast<BspInterior *>(node); 3349 3349 3350 3350 // random decision … … 3375 3375 if (node->IsLeaf()) 3376 3376 { 3377 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);3377 BspLeaf *leaf = static_cast<BspLeaf *>(node); 3378 3378 ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 3379 3379 … … 3384 3384 else 3385 3385 { 3386 BspInterior *interior = dynamic_cast<BspInterior *>(node);3386 BspInterior *interior = static_cast<BspInterior *>(node); 3387 3387 3388 3388 Plane3 plane = interior->GetPlane(); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2015 r2017 238 238 mEvaluationSamplingType = SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION; 239 239 } 240 /*else if (strcmp(buf, "interior") == 0)241 {242 mEvaluationSamplingType = SamplingStrategy::OBJECTS_INTERIOR_DISTRIBUTION;243 }*/244 240 else 245 241 { … … 311 307 312 308 309 ViewCell *ViewCellsManager::GetViewCellById(const int id) 310 { 311 ViewCellContainer::const_iterator vit, vit_end = mViewCells.end(); 312 313 for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 314 { 315 if ((*vit)->GetId() == id) 316 return (*vit); 317 } 318 return NULL; 319 } 320 321 322 bool ViewCellsManager::ExportRandomViewCells(const string &filename, 323 const vector<ViewCellPoints *> &viewCells) 324 { 325 std::ofstream outStream; 326 outStream.open(filename.c_str()); 327 328 vector<ViewCellPoints *>::const_iterator vit, vit_end = viewCells.end(); 329 330 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 331 { 332 ViewCell *vc = (*vit)->first; 333 334 outStream << "v " << vc->GetId() << endl; 335 336 SimpleRayContainer viewPoints; 337 338 SimpleRayContainer::const_iterator pit, pit_end = (*vit)->second.end(); 339 340 for (pit = (*vit)->second.begin(); pit != pit_end; ++ pit) 341 { 342 const Vector3 pt = (*pit).mOrigin; 343 const Vector3 dir = (*pit).mDirection; 344 345 outStream << "p " << pt.x << " " << pt.y << " " << pt.z 346 << " " << dir.x << " " << dir.y << " " << dir.z << endl; 347 } 348 } 349 350 return true; 351 } 352 353 354 bool ViewCellsManager::GenerateRandomViewCells(vector<ViewCellPoints *> &viewCells, 355 const int nViewCells, 356 const int nViewPoints) 357 { 358 ViewCellContainer rViewCells; 359 360 cout << "generating " << nViewCells << " random view cells" << endl; 361 GenerateRandomViewCells(rViewCells, nViewCells); 362 363 cout << "finished" << endl; 364 365 //for (int i = 0; i < viewCells.size(); ++ i) 366 // cout << "vc " << i << ": " << viewCells[i]->GetId() << endl; 367 368 cout << "generating " << nViewPoints << " view points per view cell" << endl; 369 ViewCellContainer::const_iterator vit, vit_end = rViewCells.end(); 370 371 for (vit = rViewCells.begin(); vit != vit_end; ++ vit) 372 { 373 ViewCell *vc = *vit; 374 375 ViewCellPoints *vcPts = new ViewCellPoints(); 376 viewCells.push_back(vcPts); 377 378 vcPts->first = vc; 379 380 SimpleRayContainer viewPoints; 381 // generate random view points 382 GenerateViewPoints(vc, nViewPoints, viewPoints); 383 384 SimpleRayContainer::const_iterator pit, pit_end = viewPoints.end(); 385 386 for (pit = viewPoints.begin(); pit != pit_end; ++ pit) 387 { 388 vcPts->second.push_back(*pit); 389 } 390 } 391 392 return true; 393 } 394 395 396 bool ViewCellsManager::ImportRandomViewCells(const string &filename, 397 vector<ViewCellPoints *> &viewCells) 398 { 399 ifstream inStream(filename.c_str()); 400 if (!inStream.is_open()) 401 return false; 402 403 ViewCellPoints *currentViewCell = NULL; 404 405 string buf; 406 while (!(getline(inStream, buf)).eof()) 407 { 408 switch (buf[0]) 409 { 410 case 'v': 411 { 412 int id; 413 sscanf(buf.c_str(), "v %d", &id); 414 415 currentViewCell = new ViewCellPoints(); 416 currentViewCell->first = GetViewCellById(id); 417 418 viewCells.push_back(currentViewCell); 419 break; 420 } 421 case 'p': 422 { 423 Vector3 pt, dir; 424 sscanf(buf.c_str(), "p %f %f %f %f %f %f", &pt.x, &pt.y, &pt.z, &dir.x, &dir.y, &dir.z); 425 426 SimpleRay ray(pt, dir, 0, 1); 427 currentViewCell->second.push_back(ray); 428 break; 429 } 430 default: 431 break; 432 } 433 } 434 435 return true; 436 } 437 438 439 bool ViewCellsManager::GenerateViewPoints(ViewCell *viewCell, 440 const int numViewPoints, 441 SimpleRayContainer &viewPoints) 442 { 443 bool success = true; 444 int generatedPts = 0; 445 int i = 0; 446 447 while (generatedPts < numViewPoints) 448 { 449 SimpleRay pt; 450 451 if (GenerateViewPoint(viewCell, pt)) 452 { 453 ++ generatedPts; 454 viewPoints.push_back(pt); 455 } 456 457 // savety criterium 458 if (++ i > numViewPoints + 100000) 459 { 460 return false; 461 } 462 } 463 464 return true; 465 } 466 467 468 bool ViewCellsManager::GenerateViewPoint(ViewCell *viewCell, 469 SimpleRay &ray) 470 { 471 // do not use this function since it could return different viewpoints for 472 // different executions of the algorithm 473 int tries = 0; 474 Vector3 viewPoint, direction; 475 const int maxTries = 100; 476 477 while (1) 478 { 479 // hack 480 if (!viewCell->GetMesh()) 481 CreateMesh(viewCell); 482 483 Mesh *mesh = viewCell->GetMesh(); 484 AxisAlignedBox3 box = mesh->mBox; 485 //cout <<"box: " << box << endl; 486 /*Vector3 pVector = Vector3(halton.GetNumber(1), 487 halton.GetNumber(2), 488 halton.GetNumber(3));*/ 489 490 Vector3 pVector = Vector3(Random(1.0f), 491 Random(1.0f), 492 Random(1.0f)); 493 494 viewPoint = box.GetPoint(pVector); 495 496 //const Vector3 dVector = Vector3(2 * M_PI * halton.GetNumber(4), M_PI*halton.GetNumber(5),0.0f); 497 const Vector3 dVector = Vector3(2 * M_PI * Random(1.0f), M_PI * Random(1.0f), 0.0f); 498 direction = Normalize(Vector3(sin(dVector.x), 0.0f, cos(dVector.x))); 499 //halton.GenerateNext(); 500 501 //cout << "vp: " << viewPoint << endl; 502 //cout << "dir: " << direction << endl; 503 504 ViewCell *v = GetViewCell(viewPoint); 505 506 if (v && v->GetValid()) 507 { 508 //cout << "validating view point" << endl; 509 510 mPreprocessor->GetRenderer()->mViewPoint = viewPoint; 511 mPreprocessor->GetRenderer()->mViewDirection = direction; 512 513 if (mPreprocessor->GetRenderer()->ValidViewPoint()) 514 { 515 cout << "view point valid" << endl; 516 break; 517 } 518 } 519 520 // generate a new vector 521 //halton.GenerateNext(); 522 523 //if (!box.IsInside(viewPoint)) 524 // cout << "error!" << endl; 525 if (++ tries > maxTries) 526 return false; 527 } 528 529 ray = SimpleRay(viewPoint, direction, 0, 1); 530 //cout << "view point generated: " << viewPoint << " " << direction << endl; 531 532 return true; 533 } 534 535 536 bool ViewCellsManager::IsValidViewSpace(ViewCell *vc) 537 { 538 SimpleRay simpleRay; 539 //check if view point can be generated 540 return GenerateViewPoint(vc, simpleRay); 541 } 542 543 544 bool ViewCellsManager::GenerateRandomViewCells(ViewCellContainer &viewCells, 545 const int numViewCells) 546 { 547 int generatedViewCells = 0; 548 //HaltonSequence halton; 549 //float r[1]; 550 551 ViewCell::NewMail(); 552 553 while (generatedViewCells < numViewCells) 554 { 555 // savety criterium 556 const int tries = 100000 + generatedViewCells; 557 int i = 0; 558 559 // generate next view cell 560 while (1) 561 { 562 //halton.GetNext(1, r); 563 //const int idx = (int)(r[0] * mViewCells.size() - 1.0f); 564 const int idx = (int)RandomValue(0.0f, (float)mViewCells.size() - 0.5f); 565 566 ViewCell *viewCell = GetViewCell(idx); 567 568 if (!viewCell->Mailed()) 569 { 570 viewCell->Mail(); 571 572 // check for valid view space 573 if (IsValidViewSpace(viewCell)) 574 { 575 // valid view cell found 576 viewCells.push_back(viewCell); 577 578 ++ generatedViewCells; 579 //cout << "view cell " << generatedViewCells << " generated: " << viewCell->GetId() << endl; 580 break; 581 } 582 else 583 { 584 cout << "error: invalid view cell " << generatedViewCells << " generated: " << viewCell->GetId() << endl; 585 } 586 } 587 588 if (++ i == tries) // no new view cell fond 589 { 590 cerr << "big error! no view cell found" << endl; 591 return false; 592 } 593 } 594 } 595 596 return true; 597 } 598 599 313 600 ViewCellsManager::~ViewCellsManager() 314 601 { … … 575 862 mRenderer->RenderScene(); 576 863 SimulationStatistics ss; 577 dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss);864 static_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 578 865 579 866 Debug << ss << endl; … … 1616 1903 if ((*oit)->Type() == Intersectable::TRANSFORMED_MESH_INSTANCE) 1617 1904 { 1618 TransformedMeshInstance *mit = dynamic_cast<TransformedMeshInstance *>(*oit);1905 TransformedMeshInstance *mit = static_cast<TransformedMeshInstance *>(*oit); 1619 1906 mesh = MeshManager::GetSingleton()->CreateResource(); 1620 1907 mit->GetTransformedMesh(*mesh); … … 1622 1909 else if ((*oit)->Type() == Intersectable::MESH_INSTANCE) 1623 1910 { 1624 MeshInstance *mit = dynamic_cast<MeshInstance *>(*oit);1911 MeshInstance *mit = static_cast<MeshInstance *>(*oit); 1625 1912 mesh = mit->GetMesh(); 1626 1913 } … … 2608 2895 for (lit = leaves.begin(); lit != lit_end; ++ lit) 2609 2896 { 2610 dynamic_cast<ViewCellLeaf *>(*lit)->SetActiveViewCell(vc);2897 static_cast<ViewCellLeaf *>(*lit)->SetActiveViewCell(vc); 2611 2898 } 2612 2899 } … … 2648 2935 for (it = objects.begin(); it != it_end; ++ it) 2649 2936 { 2650 MeshInstance *mi = dynamic_cast<MeshInstance *>(*it);2937 MeshInstance *mi = static_cast<MeshInstance *>(*it); 2651 2938 const AxisAlignedBox3 box = mi->GetBox(); 2652 2939 … … 2671 2958 for (it = objects.begin(); it != it_end; ++ it) 2672 2959 { 2673 MeshInstance *mi = dynamic_cast<MeshInstance *>(*it);2960 MeshInstance *mi = static_cast<MeshInstance *>(*it); 2674 2961 const AxisAlignedBox3 box = mi->GetBox(); 2675 2962 Vector3 bmin = box.Min(); … … 3252 3539 //-- interior node => propagate pvs up the tree 3253 3540 3254 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(root);3541 ViewCellInterior *interior = static_cast<ViewCellInterior *>(root); 3255 3542 3256 3543 // reset interior pvs … … 3920 4207 3921 4208 Mesh *mesh = MeshManager::GetSingleton()->CreateResource(); 3922 4209 3923 4210 IncludeNodeGeomInMesh(geom, *mesh); 4211 mesh->ComputeBoundingBox(); 4212 3924 4213 vc->SetMesh(mesh); 3925 4214 } … … 4101 4390 if (root->IsLeaf()) 4102 4391 { 4103 BspLeaf *leaf = dynamic_cast<BspLeaf *>(root);4392 BspLeaf *leaf = static_cast<BspLeaf *>(root); 4104 4393 leaf->GetViewCell()->SetMergeCost(0.0f); 4105 4394 return leaf->GetViewCell(); 4106 4395 } 4107 4396 4108 BspInterior *interior = dynamic_cast<BspInterior *>(root);4397 BspInterior *interior = static_cast<BspInterior *>(root); 4109 4398 ViewCellInterior *viewCellInterior = new ViewCellInterior(); 4110 4399 … … 4243 4532 4244 4533 for (int i = 0; i < leafOut; ++ i) 4245 kdLeaves.push_back( dynamic_cast<KdLeaf *>(mKdTree->GetRandomLeaf()));4534 kdLeaves.push_back(static_cast<KdLeaf *>(mKdTree->GetRandomLeaf())); 4246 4535 4247 4536 for (int i = 0; i < kdLeaves.size(); ++ i) … … 4406 4695 for (it = leaves.begin(); it != it_end; ++ it) 4407 4696 { 4408 KdViewCell *kdVc = dynamic_cast<KdViewCell *>(*it);4697 KdViewCell *kdVc = static_cast<KdViewCell *>(*it); 4409 4698 exporter->ExportBox(mKdTree->GetBox(kdVc->mLeaves[0])); 4410 4699 } … … 4746 5035 4747 5036 SimulationStatistics ss; 4748 dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss);5037 static_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 4749 5038 Debug << "render time before refine\n\n" << ss << endl; 4750 5039 … … 4826 5115 4827 5116 cout << "\nview cells partition render time before compress" << endl << endl;; 4828 dynamic_cast<RenderSimulator *>(mRenderer)->RenderScene();5117 static_cast<RenderSimulator *>(mRenderer)->RenderScene(); 4829 5118 SimulationStatistics ss; 4830 dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss);5119 static_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 4831 5120 cout << ss << endl; 4832 5121 … … 4857 5146 if (root->IsLeaf()) 4858 5147 { 4859 BspLeaf *leaf = dynamic_cast<BspLeaf *>(root);5148 BspLeaf *leaf = static_cast<BspLeaf *>(root); 4860 5149 leaf->GetViewCell()->SetMergeCost(0.0f); 4861 5150 return leaf->GetViewCell(); … … 4863 5152 4864 5153 4865 BspInterior *interior = dynamic_cast<BspInterior *>(root);5154 BspInterior *interior = static_cast<BspInterior *>(root); 4866 5155 ViewCellInterior *viewCellInterior = new ViewCellInterior(); 4867 5156 … … 5095 5384 for (vit = leaves.begin(); vit != vit_end; ++ vit) 5096 5385 { 5097 BspLeaf *vcLeaf = dynamic_cast<BspViewCell *>(*vit)->mLeaves[0];5386 BspLeaf *vcLeaf = static_cast<BspViewCell *>(*vit)->mLeaves[0]; 5098 5387 VssRayContainer::const_iterator rit, rit_end = vcLeaf->mVssRays.end(); 5099 5388 … … 5387 5676 for (int j = 0; j < (int)leaves.size(); ++ j) 5388 5677 { 5389 BspLeaf *leaf = dynamic_cast<BspViewCell *>(leaves[i])->mLeaves[0];5678 BspLeaf *leaf = static_cast<BspViewCell *>(leaves[i])->mLeaves[0]; 5390 5679 5391 5680 if (i != j) 5392 5681 { 5393 BspLeaf *leaf2 = dynamic_cast<BspViewCell *>(leaves[j])->mLeaves[0];5682 BspLeaf *leaf2 =static_cast<BspViewCell *>(leaves[j])->mLeaves[0]; 5394 5683 const int dist = mVspBspTree->TreeDistance(leaf, leaf2); 5395 5684 … … 5422 5711 5423 5712 Mesh *mesh = MeshManager::GetSingleton()->CreateResource(); 5713 5424 5714 IncludeNodeGeomInMesh(geom, *mesh); 5715 mesh->ComputeBoundingBox(); 5425 5716 5426 5717 vc->SetMesh(mesh); … … 5500 5791 { 5501 5792 // TODO: do I still need this here? 5502 if (0) 5503 mVspBspTree->RepairViewCellsLeafLists(); 5793 if (0) mVspBspTree->RepairViewCellsLeafLists(); 5504 5794 } 5505 5795 … … 5748 6038 5749 6039 cout << "\nview cells partition render time before compress" << endl << endl; 5750 dynamic_cast<RenderSimulator *>(mRenderer)->RenderScene();6040 static_cast<RenderSimulator *>(mRenderer)->RenderScene(); 5751 6041 SimulationStatistics ss; 5752 dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss);6042 static_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 5753 6043 cout << ss << endl; 5754 6044 … … 5782 6072 if (root->IsLeaf()) 5783 6073 { 5784 VspLeaf *leaf = dynamic_cast<VspLeaf *>(root);6074 VspLeaf *leaf = static_cast<VspLeaf *>(root); 5785 6075 leaf->GetViewCell()->SetMergeCost(0.0f); 5786 6076 return leaf->GetViewCell(); 5787 6077 } 5788 6078 5789 VspInterior *interior = dynamic_cast<VspInterior *>(root);6079 VspInterior *interior = static_cast<VspInterior *>(root); 5790 6080 ViewCellInterior *viewCellInterior = new ViewCellInterior(); 5791 6081 … … 5861 6151 for (it = leaves.begin(); it != it_end; ++ it) 5862 6152 { 5863 VspViewCell *vspVc = dynamic_cast<VspViewCell *>(*it);6153 VspViewCell *vspVc = static_cast<VspViewCell *>(*it); 5864 6154 VspLeaf *l = vspVc->mLeaves[0]; 5865 6155 … … 5927 6217 ObjectPvsEntry entry = pit.Next(); 5928 6218 5929 BvhNode *node = dynamic_cast<BvhNode *>(entry.mObject);6219 BvhNode *node = static_cast<BvhNode *>(entry.mObject); 5930 6220 5931 6221 // hack!! … … 6165 6455 for (vit = leaves.begin(); vit != vit_end; ++ vit) 6166 6456 { 6167 VspLeaf *vcLeaf = dynamic_cast<VspViewCell *>(*vit)->mLeaves[0];6457 VspLeaf *vcLeaf = static_cast<VspViewCell *>(*vit)->mLeaves[0]; 6168 6458 VssRayContainer::const_iterator rit, rit_end = vcLeaf->mVssRays.end(); 6169 6459 … … 6311 6601 void VspOspViewCellsManager::CreateMesh(ViewCell *vc) 6312 6602 { 6313 // matt: TODO6314 6603 Mesh *mesh = MeshManager::GetSingleton()->CreateResource(); 6315 6604 6316 6605 ViewCellContainer leaves; 6317 6606 mViewCellsTree->CollectLeaves(vc, leaves); … … 6321 6610 for (it = leaves.begin(); it != it_end; ++ it) 6322 6611 { 6323 VspLeaf *leaf = dynamic_cast<VspViewCell *>(*it)->mLeaves[0];6612 VspLeaf *leaf = static_cast<VspViewCell *>(*it)->mLeaves[0]; 6324 6613 const AxisAlignedBox3 box = mHierarchyManager->GetVspTree()->GetBoundingBox(leaf); 6325 6614 IncludeBoxInMesh(box, *mesh); 6326 6615 } 6327 6616 6617 mesh->ComputeBoundingBox(); 6618 6328 6619 vc->SetMesh(mesh); 6329 6620 } … … 6349 6640 for (it = leaves.begin(); it != it_end; ++ it) 6350 6641 { 6351 VspLeaf *leaf = dynamic_cast<VspViewCell *>(*it)->mLeaves[0];6642 VspLeaf *leaf = static_cast<VspViewCell *>(*it)->mLeaves[0]; 6352 6643 6353 6644 const AxisAlignedBox3 box = mHierarchyManager->GetVspTree()->GetBoundingBox(leaf); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2015 r2017 77 77 }; 78 78 79 typedef pair<ViewCell *, SimpleRayContainer> ViewCellPoints; 79 80 80 81 /** Manages different higher order operations on the view cells. … … 513 514 virtual void CompressViewCells(); 514 515 516 ViewCell *GetViewCellById(const int id); 517 518 /** Returns number of view cells. 519 */ 515 520 int GetNumViewCells() const; 516 521 517 ///////////////////////////// 522 bool GenerateRandomViewCells(ViewCellContainer &viewCells, 523 const int numViewCells); 524 525 bool GenerateRandomViewCells(vector<ViewCellPoints *> &viewCells, 526 const int nViewCells, 527 const int nViewPoints); 528 529 530 bool GenerateViewPoints(ViewCell *viewCell, 531 const int numViewPoints, 532 SimpleRayContainer &viewPoints); 533 534 bool ImportRandomViewCells(const string &filename, 535 vector<ViewCellPoints *> &viewCells); 536 537 538 bool ExportRandomViewCells(const string &filename, 539 const vector<ViewCellPoints *> &viewCells); 540 541 bool GenerateViewPoint(ViewCell *viewCell, SimpleRay &ray); 542 543 bool IsValidViewSpace(ViewCell *vc); 544 545 ////////////// 518 546 // static members 519 547 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r2005 r2017 660 660 if (mCurrentBspNode) // replace front or (if not NULL) back child 661 661 { 662 BspInterior *interior = dynamic_cast<BspInterior *>(mCurrentBspNode);662 BspInterior *interior = static_cast<BspInterior *>(mCurrentBspNode); 663 663 664 664 leaf = new BspLeaf(interior); … … 701 701 702 702 //ViewCellsMap::iterator vit = mViewCells.find(viewCellId); 703 // BspViewCell *viewCell = dynamic_cast<BspViewCell *>((*vit).second);704 BspViewCell *viewCell = dynamic_cast<BspViewCell *>(*vit);703 // BspViewCell *viewCell = static_cast<BspViewCell *>((*vit).second); 704 BspViewCell *viewCell = static_cast<BspViewCell *>(*vit); 705 705 if (viewCell->GetId() == viewCellId) 706 706 { … … 746 746 if (mCurrentBspNode) // replace NULL child of parent with current node 747 747 { 748 BspInterior *parent = dynamic_cast<BspInterior *>(mCurrentBspNode);748 BspInterior *parent = static_cast<BspInterior *>(mCurrentBspNode); 749 749 750 750 parent->ReplaceChildLink(NULL, interior); … … 825 825 { 826 826 ViewCellInterior *interior = 827 dynamic_cast<ViewCellInterior *>(mCurrentViewCell);827 static_cast<ViewCellInterior *>(mCurrentViewCell); 828 828 interior->SetupChildLink(viewCell); 829 829 } … … 1022 1022 if (mCurrentVspNode) // replace front or (if not NULL) back child 1023 1023 { 1024 VspInterior *interior = dynamic_cast<VspInterior *>(mCurrentVspNode);1024 VspInterior *interior = static_cast<VspInterior *>(mCurrentVspNode); 1025 1025 leaf = new VspLeaf(interior); 1026 1026 interior->ReplaceChildLink(NULL, leaf); … … 1065 1065 Debug << "error: view cell " << viewCellId << " not found" << endl; 1066 1066 1067 //VspViewCell *viewCell = dynamic_cast<VspViewCell *>((*vit).second);1068 VspViewCell *viewCell = dynamic_cast<VspViewCell *>(*vit);1067 //VspViewCell *viewCell = static_cast<VspViewCell *>((*vit).second); 1068 VspViewCell *viewCell = static_cast<VspViewCell *>(*vit); 1069 1069 1070 1070 if (viewCell->GetId() == viewCellId) … … 1109 1109 if (mCurrentVspNode) // replace NULL child of parent with current node 1110 1110 { 1111 VspInterior *parent = dynamic_cast<VspInterior *>(mCurrentVspNode);1111 VspInterior *parent = static_cast<VspInterior *>(mCurrentVspNode); 1112 1112 1113 1113 parent->ReplaceChildLink(NULL, interior); … … 1161 1161 if (mCurrentOspNode) // replace NULL child of parent with current node 1162 1162 { 1163 KdInterior *parent = dynamic_cast<KdInterior *>(mCurrentOspNode);1163 KdInterior *parent = static_cast<KdInterior *>(mCurrentOspNode); 1164 1164 parent->ReplaceChildLink(NULL, interior); 1165 1165 interior->mParent = parent; … … 1186 1186 void ViewCellsParseHandlers::StartOspLeaf(AttributeList& attributes) 1187 1187 { 1188 KdLeaf * leaf = new KdLeaf( dynamic_cast<KdInterior *>(mCurrentOspNode), NULL);1188 KdLeaf * leaf = new KdLeaf(static_cast<KdInterior *>(mCurrentOspNode), NULL); 1189 1189 1190 1190 if (mCurrentOspNode) 1191 1191 { 1192 1192 // replace front or (if not NULL) back child 1193 dynamic_cast<KdInterior *>(mCurrentOspNode)->ReplaceChildLink(NULL, leaf);1193 static_cast<KdInterior *>(mCurrentOspNode)->ReplaceChildLink(NULL, leaf); 1194 1194 } 1195 1195 else … … 1233 1233 if (mCurrentBvhNode) // replace front or (if not NULL) back child 1234 1234 { 1235 BvhInterior *interior = dynamic_cast<BvhInterior *>(mCurrentBvhNode);1235 BvhInterior *interior = static_cast<BvhInterior *>(mCurrentBvhNode); 1236 1236 leaf = new BvhLeaf(box, interior, (int)objects.size()); 1237 1237 interior->ReplaceChildLink(NULL, leaf); … … 1317 1317 if (mCurrentBvhNode) // replace NULL child of parent with current node 1318 1318 { 1319 BvhInterior *parent = dynamic_cast<BvhInterior *>(mCurrentBvhNode);1319 BvhInterior *parent = static_cast<BvhInterior *>(mCurrentBvhNode); 1320 1320 parent->ReplaceChildLink(NULL, interior); 1321 1321 interior->SetParent(parent); … … 1380 1380 } 1381 1381 1382 cout<<"parsing started"<<endl<<flush;1382 //cout<<"parsing started"<<endl<<flush; 1383 1383 1384 1384 // -
GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
r1960 r2017 202 202 if (!node->IsLeaf()) 203 203 { 204 BspInterior *interior = dynamic_cast<BspInterior *>(node);204 BspInterior *interior = static_cast<BspInterior *>(node); 205 205 206 206 BspNodeGeometry *front = new BspNodeGeometry(); … … 220 220 if (maxPvs) 221 221 { 222 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);222 BspLeaf *leaf = static_cast<BspLeaf *>(node); 223 223 224 224 mForcedMaterial.mDiffuseColor.b = 1.0f; … … 816 816 if (node->IsLeaf()) 817 817 { 818 ViewCell *vc = dynamic_cast<BspLeaf *>(node)->GetViewCell();818 ViewCell *vc = static_cast<BspLeaf *>(node)->GetViewCell(); 819 819 #if 0 820 820 // set the mesh material according to the ray density … … 990 990 else 991 991 { 992 BspInterior *interior = dynamic_cast<BspInterior *>(tData.mNode);992 BspInterior *interior = static_cast<BspInterior *>(tData.mNode); 993 993 994 994 // add current side of split plane … … 1107 1107 if (!node->IsLeaf()) 1108 1108 { 1109 BspInterior *interior = dynamic_cast<BspInterior *>(node);1109 BspInterior *interior = static_cast<BspInterior *>(node); 1110 1110 1111 1111 // bounded plane is added to the polygons -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r2015 r2017 273 273 case Intersectable::MESH_INSTANCE: 274 274 { 275 Mesh *mesh = dynamic_cast<MeshInstance *>(object)->GetMesh();275 Mesh *mesh = static_cast<MeshInstance *>(object)->GetMesh(); 276 276 AddMeshToPolygons(mesh, polys); 277 277 } … … 279 279 case Intersectable::VIEW_CELL: 280 280 { 281 Mesh *mesh = dynamic_cast<ViewCell *>(object)->GetMesh();281 Mesh *mesh = static_cast<ViewCell *>(object)->GetMesh(); 282 282 AddMeshToPolygons(mesh, polys); 283 283 break; … … 286 286 { 287 287 TransformedMeshInstance *mi = 288 dynamic_cast<TransformedMeshInstance *>(object);288 static_cast<TransformedMeshInstance *>(object); 289 289 290 290 Mesh mesh; … … 296 296 { 297 297 TriangleIntersectable *intersect = 298 dynamic_cast<TriangleIntersectable *>(object);298 static_cast<TriangleIntersectable *>(object); 299 299 300 300 Polygon3 *poly = new Polygon3(intersect->GetItem()); … … 762 762 763 763 Plane3 splitPlane; 764 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode);764 BspLeaf *leaf = static_cast<BspLeaf *>(tData.mNode); 765 765 766 766 // choose next split plane … … 817 817 if (newNode->IsLeaf()) 818 818 { 819 BspLeaf *leaf = dynamic_cast<BspLeaf *>(newNode);819 BspLeaf *leaf = static_cast<BspLeaf *>(newNode); 820 820 821 821 BspViewCell *viewCell = new BspViewCell(); … … 961 961 if (newNode->IsLeaf()) 962 962 { 963 BspLeaf *leaf = dynamic_cast<BspLeaf *>(newNode);963 BspLeaf *leaf = static_cast<BspLeaf *>(newNode); 964 964 965 965 BspViewCell *viewCell = new BspViewCell(); … … 1037 1037 VspBspTraversalData backData; 1038 1038 1039 BspLeaf *leaf = dynamic_cast<BspLeaf *>(splitCandidate.mParentData.mNode);1039 BspLeaf *leaf = static_cast<BspLeaf *>(splitCandidate.mParentData.mNode); 1040 1040 1041 1041 // compute locally best split plane … … 1109 1109 PolygonContainer &coincident) 1110 1110 { 1111 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode);1111 BspLeaf *leaf = static_cast<BspLeaf *>(tData.mNode); 1112 1112 1113 1113 //-- the front and back traversal data is filled with the new values … … 2205 2205 if (node->IsLeaf()) 2206 2206 { 2207 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);2207 BspLeaf *leaf = static_cast<BspLeaf *>(node); 2208 2208 2209 2209 if (!leaf->GetViewCell()->Mailed() && leaf->TreeValid()) … … 2215 2215 else 2216 2216 { 2217 BspInterior *interior = dynamic_cast<BspInterior *>(node);2217 BspInterior *interior = static_cast<BspInterior *>(node); 2218 2218 2219 2219 BspNode *first = interior->GetFront(); … … 2398 2398 { 2399 2399 // test if this leaf is in valid view space 2400 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);2400 BspLeaf *leaf = static_cast<BspLeaf *>(node); 2401 2401 if (leaf->TreeValid() && 2402 2402 (!onlyUnmailed || !leaf->Mailed()) && … … 2408 2408 else 2409 2409 { 2410 BspInterior *interior = dynamic_cast<BspInterior *>(node);2410 BspInterior *interior = static_cast<BspInterior *>(node); 2411 2411 2412 2412 nodeStack.push(interior->GetBack()); … … 2432 2432 { 2433 2433 // the node became a leaf -> evaluate stats for leafs 2434 BspLeaf *leaf = dynamic_cast<BspLeaf *>(data.mNode);2434 BspLeaf *leaf = static_cast<BspLeaf *>(data.mNode); 2435 2435 2436 2436 … … 2508 2508 if (!node->IsLeaf()) 2509 2509 { 2510 BspInterior *in = dynamic_cast<BspInterior *>(node);2510 BspInterior *in = static_cast<BspInterior *>(node); 2511 2511 2512 2512 Plane3 splitPlane = in->GetPlane(); … … 2550 2550 else // reached leaf => intersection with view cell 2551 2551 { 2552 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);2552 BspLeaf *leaf = static_cast<BspLeaf *>(node); 2553 2553 2554 2554 if (!leaf->GetViewCell()->Mailed()) … … 2612 2612 if (!onlyValid || node->TreeValid()) 2613 2613 { 2614 ViewCellLeaf *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell();2614 ViewCellLeaf *leafVc = static_cast<BspLeaf *>(node)->GetViewCell(); 2615 2615 2616 2616 ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leafVc); … … 2625 2625 else 2626 2626 { 2627 BspInterior *interior = dynamic_cast<BspInterior *>(node);2627 BspInterior *interior = static_cast<BspInterior *>(node); 2628 2628 2629 2629 nodeStack.push(interior->GetFront()); … … 2652 2652 if (node->IsLeaf()) 2653 2653 { 2654 BspViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->GetViewCell();2654 BspViewCell *viewCell = static_cast<BspLeaf *>(node)->GetViewCell(); 2655 2655 2656 2656 if (!viewCell->GetValid()) 2657 2657 { 2658 BspViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->GetViewCell();2658 BspViewCell *viewCell = static_cast<BspLeaf *>(node)->GetViewCell(); 2659 2659 2660 2660 ViewCellContainer leaves; … … 2665 2665 for (it = leaves.begin(); it != it_end; ++ it) 2666 2666 { 2667 BspLeaf *l = dynamic_cast<BspViewCell *>(*it)->mLeaf;2667 BspLeaf *l = static_cast<BspViewCell *>(*it)->mLeaf; 2668 2668 l->SetViewCell(GetOrCreateOutOfBoundsCell()); 2669 2669 ++ mBspStats.invalidLeaves; … … 2677 2677 else 2678 2678 { 2679 BspInterior *interior = dynamic_cast<BspInterior *>(node);2679 BspInterior *interior = static_cast<BspInterior *>(node); 2680 2680 2681 2681 nodeStack.push(interior->GetFront()); … … 2723 2723 if (node->IsLeaf()) 2724 2724 { 2725 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);2725 BspLeaf *leaf = static_cast<BspLeaf *>(node); 2726 2726 2727 2727 if (!leaf->GetViewCell()->GetValid()) … … 2737 2737 else 2738 2738 { 2739 BspInterior *interior = dynamic_cast<BspInterior *>(node);2739 BspInterior *interior = static_cast<BspInterior *>(node); 2740 2740 2741 2741 nodeStack.push(interior->GetFront()); … … 2880 2880 if (n) 2881 2881 { 2882 BspInterior *interior = dynamic_cast<BspInterior *>(n);2883 Plane3 halfSpace = dynamic_cast<BspInterior *>(interior)->GetPlane();2882 BspInterior *interior = static_cast<BspInterior *>(n); 2883 Plane3 halfSpace = static_cast<BspInterior *>(interior)->GetPlane(); 2884 2884 2885 2885 if (interior->GetBack() != lastNode) … … 3023 3023 continue; 3024 3024 3025 BspViewCell *bspVc = dynamic_cast<BspViewCell *>(*it);3025 BspViewCell *bspVc = static_cast<BspViewCell *>(*it); 3026 3026 vector<BspLeaf *>::const_iterator bit, bit_end = bspVc->mLeaves.end(); 3027 3027 … … 3110 3110 if (isAdjacent) 3111 3111 { 3112 neighbors.push_back( dynamic_cast<BspLeaf *>(node));3112 neighbors.push_back(static_cast<BspLeaf *>(node)); 3113 3113 } 3114 3114 } … … 3116 3116 else 3117 3117 { 3118 BspInterior *interior = dynamic_cast<BspInterior *>(node);3118 BspInterior *interior = static_cast<BspInterior *>(node); 3119 3119 3120 3120 const int cf = Polygon3::ClassifyPlane(nodeGeom.GetPolys(), … … 3204 3204 if (isAdjacent) 3205 3205 { 3206 neighbors.push_back( dynamic_cast<BspLeaf *>(node));3206 neighbors.push_back(static_cast<BspLeaf *>(node)); 3207 3207 } 3208 3208 } … … 3210 3210 else 3211 3211 { 3212 BspInterior *interior = dynamic_cast<BspInterior *>(node);3212 BspInterior *interior = static_cast<BspInterior *>(node); 3213 3213 3214 3214 const int cf = Polygon3::ClassifyPlane(nodeGeom.GetPolys(), … … 3271 3271 if (node->IsLeaf()) 3272 3272 { 3273 return dynamic_cast<BspLeaf *>(node);3273 return static_cast<BspLeaf *>(node); 3274 3274 } 3275 3275 else 3276 3276 { 3277 BspInterior *interior = dynamic_cast<BspInterior *>(node);3277 BspInterior *interior = static_cast<BspInterior *>(node); 3278 3278 BspNode *next; 3279 3279 BspNodeGeometry geom; … … 3324 3324 { 3325 3325 if ( (!onlyUnmailed || !node->Mailed()) ) 3326 return dynamic_cast<BspLeaf *>(node);3326 return static_cast<BspLeaf *>(node); 3327 3327 } 3328 3328 else 3329 3329 { 3330 BspInterior *interior = dynamic_cast<BspInterior *>(node);3330 BspInterior *interior = static_cast<BspInterior *>(node); 3331 3331 3332 3332 // random decision … … 3452 3452 if (!node->IsLeaf()) 3453 3453 { 3454 BspInterior *in = dynamic_cast<BspInterior *>(node);3454 BspInterior *in = static_cast<BspInterior *>(node); 3455 3455 3456 3456 Plane3 splitPlane = in->GetPlane(); … … 3499 3499 { 3500 3500 // reached leaf => intersection with view cell 3501 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);3501 BspLeaf *leaf = static_cast<BspLeaf *>(node); 3502 3502 ViewCell *viewCell; 3503 3503 … … 3577 3577 return node; 3578 3578 3579 BspInterior *interior = dynamic_cast<BspInterior *>(node);3579 BspInterior *interior = static_cast<BspInterior *>(node); 3580 3580 3581 3581 BspNode *front = CollapseTree(interior->GetFront(), collapsed); … … 3584 3584 if (front->IsLeaf() && back->IsLeaf()) 3585 3585 { 3586 BspLeaf *frontLeaf = dynamic_cast<BspLeaf *>(front);3587 BspLeaf *backLeaf = dynamic_cast<BspLeaf *>(back);3586 BspLeaf *frontLeaf = static_cast<BspLeaf *>(front); 3587 BspLeaf *backLeaf = static_cast<BspLeaf *>(back); 3588 3588 3589 3589 //-- collapse tree … … 3643 3643 if (node->IsLeaf()) 3644 3644 { 3645 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);3645 BspLeaf *leaf = static_cast<BspLeaf *>(node); 3646 3646 3647 3647 BspViewCell *viewCell = leaf->GetViewCell(); … … 3658 3658 else 3659 3659 { 3660 BspInterior *interior = dynamic_cast<BspInterior *>(node);3660 BspInterior *interior = static_cast<BspInterior *>(node); 3661 3661 3662 3662 nodeStack.push(interior->GetFront()); … … 3699 3699 if (node->IsLeaf()) 3700 3700 { 3701 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);3701 BspLeaf *leaf = static_cast<BspLeaf *>(node); 3702 3702 3703 3703 if (!leaf->GetViewCell()->Mailed() && leaf->TreeValid()) … … 3709 3709 else 3710 3710 { 3711 BspInterior *interior = dynamic_cast<BspInterior *>(node);3711 BspInterior *interior = static_cast<BspInterior *>(node); 3712 3712 3713 3713 BspNode *first = interior->GetFront(); … … 3837 3837 3838 3838 iit = ray->mViewCells.begin(); 3839 BspViewCell *bspVc = dynamic_cast<BspViewCell *>(*(iit ++));3839 BspViewCell *bspVc = static_cast<BspViewCell *>(*(iit ++)); 3840 3840 BspLeaf *leaf = bspVc->mLeaves[0]; 3841 3841 … … 3846 3846 // next pair 3847 3847 BspLeaf *prevLeaf = leaf; 3848 bspVc = dynamic_cast<BspViewCell *>(*iit);3848 bspVc = static_cast<BspViewCell *>(*iit); 3849 3849 leaf = bspVc->mLeaves[0]; // exactly one leaf 3850 3850 … … 3929 3929 if (node->IsLeaf()) 3930 3930 { 3931 viewcell = dynamic_cast<BspLeaf *>(node)->GetViewCell();3931 viewcell = static_cast<BspLeaf *>(node)->GetViewCell(); 3932 3932 break; 3933 3933 } 3934 3934 else 3935 3935 { 3936 BspInterior *interior = dynamic_cast<BspInterior *>(node);3936 BspInterior *interior = static_cast<BspInterior *>(node); 3937 3937 3938 3938 // random decision … … 3964 3964 return false; 3965 3965 3966 BspInterior *in = dynamic_cast<BspInterior *>(node);3966 BspInterior *in = static_cast<BspInterior *>(node); 3967 3967 3968 3968 if (in->GetPlane().Side(viewPoint) <= 0) … … 4000 4000 { 4001 4001 node = node->GetParent(); 4002 BspInterior *interior = dynamic_cast<BspInterior *>(node);4002 BspInterior *interior = static_cast<BspInterior *>(node); 4003 4003 4004 4004 // the parent is valid iff both leaves are valid … … 4021 4021 if (node->IsLeaf()) 4022 4022 { 4023 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);4023 BspLeaf *leaf = static_cast<BspLeaf *>(node); 4024 4024 ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 4025 4025 … … 4032 4032 else 4033 4033 { 4034 BspInterior *interior = dynamic_cast<BspInterior *>(node);4034 BspInterior *interior = static_cast<BspInterior *>(node); 4035 4035 4036 4036 Plane3 plane = interior->GetPlane(); -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r2015 r2017 268 268 269 269 270 271 270 bool VspInterior::IsLeaf() const 271 { 272 return false; 273 } 274 275 276 VspNode *VspInterior::GetBack() 277 { 278 return mBack; 279 } 280 281 282 VspNode *VspInterior::GetFront() 283 { 284 return mFront; 285 } 286 287 288 AxisAlignedPlane VspInterior::GetPlane() const 289 { 290 return mPlane; 291 } 292 293 294 float VspInterior::GetPosition() const 295 { 296 return mPlane.mPosition; 297 } 298 299 300 int VspInterior::GetAxis() const 301 { 302 return mPlane.mAxis; 303 } 272 304 273 305 … … 356 388 357 389 390 ViewCellLeaf *VspLeaf::GetViewCell() const 391 { 392 return mViewCell; 393 } 358 394 359 395 … … 364 400 365 401 402 bool VspLeaf::IsLeaf() const 403 { 404 return true; 405 } 366 406 367 407 … … 665 705 // todo remove dynamic cast 666 706 VspSubdivisionCandidate *sc = 667 dynamic_cast<VspSubdivisionCandidate *>(splitCandidate);707 static_cast<VspSubdivisionCandidate *>(splitCandidate); 668 708 669 709 VspTraversalData &tData = sc->mParentData; … … 718 758 if (newNode->IsLeaf()) // subdivision terminated 719 759 { 720 VspLeaf *leaf = dynamic_cast<VspLeaf *>(newNode);760 VspLeaf *leaf = static_cast<VspLeaf *>(newNode); 721 761 722 762 #if 0 … … 787 827 } 788 828 789 VspLeaf *leaf = dynamic_cast<VspLeaf *>(splitCandidate.mParentData.mNode);829 VspLeaf *leaf = static_cast<VspLeaf *>(splitCandidate.mParentData.mNode); 790 830 791 831 ///////////// … … 882 922 VspTraversalData &backData) 883 923 { 884 VspLeaf *leaf = dynamic_cast<VspLeaf *>(sc.mParentData.mNode);924 VspLeaf *leaf = static_cast<VspLeaf *>(sc.mParentData.mNode); 885 925 886 926 const VspTraversalData &tData = sc.mParentData; … … 1441 1481 if (parent) 1442 1482 { 1443 parentAxis = dynamic_cast<VspInterior *>(parent)->GetAxis();1483 parentAxis = static_cast<VspInterior *>(parent)->GetAxis(); 1444 1484 } 1445 1485 … … 1816 1856 { 1817 1857 // test if this leaf is in valid view space 1818 VspLeaf *leaf = dynamic_cast<VspLeaf *>(node);1858 VspLeaf *leaf = static_cast<VspLeaf *>(node); 1819 1859 1820 1860 if (leaf->TreeValid() && … … 1827 1867 else 1828 1868 { 1829 VspInterior *interior = dynamic_cast<VspInterior *>(node);1869 VspInterior *interior = static_cast<VspInterior *>(node); 1830 1870 1831 1871 nodeStack.push(interior->GetBack()); … … 1851 1891 { 1852 1892 // the node became a leaf -> evaluate stats for leafs 1853 VspLeaf *leaf = dynamic_cast<VspLeaf *>(data.mNode);1893 VspLeaf *leaf = static_cast<VspLeaf *>(data.mNode); 1854 1894 1855 1895 if (data.mPvs > mVspStats.maxPvs) … … 1926 1966 if (node->IsLeaf()) 1927 1967 { 1928 BspViewCell *viewCell = dynamic_cast<VspLeaf *>(node)->GetViewCell();1968 BspViewCell *viewCell = static_cast<VspLeaf *>(node)->GetViewCell(); 1929 1969 1930 1970 if (!viewCell->GetValid()) 1931 1971 { 1932 BspViewCell *viewCell = dynamic_cast<VspLeaf *>(node)->GetViewCell();1972 BspViewCell *viewCell = static_cast<VspLeaf *>(node)->GetViewCell(); 1933 1973 1934 1974 ViewCellContainer leaves; … … 1939 1979 for (it = leaves.begin(); it != it_end; ++ it) 1940 1980 { 1941 VspLeaf *l = dynamic_cast<BspViewCell *>(*it)->mLeaf;1981 VspLeaf *l = static_cast<BspViewCell *>(*it)->mLeaf; 1942 1982 l->SetViewCell(GetOrCreateOutOfBoundsCell()); 1943 1983 ++ mVspStats.invalidLeaves; … … 1952 1992 else 1953 1993 { 1954 VspInterior *interior = dynamic_cast<VspInterior *>(node);1994 VspInterior *interior = static_cast<VspInterior *>(node); 1955 1995 1956 1996 nodeStack.push(interior->GetFront()); … … 2005 2045 if (node->IsLeaf()) 2006 2046 { 2007 VspLeaf *leaf = dynamic_cast<VspLeaf *>(node);2047 VspLeaf *leaf = static_cast<VspLeaf *>(node); 2008 2048 2009 2049 if (!leaf->GetViewCell()->GetValid()) … … 2019 2059 else 2020 2060 { 2021 VspInterior *interior = dynamic_cast<VspInterior *>(node);2061 VspInterior *interior = static_cast<VspInterior *>(node); 2022 2062 2023 2063 nodeStack.push(interior->GetFront()); … … 2051 2091 if (!onlyValid || node->TreeValid()) 2052 2092 { 2053 ViewCellLeaf *leafVc = dynamic_cast<VspLeaf *>(node)->GetViewCell();2093 ViewCellLeaf *leafVc = static_cast<VspLeaf *>(node)->GetViewCell(); 2054 2094 2055 2095 ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leafVc); … … 2064 2104 else 2065 2105 { 2066 VspInterior *interior = dynamic_cast<VspInterior *>(node);2106 VspInterior *interior = static_cast<VspInterior *>(node); 2067 2107 2068 2108 nodeStack.push(interior->GetFront()); … … 2089 2129 if (node->IsLeaf()) 2090 2130 { 2091 VspLeaf *leaf = dynamic_cast<VspLeaf *>(node);2131 VspLeaf *leaf = static_cast<VspLeaf *>(node); 2092 2132 2093 2133 if (leaf != n && (!onlyUnmailed || !leaf->Mailed())) … … 2096 2136 else 2097 2137 { 2098 VspInterior *interior = dynamic_cast<VspInterior *>(node);2138 VspInterior *interior = static_cast<VspInterior *>(node); 2099 2139 2100 2140 if (interior->GetPosition() > box.Max(interior->GetAxis())) … … 2134 2174 if (node->IsLeaf()) 2135 2175 { 2136 return dynamic_cast<VspLeaf *>(node);2176 return static_cast<VspLeaf *>(node); 2137 2177 } 2138 2178 else 2139 2179 { 2140 VspInterior *interior = dynamic_cast<VspInterior *>(node);2180 VspInterior *interior = static_cast<VspInterior *>(node); 2141 2181 VspNode *next; 2142 2182 … … 2186 2226 { 2187 2227 if ( (!onlyUnmailed || !node->Mailed()) ) 2188 return dynamic_cast<VspLeaf *>(node);2228 return static_cast<VspLeaf *>(node); 2189 2229 } 2190 2230 else 2191 2231 { 2192 VspInterior *interior = dynamic_cast<VspInterior *>(node);2232 VspInterior *interior = static_cast<VspInterior *>(node); 2193 2233 2194 2234 // random decision … … 2336 2376 int axis; 2337 2377 2338 ViewCell::NewMail();2339 2340 2378 while (1) 2341 2379 { 2342 2380 if (!node->IsLeaf()) 2343 2381 { 2344 VspInterior *in = (VspInterior *)node;2382 VspInterior *in = static_cast<VspInterior *>(node); 2345 2383 position = in->GetPosition(); 2346 2384 axis = in->GetAxis(); … … 2387 2425 { 2388 2426 // compute intersection with all objects in this leaf 2389 VspLeaf *leaf = (VspLeaf *)node;2427 VspLeaf *leaf = static_cast<VspLeaf *>(node); 2390 2428 ViewCell *viewCell; 2391 // if (0) 2392 // viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 2393 // else 2394 2395 viewCell = leaf->GetViewCell(); 2396 2429 if (0) 2430 viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 2431 else 2432 viewCell = leaf->GetViewCell(); 2433 2397 2434 // don't have to mail if each view cell belongs to exactly one leaf 2398 // $$ JB -> always mailbox so that we have less conditions 2399 if (!viewCell->Mailed()) { 2400 viewCell->Mail(); 2401 2402 viewcells.push_back(viewCell); 2403 ++ hits; 2404 } 2405 2435 if (!useMailboxing || !viewCell->Mailed()) 2436 { 2437 if (useMailboxing) 2438 viewCell->Mail(); 2439 2440 viewcells.push_back(viewCell); 2441 ++ hits; 2442 } 2443 2406 2444 // get the next node from the stack 2407 2445 if (tStack.empty()) 2408 2409 2446 break; 2447 2410 2448 entp = extp; 2411 2449 mint = maxt; … … 2454 2492 if (!node->IsLeaf()) 2455 2493 { 2456 VspInterior *in = dynamic_cast<VspInterior *>(node);2494 VspInterior *in = static_cast<VspInterior *>(node); 2457 2495 position = in->GetPosition(); 2458 2496 axis = in->GetAxis(); … … 2499 2537 { 2500 2538 // compute intersection with all objects in this leaf 2501 VspLeaf *leaf = dynamic_cast<VspLeaf *>(node);2539 VspLeaf *leaf = static_cast<VspLeaf *>(node); 2502 2540 ViewCell *vc = leaf->GetViewCell(); 2503 2541 … … 2545 2583 if (node->IsLeaf()) 2546 2584 { 2547 /*const AxisAlignedBox3 box = GetBoundingBox( dynamic_cast<VspLeaf *>(node));2585 /*const AxisAlignedBox3 box = GetBoundingBox(static_cast<VspLeaf *>(node)); 2548 2586 if (!box.IsInside(point)) 2549 2587 cerr << "error, point " << point << " should be in view cell " << box << endl; 2550 2588 */ 2551 viewcell = dynamic_cast<VspLeaf *>(node)->GetViewCell();2589 viewcell = static_cast<VspLeaf *>(node)->GetViewCell(); 2552 2590 break; 2553 2591 } 2554 2592 else 2555 2593 { 2556 VspInterior *interior = dynamic_cast<VspInterior *>(node);2594 VspInterior *interior = static_cast<VspInterior *>(node); 2557 2595 2558 2596 // random decision … … 2592 2630 return false; 2593 2631 2594 VspInterior *in = dynamic_cast<VspInterior *>(node);2632 VspInterior *in = static_cast<VspInterior *>(node); 2595 2633 2596 2634 if (in->GetPosition() - viewPoint[in->GetAxis()] <= 0) … … 2628 2666 { 2629 2667 node = node->GetParent(); 2630 VspInterior *interior = dynamic_cast<VspInterior *>(node);2668 VspInterior *interior = static_cast<VspInterior *>(node); 2631 2669 2632 2670 // the parent is valid iff both leaves are valid … … 2650 2688 if (node->IsLeaf()) 2651 2689 { 2652 VspLeaf *leaf = dynamic_cast<VspLeaf *>(node);2690 VspLeaf *leaf = static_cast<VspLeaf *>(node); 2653 2691 ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 2654 2692 … … 2661 2699 else 2662 2700 { 2663 VspInterior *interior = dynamic_cast<VspInterior *>(node);2701 VspInterior *interior = static_cast<VspInterior *>(node); 2664 2702 2665 2703 AxisAlignedPlane plane = interior->GetPlane(); … … 2731 2769 if (!node->IsLeaf()) 2732 2770 { 2733 return ( dynamic_cast<VspInterior *>(node))->GetBoundingBox();2734 } 2735 2736 VspInterior *parent = dynamic_cast<VspInterior *>(node->GetParent());2771 return (static_cast<VspInterior *>(node))->GetBoundingBox(); 2772 } 2773 2774 VspInterior *parent = static_cast<VspInterior *>(node->GetParent()); 2737 2775 2738 2776 AxisAlignedBox3 box(parent->GetBoundingBox()); … … 2766 2804 if (node->IsLeaf()) 2767 2805 { 2768 VspLeaf *leaf = dynamic_cast<VspLeaf *>(node);2806 VspLeaf *leaf = static_cast<VspLeaf *>(node); 2769 2807 2770 2808 if (!leaf->GetViewCell()->Mailed() && leaf->TreeValid()) … … 2776 2814 else 2777 2815 { 2778 VspInterior *interior = dynamic_cast<VspInterior *>(node);2816 VspInterior *interior = static_cast<VspInterior *>(node); 2779 2817 2780 2818 VspNode *first = interior->GetFront(); … … 2887 2925 2888 2926 // root and bounding box were already constructed 2889 VspLeaf *leaf = dynamic_cast<VspLeaf *>(mRoot);2927 VspLeaf *leaf = static_cast<VspLeaf *>(mRoot); 2890 2928 2891 2929 ////////// … … 3304 3342 { 3305 3343 // todo remove dynamic cast 3306 VspSubdivisionCandidate *sc = dynamic_cast<VspSubdivisionCandidate *>(splitCandidate);3344 VspSubdivisionCandidate *sc = static_cast<VspSubdivisionCandidate *>(splitCandidate); 3307 3345 3308 3346 VspTraversalData &tData = sc->mParentData; … … 3318 3356 VspTraversalData tBackData; 3319 3357 3320 VspInterior *oldInterior = dynamic_cast<VspInterior *>(oldNode);3358 VspInterior *oldInterior = static_cast<VspInterior *>(oldNode); 3321 3359 3322 3360 // create new interior node and two leaf node … … 3387 3425 { 3388 3426 const ObjectPvsEntry &entry = oit.Next(); 3389 BvhNode *obj = dynamic_cast<BvhNode *>(entry.mObject);3427 BvhNode *obj = static_cast<BvhNode *>(entry.mObject); 3390 3428 3391 3429 if (!obj->IsRoot()) … … 3416 3454 { 3417 3455 const ObjectPvsEntry &entry = oit.Next(); 3418 BvhNode *obj = dynamic_cast<BvhNode *>(entry.mObject);3456 BvhNode *obj = static_cast<BvhNode *>(entry.mObject); 3419 3457 3420 3458 if (!obj->IsRoot()) … … 3486 3524 if (!node->IsLeaf()) 3487 3525 { 3488 VspInterior *in = dynamic_cast<VspInterior *>(node);3526 VspInterior *in = static_cast<VspInterior *>(node); 3489 3527 position = in->GetPosition(); 3490 3528 axis = in->GetAxis(); … … 3531 3569 { 3532 3570 // compute intersection with all objects in this leaf 3533 VspLeaf *leaf = dynamic_cast<VspLeaf *>(node);3571 VspLeaf *leaf = static_cast<VspLeaf *>(node); 3534 3572 ViewCell *viewCell; 3535 3573 if (0) -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
r1707 r2017 225 225 if (!node->IsLeaf()) 226 226 { 227 BspInterior *interior = dynamic_cast<BspInterior *>(node);227 BspInterior *interior = static_cast<BspInterior *>(node); 228 228 229 229 BspNodeGeometry *front = new BspNodeGeometry(); … … 243 243 if (maxPvs) 244 244 { 245 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);245 BspLeaf *leaf = static_cast<BspLeaf *>(node); 246 246 247 247 mForcedMaterial.mDiffuseColor.b = 1.0f; … … 584 584 SetFilled(); 585 585 SetForcedMaterial(RandomMaterial()); 586 ExportGeometry( dynamic_cast<KdLeaf *>(node)->mObjects);586 ExportGeometry(static_cast<KdLeaf *>(node)->mObjects); 587 587 SetWireframe(); 588 588 } … … 764 764 if (node->IsLeaf()) 765 765 { 766 ViewCell *vc = dynamic_cast<BspLeaf *>(node)->GetViewCell();766 ViewCell *vc = static_cast<BspLeaf *>(node)->GetViewCell(); 767 767 #if 0 768 768 // set the mesh material according to the ray density … … 918 918 else 919 919 { 920 BspInterior *interior = dynamic_cast<BspInterior *>(tData.mNode);920 BspInterior *interior = static_cast<BspInterior *>(tData.mNode); 921 921 922 922 // add current side of split plane … … 1035 1035 if (!node->IsLeaf()) 1036 1036 { 1037 BspInterior *interior = dynamic_cast<BspInterior *>(node);1037 BspInterior *interior = static_cast<BspInterior *>(node); 1038 1038 1039 1039 // bounded plane is added to the polygons -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2008 r2017 220 220 } 221 221 222 223 222 //////////// 224 223 //-- initialize external ray caster … … 269 268 exit(1); 270 269 } 271 270 271 const string viewCellsFile = ReplaceSuffix(filename, ".obj", ".vc"); 272 const int numViewCells = 2; 273 const int numViewPoints = 2; 272 274 273 275 bool useHwGlobalLines; … … 357 359 } 358 360 361 /* vector<ViewCellPoints *> myViewCells; 362 363 preprocessor->mViewCellsManager->GenerateRandomViewCells(myViewCells, numViewCells, numViewPoints); 364 cout << "exporting random view cells" << endl; 365 preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellsFile, myViewCells); 366 367 //preprocessor->mViewCellsManager->ImportRandomViewCells(viewCellsFile, myViewCells); 368 CLEAR_CONTAINER(myViewCells); 369 */ 359 370 qApp->exec(); 360 371 #endif … … 381 392 // release memory 382 393 Cleanup(); 394 383 395 delete pt; 384 396
Note: See TracChangeset
for help on using the changeset viewer.