Changeset 1764


Ignore:
Timestamp:
11/17/06 10:10:41 (18 years ago)
Author:
mattausch
Message:

removed error in sample registration

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
10 edited

Legend:

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

    r1758 r1764  
    106106bool Exporter::ExportBvHierarchy(const BvHierarchy &bvHierarchy,  
    107107                                                                 const int maxPvs, 
    108                                                                  const AxisAlignedBox3 *box, 
     108                                                                 AxisAlignedBox3 *box, 
    109109                                                                 const bool exportBoundingBoxes) 
    110110{ 
     
    149149 
    150150                SetFilled(); 
    151                 ExportGeometry(leaf->mObjects, true); 
     151                ExportGeometry(leaf->mObjects, true, box); 
    152152        } 
    153153 
     
    177177        case Intersectable::TRIANGLE_INTERSECTABLE: 
    178178                { 
    179                   const Triangle3 triangle = dynamic_cast<TriangleIntersectable *>(object)->GetItem(); 
    180                   Polygon3 poly(triangle); 
    181                   ExportPolygon(&poly); 
    182                   break; 
     179                        // if (mClampToBox && !Overlap(mBoundingBox, object->GetBox()))  return; 
     180                        const Triangle3 triangle = dynamic_cast<TriangleIntersectable *>(object)->GetItem(); 
     181 
     182            Polygon3 poly(triangle); 
     183                        ExportPolygon(&poly); 
     184                        break; 
    183185                } 
    184186        case Intersectable::BVH_INTERSECTABLE: 
    185187                { 
    186188                        BvhNode *node = dynamic_cast<BvhNode *>(object); 
     189                         
    187190                        if (node->IsLeaf()) 
     191                        { 
    188192                                ExportGeometry(dynamic_cast<BvhLeaf *>(node)->mObjects, true); 
     193                        } 
     194 
    189195                        break; 
    190196                } 
     
    247253        } 
    248254         
    249  
    250255        /////////////////////// 
    251256        //-- all objects exported as one mesh 
     
    260265                if (bbox && !Overlap(*bbox, obj->GetBox())) 
    261266                { 
    262                         //cout << *bbox << " " << obj->GetBox() << endl; 
    263267                        continue; 
    264268                } 
    265  
    266269                switch (obj->Type()) 
    267270                { 
     
    293296        } 
    294297         
    295         //cout << "describe:\n" << dummyMesh << endl; 
    296         //dummyMesh.CheckMesh(); 
    297  
    298298        ExportMesh(&dummyMesh); 
    299299        CLEAR_CONTAINER(polys); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h

    r1418 r1764  
    1111#include "Containers.h" 
    1212#include "VssRay.h" 
     13#include "AxisAlignedBox3.h" 
    1314 
    1415namespace GtpVisibilityPreprocessor { 
     
    1819class SceneGraphNode; 
    1920class Ray; 
    20 class AxisAlignedBox3; 
    2121class Intersectable; 
    2222class BspLeaf; 
     
    4848                                  mWireframe(false), 
    4949                                  mUseForcedMaterial(false), 
    50                                   mExportRayDensity(false) 
     50                                  mExportRayDensity(false), 
     51                                  mClampToBox(false) 
    5152  {} 
    5253 
     
    154155          const BvHierarchy &bvHierarchy,  
    155156          const int maxPvs,  
    156           const AxisAlignedBox3 *box = NULL, 
     157          AxisAlignedBox3 *box = NULL, 
    157158          const bool exportBoundingBoxes = true); 
    158159 
     
    163164 
    164165  virtual void ExportPolygon(Polygon3 *poly) = 0; 
     166 
     167  bool mClampToBox; 
     168  AxisAlignedBox3 mBoundingBox; 
    165169}; 
    166170  
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1763 r1764  
    14281428 
    14291429 
    1430 bool HierarchyManager::AddSampleToPvs(Intersectable *obj,  
    1431                                                                           const Vector3 &hitPoint, 
    1432                                                                           ViewCell *vc, 
    1433                                                                           const float pdf,  
    1434                                                                           float &contribution) const 
    1435 { 
    1436         if (!obj) return false; 
    1437  
    1438         switch (mObjectSpaceSubdivisionType) 
    1439         { 
    1440         case NO_OBJ_SUBDIV: 
    1441                 { 
    1442                         // potentially visible objects 
    1443                         return vc->AddPvsSample(obj, pdf, contribution); 
    1444                 } 
    1445         case KD_BASED_OBJ_SUBDIV: 
    1446                 { 
    1447                         // potentially visible kd cells 
    1448                         KdLeaf *leaf = mOspTree->GetLeaf(hitPoint/*ray->mOriginNode*/); 
    1449                         return mOspTree->AddLeafToPvs(leaf, vc, pdf, contribution); 
    1450                 } 
    1451         case BV_BASED_OBJ_SUBDIV: 
    1452                 { 
    1453                         BvhLeaf *leaf = mBvHierarchy->GetLeaf(obj); 
    1454                          
    1455                         return vc->AddPvsSample(leaf, pdf, contribution); 
    1456                 } 
    1457         default: 
    1458                 return false; 
    1459         } 
    1460 } 
    1461  
    1462  
    14631430void HierarchyManager::PrintHierarchyStatistics(ostream &stream) const 
    14641431{ 
     
    14881455void HierarchyManager::ExportObjectSpaceHierarchy(Exporter *exporter, 
    14891456                                                                                                  const ObjectContainer &objects, 
    1490                                                                                                   const AxisAlignedBox3 *bbox, 
     1457                                                                                                  AxisAlignedBox3 *bbox, 
    14911458                                                                                                  const bool exportBounds) const 
    14921459{ 
     
    15701537                break; 
    15711538        } 
     1539 
    15721540        return obj; 
    15731541} 
     
    19721940        mOldViewCells = viewCells; 
    19731941 
    1974         return viewCells.size() + bvhNodes.size(); 
     1942        return (int)(viewCells.size() + bvhNodes.size()); 
    19751943} 
    19761944 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1750 r1764  
    236236        */ 
    237237        void ExportObjectSpaceHierarchy(OUT_STREAM &stream); 
    238         /** Adds a sample to the pvs of the specified view cell. 
    239         */ 
    240         bool AddSampleToPvs( 
    241                 Intersectable *obj,  
    242                 const Vector3 &hitPoint, 
    243                 ViewCell *vc, 
    244                 const float pdf,  
    245                 float &contribution) const; 
    246  
     238         
    247239        /** Print out statistics. 
    248240        */ 
     
    265257        void ExportObjectSpaceHierarchy(Exporter *exporter,  
    266258                                                                        const ObjectContainer &objects, 
    267                                                                         const AxisAlignedBox3 *bbox, 
     259                                                                        AxisAlignedBox3 *bbox, 
    268260                                                                        const bool exportBounds = true) const; 
    269261 
     
    391383                                                         const float renderCostPerStorage, 
    392384                                                         const float vspOspRatio); 
    393  
    394         bool AddSampleToPvs(Intersectable *obj,  
    395                                                 const float pdf, 
    396                                                 float &contribution) const; 
    397385 
    398386        /** Collect affected view space candidates. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r1757 r1764  
    407407void Pvs<T, S>::MergeInPlace(const Pvs<T, S> &a) 
    408408{ 
    409     //const int samples = mSamples + a.mSamples; 
    410409        ObjectPvs interPvs; 
    411410         
     
    415414        mEntries = interPvs.mEntries; 
    416415        mSamples = interPvs.mSamples; 
    417         //mSamples = samples; 
    418416} 
    419417 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1763 r1764  
    262262                                                        const float pdf,  
    263263                                                        float &contribution) 
    264 { 
     264{ cout << "here15" << endl; 
    265265        const bool result = mPvs.AddSample(sample, pdf, contribution); 
    266266        // have to recompute pvs size 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1763 r1764  
    2828#define ABS_CONTRIBUTION_WEIGHT 1.0f 
    2929 
    30 // warning: Should not count origin object for sampling because it disturbs heuristics 
     30// warning: Should not count origin object for sampling  
     31// because it disturbs heuristics 
    3132#define SAMPLE_ORIGIN_OBJECTS 0  // matt temp 
    3233 
    3334// $$JB HACK 
    34 #define USE_KD_PVS 1 
     35#define USE_KD_PVS 0 
    3536#define KD_PVS_AREA (1e-4f) 
    3637 
     
    4243// HACK 
    4344const static bool SAMPLE_AFTER_SUBDIVISION = true; 
    44 const static bool CLAMP_TO_BOX = false; 
    45 //const static bool CLAMP_TO_BOX = true; 
     45//const static bool CLAMP_TO_BOX = false; 
     46const static bool CLAMP_TO_BOX = true; 
    4647 
    4748 
     
    118119        Environment::GetSingleton()->GetStringValue("ViewCells.samplingType", buf); 
    119120 
    120          
    121         /*ObjectPvs pvs1, pvs2, mergedPvs; 
    122  
    123         pvs1.AddSample((Intersectable *)1, 1); 
    124         pvs1.AddSample((Intersectable *)3, 1); 
    125         pvs1.AddSample((Intersectable *)6, 1); 
    126         pvs1.AddSample((Intersectable *)7, 1); 
    127         pvs1.AddSample((Intersectable *)9, 1); 
    128         pvs1.AddSample((Intersectable *)12, 1); 
    129         pvs1.AddSample((Intersectable *)15, 1); 
    130         pvs1.AddSample((Intersectable *)7, 1); 
    131         pvs2.AddSample((Intersectable *)3, 1); 
    132         pvs2.AddSample((Intersectable *)4, 1); 
    133         pvs2.AddSample((Intersectable *)6, 1); 
    134         pvs2.AddSample((Intersectable *)8, 1); 
    135         pvs2.AddSample((Intersectable *)9, 1); 
    136         pvs2.AddSample((Intersectable *)14, 1); 
    137  
    138         ObjectPvs::Merge(mergedPvs, pvs1, pvs2); 
    139  
    140         Debug << "\npvs1\n"; 
    141         cout << "\npvs1\n"; 
    142         ObjectPvsIterator pvs1It = pvs1.GetIterator(); 
    143  
    144         while (pvs1It.HasMoreEntries()) 
    145         { 
    146                 ObjectPvsEntry entry = pvs1It.Next(); 
    147                  
    148                 Debug << (int)entry.mObject << " "; 
    149                 cout << (int)entry.mObject << " "; 
    150         } 
    151  
    152 Debug << "\npvs2\n"; 
    153         cout << "\npvs2\n"; 
    154         ObjectPvsIterator pvs2It = pvs2.GetIterator(); 
    155  
    156         while (pvs2It.HasMoreEntries()) 
    157         { 
    158                 ObjectPvsEntry entry = pvs2It.Next(); 
    159                  
    160                 Debug << (int)entry.mObject << " "; 
    161                 cout << (int)entry.mObject << " "; 
    162         } 
    163  
    164 Debug << "\nmerged\n"; 
    165         cout << "\nmerged\n"; 
    166         ObjectPvsIterator mergedIt = mergedPvs.GetIterator(); 
    167  
    168         while (mergedIt.HasMoreEntries()) 
    169         { 
    170                 ObjectPvsEntry entry = mergedIt.Next(); 
    171                 Debug << (int)entry.mObject << " " << entry.mData.mSumPdf << " x "; 
    172                 cout << (int)entry.mObject << " " << entry.mData.mSumPdf << " x "; 
    173         } 
    174 */ 
    175121        // sampling type for view cells construction samples 
    176122        if (strcmp(buf, "object") == 0) 
     
    956902{ 
    957903        return mExportPvs; 
    958 } 
    959  
    960  
    961 bool ViewCellsManager::AddSampleToPvs(Intersectable *obj,  
    962                                                                           const Vector3 &hitPoint, 
    963                                                                           ViewCell *vc, 
    964                                                                           const float pdf,  
    965                                                                           float &contribution) const 
    966 { 
    967         if (!obj) 
    968           return false; 
    969          
    970         // potentially visible objects 
    971         return vc->AddPvsSample(obj, pdf, contribution); 
    972904} 
    973905 
     
    20081940ViewCellsManager::AddSampleContributions(VssRay &ray) 
    20091941{ 
    2010   // assumes viewcells have been stored... 
    2011   ViewCellContainer *viewcells = &ray.mViewCells; 
    2012   ViewCellContainer::const_iterator it; 
    2013  
    2014   if (!ray.mTerminationObject) 
    2015         return; 
    2016    
    2017   Intersectable *obj = GetIntersectable(ray, true); 
    2018    
    2019   for (it = viewcells->begin(); it != viewcells->end(); ++it) { 
    2020         ViewCell *viewcell = *it; 
    2021         if (viewcell->GetValid()) { 
    2022           // if ray not outside of view space 
    2023           viewcell->GetPvs().AddSample(obj, ray.mPdf); 
    2024         } 
    2025   } 
     1942        // assumes viewcells have been stored... 
     1943        ViewCellContainer *viewcells = &ray.mViewCells; 
     1944        ViewCellContainer::const_iterator it; 
     1945 
     1946        if (!ray.mTerminationObject) 
     1947                return; 
     1948 
     1949        Intersectable *obj = GetIntersectable(ray, true); 
     1950 
     1951        for (it = viewcells->begin(); it != viewcells->end(); ++it)  
     1952        { 
     1953                ViewCell *viewcell = *it; 
     1954                if (viewcell->GetValid())  
     1955                { 
     1956                        Intersectable *entry = GetIntersectable(ray, true); 
     1957                        if (entry)     
     1958                                // if ray not outside of view space 
     1959                                viewcell->GetPvs().AddSample(entry, ray.mPdf); 
     1960                } 
     1961        } 
    20261962} 
    20271963 
     
    20611997         
    20621998        Intersectable *obj = GetIntersectable(ray, true); 
    2063          
    2064          
     1999                 
    20652000        ViewCellContainer::const_iterator it = viewcells.begin(); 
    20662001         
     
    20682003        { 
    20692004                ViewCell *viewcell = *it; 
    2070                  
    2071                 if (viewcell->GetValid()) // tests if view cell is in valid view space 
     2005                // tests if view cell is in valid view space 
     2006                if (viewcell->GetValid()) 
    20722007                { 
    20732008                        float contribution; 
     
    21132048                                // if view point is valid, add new object to the pvs 
    21142049                                if (ray.mTerminationObject) 
    2115                                 { 
     2050                                {  
    21162051                                        viewcell->GetPvs().AddSample(obj, ray.mPdf); 
    21172052                                }                                
    21182053#if SAMPLE_ORIGIN_OBJECTS 
    21192054                                 if (ray.mOriginObject) 
    2120                                  { 
     2055                                 {  
    21212056                                         viewcell->GetPvs().AddSample(ray.mOriginObject, ray.mPdf); 
    21222057                                 } 
     
    25932528          { 
    25942529                  Intersectable *o = *noi; 
     2530                  
    25952531                  // $$ JB warning: pdfs are not correct at this point!    
    25962532                  nPvs.AddSample(o, Limits::Small); 
     
    25982534          } 
    25992535  } 
    2600   //  cout<<"nPvs size = "<<nPvsSize<<endl; 
    2601  
     2536 
     2537  // cout<<"nPvs size = "<<nPvsSize<<endl; 
    26022538  pvs.MergeInPlace(nPvs); 
    26032539} 
     
    28502786        } 
    28512787 
    2852         //cout << "recursivly updating pvs" << endl; 
    2853  
    28542788        //////////////// 
    28552789        //-- interior node => propagate pvs up the tree 
     
    28992833 
    29002834                        if (!intersect->Mailed()) 
    2901                         { 
     2835                        {  
    29022836                                pvs.AddSample(intersect, entry.mData.mSumPdf); 
    29032837                                intersect->Mail(); 
     
    55045438        if (exporter) 
    55055439        { 
     5440                if (CLAMP_TO_BOX) 
     5441                {        
     5442                        exporter->mClampToBox = true;    
     5443                } 
     5444 
    55065445                EvaluateViewCellsStats(); 
    55075446 
     5447                const long starttime = GetTime(); 
     5448                cout << "exporting final view cells (after initial construction + post process) ... "; 
     5449 
     5450                // matt: hack for clamping scene 
     5451                AxisAlignedBox3 bbox = mViewSpaceBox; 
     5452                bbox.Scale(scale); 
     5453 
     5454                if (1 && mExportRays) 
     5455                {        
     5456                        exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
     5457                } 
     5458 
     5459                mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects,  
     5460                                                                                                          CLAMP_TO_BOX ? &bbox : NULL, false); 
     5461                 
    55085462                // hack color code (show pvs size) 
    55095463                const int savedColorCode = mColorCode; 
    55105464                mColorCode = 1; // export pvs 
    55115465 
    5512                 const long starttime = GetTime(); 
    5513                 cout << "exporting final view cells (after initial construction + post process) ... "; 
    5514  
    5515                 // matt: hack for clamping scene 
    5516                 AxisAlignedBox3 bbox = mViewSpaceBox; 
    5517                 bbox.Scale(scale); 
    5518  
     5466                //ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane()); 
     5467                ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane()); 
     5468 
     5469                delete exporter; 
     5470 
     5471                cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 
     5472                mColorCode = savedColorCode; 
     5473        } 
     5474 
     5475        // export final object partition 
     5476        exporter = Exporter::GetExporter("final_object_partition.wrl"); 
     5477 
     5478        if (exporter) 
     5479        { 
    55195480                if (CLAMP_TO_BOX) 
    55205481                {        
    5521                         exporter->SetWireframe();  
    5522                         exporter->ExportBox(bbox); 
    5523                         exporter->SetFilled();  
    5524                 } 
    5525  
    5526                 if (0 && mExportGeometry) 
    5527                 { 
    5528                         exporter->ExportGeometry(objects, true, CLAMP_TO_BOX ? &bbox : NULL); 
    5529                 } 
    5530  
    5531                 if (1 && mExportRays) 
    5532                 {        
    5533                         exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
    5534                 } 
    5535  
    5536                 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects,  
    5537                                                                                                           CLAMP_TO_BOX ? &bbox : NULL, false); 
    5538                  
    5539                 //ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane()); 
    5540                 ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane()); 
    5541  
    5542                 delete exporter; 
    5543  
    5544                 cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 
    5545                 mColorCode = savedColorCode; 
    5546         } 
    5547  
    5548         // export final object partition 
    5549         exporter = Exporter::GetExporter("final_object_partition.wrl"); 
    5550  
    5551         if (exporter) 
    5552         { 
     5482                        exporter->mClampToBox = true;    
     5483                } 
     5484 
    55535485                const long starttime = GetTime(); 
    55545486 
     
    59045836                        { 
    59055837                                // todo: maybe not correct for kd node pvs 
    5906                            
    5907                           if (viewcell->GetPvs().GetSampleContribution(terminationObj, 
    5908                                                                                                                    ray.mPdf,  
    5909                                                                                                                    contribution)) 
     5838                                if (viewcell->GetPvs().GetSampleContribution( 
     5839                                                terminationObj, ray.mPdf, contribution)) 
    59105840                                { 
    5911                                   ++ ray.mPvsContribution; 
     5841                                        ++ ray.mPvsContribution; 
    59125842                                } 
    5913                            
    5914                           ray.mRelativePvsContribution += contribution; 
     5843 
     5844                                ray.mRelativePvsContribution += contribution; 
    59155845                        } 
    59165846                         
    59175847                        //////////////// 
    5918                         //-- for directional sampling it is important to count only contributions  
    5919                         //-- made in one direction! 
     5848                        //-- for directional sampling it is important to count  
     5849                        //-- only contributions made in one direction! 
    59205850                        //-- the other contributions of this sample will be counted for the opposite ray! 
     5851 
    59215852#if SAMPLE_ORIGIN_OBJECTS 
     5853 
    59225854                        if (originObj &&  
    59235855                                viewcell->GetPvs().GetSampleContribution(originObj, 
     
    59465878 
    59475879                //$$JB hack 
    5948 #if !USE_KD_PVS 
    5949                 AddSampleToPvs( 
    5950                                            terminationObj,  
    5951                                            ray.mTermination,  
    5952                                            viewCell,  
    5953                                            ray.mPdf,  
    5954                                            ray.mRelativePvsContribution); 
    5955 #else 
    59565880                viewCell->GetPvs().AddSample(terminationObj, ray.mPdf); 
    5957 #endif 
    59585881                 
    59595882#if SAMPLE_ORIGIN_OBJECTS 
    5960                 AddSampleToPvs( 
    5961                                            originObj,  
    5962                                            ray.mOrigin,  
    5963                                            viewCell,  
    5964                                            ray.mPdf,  
    5965                                            ray.mRelativePvsContribution); 
     5883                viewCell->GetPvs().AddSample(originObj, ray.mPdf); 
    59665884#endif                   
    59675885        } 
    59685886         
    5969          
    5970  
    59715887        return ABS_CONTRIBUTION_WEIGHT*ray.mPvsContribution + 
    59725888          (1.0f - ABS_CONTRIBUTION_WEIGHT)*ray.mRelativePvsContribution; 
    5973 } 
    5974  
    5975  
    5976 bool VspOspViewCellsManager::AddSampleToPvs(Intersectable *obj,  
    5977                                                                                         const Vector3 &hitPoint, 
    5978                                                                                         ViewCell *vc, 
    5979                                                                                         const float pdf,  
    5980                                                                                         float &contribution) const 
    5981 { 
    5982   // The hierarchy manager decides about the type of sample cast 
    5983   return mHierarchyManager->AddSampleToPvs(obj, hitPoint, vc, pdf, contribution); 
    59845889} 
    59855890 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1761 r1764  
    516516        bool GetStoreKdPVs() const; 
    517517 
    518         /** Adds a sample to the pvs of the specified view cell. 
    519                 @param obj the hit object 
    520                 @param hitPoint the point where the object is hit. 
    521                 @param vc the sanpled view cell 
    522                 @param pdf probability of the ray 
    523                 @param contribution the relative pvs contribution 
    524                 @returns true if the sample gives a contribution to the pvs. 
    525         */ 
    526         virtual bool AddSampleToPvs(Intersectable *obj,  
    527                                                                 const Vector3 &hitPoint, 
    528                                                                 ViewCell *vc, 
    529                                                                 const float pdf,  
    530                                                                 float &contribution) const; 
    531  
    532518        /** Exports single view cells for visualization. 
    533519                @param objects the scene objects 
     
    11211107                                                                        BoundingBoxConverter *bconverter); 
    11221108 
    1123         bool AddSampleToPvs(Intersectable *obj,  
    1124                                                 const Vector3 &hitPoint, 
    1125                                                 ViewCell *vc, 
    1126                                                 const float pdf,  
    1127                                                 float &contribution) const; 
    1128  
    11291109        void ExportSingleViewCells(const ObjectContainer &objects, 
    11301110                                                           const int maxViewCells, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r1763 r1764  
    10331033 
    10341034                bool madeContrib = false; 
    1035                 float contribution; 
    1036  
    1037                 Intersectable *obj = ray->mTerminationObject; 
    1038  
    1039                 if (obj)  
     1035                float contribution = 1; 
     1036 
     1037                Intersectable *entry =  
     1038                        mHierarchyManager->GetIntersectable(ray->mTerminationObject, true); 
     1039 
     1040                if (entry)  
    10401041                { 
    10411042                        madeContrib =  
    1042                                 mViewCellsManager->AddSampleToPvs( 
    1043                                         obj,  
    1044                                         ray->mTermination,  
    1045                                         vc,  
    1046                                         ray->mPdf,  
    1047                                         contribution); 
     1043                                vc->GetPvs().AddSample(entry, ray->mPdf); 
    10481044 
    10491045                        sc += contribution; 
    10501046                } 
    10511047#if COUNT_ORIGIN_OBJECTS 
    1052                 obj = ray->mOriginObject; 
    1053  
    1054                 if (obj)  
     1048                entry = mHierarchyManager->GetIntersectable(ray->mOriginObject, true); 
     1049 
     1050                if (entry)  
    10551051                { 
    10561052                        madeContrib =  
    1057                                 mViewCellsManager->AddSampleToPvs( 
    1058                                         obj, 
    1059                                         ray->mOrigin,  
    1060                                         vc,  
    1061                                         ray->mPdf,  
    1062                                         contribution); 
     1053                                vc->GetPvs().AddSample(entry, ray->mPdf); 
    10631054 
    10641055                        sc += contribution; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r1732 r1764  
    3838class KdTreeStatistics; 
    3939 
     40 
     41#define WORK_WITH_VIEWCELLS 0 
    4042 
    4143/** View space partition statistics. 
Note: See TracChangeset for help on using the changeset viewer.