Files Classes Functions Hierarchy
#include <vrmlconvert.h>
Public Member Functions | |
| boolc | eval (vector< vrmlshape > &s, vrmlshapeparse const &p) const |
| Convert the parser to vmrlshape objects. | |
The VRML is restricted to points and normals as triangles.
vrmlshapeparse p;
p.readfile("p3.wrl");
vector<vrmlshape> s;
vrmlconvert()(s,p);
Definition at line 36 of file vrmlconvert.h.
| boolc vrmlconvert::eval | ( | vector< vrmlshape > & | s, | |
| vrmlshapeparse const & | p | |||
| ) | const |
Convert the parser to vmrlshape objects.
Definition at line 140 of file vrmlconvert.cpp.
References vrmlshapeparse::vshp.
Referenced by vrmltest::test01().
00144 { 00145 vector< vrmlshaperaw > const & v(p.vshp); 00146 00147 if(!hastriangles(v)) 00148 return false; 00149 00150 // Iterate writing shapes. 00151 vrmlshape * curr = 0; 00152 00153 uintc imax = v.size(); 00154 for (uint i=0; i<imax; ++i) 00155 { 00156 if (!v[i].istriangles) 00157 continue; 00158 00159 if (s.empty()) 00160 { 00161 s.push_back(vrmlshape()); 00162 curr = & s.back(); 00163 writepointsandnormals(*curr,v[i]); 00164 writeattributes(*curr,v[i]); 00165 } 00166 else 00167 { 00168 curr = & s.back(); 00169 if (equalattributes(*curr,v[i])) 00170 { 00171 writepointsandnormals(*curr,v[i]); 00172 } 00173 else 00174 { 00175 s.push_back(vrmlshape()); 00176 writepointsandnormals(*curr,v[i]); 00177 writeattributes(*curr,v[i]); 00178 } 00179 } 00180 } 00181 00182 return true; 00183 }
1.5.8