Changeset 1633 for GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
- Timestamp:
- 10/17/06 20:32:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1610 r1633 694 694 if (!LocalTerminationCriteriaMet(tData) && !globalCriteriaMet) 695 695 { 696 /////////// 696 697 //-- continue subdivision 698 697 699 VspTraversalData tFrontData; 698 700 VspTraversalData tBackData; … … 714 716 if (1) EvalSubdivisionStats(*sc); 715 717 718 ///////////// 716 719 //-- evaluate new split candidates for global greedy cost heuristics 717 720 … … 728 731 tQueue.Push(frontCandidate); 729 732 tQueue.Push(backCandidate); 730 731 // delete old leaf node732 // DEL_PTR(tData.mNode);733 734 // note: leaf is not destroyed because it is needed to collect 735 // dirty candidates in hierarchy manager 733 736 } 734 737 … … 825 828 826 829 splitCandidate.SetPriority(priority); 830 } 831 832 833 float VspTree::EvalPriority(const VspSubdivisionCandidate &splitCandidate) const 834 { 835 // compute global decrease in render cost 836 float oldRenderCost; 837 const float renderCostDecr = EvalRenderCostDecrease(splitCandidate.mSplitPlane, 838 splitCandidate.mParentData, 839 oldRenderCost); 840 841 #if 0 842 const float priority = (float)-splitCandidate.mParentData.mDepth; 843 #else 844 // take render cost of node into account 845 // otherwise danger of being stuck in a local minimum!! 846 const float factor = mRenderCostDecreaseWeight; 847 const float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 848 #endif 849 850 return priority; 827 851 } 828 852 … … 2872 2896 void VspTree::CollectDirtyCandidate(const VssRay &ray, 2873 2897 const bool isTermination, 2874 vector<SubdivisionCandidate *> &dirtyList) const 2898 vector<SubdivisionCandidate *> &dirtyList, 2899 const bool onlyUnmailed) const 2875 2900 { 2876 2901 … … 2882 2907 2883 2908 if (!obj) return; 2884 2909 2910 SubdivisionCandidate *candidate = NULL; 2911 2885 2912 switch (mHierarchyManager->GetObjectSpaceSubdivisionType()) 2886 2913 { … … 2892 2919 { 2893 2920 leaf->Mail(); 2894 dirtyList.push_back(leaf->mSubdivisionCandidate);2921 candidate = leaf->mSubdivisionCandidate; 2895 2922 } 2896 2923 break; … … 2903 2930 { 2904 2931 leaf->Mail(); 2905 // a candidate still attached to this node 2906 if (leaf->GetSubdivisionCandidate()) 2907 { 2908 dirtyList.push_back(leaf->GetSubdivisionCandidate()); 2909 } 2932 candidate = leaf->GetSubdivisionCandidate(); 2910 2933 } 2911 2934 break; 2912 2935 } 2913 2936 default: 2937 cerr << "not implemented yet" << endl; 2938 candidate = NULL; 2914 2939 break; 2915 2940 } 2941 2942 // is this leaf still a split candidate? 2943 if (candidate && (!onlyUnmailed || !candidate->Mailed())) 2944 { 2945 candidate->Mail(); 2946 dirtyList.push_back(candidate); 2947 } 2916 2948 } 2917 2949 2918 2950 2919 2951 void VspTree::CollectDirtyCandidates(VspSubdivisionCandidate *sc, 2920 vector<SubdivisionCandidate *> &dirtyList) 2952 vector<SubdivisionCandidate *> &dirtyList, 2953 const bool onlyUnmailed) 2921 2954 { 2922 2955 VspTraversalData &tData = sc->mParentData; … … 2933 2966 VssRay *ray = (*rit).mRay; 2934 2967 2935 CollectDirtyCandidate(*ray, true, dirtyList );2936 CollectDirtyCandidate(*ray, false, dirtyList);2968 CollectDirtyCandidate(*ray, true, dirtyList, onlyUnmailed); 2969 CollectDirtyCandidate(*ray, false, dirtyList, onlyUnmailed); 2937 2970 } 2938 2971 }
Note: See TracChangeset
for help on using the changeset viewer.