Changeset 726 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 04/04/06 23:55:38 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj
r722 r726 65 65 <Tool 66 66 Name="VCCLCompilerTool" 67 InlineFunctionExpansion="2" 68 FavorSizeOrSpeed="1" 69 OptimizeForWindowsApplication="TRUE" 67 70 AdditionalIncludeDirectories="..\support;..\support\devil\include;..\support\zlib\include;..\include;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\src;"$(CG_INC_PATH)";..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces" 68 71 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;" -
GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp
r704 r726 156 156 157 157 currentMesh->AddFace(face); 158 if (meshGrouping != 0 && 159 currentMesh->mFaces.size() >= meshGrouping) { 158 if (meshGrouping != 0 && currentMesh->mFaces.size() >= meshGrouping) { 160 159 if (ROTATE_SCENE) 161 160 RotateMesh(currentMesh); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r719 r726 2441 2441 { 2442 2442 geom.Add(candidatePolys[i], candidatePlanes[i]); 2443 // geom.mPolys.push_back(candidates[i]);2444 2443 } 2445 2444 } … … 2456 2455 2457 2456 2458 int BspTree::FindNeighbors(BspNode *n, vector<BspLeaf *>2459 &neighbors,2457 int BspTree::FindNeighbors(BspNode *n, 2458 vector<BspLeaf *> &neighbors, 2460 2459 const bool onlyUnmailed) const 2461 2460 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r722 r726 2104 2104 { 2105 2105 exporter->ExportMesh(vc->GetMesh()); 2106 2106 2107 return; 2107 2108 } 2108 2109 2110 2111 if (clipPlane) 2112 { 2113 ViewCellContainer leaves; 2114 mViewCellsTree->CollectLeaves(vc, leaves); 2115 ViewCellContainer::const_iterator it, it_end = leaves.end(); 2116 2117 for (it = leaves.begin(); it != it_end; ++ it) 2118 { 2119 BspNodeGeometry geom; 2120 2121 BspNodeGeometry front; 2122 BspNodeGeometry back; 2123 2124 BspLeaf *leaf = dynamic_cast<BspViewCell *>(*it)->mLeaf; 2125 mBspTree->ConstructGeometry(leaf, geom); 2126 2127 const float eps = 0.00000001f; 2128 const int cf = geom.Side(*clipPlane, eps); 2129 2130 if (cf == -1) 2131 { 2132 exporter->ExportPolygons(geom.GetPolys()); 2133 } 2134 else if (cf == 0) 2135 { 2136 geom.SplitGeometry(front, 2137 back, 2138 *clipPlane, 2139 mViewSpaceBox, 2140 eps); 2141 2142 //Debug << "geo size: " << geom.Size() << endl; 2143 //Debug << "size b: " << back.Size() << " f: " << front.Size() << endl; 2144 if (back.Valid()) 2145 { 2146 exporter->ExportPolygons(back.GetPolys()); 2147 } 2148 } 2149 } 2150 } 2151 else 2152 { 2153 BspNodeGeometry geom; 2154 mBspTree->ConstructGeometry(vc, geom); 2155 2156 exporter->ExportPolygons(geom.GetPolys()); 2157 } 2158 } 2159 2160 2161 void BspViewCellsManager::CreateMesh(ViewCell *vc) 2162 { 2163 // delete previous mesh 2164 ///DEL_PTR(vc->GetMesh()); 2109 2165 BspNodeGeometry geom; 2110 2166 mBspTree->ConstructGeometry(vc, geom); 2111 2167 2112 if (clipPlane)2113 {2114 const int cf = Polygon3::ClassifyPlane(geom.GetPolys(), *clipPlane, 0.0001f);2115 2116 if (cf == Polygon3::BACK_SIDE)2117 {2118 exporter->ExportPolygons(geom.GetPolys());2119 }2120 else if (cf == Polygon3::SPLIT)2121 {2122 BspNodeGeometry front;2123 BspNodeGeometry back;2124 2125 geom.SplitGeometry(front,2126 back,2127 *clipPlane,2128 mViewSpaceBox,2129 0.0001f);2130 2131 if (back.Valid())2132 exporter->ExportPolygons(back.GetPolys());2133 }2134 }2135 else2136 {2137 exporter->ExportPolygons(geom.GetPolys());2138 }2139 }2140 2141 2142 void BspViewCellsManager::CreateMesh(ViewCell *vc)2143 {2144 if (vc->GetMesh())2145 delete vc->GetMesh();2146 2147 BspNodeGeometry geom;2148 2149 mBspTree->ConstructGeometry(vc, geom);2150 2151 2168 Mesh *mesh = new Mesh(); 2169 2152 2170 geom.AddToMesh(*mesh); 2153 2171 vc->SetMesh(mesh); 2172 // put mesh into mesh container so we can savely delete it 2154 2173 mMeshContainer.push_back(mesh); 2155 2174 } … … 2785 2804 } 2786 2805 2806 2787 2807 void VspKdViewCellsManager::Visualize(const ObjectContainer &objects, 2788 2808 const VssRayContainer &sampleRays) … … 2882 2902 Exporter *exporter = Exporter::GetExporter("vspkdtree_merged.x3d"); 2883 2903 2884 //if (exportGeometry) exporter->SetWireframe();2885 //else exporter->SetFilled();2886 2904 2887 2905 ExportViewCellsForViz(exporter); … … 4000 4018 void VspBspViewCellsManager::CreateMesh(ViewCell *vc) 4001 4019 { 4002 if (vc->GetMesh()) 4003 delete vc->GetMesh(); 4004 4005 4020 //if (vc->GetMesh()) delete vc->GetMesh(); 4006 4021 BspNodeGeometry geom; 4007 4022 … … 4011 4026 geom.AddToMesh(*mesh); 4012 4027 vc->SetMesh(mesh); 4028 // put mesh into mesh container so we can savely delete it 4013 4029 mMeshContainer.push_back(mesh); 4014 4030 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r719 r726 458 458 459 459 EvalPriority(tData); 460 461 462 if (mSimulateOctree) 463 tData.mAxis = 0; 460 464 461 465 462 // first node is kd node, i.e. an axis aligned box … … 569 566 geom); 570 567 571 572 568 573 569 // compute first split candidate … … 695 691 VspBspTraversalData tBackData; 696 692 697 if (mSimulateOctree)698 { // choose axes in circular motion699 tFrontData.mAxis = (tData.mAxis + 1) % 3;700 tBackData.mAxis = (tData.mAxis + 1) % 3;701 }702 703 693 // create new interior node and two leaf nodes 704 694 // or return leaf as it is (if maxCostRatio missed) … … 709 699 Plane3 splitPlane; 710 700 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode); 711 701 702 // choose next split plane 712 703 if (!SelectPlane(splitPlane, leaf, tData, tFrontData, tBackData, splitAxis)) 713 704 { … … 722 713 } 723 714 715 // if this a valid split => subdivide this node further 724 716 if (splitFurther) //-- continue subdivision 725 717 { … … 732 724 733 725 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && (splitAxis < 3)); 726 tFrontData.mAxis = tBackData.mAxis = splitAxis; 734 727 735 728 // how often was max cost ratio missed in this branch? … … 740 733 EvalPriority(tBackData); 741 734 735 // evaluate subdivision stats 742 736 if (1) 743 737 { 744 745 738 float cFront = (float)tFrontData.mPvs * tFrontData.mProbability; 746 739 float cBack = (float)tBackData.mPvs * tBackData.mProbability; … … 823 816 } 824 817 825 818 // subdivide using a split plane queue 826 819 BspNode *VspBspTree::Subdivide(VspBspSplitQueue &tQueue, 827 820 VspBspSplitCandidate &splitCandidate) … … 839 832 840 833 //-- continue subdivision 834 841 835 // create new interior node and two leaf node 842 836 const Plane3 splitPlane = splitCandidate.mSplitPlane; … … 853 847 854 848 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && (splitAxis < 3)); 855 849 tFrontData.mAxis = tBackData.mAxis = splitAxis; 850 856 851 // how often was max cost ratio missed in this branch? 857 852 tFrontData.mMaxCostMisses = maxCostMisses; … … 960 955 961 956 // compute locally best split plane 962 957 bool success = SelectPlane(splitData.mSplitPlane, leaf, tData, 963 958 frontData, backData, splitData.mSplitAxis); 964 959 … … 1403 1398 sAxis = Random(3); 1404 1399 else if (mSimulateOctree) 1405 sAxis = tData.mAxis;1400 sAxis = (tData.mAxis + 1) % 3; 1406 1401 1407 1402 //Debug << "use special axis: " << useSpecialAxis << endl; … … 2012 2007 2013 2008 const int pvsSize = data.mPvs; 2014 //cout << "here433" << endl; 2009 2015 2010 RayInfoContainer::const_iterator rit, rit_end = data.mRays->end(); 2016 2011 -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
r712 r726 1145 1145 for (oit = objects.begin(); oit != oit_end; ++ oit) 1146 1146 { 1147 if (1) 1148 { 1147 if (0) 1149 1148 SetForcedMaterial(RandomMaterial()); 1150 } 1151 1149 1152 1150 ExportIntersectable(*oit); 1153 1151 } -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
r712 r726 57 57 58 58 59 static void RotateMesh(Mesh *mesh) 60 { 61 VertexContainer::iterator it, it_end = mesh->mVertices.end(); 62 63 const float angle = 30.0f * PI / 180.0f; 64 const Matrix4x4 rot = RotationYMatrix(angle); 65 66 for (it = mesh->mVertices.begin(); it != it_end; ++ it) 67 { 68 (*it) = rot * (*it); 69 } 70 } 59 71 60 72 // --------------------------------------------------------------------------- … … 96 108 97 109 98 static void RotateMesh(Mesh *mesh)99 {100 VertexContainer::iterator it, it_end = mesh->mVertices.end();101 102 const float angle = 30.0f * PI / 180.0f;103 const Matrix4x4 rot = RotationYMatrix(angle);104 105 for (it = mesh->mVertices.begin(); it != it_end; ++ it)106 {107 (*it) = rot * (*it);108 }109 }110 110 111 111
Note: See TracChangeset
for help on using the changeset viewer.