Ignore:
Timestamp:
07/11/05 00:02:07 (19 years ago)
Author:
bittner
Message:

functional raycasting version

File:
1 edited

Legend:

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

    r65 r162  
     1#include "SceneGraph.h" 
     2#include "Exporter.h" 
     3#include "UnigraphicsParser.h" 
    14#include "Preprocessor.h" 
    2 #include "SamplingPreprocessor.h" 
    3 #include "ExactPreprocessor.h" 
    45 
    5 namespace GtpVisibilityPreprocessor { 
    66 
    7   bool 
    8   Preprocessor::LoadViewcells(const string filename) 
    9   { 
    107 
     8   
     9bool 
     10Preprocessor::LoadViewcells(const string filename) 
     11{ 
     12   
     13  return true; 
     14} 
     15 
     16bool 
     17Preprocessor::GenerateViewcells() 
     18{ 
     19   
     20  return true; 
     21} 
     22 
     23bool 
     24Preprocessor::LoadScene(const string filename) 
     25{ 
     26  // use leaf nodes of the original spatial hiearrchy as occludees 
     27 
     28  mSceneGraph = new SceneGraph; 
     29  Parser *parser = new UnigraphicsParser; 
     30  bool result = parser->ParseFile(filename, &mSceneGraph->mRoot); 
     31   
     32  return result; 
     33} 
     34 
     35bool 
     36Preprocessor::ExportPreprocessedData(const string filename) 
     37{ 
     38  return false; 
     39} 
     40 
     41bool 
     42Preprocessor::BuildKdTree() 
     43{ 
     44  mKdTree = new KdTree; 
     45  // add mesh instances of the scene graph to the root of the tree 
     46  KdLeaf *root = (KdLeaf *)mKdTree->GetRoot(); 
     47  mSceneGraph->CollectMeshInstaces(&root->mObjects); 
     48   
     49  mKdTree->Construct(); 
     50  return true; 
     51} 
     52 
     53 
     54void 
     55Preprocessor::KdTreeStatistics(ostream &s) 
     56{ 
     57  s<<mKdTree->GetStatistics(); 
     58} 
     59 
     60 
     61bool 
     62Preprocessor::Export( const string filename, 
     63                      const bool scene, 
     64                      const bool kdtree 
     65                      ) 
     66{ 
     67  Exporter *exporter = Exporter::GetExporter(filename); 
     68 
     69  if (exporter) { 
     70    if (scene) 
     71      exporter->ExportScene(mSceneGraph->mRoot); 
     72 
     73    if (kdtree) { 
     74      exporter->SetWireframe(); 
     75      exporter->ExportKdTree(*mKdTree); 
     76    } 
     77 
     78    delete exporter; 
    1179    return true; 
    1280  } 
    1381 
    14   bool 
    15   Preprocessor::GenerateViewcells() 
    16   { 
    17      
    18     return true; 
    19   } 
    20      
    21   bool 
    22   Preprocessor::LoadScene(const string filename) 
    23   { 
    24     // use leaf nodes of the original spatial hiearrchy as occludees 
    25      
    26     return true; 
    27   } 
     82  return false; 
     83} 
    2884 
    29   bool 
    30   Preprocessor::ExportPreprocessedData(const string filename) 
    31   { 
    32     return false; 
    33   } 
    34    
    35   bool 
    36   Preprocessor::BuildKdTree() 
    37   { 
    38     mKdTree = new KdTree; 
    39     mKdTree->Subdivide(mKdTree->GetRoot()); 
    40     return true; 
    41   } 
    42    
    43 }; 
    4485 
    45 int 
    46 main(int argc, char **argv) 
    47 { 
    48   GtpVisibilityPreprocessor::Preprocessor *p = new GtpVisibilityPreprocessor::SamplingPreprocessor(); 
    49   p->LoadScene("scene.wrl"); 
    50   p->LoadViewcells("viewcells.wrl"); 
    51   p->ComputeVisibility(); 
    52   p->ExportPreprocessedData("scene.vis"); 
    53   return 0; 
    54 } 
     86 
Note: See TracChangeset for help on using the changeset viewer.