Changeset 440


Ignore:
Timestamp:
11/30/05 18:02:55 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
2 added
14 edited

Legend:

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

    r438 r440  
    103103  ExportBspLeaves(const BspTree &tree, const int maxPvs = 0) = 0; 
    104104 
     105  virtual void 
     106  ExportGeometry(const ObjectContainer &objects) = 0; 
     107 
    105108  void SetExportRayDensity(const bool d) { mExportRayDensity = d; } 
    106109   
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp

    r439 r440  
    4040         
    4141        filenames.push_back(string(str, pos, str.size() - pos)); 
    42         return filenames.size(); 
     42        return (int)filenames.size(); 
    4343} 
    4444 
     
    161161} 
    162162 
    163  
    164 void Preprocessor::ExportSplits(const ObjectContainer &objects, 
    165                                                                 const RayContainer &sampleRays, 
    166                                                                 const int visSamples) 
    167 { 
    168         Exporter *exporter = Exporter::GetExporter("bsp_splits.x3d"); 
    169  
    170         if (exporter)  
    171         {        
    172                 Material m;  
    173                 m.mDiffuseColor = RgbColor(1, 0, 0); 
    174                 exporter->SetForcedMaterial(m); 
    175                 exporter->SetWireframe(); 
    176                 exporter->ExportBspSplits(*mBspTree, true); 
    177  
    178                 // take forced material, else big scenes cannot be viewed 
    179                 m.mDiffuseColor = RgbColor(0, 1, 0); 
    180                 exporter->SetForcedMaterial(m); 
    181                 exporter->SetFilled(); 
    182  
    183                 exporter->ResetForcedMaterial(); 
    184                  
    185                 // export rays 
    186                 if (0) 
    187                 { 
    188                         RayContainer outRays; 
    189                  
    190                         for (int i = 0; i < sampleRays.size(); ++ i) 
    191                         { 
    192                                 // only rays piercing geometry 
    193                                 if (!sampleRays[i]->intersections.empty()) 
    194                                         outRays.push_back(sampleRays[i]); 
    195                         } 
    196                         if (BspTree::sConstructionMethod == BspTree::FROM_SAMPLES) 
    197                         { 
    198                                 // export rays  
    199                                 exporter->ExportRays(outRays, 1000, RgbColor(1, 1, 0)); 
    200                         } 
    201                 } 
    202  
    203                 if (1) 
    204                         ExportSceneGeometry(exporter, objects); 
    205  
    206                 delete exporter; 
    207         } 
    208 } 
    209  
    210 inline bool vc_gt(ViewCell *a, ViewCell *b)  
    211 {  
    212         return a->GetPvs().GetSize() > b->GetPvs().GetSize(); 
    213 } 
    214  
    215 void Preprocessor::ExportBspPvs(const ObjectContainer &objects, 
    216                                                                 const RayContainer &sampleRays, 
    217                                                                 const int visSamples) 
    218 { 
    219         const int leafOut = 10; 
    220          
    221         ViewCell::NewMail(); 
    222  
    223         //-- some rays for output 
    224         const int raysOut = min((int)sampleRays.size(), visSamples); 
    225         cout << "visualization using " << visSamples << " samples" << endl; 
    226         vector<Ray *> vcRays[leafOut]; 
    227  
    228         if (0) 
    229         { 
    230                 //-- some random view cells and rays for output 
    231                 vector<BspLeaf *> bspLeaves; 
    232  
    233                 for (int i = 0; i < leafOut; ++ i) 
    234                         bspLeaves.push_back(mBspTree->GetRandomLeaf());  
    235                  
    236                 for (int i = 0; i < bspLeaves.size(); ++ i) 
    237                 { 
    238                         cout << "creating output for view cell " << i << " ... "; 
    239                         // check whether we can add the current ray to the output rays 
    240                         for (int k = 0; k < raysOut; ++ k)  
    241                         { 
    242                                 Ray *ray = sampleRays[k]; 
    243  
    244                                 for     (int j = 0; j < (int)ray->bspIntersections.size(); ++ j) 
    245                                 { 
    246                                         BspLeaf *leaf = ray->bspIntersections[j].mLeaf; 
    247  
    248                                         if (bspLeaves[i]->GetViewCell() == leaf->GetViewCell())  
    249                                         { 
    250                                                 vcRays[i].push_back(ray); 
    251                                         } 
    252                                 } 
    253                         } 
    254  
    255                         Intersectable::NewMail(); 
    256  
    257                         BspViewCell *vc = dynamic_cast<BspViewCell *>(bspLeaves[i]->GetViewCell()); 
    258  
    259                         //bspLeaves[j]->Mail(); 
    260                         char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 
    261  
    262                         Exporter *exporter = Exporter::GetExporter(s); 
    263                         exporter->SetFilled(); 
    264  
    265                         ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 
    266  
    267                         exporter->SetWireframe(); 
    268                         //exporter->SetFilled(); 
    269  
    270                         Material m;//= RandomMaterial(); 
    271                         m.mDiffuseColor = RgbColor(0, 1, 0); 
    272                         exporter->SetForcedMaterial(m); 
    273  
    274                         if (vc->GetMesh()) 
    275                                 exporter->ExportViewCell(vc); 
    276                         else 
    277                         { 
    278                                 PolygonContainer cell; 
    279                                 // export view cell geometry 
    280                                 mBspTree->ConstructGeometry(vc, cell); 
    281                                 exporter->ExportPolygons(cell); 
    282                                 CLEAR_CONTAINER(cell); 
    283                         } 
    284  
    285                         Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize()  
    286                                         << ", piercing rays=" << (int)vcRays[i].size() << endl; 
    287  
    288                         // export rays piercing this view cell 
    289                         exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 
    290  
    291                         m.mDiffuseColor = RgbColor(1, 0, 0); 
    292                         exporter->SetForcedMaterial(m); 
    293  
    294                         // exporter->SetWireframe(); 
    295                         exporter->SetFilled(); 
    296  
    297                         // output PVS of view cell 
    298                         for (; it != vc->GetPvs().mEntries.end(); ++ it)  
    299                         { 
    300                                 Intersectable *intersect = (*it).first; 
    301                                 if (!intersect->Mailed()) 
    302                                 { 
    303                                         exporter->ExportIntersectable(intersect); 
    304                                         intersect->Mail(); 
    305                                 }                        
    306                         } 
    307                                  
    308                         // output rest of the objects 
    309                         if (0) 
    310                         { 
    311                                 Material m;//= RandomMaterial(); 
    312                                 m.mDiffuseColor = RgbColor(0, 0, 1); 
    313                                 exporter->SetForcedMaterial(m); 
    314  
    315                                 for (int j = 0; j < objects.size(); ++ j) 
    316                                         if (!objects[j]->Mailed()) 
    317                                         { 
    318                                                 exporter->SetForcedMaterial(m); 
    319                                                 exporter->ExportIntersectable(objects[j]); 
    320                                                 objects[j]->Mail(); 
    321                                         } 
    322                         } 
    323                         DEL_PTR(exporter); 
    324                         cout << "finished" << endl; 
    325                 } 
    326         } 
    327         else 
    328         { 
    329                 ViewCellContainer viewCells; 
    330  
    331                 mBspTree->CollectViewCells(viewCells); 
    332                 stable_sort(viewCells.begin(), viewCells.end(), vc_gt); 
    333  
    334                 int limit = min(leafOut, (int)viewCells.size());  
    335                  
    336                 for (int i = 0; i < limit; ++ i) 
    337                 { 
    338                         cout << "creating output for view cell " << i << " ... "; 
    339                          
    340             Intersectable::NewMail(); 
    341                         BspViewCell *vc = dynamic_cast<BspViewCell *>(viewCells[i]); 
    342  
    343                         cout << "creating output for view cell " << i << " ... "; 
    344                         // check whether we can add the current ray to the output rays 
    345                         for (int k = 0; k < raysOut; ++ k)  
    346                         { 
    347                                 Ray *ray = sampleRays[k]; 
    348  
    349                                 for     (int j = 0; j < (int)ray->bspIntersections.size(); ++ j) 
    350                                 { 
    351                                         BspLeaf *leaf = ray->bspIntersections[j].mLeaf; 
    352  
    353                                         if (vc == leaf->GetViewCell())  
    354                                         { 
    355                                                 vcRays[i].push_back(ray); 
    356                                         } 
    357                                 } 
    358                         } 
    359  
    360                         //bspLeaves[j]->Mail(); 
    361                         char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 
    362  
    363                         Exporter *exporter = Exporter::GetExporter(s); 
    364                          
    365                         exporter->SetWireframe(); 
    366  
    367                         Material m;//= RandomMaterial(); 
    368                         m.mDiffuseColor = RgbColor(0, 1, 0); 
    369                         exporter->SetForcedMaterial(m); 
    370  
    371                         if (vc->GetMesh()) 
    372                                 exporter->ExportViewCell(vc); 
    373                         else 
    374                         { 
    375                                 PolygonContainer cell; 
    376                                 // export view cell 
    377                                 mBspTree->ConstructGeometry(vc, cell); 
    378                                 exporter->ExportPolygons(cell); 
    379                                 CLEAR_CONTAINER(cell); 
    380                         } 
    381  
    382                          
    383                         Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize()  
    384                                         << ", piercing rays=" << (int)vcRays[i].size() << endl; 
    385  
    386                          
    387                         // export rays piercing this view cell 
    388                         exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 
    389          
    390                         m.mDiffuseColor = RgbColor(1, 0, 0); 
    391                         exporter->SetForcedMaterial(m); 
    392  
    393                         ViewCellPvsMap::const_iterator it, 
    394                                 it_end = vc->GetPvs().mEntries.end(); 
    395  
    396                         // output PVS of view cell 
    397                         for (it = vc->GetPvs().mEntries.begin(); it != it_end; ++ it)  
    398                         { 
    399                                 Intersectable *intersect = (*it).first; 
    400                                 if (!intersect->Mailed()) 
    401                                 { 
    402                                         Material m = RandomMaterial(); 
    403                          
    404                                         exporter->SetForcedMaterial(m); 
    405  
    406                                         exporter->ExportIntersectable(intersect); 
    407                                         intersect->Mail(); 
    408                                 }                        
    409                         } 
    410                                  
    411                         DEL_PTR(exporter); 
    412                         cout << "finished" << endl; 
    413                 } 
    414         } 
    415 } 
    416  
    417  
    418 void Preprocessor::ExportSceneGeometry(Exporter *exporter,  
    419                                                                            const ObjectContainer &objects) 
    420 { 
    421         Material m;//= RandomMaterial(); 
    422         m.mDiffuseColor = RgbColor(0, 1, 0); 
    423         exporter->SetForcedMaterial(m); 
    424         exporter->SetWireframe(); 
    425  
    426         for (int j = 0; j < objects.size(); ++ j) 
    427                 exporter->ExportIntersectable(objects[j]); 
    428 } 
    429  
    430163bool Preprocessor::PrepareViewCells() 
    431164{ 
     
    436169        if (strcmp(viewCellsStr, "kdTree") == 0) 
    437170        { 
    438                 //mViewCellsManager = new KdViewCellsManager(mKdTree); 
     171                mViewCellsManager = new KdViewCellsManager(mKdTree); 
    439172        } 
    440173        if (strcmp(viewCellsStr, "bspTree") == 0) 
    441174        { 
    442                 //mViewCellsManager = new BspViewCellsManager(mBspTree, mBspConstructionSamples); 
     175                int bspConstructionSamples = 0; 
     176 
     177                environment->GetIntValue("BspTree.Construction.samples", bspConstructionSamples); 
     178                mViewCellsManager = new BspViewCellsManager(mBspTree, bspConstructionSamples); 
    443179        } 
    444180        else if (strcmp(viewCellsStr, "vspTree") == 0) 
    445181        { 
    446                 //mViewCellsManager = new VspKdViewCellContaienr(mVspKdTree, mVspKdConstructionSamples); 
     182                int vspKdConstructionSamples = 0; 
     183                 
     184                environment->GetIntValue("VspKdTree.Construction.samples", vspKdConstructionSamples); 
     185        mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, vspKdConstructionSamples); 
    447186        } 
    448187        else if (strcmp(viewCellsStr, "sceneDependent") == 0) 
    449188        { 
    450189                //TODO 
    451                 //mViewCellsManager = new BspViewCellContainer(mBspTree); 
     190                int bspConstructionSamples = 0; 
     191 
     192                environment->GetIntValue("BspTree.Construction.samples", bspConstructionSamples); 
     193                mViewCellsManager = new BspViewCellsManager(mBspTree, bspConstructionSamples); 
    452194        } 
    453195        else 
     
    457199        } 
    458200 
     201        int postProcessSamples = 0; 
     202        int visSamples = 0; 
     203 
     204        environment->GetIntValue("ViewCells.PostProcessing.samples", postProcessSamples); 
     205        environment->GetIntValue("BspTree.Visualization.samples", visSamples); 
     206 
     207        mViewCellsManager->SetPostProcessSamples(postProcessSamples); 
     208        mViewCellsManager->SetVisualizationSamples(visSamples); 
     209 
     210 
    459211        //-- parse view cells construction method 
     212 
    460213        bool loadViewCells = false; 
    461214        environment->GetBoolValue("ViewCell.Construction.loadFromFile", loadViewCells); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h

    r439 r440  
    100100 
    101101protected: 
    102   void ExportBspPvs(const ObjectContainer &objects, 
    103                                         const RayContainer &sampleRays, 
    104                                         const int visSamples); 
    105102 
    106   void ExportSplits(const ObjectContainer &objects, 
    107                                         const RayContainer &sampleRays, 
    108                                         const int visSamples); 
     103  ///////////////////////// 
    109104 
    110   /** Export scene geometry. 
    111   */ 
    112   void ExportSceneGeometry(Exporter *exporter, const ObjectContainer &objects); 
    113  
     105  /// samples used for construction of the BSP view cells tree. 
    114106  int mBspConstructionSamples; 
     107   /// samples used for construction of the VSP KD tree. 
     108  int mVspKdConstructionSamples; 
    115109}; 
    116110 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp

    r439 r440  
    5353/*     class BspRenderSimulator implementation          */ 
    5454/********************************************************/ 
     55BspRenderSimulator::BspRenderSimulator(BspTree *bspTree): 
     56mBspTree(bspTree) 
     57{ 
     58} 
    5559 
    5660BspRenderSimulator::BspRenderSimulator(float objRenderCost,  
     
    149153                                                                                         KdTree *kdTree): 
    150154RenderSimulator(objRenderCost, vcOverhead, moveSpeed), mKdTree(kdTree) 
     155{ 
     156} 
     157 
     158KdRenderSimulator::KdRenderSimulator(KdTree *kdTree): 
     159mKdTree(kdTree) 
    151160{ 
    152161} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h

    r439 r440  
    8484{ 
    8585public: 
     86        BspRenderSimulator(BspTree *bspTree); 
     87 
    8688        BspRenderSimulator(float objRenderCost,  
    8789                                                           float vcOverhead,  
     
    104106{ 
    105107public: 
     108        KdRenderSimulator(KdTree *kdTree); 
     109 
    106110        KdRenderSimulator(float objRenderCost,  
    107111                                                          float vcOverhead,  
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r439 r440  
    1515  environment->GetIntValue("Sampling.samplesPerPass", mSamplesPerPass); 
    1616  environment->GetIntValue("Sampling.totalSamples", mTotalSamples); 
    17   environment->GetIntValue("BspTree.Construction.samples", mBspConstructionSamples); 
    18   environment->GetIntValue("VspKdTree.Construction.samples", mVspConstructionSamples); 
    19   environment->GetIntValue("ViewCells.PostProcessing.samples", mPostProcessSamples); 
    20   environment->GetIntValue("BspTree.Visualization.samples", mVisualizationSamples); 
    2117  
    22   mKdPvsDepth = 100; 
    2318  mStats.open("stats.log"); 
    2419} 
     
    2722{ 
    2823        CLEAR_CONTAINER(mSampleRays); 
    29         CLEAR_CONTAINER(mVspSampleRays); 
     24        CLEAR_CONTAINER(mVssSampleRays); 
    3025} 
    3126 
     
    3429                                                                                                                         const Vector3 &point,  
    3530                                                                                                                         const Vector3 &direction, 
    36                                                                                                                          const int type) 
     31                                                           const int type, 
     32                                                           const Ray::Intersection &origin) 
    3733{ 
    3834  ray.intersections.clear(); 
     
    4036  ray.testedObjects.clear(); 
    4137  ray.bspIntersections.clear(); 
     38   
    4239        ray.mFlags |= Ray::STORE_KDLEAVES | Ray::STORE_BSP_INTERSECTIONS; 
    4340  //  cout<<point<<" "<<direction<<endl; 
    4441  ray.Init(point, direction, type); 
    45 } 
    46  
    47 KdNode * 
    48 SamplingPreprocessor::GetNodeForPvs(KdLeaf *leaf) 
    49 { 
    50   KdNode *node = leaf; 
    51   while (node->mParent && node->mDepth > mKdPvsDepth) 
    52     node = node->mParent; 
    53   return node; 
    54 } 
    55  
    56 int 
    57 SamplingPreprocessor::AddNodeSamples(const Ray &ray, 
    58                                                                          Intersectable *sObject, 
    59                                                                          Intersectable *tObject 
    60                                                                          ) 
    61 { 
    62   int contributingSamples = 0; 
    63   int j; 
    64         int objects = 0; 
    65         if (sObject) 
    66                 objects++; 
    67         if (tObject) 
    68                 objects++; 
    69  
    70         if (objects) { 
    71                 for (j=0; j < ray.kdLeaves.size(); j++) { 
    72                         KdNode *node = GetNodeForPvs( ray.kdLeaves[j] ); 
    73                         if (sObject) 
    74                                 contributingSamples += sObject->mKdPvs.AddSample(node); 
    75                         if (tObject) 
    76                                 contributingSamples += tObject->mKdPvs.AddSample(node); 
    77                 } 
    78         } 
    79          
    80         for (j=1; j < ((int)ray.kdLeaves.size() - 1); j++) { 
    81                 ray.kdLeaves[j]->AddPassingRay2(ray, 
    82                                                                                 objects, 
    83                                                                                 ray.kdLeaves.size() 
    84                                                                                 ); 
    85   } 
    86    
    87   return contributingSamples; 
    88 } 
    89  
     42        ray.sourceObject = origin; 
     43} 
    9044 
    9145void 
     
    10256} 
    10357 
    104 int SamplingPreprocessor::AddObjectSamples(Intersectable *obj, const Ray &ray) 
    105 { 
    106         int contributingSamples = 0; 
    107         int j; 
    10858  
    109         // object can be seen from the view cell => add to view cell pvs 
    110         /*for (j=0; j < ray.bspIntersections.size(); ++ j) 
     59int 
     60SamplingPreprocessor::CastRays(const RayContainer &rays,  
     61                                                           int &sampleContributions,  
     62                                                           int &contributingSamples) 
    11163        {        
    112                 BspLeaf *leaf = ray.bspIntersections[j].mLeaf; 
    113                 // if ray not in unbounded space 
    114                 if (leaf->GetViewCell() != &mUnbounded) 
    115                         contributingSamples +=  
    116                                 leaf->GetViewCell()->GetPvs().AddSample(obj); 
    117         }*/ 
     64        // cast ray to KD tree to find intersection with other objects 
     65        RayContainer::const_iterator it, it_end = rays.end(); 
    11866  
    119         // rays passing through this viewcell 
    120         /*if (mPass > 1) 
    121                 for (j=1; j < ((int)ray.bspIntersections.size() - 1); ++ j)  
    122                 { 
    123                         BspLeaf *leaf = ray.bspIntersections[j].mLeaf; 
    124  
    125                         if (leaf->GetViewCell() != &mUnbounded) 
    126                                 leaf->GetViewCell()-> 
    127                                         AddPassingRay(ray, contributingSamples ? 1 : 0); 
    128                 } 
    129  */ 
    130         return contributingSamples; 
    131 } 
    132  
     67        for (it = rays.begin(); it != it_end; ++it) 
     68        mKdTree->CastRay((*it)); 
     69 
     70        sampleContributions = mViewCellsManager->CastRays(rays); 
     71} 
    13372 
    13473int 
    135 SamplingPreprocessor::CastRay(Intersectable *object, Ray &ray) 
    136 { 
    137         int sampleContributions = 0; 
    138  
    139 /*      long t1 = GetRealTime(); 
     74SamplingPreprocessor::CastRay(const Ray &ray) 
     75{ 
    14076        // cast ray to KD tree to find intersection with other objects 
    14177        mKdTree->CastRay(ray); 
    142         long t2 = GetRealTime(); 
    143  
    144         if (0 && object && object->GetId() > 2197) { 
    145                 object->Describe(cout)<<endl; 
    146                 cout<<ray<<endl; 
    147         } 
    148  
    149         switch(ViewCell::sHierarchy) 
    150         { 
    151         case ViewCell::BSP: 
    152                  
    153                 //-- cast ray to BSP tree to get intersection with view cells 
    154                 if (!mBspTree) 
    155                         break; 
    156                  
    157                 mBspTree->CastRay(ray); 
    158                          
    159                 if (object) 
    160                         sampleContributions += AddObjectSamples(object, ray); 
    161                          
    162                 if (!ray.intersections.empty()) // second intersection found 
    163                 { 
    164                         sampleContributions +=  
    165                                 AddObjectSamples(ray.intersections[0].mObject, ray); 
    166                 } 
    167                 break; 
    168         case ViewCell::KD: 
    169                 if (ray.kdLeaves.size())  
    170                 { 
    171                         Intersectable *terminator = 
    172                                 ray.intersections.size() ? ray.intersections[0].mObject: NULL; 
    173  
    174                         sampleContributions += AddNodeSamples(ray, 
    175                                                                                                                                                                         object, 
    176                                                                                                                                                                         terminator); 
    177                 } 
    178                 break; 
    179         case ViewCell::VSP: 
    180                 // TODO: 
    181                 break; 
    182         default: 
    183                 Debug << "Should never come here" << endl; 
    184                 break; 
    185         } 
    186 */ 
    187         return sampleContributions; 
     78 
     79        return mViewCellsManager->CastRay(ray); 
    18880} 
    18981 
     
    265157                Vector3 target = t*poly.mVertices[edge] + (1.0f-t)*poly.mVertices[(edge + 1)% 
    266158                                                                                                                                                                                                                                                                                 poly.mVertices.size()]; 
    267                 SetupRay(ray, point, target - point, Ray::LOCAL_RAY); 
     159                SetupRay(ray, point, target - point, Ray::LOCAL_RAY, Ray::Intersection(0, object, 0)); 
    268160                if (!mesh->CastRay(ray, mi)) { 
    269161                        // the rays which intersect the mesh have been discarded since they are not tangent 
    270162                        // to the mesh 
    271163                        rays++; 
    272                         edgeSamplesContributions += CastRay(object, ray); 
     164                        edgeSamplesContributions += CastRay(ray); 
    273165                } 
    274166        } 
     
    347239SamplingPreprocessor::ComputeVisibility() 
    348240{ 
    349    
    350241  // pickup an object 
    351242  ObjectContainer objects; 
    352243   
     244  /// rays per pass 
     245  RayContainer passRays; 
     246 
    353247  mSceneGraph->CollectObjects(&objects); 
    354248 
    355249  Vector3 point, normal, direction; 
    356   Ray ray; 
     250  //Ray ray; 
    357251 
    358252  long startTime = GetTime(); 
     
    361255  int totalSamples = 0; 
    362256 
    363   int pvsOut = Min((int)objects.size(), 10); 
    364257  int pvsSize = 0; 
    365  
    366   RayContainer rays[10]; 
    367258 
    368259  while (totalSamples < mTotalSamples) { 
     
    374265                int reverseSamples = 0; 
    375266                 
    376                          
    377                 //cout << "totalSamples: "  << totalSamples << endl; 
    378  
    379267                for (i = 0; i < objects.size(); i++) { 
    380268                                                 
     
    383271                 
    384272                        int pvsSize = 0; 
    385                         //if (ViewCell::sHierarchy == ViewCell::KD) 
    386                         //      pvsSize = object->mKdPvs.GetSize(); 
    387                                                  
    388273                         
    389274                        if (0 && pvsSize && mPass == 1000 ) { 
     
    394279                         
    395280                        bool viewcellSample = true; 
    396                         int sampleContributions; 
     281                        //int sampleContributions; 
    397282                        bool debug = false; //(object->GetId() >= 2199); 
    398283                        if (viewcellSample) { 
     
    423308                                        } 
    424309                                         
     310                                        Ray *ray = new Ray(); 
     311 
     312                                        // the source object 
     313                                        Ray::Intersection source =  
     314                                                Ray::Intersection(0, reverseSample ? NULL : object, faceIndex); 
     315                                         
    425316                                        // construct a ray 
    426                                         SetupRay(ray, point, direction, Ray::LOCAL_RAY); 
    427                                          
    428                                         sampleContributions = CastRay(reverseSample ? NULL : object, ray); 
     317                                        SetupRay(*ray, point, direction, Ray::LOCAL_RAY, source); 
     318                                        passRays.push_back(ray); 
    429319                                         
    430320                                        //-- CORR matt: put block inside loop 
    431                                         if (sampleContributions) { 
     321                                        /*if (sampleContributions) { 
    432322                                                passContributingSamples ++; 
    433323                                                passSampleContributions += sampleContributions; 
    434                                         } 
    435  
    436                                         if ( i < pvsOut ) { 
    437                                                 Ray *nray = new Ray(ray); 
    438                                                 rays[i].push_back(nray); 
    439                                         } 
    440                  
    441                                         if (!ray.intersections.empty()) { 
    442                                                 // check whether we can add this to the rays 
    443                                                 for (int j = 0; j < pvsOut; j++) { 
    444                                                         if (objects[j] == ray.intersections[0].mObject) { 
    445                                                                 Ray *nray = new Ray(ray); 
    446                                                                 rays[j].push_back(nray); 
    447                                                         } 
    448                                                 } 
    449                                         } 
     324                                        }*/ 
     325                 
    450326                                        //------------------- 
    451327                                        ProcessViewCells(ray, 
    452                                                                          reverseSample ? NULL : object, 
    453                                                                          faceIndex, 
     328                                                                         objects, 
    454329                                                                         passContributingSamples, 
    455330                                                                         passSampleContributions); 
     
    465340                } 
    466341         
     342                CastRays(passRays, passSampleContributions, passContributingSamples); 
     343                CLEAR_CONTAINER(passRays); 
     344                passRays.clear(); 
     345 
    467346                totalSamples += passSamples;  
    468347                 
     
    472351                mPass++; 
    473352         
    474                 // TODO: move into view cell container 
    475                 /*if (ViewCell::sHierarchy == ViewCell::KD) 
    476                 { 
    477                         pvsSize = 0; 
    478  
    479                         for (i=0; i < objects.size(); i++) { 
    480                                 Intersectable *object = objects[i]; 
    481                                 pvsSize += object->mKdPvs.GetSize(); 
    482                         } 
    483                 } 
    484                 else 
    485353                        pvsSize += passSampleContributions; 
    486                 */ 
     354                 
    487355                float avgRayContrib = (passContributingSamples > 0) ?  
    488356                        passSampleContributions/(float)passContributingSamples : 0; 
     
    506374        } 
    507375         
    508 //      if (ViewCell::sHierarchy == ViewCell::KD)        
    509                 cout << "#totalKdPvsSize=" << mKdTree->CollectLeafPvs() << endl; 
    510    
    511         //-- render simulation 
    512         cout << "\nevaluating bsp view cells render time before merge ... "; 
    513  
    514         SimulationStatistics ss = mViewCellsManager->SimulateRendering(); 
    515  
    516         cout << " finished" << endl; 
    517         cout << ss << endl; 
    518         Debug << ss << endl; 
    519  
    520         if (mBspTree) 
    521         { 
    522                 //-- post processing of bsp view cells 
    523         int vcSize = 0; 
    524                 int pvsSize = 0; 
    525  
    526                 Debug << "overall scene size: " << (int)objects.size() << endl; 
    527                  
    528                 BspViewCellsStatistics stat; 
    529                 mBspTree->EvaluateViewCellsStats(stat); 
    530                 Debug << "original view cell partition:\n" << stat << endl; 
    531                  
    532                 if (1) // export view cells 
    533                 { 
    534                         cout << "exporting initial view cells (=leaves) ... "; 
    535                         Exporter *exporter = Exporter::GetExporter("view_cells.x3d"); 
    536                         if (exporter) 
    537                         { 
    538                                 exporter->SetWireframe(); 
    539                                 exporter->ExportBspLeaves(*mBspTree, stat.maxPvs); 
    540                                 //exporter->ExportBspViewCellPartition(*mBspTree, 0); 
    541                                  
    542                                 if (1) 
    543                                         ExportSceneGeometry(exporter, objects); 
    544                                          
    545                                 delete exporter; 
    546                         } 
    547                         cout << "finished" << endl; 
    548                 } 
    549  
    550                 cout << "starting post processing using " << mPostProcessSamples << " samples ... "; 
    551                  
    552                 long startTime = GetTime(); 
    553                 int merged = PostprocessViewCells(mSampleRays); 
    554                  
    555                 cout << "finished" << endl; 
    556                 cout << "merged " << merged << " view cells in " 
    557                          << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl; 
    558  
    559                 //-- recount pvs 
    560                 mBspTree->EvaluateViewCellsStats(stat); 
    561                  
    562                 Debug << "after post processing:\n" << stat << endl; 
    563  
    564                 //-- render simulation 
    565                 cout << "\nevaluating render time after merge ... "; 
    566                          
    567                 SimulationStatistics ss = mViewCellsManager->SimulateRendering(); 
    568  
    569                 cout << " finished" << endl; 
    570  
    571                 cout << ss << endl; 
    572                 Debug << ss << endl; 
    573  
    574                 if (1) // export view cells 
    575                 { 
    576                         cout << "exporting view cells after merge ... "; 
    577                         Exporter *exporter = Exporter::GetExporter("merged_view_cells.x3d"); 
    578                         if (exporter) 
    579                         { 
    580                                 exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs); 
    581                                 //exporter->ExportBspViewCellPartition(*mBspTree, 0); 
    582                                 delete exporter; 
    583                         } 
    584  
    585                         cout << "finished" << endl; 
    586                 } 
    587  
    588                 //-- visualization of the BSP splits 
    589                 bool exportSplits = false; 
    590                 environment->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits); 
    591                  
    592                 cout << "exporting splits ... "; 
    593                 if (exportSplits) 
    594                         ExportSplits(objects, mSampleRays, mVisualizationSamples); 
    595                 cout << "finished" << endl; 
    596  
    597                 // export the PVS of sample view cells 
    598                 if (1) 
    599                         ExportBspPvs(objects, mSampleRays, mVisualizationSamples); 
    600         } 
     376        //cout << "#totalKdPvsSize=" << mKdTree->CollectLeafPvs() << endl; 
    601377         
    602378  //  HoleSamplingPass(); 
     
    608384        } 
    609385 
    610         if (mVspKdTree) 
    611         { 
    612                 if (1) 
    613                 { 
    614                         Exporter *exporter = Exporter::GetExporter("vspkdtree.x3d");  
    615                         //exporter->SetWireframe(); 
    616                         exporter->ExportVspKdTree(*mVspKdTree, mVspKdTree->GetStatistics().maxPvsSize); 
    617  
    618                         Debug << "average PVS size: " << mVspKdTree->GetAvgPvsSize() << endl; 
    619  
    620                         if (0) ExportSceneGeometry(exporter, objects); 
    621  
    622                         bool exportRays = true; 
    623  
    624                         if (exportRays)  
    625                         { 
    626                                 int raysSize = 2000; 
    627                                 float prob = raysSize / (float)mVspSampleRays.size(); 
    628                  
    629                                 exporter->SetWireframe(); 
    630                          
    631                                 VssRayContainer rays; 
    632                                 for (int i = 0; i < mVspSampleRays.size(); ++ i) 
    633                                 { 
    634                                         if (RandomValue(0,1) < prob) 
    635                                                 rays.push_back(mVspSampleRays[i]); 
    636                                 } 
    637  
    638                                 exporter->ExportRays(rays, RgbColor(1, 0, 0)); 
    639                         } 
    640  
    641                         delete exporter; 
    642                 } 
    643  
    644                 if (1) 
    645                 { 
    646                         vector<VspKdTreeLeaf *> leafContainer; 
    647  
    648                         mVspKdTree->CollectLeaves(leafContainer); 
    649  
    650                         for (int i = 0; i < 10; ++ i) 
    651                         { 
    652                                 char s[64]; 
    653                                 sprintf(s, "vsp_leaves%04d.x3d", i); 
    654                                 Exporter *exporter = Exporter::GetExporter(s); 
    655  
    656                                 // export geometry 
    657                                 VspKdTreeLeaf *leaf = leafContainer[Random((int)leafContainer.size())];  
    658                                 AxisAlignedBox3 box = mVspKdTree->GetBBox(leaf); 
    659  
    660                                 Material m; 
    661                                 m.mDiffuseColor = RgbColor(0, 1, 1); 
    662                                 exporter->SetForcedMaterial(m); 
    663                                 exporter->SetWireframe(); 
    664                                 exporter->ExportBox(box); 
    665  
    666                                 //-- export stored rays 
    667                                 VssRayContainer vssRays; 
    668                                 leaf->GetRays(vssRays); 
    669  
    670                                 VssRayContainer rays; 
    671  
    672                                 VssRayContainer::const_iterator it, it_end = vssRays.end(); 
    673  
    674                                 for (it = vssRays.begin(); it != it_end; ++ it) 
    675                                 { 
    676                                         //if (!(*it)->mOriginObject && !(*it)->mTerminationObject) 
    677                         rays.push_back(*it); 
    678  
    679                                         //if (!(*it)->mOriginObject && !(*it)->mTerminationObject) 
    680                                         //      Debug << "ERR: " << (*it)->mOrigin << " " << (*it)->mTermination << endl; 
    681                                 } 
    682  
    683                                 exporter->ExportRays(rays, RgbColor(1, 0, 0)); 
    684  
    685                                 //-- export stored PVS 
    686                                 ObjectContainer pvsObj; 
    687                                 leaf->ExtractPvs(pvsObj); 
    688                                  
    689                                 ExportSceneGeometry(exporter, pvsObj); 
    690  
    691                                 delete exporter; 
    692                         }                        
    693                 } 
    694         } 
    695    
    696         bool exportRays = false; 
    697         if (exportRays) { 
    698                 Exporter *exporter = NULL; 
    699                 exporter = Exporter::GetExporter("sample-rays.x3d"); 
    700                 exporter->SetWireframe(); 
    701                 exporter->ExportKdTree(*mKdTree); 
    702                 exporter->ExportBspTree(*mBspTree); 
    703  
    704                 for (i=0; i < pvsOut; i++)  
    705                         exporter->ExportRays(rays[i], 1000, RgbColor(1, 0, 0)); 
    706                 exporter->SetFilled(); 
    707                  
    708                 delete exporter; 
    709         } 
     386        //-- post process view cells 
     387        mViewCellsManager->PostProcess(objects, mSampleRays); 
     388                 
    710389 
    711390        //-- several visualizations and statistics 
    712         if (1) { 
    713  
    714    for (int k=0; k < pvsOut; k++) { 
    715                  Intersectable *object = objects[k]; 
    716                  char s[64]; 
    717                  sprintf(s, "sample-pvs%04d.x3d", k); 
    718                  Exporter *exporter = Exporter::GetExporter(s); 
    719                  exporter->SetWireframe(); 
    720391                  
     392        //-- render simulation 
     393        cout << "\nevaluating bsp view cells render time before merge ... "; 
    721394                  
    722                  KdPvsMap::iterator i = object->mKdPvs.mEntries.begin(); 
    723                  Intersectable::NewMail(); 
     395        SimulationStatistics ss = mViewCellsManager->SimulateRendering(); 
    724396                  
    725                  // avoid adding the object to the list 
    726                  object->Mail(); 
    727                  ObjectContainer visibleObjects; 
     397        cout << " finished" << endl; 
     398        cout << ss << endl; 
     399        Debug << ss << endl; 
    728400                  
    729                  for (; i != object->mKdPvs.mEntries.end(); i++)  
    730                          { 
    731                                  KdNode *node = (*i).first; 
    732                                  exporter->ExportBox(mKdTree->GetBox(node)); 
    733                                  mKdTree->CollectObjects(node, visibleObjects); 
    734                          } 
    735                   
    736                  exporter->ExportRays(rays[k], 1000, RgbColor(0, 1, 0)); 
    737                  exporter->SetFilled(); 
    738                   
    739                  for (int j = 0; j < visibleObjects.size(); j++) 
    740                          exporter->ExportIntersectable(visibleObjects[j]); 
    741                   
    742                   
    743                  Material m; 
    744                  m.mDiffuseColor = RgbColor(1, 0, 0); 
    745                  exporter->SetForcedMaterial(m); 
    746                  exporter->ExportIntersectable(object); 
    747                   
    748                  delete exporter; 
    749          } 
    750   } 
     401        mViewCellsManager->Visualize(objects, mSampleRays);      
    751402   
    752403  return true; 
     
    754405 
    755406void SamplingPreprocessor::ProcessViewCells(const Ray &ray, 
    756                                             Intersectable *object, 
    757                                                                                         const int faceIndex, 
     407                                                                                        const ObjectContainer &objects, 
    758408                                                                                        int &contributingSamples, 
    759409                                                                                        int &sampleContributions) 
    760410{ 
    761 } 
    762 /* 
    763 void SamplingPreprocessor::ProcessVspViewCells(Ray &ray, 
    764                                                Intersectable *object, 
    765                                                                                            const int faceIndex, 
    766                                                                                            int &contributingSamples, 
    767                                                                                            int &sampleContributions) 
    768 { 
    769         if (!mVspKdTree) 
    770         { 
    771                 // store samples for vsp kd tree construction 
    772                 if ((int)mVspSampleRays.size() < mVspConstructionSamples) 
     411        // save rays for view cells construction 
     412        if (!mViewCellsManager->ViewCellsConstructed()) 
    773413                { 
    774                         if (!ray.intersections.empty()) 
    775                         { 
    776                                 ray.sourceObject = Ray::Intersection(0.0, object, faceIndex); 
    777                                 VssRay *sRay = new VssRay(ray); 
    778                                 mVspSampleRays.push_back(sRay); 
    779                         } 
    780                 } 
     414                if ((int)mSampleRays.size() < mViewCellsManager->GetConstructionSamples()) 
     415                        mVssSampleRays.push_back(new VssRay(ray)); 
    781416                else 
    782417                { 
    783                         // construct VSP tree using the collected samples 
    784                         cout << "building VSP tree from " << (int)mVspSampleRays.size() << " samples " << endl; 
    785                         mVspKdTree = new VspKdTree(); 
    786                         mVspKdTree->Construct(mVspSampleRays, &mKdTree->GetBox()); 
     418                        mViewCellsManager->Construct(objects, mVssSampleRays); 
     419                        // construct view cells using the collected samples 
     420                        cout << "building view cells from " << (int)mSampleRays.size() << " samples " << endl; 
    787421                 
    788422                        // add contributions of saved samples to PVS 
     
    790424                        //sampleContributions += mBspTree->GetStat().sampleContributions; 
    791425 
    792                         Debug << mVspKdTree->GetStatistics(); 
    793  
    794                         // throw away samples because BSP leaves not stored in order  
    795                         // Need ordered rays for post processing => collect new rays 
    796                         //CLEAR_CONTAINER(mVspSampleRays); 
    797                 } 
    798         } 
    799 } 
    800  
    801 void SamplingPreprocessor::ProcessBspViewCells(const Ray &ray, 
    802                                                Intersectable *object, 
    803                                                                                            const int faceIndex, 
    804                                                                                            int &contributingSamples, 
    805                                                                                            int &sampleContributions) 
    806 { 
    807         // save rays for bsp tree construction 
    808         if (!mBspTree) 
    809         { 
    810                 if ((BspTree::sConstructionMethod == BspTree::FROM_SAMPLES) && 
    811                         ((int)mSampleRays.size() < mBspConstructionSamples)) 
    812                 { 
    813                         MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 
    814                          
    815                         Ray *sRay = new Ray(ray); 
    816                         mSampleRays.push_back(sRay); 
    817                  
    818                         // also add origin to sample 
    819                         sRay->sourceObject = Ray::Intersection(0.0, object, faceIndex); 
    820                 } 
    821                 else 
    822                 { 
    823                         // construct BSP tree using the collected samples 
    824                         cout << "building bsp tree from " << (int)mSampleRays.size() << " samples " << endl; 
    825                         BuildBspTree(); 
    826                  
    827                         // add contributions of saved samples to PVS 
    828                         contributingSamples += mBspTree->GetStat().contributingSamples; 
    829                         sampleContributions += mBspTree->GetStat().sampleContributions; 
    830  
    831                         BspTreeStatistics(Debug); 
    832  
    833                         if (0) Export("vc_bsptree.x3d", false, false, true); 
    834  
    835                         // throw away samples because BSP leaves not stored in order  
    836                         // Need ordered rays for post processing => collect new rays 
    837                         CLEAR_CONTAINER(mSampleRays); 
    838                 } 
    839         } 
    840         // save rays for post processing 
    841         else if (((int)mSampleRays.size() < mPostProcessSamples) || 
    842                          ((int)mSampleRays.size() < mVisualizationSamples)) 
     426                        // throw away samples  
     427                        CLEAR_CONTAINER(mVssSampleRays); 
     428                } 
     429        } 
     430        // Need (ordered) rays for post processing => collect new rays 
     431        else if (((int)mSampleRays.size() < mViewCellsManager->GetPostProcessSamples()) || 
     432                         ((int)mSampleRays.size() < mViewCellsManager->GetVisualizationSamples())) 
    843433        { 
    844434                mSampleRays.push_back(new Ray(ray)); 
    845435        } 
    846436} 
    847 */ 
    848 // merge or subdivide view cells 
    849 int SamplingPreprocessor::PostprocessViewCells(const RayContainer &rays) 
    850 { 
    851         int merged = 0; 
    852  
    853         RayContainer::const_iterator rit, rit_end = rays.end(); 
    854         vector<Ray::BspIntersection>::const_iterator iit; 
    855  
    856         int limit = min((int)mSampleRays.size(), mPostProcessSamples); 
    857  
    858         for (int i = 0; i < limit; ++ i) 
    859         {   
    860                 Ray *ray = mSampleRays[i]; 
    861  
    862                 // traverse leaves stored in the rays and compare and merge consecutive 
    863                 // leaves (i.e., the neighbors in the tree) 
    864                 if (ray->bspIntersections.size() < 2) 
    865                         continue; 
    866  
    867                 iit = ray->bspIntersections.begin(); 
    868  
    869                 BspLeaf *previousLeaf = (*iit).mLeaf; 
    870                 ++ iit; 
    871                  
    872                 for (; iit != ray->bspIntersections.end(); ++ iit) 
    873                 { 
    874                         BspLeaf *leaf = (*iit).mLeaf; 
    875  
    876                         if (mBspTree->ShouldMerge(leaf, previousLeaf)) 
    877                         {                        
    878                                 mBspTree->MergeViewCells(leaf, previousLeaf); 
    879  
    880                                 ++ merged; 
    881                         } 
    882                  
    883                         previousLeaf = leaf; 
    884                 } 
    885         } 
    886  
    887         return merged; 
    888 } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h

    r439 r440  
    2222 
    2323protected: 
     24        /** Sets up ray for sampling. 
     25        */ 
    2426  void 
    2527  SetupRay(Ray &ray,  
    2628                   const Vector3 &point,  
    2729                   const Vector3 &direction, 
    28                    const int type); 
     30                         const int type, 
     31                         const Ray::Intersection &source); 
    2932 
    30   KdNode * 
    31   GetNodeForPvs(KdLeaf *leaf); 
    32  
    33         int 
    34         AddNodeSamples(const Ray &ray, 
    35                                                                  Intersectable *sObject, 
    36                                                                  Intersectable *tObject 
    37                                                                  ); 
    38  
     33        /** Refined sampling for finding "holes", i.e., difficult visibility. 
     34        */ 
    3935  void 
    4036  HoleSamplingPass(); 
    4137 
     38        /** Casts a bundle of sample rays into the scene. 
     39        */ 
     40        int CastRays(const RayContainer &rays, 
     41                                 int &sampleContribtion,  
     42                                 int &contributingSamples); 
     43         
     44        /** Casts a ray into the scene. 
     45        */ 
    4246        int 
    43         CastRay(Intersectable *object, 
    44                                         Ray &ray); 
     47        CastRay(const Ray &ray); 
    4548         
    46         KdNode * 
    47         GetNodeToSample(Intersectable *object); 
     49        /** Verify if the exact visibility for this object was established. 
     50        */ 
    4851        void 
    4952        VerifyVisibility(Intersectable *object); 
    5053 
    51         int 
    52         CastEdgeSamples( 
     54        /** Sample the shiluette of objects in order to find visibility changes 
     55                along the visibility skeleton. 
     56        */ 
     57        int CastEdgeSamples( 
    5358                                                                        Intersectable *object, 
    5459                                                                        const Vector3 &point, 
     
    5762                                                                        ); 
    5863 
    59         /** Processes the BSP based view cells during a pass. 
    60                  
     64        /** Processes the view cells during a pass. 
    6165                @param ray the current ray 
    62                 @param object the currently processed object 
    63                 @param faceIndex the sampled face of the object 
    64                 @param contributingSamples samples contributing to pvs 
    65                 @param sampleContributions contribution of the samples 
    66         */ 
    67         /*void ProcessBspViewCells(const Ray &ray, 
    68                                                          Intersectable *object, 
    69                                                          const int faceIndex, 
    70                                                          int &contributingSamples, 
    71                                                          int &sampleContributions); 
    7266 
    73         void ProcessVspViewCells(Ray &ray, 
    74                                                          Intersectable *object, 
    75                                                          const int faceIndex, 
    76                                                          int &contributingSamples, 
    77                                                          int &sampleContributions); 
     67                @param contributingSamples returns the samples contributing to pvs 
     68                @param sampleContributions returns the accumulated  
     69                contribution of the samples 
    7870*/ 
     71         
    7972        void ProcessViewCells(const Ray &ray, 
    80                                                   Intersectable *object, 
    81                                                   const int faceIndex, 
     73                                                  const ObjectContainer &objects, 
    8274                                                  int &contributingSamples, 
    8375                                                  int &sampleContributions); 
     
    8779        int AddObjectSamples(Intersectable *obj, const Ray &ray); 
    8880 
    89         /** Post processes view cells (i.e., merges or subdivides view cells based 
    90                 on the PVS and the ray sets. 
    91                 @param rays a set of rays which carries the visibility information  
    92                 the merging / subdivision is based on. 
    93                 @returns number of merged view cells. 
     81        /** 
     82                Returns random node as target for the current sample ray. 
    9483        */ 
    95         int PostprocessViewCells(const RayContainer &rays); 
     84        KdNode *GetNodeToSample(Intersectable *object); 
     85 
    9686 
    9787protected: 
     
    10191        int mSamplesPerPass; 
    10292        int mTotalSamples; 
    103         int mKdPvsDepth; 
     93         
    10494        ofstream mStats; 
    10595        ObjectContainer mObjects; 
    10696 
    10797        RayContainer mSampleRays; 
    108         VssRayContainer mVspSampleRays; 
    109          
    110         int mVspConstructionSamples; 
    111  
    112     int mPostProcessSamples; 
    113         int mVisualizationSamples; 
    114  
     98        VssRayContainer mVssSampleRays; 
    11599}; 
    116100 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r439 r440  
    3535*/ 
    3636const float BspTree::sBalancedRaysTable[] = {1, -1, 0, 0, 0}; 
    37  
    38 int BspTree::sConstructionMethod = FROM_INPUT_VIEW_CELLS; 
    3937 
    4038int BspTree::sFrontId = 0;  
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r437 r440  
    526526        static void ParseEnvironment(); 
    527527 
    528         /// BSP tree construction method 
    529         static int sConstructionMethod; 
    530  
    531528 
    532529protected: 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h

    r437 r440  
    441441        int CastRay(Ray &ray); 
    442442 
    443         /** Set to true if new view cells shall be generated in each leaf. 
    444         */ 
    445         void SetGenerateViewCells(int generateViewCells); 
    446  
    447443        /// bsp tree construction types 
    448444        enum {FROM_INPUT_VIEW_CELLS, FROM_SCENE_GEOMETRY, FROM_SAMPLES}; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp

    r433 r440  
    444444 
    445445void 
    446 VspKdTree::Construct(VssRayContainer &rays, 
     446VspKdTree::Construct(const VssRayContainer &rays, 
    447447                                         AxisAlignedBox3 *forcedBoundingBox) 
    448448{ 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h

    r428 r440  
    426426        virtual ~VspKdTree(); 
    427427 
    428         virtual void Construct(VssRayContainer &rays, 
     428        virtual void Construct(const VssRayContainer &rays, 
    429429                                                   AxisAlignedBox3 *forcedBoundingBox = NULL); 
    430430 
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp

    r438 r440  
    11481148        CLEAR_CONTAINER(polys); 
    11491149} 
     1150 
     1151 
     1152void X3dExporter::ExportGeometry(const ObjectContainer &objects) 
     1153{ 
     1154        for (int j = 0; j < objects.size(); ++ j) 
     1155                ExportIntersectable(objects[j]); 
     1156} 
     1157 
     1158 
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h

    r438 r440  
    8484 
    8585  virtual void  
     86  ExportGeometry(const ObjectContainer &objects); 
     87 
     88  virtual void  
    8689  ExportBspSplitPlanes(const BspTree &tree); 
    8790   
Note: See TracChangeset for help on using the changeset viewer.