Changeset 2643 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 02/21/08 18:10:24 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BoundingBoxConverter.h
r2111 r2643 1 1 #ifndef _BoundingBoxConverter_H__ 2 2 #define _BoundingBoxConverter_H__ 3 4 3 5 #include <vector> 4 6 #include "AxisAlignedBox3.h" -
GTP/trunk/Lib/Vis/Preprocessing/src/Camera.h
r2629 r2643 4 4 #include "Vector3.h" 5 5 #include "AxisAlignedBox3.h" 6 #include "ktbconf.h" 6 7 7 8 8 namespace GtpVisibilityPreprocessor { -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2638 r2643 85 85 //mUseVbos(true), 86 86 mUseVbos(false), 87 mComputeGVS(false), 87 88 mCurrentFrame(-1) 88 89 { … … 101 102 // mViewDirection = Vector3(0.433884, 0, -0.900969); 102 103 104 //mViewPoint = Vector3(1213.85, 176.988, -437.364); 105 //mViewDirection = Vector3(0.433884, 0, -0.900969); 106 107 mViewPoint = Vector3(32.8596, 9.86079, -1023.79); 108 mViewDirection = Vector3(-0.92196, 0, 0.387286); 109 103 110 //mViewPoint = Vector3(1099.9,183.0,-387); 104 111 //mViewDirection = Vector3(-0.6,0,-0.8); 112 113 // inside 114 mViewPoint = Vector3(14.1254, 10.9818, -1032.75); 115 mViewDirection = Vector3(-0.604798, 0, 0.796379); 116 117 // outside 118 mViewPoint = Vector3(35.092, 17.7078, -857.966); 119 mViewDirection = Vector3(-0.411287, 0, -0.911506); 120 105 121 #endif 106 122 mFrame = 0; … … 1721 1737 1722 1738 // check if already rendered 1723 if (!obj->Mailed ())1739 if (!obj->Mailed2()) 1724 1740 bufferSize += 3; 1725 1741 //else cout << obj->mMailbox << " " << obj->sMailId << " "; … … 1736 1752 1737 1753 // check if already rendered 1738 if (obj->Mailed ())1754 if (obj->Mailed2()) 1739 1755 continue; 1740 1756 1741 obj->Mail ();1757 obj->Mail2(); 1742 1758 1743 1759 Triangle3 tri = obj->GetItem(); … … 1789 1805 int indexBufferSize = 0; 1790 1806 1791 KdNode::NewMail ();1807 KdNode::NewMail2(); 1792 1808 1793 1809 ObjectPvsIterator it = pvs.GetIterator(); … … 1813 1829 void GlRenderer::_UpdatePvsIndices(KdNode *node, int &indexBufferSize) 1814 1830 { 1815 if (node->Mailed ())1831 if (node->Mailed2()) 1816 1832 return; 1817 1833 1818 node->Mail ();1834 node->Mail2(); 1819 1835 1820 1836 // if (mObjects.size() * 3 < indexBufferSize) cerr << "problem: " << mObjects.size() * 3 << " < " << indexBufferSize << endl; … … 1851 1867 leaf->mIndexBufferSize = indexBufferSize - leaf->mIndexBufferStart; 1852 1868 } 1853 1854 //cout << "id: " << indexBufferSize << endl;1855 1869 } 1856 1870 -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r2625 r2643 63 63 struct PvsCache 64 64 { 65 66 65 PvsCache():mViewCell(NULL), mUnfilteredPvsSize(0) {} 67 66 68 67 void Reset() 69 68 { 70 mViewCell = NULL; mPvs.Clear(); 69 mViewCell = NULL; 70 mPvs.Clear(); 71 71 filteredBoxes.clear(); 72 72 mUnfilteredPvsSize = 0; … … 229 229 230 230 vector<PvsErrorEntry> mPvsErrorBuffer; 231 bool mComputeGVS; 231 232 232 233 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/GtpVisibility05.vcproj
r2568 r2643 115 115 <Tool 116 116 Name="VCCLCompilerTool" 117 AdditionalIncludeDirectories="..\includ e;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;Timer"117 AdditionalIncludeDirectories="..\includ;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;Timer;..\src\havran" 118 118 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NO_QT;USE_VERBOSE_PVS" 119 119 RuntimeLibrary="2" … … 232 232 </File> 233 233 <File 234 RelativePath=".\HavranDynRayCaster.cpp" 235 > 236 </File> 237 <File 238 RelativePath=".\HavranRayCaster.cpp" 239 > 240 </File> 241 <File 234 242 RelativePath=".\HierarchyManager.cpp" 235 243 > … … 348 356 </File> 349 357 <File 358 RelativePath=".\RandomViewCellsHandler.cpp" 359 > 360 </File> 361 <File 350 362 RelativePath=".\Ray.cpp" 351 363 > … … 409 421 <File 410 422 RelativePath=".\Tetrahedron3.cpp" 423 > 424 </File> 425 <File 426 RelativePath=".\havran\timer.cpp" 411 427 > 412 428 </File> … … 526 542 </File> 527 543 <File 544 RelativePath=".\havran\configh.h" 545 > 546 </File> 547 <File 528 548 RelativePath=".\Containers.h" 529 549 > … … 546 566 </File> 547 567 <File 568 RelativePath=".\FilterBasedDistribution.cpp" 569 > 570 </File> 571 <File 572 RelativePath=".\FilterBasedDistribution.h" 573 > 574 </File> 575 <File 548 576 RelativePath=".\FlexibleHeap.h" 549 577 > … … 586 614 </File> 587 615 <File 616 RelativePath=".\HavranRayCaster.h" 617 > 618 </File> 619 <File 588 620 RelativePath=".\HierarchyManager.h" 589 621 > … … 722 754 </File> 723 755 <File 756 RelativePath=".\RandomViewCellsHandler.h" 757 > 758 </File> 759 <File 724 760 RelativePath=".\Ray.h" 725 761 > … … 734 770 </File> 735 771 <File 772 RelativePath=".\havran\raypack.h" 773 > 774 </File> 775 <File 736 776 RelativePath=".\Rectangle3.h" 737 777 > … … 799 839 <File 800 840 RelativePath=".\Tetrahedron3.h" 841 > 842 </File> 843 <File 844 RelativePath=".\havran\timer.h" 801 845 > 802 846 </File> … … 888 932 > 889 933 </Filter> 934 <Filter 935 Name="havran" 936 > 937 <File 938 RelativePath=".\havran\allocgo2.cpp" 939 > 940 </File> 941 <File 942 RelativePath=".\havran\allocgo2.h" 943 > 944 </File> 945 <File 946 RelativePath=".\havran\ktb.cpp" 947 > 948 </File> 949 <File 950 RelativePath=".\havran\ktb.h" 951 > 952 </File> 953 <File 954 RelativePath=".\havran\ktb8b.cpp" 955 > 956 </File> 957 <File 958 RelativePath=".\havran\ktb8b.h" 959 > 960 </File> 961 <File 962 RelativePath=".\havran\ktbai.cpp" 963 > 964 </File> 965 <File 966 RelativePath=".\havran\ktbai.h" 967 > 968 </File> 969 <File 970 RelativePath=".\havran\ktball.cpp" 971 > 972 </File> 973 <File 974 RelativePath=".\havran\ktball.h" 975 > 976 </File> 977 <File 978 RelativePath=".\havran\ktbconf.h" 979 > 980 </File> 981 <File 982 RelativePath=".\havran\ktbf2trv.cpp" 983 > 984 </File> 985 <File 986 RelativePath=".\havran\ktbftrav.cpp" 987 > 988 </File> 989 <File 990 RelativePath=".\havran\ktbs.cpp" 991 > 992 </File> 993 <File 994 RelativePath=".\havran\ktbs.h" 995 > 996 </File> 997 <File 998 RelativePath=".\havran\ktbtrav.cpp" 999 > 1000 </File> 1001 <File 1002 RelativePath=".\havran\ktbtrav.h" 1003 > 1004 </File> 1005 <File 1006 RelativePath=".\havran\sbbox.cpp" 1007 > 1008 </File> 1009 <File 1010 RelativePath=".\havran\sbbox.h" 1011 > 1012 </File> 1013 <File 1014 RelativePath=".\havran\subdivm.h" 1015 > 1016 </File> 1017 <File 1018 RelativePath=".\havran\testrt.cpp" 1019 > 1020 </File> 1021 <File 1022 RelativePath=".\havran\testrt.h" 1023 > 1024 </File> 1025 </Filter> 890 1026 </Files> 891 1027 <Globals> -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2633 r2643 12 12 #include "BvHierarchy.h" 13 13 #include "Polygon3.h" 14 #include "IntersectableWrapper.h" 15 14 16 15 17 … … 18 20 19 21 #define GVS_DEBUG 0 22 static ObjectContainer myobjects; 20 23 21 24 struct VizStruct … … 37 40 mCurrentViewCell(NULL), 38 41 mCurrentViewPoint(Vector3(0.0f, 0.0f, 0.0f)) 39 //,mGenericStats(0)40 42 { 41 43 Environment::GetSingleton()->GetIntValue("GvsPreprocessor.totalSamples", mTotalSamples); … … 75 77 76 78 mGvsStats.Reset(); 79 80 mGenericStats = 0; 81 mGenericStats2 = 0; 77 82 } 78 83 … … 184 189 Intersectable *obj = ray.mTerminationObject; 185 190 186 if ( !obj->mCounter)191 if (obj->mCounter < 2) 187 192 { 188 obj->mCounter = 1;193 obj->mCounter += 2; 189 194 mTrianglePvs.push_back(obj); 190 195 196 mGenericStats = mTrianglePvs.size(); 197 191 198 // if using kd pvs, exchange the triangle with the node in the pvs 192 199 if (mUseKdPvs) … … 199 206 KdIntersectable *kdInt = mKdTree->GetOrCreateKdIntersectable(node); 200 207 mCurrentViewCell->GetPvs().AddSampleDirty(kdInt, 1.0f); 208 //mCurrentViewCell->GetPvs().AddSampleDirtyCheck(kdInt, 1.0f); 209 201 210 mViewCellsManager->UpdateStatsForViewCell(mCurrentViewCell, kdInt); 211 myobjects.clear(); 212 mKdTree->CollectObjects(node, myobjects); 213 214 // account for kd object pvs 215 ObjectContainer::const_iterator oit, oit_end = myobjects.end(); 216 217 for (oit = myobjects.begin(); oit != oit_end; ++ oit) 218 { 219 TriangleIntersectable *triObj = static_cast<TriangleIntersectable *>(*oit); 220 221 if ((triObj->mCounter != 1) && (triObj->mCounter != 3)) 222 { 223 ++ triObj->mCounter; 224 ++ mGenericStats2; 225 } 226 } 202 227 } 203 228 } 204 229 205 230 result = true; 206 231 } … … 755 780 756 781 mGvsStats.mPerViewCellSamples = 0; 782 757 783 int oldContribution = mGvsStats.mTotalContribution; 758 784 int passSamples = 0; 759 760 785 mGenericStats = 0; 786 mGenericStats2 = 0; 761 787 762 788 //while (mGvsStats.mPerViewCellSamples < mTotalSamples) 763 while (1) 789 while (1) 764 790 { 765 791 mRayCaster->InitPass(); … … 788 814 cout << "contribution=" << mGvsStats.mPassContribution << " (of " << mMinContribution << ")" << endl; 789 815 790 //mGenericStats = GvsStats.mGvsStats.mPassContribution;816 //mGenericStats = mGvsStats.mPassContribution; 791 817 792 818 // termination criterium … … 865 891 AxisAlignedBox3 box = mCurrentViewCell->GetMesh()->mBox; 866 892 867 vector<KdLeaf *> leaves; 868 mKdTree->GetBoxIntersections(box, leaves); 869 870 vector<KdLeaf *>::const_iterator lit, lit_end = leaves.end(); 871 872 for (lit = leaves.begin(); lit != leaves.end(); ++ lit) 873 { 874 KdLeaf *leaf = *lit; 893 //vector<KdLeaf *> leaves; 894 //mKdTree->GetBoxIntersections(box, leaves); 895 896 ObjectContainer kdobjects; 897 mKdTree->CollectKdObjects(box, kdobjects); 898 //vector<KdLeaf *>::const_iterator lit, lit_end = leaves.end(); 899 //for (lit = leaves.begin(); lit != lit_end; ++ lit) 900 ObjectContainer::const_iterator oit, oit_end = kdobjects.end(); 901 for (oit = kdobjects.begin(); oit != oit_end; ++ oit) 902 { 903 // add to kdnode pvs 904 KdIntersectable *kdInt = static_cast<KdIntersectable *>(*oit); 875 905 876 // add to kdnode pvs 877 if (mUseKdPvs) 878 { 879 leaf->Mail(); 880 KdIntersectable *kdInt = mKdTree->GetOrCreateKdIntersectable(leaf); 881 mCurrentViewCell->GetPvs().AddSampleDirty(kdInt, 1.0f); 882 883 mViewCellsManager->UpdateStatsForViewCell(mCurrentViewCell, kdInt); 884 } 885 886 ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 887 888 for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 906 //mCurrentViewCell->GetPvs().AddSampleDirty(kdInt, 1.0f); 907 mCurrentViewCell->GetPvs().AddSampleDirtyCheck(kdInt, 1.0f); 908 mViewCellsManager->UpdateStatsForViewCell(mCurrentViewCell, kdInt); 909 910 myobjects.clear(); 911 mKdTree->CollectObjects(kdInt->GetItem(), myobjects); 912 913 // account for kd object pvs 914 ObjectContainer::const_iterator oit, oit_end = myobjects.end(); 915 916 for (oit = myobjects.begin(); oit != oit_end; ++ oit) 889 917 { 890 918 TriangleIntersectable *triObj = static_cast<TriangleIntersectable *>(*oit); 891 919 920 // account for the overall pvs 921 if ((triObj->mCounter != 1) && (triObj->mCounter != 3)) 922 { 923 ++ triObj->mCounter; 924 ++ mGenericStats2; 925 } 926 927 // the triangle itself intersects 892 928 if (box.Intersects(triObj->GetItem())) 893 929 { 894 if ( !triObj->mCounter)930 if ((triObj->mCounter < 2)) 895 931 { 896 triObj->mCounter = 1; 932 triObj->mCounter += 2; 933 897 934 mTrianglePvs.push_back(triObj); 935 mGenericStats = mTrianglePvs.size(); 898 936 } 899 } 937 } 900 938 } 901 939 } 902 940 } 941 903 942 904 943 … … 929 968 continue; 930 969 931 //ViewCell *vc = mViewCellsManager->GetViewCell(mCurrentViewPoint);932 970 ViewCell *vc = mViewCellsManager->GetViewCell(mRendererWidget->GetViewPoint()); 933 971 934 //cout << "v " << mRendererWidget->GetViewPoint() << " ";935 936 972 // no valid view cell or view cell already computed 937 if (!vc || !vc->GetPvs().Empty() )973 if (!vc || !vc->GetPvs().Empty() || !mRendererWidget->mComputeGVS) 938 974 continue; 939 975 940 //cout << "computing new view cell: " << vc->GetId() << endl; 941 976 mRendererWidget->mComputeGVS = false; 942 977 // hack: reset counters 943 978 ObjectContainer::const_iterator oit, oit_end = mObjects.end(); … … 950 985 } 951 986 } 952 953 954 987 955 988 … … 999 1032 1000 1033 BvhLeaf::NewMail(); 1001 //KdNode::NewMail();1002 1034 1003 1035 ObjectContainer::const_iterator oit, oit_end = mTrianglePvs.end(); … … 1209 1241 { 1210 1242 mCurrentViewCell = vc; 1211 1212 if (mUseKdPvs) 1213 { 1214 KdNode::NewMail(); 1215 //mKdPvs.clear(); 1216 } 1243 KdNode::NewMail(); 1217 1244 1218 1245 long startTime = GetTime(); 1219 1246 cout << "\n***********************\n" 1220 << " processing view cell " << mProcessedViewCells1247 << "computing view cell " << mProcessedViewCells 1221 1248 << " (id: " << mCurrentViewCell->GetId() << ")" << endl; 1222 1249 … … 1256 1283 mCurrentViewCell->GetPvs().AddSampleDirty(*it, 1.0f); 1257 1284 */ 1258 mGvsStats.mPerViewCellPvs = mCurrentViewCell->GetPvs().GetSize();; 1285 mGvsStats.mPerViewCellPvs = mCurrentViewCell->GetPvs().GetSize(); 1286 1287 cout << "pvs cost: " << mCurrentViewCell->GetPvs().EvalPvsCost() << " pvs tri: " << mGenericStats2 << endl; 1259 1288 } 1260 1289 … … 1279 1308 1280 1309 mTrianglePvs.clear(); 1281 #if 0 1282 if (GVS_DEBUG) 1283 { 1284 //VisualizeViewCell(mCurrentViewCell); 1285 VisualizeViewCell(objectPvs); 1286 CLEAR_CONTAINER(mVssRays); 1287 } 1288 cout << "finished" << endl; 1289 1290 if (mEvaluatePixelError || mExportVisibility) 1291 { 1292 StorePvs(objectPvs); 1293 } 1294 #endif 1295 } 1296 1297 } 1310 } 1311 1312 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HavranRayCaster.h
r2629 r2643 1 1 #ifndef _HavranRayCaster_H__ 2 2 #define _HavranRayCaster_H__ 3 4 #ifdef USE_HAVRAN_RAYCASTER 3 5 4 6 #include "RayCaster.h" … … 208 210 } // namespace 209 211 212 #endif 213 210 214 #endif // _HavranRayCaster_H__ -
GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.cpp
r2582 r2643 17 17 namespace GtpVisibilityPreprocessor { 18 18 19 20 int Intersectable::sMailId = 10000;//2147483647; 21 int Intersectable::sReservedMailboxes = 1; 22 23 int Intersectable::sMailId2 = 10000;//2147483647; 24 int Intersectable::sReservedMailboxes2 = 1; 19 25 20 26 // This is the result of computing intersection -
GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
r2615 r2643 84 84 int mMailbox; 85 85 86 static void NewMail2(const int reserve = 1) 87 { 88 sMailId2 += sReservedMailboxes2; 89 sReservedMailboxes2 = reserve; 90 } 91 92 //////////// 93 void Mail2() { mMailbox2 = sMailId2; } 94 bool Mailed2() const { return mMailbox2 == sMailId2; } 95 96 void Mail2(const int mailbox) { mMailbox2 = sMailId2 + mailbox; } 97 bool Mailed2(const int mailbox) const { return mMailbox2 == sMailId2 + mailbox; } 98 99 int IncMail2() { return ++ mMailbox2 - sMailId2; } 100 101 // last mail id -> warning not thread safe! 102 // both mailId and mailbox should be unique for each thread!!! 103 static int sMailId2; 104 static int sReservedMailboxes2; 105 106 /// Mailbox used for traversals 107 int mMailbox2; 108 109 //////////// 86 110 87 111 //////////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r2638 r2643 23 23 int KdNode::sMailId = 1; 24 24 int KdNode::sReservedMailboxes = 1; 25 int KdNode::sMailId2 = 1; 26 int KdNode::sReservedMailboxes2 = 1; 25 27 26 28 … … 32 34 33 35 KdNode::KdNode(KdInterior *parent): 34 mParent(parent), mMailbox(0), mIntersectable(NULL) 36 mParent(parent), mMailbox(0), mIntersectable(NULL), mMailbox2(0) 35 37 { 36 38 if (parent) … … 1152 1154 } 1153 1155 1156 1157 void KdTree::CollectObjectsWithoutMail(KdNode *n, ObjectContainer &objects) 1158 { 1159 stack<KdNode *> nodeStack; 1160 1161 nodeStack.push(n); 1162 1163 while (!nodeStack.empty()) 1164 { 1165 KdNode *node = nodeStack.top(); 1166 nodeStack.pop(); 1167 1168 if (node->IsLeaf()) 1169 { 1170 KdLeaf *leaf = (KdLeaf *)node; 1171 for (int j=0; j < leaf->mObjects.size(); j++) 1172 { 1173 Intersectable *object = leaf->mObjects[j]; 1174 objects.push_back(object); 1175 } 1176 } 1177 else 1178 { 1179 KdInterior *interior = (KdInterior *)node; 1180 1181 nodeStack.push(interior->mFront); 1182 nodeStack.push(interior->mBack); 1183 } 1184 } 1185 } 1186 1187 1154 1188 void 1155 1189 KdTree::CollectObjects(KdNode *n, ObjectContainer &objects) -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
r2618 r2643 102 102 int mMailbox; 103 103 104 static int sMailId2; 105 static int sReservedMailboxes2; 106 int mMailbox2; 107 104 108 KdIntersectable *mIntersectable; 105 109 … … 114 118 void Mail(const int mailbox) { mMailbox = sMailId + mailbox; } 115 119 bool Mailed(const int mailbox) const { return mMailbox == sMailId + mailbox; } 120 121 122 static void NewMail2(const int reserve = 1) { 123 sMailId2 += sReservedMailboxes; 124 sReservedMailboxes2 = reserve; 125 } 126 127 void Mail2() { mMailbox2 = sMailId2; } 128 bool Mailed2() const { return mMailbox2 == sMailId2; } 129 130 void Mail2(const int mailbox) { mMailbox2 = sMailId2 + mailbox; } 131 bool Mailed2(const int mailbox) const { return mMailbox2 == sMailId2 + mailbox; } 132 116 133 117 134 virtual ~KdNode(){}; … … 372 389 void 373 390 CollectObjects(KdNode *n, ObjectContainer &objects); 374 375 void 376 CollectObjects(const AxisAlignedBox3 &box,377 391 void 392 CollectObjectsWithoutMail(KdNode *n, ObjectContainer &objects); 393 void 394 CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects); 378 395 379 396 void -
GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.cpp
r2635 r2643 16 16 namespace GtpVisibilityPreprocessor { 17 17 18 static ObjectPvs dummyPvs; 18 19 19 20 /** the pvs is the number of different objects in the node leaves … … 33 34 34 35 // already processed node (=> objects already in pvs)? 35 if ( !node->Mailed())36 if (1)//!node->Mailed()) 36 37 { 37 node->Mail(); 38 38 //node->Mail(); 39 39 if (node->IsLeaf()) 40 40 { … … 50 50 for (oit = leaf->mMultipleObjects.begin(); oit != oit_end; ++ oit) 51 51 { 52 Intersectable *obj ect= *oit;52 Intersectable *obj = *oit; 53 53 54 if ( !object->Mailed())54 if (1)//!obj->Mailed()) 55 55 { 56 object->Mail(); 57 ++ pvs; 56 //obj->Mail(); 57 if (dummyPvs.AddSample(obj)) 58 ++ pvs; 58 59 } 59 60 } … … 66 67 for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 67 68 { 68 Intersectable *obj ect= *oit;69 Intersectable *obj = *oit; 69 70 70 if (!obj ect->Mailed())71 if (!obj->Mailed2()) 71 72 { 72 object->Mail(); 73 ++ pvs; 73 //if (dummyPvs.AddSample(obj, 1.0f))++ pvs; 74 obj->Mail2(); 75 ++pvs; 74 76 } 75 77 } … … 78 80 } 79 81 else // traverse tree 80 82 { 81 83 KdInterior *interior = static_cast<KdInterior *>(node); 82 84 … … 87 89 } 88 90 91 ///return dummyPvs.Size(); 89 92 return pvs; 90 93 } … … 152 155 153 156 157 154 158 float ObjectPvs::EvalPvsCost() const 155 159 { 156 160 float pvs = 0; 157 161 158 Intersectable::NewMail(); 159 KdNode::NewMail(); 162 Intersectable::NewMail2(); 163 //KdNode::NewMail(); 164 dummyPvs.Clear(); 160 165 161 166 ObjectPvsIterator pit = GetIterator(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2638 r2643 1045 1045 GetIntValue("Preprocessor.rayCastMethod", rayCastMethod); 1046 1046 1047 if ((rayCastMethod == 2) || (rayCastMethod == 3)) { 1048 HavranRayCaster *hr = 0; 1049 if (rayCastMethod == 3) 1050 hr = reinterpret_cast<HavranDynRayCaster*>(mRayCaster); 1051 else 1052 hr = reinterpret_cast<HavranRayCaster*>(mRayCaster); 1053 1054 string ktbFilename = internKdTree; 1055 int l = ktbFilename.length(); 1056 ktbFilename[l-1] = 't'; 1057 ktbFilename[l-2] = 'b'; 1058 ktbFilename[l-3] = 'k'; 1059 1060 cout << "Trying to load tree from file " << ktbFilename << endl; 1061 if (hr->ImportBinTree(ktbFilename, this->mObjects)) { 1062 cout << "Loading failed - building kd-tree" << endl; 1063 hr->Build(this->mObjects); 1064 cout << "Exporting kd-tree to file " << ktbFilename << endl; 1065 hr->ExportBinTree(ktbFilename); 1066 } 1067 else 1068 cout << " done." << endl; 1047 #ifdef USE_HAVRAN_RAYCASTER 1048 1049 if ((rayCastMethod == 2) || (rayCastMethod == 3)) 1050 { 1051 HavranRayCaster *hr = 0; 1052 1053 if (rayCastMethod == 3) 1054 hr = reinterpret_cast<HavranDynRayCaster*>(mRayCaster); 1055 else 1056 hr = reinterpret_cast<HavranRayCaster*>(mRayCaster); 1057 1058 string ktbFilename = internKdTree; 1059 int l = ktbFilename.length(); 1060 ktbFilename[l-1] = 't'; 1061 ktbFilename[l-2] = 'b'; 1062 ktbFilename[l-3] = 'k'; 1063 1064 cout << "Trying to load tree from file " << ktbFilename << endl; 1065 if (hr->ImportBinTree(ktbFilename, this->mObjects)) { 1066 cout << "Loading failed - building kd-tree" << endl; 1067 hr->Build(this->mObjects); 1068 cout << "Exporting kd-tree to file " << ktbFilename << endl; 1069 hr->ExportBinTree(ktbFilename); 1070 } 1071 else 1072 cout << " done." << endl; 1069 1073 } 1070 1071 1074 #endif 1075 1076 1072 1077 if (!mUseKdTree) { 1073 1078 // create just a dummy KdTree … … 1134 1139 if (rayCastMethod == 2) 1135 1140 { 1141 #ifdef USE_HAVRAN_RAYCASTER 1136 1142 cout << "ray cast method: havran" << endl <<flush; 1137 1143 mRayCaster = new GALIGN16 HavranRayCaster(*this); 1144 #endif 1138 1145 } 1139 1146 if (rayCastMethod == 3) 1140 1147 { 1148 #ifdef USE_HAVRAN_RAYCASTER 1141 1149 cout << "ray cast method: havran - dyn" << endl <<flush; 1142 1150 mRayCaster = new GALIGN16 HavranDynRayCaster(*this); 1151 #endif 1143 1152 } 1144 1153 … … 1759 1768 cout<<leaf->GetBox(); 1760 1769 mDynamicObjects.push_back(leaf); 1761 // 1770 //leaf->RebuildKtbTree(); 1762 1771 mSceneGraph->GetRoot()->mChildren.push_back(leaf); 1763 1772 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2636 r2643 274 274 275 275 int mGenericStats; 276 int mGenericStats2; 276 277 277 278 void ScheduleUpdateDynamicObjects() { -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2633 r2643 126 126 OptimizeForWindowsApplication="TRUE" 127 127 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";"$(CG_INC_PATH)";Timer;..\src\sparsehash\src\google\sparsehash;..\src\sparsehash\src\windows;..\src\sparsehash\src\google;..\src\sparsehash\src;..\src\ootl\;..\src\ootl\src\;..\src\ootl\src\cpp;..\src\ootl\src\cpp\include\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;..\src\ootl\src\cpp\include\ootl\mswin;..\src\havran" 128 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_ HASH_PVS;USE_CG"128 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_VERBOSE_PVS;USE_CG" 129 129 StringPooling="TRUE" 130 130 MinimalRebuild="TRUE" … … 417 417 <File 418 418 RelativePath=".\HashPvs.h"> 419 </File> 420 <File 421 RelativePath=".\HavranDynRayCaster.cpp"> 419 422 </File> 420 423 <File … … 1144 1147 </File> 1145 1148 <File 1149 RelativePath=".\havran\ktbs.cpp"> 1150 </File> 1151 <File 1152 RelativePath=".\havran\ktbs.h"> 1153 </File> 1154 <File 1146 1155 RelativePath=".\havran\ktbtrav.cpp"> 1147 1156 </File> -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2638 r2643 307 307 GlRenderer::InitGL(); 308 308 309 //glEnable(GL_FOG); 310 //glFogi(GL_FOG_MODE, GL_EXP); 311 glFogi(GL_FOG_MODE, GL_LINEAR); 312 313 // glFogf(GL_FOG_DENSITY, .2f); 314 glFogf(GL_FOG_START, 50.f); 315 glFogf(GL_FOG_END, 500.f); 316 309 317 GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0}; 310 318 GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; … … 440 448 int indexBufferSize = 0; 441 449 442 KdNode::NewMail ();450 KdNode::NewMail2(); 443 451 //Intersectable::NewMail(); 444 452 … … 506 514 if (viewcell) 507 515 { 508 #if 1516 #if 0 509 517 // copy the pvs so that it can be filtered ... 510 518 if (PvsChanged(viewcell)) … … 518 526 //mMutex.lock(); 519 527 // mSpatialFilter size is in range 0.001 - 0.1 520 mViewCellsManager->ApplyFilter2(viewcell, 521 mUseFilter, 522 100.0f * mSpatialFilterSize, 523 //pvs, 524 mPvsCache.mPvs, 525 &mPvsCache.filteredBoxes); 528 mViewCellsManager->ApplyFilter2(viewcell, 529 mUseFilter, 530 100.0f * mSpatialFilterSize, 531 mPvsCache.mPvs, 532 &mPvsCache.filteredBoxes); 526 533 //mPvsCache.mPvs = pvs; 527 534 //mMutex.unlock(); … … 535 542 // update the indices for rendering 536 543 PreparePvs2(mPvsCache.mPvs); 537 538 544 emit PvsUpdated(); 545 mCurrentPvsCost = mPvsCache.mPvs.EvalPvsCost(); 539 546 } 540 547 #else 548 541 549 PreparePvs2(viewcell->GetPvs()); 542 550 emit PvsUpdated(); 551 543 552 #endif 544 553 … … 577 586 mWireFrame = false; 578 587 } 588 mCurrentPvsCost = viewcell->GetPvs().EvalPvsCost(); 579 589 } 580 590 else … … 585 595 RenderScene(); 586 596 } 597 598 //cout << "vp: " << mViewPoint << " vd: " << mViewDirection << endl; 587 599 } 588 600 … … 794 806 } 795 807 796 if ( 1 &&mShowRays)808 if (mShowRays) 797 809 { 798 810 RenderRays(mViewCellsManager->mVizBuffer.GetRays(), mRayVisualizationMethod, mShowDistribution, 1); … … 937 949 //mRenderVisibilityEstimates = true; 938 950 951 mComputeGVS = false; 939 952 mUseRandomColorPerPvsObject = false; 940 953 … … 980 993 mShowRays = false; 981 994 982 SetSceneCut( 0);995 SetSceneCut(1000); 983 996 mControlWidget = new QtRendererControlWidget(NULL); 984 997 … … 991 1004 connect(mControlWidget, SIGNAL(SetRandomViewPoint()), this, SLOT(SetRandomViewPoint())); 992 1005 connect(mControlWidget, SIGNAL(StoreStatistics(void)), this, SLOT(StoreStatistics(void))); 1006 connect(mControlWidget, SIGNAL(ComputeGVS(void)), this, SLOT(ComputeGVS(void))); 993 1007 connect(mControlWidget, SIGNAL(LoadObject(void)), this, SLOT(LoadObject(void))); 994 1008 … … 1270 1284 #if 0 1271 1285 QFont font40; font40.setPointSize(30); 1272 s.sprintf("PVS: %04d", mPvsSize);1273 renderText(20, 40, s, font40);1286 //s.sprintf("PVS: %04d", mPvsSize); 1287 //renderText(20, 40, s, font40); 1274 1288 #endif 1275 1289 1276 /* QFont font40; font40.setPointSize(30); 1277 s.sprintf("New triangles: %04d", 100); 1278 renderText(200, 40, s, font40);*/ 1290 //s.sprintf("RAW TRI: %07d", mViewCellsManager->GetPreprocessor()->mGenericStats); 1291 //renderText(290, 40, s, font40); 1292 //s.sprintf("PVS TRI: %07d", mViewCellsManager->GetPreprocessor()->mGenericStats2); 1293 //renderText(290, 70, s, font40); 1294 1295 s.sprintf("PVS TRI: %07d", (int)mCurrentPvsCost); 1296 renderText(290, 70, s, font40); 1297 //renderText(290, 70, s, font40); 1298 1279 1299 } 1280 1300 … … 1283 1303 QtGlRendererWidget::SetViewCellGranularity(int number) 1284 1304 { 1285 if (mViewCellsManager) { 1286 // mViewCellsManager->SetMaxFilterSize(number); 1305 if (mViewCellsManager) 1306 { 1307 // mViewCellsManager->SetMaxFilterSize(number); 1287 1308 1288 1309 // $$ tmp off … … 1301 1322 if (mViewCellsManager) 1302 1323 mViewCellsManager->SetMaxFilterSize(number); 1324 1303 1325 mPvsCache.Reset(); 1304 1326 updateGL(); … … 1324 1346 AxisAlignedBox3 box = mViewCellsManager->GetViewSpaceBox(); 1325 1347 Vector3 p = (1.0f - f) * box.Min() + f * box.Max(); 1326 mSceneCutPlane.mNormal = Vector3(0, -1,0);1348 mSceneCutPlane.mNormal = Vector3(0, -1, 0); 1327 1349 mSceneCutPlane.mD = -DotProd(mSceneCutPlane.mNormal, p); 1328 1350 … … 1996 2018 QGroupBox *groupBox = CreateVisualizationPanel(hbox); 1997 2019 vh->addWidget(groupBox, 0, 0); 2020 1998 2021 #if REMOVE_TEMPORARY 1999 2022 QGroupBox *groupBox2 = CreateRenderCostPanel(hbox); 2000 2023 vh->addWidget(groupBox2, 0, 0); 2001 #endif 2024 2002 2025 QGroupBox *groupBox3 = CreateRayVisualizationPanel(hbox); 2003 2026 vh->addWidget(groupBox3, 0, 0); … … 2005 2028 QGroupBox *groupBox4 = CreateTrafoPanel(hbox); 2006 2029 vh->addWidget(groupBox4, 0, 0); 2030 #endif 2007 2031 2008 2032 ////////////////////////////////// 2009 2033 2010 2011 /*cb = new QRadiobox("Top View", vbox);2012 vl->addWidget(cb);2013 cb->setChecked(false);2014 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetTopView(bool)));2015 */2016 2034 2017 2035 //vbox->resize(800,150); … … 2168 2186 #endif 2169 2187 2188 button = new QPushButton("Compute GVS", vbox); 2189 vbox->layout()->addWidget(button); 2190 connect(button, SIGNAL(clicked()), SIGNAL(ComputeGVS())); 2191 2170 2192 #if DYNAMIC_OBJECTS_HACK 2171 2193 … … 2202 2224 2203 2225 //connect(button, SIGNAL(clicked(void)), SLOT(StoreStatistics(void))); 2204 //mHidingCost = 0.1f;2205 //////////////////////////////////////////2226 2227 ////////////////////////////////////////// 2206 2228 2207 2229 label = new QLabel("Spatial Filter size"); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2636 r2643 99 99 100 100 void FocusNextPvsErrorFrame(); 101 void UpdatePvsErrorItem(int i, 102 GlRendererBuffer::PvsErrorEntry &); 101 void UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &); 103 102 104 103 … … 113 112 void SetRandomViewPoint(); 114 113 void StoreStatistics(); 114 void ComputeGVS(); 115 115 void LoadObject(); 116 116 void UpdateAllPvs(); … … 231 231 ViewCellInfoContainer mCompareInfo; 232 232 233 int mCurrentPvsCost; 234 233 235 vector<RgbColor> mColors; 234 236 … … 316 318 void SetRandomViewPoint(); 317 319 void StoreStatistics(); 320 318 321 void LoadObject(); 319 322 320 323 void SetRenderErrors(bool b) { 321 324 mRenderErrors = b; 325 updateGL(); 326 } 327 328 void ComputeGVS() { 329 mComputeGVS = true; 322 330 updateGL(); 323 331 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtInterface.vcproj
r2633 r2643 165 165 <Tool 166 166 Name="VCCLCompilerTool" 167 AdditionalIncludeDirectories="..\..\src;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\..\..\..\..\..\..\NonGTP\Zlib\include;"$(CG_INC_PATH)";..\..\src\sparsehash\src;..\..\src\sparsehash\src\google;..\..\src\sparsehash\src\windows;..\..\src\sparsehash\src\google\sparsehash "168 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_ HASH_PVS;USE_QT;USE_CG;GTP_INTERNAL"167 AdditionalIncludeDirectories="..\..\src;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\..\..\..\..\..\..\NonGTP\Zlib\include;"$(CG_INC_PATH)";..\..\src\sparsehash\src;..\..\src\sparsehash\src\google;..\..\src\sparsehash\src\windows;..\..\src\sparsehash\src\google\sparsehash;..\src\havran" 168 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_VERBOSE_PVS;USE_QT;USE_CG;GTP_INTERNAL" 169 169 RuntimeLibrary="2" 170 170 UsePrecompiledHeader="0" -
GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp
r2621 r2643 6 6 #include "Intersectable.h" 7 7 #include "IntersectableWrapper.h" 8 #include "ktball.h"8 //#include "ktball.h" 9 9 10 10 … … 279 279 280 280 SceneGraphLeaf::SceneGraphLeaf(): mIsDynamic(false) 281 #if DYNAMIC_OBJECTS_HACK282 , mKtbTree(NULL)283 #endif284 281 { 285 282 mTrafo = IdentityMatrix(); … … 292 289 293 290 SceneGraphLeaf::SceneGraphLeaf(bool isDynamic): mIsDynamic(isDynamic) 294 #if DYNAMIC_OBJECTS_HACK295 , mKtbTree(NULL)296 #endif297 291 { 298 292 mTrafo = IdentityMatrix(); … … 324 318 325 319 326 #if DYNAMIC_OBJECTS_HACK 327 328 329 void SceneGraphLeaf::RebuildKtbTree() 330 { 331 if (mKtbTree) 332 delete mKtbTree; 333 334 mKtbTree = new CKTB(); 335 mKtbTree->BuildUp(mGeometry); 336 } 337 338 #endif 339 340 341 } 320 321 } -
GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h
r2636 r2643 72 72 73 73 #if DYNAMIC_OBJECTS_HACK 74 void RebuildKtbTree();75 74 SceneGraphLeafIntersectable *GetIntersectable() { return mIntersectable; } 76 75 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r2633 r2643 145 145 OptimizeForWindowsApplication="TRUE" 146 146 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;..\src\sparsehash\src\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;$(NOINHERIT)" 147 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_ HASH_PVS;QT_OPENGL_LIB;QT_DLL"147 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_VERBOSE_PVS;QT_OPENGL_LIB;QT_DLL" 148 148 StringPooling="TRUE" 149 149 MinimalRebuild="TRUE" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r2588 r2643 49 49 myless<vector<ViewCell *>::value_type> > TraversalQueue; 50 50 51 int Intersectable::sMailId = 10000;//2147483647;52 int Intersectable::sReservedMailboxes = 1;53 51 54 52 float MergeCandidate::sRenderCostWeight = 0; -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2634 r2643 28 28 #include "ViewCellsManager.h" 29 29 30 #include "testrt.h"30 //#include "testrt.h" 31 31 32 32
Note: See TracChangeset
for help on using the changeset viewer.