Ignore:
Timestamp:
01/13/06 17:39:43 (19 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp

    r532 r535  
    2929const float VspBspTree::sBalancedRaysTable[] = {1, -1, 0, 0, 0}; 
    3030 
     31int BspMergeCandidate::sMaxPvsSize = 0; 
    3132 
    3233int VspBspTree::sFrontId = 0; 
     
    311312 
    312313        mMaxPvs = (int)(mMaxPvsRatio * (float)numObj); 
    313         Debug << "maximal pvs where view cell is valid: " << mMaxPvs << endl; 
     314         
     315        Debug << "maximal pvs (i.e., view cell considered as valid: " << mMaxPvs << endl; 
    314316        //-- store rays 
    315317        for (rit = sampleRays.begin(); rit != rit_end; ++ rit) 
     
    424426                 (data.mArea <= mTermMinArea) || 
    425427                 (mStat.Leaves() >= mMaxViewCells) || 
    426                  (data.GetAvgRayContribution() >= mTermMaxRayContribution) || 
     428                 (data.GetAvgRayContribution() > mTermMaxRayContribution) || 
    427429                 (data.mDepth >= mTermMaxDepth)); 
    428430} 
     
    21592161typedef pair<BspNode *, BspNodeGeometry *> bspNodePair; 
    21602162 
     2163 
    21612164int VspBspTree::CastBeam(Beam &beam) 
    21622165{ 
     
    21762179                 
    21772180                AxisAlignedBox3 box; 
    2178                 geom->ComputeBoundingBox(box); 
    2179  
    2180                 int side = beam.ComputeIntersection(box); 
     2181                box.Initialize(); 
     2182                geom->IncludeInBox(box); 
     2183 
     2184                Debug << "box:\n " << box << endl;; 
     2185                const int side = beam.ComputeIntersection(box); 
    21812186                 
    21822187                switch (side)  
    21832188                { 
    21842189                case -1: 
     2190                        Debug << "here999" << endl; 
    21852191                        CollectViewCells(node, beam.mViewCells, true); 
    21862192                        break; 
    21872193                case 0: 
     2194                         
    21882195                        if (node->IsLeaf()) 
    21892196                        { 
    2190                                 BspLeaf *leaf = dynamic_cast<BspLeaf *>(leaf); 
     2197                                Debug << "here2" << endl; 
     2198                                BspLeaf *leaf = dynamic_cast<BspLeaf *>(node); 
     2199                         
    21912200                                if (!leaf->GetViewCell()->Mailed() && leaf->TreeValid()) 
     2201                                { 
     2202                                        leaf->GetViewCell()->Mail(); 
    21922203                                        beam.mViewCells.push_back(leaf->GetViewCell()); 
     2204                                } 
    21932205                        } 
    21942206                        else  
    21952207                        { 
     2208                                Debug << "here77" << endl; 
    21962209                                BspInterior *interior = dynamic_cast<BspInterior *>(node); 
     2210                         
    21972211                                BspNode *first = interior->GetBack(); 
    21982212                                BspNode *second = interior->GetFront(); 
    2199                  
     2213             
     2214                                BspNodeGeometry *firstGeom = new BspNodeGeometry(); 
     2215                                BspNodeGeometry *secondGeom = new BspNodeGeometry(); 
     2216 
     2217                                ConstructGeometry(first, *firstGeom); 
     2218                                ConstructGeometry(second, *secondGeom); 
     2219 
    22002220                                // decide on the order of the nodes 
    22012221                                if (DotProd(beam.mPlanes[0].mNormal,  
     
    22032223                                { 
    22042224                                        swap(first, second); 
     2225                                        swap(firstGeom, secondGeom); 
    22052226                                } 
    22062227 
    2207                                 BspNodeGeometry *leftGeom = new BspNodeGeometry(); 
    2208                                 BspNodeGeometry *rightGeom = new BspNodeGeometry(); 
    2209  
    2210                                 ConstructGeometry(first, *leftGeom); 
    2211                                 ConstructGeometry(second, *rightGeom); 
    2212  
    2213                                 nodeStack.push(bspNodePair(first, leftGeom)); 
    2214                                 nodeStack.push(bspNodePair(second, rightGeom)); 
     2228                                nodeStack.push(bspNodePair(first, firstGeom)); 
     2229                                nodeStack.push(bspNodePair(second, secondGeom)); 
    22152230                        } 
     2231                         
    22162232                        break; 
     2233                        Debug << "culling!!" << endl; 
    22172234                        // default: cull 
    22182235                } 
     2236                Debug << "here4" << endl; 
    22192237                DEL_PTR(geom); 
     2238                 
    22202239        } 
    22212240 
     
    24712490int VspBspTree::MergeViewCells(const VssRayContainer &rays) 
    24722491{ 
     2492        BspMergeCandidate::sMaxPvsSize = mMaxPvs; 
     2493 
    24732494        MergeStatistics mergeStats; 
    24742495        mergeStats.Start(); 
     
    28662887 
    28672888        mMergeCost = newCost - oldCost; 
    2868 //      if (vcPvs > sMaxPvsSize) // strong penalty if pvs size too large 
    2869 //              mMergeCost += 1.0; 
     2889        if (newPvs > sMaxPvsSize) // strong penalty if pvs size too large 
     2890                mMergeCost += 1.0; 
    28702891} 
    28712892 
Note: See TracChangeset for help on using the changeset viewer.