Changeset 1289


Ignore:
Timestamp:
08/28/06 09:45:22 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
2 edited

Legend:

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

    r1287 r1289  
    15911591                        rayInf.ComputeRayIntersection(candidatePlane.mAxis,  
    15921592                                                                                  candidatePlane.mPosition, t); 
    1593 /* 
    1594                 if (!mUseKdPvsForHeuristics) 
     1593 
     1594                switch (mHierarchyManager->GetObjectSpaceSubdivisonType()) 
     1595                { 
     1596                case HierarchyManager::NO_OBJ_SUBDIV: 
    15951597                { 
    15961598                        // find front and back pvs for origing and termination object 
    15971599                        UpdateObjPvsContri(ray->mTerminationObject, cf, pvsFront, pvsBack, totalPvs); 
    15981600                        UpdateObjPvsContri(ray->mOriginObject, cf, pvsFront, pvsBack, totalPvs); 
     1601 
     1602                        break; 
     1603                } 
     1604                case HierarchyManager::KD_BASED_OBJ_SUBDIV: 
     1605                { 
     1606                        break; 
     1607                } 
     1608                case HierarchyManager::BV_BASED_OBJ_SUBDIV: 
     1609                { 
     1610                        BvhLeaf *tLeaf = mHierarchyManager->mBvHierarchy->GetLeaf(ray->mTerminationObject); 
     1611                        BvhLeaf *oLeaf = mHierarchyManager->mBvHierarchy->GetLeaf(ray->mOriginObject); 
     1612 
     1613                        UpdateBvNodePvsContri(tLeaf, cf, pvsFront, pvsBack, totalPvs); 
     1614                        UpdateBvNodePvsContri(oLeaf, cf, pvsFront, pvsBack, totalPvs); 
     1615                         
     1616                        break; 
     1617                } 
     1618        default: 
     1619                break; 
     1620        } 
     1621 
     1622/* 
     1623                if (!mUseKdPvsForHeuristics) 
     1624                { 
     1625                         
    15991626                } 
    16001627                else 
     
    17021729 
    17031730void VspTree::UpdateObjPvsContri(Intersectable *obj, 
    1704                                                   const int cf, 
    1705                                                   float &frontPvs, 
    1706                                                   float &backPvs, 
    1707                                                   float &totalPvs) const 
     1731                                                                const int cf, 
     1732                                                                float &frontPvs, 
     1733                                                                float &backPvs, 
     1734                                                                float &totalPvs) const 
    17081735{ 
    17091736        if (!obj) return; 
     
    17501777        } 
    17511778} 
     1779 
     1780 
     1781void VspTree::UpdateBvhLeafPvsContri(BvhLeaf *leaf, 
     1782                                                                         const int cf, 
     1783                                                                         float &frontPvs, 
     1784                                                                         float &backPvs, 
     1785                                                                         float &totalPvs) const 
     1786{ 
     1787        if (!leaf) return; 
     1788 
     1789        const int renderCost = (int)leaf->mObjects.size(); 
     1790 
     1791        // leaf in no pvs => new 
     1792        if (!leaf->Mailed() && !leaf->Mailed(1) && !leaf->Mailed(2)) 
     1793        { 
     1794                totalPvs += renderCost; 
     1795        } 
     1796 
     1797        // QUESTION matt: is it safe to assume that  
     1798        // the leaf belongs to no pvs in this case? 
     1799        //if (cf == Ray::COINCIDENT) return; 
     1800 
     1801        if (cf >= 0) // front pvs 
     1802        { 
     1803                if (!leaf->Mailed() && !leaf->Mailed(2)) 
     1804                { 
     1805                        frontPvs += renderCost; 
     1806                 
     1807                        // already in back pvs => in both pvss 
     1808                        if (leaf->Mailed(1)) 
     1809                                leaf->Mail(2); 
     1810                        else 
     1811                                leaf->Mail(); 
     1812                } 
     1813        } 
     1814 
     1815        if (cf <= 0) // back pvs 
     1816        { 
     1817                if (!leaf->Mailed(1) && !obj->Mailed(2)) 
     1818                { 
     1819                        backPvs += renderCost; 
     1820                 
     1821                        // already in front pvs => in both pvss 
     1822                        if (leaf->Mailed()) 
     1823                                leaf->Mail(2); 
     1824                        else 
     1825                                leaf->Mail(1); 
     1826                } 
     1827        } 
     1828} 
     1829 
    17521830 
    17531831 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r1259 r1289  
    831831         
    832832        */ 
    833         void UpdateObjPvsContri(Intersectable *obj,  
    834                                          const int cf,  
    835                                          float &frontPvs,  
    836                                          float &backPvs,  
    837                                          float &totalPvs) const; 
     833        void UpdateObjPvsContri( 
     834                Intersectable *obj,  
     835                const int cf,  
     836                float &frontPvs,  
     837                float &backPvs,  
     838                float &totalPvs) const; 
     839 
     840        void UpdateBvhLeafPvsContri( 
     841                BvhLeaf *leaf, 
     842                const int cf, 
     843                float &frontPvs, 
     844                float &backPvs, 
     845                float &totalPvs) const; 
     846 
    838847         
    839848        /** See UpdateObjPvsContri.  
Note: See TracChangeset for help on using the changeset viewer.