Ignore:
Timestamp:
01/23/06 18:34:47 (18 years ago)
Author:
mattausch
Message:

construction method for view cells

File:
1 edited

Legend:

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

    r568 r570  
    19801980                                bool isAdjacent = true; 
    19811981 
    1982                         /*      if (1) 
     1982                                if (1) 
    19831983                                { 
    19841984                                        // test all planes of current node if still adjacent 
     
    20142014                                                } 
    20152015                                        } 
    2016                                 }*/ 
     2016                                } 
    20172017                                // neighbor was found 
    20182018                                if (isAdjacent) 
     
    31153115        queue<BspMergeCandidate> *backQueue = &queue2; 
    31163116 
    3117 #if 1 
    3118     Exporter *exporter = Exporter::GetExporter("neighors.x3d"); 
    3119  
    3120         if (exporter) 
    3121         { 
    3122                 cout << "exporting neighbors ... "; 
    3123                 exporter->ExportGeometry(objects); 
    3124         } 
    3125  
    3126         // HACK for visualization 
    3127         //ViewCellContainer viewCells; 
    3128         //ViewCell::NewMail(); 
    3129         //CollectViewCells(mRoot, true, viewCells, true); 
    3130         //for (int i = 0; i < viewCells.size(); ++i) 
    3131         //      viewCells[i]->SetId((int)RandomValue(0, Real(256*256*256))); 
    3132          
    3133          
    31343117        while (!mMergeQueue.empty()) 
    31353118        { 
     
    31373120                shuffleQueue->push(mc); 
    31383121                mMergeQueue.pop(); 
    3139  
    3140                 // visualize neighbors 
    3141                 Material m = RandomMaterial(); 
    3142                 exporter->SetForcedMaterial(m); 
    3143          
    3144  
    3145                 if (!mc.GetLeaf1()->Mailed()) 
    3146                 { 
    3147                         BspNodeGeometry geom1; 
    3148                         ConstructGeometry(mc.GetLeaf1(), geom1); 
    3149                         //m.mDiffuseColor.r = (mc.GetLeaf1()->GetViewCell()->GetId() & 256)/ 255.0f; 
    3150                         //m.mDiffuseColor.g = ((mc.GetLeaf1()->GetViewCell()->GetId()>>8) & 256)/ 255.0f; 
    3151                         //m.mDiffuseColor.b = ((mc.GetLeaf1()->GetViewCell()->GetId()>>16) & 256)/ 255.0f; 
    3152                         //exporter->SetForcedMaterial(m); 
    3153                         exporter->ExportPolygons(geom1.mPolys); 
    3154                         mc.GetLeaf1()->Mail(); 
    3155                 } 
    3156  
    3157                 if (!mc.GetLeaf2()->Mailed()) 
    3158                 { 
    3159                         BspNodeGeometry geom2; 
    3160                         ConstructGeometry(mc.GetLeaf2(), geom2); 
    3161                         //m.mDiffuseColor.r = (mc.GetLeaf2()->GetViewCell()->GetId() & 256)/ 255.0f; 
    3162                         //m.mDiffuseColor.g = ((mc.GetLeaf2()->GetViewCell()->GetId()>>8) & 256)/ 255.0f; 
    3163                         //m.mDiffuseColor.b = ((mc.GetLeaf2()->GetViewCell()->GetId()>>16) & 256)/ 255.0f; 
    3164                         //exporter->SetForcedMaterial(m); 
    3165                         exporter->ExportPolygons(geom2.mPolys); 
    3166                         mc.GetLeaf2()->Mail(); 
    3167                 }                
    3168         } 
    3169  
    3170         if (exporter) 
    3171         { 
    3172                 cout << "finished" << endl; 
    3173                 delete exporter; 
    3174         } 
    3175 #else 
    3176         while (!mMergeQueue.empty()) 
    3177         { 
    3178                 BspMergeCandidate mc = mMergeQueue.top(); 
    3179                 shuffleQueue->push(mc); 
    3180                 mMergeQueue.pop(); 
    3181         } 
    3182 #endif 
     3122        } 
     3123 
    31833124        const int numPasses = 5; 
    31843125        int pass = 0; 
     
    32573198        //const int pvs1 = SubtractedPvsSize(vc1, leaf, *leaf->mPvs); 
    32583199        const int pvs1 = SubtractedPvsSize(vc1->GetPvs(), *leaf->mPvs); 
    3259          
    32603200        const int pvs2 = AddedPvsSize(vc2->GetPvs(), *leaf->mPvs); 
    32613201 
     
    32773217        } 
    32783218 
    3279         const float cost1 = (float)pvs1 * p1; 
    3280         const float cost2 = (float)pvs2 * p2; 
     3219        const float cost1 = (float)pvs1;// * p1; 
     3220        const float cost2 = (float)pvs2;// * p2; 
    32813221 
    32823222        return cost1 + cost2; 
     
    33303270        BspViewCell *vc2 = leaf2->GetViewCell(); 
    33313271 
    3332         float cost1;  
    3333         float cost2;  
    3334  
    3335         if (mUseAreaForPvs) 
     3272        float cost1 = vc1->GetPvs().GetSize();  
     3273        float cost2 = vc2->GetPvs().GetSize();  
     3274 
     3275        /*if (mUseAreaForPvs) 
    33363276        { 
    33373277                cost1 = vc1->GetPvs().GetSize() * vc1->GetArea(); 
     
    33423282                cost1 = vc1->GetPvs().GetSize() * vc1->GetVolume(); 
    33433283                cost2 = vc2->GetPvs().GetSize() * vc2->GetVolume(); 
    3344         } 
     3284        }*/ 
    33453285 
    33463286        const float oldCost = cost1 + cost2; 
     
    34503390} 
    34513391 
     3392 
    34523393/************************************************************************/ 
    34533394/*                BspMergeCandidate implementation                      */ 
Note: See TracChangeset for help on using the changeset viewer.