Ignore:
Timestamp:
02/15/07 00:35:41 (17 years ago)
Author:
mattausch
Message:

implemented hashpvs

File:
1 edited

Legend:

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

    r2115 r2116  
    2828 
    2929 
     30 
    3031#define USE_RAY_LENGTH_AS_CONTRIBUTION 0 
    3132#define DIST_WEIGHTED_CONTRIBUTION 0 
     
    170171        } 
    171172                 
    172     Debug << "casting initial strategies: "; 
    173  
     173    Debug << "casting strategies: "; 
    174174        for (int i = 0; i < (int)mStrategies.size(); ++ i) 
    175175                Debug << mStrategies[i] << " "; 
     
    730730{ 
    731731        long startTime = GetTime(); 
    732  
     732         
    733733        SimpleRayContainer simpleRays; 
    734734         
     
    10181018 
    10191019 
    1020 ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename,  
    1021                                                                                                   ObjectContainer &pvsObjects, 
    1022                                                                                                   bool finalizeViewCells, 
    1023                                                                                                   BoundingBoxConverter *bconverter) 
    1024                                                                                                   
    1025 { 
    1026         ObjectContainer dummys; 
    1027  
    1028         return LoadViewCells(filename,  
    1029                                                  pvsObjects, 
    1030                                                  dummys, 
    1031                                                  finalizeViewCells, 
    1032                                                  bconverter); 
    1033 } 
    10341020 
    10351021 
     
    10591045        } 
    10601046         
     1047        //cout << "viewcells parsed " <<endl; 
     1048 
    10611049        if (0) 
    10621050        { 
     
    11271115                if (mUseKdPvs) 
    11281116                { 
    1129                         vector<KdIntersectable *>::iterator kit, kit_end =  
    1130                                 GetPreprocessor()->mKdTree->mKdIntersectables.end(); 
     1117                        vector<KdIntersectable *>::iterator kit, kit_end = GetPreprocessor()->mKdTree->mKdIntersectables.end(); 
    11311118 
    11321119                        int id = 0; 
     
    11381125                                obj->SetId(id); 
    11391126         
    1140                                 stream << "<BoundingBox" << " id=\""    << id << "\"" 
    1141                                            << " min=\""      << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
    1142                                            << " max=\""      << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
     1127                                stream << "<BoundingBox" << " id=\"" << id << "\"" 
     1128                                           << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
     1129                                           << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
    11431130                        } 
    11441131                } 
     
    11541141                                //-- the bounding boxes 
    11551142 
    1156                                 stream << "<BoundingBox" << " id=\""    << (*oit)->GetId()    << "\"" 
    1157                                            << " min=\""      << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
    1158                                            << " max=\""      << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
     1143                                stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 
     1144                                           << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
     1145                                           << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
    11591146                        } 
    11601147                } 
     
    15601547                 
    15611548                castSamples += samplesPerPass; 
    1562                 //HashPvs<int> dummy; 
    15631549 
    15641550                Real timeDiff = TimeDiff(startTime, GetTime()); 
     
    20702056                                                                                         const bool useHitObjects) 
    20712057{ 
    2072   float sum = 0.0f; 
    2073  
    2074   VssRayContainer::const_iterator it, it_end = rays.end(); 
    2075  
    2076   for (it = rays.begin(); it != it_end; ++ it)  
    2077         { 
    2078           if (!ViewCellsConstructed()) { 
    2079                 // view cells not yet constructed 
    2080                 // just take the lenghts of the rays as contributions 
    2081                 if ((*it)->mTerminationObject) 
    2082                   sum += (*it)->Length(); 
    2083           } else { 
    2084                 sum += ComputeSampleContribution(*(*it), addRays, storeViewCells, useHitObjects); 
    2085           } 
    2086         } 
    2087  
    2088   //cout<<"view cell cast time:"<<viewCellCastTimer.TotalTime()<<" s"<<endl; 
    2089  // cout<<"pvs time:"<<pvsTimer.TotalTime()<<" s"<<endl; 
    2090    
    2091   return sum; 
     2058        float sum = 0.0f; 
     2059 
     2060        VssRayContainer::const_iterator it, it_end = rays.end(); 
     2061 
     2062        for (it = rays.begin(); it != it_end; ++ it)  
     2063        { 
     2064                if (!ViewCellsConstructed())  
     2065                { 
     2066                        // view cells not yet constructed 
     2067                        // just take the lenghts of the rays as contributions 
     2068                        if ((*it)->mTerminationObject) 
     2069                        { 
     2070                                sum += (*it)->Length(); 
     2071                        } 
     2072                }  
     2073                else  
     2074                { 
     2075                        sum += ComputeSampleContribution(*(*it), addRays, storeViewCells, useHitObjects); 
     2076                } 
     2077        } 
     2078 
     2079        cout << "view cell cast time: " << viewCellCastTimer.TotalTime() << " s" << endl; 
     2080        Debug << "view cell cast time: " << viewCellCastTimer.TotalTime() << " s" << endl; 
     2081 
     2082        cout << "pvs time: " << pvsTimer.TotalTime() << " s" << endl; 
     2083        Debug << "pvs time: " << pvsTimer.TotalTime() << " s" << endl; 
     2084         
     2085        return sum; 
    20922086} 
    20932087 
Note: See TracChangeset for help on using the changeset viewer.