Ignore:
Timestamp:
01/15/07 08:37:28 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1974 r1977  
    20272027                stat.avgPvs += pvsCost; 
    20282028 
    2029                 const float pvsEntries = mViewCellsTree->GetPvsEntries(viewcell); 
     2029                const float pvsEntries = (float)mViewCellsTree->GetPvsEntries(viewcell); 
    20302030                stat.avgPvsEntries += pvsEntries; 
    20312031                 
    2032  
    20332032                if (mPerViewCellStat[i].pvsSize > 0.0f) 
    20342033                  mPerViewCellStat[i].relPvsIncrease = (pvsCost - mPerViewCellStat[i].pvsSize)/mPerViewCellStat[i].pvsSize; 
     
    22802279          } 
    22812280         
     2281} 
     2282 
     2283 
     2284float ViewCellsManager::ComputeSampleContribution(VssRay &ray, 
     2285                                                                                                  const bool addRays, 
     2286                                                                                                  ViewCell *currentViewCell) 
     2287{ 
     2288        ray.mPvsContribution = 0; 
     2289        ray.mRelativePvsContribution = 0.0f; 
     2290 
     2291        if (!ray.mTerminationObject) 
     2292                return 0.0f; 
     2293 
     2294        static Ray hray; 
     2295        hray.Init(ray); 
     2296 
     2297        float tmin = 0, tmax = 1.0; 
     2298 
     2299        if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 
     2300        { 
     2301                // cerr<<"ray outside view space box\n"; 
     2302                return 0; 
     2303        } 
     2304 
     2305        Vector3 origin = hray.Extrap(tmin); 
     2306        Vector3 termination = hray.Extrap(tmax); 
     2307 
     2308        // traverse the view space subdivision 
     2309        if (!LineSegmentIntersects(origin,  
     2310                                                           termination,  
     2311                                                           currentViewCell)) 
     2312        { 
     2313                return 0; 
     2314        } 
     2315         
     2316        // optain pvs entry (can be different from hit object) 
     2317        Intersectable *terminationObj = GetIntersectable(ray, true); 
     2318 
     2319        ComputeViewCellContribution(currentViewCell,  
     2320                                                                ray,  
     2321                                                                terminationObj,  
     2322                                                                ray.mTermination,  
     2323                                                                addRays); 
     2324         
     2325#if USE_RAY_LENGTH_AS_CONTRIBUTION 
     2326        float c = 0.0f; 
     2327        if (terminationObj)  
     2328          c = ray.Length(); 
     2329        ray.mRelativePvsContribution = ray.mPvsContribution = c; 
     2330        return c; 
     2331#else 
     2332        return ABS_CONTRIBUTION_WEIGHT*ray.mPvsContribution + 
     2333          (1.0f - ABS_CONTRIBUTION_WEIGHT)*ray.mRelativePvsContribution; 
     2334#endif 
    22822335} 
    22832336 
     
    33303383 
    33313384 
     3385bool BspViewCellsManager::LineSegmentIntersects(const Vector3 &origin,  
     3386                                                                                                const Vector3 &termination,  
     3387                                                                                                ViewCell *viewCell) 
     3388{ 
     3389        return false; 
     3390} 
     3391 
     3392 
    33323393void ViewCellsManager::ExportMergedViewCells(const ObjectContainer &objects) 
    33333394{ 
     
    43164377 
    43174378 
     4379bool KdViewCellsManager::LineSegmentIntersects(const Vector3 &origin,  
     4380                                                                                           const Vector3 &termination,  
     4381                                                                                           ViewCell *viewCell) 
     4382{ 
     4383        return false; 
     4384} 
     4385 
     4386 
    43184387void KdViewCellsManager::CreateMesh(ViewCell *vc) 
    43194388{ 
     
    50895158{ 
    50905159        return mVspBspTree->CastLineSegment(origin, termination, viewcells); 
     5160} 
     5161 
     5162 
     5163bool VspBspViewCellsManager::LineSegmentIntersects(const Vector3 &origin,  
     5164                                                                                                   const Vector3 &termination,  
     5165                                                                                                   ViewCell *viewCell) 
     5166{ 
     5167        return false; 
    50915168} 
    50925169 
     
    61056182                                                                                        ViewCellContainer &viewcells) 
    61066183{ 
    6107         return mHierarchyManager->GetVspTree()->CastLineSegment(origin, termination, viewcells); 
     6184        return mHierarchyManager-> 
     6185                GetVspTree()->CastLineSegment(origin, termination, viewcells); 
     6186} 
     6187 
     6188 
     6189bool VspOspViewCellsManager::LineSegmentIntersects(const Vector3 &origin,  
     6190                                                                                                   const Vector3 &termination,  
     6191                                                                                                   ViewCell *viewCell) 
     6192{ 
     6193        return mHierarchyManager-> 
     6194                GetVspTree()->LineSegmentIntersects(origin, termination, viewCell); 
    61086195} 
    61096196 
Note: See TracChangeset for help on using the changeset viewer.