Changeset 1687 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 10/27/06 10:39:58 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1686 r1687 415 415 backData.mMaxCostMisses = sc.GetMaxCostMisses(); 416 416 417 // node->mRenderCostDecr = sc.GetRenderCostDecrease();418 //node->mPvsEntriesIncr = sc.GetPvsEntriesIncr();419 417 // set the time stamp so the order of traversal can be reconstructed 418 node->mTimeStamp = mHierarchyManager->mTimeStamp ++; 419 420 420 // assign the objects in sorted order 421 421 if (mUseGlobalSorting) … … 449 449 currentNode = SubdivideNode(*sc, tFrontData, tBackData); 450 450 451 // set the time stamp so the order of traversal can be reconstructed452 currentNode->mTimeStamp = mHierarchyManager->mTimeStamp ++;453 //currentNode->mRenderCostDecr = sc.GetRenderCostDecrease();454 //currentNode->mPvsEntriesIncr = sc.GetPvsEntriesIncr();455 456 451 // decrease the weighted average cost of the subdivisoin 457 452 mTotalCost -= sc->GetRenderCostDecrease(); … … 899 894 // (as we are not sampling volumetric visibility, 900 895 // this should provide better heuristics 901 const float area = //obox.SurfaceArea();896 const float area = obj->GetArea();//obox.SurfaceArea(); 902 897 903 898 al += area; … … 2141 2136 currentNode = SubdivideNode(*sc, tFrontData, tBackData); 2142 2137 2143 currentNode->mRenderCostDecr = oldNode->mRenderCostDecr +sc->GetRenderCostDecrease();2144 currentNode->mPvsEntriesIncr = oldNode->mPvsEntriesIncr +sc->GetPvsEntriesIncr();2145 2138 oldNode->mRenderCostDecr += sc->GetRenderCostDecrease(); 2139 oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 2140 cout << "here5" << endl; 2146 2141 /////////////////////////// 2147 2142 //-- push the new split candidates on the queue … … 2151 2146 2152 2147 frontCandidate->SetPriority((float)-oldInterior->GetFront()->mTimeStamp); 2153 backCandidate->SetPriority((float)-oldInterior->Get Front()->mTimeStamp);2148 backCandidate->SetPriority((float)-oldInterior->GetBack()->mTimeStamp); 2154 2149 2155 2150 frontCandidate->mEvaluationHack = oldInterior->GetFront(); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1686 r1687 1667 1667 firstBvh->mEvaluationHack = oldBvhRoot; 1668 1668 1669 firstVsp->SetPriority((float)-oldVspRoot->mTimeStamp); 1670 firstBvh->SetPriority((float)-oldBvhRoot->mTimeStamp); 1671 1669 1672 tQueue.Push(firstVsp); 1670 1673 tQueue.Push(firstBvh); … … 1726 1729 cout << "next candidate: " << nextCandidate->GetPriority() << endl; 1727 1730 1728 if (nextCandidate->Type() == SubdivisionCandidate::VIEW_SPACE) 1731 if (nextCandidate->Type() == SubdivisionCandidate::VIEW_SPACE) 1732 { 1733 cout << "here8" << endl; 1729 1734 mVspTree->SubdivideAndCopy(tQueue, nextCandidate); 1735 1736 VspNode *oldNode = (VspNode *)nextCandidate->mEvaluationHack; 1737 1738 totalRenderCost -= oldNode->mRenderCostDecr; 1739 entriesInPvs += oldNode->mPvsEntriesIncr; 1740 } 1730 1741 else 1742 {cout << "here9" << endl; 1731 1743 mBvHierarchy->SubdivideAndCopy(tQueue, nextCandidate); 1732 1733 totalRenderCost -= nextCandidate->GetRenderCostDecrease(); 1734 entriesInPvs += nextCandidate->GetPvsEntriesIncr(); 1744 1745 BvhNode *oldNode = (BvhNode *)nextCandidate->mEvaluationHack; 1746 1747 totalRenderCost -= oldNode->mRenderCostDecr; 1748 entriesInPvs += oldNode->mPvsEntriesIncr; 1749 } 1735 1750 1736 1751 ++ steps; 1737 1752 cout << "rc: " << nextCandidate->GetRenderCostDecrease() << endl; 1753 cout << "pvs: " << nextCandidate->GetPvsEntriesIncr() << endl; 1754 1738 1755 const float memoryCost = (float)entriesInPvs * (float)ObjectPvs::GetEntrySize(); 1739 1756 UpdateStats(stats, steps, totalRenderCost, entriesInPvs, memoryCost, false); -
GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
r1686 r1687 112 112 virtual float GetArea() const {return 0; } 113 113 virtual int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal) = 0; 114 115 virtual int GetRandomVisibleSurfacePoint(Vector3 &point,116 Vector3 &normal,117 const Vector3 &viewpoint,118 const int maxTries) = 0;119 120 virtual ostream &Describe(ostream &s) = 0;121 122 virtual int GenerateSilhouetteRays(const int nrays,123 const AxisAlignedBox3 &originBox,124 const AxisAlignedBox3 &directionBox, VssRayContainer &rays)125 {126 return 0;127 }128 114 129 static bool GreaterCounter(const Intersectable *a, 130 const Intersectable *b) 131 { 132 return a->mCounter > b->mCounter; 133 } 115 virtual int GetRandomVisibleSurfacePoint(Vector3 &point, 116 Vector3 &normal, 117 const Vector3 &viewpoint, 118 const int maxTries) = 0; 134 119 135 static string GetTypeName(Intersectable *obj) 136 { 137 switch(obj->Type()) 138 { 139 case MESH_INSTANCE: 140 return "mesh_instance\n"; 141 142 case TRANSFORMED_MESH_INSTANCE: 143 return "transformed_mesh_instance\n"; 144 145 case SPHERE: 146 return "sphere\n"; 120 virtual ostream &Describe(ostream &s) = 0; 147 121 148 case VIEW_CELL: 149 return "view cell\n"; 150 151 case OGRE_MESH_INSTANCE: 152 return "ogre_mesh_instance\n"; 122 virtual int GenerateSilhouetteRays(const int nrays, 123 const AxisAlignedBox3 &originBox, 124 const AxisAlignedBox3 &directionBox, VssRayContainer &rays) 125 { 126 return 0; 127 } 153 128 154 case KD_INTERSECTABLE: 155 return "kd_intersectable\n"; 129 static bool GreaterCounter(const Intersectable *a, 130 const Intersectable *b) 131 { 132 return a->mCounter > b->mCounter; 133 } 156 134 157 default: 158 return "unknown\n"; 159 } 160 } 135 static string GetTypeName(Intersectable *obj) 136 { 137 switch(obj->Type()) 138 { 139 case MESH_INSTANCE: 140 return "mesh_instance\n"; 161 141 162 /** returns normal from the face with the specified index. 163 PROBLEM: Does not fit to all intersectable types (e.g., spheres) 164 */ 165 virtual Vector3 GetNormal(const int idx) const { return Vector3(0, 0, 0); } 142 case TRANSFORMED_MESH_INSTANCE: 143 return "transformed_mesh_instance\n"; 144 145 case SPHERE: 146 return "sphere\n"; 147 148 case VIEW_CELL: 149 return "view cell\n"; 150 151 case OGRE_MESH_INSTANCE: 152 return "ogre_mesh_instance\n"; 153 154 case KD_INTERSECTABLE: 155 return "kd_intersectable\n"; 156 157 default: 158 return "unknown\n"; 159 } 160 } 161 162 /** returns normal from the face with the specified index. 163 PROBLEM: Does not fit to all intersectable types (e.g., spheres) 164 */ 165 virtual Vector3 GetNormal(const int idx) const { return Vector3(0, 0, 0); } 166 166 }; 167 167 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1686 r1687 721 721 tBackData.mMaxCostMisses = maxCostMisses; 722 722 723 //newNode->mRenderCostDecr = sc->GetRenderCostDecrease();724 //newNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr();725 726 // set the time stamp so the order of traversal can be reconstructed727 newNode->mTimeStamp = mHierarchyManager->mTimeStamp ++;728 729 723 mTotalCost -= sc->GetRenderCostDecrease(); 730 724 mTotalPvsSize += tFrontData.mPvs + tBackData.mPvs - tData.mPvs; … … 970 964 CreateViewCell(frontData, false); 971 965 CreateViewCell(backData, false); 966 967 // set the time stamp so the order of traversal can be reconstructed 968 interior->mTimeStamp = mHierarchyManager->mTimeStamp ++; 972 969 973 970 #if WORK_WITH_VIEWCELL_PVS … … 3306 3303 // create new interior node and two leaf node 3307 3304 const AxisAlignedPlane splitPlane = oldInterior->GetPlane(); 3308 const int maxCostMisses = sc->GetMaxCostMisses(); 3305 3306 // evaluate the changes in render cost and pvs entries 3307 EvalSubdivisionCandidate(*sc, false); 3309 3308 3310 3309 newNode = SubdivideNode(splitPlane, tData, tFrontData, tBackData); 3311 3310 3312 // how often was max cost ratio missed in this branch? 3313 tFrontData.mMaxCostMisses = maxCostMisses; 3314 tBackData.mMaxCostMisses = maxCostMisses; 3315 3316 newNode->mRenderCostDecr = oldNode->mRenderCostDecr + sc->GetRenderCostDecrease(); 3317 newNode->mPvsEntriesIncr = oldNode->mPvsEntriesIncr + sc->GetPvsEntriesIncr(); 3318 3311 oldNode->mRenderCostDecr += sc->GetRenderCostDecrease(); 3312 oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 3313 cout << "here4" << endl; 3314 3319 3315 ///////////// 3320 3316 //-- evaluate new split candidates for global greedy cost heuristics … … 3324 3320 3325 3321 frontCandidate->SetPriority((float)-oldInterior->GetFront()->mTimeStamp); 3326 backCandidate->SetPriority((float)-oldInterior->Get Front()->mTimeStamp);3322 backCandidate->SetPriority((float)-oldInterior->GetBack()->mTimeStamp); 3327 3323 3328 3324 frontCandidate->mEvaluationHack = oldInterior->GetFront();
Note: See TracChangeset
for help on using the changeset viewer.