Ignore:
Timestamp:
11/07/05 11:27:38 (19 years ago)
Author:
bittner
Message:

VssPreprocessor? updates - directional rays, x3dexporter updates - removed duplicated code for ray exports

File:
1 edited

Legend:

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

    r383 r386  
    88#include "ViewCell.h" 
    99#include "Polygon3.h" 
     10#include "VssRay.h" 
    1011 
    1112X3dExporter::X3dExporter(const string filename):Exporter(filename) 
     
    2627 
    2728 
    28 bool 
    29 X3dExporter::ExportRays(const vector<Ray> &rays, 
    30                         const float length, 
    31                         const RgbColor &color) 
    32 { 
    33   vector<Ray>::const_iterator ri = rays.begin(); 
    34   stream<<"<Shape>"<<endl; 
    35   stream<<"<Appearance>"<<endl; 
    36   stream<<"<Material ambientColor=\""<<color.r<<" "<<color.g<<" "<<color.b<< 
    37     "\" />"<<endl; 
    38   stream<<"</Appearance>"<<endl; 
    39    
    40   stream<<"<IndexedLineSet coordIndex=\""<<endl; 
    41  
    42   int index = 0; 
    43   for (; ri != rays.end(); ri++) { 
    44     stream<<index<<" "<<index+1<<" -1\n"; 
    45     index+=2; 
    46   } 
    47    
    48   stream<<"\" >"<<endl; 
    49    
    50   stream<<"<Coordinate  point=\""<<endl; 
    51    
    52   ri = rays.begin(); 
    53   for (; ri != rays.end(); ri++) { 
    54     Vector3 a = (*ri).GetLoc(); 
     29//  bool 
     30//  X3dExporter::ExportRays(const vector<Ray> &rays, 
     31//                                                                                              const float length, 
     32//                                                                                              const RgbColor &color) 
     33//  { 
     34//    vector<Ray>::const_iterator ri = rays.begin(); 
     35//    stream<<"<Shape>"<<endl; 
     36//    stream<<"<Appearance>"<<endl; 
     37//    stream<<"<Material ambientColor=\""<<color.r<<" "<<color.g<<" "<<color.b<< 
     38//      "\" />"<<endl; 
     39//    stream<<"</Appearance>"<<endl; 
     40   
     41//    stream<<"<IndexedLineSet coordIndex=\""<<endl; 
     42 
     43//    int index = 0; 
     44//    for (; ri != rays.end(); ri++) { 
     45//      stream<<index<<" "<<index+1<<" -1\n"; 
     46//      index+=2; 
     47//    } 
     48   
     49//    stream<<"\" >"<<endl; 
     50   
     51//    stream<<"<Coordinate  point=\""<<endl; 
     52   
     53//    ri = rays.begin(); 
     54//    for (; ri != rays.end(); ri++) { 
     55//      Vector3 a = (*ri).GetLoc(); 
    5556     
    56     Vector3 b; 
    57     if (length < 0) 
    58       b = (*ri).GetLoc() - length*(*ri).GetDir(); 
    59     else 
    60       if ((*ri).intersections.size()==0) 
    61         b = (*ri).GetLoc() + length*(*ri).GetDir(); 
    62       else 
    63         b = (*ri).Extrap((*ri).intersections[0].mT); 
     57//      Vector3 b; 
     58//      if (length < 0) 
     59//        b = (*ri).GetLoc() - length*(*ri).GetDir(); 
     60//      else 
     61//        if ((*ri).intersections.size()==0) 
     62//      b = (*ri).GetLoc() + length*(*ri).GetDir(); 
     63//        else 
     64//      b = (*ri).Extrap((*ri).intersections[0].mT); 
    6465     
    65     stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
    66     stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n"; 
    67   } 
    68    
    69   stream<<"\" >"<<endl; 
    70   stream<<"</Coordinate>"<<endl; 
    71   stream<<"</IndexedLineSet>"<<endl; 
    72   stream<<"</Shape>"<<endl; 
    73   return true; 
    74 } 
     66//      stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
     67//      stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n"; 
     68//    } 
     69   
     70//    stream<<"\" >"<<endl; 
     71//    stream<<"</Coordinate>"<<endl; 
     72//    stream<<"</IndexedLineSet>"<<endl; 
     73//    stream<<"</Shape>"<<endl; 
     74//    return true; 
     75//  } 
     76 
    7577 
    7678bool 
    7779X3dExporter::ExportRays(const RayContainer &rays, 
    78                                                 const float length, 
    79                                                 const RgbColor &color) 
     80                                                                                                const float length, 
     81                                                                                                const RgbColor &color) 
    8082{ 
    8183  RayContainer::const_iterator ri = rays.begin(); 
     
    121123  stream<<"</Shape>"<<endl; 
    122124 
     125  return true; 
     126} 
     127 
     128bool 
     129X3dExporter::ExportRays(const VssRayContainer &rays, 
     130                                                                                                const RgbColor &color) 
     131{ 
     132  VssRayContainer::const_iterator ri = rays.begin(); 
     133 
     134  stream<<"<Shape>"<<endl; 
     135  stream<<"<Appearance>"<<endl; 
     136  stream<<"<Material ambientColor=\""<<color.r<<" "<<color.g<<" "<<color.b<< 
     137    "\" />"<<endl; 
     138  stream<<"</Appearance>"<<endl; 
     139   
     140  stream<<"<IndexedLineSet coordIndex=\""<<endl; 
     141 
     142  int index = 0; 
     143  for (; ri != rays.end(); ri++) { 
     144    stream<<index<<" "<<index+1<<" -1\n"; 
     145    index+=2; 
     146  } 
     147   
     148  stream<<"\" >"<<endl; 
     149   
     150  stream<<"<Coordinate  point=\""<<endl; 
     151   
     152  ri = rays.begin(); 
     153  for (; ri != rays.end(); ri++) { 
     154    Vector3 a = (*ri)->GetOrigin(); 
     155     
     156    Vector3 b = (*ri)->GetTermination(); 
     157    stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
     158    stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n"; 
     159  } 
     160   
     161  stream<<"\" >"<<endl; 
     162  stream<<"</Coordinate>"<<endl; 
     163  stream<<"</IndexedLineSet>"<<endl; 
     164  stream<<"</Shape>"<<endl; 
     165         
    123166  return true; 
    124167} 
Note: See TracChangeset for help on using the changeset viewer.