Changeset 1732 for GTP/trunk/Lib/Vis
- Timestamp:
- 11/09/06 13:36:30 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1727 r1732 47 47 mParent(NULL), 48 48 mMailbox(0), 49 mRenderCostDecr(0),50 mMemoryIncr(0),51 mPvsEntriesIncr(0),49 //mRenderCostDecr(0), 50 //mMemoryIncr(0), 51 //mPvsEntriesIncr(0), 52 52 mTimeStamp(0) 53 53 { … … 59 59 mBoundingBox(bbox), 60 60 mMailbox(0), 61 mMemoryIncr(0),62 mRenderCostDecr(0),63 mPvsEntriesIncr(0),61 //mMemoryIncr(0), 62 //mRenderCostDecr(0), 63 //mPvsEntriesIncr(0), 64 64 mTimeStamp(0) 65 65 { … … 71 71 mParent(parent), 72 72 mMailbox(0), 73 mMemoryIncr(0),74 mRenderCostDecr(0),75 mPvsEntriesIncr(0),73 //mMemoryIncr(0), 74 //mRenderCostDecr(0), 75 //mPvsEntriesIncr(0), 76 76 mTimeStamp(0) 77 77 { … … 292 292 Environment::GetSingleton()->GetIntValue("BvHierarchy.maxTests", mMaxTests); 293 293 294 //mUseBboxAreaForSah = false; 295 mUseBboxAreaForSah = true; 294 //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(VspViewCell)); 295 //mMemoryConst = (float)sizeof(BvhLeaf); 296 mMemoryConst = (float)sizeof(ObjectContainer); 297 cout << "bvh memcost: " << mMemoryConst << endl; 298 cout << "triangle: " << sizeof(TriangleIntersectable) << endl; 299 cout << "triangle: " << sizeof(Intersectable) << endl; 300 cout << "triangle: " << sizeof(ObjectContainer) << endl; 301 cout << "triangle: " << sizeof(float) << endl; 302 cout << "triangle: " << sizeof(int) << endl; 303 304 mUseBboxAreaForSah = true; 296 305 297 306 ///////////// … … 317 326 Debug << "use global sort: " << mUseGlobalSorting << endl; 318 327 Debug << "minimal rays for visibility: " << mMinRaysForVisibility << endl; 328 Debug << "bvh mem const: " << mMemoryConst << endl; 319 329 320 330 Debug << endl; … … 503 513 { 504 514 BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(currentNode); 505 CollectRays(leaf->mObjects, leaf->mVssRays);515 // CollectRays(leaf->mObjects, leaf->mVssRays); 506 516 } 507 517 … … 584 594 // otherwise danger of being stuck in a local minimum! 585 595 const float factor = mRenderCostDecreaseWeight; 586 priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 587 588 if (mHierarchyManager->mConsiderMemory2) 589 { 590 priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mHierarchyManager->mMemoryConst); 596 597 if (1) 598 { 599 priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 600 if (mHierarchyManager->mConsiderMemory2) 601 { 602 priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 603 } 604 } 605 else 606 { 607 if (!mHierarchyManager->mConsiderMemory2) 608 { 609 priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 610 } 611 else 612 { 613 const float ratio = 614 renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 615 616 priority = factor * ratio + (1.0f - factor) * oldRenderCost; 617 } 591 618 } 592 619 } … … 2351 2378 //oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 2352 2379 2353 oldNode->mRenderCostDecr = sc->GetRenderCostDecrease();2354 oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr();2380 //oldNode->mRenderCostDecr = sc->GetRenderCostDecrease(); 2381 //oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr(); 2355 2382 2356 2383 /////////////////////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1727 r1732 204 204 int mTimeStamp; 205 205 206 int mPvsEntriesIncr;207 float mMemoryIncr;208 float mRenderCostDecr;206 //int mPvsEntriesIncr; 207 //float mMemoryIncr; 208 //float mRenderCostDecr; 209 209 210 210 ///////////////////////////////////// … … 327 327 328 328 /// Rays piercing this leaf. 329 VssRayContainer mVssRays;329 //VssRayContainer mVssRays; 330 330 /// objects 331 331 ObjectContainer mObjects; … … 954 954 int mMinRaysForVisibility; 955 955 956 /// constant value for driving the heuristics 957 float mMemoryConst; 958 956 959 int mMaxTests; 957 960 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1731 r1732 151 151 Environment::GetSingleton()->GetIntValue( 152 152 "Hierarchy.Construction.maxRepairs", mMaxRepairs); 153 154 if (1 && mConsiderMemory2)155 {156 mMemoryConst = (float)(sizeof(VspLeaf *) + sizeof (VspViewCell *));157 }158 else159 {160 Environment::GetSingleton()->GetFloatValue(161 "Hierarchy.Termination.memoryConst", mMemoryConst);162 }163 164 153 // compare to bytes 165 154 mTermMaxMemory *= (1024.0f * 1024.0f); … … 177 166 Debug << "consider memory: " << mConsiderMemory << endl; 178 167 Debug << "consider memory2: " << mConsiderMemory << endl; 179 Debug << "mem const: " << mMemoryConst << endl;180 168 Debug << "min steps of same kind: " << mMinStepsOfSameType << endl; 181 169 Debug << "max steps of same kind: " << mMaxStepsOfSameType << endl; … … 1933 1921 1934 1922 isLeaf = newNode->IsLeaf(); 1935 subStats.mRenderCostDecrease = oldNode->mRenderCostDecr;1936 entriesIncr = oldNode->mPvsEntriesIncr;1923 //subStats.mRenderCostDecrease = oldNode->mRenderCostDecr; 1924 //entriesIncr = oldNode->mPvsEntriesIncr; 1937 1925 } 1938 1926 else … … 1944 1932 1945 1933 isLeaf = newNode->IsLeaf(); 1946 subStats.mRenderCostDecrease = oldNode->mRenderCostDecr;1947 entriesIncr = oldNode->mPvsEntriesIncr;1934 //subStats.mRenderCostDecrease = oldNode->mRenderCostDecr; 1935 //entriesIncr = oldNode->mPvsEntriesIncr; 1948 1936 } 1949 1937 … … 2078 2066 2079 2067 const float objectSpaceHierarchyMem = float( 2080 subStats.mObjectSpaceSplits * sizeof( BvhLeaf *) +2081 (subStats.mObjectSpaceSplits - 1) * sizeof(BvhInterior *) +2082 sizeof(BvHierarchy)2068 subStats.mObjectSpaceSplits * sizeof(ObjectContainer) 2069 //+ (subStats.mObjectSpaceSplits - 1) * sizeof(BvhInterior) 2070 //+sizeof(BvHierarchy) 2083 2071 ) / float(1024 * 1024); 2084 2072 2085 2073 2086 2074 const float viewSpaceHierarchyMem = float( 2087 subStats.mViewSpaceSplits * sizeof(VspLeaf *) + 2088 (subStats.mViewSpaceSplits - 1) * sizeof(VspInterior *) + 2089 sizeof(VspTree) 2075 subStats.mViewSpaceSplits * sizeof(ObjectPvs) 2076 //+ (subStats.mViewSpaceSplits - 1) * sizeof(VspInterior) 2077 + sizeof(ObjectPvs) 2078 //+ sizeof(VspTree) 2090 2079 ) / float(1024 * 1024); 2091 2080 … … 2093 2082 2094 2083 subStats.Print(splitsStats); 2095 2096 2084 splits += splitsStepSize; 2097 2085 2098 2086 if (subStats.mNumSplits == mHierarchyStats.Leaves()) 2099 2087 break; 2100 } 2088 2089 cout << subStats.mNumSplits << " "; 2090 } 2091 cout << endl; 2101 2092 } 2102 2093 -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1727 r1732 283 283 284 284 inline bool ConsiderMemory() const { return mConsiderMemory; } 285 inline float GetMemoryConst() const { return mMemoryConst; }285 //inline float GetMemoryConst() const { return mMemoryConst; } 286 286 287 287 … … 620 620 bool mConsiderMemory; 621 621 622 /// constant value for driving the heuristics623 float mMemoryConst;624 625 622 bool mConsiderMemory2; 626 623 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
r1709 r1732 388 388 }; 389 389 390 390 391 /** Leaf of the view cell hierarchy corresponding 391 392 to a leaf in a spatial hierarchy. -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1723 r1732 5804 5804 5805 5805 startTime = GetTime(); 5806 5806 5807 cout << "compute new statistics ... " << endl; 5807 5808 … … 5811 5812 timeDiff = TimeDiff(startTime, GetTime()); 5812 5813 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 5814 cout << "*************************************" << endl; 5815 5813 5816 Debug << "statistics computed in " << timeDiff * 1e-3 << " secs" << endl; 5814 5817 5815 5818 // only for debugging purpose 5816 if ( 1)5819 if (0) 5817 5820 { 5818 5821 ViewCellContainer viewCells; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1727 r1732 181 181 mParent(NULL), 182 182 mTreeValid(true), 183 mTimeStamp(0) ,184 mRenderCostDecr(0), 185 mMemoryIncr(0), 186 mPvsEntriesIncr(0)183 mTimeStamp(0) 184 //,mRenderCostDecr(0) 185 //,mMemoryIncr(0) 186 //,mPvsEntriesIncr(0) 187 187 {} 188 188 … … 191 191 mParent(parent), 192 192 mTreeValid(true), 193 mMemoryIncr(0), 194 mRenderCostDecr(0), 195 mPvsEntriesIncr(0), 193 //,mMemoryIncr(0) 194 //,mRenderCostDecr(0) 195 //,mPvsEntriesIncr(0) 196 196 mTimeStamp(0) 197 197 {} … … 470 470 Environment::GetSingleton()->GetBoolValue("VspTree.simulateOctree", mCirculatingAxis); 471 471 472 //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(VspViewCell)); 473 //mMemoryConst = 50;//(float)(sizeof(VspViewCell)); 474 475 //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(ObjectPvs)); 476 mMemoryConst = (float)sizeof(ObjectPvs); 477 cout << "vsp memcost: " << mMemoryConst << endl; 472 478 473 479 ////////////// … … 498 504 Debug << "maxband: " << mMaxBand << endl; 499 505 506 Debug << "vsp mem const: " << mMemoryConst << endl; 507 500 508 Debug << endl; 501 509 } … … 838 846 // otherwise danger of being stuck in a local minimum! 839 847 const float factor = mRenderCostDecreaseWeight; 840 float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 841 842 if (mHierarchyManager->mConsiderMemory2) 843 { 844 priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mHierarchyManager->mMemoryConst); 845 } 846 848 849 float priority; 850 851 if (1) 852 { 853 priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 854 if (mHierarchyManager->mConsiderMemory2) 855 { 856 priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 857 } 858 } 859 else 860 { 861 if (!mHierarchyManager->mConsiderMemory2) 862 { 863 priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 864 } 865 else 866 { 867 const float ratio = 868 renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 869 870 priority = factor * ratio + (1.0f - factor) * oldRenderCost; 871 } 872 } 873 847 874 splitCandidate.SetPriority(priority); 848 875 } … … 3323 3350 //oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 3324 3351 3325 oldNode->mRenderCostDecr = sc->GetRenderCostDecrease();3326 oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr();3352 //oldNode->mRenderCostDecr = sc->GetRenderCostDecrease(); 3353 //oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr(); 3327 3354 3328 3355 ///////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
r1705 r1732 192 192 float GetMergeCost() {return (float)-mTimeStamp; } 193 193 194 int mTimeStamp; 195 194 196 ///////// 195 197 //-- mailing options … … 203 205 int mMailbox; 204 206 205 int mTimeStamp; 206 207 int mPvsEntriesIncr; 208 float mMemoryIncr; 209 float mRenderCostDecr; 207 //int mPvsEntriesIncr; 208 //float mMemoryIncr; 209 //float mRenderCostDecr; 210 210 211 211 protected: … … 333 333 VssRayContainer mVssRays; 334 334 335 /// leaf pvs336 //ObjectPvs *mPvs;337 338 335 /// Probability that the view point lies in this leaf 339 336 float mProbability; … … 1120 1117 1121 1118 int mMaxTests; 1119 1120 /// constant value for driving the heuristics 1121 float mMemoryConst; 1122 1122 }; 1123 1123
Note: See TracChangeset
for help on using the changeset viewer.