Changeset 1566


Ignore:
Timestamp:
10/04/06 11:11:51 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
3 edited

Legend:

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

    r1563 r1566  
    8585                //cout << " h " << mSampleContriPerPass << " " << mSamplesPerPass << " " << mTotalSamples << endl; 
    8686                mRayQueue.push(vssRay); 
    87                 //mVssRays.push_back(new VssRay(*vssRay)); 
     87                mVssRays.push_back(new VssRay(*vssRay)); 
    8888        ++ mSampleContriPerPass; 
    8989 
     
    184184                SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin); 
    185185         
     186                // cast ray into the new subdivision point 
    186187                VssRay *newRay = mRayCaster->CastRay(sray, mViewCellsManager->GetViewSpaceBox(), false); 
    187188                //cout << "\np1: " << p1 << "\np : " <<  p << "\np2: " << p2 << endl; 
     
    190191                const bool enqueued = HandleRay(newRay); 
    191192                 
     193                // subdivide further 
    192194                const int s1 = SubdivideEdge(hitTriangle, p1, p, x, *newRay, oldRay); 
    193195                const int s2 = SubdivideEdge(hitTriangle, p, p2, *newRay, y, oldRay); 
     
    234236                simpleRays.AddRay(sr); 
    235237        } 
    236 #if 0 
    237         VizStruct dummy; 
    238         dummy.enlargedTriangle = new Polygon3(enlargedTriangle); 
    239         dummy.originalTriangle = hitTriangle; 
    240         //dummy.ray = new VssRay(currentRay); 
    241         vizContainer.push_back(dummy); 
    242 #endif 
     238 
     239        if (0) 
     240        { 
     241                VizStruct dummy; 
     242                dummy.enlargedTriangle = new Polygon3(enlargedTriangle); 
     243                dummy.originalTriangle = hitTriangle; 
     244                //dummy.ray = new VssRay(currentRay); 
     245                vizContainer.push_back(dummy); 
     246        } 
    243247 
    244248        // cast rays to triangle vertices and determine visibility 
     
    363367 
    364368        mTotalSampleContri += mSampleContriPerPass; 
    365  
    366369        return castSamples; 
    367370} 
     
    439442 
    440443                mViewCellsManager->PrintPvsStatistics(mStats); 
     444 
     445                // visualization 
     446//              mViewCellsManager->Visualize(mVssRays); 
     447                CLEAR_CONTAINER(mVssRays); 
    441448                // ComputeRenderError(); 
    442449                ++ mPass; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1563 r1566  
    42274227        } 
    42284228 
    4229         int limit = min(leafOut, (int)mViewCells.size()); 
    4230  
    4231         int raysOut = 0; 
    4232  
     4229        ////////// 
    42334230        //-- some rays for output 
     4231 
     4232        const int limit = min(leafOut, (int)mViewCells.size()); 
     4233        const int raysOut = min((int)rays.size(), 100); 
     4234 
    42344235        for (int i = 0; i < limit; ++ i) 
    42354236        { 
     
    42464247                mViewCellsTree->GetPvs(vc, pvs); 
    42474248 
    4248                 //bspLeaves[j]->Mail(); 
    42494249                char s[64]; sprintf(s, "bsp-pvs%04d.wrl", i); 
    42504250                Exporter *exporter = Exporter::GetExporter(s); 
     
    42524252                Debug << i << ": pvs size=" << (int)mViewCellsTree->GetPvsSize(vc) << endl; 
    42534253 
    4254                 //-- export the sample rays 
    42554254                if (mExportRays) 
    42564255                { 
    4257                         // output rays stored with the view cells during subdivision 
     4256                        //////////// 
     4257                        //-- export rays piercing this view cell 
     4258 
     4259                        // take rays stored with the view cells during subdivision 
    42584260                        VssRayContainer vcRays; 
    42594261            VssRayContainer collectRays; 
    42604262 
    4261                         raysOut = min((int)rays.size(), 100); 
    4262  
    4263                         // collect intial view cells 
     4263                        // collect initial view cells 
    42644264                        ViewCellContainer leaves; 
    42654265                        mViewCellsTree->CollectLeaves(vc, leaves); 
    42664266 
    42674267                        ViewCellContainer::const_iterator vit, vit_end = leaves.end(); 
    4268         
    4269                         for (vit = leaves.begin(); vit != vit_end; ++ vit) 
     4268                for (vit = leaves.begin(); vit != vit_end; ++ vit) 
    42704269                        { 
    42714270                                BspLeaf *vcLeaf = dynamic_cast<BspViewCell *>(*vit)->mLeaves[0]; 
    4272                                  
    42734271                                VssRayContainer::const_iterator rit, rit_end = vcLeaf->mVssRays.end(); 
    42744272 
     
    42794277                        } 
    42804278 
     4279                        // prepare some rays for output 
    42814280                        VssRayContainer::const_iterator rit, rit_end = collectRays.end(); 
    4282  
    42834281                        for (rit = collectRays.begin(); rit != rit_end; ++ rit) 
    42844282                        { 
    4285                                 float p = RandomValue(0.0f, (float)collectRays.size()); 
     4283                                const float p = RandomValue(0.0f, (float)collectRays.size()); 
    42864284                         
    42874285                                if (p < raysOut) 
     4286                                { 
    42884287                                        vcRays.push_back(*rit); 
     4288                                } 
    42894289                        } 
    42904290 
    4291                         ////////// 
    4292                         //-- export rays piercing this view cell 
    42934291                        exporter->ExportRays(vcRays, RgbColor(1, 1, 1)); 
    42944292                } 
     
    43104308                        //////// 
    43114309                        //-- export pvs 
     4310                        Intersectable::NewMail(); 
    43124311                        ObjectPvsMap::const_iterator oit, oit_end = pvs.mEntries.end(); 
    4313  
    4314                         Intersectable::NewMail(); 
    4315  
     4312                         
    43164313                        // output PVS of view cell 
    43174314                        for (oit = pvs.mEntries.begin(); oit != oit_end; ++ oit) 
    43184315                        {                
    43194316                                Intersectable *intersect = (*oit).first; 
    4320  
    43214317                                if (!intersect->Mailed()) 
    43224318                                { 
     
    54335429        { 
    54345430                ViewCell *viewcell = *it; 
    5435  
     5431                 
    54365432                if (viewcell->GetValid()) 
    5437                 { 
    5438                         // if ray not outside of view space 
     5433                {       // if ray not outside of view space 
    54395434                        float contribution; 
    54405435 
     
    54705465 
    54715466        if (!addRays) 
     5467        { 
    54725468                return ray.mRelativePvsContribution; 
     5469        } 
    54735470 
    54745471        // sampled objects are stored in the pvs 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h

    r1528 r1566  
    2020 // various flags 
    2121  enum { 
    22     FPosDirX = 1,  // the direction of ray in X-axis is positive 
    23     FPosDirY = 2,  // the direction of ray in Y-axis is positive 
    24     FPosDirZ = 4   // the direction of ray in Z-axis is positive 
     22    FPosDirX = 1,    // the direction of ray in X-axis is positive 
     23    FPosDirY = 2,    // the direction of ray in Y-axis is positive 
     24    FPosDirZ = 4,    // the direction of ray in Z-axis is positive 
     25        BorderSample = 8,// if this ray is an adaptive border ray 
     26        ReverserRay = 16 // if this ray is a reverse sample 
    2527  }; 
    2628 
Note: See TracChangeset for help on using the changeset viewer.