Changeset 453 for trunk/VUT


Ignore:
Timestamp:
12/06/05 01:08:18 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h

    r439 r453  
    1212struct Triangle3; 
    1313class BspLeaf; 
     14class VspKdTree; 
     15class VspKdTreeLeaf; 
    1416 
    1517/** 
     
    5860}; 
    5961 
     62class VspKdViewCell: public ViewCell 
     63{ 
     64public: 
     65        VspKdViewCell(): mVspKdLeaves(0) {} 
     66        VspKdViewCell(Mesh *mesh):  
     67        ViewCell(mesh), mVspKdLeaves(0) {} 
     68 
     69        float GetSize() {return 0;} 
     70        /// Leaves which hold this view cell. 
     71        vector<VspKdTreeLeaf *> mVspKdLeaves; 
     72}; 
    6073#endif 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r452 r453  
    16811681                return false; 
    16821682 
    1683         int fdiff = fvc->GetPvs().Diff(bvc->GetPvs()); 
     1683        const int fdiff = fvc->GetPvs().Diff(bvc->GetPvs()); 
    16841684 
    16851685        if (fvc->GetPvs().GetSize() + fdiff < mMaxPvs) 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp

    r452 r453  
    2525#include "Ray.h" 
    2626#include "RayInfo.h" 
    27  
     27#include "ViewCellsManager.h" 
     28#include "ViewCell.h" 
    2829 
    2930// Static variables 
     
    269270        for (it = mRays.begin(); it != mRays.end(); ++ it) 
    270271                rays.push_back((*it).mRay); 
     272} 
     273 
     274ViewCell *VspKdTreeLeaf::GetViewCell() 
     275{ 
     276        return mViewCell; 
    271277} 
    272278 
     
    18731879{} 
    18741880 
    1875 int MergeCandidate::ComputePvsDifference() const 
    1876 { 
    1877         return 0; 
    1878 } 
    1879  
    18801881float MergeCandidate::EvaluateMergeCost() const 
    18811882{ 
    1882         return 0; 
    1883 } 
     1883        // pvs difference 
     1884        VspKdViewCell *vc1 = dynamic_cast<VspKdViewCell *>(mLeaf1->GetViewCell()); 
     1885        VspKdViewCell *vc2 = dynamic_cast<VspKdViewCell *>(mLeaf2->GetViewCell()); 
     1886 
     1887        const int diff1 = vc1->GetPvs().Diff(vc2->GetPvs()); 
     1888         
     1889        //const int diff2 = vc2->GetPvs().Diff(vc1->GetPvs()); 
     1890        //const float simDiff = (float)max(diff1, diff2); 
     1891 
     1892        const float oldCost =  
     1893                vc1->GetSize() * vc1->GetPvs().GetSize() +  
     1894                vc2->GetSize() * vc2->GetPvs().GetSize(); 
     1895 
     1896        const float mergedPvsCost =  
     1897                (diff1 + vc1->GetPvs().GetSize()) * 
     1898                (vc1->GetSize() + vc2->GetSize()); 
     1899 
     1900        return mergedPvsCost / oldCost; 
     1901} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h

    r452 r453  
    4949        /** Computes PVS difference between the leaves. 
    5050        */ 
    51         int ComputePvsDifference() const; 
     51        //int ComputePvsDifference() const; 
    5252 
    5353        /** Evaluates the merge costs of this leaf. 
     
    5757        friend bool operator<(const MergeCandidate &leafa, const MergeCandidate &leafb)  
    5858        { 
    59                 return leafa.ComputePvsDifference() < leafb.ComputePvsDifference(); 
     59                return leafa.EvaluateMergeCost() < leafb.EvaluateMergeCost(); 
    6060        } 
    6161}; 
     
    322322 
    323323        static int mailID; 
     324 
     325        /** Returns view cell. 
     326        */ 
     327        ViewCell *GetViewCell(); 
    324328 
    325329protected: 
Note: See TracChangeset for help on using the changeset viewer.