Changeset 1149


Ignore:
Timestamp:
07/25/06 08:42:07 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj

    r1148 r1149  
    2020                                Name="VCCLCompilerTool" 
    2121                                Optimization="0" 
    22                                 AdditionalIncludeDirectories="..\include;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\src;"$(CG_INC_PATH)";..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces" 
     22                                AdditionalIncludeDirectories="..\include;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\src;"$(CG_INC_PATH)";..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(BOOST_INCLUDE)"" 
    2323                                PreprocessorDefinitions="WIN32;_DEBUG;_LIB;" 
    2424                                MinimalRebuild="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r1147 r1149  
    22172217                                        "true"); 
    22182218         
     2219        RegisterOption("VspTree.maxTests", 
     2220                                        optInt, 
     2221                                        "vsp_max_tests=", 
     2222                                        "2000"); 
    22192223 
    22202224 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.cpp

    r863 r1149  
    165165} 
    166166 
     167 
    167168float RayInfo::SqrSegmentLength() const 
    168169{ 
     
    170171} 
    171172 
     173 
     174void GetRayInfoSets(const RayInfoContainer &sourceRays, 
     175                    const int maxSize, 
     176                                        RayInfoContainer &usedRays, 
     177                                        RayInfoContainer *savedRays) 
     178{ 
     179        const int limit = min(maxSize, (int)sourceRays.size()); 
     180        const float prop = (float)limit / ((float)sourceRays.size() + Limits::Small); 
     181 
     182        RayInfoContainer::const_iterator it, it_end = sourceRays.end(); 
     183 
     184        for (it = sourceRays.begin(); it != it_end; ++ it) 
     185        { 
     186                if (Random(1.0f) < prop) 
     187                        usedRays.push_back(*it); 
     188                else if (savedRays) 
     189                        savedRays->push_back(*it); 
     190        } 
    172191} 
     192 
     193} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.h

    r1147 r1149  
    9393        int ComputeRayIntersection(const Plane3 &splitPlane, float &t) const; 
    9494 
    95         /*friend void GetRaySets(const RayInfoContainer &sourceRays, 
    96                                                    const int maxSize, 
    97                                                    RayInfoContainer &usedRays, 
    98                                                    RayInfoContainer *savedRays) const;*/ 
     95        friend void GetRayInfoSets(const RayInfoContainer &sourceRays, 
     96                const int maxSize, 
     97                RayInfoContainer &usedRays, 
     98                RayInfoContainer *savedRays = NULL); 
    9999}; 
    100100 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r1147 r1149  
    13581358                                          float &position) 
    13591359{ 
    1360         RayInfoContainer usedRays, savedRays; 
    1361  
    1362 /*      if (mMaxTests < rays.size()) 
    1363         { 
    1364                 GetRaySets(rays, mMaxTests, usedRays, savedRays); 
     1360        RayInfoContainer usedRays; 
     1361 
     1362        if (mMaxTests < rays.size()) 
     1363        { 
     1364                GetRayInfoSets(rays, mMaxTests, usedRays); 
    13651365        } 
    13661366        else 
    1367         {*/ 
     1367        { 
    13681368                usedRays = rays; 
    1369         //} 
     1369        } 
    13701370 
    13711371        const float minBox = box.Min(axis); 
     
    14051405 
    14061406        // set all object as belonging to the front pvs 
    1407         for(ri = rays.begin(); ri != ri_end; ++ ri) 
     1407        for(ri = usedRays.begin(); ri != ri_end; ++ ri) 
    14081408        { 
    14091409                Intersectable *oObject = (*ri).mRay->mOriginObject; 
     
    15001500                         
    15011501                        // HACK: current positition is BETWEEN visibility events 
    1502                         if ((ci + 1) != ci_end) 
     1502                        if (0 && ((ci + 1) != ci_end)) 
     1503                        { 
    15031504                                currentPos = ((*ci).value + (*(ci + 1)).value) * 0.5f; 
     1505                        } 
    15041506                        else 
    1505                                 currentPos = (*ci).value;                        
     1507                currentPos = (*ci).value;                        
    15061508 
    15071509                        //Debug  << "pos=" << (*ci).value << "\t pvs=(" <<  pvsl << "," << pvsr << ")" << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1147 r1149  
    413413        Environment::GetSingleton()->GetBoolValue("VspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis); 
    414414         
    415         //Environment::GetSingleton()->GetFloatValue("VspTree.maxTotalMemory", mMaxTotalMemory); 
     415        Environment::GetSingleton()->GetIntValue("VspTree.maxTests", mMaxTests); 
    416416        Environment::GetSingleton()->GetFloatValue("VspTree.maxStaticMemory", mMaxMemory); 
    417417 
     
    13901390                                                                           float &position) 
    13911391{ 
    1392         RayInfoContainer *rays = tData.mRays; 
     1392        RayInfoContainer usedRays; 
     1393 
     1394        if (mMaxTests < (int)tData.mRays->size()) 
     1395        { 
     1396                GetRayInfoSets(*tData.mRays, mMaxTests, usedRays); 
     1397        } 
     1398        else 
     1399        { 
     1400                usedRays = *tData.mRays; 
     1401        } 
     1402 
    13931403        int pvsSize = tData.mPvs; 
    13941404 
     
    14011411        const float maxBand = minBox + mMaxBand * sizeBox; 
    14021412 
    1403         SortSplitCandidates(*rays, axis, minBand, maxBand); 
     1413        SortSplitCandidates(usedRays, axis, minBand, maxBand); 
    14041414 
    14051415        // prepare the sweep 
    14061416        // (note: returns pvs size, so there would be no need  
    14071417        // to give pvs size as argument) 
    1408         pvsSize = PrepareHeuristics(*rays); 
     1418        pvsSize = PrepareHeuristics(usedRays); 
    14091419 
    14101420        // go through the lists, count the number of objects left and right 
     
    14481458                         
    14491459                        // HACK: current positition is BETWEEN visibility events 
    1450                         if ((ci + 1) != ci_end) 
     1460                        if (0 && ((ci + 1) != ci_end)) 
    14511461                                currentPos = ((*ci).value + (*(ci + 1)).value) * 0.5f; 
    14521462                        else 
     
    32953305                         
    32963306                        // HACK: current positition is BETWEEN visibility events 
    3297                         if ((ci + 1) != ci_end) 
     3307                        if (0 && ((ci + 1) != ci_end)) 
    32983308                                currentPos = ((*ci).mPos + (*(ci + 1)).mPos) * 0.5f; 
    32993309                        else 
     
    33013311 
    33023312                        // note matt: can happen that volr is less than zero: bug or numerical error? 
    3303                         //if (volr < 0)         Debug << "warning!! " << totalVol << " " << volRightDecr << " " << volRightDecr - totalVol << endl; 
     3313                        //if (volr < 0) Debug << "warning!"; 
    33043314 
    33053315                        /*Debug << "pos: " << (*ci).mPos  
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h

    r1145 r1149  
    11331133        /// weight between render cost decrease and node render cost 
    11341134        float mRenderCostDecreaseWeight; 
     1135 
     1136        int mMaxTests; 
    11351137}; 
    11361138 
Note: See TracChangeset for help on using the changeset viewer.