Changeset 579 for trunk/VUT/GtpVisibilityPreprocessor/src
- Timestamp:
- 01/27/06 16:27:22 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp
r574 r579 1266 1266 "false"); 1267 1267 1268 RegisterOption("ViewCells.delayedConstruction", 1269 optBool, 1270 "-view_cells_delayed_construction", 1271 "false"); 1268 1272 1269 1273 1270 RegisterOption("ViewCells.Visualization.exportGeometry", -
trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
r577 r579 456 456 { 457 457 458 Debug << "type: rss" << endl; 459 458 460 cout<<"Rss Preprocessor started\n"<<flush; 459 461 // cout<<"Memory/ray "<<sizeof(VssRay)+sizeof(RssTreeNode::RayInfo)<<endl; -
trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp
r569 r579 2778 2778 Debug<<"Error: object Id out of range, Id="<<id<<" roots.size()="<<mRoots.size()<< 2779 2779 endl<<flush; 2780 id = mRoots.size()-1; // $$ last tree is used by all unsigned objects2780 id = (int)mRoots.size()-1; // $$ last tree is used by all unsigned objects 2781 2781 } 2782 2782 return mRoots[id]; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r577 r579 356 356 357 357 358 void ViewCellsManager::EvaluateRenderStatistics(float &totalRenderCost, 359 float &expectedRenderCost, 360 float &variance) 361 { 362 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 363 364 //-- compute expected value 365 366 totalRenderCost = 0; 367 368 for (it = mViewCells.begin(); it != it_end; ++ it) 369 { 370 ViewCell *vc = *it; 371 372 totalRenderCost += vc->GetPvs().GetSize() * vc->GetVolume(); 373 } 374 375 expectedRenderCost = totalRenderCost / (float)mViewCells.size(); 376 377 378 //-- compute variance 379 380 variance = 0; 381 382 for (it = mViewCells.begin(); it != it_end; ++ it) 383 { 384 ViewCell *vc = *it; 385 386 float renderCost = vc->GetPvs().GetSize() * vc->GetVolume(); 387 388 const float var = (expectedRenderCost - renderCost) * (expectedRenderCost - renderCost); 389 390 variance += var; 391 } 392 393 variance /= (float)mViewCells.size(); 394 } 395 396 397 358 398 void ViewCellsManager::AddViewCell(ViewCell *viewCell) 359 399 { -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
r577 r579 323 323 static ViewCellsManager *LoadViewCells(const string filename, ObjectContainer *objects); 324 324 325 /** Evaluates statistics values on view cells. 326 */ 327 void EvaluateRenderStatistics(float &totalRenderCost, 328 float &expectedRenderCost, 329 float &variance); 330 325 331 protected: 326 332 -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r578 r579 29 29 const float VspBspTree::sBalancedRaysTable[] = {1, -1, 0, 0, 0}; 30 30 31 int BspMergeCandidate::sMaxPvsSize = 0; 31 ViewCellsManager *BspMergeCandidate::sViewCellsManager = NULL; 32 //int BspMergeCandidate::sMaxPvsSize = 0; 32 33 //int BspMergeCandidate::sMinPvsSize = 0; 33 34 … … 37 38 38 39 float BspMergeCandidate::sOverallCost = 0; 40 float BspMergeCandidate::sExpectedCost = 0; 41 float BspMergeCandidate::sVariance = 0; 42 float BspMergeCandidate::sRenderCostWeight = 0.5f; 39 43 bool BspMergeCandidate::sUseArea = false; 40 41 42 int BspMergeCandidate::sUpperPvsLimit = 120; 43 int BspMergeCandidate::sLowerPvsLimit = 5; 44 45 46 47 /********************************************************************/ 48 /* class VspBspTree implementation */ 49 /********************************************************************/ 44 int BspMergeCandidate::sNumViewCells = 0; 45 46 //int upperPvsLimit = 120; 47 //int lowerPvsLimit = 5; 48 49 50 51 // pvs penalty can be different from pvs size 52 inline float EvalPvsPenalty(const int pvs, 53 const int lower, 54 const int upper) 55 { 56 // clamp to minmax values 57 if (pvs < lower) 58 return (float)lower; 59 if (pvs > upper) 60 return (float)upper; 61 62 return (float)pvs; 63 } 64 65 66 // penalty for pvs durint merge 67 inline float EvalPvsPenaltyForMerge(const int pvs, 68 const int lower, 69 const int upper) 70 { 71 // clamp to minmax values 72 if (pvs < lower) 73 return (float)lower; 74 if (pvs > upper) 75 return (float)upper; 76 77 return (float)pvs; 78 } 79 80 81 /**********************************************************************/ 82 /* class VspBspTree implementation */ 83 /**********************************************************************/ 50 84 51 85 … … 192 226 DEL_PTR(mSplitCandidates); 193 227 } 228 194 229 195 230 int VspBspTree::AddMeshToPolygons(Mesh *mesh, … … 1070 1105 #endif 1071 1106 1107 1072 1108 const float newCost = pvsBack * pBack + pvsFront * pFront; 1073 1109 const float oldCost = (float)pvsSize * pOverall + Limits::Small; … … 1388 1424 if (1) 1389 1425 { 1390 const float oldCost = pOverall * (float)totalPvs + Limits::Small; 1391 cost += mPvsFactor * (pvsFront * pFront + pvsBack * pBack) / oldCost; 1426 const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize(); 1427 const int upperPvsLimit = mViewCellsManager->GetMaxPvsSize(); 1428 1429 const float penaltyOld = EvalPvsPenalty(totalPvs, lowerPvsLimit, upperPvsLimit); 1430 1431 const float penaltyFront = EvalPvsPenalty(pvsFront, lowerPvsLimit, upperPvsLimit); 1432 const float penaltyBack = EvalPvsPenalty(pvsBack, lowerPvsLimit, upperPvsLimit); 1433 1434 const float oldCost = pOverall * (float)penaltyOld + Limits::Small; 1435 cost += mPvsFactor * (penaltyFront * pFront + penaltyBack * pBack) / oldCost; 1436 1392 1437 } 1393 1438 else … … 2673 2718 leaf->mPvs = new ObjectPvs(leaf->GetViewCell()->GetPvs()); 2674 2719 2675 BspMergeCandidate::sOverallCost +=2676 leaf->mProbability * leaf->mPvs->GetSize();2677 2720 //const float rc = leaf->mProbability * (float)leaf->mPvs->GetSize(); 2721 //BspMergeCandidate::sOverallCost += rc; 2722 2678 2723 // the same leaves must not be part of two merge candidates 2679 2724 leaf->Mail(); … … 2741 2786 new ObjectPvs(leaf->GetViewCell()->GetPvs()); 2742 2787 2743 BspMergeCandidate::sOverallCost +=2744 leaf->mProbability * leaf->mPvs->GetSize();2788 //BspMergeCandidate::sOverallCost += 2789 // leaf->mProbability * leaf->mPvs->GetSize(); 2745 2790 2746 2791 ++ numLeaves; … … 2767 2812 new ObjectPvs(leaf->GetViewCell()->GetPvs()); 2768 2813 2769 BspMergeCandidate::sOverallCost +=2770 leaf->mProbability * leaf->mPvs->GetSize();2814 //BspMergeCandidate::sOverallCost += 2815 // leaf->mProbability * leaf->mPvs->GetSize(); 2771 2816 2772 2817 ++ numLeaves; … … 2872 2917 2873 2918 2919 #if 1 2874 2920 int VspBspTree::MergeViewCells(const VssRayContainer &rays, const ObjectContainer &objects) 2875 2921 { 2876 BspMergeCandidate::sMaxPvsSize = mViewCellsManager->GetMaxPvsSize(); 2877 //BspMergeCandidate::sMinPvsSize = mViewCellsManager->GetMinPvsSize(); 2922 BspMergeCandidate::sViewCellsManager = mViewCellsManager; 2878 2923 BspMergeCandidate::sUseArea = mUseAreaForPvs; 2879 2924 2925 2926 //-- compute statistics values of initial view cells 2927 mViewCellsManager->EvaluateRenderStatistics(BspMergeCandidate::sOverallCost, 2928 BspMergeCandidate::sExpectedCost, 2929 BspMergeCandidate::sVariance); 2930 2931 2932 //BspMergeCandidate::sExpectedCost = 2933 // BspMergeCandidate::sOverallCost / BspMergeCandidate::sNumViewCells; 2934 2935 2936 ViewCellsManager::PvsStatistics pvsStats; 2937 mViewCellsManager->GetPvsStatistics(pvsStats); 2938 2939 static float expectedValue = pvsStats.avgPvs; 2940 2880 2941 // the current view cells are kept in this container 2881 2942 ViewCellContainer viewCells; … … 2885 2946 CollectViewCells(mRoot, true, viewCells, true); 2886 2947 } 2948 2949 2887 2950 ViewCell::NewMail(); 2888 2951 … … 2890 2953 mergeStats.Start(); 2891 2954 2892 //BspMergeCandidate::sOverallCost = mBox.SurfaceArea() * mBspStats.maxPvs;2893 2955 long startTime = GetTime(); 2894 2956 … … 2912 2974 startTime = GetTime(); 2913 2975 2976 // frequency stats are updated 2977 const int statsOut = 100; 2978 2979 // number of view cells withouth the invalid ones 2980 BspMergeCandidate::sNumViewCells = mBspStats.Leaves() - mBspStats.invalidLeaves; 2981 2982 // passes are needed for statistics, because we don't want to record 2983 // every merge 2984 const int maxMergesPerPass = 100; 2985 int pass = 0; 2986 2987 // maximal ratio of old expected render cost to expected render 2988 // when the the render queue has to be reset. 2989 const float ercMaxRatio = 0.7f; 2990 2991 cout << "actual merge starts now ... " << endl; 2992 2993 2994 2995 //-- use priority queue to merge leaf pairs 2996 2997 2998 while (!mMergeQueue.empty() && 2999 (BspMergeCandidate::sNumViewCells > mMergeMinViewCells) && 3000 (mMergeQueue.top().GetMergeCost() < mMergeMaxCostRatio * BspMergeCandidate::sOverallCost)) 3001 { 3002 3003 int mergedPerPass = 0; 3004 const float oldExpectedCost = BspMergeCandidate::sExpectedCost; 3005 3006 //#ifdef _DEBUG 3007 Debug << "abs mergecost: " << mMergeQueue.top().GetMergeCost() << " rel mergecost: " 3008 << mMergeQueue.top().GetMergeCost() / BspMergeCandidate::sOverallCost 3009 << " max ratio: " << mMergeMaxCostRatio << endl 3010 << " expected value: " << oldExpectedCost << endl; 3011 //#endif 3012 3013 while (!mMergeQueue.empty() && 3014 (BspMergeCandidate::sNumViewCells > mMergeMinViewCells) && 3015 (ercMaxRatio > oldExpectedCost / BspMergeCandidate::sExpectedCost) && 3016 (mMergeQueue.top().GetMergeCost() < mMergeMaxCostRatio * BspMergeCandidate::sOverallCost) && 3017 (maxMergesPerPass < mergedPerPass)); 3018 { 3019 Debug << "erc max ratio" << ercMaxRatio << endl; 3020 3021 BspMergeCandidate mc = mMergeQueue.top(); 3022 mMergeQueue.pop(); 3023 3024 // both view cells equal! 3025 if (mc.GetLeaf1()->GetViewCell() == mc.GetLeaf2()->GetViewCell()) 3026 continue; 3027 3028 if (mc.Valid()) 3029 { 3030 ViewCell::NewMail(); 3031 const float currentMergeCost = mc.GetMergeCost(); 3032 3033 MergeViewCells(mc.GetLeaf1(), mc.GetLeaf2()); 3034 3035 -- BspMergeCandidate::sNumViewCells; 3036 ++ mergeStats.merged; 3037 ++ mergedPerPass; 3038 3039 // increase absolute merge cost 3040 BspMergeCandidate::sOverallCost += mc.GetRenderCost(); 3041 BspMergeCandidate::sVariance = mc.GetVarianceIncr(); 3042 3043 BspMergeCandidate::sExpectedCost = 3044 BspMergeCandidate::sOverallCost / (float)BspMergeCandidate::sNumViewCells; 3045 3046 // stats 3047 if (mc.GetLeaf1()->IsSibling(mc.GetLeaf2())) 3048 ++ mergeStats.siblings; 3049 3050 if (0) 3051 { 3052 const int dist = 3053 TreeDistance(mc.GetLeaf1(), mc.GetLeaf2()); 3054 if (dist > mergeStats.maxTreeDist) 3055 mergeStats.maxTreeDist = dist; 3056 mergeStats.accTreeDist += dist; 3057 } 3058 3059 if ((mergeStats.merged % statsOut) == 0) 3060 { 3061 cout << "merged " << mergeStats.merged << " view cells" << endl; 3062 3063 mStats 3064 << "#Pass\n" << pass << endl 3065 << "#Merged\n" << mergeStats.merged << endl 3066 << "#Viewcells\n" << BspMergeCandidate::sNumViewCells << endl 3067 << "#OverallCost\n" << BspMergeCandidate::sOverallCost << endl 3068 << "#CurrentCost\n" << currentMergeCost << endl 3069 << "#RelativeCost\n" << currentMergeCost / BspMergeCandidate::sOverallCost << endl 3070 << "#CurrentPvs\n" << mc.GetLeaf1()->GetViewCell()->GetPvs().GetSize() << endl 3071 << "#MergedSiblings\n" << mergeStats.siblings << endl 3072 << "#AvgTreeDist\n" << mergeStats.AvgTreeDist() << endl 3073 << "#ExpectedCost\n" << BspMergeCandidate::sExpectedCost << endl 3074 << "#RatioExpectedCost\n" << oldExpectedCost / BspMergeCandidate::sExpectedCost << endl 3075 << "#variance\n" << BspMergeCandidate::sVariance << endl; 3076 3077 if (mExportMergedViewCells) 3078 ExportMergedViewCells(viewCells, objects, BspMergeCandidate::sNumViewCells); 3079 } 3080 } 3081 else 3082 { 3083 3084 // merge candidate not valid, because one of the leaves was already 3085 // merged with another one => validate and reinsert into queue 3086 mc.SetValid(); 3087 mMergeQueue.push(mc); 3088 } 3089 } 3090 3091 3092 ++ pass; 3093 } 3094 3095 mergeStats.overallCost = BspMergeCandidate::sOverallCost; 3096 3097 mergeStats.mergeTime = TimeDiff(startTime, GetTime()); 3098 mergeStats.Stop(); 3099 3100 Debug << mergeStats << endl << endl; 3101 3102 // delete the view cells which were already merged 3103 CLEAR_CONTAINER(mOldViewCells); 3104 3105 3106 //TODO: should return sample contributions? 3107 return mergeStats.merged; 3108 } 3109 3110 #else 3111 3112 int VspBspTree::MergeViewCells(const VssRayContainer &rays, const ObjectContainer &objects) 3113 { 3114 BspMergeCandidate::sViewCellsManager = mViewCellsManager; 3115 BspMergeCandidate::sUseArea = mUseAreaForPvs; 3116 3117 ViewCellsManager::PvsStatistics pvsStats; 3118 mViewCellsManager->GetPvsStatistics(pvsStats); 3119 3120 static float expectedValue = pvsStats.avgPvs; 3121 // the current view cells are kept in this container 3122 ViewCellContainer viewCells; 3123 if (mExportMergedViewCells) 3124 { 3125 ViewCell::NewMail(); 3126 CollectViewCells(mRoot, true, viewCells, true); 3127 } 3128 ViewCell::NewMail(); 3129 3130 MergeStatistics mergeStats; 3131 mergeStats.Start(); 3132 3133 //BspMergeCandidate::sOverallCost = mBox.SurfaceArea() * mBspStats.maxPvs; 3134 long startTime = GetTime(); 3135 3136 cout << "collecting merge candidates ... " << endl; 3137 3138 if (mUseRaysForMerge) 3139 { 3140 mergeStats.nodes = CollectMergeCandidates(rays); 3141 } 3142 else 3143 { 3144 vector<BspLeaf *> leaves; 3145 CollectLeaves(leaves); 3146 mergeStats.nodes = CollectMergeCandidates(leaves); 3147 } 3148 3149 cout << "fininshed collecting candidates" << endl; 3150 3151 mergeStats.collectTime = TimeDiff(startTime, GetTime()); 3152 mergeStats.candidates = (int)mMergeQueue.size(); 3153 startTime = GetTime(); 3154 3155 2914 3156 // number of view cells withouth the invalid ones 2915 3157 int nViewCells = mBspStats.Leaves() - mBspStats.invalidLeaves; 2916 2917 2918 // pass is needed for statistics. the last n passes are 2919 // recorded 2920 const int maxPasses = 1000; 2921 const int nextPass = 50; 2922 2923 int pass = max(nViewCells - mMergeMinViewCells - maxPasses, 0); 2924 3158 BspMergeCandidate::sExpectedCost = BspMergeCandidate::sOverallCost / (float)nViewCells; 3159 3160 // passes are needed for statistics, because we don't want to record 3161 // every merge 3162 const int mergesPerPass = 100; 3163 3164 int nextPass = 0; 3165 int pass = 0; 3166 3167 3168 Debug << "stats: " << nextStats << " " << statsIncr << endl; 2925 3169 cout << "actual merge starts now ... " << endl; 2926 3170 … … 2939 3183 mMergeQueue.pop(); 2940 3184 3185 2941 3186 // both view cells equal! 2942 3187 if (mc.GetLeaf1()->GetViewCell() == mc.GetLeaf2()->GetViewCell()) … … 2966 3211 ++ mergeStats.siblings; 2967 3212 3213 if (0) 2968 3214 const int dist = 2969 3215 TreeDistance(mc.GetLeaf1(), mc.GetLeaf2()); … … 2972 3218 mergeStats.accTreeDist += dist; 2973 3219 2974 if ((mergeStats.merged == pass) || (nViewCells == mMergeMinViewCells))3220 if ((mergeStats.merged == nextPass) || (nViewCells == mMergeMinViewCells)) 2975 3221 { 2976 pass += nextPass; 3222 nextPass += mergesPerPass; 3223 2977 3224 mStats 2978 3225 << "#Pass\n" << pass ++ << endl … … 2987 3234 2988 3235 if (mExportMergedViewCells) 2989 ExportMergedViewCells(viewCells, objects, nViewCells); 3236 ExportMergedViewCells(viewCells, objects, nViewCells); 2990 3237 } 2991 3238 } … … 3014 3261 return mergeStats.merged; 3015 3262 } 3263 #endif 3016 3264 3017 3265 … … 3467 3715 3468 3716 3469 /************************************************************************ /3470 /* BspMergeCandidate implementation */3471 /************************************************************************ /3717 /**************************************************************************/ 3718 /* BspMergeCandidate implementation */ 3719 /**************************************************************************/ 3472 3720 3473 3721 3474 3722 BspMergeCandidate::BspMergeCandidate(BspLeaf *l1, BspLeaf *l2): 3475 mMergeCost(0), 3723 mRenderCost(0), 3724 mVarianceIncr(0), 3476 3725 mLeaf1(l1), 3477 3726 mLeaf2(l2), … … 3483 3732 3484 3733 3485 float BspMergeCandidate::Get Cost(ViewCell *vc) const3734 float BspMergeCandidate::GetRenderCost(ViewCell *vc) const 3486 3735 { 3487 3736 if (sUseArea) … … 3495 3744 { 3496 3745 BspViewCell *vc = mLeaf1->GetViewCell(); 3497 return GetCost(vc); 3746 3747 return GetRenderCost(vc); 3498 3748 } 3499 3749 … … 3502 3752 { 3503 3753 BspViewCell *vc = mLeaf2->GetViewCell(); 3504 return GetCost(vc); 3754 3755 return GetRenderCost(vc); 3505 3756 } 3506 3757 … … 3533 3784 3534 3785 3535 inline float BspMergeCandidate::EvalPvsPenalty(int pvs) const3536 {3537 // clamp to minmax values3538 if (pvs > sUpperPvsLimit)3539 return (float)sUpperPvsLimit;3540 if (pvs < sLowerPvsLimit)3541 return (float)sLowerPvsLimit;3542 3543 return (float)pvs;3544 }3545 3546 3786 3547 3787 void BspMergeCandidate::EvalMergeCost() … … 3551 3791 BspViewCell *vc2 = mLeaf2->GetViewCell(); 3552 3792 3553 //const int diff1 = vc1->GetPvs().Diff(vc2->GetPvs());3554 //const int newPvs = diff1 + vc1->GetPvs().GetSize();3555 3793 const int newPvs = ComputeMergedPvsSize(vc1->GetPvs(), vc2->GetPvs()); 3556 const float f = EvalPvsPenalty(newPvs); 3794 const float newPenalty = 3795 EvalPvsPenalty(newPvs, 3796 sViewCellsManager->GetMinPvsSize(), 3797 sViewCellsManager->GetMaxPvsSize()); 3557 3798 3558 3799 //-- compute ratio of old cost … … 3566 3807 3567 3808 3568 if (newPvs > s MaxPvsSize) // strong penalty if pvs size too large3569 { 3570 m MergeCost = 1e15;3809 if (newPvs > sViewCellsManager->GetMaxPvsSize()) // strong penalty if pvs size too large 3810 { 3811 mRenderCost = 1e15; 3571 3812 } 3572 3813 else 3573 3814 { 3574 mMergeCost = newCost - oldCost; 3575 } 3815 mRenderCost = newCost - oldCost; 3816 } 3817 3818 // merge cost also takes variance into account 3819 3820 const float oldVar1 = GetLeaf1Variance(); 3821 const float oldVar2 = GetLeaf2Variance(); 3822 3823 const float newVar = (sExpectedCost - mRenderCost) * (sExpectedCost - mRenderCost); 3824 3825 mVarianceIncr = (newVar - oldVar1 - oldVar2) / sNumViewCells; 3826 //mMergeCost = mRenderCost + fabs(newPenalty - BspMergeCandidate::sExpectedCost) ; 3576 3827 } 3577 3828 … … 3589 3840 3590 3841 3591 BspLeaf *BspMergeCandidate::GetLeaf1() 3842 BspLeaf *BspMergeCandidate::GetLeaf1() const 3592 3843 { 3593 3844 return mLeaf1; … … 3595 3846 3596 3847 3597 BspLeaf *BspMergeCandidate::GetLeaf2() 3848 BspLeaf *BspMergeCandidate::GetLeaf2() const 3598 3849 { 3599 3850 return mLeaf2; … … 3611 3862 float BspMergeCandidate::GetMergeCost() const 3612 3863 { 3613 return mMergeCost; 3864 return mRenderCost * sRenderCostWeight + mVarianceIncr * (1.0f - sRenderCostWeight); 3865 } 3866 3867 3868 float BspMergeCandidate::GetRenderCost() const 3869 { 3870 return mRenderCost; 3871 } 3872 3873 3874 float BspMergeCandidate::GetVarianceIncr() const 3875 { 3876 return mVarianceIncr; 3877 } 3878 3879 float BspMergeCandidate::GetLeaf1Variance() const 3880 { 3881 const float leafCost = GetLeaf1Cost(); 3882 3883 return (sExpectedCost - leafCost) * (sExpectedCost - leafCost); 3884 } 3885 3886 3887 float BspMergeCandidate::GetLeaf2Variance() const 3888 { 3889 const float leafCost = GetLeaf2Cost(); 3890 3891 return (sExpectedCost - leafCost) * (sExpectedCost - leafCost); 3614 3892 } 3615 3893 -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
r578 r579 785 785 void SetLeaf2(BspLeaf *l); 786 786 787 BspLeaf *GetLeaf1() ;788 BspLeaf *GetLeaf2() ;787 BspLeaf *GetLeaf1() const; 788 BspLeaf *GetLeaf2() const; 789 789 790 790 /** Merge cost of this candidate pair. … … 792 792 float GetMergeCost() const; 793 793 794 /** Render cost of this candidate. 795 */ 796 float GetRenderCost() const; 797 798 /** returns increase in variance of this view cell. 799 */ 800 float GetVarianceIncr() const; 801 794 802 /** Returns cost of leaf 1. 795 803 */ 796 804 float GetLeaf1Cost() const; 805 797 806 /** Returns cost of leaf 2. 798 807 */ 799 808 float GetLeaf2Cost() const; 800 809 801 /// maximal pvs size 802 static int sMaxPvsSize; 803 /// minimal pvs size 804 //static int sMinPvsSize; 810 /** Variance of leaf1 811 */ 812 float GetLeaf1Variance() const; 813 814 /** Variance of leaf2 815 */ 816 float GetLeaf2Variance() const; 805 817 806 818 /// overall cost used to normalize cost ratio 807 819 static float sOverallCost; 808 // if area or volume should be used for the merge heuristics 820 static float sExpectedCost; 821 static float sVariance; 822 823 static int sNumViewCells; 824 825 // weights between variance and render cost increase (must between zero and one) 826 static float sRenderCostWeight; 827 828 /// if area or volume should be used for the merge heuristics 809 829 static bool sUseArea; 810 830 811 static int sUpperPvsLimit;812 static int sLowerPvsLimit;831 /// pointer to view cells manager 832 static ViewCellsManager *sViewCellsManager; 813 833 814 834 protected: … … 819 839 void EvalMergeCost(); 820 840 821 /** penalty for a given pvs size. 822 */ 823 inline float EvalPvsPenalty(int pvs) const; 824 825 /** Cost of a view cell. 826 */ 827 float GetCost(ViewCell *vc) const; 841 /** render cost of a view cell. 842 */ 843 float GetRenderCost(ViewCell *vc) const; 828 844 829 845 int mLeaf1Id; 830 846 int mLeaf2Id; 831 847 832 float mMergeCost; 833 848 /// render cost increase by this merge 849 float mRenderCost; 850 /// increase / decrease of variance 851 float mVarianceIncr; 852 834 853 BspLeaf *mLeaf1; 835 854 BspLeaf *mLeaf2; -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r577 r579 494 494 VssPreprocessor::ComputeVisibility() 495 495 { 496 496 Debug << "type: vss" << endl; 497 497 498 498 long startTime = GetTime(); … … 523 523 cout<<"mUseViewSpaceBox="<<mUseViewSpaceBox<<endl; 524 524 Debug << "use view space box=" << mUseViewSpaceBox << endl; 525 525 526 if (mUseViewSpaceBox) 526 527 { 527 mViewSpaceBox = box;528 mViewSpaceBox = box; 528 529 } 529 530 else 530 531 { 531 mViewSpaceBox = NULL;532 mViewSpaceBox = NULL; 532 533 } 533 534
Note: See TracChangeset
for help on using the changeset viewer.