Ignore:
Timestamp:
01/20/06 22:32:51 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r561 r562  
    2626mTotalArea(0.0f), 
    2727mViewCellsFinished(false), 
    28 mMaxPvsSize(99999), 
     28mMaxPvsSize(9999999), 
     29mMinPvsSize(1), // only empty view cells are invalid 
    2930mMaxPvsRatio(1.0) 
    3031{ 
     
    3940mPostProcessSamples(0), 
    4041mVisualizationSamples(0), 
    41 mViewCellsFinished(false) 
     42mTotalAreaValid(false), 
     43mTotalArea(0.0f), 
     44mViewCellsFinished(false), 
     45mMaxPvsSize(9999999), 
     46mMinPvsSize(1), // only empty view cells are invalid 
     47mMaxPvsRatio(1.0) 
    4248{ 
    4349        mViewSpaceBox.Initialize(); 
     
    111117 
    112118bool ViewCellsManager::CheckValidity(ViewCell *vc,  
    113                                                                          float minPvsRatio,  
    114                                                                          float maxPvsRatio) const 
    115 { 
    116         if ((vc->GetPvs().GetSize() > mMaxPvsSize * maxPvsRatio) || 
    117                 (vc->GetPvs().GetSize() < mMaxPvsSize * minPvsRatio)) 
     119                                                                         int minPvsSize,  
     120                                                                         int maxPvsSize) const 
     121{ 
     122        if ((vc->GetPvs().GetSize() > mMaxPvsSize) || 
     123                (vc->GetPvs().GetSize() < mMinPvsSize)) 
    118124        {        
    119125                return false; 
     
    121127 
    122128        return true; 
     129} 
     130 
     131 
     132void ViewCellsManager::SetValidity(ViewCell *vc,  
     133                                                                   int minPvs,  
     134                                                                   int maxPvs) const 
     135{ 
     136        vc->SetValid(CheckValidity(vc, minPvs, maxPvs)); 
    123137} 
    124138 
     
    427441 
    428442 
     443int ViewCellsManager::GetMinPvsSize() const 
     444{ 
     445        return mMinPvsSize; 
     446} 
     447 
     448 
     449 
    429450float ViewCellsManager::GetMaxPvsRatio() const 
    430451{ 
     
    442463        // matt TODO: remove this!! 
    443464        Ray hray(ray); 
     465        //static Ray hray; 
     466        //hray.Init(ray.GetOrigin(), ray.GetDir(), Ray::LINE_SEGMENT); 
     467         
    444468        float tmin = 0, tmax = 1.0; 
    445469 
    446         //hray.Init(ray.GetOrigin(), ray.GetDir(), Ray::LINE_SEGMENT); 
    447470        if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 
    448471                return; 
     
    451474        Vector3 termination = hray.Extrap(tmax); 
    452475 
    453         CastLineSegment(origin, 
    454                                         termination, 
    455                                         viewcells); 
     476        CastLineSegment(origin, termination, viewcells); 
    456477        //Debug << "constribution: " << (int)viewcells.size() << endl; 
    457478        // copy viewcells memory efficiently 
     
    23732394                                                                                 ViewCell *vc) const 
    23742395{ 
    2375         if (CheckValidity(vc, 0.0, mMaxPvsRatio) && (mColorCode == 0)) // Random color 
     2396        if (CheckValidity(vc, mMinPvsSize, mMaxPvsSize) && (mColorCode == 0)) // Random color 
    23762397                return; 
    23772398 
     
    24062427        } 
    24072428 
    2408         m.mDiffuseColor.b = CheckValidity(vc, 0.0, mMaxPvsRatio) ? 1.0f : 0.0f; 
     2429        m.mDiffuseColor.b = CheckValidity(vc, mMinPvsSize, mMaxPvsSize) ? 1.0f : 0.0f; 
    24092430        m.mDiffuseColor.r = importance; 
    24102431        m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 
     
    24882509         
    24892510        mViewCellsFinished = true; 
     2511        mMaxPvsSize = (int)objects->size(); 
    24902512 
    24912513        FinalizeViewCells(true); 
    2492  
     2514         
    24932515        Debug << (int)mViewCells.size() << " view cells loaded" << endl; 
    24942516 
Note: See TracChangeset for help on using the changeset viewer.