Changeset 386 for trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
- Timestamp:
- 11/07/05 11:27:38 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
r383 r386 8 8 #include "ViewCell.h" 9 9 #include "Polygon3.h" 10 #include "VssRay.h" 10 11 11 12 X3dExporter::X3dExporter(const string filename):Exporter(filename) … … 26 27 27 28 28 bool29 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(); 55 56 56 Vector3 b;57 if (length < 0)58 b = (*ri).GetLoc() - length*(*ri).GetDir();59 else60 if ((*ri).intersections.size()==0)61 b = (*ri).GetLoc() + length*(*ri).GetDir();62 else63 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); 64 65 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 75 77 76 78 bool 77 79 X3dExporter::ExportRays(const RayContainer &rays, 78 const float length,79 const RgbColor &color)80 const float length, 81 const RgbColor &color) 80 82 { 81 83 RayContainer::const_iterator ri = rays.begin(); … … 121 123 stream<<"</Shape>"<<endl; 122 124 125 return true; 126 } 127 128 bool 129 X3dExporter::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 123 166 return true; 124 167 }
Note: See TracChangeset
for help on using the changeset viewer.