source: GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp @ 1404

Revision 1404, 19.0 KB checked in by mattausch, 18 years ago (diff)

debugging after merge

Line 
1#include "SceneGraph.h"
2#include "KdTree.h"
3#include "VssPreprocessor.h"
4#include "X3dExporter.h"
5#include "Environment.h"
6#include "MutualVisibility.h"
7#include "Polygon3.h"
8#include "ViewCell.h"
9#include "VssRay.h"
10#include "VssTree.h"
11#include "ViewCellsManager.h"
12#include "RenderSimulator.h"
13#include "Beam.h"
14#include "GlRenderer.h"
15#include "Intersectable.h"
16#ifdef GTP_INTERNAL
17#include "ArchModeler2MLRT.hxx"
18#endif
19
20namespace GtpVisibilityPreprocessor {
21
22bool use2dSampling = false;
23bool useViewspacePlane = false;
24
25VssPreprocessor::VssPreprocessor():
26  mVssRays(),
27  mViewSpaceBox(NULL)
28{
29  // this should increase coherence of the samples
30  Environment::GetSingleton()->GetIntValue("VssPreprocessor.samplesPerPass", mSamplesPerPass);
31  Environment::GetSingleton()->GetIntValue("VssPreprocessor.initialSamples", mInitialSamples);
32  Environment::GetSingleton()->GetIntValue("VssPreprocessor.vssSamples", mVssSamples);
33  Environment::GetSingleton()->GetIntValue("VssPreprocessor.vssSamplesPerPass", mVssSamplesPerPass);
34  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.useImportanceSampling", mUseImportanceSampling);
35 
36  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.loadInitialSamples", mLoadInitialSamples);
37  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.storeInitialSamples", mStoreInitialSamples);
38  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.useViewSpaceBox", mUseViewSpaceBox);
39  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.testBeamSampling", mTestBeamSampling);
40  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.enlargeViewSpace", mEnlargeViewSpace);
41  Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace);
42 
43  useViewspacePlane = mUseViewSpaceBox; //hack
44
45 
46  Debug << "*********** vss preprocessor options **************" << endl;
47  Debug << "use view space box=" << mUseViewSpaceBox << endl;
48  Debug << "enlarge view space=" << mEnlargeViewSpace << endl;
49  Debug << "*********** end vss preprocessor options **************" << endl;
50
51  mStats.open("stats.log");
52}
53
54
55VssPreprocessor::~VssPreprocessor()
56{
57        CLEAR_CONTAINER(mVssRays);
58        DEL_PTR(mViewSpaceBox);
59}
60
61
62
63
64
65
66Vector3
67VssPreprocessor::GetViewpoint(AxisAlignedBox3 *viewSpaceBox)
68{
69  AxisAlignedBox3 box;
70
71  if (viewSpaceBox)
72        box =*viewSpaceBox;
73  else
74        box = mKdTree->GetBox();
75
76  // shrink the box in the y direction
77  return box.GetRandomPoint();
78}
79
80Vector3
81VssPreprocessor::GetDirection(const Vector3 &viewpoint,
82                                                          AxisAlignedBox3 *viewSpaceBox
83                                                          )
84{
85  Vector3 point;
86  if (!use2dSampling)
87  {
88          if (0)
89          {
90                  Vector3 normal;
91                  int i = Random((int)mObjects.size());
92                  Intersectable *object = mObjects[i];
93                  object->GetRandomSurfacePoint(point, normal);
94          }
95          else
96                  point = mKdTree->GetBox().GetRandomPoint();
97        //        point = viewpoint + UniformRandomVector();
98  }
99  else
100  {
101          AxisAlignedBox3 box;
102
103          if (viewSpaceBox)
104                  box =*viewSpaceBox;
105          else
106                  box = mKdTree->GetBox();
107
108          point = box.GetRandomPoint();
109          point.y = viewpoint.y;
110  }
111
112  return point - viewpoint;
113}
114
115int
116VssPreprocessor::GenerateImportanceRays(VssTree *vssTree,
117                                                                                const int desiredSamples,
118                                                                                SimpleRayContainer &rays
119                                                                                )
120{
121  int num;
122  if (0) {
123        float minRayContribution;
124        float maxRayContribution;
125        float avgRayContribution;
126
127        vssTree->GetRayContributionStatistics(minRayContribution,
128                                                                                  maxRayContribution,
129                                                                                  avgRayContribution);
130
131        cout<<
132          "#MIN_RAY_CONTRIB\n"<<minRayContribution<<endl<<
133          "#MAX_RAY_CONTRIB\n"<<maxRayContribution<<endl<<
134          "#AVG_RAY_CONTRIB\n"<<avgRayContribution<<endl;
135
136        float p = desiredSamples/(float)(avgRayContribution*vssTree->stat.Leaves());
137        num = vssTree->GenerateRays(p, rays);
138  } else {
139        int leaves = vssTree->stat.Leaves();
140        num = vssTree->GenerateRays(desiredSamples, leaves, rays);
141  }
142
143  cout<<"Generated "<<num<<" rays."<<endl;
144
145  return num;
146}
147
148
149bool
150VssPreprocessor::ExportRays(const char *filename,
151                                                        const VssRayContainer &vssRays,
152                                                        const int number
153                                                        )
154{
155  cout<<"Exporting vss rays..."<<endl<<flush;
156
157  Exporter *exporter = NULL;
158  exporter = Exporter::GetExporter(filename);
159  exporter->SetWireframe();
160  exporter->ExportKdTree(*mKdTree);
161  exporter->SetFilled();
162  exporter->ExportScene(mSceneGraph->GetRoot());
163  exporter->SetWireframe();
164
165  if (mViewSpaceBox) {
166        exporter->SetForcedMaterial(RgbColor(1,0,1));
167        exporter->ExportBox(*mViewSpaceBox);
168        exporter->ResetForcedMaterial();
169  }
170
171  VssRayContainer rays;
172  vssRays.SelectRays(number, rays);
173 
174  //exporter->ExportRays(rays, RgbColor(1, 0, 0));
175
176  delete exporter;
177
178  cout<<"done."<<endl<<flush;
179
180  return true;
181}
182
183
184bool
185VssPreprocessor::ExportVssTree(char *filename,
186                                                           VssTree *tree,
187                                                           const Vector3 &dir
188                                                           )
189{
190  Exporter *exporter = Exporter::GetExporter(filename);
191  exporter->SetFilled();
192  exporter->ExportScene(mSceneGraph->GetRoot());
193  //  exporter->SetWireframe();
194  bool result = exporter->ExportVssTree2( *tree, dir );
195  delete exporter;
196  return result;
197}
198
199bool
200VssPreprocessor::ExportVssTreeLeaf(char *filename,
201                                                                   VssTree *tree,
202                                                                   VssTreeLeaf *leaf)
203{
204  Exporter *exporter = NULL;
205  exporter = Exporter::GetExporter(filename);
206  exporter->SetWireframe();
207  exporter->ExportKdTree(*mKdTree);
208
209  if (mViewSpaceBox) {
210        exporter->SetForcedMaterial(RgbColor(1,0,0));
211        exporter->ExportBox(*mViewSpaceBox);
212        exporter->ResetForcedMaterial();
213  }
214
215  exporter->SetForcedMaterial(RgbColor(0,0,1));
216  exporter->ExportBox(tree->GetBBox(leaf));
217  exporter->ResetForcedMaterial();
218
219  VssRayContainer rays[4];
220  for (int i=0; i < leaf->rays.size(); i++) {
221        int k = leaf->rays[i].GetRayClass();
222        rays[k].push_back(leaf->rays[i].mRay);
223  }
224
225  // SOURCE RAY
226  exporter->ExportRays(rays[0], RgbColor(1, 0, 0));
227  // TERMINATION RAY
228  exporter->ExportRays(rays[1], RgbColor(1, 1, 1));
229  // PASSING_RAY
230  exporter->ExportRays(rays[2], RgbColor(1, 1, 0));
231  // CONTAINED_RAY
232  exporter->ExportRays(rays[3], RgbColor(0, 0, 1));
233
234  delete exporter;
235  return true;
236}
237
238void
239VssPreprocessor::ExportVssTreeLeaves(VssTree *tree, const int number)
240{
241  vector<VssTreeLeaf *> leaves;
242  tree->CollectLeaves(leaves);
243
244  int num = 0;
245  int i;
246  float p = number / (float)leaves.size();
247  for (i=0; i < leaves.size(); i++) {
248        if (RandomValue(0,1) < p) {
249          char filename[64];
250          sprintf(filename, "vss-leaf-%04d.x3d", num);
251          ExportVssTreeLeaf(filename, tree, leaves[i]);
252          num++;
253        }
254        if (num >= number)
255          break;
256  }
257}
258
259
260void VssPreprocessor::TestBeamCasting(VssTree *tree,
261                                                                          ViewCellsManager *vm,
262                                                                          const ObjectContainer &objects)
263{
264        //debuggerWidget = new GlDebuggerWidget(renderer);
265        //  renderer->resize(640, 480);
266        //debuggerWidget->resize(640, 480);
267
268        vector<VssTreeLeaf *> leaves;
269        tree->CollectLeaves(leaves);
270
271        Exporter *exporter = Exporter::GetExporter("shafts.x3d");
272
273        exporter->SetWireframe();
274        exporter->ExportGeometry(objects);
275        exporter->SetFilled();
276        //Randomize();
277// §§matt
278//      debuggerWidget = new GlDebuggerWidget(renderer);
279
280        /*debuggerWidget->mBeam = beam;
281        debuggerWidget->mSourceObject = sourceObj;
282        debuggerWidget->mSamples = 10000;
283       
284        Debug << "showing window" << endl;
285        debuggerWidget->show();
286       
287        renderer->makeCurrent();*/
288
289        for (int i = 0; i < 10; ++ i)
290        {
291                Beam beam;
292                Intersectable *sourceObj = mObjects[5];
293
294                const int index = (int)RandomValue(0, (Real)((int)leaves.size() - 1));
295                VssTreeLeaf *leaf = leaves[index];
296
297                AxisAlignedBox3 dirBox = tree->GetDirBBox(leaf);
298                AxisAlignedBox3 box = tree->GetBBox(leaf);
299               
300                beam.Construct(box, dirBox);
301
302                // collect kd leaves and view cells
303                mKdTree->CastBeam(beam);
304                vm->CastBeam(beam);
305
306                Debug << "found " << (int)beam.mViewCells.size() << " view cells and "
307                          << (int)beam.mKdNodes.size() << " kd nodes" << endl;
308
309                BeamSampleStatistics stats;
310// §§matt
311/*              renderer->SampleBeamContributions(sourceObj,
312                                                                                  beam,
313                                                                                  200000,
314                                                                                  stats);
315
316                char s[64]; sprintf(s, "shaft%04d.png", i);
317
318                QImage image = renderer->toImage();
319                image.save(s, "PNG");
320                Debug << "beam statistics: " << stats << endl << endl;
321*/
322                if (1)
323                {
324                        AxisAlignedBox3 sbox = mSceneGraph->GetBox();
325                        Vector3 bmin = sbox.Min() - 150.0f;
326                        Vector3 bmax = sbox.Max() + 150.0f;
327                        AxisAlignedBox3 vbox(bmin, bmax);
328               
329                        exporter->ExportBeam(beam, vbox);
330                }
331
332                bool exportViewCells = false;
333               
334                if (exportViewCells)
335                {
336                        ViewCellContainer::const_iterator it, it_end = beam.mViewCells.end();
337                       
338                        for (it = beam.mViewCells.begin(); it != beam.mViewCells.end(); ++ it)
339                        {
340                                BspNodeGeometry geom;
341                                AxisAlignedBox3 vbox;
342                                vbox.Initialize();
343                                vbox.Include((*it)->GetMesh());
344                       
345                                exporter->SetWireframe();
346                                exporter->ExportBox(vbox);
347                                exporter->SetFilled();
348                                exporter->ExportViewCell(*it);
349                        }
350
351                        /*vector<KdNode *>::const_iterator it, it_end = beam.mKdNodes.end();
352                       
353                        for (it = beam.mKdNodes.begin(); it != beam.mKdNodes.end(); ++ it)
354                        {
355                                exporter->ExportBox(mKdTree->GetBox((*it)));
356                        }*/
357                }
358        }
359        /*while (1)
360        { debuggerWidget->repaint();
361        };*/
362        delete exporter;
363}
364
365
366float
367VssPreprocessor::GetAvgPvsSize(VssTree *tree,
368                                                           const vector<AxisAlignedBox3> &viewcells
369                                                           )
370{
371  vector<AxisAlignedBox3>::const_iterator it, it_end = viewcells.end();
372
373  int sum = 0;
374  for (it = viewcells.begin(); it != it_end; ++ it)
375        sum += tree->GetPvsSize(*it);
376
377  return sum/(float)viewcells.size();
378}
379
380bool
381VssPreprocessor::ComputeVisibility()
382{
383        Debug << "type: vss" << endl;
384
385  long startTime = GetTime();
386
387  int totalSamples = 0;
388
389
390  AxisAlignedBox3 box(mKdTree->GetBox());
391 
392  if (!useViewspacePlane) {
393        float size = 0.05f;
394        float s = 0.5f - size;
395        float olds = Magnitude(box.Size());
396        box.Enlarge(box.Size()*Vector3(-s));
397        Vector3 translation = Vector3(-olds*0.1f, 0, 0);
398        box.SetMin(box.Min() + translation);
399        box.SetMax(box.Max() + translation);
400  } else {
401
402        // sample city like heights
403        box.SetMin(1, box.Min(1) + box.Size(1)*0.2f);
404        box.SetMax(1, box.Min(1) + box.Size(1)*0.3f);
405  }
406
407  if (use2dSampling)
408        box.SetMax(1, box.Min(1));
409
410  cout << "use view space box=" << mUseViewSpaceBox << endl;
411
412 
413  if (mUseViewSpaceBox)
414  {
415        //mViewSpaceBox = ConstructViewSpaceBox();
416
417          if (!mEnlargeViewSpace)
418          {
419                  mViewSpaceBox = new AxisAlignedBox3(box);
420          }
421          else
422          {
423                  mViewSpaceBox = new AxisAlignedBox3(mKdTree->GetBox());
424
425                  if (0)
426                  {
427                          // HACK: enlarge in y directon
428                          Vector3 size = mViewSpaceBox->Size();
429                       
430                          size[1] *= 1.25;
431                          Vector3 enlarge(size[0] * 0.25f, size[1] * 0.0f, size[2] * 0.25f);
432                          //Vector3 enlarge(size[0] * 4.0f, 0.0f, 0.0f);
433
434                          mViewSpaceBox->Enlarge(enlarge);
435                          mViewSpaceBox->SetMax(mViewSpaceBox->Max() + enlarge);
436                  }
437                  else
438                  {
439                          AxisAlignedBox3 tbox(*mViewSpaceBox);
440
441                          Vector3 size = mViewSpaceBox->Size();
442                          tbox.SetMax(0, mViewSpaceBox->Max(0) + size[0] * 0.5f);
443                          tbox.SetMin(0, mViewSpaceBox->Min(0) + size[0]);
444                          *mViewSpaceBox = tbox;
445
446                          // $$ JB temporary
447                          /*AxisAlignedBox3 tempbox = *mViewSpaceBox;
448                         
449                          float s = tempbox.Size(0);
450                         
451                          tempbox.Scale(0.8f);
452                          tempbox.SetMax(0, box.Max(0) + s*0.8f);
453                          tempbox.SetMin(0, box.Min(0) + s*0.8f);
454                          *mViewSpaceBox = tempbox;*/
455                  }             
456          }
457          //Debug << "view space box: " << *mViewSpaceBox << endl;
458  }
459  else
460  {
461          mViewSpaceBox = NULL;
462  }
463 
464  AxisAlignedBox3 vbox = mViewSpaceBox ? *mViewSpaceBox : mKdTree->GetBox();
465
466  mSceneGraph->CollectObjects(&mObjects);
467
468  if (!mLoadViewCells)
469  {
470          //-- generate new view cells or reconstruct them
471          //-- for construction the manager uses it's own set of samples
472          mViewCellsManager->SetViewSpaceBox(vbox);
473          mViewCellsManager->Construct(this);
474
475          // output visualizations and statistics
476          Debug << "view cells construction finished: " << endl;
477          mViewCellsManager->PrintStatistics(Debug);
478  }
479#if 1
480  else
481  {     
482          //-- load view cells from file
483          //-- test successful view cells loading by exporting them again
484      VssRayContainer dummies;
485          mViewCellsManager->Visualize(mObjects, dummies);
486          mViewCellsManager->ExportViewCells("test.xml.zip", mViewCellsManager->GetExportPvs(), mObjects);
487  }
488#endif
489
490  VssTree *vssTree = NULL;
491  const long initialTime = GetTime();
492
493  if (mLoadInitialSamples)
494  {
495          cout << "Loading samples from file ... ";
496          LoadSamples(mVssRays, mObjects);
497          cout << "finished\n" << endl;
498          totalSamples = (int)mVssRays.size();
499  }
500  else
501  {
502        while (totalSamples < mInitialSamples) {
503                int passContributingSamples = 0;
504                int passSampleContributions = 0;
505                int passSamples = 0;
506
507                int index = 0;
508
509                int sampleContributions;
510
511                int s = Min(mSamplesPerPass, mInitialSamples);
512                for (int k=0; k < s; k++) {
513                        // changed by matt
514                        Vector3 viewpoint;
515                        //                      viewpoint = GetViewpoint(mViewSpaceBox);
516                        mViewCellsManager->GetViewPoint(viewpoint);
517                        Vector3 direction = GetDirection(viewpoint, mViewSpaceBox);
518
519                        sampleContributions = CastRay(viewpoint, direction, 1, mVssRays, vbox);
520
521                        if (sampleContributions) {
522                                passContributingSamples ++;
523                                passSampleContributions += sampleContributions;
524                        }
525                        passSamples++;
526                        totalSamples++;
527                }
528
529                mPass++;
530                int pvsSize = 0;
531                float avgRayContrib = (passContributingSamples > 0) ?
532                        passSampleContributions/(float)passContributingSamples : 0;
533
534                cout << "#Pass " << mPass << " : t = " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl;
535                cout << "#TotalSamples=" << totalSamples/1000
536                        << "#SampleContributions=" << passSampleContributions << " ("
537                        << 100*passContributingSamples/(float)passSamples<<"%)" << " avgPVS="
538                        << pvsSize/(float)mObjects.size() << endl
539                        << "avg ray contrib=" << avgRayContrib << endl;
540
541                mStats <<
542                        "#Pass\n" <<mPass<<endl<<
543                        "#Time\n" << TimeDiff(startTime, GetTime())*1e-3 << endl<<
544                        "#TotalSamples\n" << totalSamples<< endl<<
545                        "#SampleContributions\n" << passSampleContributions << endl <<
546                        "#PContributingSamples\n"<<100*passContributingSamples/(float)passSamples<<endl <<
547                        "#AvgPVS\n"<< pvsSize/(float)mObjects.size() << endl <<
548                        "#AvgRayContrib\n" << avgRayContrib << endl;
549          }
550 
551          cout << "#totalPvsSize=" << mKdTree->CollectLeafPvs() << endl;
552
553
554         
555  }
556 
557
558  cout << "#totalRayStackSize=" << (int)mVssRays.size() << endl << flush;
559  Debug << (int)mVssRays.size() << " rays generated in "
560            << TimeDiff(initialTime, GetTime()) * 1e-3 << " seconds" << endl;
561
562  if (mStoreInitialSamples)
563  {
564          cout << "Writing " << (int)mVssRays.size() << " samples to file ... ";
565          ExportSamples(mVssRays);
566          cout << "finished\n" << endl;
567
568          /*VssRayContainer dummyRays;
569          LoadSamples(dummyRays, mObjects);
570          Debug << "rays " << (int)mVssRays.size() << " " << dummyRays.size() << endl;
571
572          for (int i = 0; i < (int)mVssRays.size(); ++ i)
573          {
574                  Debug << mVssRays[i]->GetOrigin() << " " << mVssRays[i]->GetTermination() << " " << mVssRays[i]->mOriginObject << " " << mVssRays[i]->mTerminationObject << endl;
575                  Debug << dummyRays[i]->GetOrigin() << " " << dummyRays[i]->GetTermination() << " " << dummyRays[i]->mOriginObject << " " << dummyRays[i]->mTerminationObject << endl << endl;
576          }*/
577  }
578
579 
580  //int numExportRays = 2000;
581  int numExportRays = 0;
582
583  if (numExportRays) {
584        char filename[64];
585        sprintf(filename, "vss-rays-initial.x3d");
586        ExportRays(filename, mVssRays, numExportRays);
587  }
588
589  vssTree = new VssTree;
590  // viewcells = Construct(mVssRays);
591
592  vssTree->Construct(mVssRays, mViewSpaceBox);
593  cout<<"VssTree root PVS size = "<<vssTree->GetRootPvsSize()<<endl;
594
595  ExportRays("kdtree.x3d", mVssRays, 10);
596
597  if (0)
598  {
599          ExportVssTree("vss-tree-100.x3d", vssTree, Vector3(1,0,0));
600          ExportVssTree("vss-tree-001.x3d", vssTree, Vector3(0,0,1));
601          ExportVssTree("vss-tree-101.x3d", vssTree, Vector3(1,0,1));
602          ExportVssTree("vss-tree-101m.x3d", vssTree, Vector3(-1,0,-1));
603          ExportVssTreeLeaves(vssTree, 10);
604  }
605
606  // viewcells->UpdatePVS(newVssRays);
607  // get viewcells as kd tree boxes
608  vector<AxisAlignedBox3> kdViewcells;
609  if (0) {
610        vector<KdLeaf *> leaves;
611        mKdTree->CollectLeaves(leaves);
612        vector<KdLeaf *>::const_iterator it;
613        int targetLeaves = 50;
614        float prob = targetLeaves/(float)leaves.size();
615        for (it = leaves.begin(); it != leaves.end(); ++it)
616          if (RandomValue(0.0f,1.0f) < prob)
617                kdViewcells.push_back(mKdTree->GetBox(*it));
618
619        float avgPvs = GetAvgPvsSize(vssTree, kdViewcells);
620        cout<<"Initial average PVS size = "<<avgPvs<<endl;
621  }
622
623
624  int samples = 0;
625  int pass = 0;
626
627 
628  // cast view cell samples
629  while (samples < mVssSamples)
630  {
631       
632        int num = mVssSamplesPerPass;
633        SimpleRayContainer rays;
634        VssRayContainer vssRays;
635
636        if (!mUseImportanceSampling) {
637          for (int j=0; j < num; j++) {
638            // changed by matt
639                //Vector3 viewpoint = GetViewpoint(mViewSpaceBox);
640                Vector3 viewpoint;
641                mViewCellsManager->GetViewPoint(viewpoint);
642                Vector3 direction = GetDirection(viewpoint, mViewSpaceBox);
643                rays.push_back(SimpleRay(viewpoint, direction));
644          }
645        } else {
646          num = GenerateImportanceRays(vssTree, num, rays);
647        }
648
649        for (int i=0; i < rays.size(); i++)
650          CastRay(rays[i].mOrigin, rays[i].mDirection, 1, vssRays, vbox);
651
652        vssTree->AddRays(vssRays);
653
654        if (0) {
655          int subdivided = vssTree->UpdateSubdivision();
656          cout<<"subdivided leafs = "<<subdivided<<endl;
657        }
658
659        float avgPvs = GetAvgPvsSize(vssTree, kdViewcells);
660        cout<<"Average PVS size = "<<avgPvs<<endl;
661
662        /// compute view cell contribution of rays
663        mViewCellsManager->ComputeSampleContributions(vssRays, true, false);
664       
665        if (numExportRays) {
666          char filename[64];
667          if (mUseImportanceSampling)
668                sprintf(filename, "vss-rays-i%04d.x3d", pass);
669          else
670                sprintf(filename, "vss-rays-%04d.x3d", pass);
671
672          ExportRays(filename, vssRays, numExportRays);
673        }
674
675        samples+=num;
676        float pvs = vssTree->GetAvgPvsSize();
677        cout<<"*****************************\n";
678        cout<<samples<<" avgPVS ="<<pvs<<endl;
679        cout<<"VssTree root PVS size = "<<vssTree->GetRootPvsSize()<<endl;
680        cout<<"*****************************\n";
681//      if (samples >= mVssSamples) break;
682        pass ++;
683  }
684
685  if (mTestBeamSampling && mUseGlRenderer)
686  {     
687          TestBeamCasting(vssTree, mViewCellsManager, mObjects);
688  }
689
690  if (0)  Debug << vssTree->stat << endl;
691
692  if (0)
693  {
694        VssRayContainer viewCellRays;
695        // compute rays used for view cells construction
696        const int numRays = mViewCellsManager->GetVisualizationSamples();
697        vssTree->CollectRays(viewCellRays, numRays);
698  }
699
700  //-- render simulation after merge
701  cout << "\nevaluating bsp view cells render time after sampling ... ";
702  Debug << "\nStatistics after sampling: " << endl;
703
704  mRenderSimulator->RenderScene();
705  SimulationStatistics ss;
706  mRenderSimulator->GetStatistics(ss);
707 
708  cout << " finished" << endl;
709  cout << ss << endl;
710  Debug << ss << endl;
711
712  delete vssTree;
713 
714  return true;
715}
716
717}
Note: See TracBrowser for help on using the repository browser.