VrmlParser.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  */
9 
15 #include "VrmlParser.h"
16 
17 #include <cmath>
18 #include <vector>
19 #include <list>
20 #include <iostream>
21 #include <hrpUtil/EasyScanner.h>
22 #include <hrpUtil/UrlUtil.h>
23 
24 #include <boost/version.hpp>
25 #if (BOOST_VERSION <= 103301)
26 #include <boost/filesystem/path.hpp>
27 #include <boost/filesystem/operations.hpp>
28 #else
29 #include <boost/filesystem.hpp>
30 #endif
31 
32 using namespace std;
33 using namespace boost;
34 using namespace hrp;
35 
36 namespace {
37 
41  enum {
42 
43  NO_SYMBOL = 0,
44 
45  // values
46  V_TRUE,
47  V_FALSE,
48  V_NULL,
49 
50  // types
51  T_SFINT32,
52  T_MFINT32,
53  T_SFFLOAT,
54  T_MFFLOAT,
55  T_SFVEC2F,
56  T_MFVEC2F,
57  T_SFVEC3F,
58  T_MFVEC3F,
59  T_SFSTRING,
60  T_MFSTRING,
61  T_SFROTATION,
62  T_MFROTATION,
63  T_SFTIME,
64  T_MFTIME,
65  T_SFCOLOR,
66  T_MFCOLOR,
67  T_SFNODE,
68  T_MFNODE,
69  T_SFBOOL,
70  T_SFIMAGE,
71 
72  // Nodes
73  N_PROTO,
74  N_INLINE,
75  N_BACKGROUND,
76  N_NAVIGATION_INFO,
77  N_VIEWPOINT,
78  N_GROUP,
79  N_TRANSFORM,
80  N_APPEARANCE,
81  N_MATERIAL,
82  N_IMAGE_TEXTURE,
83  N_TEXTURE_TRANSFORM,
84  N_SHAPE,
85  N_BOX,
86  N_CONE,
87  N_CYLINDER,
88  N_SPHERE,
89  N_TEXT,
90  N_FONT_STYLE,
91  N_INDEXED_LINE_SET,
92  N_INDEXED_FACE_SET,
93  N_COLOR,
94  N_COORDINATE,
95  N_TEXTURE_COORDINATE,
96  N_NORMAL,
97  N_CYLINDER_SENSOR,
98 
99  N_POINTSET,
100  N_PIXEL_TEXTURE,
101  N_MOVIE_TEXTURE,
102  N_ELEVATION_GRID,
103  N_EXTRUSION,
104  N_SWITCH,
105  N_LOD,
106  N_COLLISION,
107  N_ANCHOR,
108  N_FOG,
109  N_BILLBOARD,
110  N_WORLD_INFO,
111  N_POINT_LIGHT,
112  N_DIRECTIONAL_LIGHT,
113  N_SPOT_LIGHT,
114 
115  N_AUDIO_CLIP,
116  N_SOUND,
117  N_COLOR_INTERPOLATOR,
118  N_COORDINATE_INTERPOLATOR,
119  N_ORIENTATION_INTERPOLATOR,
120  N_NORMAL_INTERPOLATOR,
121  N_POSITION_INTERPOLATOR,
122  N_SCALAR_INTERPOLATOR,
123  N_PLANE_SENSOR,
124  N_PROXIMITY_SENSOR,
125  N_SPHERE_SENSOR,
126  N_TIME_SENSOR,
127  N_TOUCH_SENSOR,
128  N_VISIBILITY_SENSOR,
129 
130  // Fields
131  F_IS,
132 
133  F_URL,
134 
135  F_GROUND_ANGLE,
136  F_GROUND_COLOR,
137  F_SKY_ANGLE,
138  F_SKY_COLOR,
139  F_BACK_URL,
140  F_BOTTOM_URL,
141  F_FRONT_URL,
142  F_LEFT_URL,
143  F_RIGHT_URL,
144  F_TOP_URL,
145 
146  F_AVATAR_SIZE,
147  F_HEADLIGHT,
148  F_SPEED,
149  F_TYPE,
150  F_VISIBILITY_LIMIT,
151 
152  F_FIELD_OF_VIEW,
153  F_JUMP,
154  F_ORIENTATION,
155  F_POSITION,
156  F_DESCRIPTION,
157 
158  F_CHILDREN,
159  F_ADD_CHILDREN,
160  F_REMOVE_CHILDREN,
161  F_BBOX_CENTER,
162  F_BBOX_SIZE,
163 
164  F_CENTER,
165  F_ROTATION,
166  F_SCALE,
167  F_SCALE_ORIENTATION,
168  F_TRANSLATION,
169 
170  F_APPEARANCE,
171  F_GEOMETRY,
172 
173  F_MATERIAL,
174  F_TEXTURE,
175  F_TEXTURE_TRANSFORM,
176 
177  F_AMBIENT_INTENSITY,
178  F_DIFFUSE_COLOR,
179  F_EMISSIVE_COLOR,
180  F_SHININESS,
181  F_SPECULAR_COLOR,
182  F_TRANSPARANCY,
183 
184  F_REPEAT_S,
185  F_REPEAT_T,
186 
187  F_SIZE,
188 
189  F_BOTTOM,
190  F_BOTTOM_RADIUS,
191  F_HEIGHT,
192  F_SIDE,
193 
194  F_RADIUS,
195  F_TOP,
196 
197  F_STRING,
198  F_FONT_STYLE,
199  F_LENGTH,
200  F_MAX_EXTENT,
201 
202  F_FAMILY,
203  F_HORIZONTAL,
204  F_JUSTIFY,
205  F_LANGUAGE,
206  F_LEFT_TO_RIGHT,
207  F_SPACING,
208  F_STYLE,
209  F_TOP_TO_BOTTOM,
210 
211  F_COLOR,
212  F_COORD,
213  F_COLOR_INDEX,
214  F_COLOR_PER_VERTEX,
215  F_COORD_INDEX,
216 
217  F_CCW,
218  F_CONVEX,
219  F_SOLID,
220  F_CREASE_ANGLE,
221  F_NORMAL,
222  F_NORMAL_INDEX,
223  F_NORMAL_PER_VERTEX,
224  F_TEX_COORD_INDEX,
225  F_TEX_COORD,
226 
227  F_POINT,
228  F_VECTOR,
229 
230  F_BBOXCENTER,
231  F_BBOXSIZE,
232 
233  F_AUTO_OFFSET,
234  F_DISK_ANGLE,
235  F_ENABLED,
236  F_MAX_ANGLE,
237  F_MIN_ANGLE,
238  F_OFFSET,
239 
240  F_IMAGE,
241 
242  F_X_DIMENSION,
243  F_Z_DIMENSION,
244  F_X_SPACING,
245  F_Z_SPACING,
246 
247  F_LOOP,
248  F_START_TIME,
249  F_STOP_TIME,
250 
251  F_CROSS_SECTION,
252  F_SPINE,
253  F_BEGIN_CAP,
254  F_END_CAP,
255 
256  F_CHOICE,
257  F_WHICH_CHOICE,
258 
259  F_RANGE,
260  F_LEVEL,
261 
262  F_COLLIDE,
263  F_PROXY,
264 
265  F_PARAMETER,
266 
267  F_VISIBILITY_RANGE,
268  F_FOG_TYPE,
269 
270  F_AXIS_OF_ROTATION,
271 
272  F_TITLE,
273  F_INFO,
274 
275  F_LOCATION,
276  F_ON,
277  F_INTENSITY,
278  F_ATTENUATION,
279  F_DIRECTION,
280  F_BEAM_WIDTH,
281  F_CUT_OFF_RANGE,
282 
283  // event type
284  E_FIELD,
285  E_EXPOSED_FIELD,
286  E_EVENTIN,
287  E_EVENTOUT,
288 
289  // def & route
290  D_DEF,
291  D_USE,
292  D_ROUTE,
293 
294  // unsupported keywords
295  U_SCRIPT,
296  U_EXTERNPROTO
297 
298  };
299 }
300 
301 
302 namespace hrp {
303 
305  {
306  public:
307  VrmlParserImpl(VrmlParser* self);
308  VrmlParser* self;
309 
312 
314 
315  typedef map<VrmlProto*, EasyScannerPtr> ProtoToEntityScannerMap;
316  ProtoToEntityScannerMap protoToEntityScannerMap;
317 
318  typedef map<string, VrmlNodePtr> TDefNodeMap;
319  typedef pair<string, VrmlNodePtr> TDefNodePair;
320  typedef map<string, VrmlProtoPtr> TProtoMap;
321  typedef pair<string, VrmlProtoPtr> TProtoPair;
322 
323  TProtoMap protoMap;
324  TDefNodeMap defNodeMap;
325 
326  void load(const string& filename);
327  VrmlNodePtr readSpecificNode(VrmlNodeCategory nodeCategory, int symbol, const std::string& symbolString);
328  VrmlNodePtr readInlineNode(VrmlNodeCategory nodeCategory);
329  VrmlNodePtr newInlineSource(std::string& io_filename);
330  VrmlProtoPtr defineProto();
331 
332  VrmlNodePtr readNode(VrmlNodeCategory nodeCategory);
333  VrmlProtoInstancePtr readProtoInstanceNode(const std::string& proto_name, VrmlNodeCategory nodeCategory);
334  VrmlNodePtr evalProtoInstance(VrmlProtoInstancePtr proto, VrmlNodeCategory nodeCategory);
335  VrmlUnsupportedNodePtr skipUnsupportedNode(const std::string& nodeTypeName);
336  VrmlUnsupportedNodePtr skipScriptNode();
337  VrmlUnsupportedNodePtr skipExternProto();
338 
339  VrmlViewpointPtr readViewpointNode();
340  VrmlNavigationInfoPtr readNavigationInfoNode();
341  VrmlBackgroundPtr readBackgroundNode();
342  VrmlGroupPtr readGroupNode();
343  VrmlTransformPtr readTransformNode();
344  VrmlShapePtr readShapeNode();
345  VrmlCylinderSensorPtr readCylinderSensorNode();
346  VrmlBoxPtr readBoxNode();
347  VrmlConePtr readConeNode();
348  VrmlCylinderPtr readCylinderNode();
349 
350  VrmlPointSetPtr readPointSetNode();
351  VrmlPixelTexturePtr readPixelTextureNode();
352  VrmlMovieTexturePtr readMovieTextureNode();
353  VrmlElevationGridPtr readElevationGridNode();
354  VrmlExtrusionPtr readExtrusionNode();
355  VrmlSwitchPtr readSwitchNode();
356  VrmlLODPtr readLODNode();
357  VrmlCollisionPtr readCollisionNode();
358  VrmlAnchorPtr readAnchorNode();
359  VrmlFogPtr readFogNode();
360  VrmlBillboardPtr readBillboardNode();
361  VrmlWorldInfoPtr readWorldInfoNode();
362  VrmlPointLightPtr readPointLightNode();
363  VrmlDirectionalLightPtr readDirectionalLightNode();
364  VrmlSpotLightPtr readSpotLightNode();
365 
366  VrmlSpherePtr readSphereNode();
367  VrmlTextPtr readTextNode();
368  VrmlFontStylePtr readFontStyleNode();
369  VrmlIndexedLineSetPtr readIndexedLineSetNode();
370  VrmlIndexedFaceSetPtr readIndexedFaceSetNode();
371  void checkIndexedFaceSet(VrmlIndexedFaceSetPtr node);
372  VrmlCoordinatePtr readCoordNode();
373  VrmlTextureCoordinatePtr readTextureCoordinateNode();
374  VrmlColorPtr readColorNode();
375  VrmlAppearancePtr readAppearanceNode();
376  VrmlMaterialPtr readMaterialNode();
377  VrmlImageTexturePtr readImageTextureNode();
378  VrmlTextureTransformPtr readTextureTransformNode();
379  VrmlNormalPtr readNormalNode();
380 
381  VrmlVariantField& readProtoField(VrmlFieldTypeId fieldTypeId);
382 
383  void readSFInt32(SFInt32& out_value);
384  void readSFFloat(SFFloat& out_value);
385  void readSFString(SFString& out_value);
386  void readMFInt32(MFInt32& out_value);
387  void readMFFloat(MFFloat& out_value);
388  void readSFColor(SFColor& out_value);
389  void readMFColor(MFColor& out_value);
390  void readMFString(MFString& out_value);
391  void readSFVec2f(SFVec2f& out_value);
392  void readMFVec2f(MFVec2f& out_value);
393  void readSFVec3f(SFVec3f& out_value);
394  void readMFVec3f(MFVec3f& out_value);
395  void readSFRotation(SFRotation& out_value);
396  void readMFRotation(MFRotation& out_value);
397  void readSFBool(SFBool& out_value);
398  void readSFTime(SFTime& out_value);
399  void readMFTime(MFTime& out_value);
400  void readSFNode(SFNode& out_node, VrmlNodeCategory nodeCategory);
401  SFNode readSFNode(VrmlNodeCategory nodeCategory);
402  void readMFNode(MFNode& out_nodes, VrmlNodeCategory nodeCategory);
403  void readSFImage( SFImage& out_image );
404  private:
405  VrmlParserImpl(const VrmlParserImpl& self, const list< string >& ref);
406  const list< string >* getAncestorPathsList() const {return &ancestorPathsList;}
407  void setSymbols();
408  void init();
409  list< string > ancestorPathsList;
410  };
411 }
412 
413 
414 VrmlParser::VrmlParser()
415 {
416  init();
417 }
418 
419 
420 VrmlParser::VrmlParser(const string& filename)
421 {
422  init();
423  load(filename);
424 }
425 
426 
427 
428 void VrmlParser::init()
429 {
430 
431  impl = new VrmlParserImpl(this);
432 }
433 
434 
435 VrmlParserImpl::VrmlParserImpl(VrmlParser* self) : self(self)
436 {
437  init();
438 }
439 
440 VrmlParserImpl::VrmlParserImpl(const VrmlParserImpl& refThis, const list< string >& refSet)
441 : self(refThis.self), ancestorPathsList(refSet)
442 {
443  init();
444 }
445 
446 
448 {
449  delete impl;
450 }
451 
452 
454 {
455  impl->protoInstanceActualNodeExtractionMode = isOn;
456 }
457 
458 
459 
463 void VrmlParser::load(const string& filename)
464 {
465  impl->load(filename);
466 }
467 
468 
469 void VrmlParserImpl::load(const string& filename)
470 {
471  filesystem::path localPath(filename);
472  localPath.normalize();
473 
474 #if (BOOST_VERSION < 104600)
475  ancestorPathsList.push_back(localPath.file_string());
476  scanner->loadFile(localPath.file_string());
477 #else
478  ancestorPathsList.push_back(localPath.string());
479  scanner->loadFile(localPath.string());
480 #endif
481 
482  // header check
483  scanner->setCommentChar(0);
484  bool ok = scanner->readString("#VRML V2.0");
485  if(ok){
486  scanner->skipLine();
487  }
488 
489  scanner->setCommentChar('#');
490  scanner->setQuoteChar('"');
491  scanner->setWhiteSpaceChar(',');
492  scanner->setLineOriented(false);
493 }
494 
495 
497 {
498  return impl->readNode(TOP_NODE);
499 }
500 
501 
503 {
504  VrmlNodePtr node;
505 
506  /* comment out this to allow empty proto instance node
507  if(scanner->isEOF()){
508  if(currentProtoInstance){
509  scanner->throwException("Illegal proto instance node");
510  }
511  }
512  */
513 
514  if(!scanner->readWord()){
515  return 0;
516  }
517 
518  string def_name;
519  string nodeTypeName(scanner->stringValue);
520  int symbol = scanner->getSymbolID(scanner->stringValue);
521 
522  if(symbol){
523 
524  if(symbol==N_INLINE)
525  return readInlineNode(nodeCategory);
526 
527  if(symbol==N_PROTO){
528  if(nodeCategory == TOP_NODE){
529  return defineProto();
530  } else {
531  scanner->throwException("PROTO node cannot be defined here");
532  }
533  }
534 
535  if(symbol==D_USE){
536  scanner->readString();
537  const string& label = scanner->stringValue;
538  TDefNodeMap::iterator p = defNodeMap.find(label);
539  if(p != defNodeMap.end()){
540  return p->second;
541  } else {
542  scanner->throwException
543  (string("A node \"") + label + "\" specified by the USE directive does not exist");
544  }
545  }
546 
547  // ROUTE has 3 parameters to skip
548  // return as VrmlUnsupportedNode
549  if(symbol == D_ROUTE){
550  scanner->readString(); // eventOut or exposedField
551  if(!scanner->readString("TO")) // "TO"
552  scanner->throwException("Illegal ROUTE (without TO)");
553  scanner->readString(); // eventIn or exposedField
554  // recursive call to continue reading without node construction
555  return readNode( nodeCategory );
556  }
557 
558  // unsupported keywords
559  if(symbol == U_SCRIPT){
560  cerr << "Script is not supported. " << endl;
561  skipScriptNode();
562  return readNode( nodeCategory );
563  }
564  if(symbol == U_EXTERNPROTO){
565  cerr << "ExternProto is not supported." << endl;
566  skipExternProto();
567  return readNode( nodeCategory );
568  }
569 
570  if(symbol == D_DEF){
571  def_name = scanner->readStringEx("Illegal DEF name");
572  scanner->readWord();
573  symbol = scanner->getSymbolID(scanner->stringValue);
574  nodeTypeName = scanner->stringValue;
575  }
576 
577  }
578 
579  if(!scanner->readChar('{')){
580  scanner->throwException
581  (string("The entity of a ") + nodeTypeName + " node does not correctly begin with '{'");
582  }
583 
584  if(symbol){
585  node = readSpecificNode(nodeCategory, symbol, nodeTypeName);
586  } else {
587  node = readProtoInstanceNode(scanner->stringValue, nodeCategory);
588  }
589 
590  if(!scanner->readChar('}')){
591  scanner->throwException
592  (string("A ") + nodeTypeName + " node is not correctly closed with '}'");
593  }
594 
595  if(def_name.size() > 0) {
596  defNodeMap.insert(TDefNodePair(def_name, node));
597  node->defName = def_name;
598  }
599 
600  return node;
601 }
602 
603 
604 VrmlNodePtr VrmlParserImpl::readSpecificNode(VrmlNodeCategory nodeCategory, int symbol, const string& nodeTypeName)
605 {
606  VrmlNodePtr node;
607 
608  switch(symbol){
609 
610  case N_BACKGROUND: node = readBackgroundNode(); break;
611  case N_NAVIGATION_INFO: node = readNavigationInfoNode(); break;
612  case N_VIEWPOINT: node = readViewpointNode(); break;
613 
614  case N_GROUP: node = readGroupNode(); break;
615  case N_TRANSFORM: node = readTransformNode(); break;
616  case N_SHAPE: node = readShapeNode(); break;
617  case N_CYLINDER_SENSOR: node = readCylinderSensorNode(); break;
618 
619  case N_POINTSET: node = readPointSetNode(); break;
620  case N_PIXEL_TEXTURE: node = readPixelTextureNode(); break;
621  case N_MOVIE_TEXTURE: node = readMovieTextureNode(); break;
622  case N_ELEVATION_GRID: node = readElevationGridNode(); break;
623  case N_EXTRUSION: node = readExtrusionNode(); break;
624  case N_SWITCH: node = readSwitchNode(); break;
625  case N_LOD: node = readLODNode(); break;
626  case N_COLLISION: node = readCollisionNode(); break;
627  case N_ANCHOR: node = readAnchorNode(); break;
628  case N_FOG: node = readFogNode(); break;
629  case N_BILLBOARD: node = readBillboardNode(); break;
630  case N_WORLD_INFO: node = readWorldInfoNode(); break;
631  case N_POINT_LIGHT: node = readPointLightNode(); break;
632  case N_DIRECTIONAL_LIGHT: node = readDirectionalLightNode(); break;
633  case N_SPOT_LIGHT: node = readSpotLightNode(); break;
634 
635  case N_MATERIAL: node = readMaterialNode(); break;
636  case N_APPEARANCE: node = readAppearanceNode(); break;
637  case N_IMAGE_TEXTURE: node = readImageTextureNode(); break;
638  case N_TEXTURE_TRANSFORM: node = readTextureTransformNode(); break;
639 
640  case N_BOX: node = readBoxNode(); break;
641  case N_CONE: node = readConeNode(); break;
642  case N_CYLINDER: node = readCylinderNode(); break;
643  case N_SPHERE: node = readSphereNode(); break;
644  case N_TEXT: node = readTextNode(); break;
645  case N_INDEXED_FACE_SET: node = readIndexedFaceSetNode(); break;
646  case N_INDEXED_LINE_SET: node = readIndexedLineSetNode(); break;
647 
648  case N_COORDINATE: node = readCoordNode(); break;
649  case N_TEXTURE_COORDINATE: node = readTextureCoordinateNode(); break;
650  case N_COLOR: node = readColorNode(); break;
651  case N_NORMAL: node = readNormalNode(); break;
652  case N_FONT_STYLE: node = readFontStyleNode(); break;
653 
654  // unsupported nodes
655  case N_AUDIO_CLIP: node = skipUnsupportedNode("AudioClip"); break;
656  case N_SOUND: node = skipUnsupportedNode("Sound"); break;
657  case N_COLOR_INTERPOLATOR: node = skipUnsupportedNode("ColorInterpolator"); break;
658  case N_COORDINATE_INTERPOLATOR: node = skipUnsupportedNode("CoordinateInterpolator"); break;
659  case N_ORIENTATION_INTERPOLATOR: node = skipUnsupportedNode("OrientationInterpolator"); break;
660  case N_NORMAL_INTERPOLATOR: node = skipUnsupportedNode("NormalInterpolator"); break;
661  case N_POSITION_INTERPOLATOR: node = skipUnsupportedNode("PositionInterpolator"); break;
662  case N_SCALAR_INTERPOLATOR: node = skipUnsupportedNode("ScalarInterpolator"); break;
663  case N_PLANE_SENSOR: node = skipUnsupportedNode("PlaneSensor"); break;
664  case N_PROXIMITY_SENSOR: node = skipUnsupportedNode("ProximitySensor"); break;
665  case N_SPHERE_SENSOR: node = skipUnsupportedNode("SphereSensor"); break;
666  case N_TIME_SENSOR: node = skipUnsupportedNode("TimeSensor"); break;
667  case N_TOUCH_SENSOR: node = skipUnsupportedNode("TouchSensor"); break;
668  case N_VISIBILITY_SENSOR: node = skipUnsupportedNode("VisibilitySensor"); break;
669 
670  default: scanner->throwException
671  (string("Node type \"") + nodeTypeName + "\" is not supported");
672 
673  }
674 
675  if(!node->isCategoryOf(nodeCategory)){
676  scanner->throwException
677  (string("A ") + nodeTypeName + " node is put in a illegal place");
678  }
679 
680  return node;
681 }
682 
683 
685 {
686  while(true){
687  if(!scanner->readQuotedString()){
688  if(scanner->peekChar() == '}'){
689  break;
690  } if(!scanner->readChar()){
691  scanner->throwException( "Node is not closed." );
692  }
693  }
694  }
695  return new VrmlUnsupportedNode( nodeTypeName );
696 }
697 
698 
700 {
701  // '}' appears twice in "Script" node
702  for(int i=0; i<1; i++){
703  while(true){
704  if(!scanner->readQuotedString()){
705  if(scanner->peekChar() == '}'){
706  scanner->readChar();
707  break;
708  }
709  if(!scanner->readChar()){
710  scanner->throwException( "Script is not closed." );
711  }
712  }
713  }
714  }
715 
716  // return new VrmlUnsupportedNode( "Script" );
717  return NULL;
718 }
719 
720 
722 {
723  // read untill ']' appears
724  while(true){
725  if(!scanner->readQuotedString()){
726  if( scanner->peekChar() == ']' ){
727  // read found ']' and break this loop
728  scanner->readChar();
729  break;
730  }
731  if(!scanner->readChar()){
732  scanner->throwException( "EXTERNPROTO is not closed." );
733  }
734  }
735  }
736  // read URL after ']'
737  SFString url;
738  readSFString( url );
739 
740  // return new VrmlUnsupportedNode( "EXTERNPROTO" );
741  return NULL;
742 }
743 
744 
746 {
747  scanner->readChar('{');
748 
749  if(scanner->readSymbol() && scanner->symbolValue == F_URL){
750  MFString inlineUrls;
751  readMFString(inlineUrls);
752  scanner->readCharEx('}', "syntax error 2");
753 
754  VrmlInlinePtr inlineNode = new VrmlInline();
755  for( MFString::iterator ite = inlineUrls.begin(); ite != inlineUrls.end(); ++ite ){
756  inlineNode->children.push_back( newInlineSource( *ite ) );
757  inlineNode->urls.push_back(*ite);
758  }
759  return inlineNode;
760  }
761  return 0;
762 }
763 
764 
766 {
767  filesystem::path localPath;
768  string chkFile("");
769  if( isFileProtocol( io_filename ) )
770  {
771  localPath = filesystem::path( deleteURLScheme(io_filename) );
772 
773  localPath.normalize();
774  // Relative path check & translate to absolute path
775  if ( ! exists(localPath) ){
776 
777  filesystem::path parentPath( scanner->filename );
778 #if BOOST_VERSION < 103600
779  localPath = parentPath.branch_path() / localPath;
780 #else
781  localPath = parentPath.parent_path() / localPath;
782 #endif
783  localPath.normalize();
784  }
785  chkFile = complete( localPath ).string();
786  } else {
787  // Not file protocol implements
788  chkFile = io_filename;
789  }
790  for( list<string>::const_iterator cIte = ancestorPathsList.begin(); cIte != ancestorPathsList.end(); ++cIte){
791  if( chkFile == *cIte )
792  {
793  scanner->throwException("Infinity loop ! " + chkFile + " is included ancestor list");
794  }
795  }
796 
797  VrmlParserImpl inlineParser( *this, ancestorPathsList );
798 
799  inlineParser.load( chkFile );
800  io_filename = chkFile;
801 
802  VrmlGroupPtr group = new VrmlGroup();
803  while(VrmlNodePtr node = inlineParser.readNode(TOP_NODE)){
804  if(node->isCategoryOf(CHILD_NODE)){
805  group->children.push_back(node);
806  }
807  }
808 
809  if(group->children.size() == 1){
810  return group->children.front();
811  } else {
812  return group;
813  }
814 }
815 
816 
818 {
819  string proto_name = scanner->readWordEx("illegal PROTO name");
820  scanner->readCharEx('[', "syntax error 3");
821 
822  VrmlProtoPtr proto = new VrmlProto(proto_name);
823 
824  while(!scanner->readChar(']')){
825  int event_type = scanner->readSymbolEx("illegal field event type");
826  int field_symbol = scanner->readSymbolEx("illegal field type");
827  string field_name = scanner->readWordEx("syntax error 4");
828 
829  // insert a new empty field and get it, contents of which will be set below
830  VrmlVariantField& field = proto->fields.insert(TProtoFieldPair(field_name, VrmlVariantField())).first->second;
831 
832  switch(event_type){
833 
834  case E_FIELD:
835  case E_EXPOSED_FIELD:
836 
837  switch(field_symbol){
838 
839  case T_SFINT32: field.setType(SFINT32); readSFInt32(field.sfInt32()); break;
840  case T_MFINT32: field.setType(MFINT32); readMFInt32(field.mfInt32()); break;
841  case T_SFFLOAT: field.setType(SFFLOAT); readSFFloat(field.sfFloat()); break;
842  case T_MFFLOAT: field.setType(MFFLOAT); readMFFloat(field.mfFloat()); break;
843  case T_SFVEC3F: field.setType(SFVEC3F); readSFVec3f(field.sfVec3f()); break;
844  case T_MFVEC3F: field.setType(MFVEC3F); readMFVec3f(field.mfVec3f()); break;
845  case T_SFCOLOR: field.setType(SFCOLOR); readSFColor(field.sfColor()); break;
846  case T_MFCOLOR: field.setType(MFCOLOR); readMFColor(field.mfColor()); break;
847  case T_SFSTRING: field.setType(SFSTRING); readSFString(field.sfString()); break;
848  case T_MFSTRING: field.setType(MFSTRING); readMFString(field.mfString()); break;
849  case T_SFROTATION: field.setType(SFROTATION); readSFRotation(field.sfRotation()); break;
850  case T_MFROTATION: field.setType(MFROTATION); readMFRotation(field.mfRotation()); break;
851  case T_SFBOOL: field.setType(SFBOOL); readSFBool(field.sfBool()); break;
852  case T_SFNODE: field.setType(SFNODE); readSFNode(field.sfNode(), ANY_NODE); break;
853  case T_MFNODE: field.setType(MFNODE); readMFNode(field.mfNode(), ANY_NODE); break;
854  case T_SFIMAGE: field.setType(SFIMAGE); readSFImage(field.sfImage()); break;
855 
856 
857  default: scanner->throwException("illegal field type");
858  }
859  break;
860 
861  case E_EVENTIN:
862  case E_EVENTOUT:
863 
864  switch(field_symbol){
865 
866  case T_SFINT32: field.setType(SFINT32); break;
867  case T_MFINT32: field.setType(MFINT32); break;
868  case T_SFFLOAT: field.setType(SFFLOAT); break;
869  case T_MFFLOAT: field.setType(MFFLOAT); break;
870  case T_SFVEC3F: field.setType(SFVEC3F); break;
871  case T_MFVEC3F: field.setType(MFVEC3F); break;
872  case T_SFCOLOR: field.setType(SFCOLOR); break;
873  case T_MFCOLOR: field.setType(MFCOLOR); break;
874  case T_SFSTRING: field.setType(SFSTRING); break;
875  case T_MFSTRING: field.setType(MFSTRING); break;
876  case T_SFROTATION: field.setType(SFROTATION); break;
877  case T_MFROTATION: field.setType(MFROTATION); break;
878  case T_SFBOOL: field.setType(SFBOOL); break;
879  case T_SFNODE: field.setType(SFNODE); break;
880  case T_MFNODE: field.setType(MFNODE); break;
881  case T_SFIMAGE: field.setType(SFIMAGE); break;
882  }
883  break;
884 
885  default: scanner->throwException("illegal field event type");
886 
887  }
888  }
889 
890  scanner->readCharEx('{', "A PROTO definition has no entity");
891  char* begin = scanner->text;
892  int brace_level = 1;
893  while(true){
894  int token = scanner->readToken();
895  if(token == EasyScanner::T_NONE){
896  scanner->throwException("syntax error 5");
897  } else if(token == EasyScanner::T_SIGLUM){
898  if(scanner->charValue == '{') {
899  brace_level++;
900  } else if(scanner->charValue == '}') {
901  brace_level--;
902  if(brace_level==0)
903  break;
904  }
905  }
906  }
907 
908  EasyScannerPtr entityScanner(new EasyScanner(*scanner, false));
909  entityScanner->setText(begin, scanner->text - begin - 1);
910  entityScanner->setLineNumberOffset(scanner->lineNumber);
911 
912  protoToEntityScannerMap[proto.get()] = entityScanner;
913 
914  protoMap.insert(TProtoPair(proto_name, proto));
915 
916  return proto;
917 }
918 
919 
921 {
922  TProtoMap::iterator p = protoMap.find(proto_name);
923  if(p == protoMap.end()){
924  scanner->throwException("undefined node");
925  }
926 
927  VrmlProtoPtr proto = p->second;
928  VrmlProtoInstancePtr protoInstance(new VrmlProtoInstance(proto));
929 
930  while(scanner->readWord()){
931  TProtoFieldMap::iterator p = protoInstance->fields.find(scanner->stringValue);
932  if(p == protoInstance->fields.end())
933  scanner->throwException("undefined field");
934 
935  VrmlVariantField& field = p->second;
936 
937  switch(field.typeId()){
938 
939  case SFINT32: readSFInt32(field.sfInt32()); break;
940  case MFINT32: readMFInt32(field.mfInt32()); break;
941  case SFFLOAT: readSFFloat(field.sfFloat()); break;
942  case MFFLOAT: readMFFloat(field.mfFloat()); break;
943  case SFVEC2F: readSFVec2f(field.sfVec2f()); break;
944  case MFVEC2F: readMFVec2f(field.mfVec2f()); break;
945  case SFVEC3F: readSFVec3f(field.sfVec3f()); break;
946  case MFVEC3F: readMFVec3f(field.mfVec3f()); break;
947  case SFCOLOR: readSFVec3f(field.sfColor()); break;
948  case MFCOLOR: readMFVec3f(field.mfColor()); break;
949  case SFSTRING: readSFString(field.sfString()); break;
950  case MFSTRING: readMFString(field.mfString()); break;
951  case SFROTATION: readSFRotation(field.sfRotation()); break;
952  case MFROTATION: readMFRotation(field.mfRotation()); break;
953  case SFBOOL: readSFBool(field.sfBool()); break;
954  case SFNODE: readSFNode(field.sfNode(), ANY_NODE); break;
955  case MFNODE: readMFNode(field.mfNode(), ANY_NODE); break;
956  case SFIMAGE: readSFImage(field.sfImage()); break;
957  default:
958  break;
959  }
960  }
961 
963  protoInstance->actualNode = evalProtoInstance(protoInstance, nodeCategory);
964  }
965 
966  return protoInstance;
967 }
968 
969 
971 {
972  EasyScannerPtr orgScanner = scanner;
973  ProtoToEntityScannerMap::iterator p;
974  p = protoToEntityScannerMap.find(protoInstance->proto.get());
975  if(p == protoToEntityScannerMap.end()){
976  scanner->throwException("Undefined proto node instance");
977  }
978  scanner = p->second;
979  scanner->moveToHead();
980 
981  VrmlProtoInstancePtr orgProtoInstance = currentProtoInstance;
982  currentProtoInstance = protoInstance;
983 
984  VrmlNodePtr node = readNode(nodeCategory);
985  if(node){
986  node->defName = protoInstance->defName;
987  }
988 
989  scanner = orgScanner;
990  currentProtoInstance = orgProtoInstance;
991 
992  return node;
993 }
994 
995 
997 {
999 
1000  while(scanner->readSymbol()){
1001 
1002  switch(scanner->symbolValue){
1003 
1004  case F_FIELD_OF_VIEW: readSFFloat(node->fieldOfView); break;
1005  case F_JUMP: readSFBool(node->jump); break;
1006  case F_ORIENTATION: readSFRotation(node->orientation); break;
1007  case F_POSITION: readSFVec3f(node->position); break;
1008  case F_DESCRIPTION: readSFString(node->description); break;
1009 
1010  default: scanner->throwException("Undefined field");
1011  }
1012  }
1013 
1014  return node;
1015 }
1016 
1017 
1019 {
1021 
1022  while(scanner->readSymbol()){
1023 
1024  switch(scanner->symbolValue){
1025 
1026  case F_AVATAR_SIZE: readMFFloat(node->avatarSize); break;
1027  case F_HEADLIGHT: readSFBool(node->headlight); break;
1028  case F_SPEED: readSFFloat(node->speed); break;
1029  case F_TYPE: readMFString(node->type); break;
1030  case F_VISIBILITY_LIMIT: readSFFloat(node->visibilityLimit); break;
1031 
1032  default: scanner->throwException("Undefined field");
1033  }
1034  }
1035 
1036  return node;
1037 }
1038 
1039 
1041 {
1043 
1044  while(scanner->readSymbol()){
1045 
1046  switch(scanner->symbolValue){
1047 
1048  case F_GROUND_ANGLE: readMFFloat(node->groundAngle); break;
1049  case F_GROUND_COLOR: readMFColor(node->groundColor); break;
1050  case F_SKY_ANGLE: readMFFloat(node->skyAngle); break;
1051  case F_SKY_COLOR: readMFColor(node->skyColor); break;
1052  case F_BACK_URL: readMFString(node->backUrl); break;
1053  case F_BOTTOM_URL: readMFString(node->bottomUrl); break;
1054  case F_FRONT_URL: readMFString(node->frontUrl); break;
1055  case F_LEFT_URL: readMFString(node->leftUrl); break;
1056  case F_RIGHT_URL: readMFString(node->rightUrl); break;
1057  case F_TOP_URL: readMFString(node->topUrl); break;
1058 
1059  default: scanner->throwException("Undefined field");
1060  }
1061  }
1062 
1063  return node;
1064 }
1065 
1066 
1068 {
1069  VrmlGroupPtr node(new VrmlGroup);
1070 
1071  while(scanner->readSymbol()){
1072 
1073  switch(scanner->symbolValue){
1074 
1075  case F_BBOX_CENTER: readSFVec3f(node->bboxCenter); break;
1076  case F_BBOX_SIZE: readSFVec3f(node->bboxSize); break;
1077  case F_CHILDREN: readMFNode(node->children, CHILD_NODE); break;
1078 
1079  case F_ADD_CHILDREN:
1080  case F_REMOVE_CHILDREN:
1081  {
1082  MFNode dummy;
1083  readMFNode(dummy, CHILD_NODE);
1084  }
1085  break;
1086 
1087  default: scanner->throwException("Undefined field");
1088  }
1089  }
1090 
1091  return node;
1092 }
1093 
1094 
1096 {
1097  VrmlTransformPtr node(new VrmlTransform);
1098 
1099  while(scanner->readSymbol()){
1100 
1101  switch(scanner->symbolValue){
1102 
1103  case F_CENTER: readSFVec3f(node->center); break;
1104  case F_ROTATION: readSFRotation(node->rotation); break;
1105  case F_SCALE: readSFVec3f(node->scale); break;
1106  case F_SCALE_ORIENTATION: readSFRotation(node->scaleOrientation); break;
1107  case F_TRANSLATION: readSFVec3f(node->translation); break;
1108  case F_BBOX_CENTER: readSFVec3f(node->bboxCenter); break;
1109  case F_BBOX_SIZE: readSFVec3f(node->bboxSize); break;
1110 
1111  case F_CHILDREN: readMFNode(node->children, CHILD_NODE); break;
1112 
1113  default: scanner->throwException("Undefined field");
1114  }
1115  }
1116 
1117  return node;
1118 }
1119 
1120 
1122 {
1123  VrmlShapePtr node(new VrmlShape);
1124 
1125  while(scanner->readSymbol()){
1126 
1127  switch(scanner->symbolValue){
1128 
1129  case F_APPEARANCE: node->appearance = dynamic_pointer_cast<VrmlAppearance>(readSFNode(APPEARANCE_NODE)); break;
1130  case F_GEOMETRY: node->geometry = readSFNode(GEOMETRY_NODE); break;
1131 
1132  default: scanner->throwException("Undefined field");
1133  }
1134  }
1135 
1136  return node;
1137 }
1138 
1139 
1141 {
1143 
1144  while(scanner->readSymbol()){
1145 
1146  switch(scanner->symbolValue){
1147 
1148  case F_AUTO_OFFSET: readSFBool(node->autoOffset); break;
1149  case F_DISK_ANGLE: readSFFloat(node->diskAngle); break;
1150  case F_ENABLED: readSFBool(node->enabled); break;
1151  case F_MAX_ANGLE: readSFFloat(node->maxAngle); break;
1152  case F_MIN_ANGLE: readSFFloat(node->minAngle); break;
1153  case F_OFFSET: readSFFloat(node->offset); break;
1154 
1155  default: scanner->throwException("Undefined field");
1156  }
1157  }
1158 
1159  return node;
1160 }
1161 
1162 
1164 {
1165  VrmlPointSetPtr node(new VrmlPointSet);
1166 
1167  while(scanner->readSymbol()){
1168  switch(scanner->symbolValue){
1169  case F_COORD:
1170  node->coord = dynamic_pointer_cast<VrmlCoordinate>( readSFNode( COORDINATE_NODE ) );
1171  break;
1172 
1173  case F_COLOR:
1174  node->color = dynamic_pointer_cast<VrmlColor>( readSFNode( COLOR_NODE ) );
1175  break;
1176 
1177  default:
1178  scanner->throwException( "Undefined field" );
1179  }
1180  }
1181 
1182  return node;
1183 }
1184 
1185 
1187 {
1189 
1190  while(scanner->readSymbol()){
1191  switch(scanner->symbolValue){
1192  case F_IMAGE:
1193  readSFImage( node->image );
1194  break;
1195 
1196  case F_REPEAT_S:
1197  readSFBool( node->repeatS );
1198  break;
1199 
1200  case F_REPEAT_T:
1201  readSFBool( node->repeatT );
1202  break;
1203 
1204  default:
1205  scanner->throwException( "Undefined field" );
1206  }
1207  }
1208 
1209  return node;
1210 }
1211 
1212 
1214 {
1216 
1217  while(scanner->readSymbol()){
1218  switch(scanner->symbolValue){
1219  case F_URL:
1220  readMFString( node->url );
1221  break;
1222 
1223  case F_LOOP:
1224  readSFBool( node->loop );
1225  break;
1226 
1227  case F_SPEED:
1228  readSFFloat( node->speed );
1229  break;
1230 
1231  case F_START_TIME:
1232  readSFTime( node->startTime );
1233  break;
1234 
1235  case F_STOP_TIME:
1236  readSFTime( node->stopTime );
1237  break;
1238 
1239  case F_REPEAT_S:
1240  readSFBool( node->repeatS );
1241  break;
1242 
1243  case F_REPEAT_T:
1244  readSFBool( node->repeatT );
1245  break;
1246 
1247  default:
1248  scanner->throwException( "Undefined field" );
1249  }
1250  }
1251 
1252  return node;
1253 }
1254 
1255 
1257 {
1259 
1260  while(scanner->readSymbol()){
1261  switch(scanner->symbolValue){
1262  case F_X_DIMENSION:
1263  readSFInt32( node->xDimension );
1264  break;
1265 
1266  case F_Z_DIMENSION:
1267  readSFInt32( node->zDimension );
1268  break;
1269 
1270  case F_X_SPACING:
1271  readSFFloat( node->xSpacing );
1272  break;
1273 
1274  case F_Z_SPACING:
1275  readSFFloat( node->zSpacing );
1276  break;
1277 
1278  case F_HEIGHT:
1279  readMFFloat( node->height );
1280  break;
1281 
1282  case F_CCW:
1283  readSFBool( node->ccw );
1284  break;
1285 
1286  case F_COLOR_PER_VERTEX:
1287  readSFBool( node->colorPerVertex );
1288  break;
1289 
1290  case F_CREASE_ANGLE:
1291  readSFFloat( node->creaseAngle );
1292  break;
1293 
1294  case F_NORMAL_PER_VERTEX:
1295  readSFBool( node->normalPerVertex );
1296  break;
1297 
1298  case F_SOLID:
1299  readSFBool( node->solid );
1300  break;
1301 
1302  case F_COLOR:
1303  node->color = dynamic_pointer_cast<VrmlColor>( readSFNode( COLOR_NODE ) );
1304  break;
1305 
1306  case F_NORMAL:
1307  node->normal = dynamic_pointer_cast<VrmlNormal>( readSFNode( NORMAL_NODE ) );
1308  break;
1309 
1310  case F_TEX_COORD:
1311  node->texCoord = dynamic_pointer_cast<VrmlTextureCoordinate>( readSFNode( TEXTURE_COORDINATE_NODE ) );
1312  break;
1313 
1314  default:
1315  scanner->throwException( "Undefined field" );
1316  }
1317  }
1318 
1319  return node;
1320 }
1321 
1322 
1324 {
1325  VrmlExtrusionPtr node( new VrmlExtrusion );
1326 
1327  while(scanner->readSymbol()){
1328  switch(scanner->symbolValue){
1329  case F_CROSS_SECTION:
1330  readMFVec2f( node->crossSection );
1331  break;
1332 
1333  case F_SPINE:
1334  readMFVec3f( node->spine );
1335  break;
1336 
1337  case F_SCALE:
1338  readMFVec2f( node->scale );
1339  break;
1340 
1341  case F_ORIENTATION:
1342  readMFRotation( node->orientation );
1343  break;
1344 
1345  case F_BEGIN_CAP:
1346  readSFBool( node->beginCap );
1347  break;
1348 
1349  case F_END_CAP:
1350  readSFBool( node->endCap );
1351  break;
1352 
1353  case F_SOLID:
1354  readSFBool( node->solid );
1355  break;
1356 
1357  case F_CCW:
1358  readSFBool( node->ccw );
1359  break;
1360 
1361  case F_CONVEX:
1362  readSFBool( node->convex );
1363  break;
1364 
1365  case F_CREASE_ANGLE:
1366  readSFFloat( node->creaseAngle );
1367  break;
1368 
1369  default:
1370  scanner->throwException( "Undefined field" );
1371  }
1372  }
1373 
1374  return node;
1375 }
1376 
1377 
1379 {
1380  VrmlSwitchPtr node( new VrmlSwitch );
1381 
1382  while(scanner->readSymbol()){
1383  switch(scanner->symbolValue){
1384  case F_CHOICE:
1385  readMFNode(node->choice, CHILD_NODE);
1386  break;
1387 
1388  case F_WHICH_CHOICE:
1389  readSFInt32(node->whichChoice);
1390  break;
1391 
1392  default:
1393  scanner->throwException( "Undefined field" );
1394  }
1395  }
1396 
1397  return node;
1398 }
1399 
1400 
1402 {
1403  VrmlLODPtr node( new VrmlLOD );
1404 
1405  while(scanner->readSymbol()){
1406  switch(scanner->symbolValue){
1407  case F_RANGE:
1408  readMFFloat(node->range);
1409  break;
1410 
1411  case F_CENTER:
1412  readSFVec3f(node->center);
1413  break;
1414 
1415  case F_LEVEL:
1416  readMFNode(node->level, ANY_NODE);
1417  break;
1418 
1419  default:
1420  scanner->throwException("Undefined field");
1421  }
1422  }
1423 
1424  return node;
1425 }
1426 
1427 
1429 {
1430  VrmlCollisionPtr node(new VrmlCollision);
1431 
1432  while(scanner->readSymbol()){
1433  switch(scanner->symbolValue){
1434  case F_COLLIDE:
1435  readSFBool(node->collide);
1436  break;
1437 
1438  case F_CHILDREN:
1439  readMFNode(node->children, CHILD_NODE);
1440  break;
1441 
1442  case F_PROXY:
1443  readSFNode(node->proxy, SHAPE_NODE);
1444  break;
1445 
1446  case F_BBOX_CENTER:
1447  readSFVec3f(node->bboxCenter);
1448  break;
1449 
1450  case F_BBOX_SIZE:
1451  readSFVec3f(node->bboxSize);
1452  break;
1453 
1454  default:
1455  scanner->throwException( "Undefined field" );
1456  }
1457  }
1458 
1459  return node;
1460 }
1461 
1462 
1464 {
1465  VrmlAnchorPtr node(new VrmlAnchor);
1466 
1467  while(scanner->readSymbol()){
1468  switch( scanner->symbolValue){
1469  case F_CHILDREN:
1470  readMFNode(node->children, CHILD_NODE);
1471  break;
1472 
1473  case F_DESCRIPTION:
1474  readSFString(node->description);
1475  break;
1476 
1477  case F_PARAMETER:
1478  readMFString(node->parameter);
1479  break;
1480 
1481  case F_URL:
1482  readMFString(node->url);
1483  break;
1484 
1485  case F_BBOX_CENTER:
1486  readSFVec3f(node->bboxCenter);
1487  break;
1488 
1489  case F_BBOX_SIZE:
1490  readSFVec3f(node->bboxSize);
1491  break;
1492 
1493  default:
1494  scanner->throwException( "Undefined field" );
1495  }
1496  }
1497 
1498  return node;
1499 }
1500 
1501 
1503 {
1504  VrmlFogPtr node(new VrmlFog);
1505 
1506  while(scanner->readSymbol()){
1507  switch(scanner->symbolValue){
1508  case F_COLOR:
1509  readSFColor(node->color);
1510  break;
1511 
1512  case F_VISIBILITY_RANGE:
1513  readSFFloat(node->visibilityRange);
1514  break;
1515 
1516  case F_FOG_TYPE:
1517  readSFString(node->fogType);
1518  break;
1519 
1520  default:
1521  scanner->throwException( "Undefined field" );
1522  }
1523  }
1524 
1525  return node;
1526 }
1527 
1528 
1530 {
1531  VrmlBillboardPtr node( new VrmlBillboard );
1532 
1533  while(scanner->readSymbol()){
1534  switch(scanner->symbolValue){
1535  case F_AXIS_OF_ROTATION:
1536  readSFVec3f(node->axisOfRotation);
1537  break;
1538 
1539  case F_CHILDREN:
1540  readMFNode(node->children, CHILD_NODE);
1541  break;
1542 
1543  case F_BBOX_CENTER:
1544  readSFVec3f(node->bboxCenter);
1545  break;
1546 
1547  case F_BBOX_SIZE:
1548  readSFVec3f(node->bboxSize);
1549  break;
1550 
1551  default:
1552  scanner->throwException( "Undefined field" );
1553  }
1554  }
1555 
1556  return node;
1557 }
1558 
1559 
1561 {
1562  VrmlWorldInfoPtr node(new VrmlWorldInfo);
1563 
1564  while(scanner->readSymbol()){
1565  switch(scanner->symbolValue){
1566  case F_TITLE:
1567  readSFString(node->title);
1568  break;
1569 
1570  case F_INFO:
1571  readMFString(node->info);
1572  break;
1573 
1574  default:
1575  scanner->throwException("Undefined field");
1576  }
1577  }
1578 
1579  return node;
1580 }
1581 
1582 
1584 {
1585  VrmlPointLightPtr node( new VrmlPointLight );
1586 
1587  while(scanner->readSymbol()){
1588  switch(scanner->symbolValue){
1589  case F_LOCATION:
1590  readSFVec3f(node->location);
1591  break;
1592 
1593  case F_ON:
1594  readSFBool(node->on);
1595  break;
1596 
1597  case F_INTENSITY:
1598  readSFFloat(node->intensity);
1599  break;
1600 
1601  case F_COLOR:
1602  readSFColor(node->color);
1603  break;
1604 
1605  case F_RADIUS:
1606  readSFFloat(node->radius);
1607  break;
1608 
1609  case F_AMBIENT_INTENSITY:
1610  readSFFloat(node->ambientIntensity);
1611  break;
1612 
1613  case F_ATTENUATION:
1614  readSFVec3f(node->attenuation);
1615  break;
1616 
1617  default:
1618  scanner->throwException( "Undefined field" );
1619  }
1620  }
1621 
1622  return node;
1623 }
1624 
1625 
1626 
1628 {
1630 
1631  while(scanner->readSymbol()){
1632 
1633  switch(scanner->symbolValue){
1634 
1635  case F_DIRECTION: readSFVec3f(node->direction); break;
1636  case F_ON: readSFBool(node->on); break;
1637  case F_INTENSITY: readSFFloat(node->intensity); break;
1638  case F_COLOR: readSFColor(node->color); break;
1639  case F_AMBIENT_INTENSITY: readSFFloat(node->ambientIntensity); break;
1640 
1641  default: scanner->throwException("Undefined field");
1642  }
1643  }
1644 
1645  return node;
1646 }
1647 
1648 
1650 {
1651  VrmlSpotLightPtr node(new VrmlSpotLight);
1652 
1653  while(scanner->readSymbol()){
1654  switch(scanner->symbolValue){
1655  case F_LOCATION:
1656  readSFVec3f(node->location);
1657  break;
1658 
1659  case F_DIRECTION:
1660  readSFVec3f(node->direction);
1661  break;
1662 
1663  case F_ON:
1664  readSFBool(node->on);
1665  break;
1666 
1667  case F_COLOR:
1668  readSFColor(node->color);
1669  break;
1670 
1671  case F_INTENSITY:
1672  readSFFloat(node->intensity);
1673  break;
1674 
1675  case F_RADIUS:
1676  readSFFloat(node->radius);
1677  break;
1678 
1679  case F_AMBIENT_INTENSITY:
1680  readSFFloat(node->ambientIntensity);
1681  break;
1682 
1683  case F_ATTENUATION:
1684  readSFVec3f(node->attenuation);
1685  break;
1686 
1687  case F_BEAM_WIDTH:
1688  readSFFloat(node->beamWidth);
1689  break;
1690 
1691  case F_CUT_OFF_RANGE:
1692  readSFFloat(node->cutOffAngle);
1693  break;
1694 
1695  default:
1696  scanner->throwException( "Undefined field" );
1697  }
1698  }
1699 
1700  return node;
1701 }
1702 
1703 
1705 {
1706  VrmlBoxPtr node(new VrmlBox);
1707 
1708  if(scanner->readSymbol()){
1709  if(scanner->symbolValue != F_SIZE)
1710  scanner->throwException("Undefined field");
1711  readSFVec3f(node->size);
1712  }
1713 
1714  return node;
1715 }
1716 
1717 
1719 {
1720  VrmlConePtr node(new VrmlCone);
1721 
1722  while(scanner->readSymbol()){
1723 
1724  switch(scanner->symbolValue){
1725 
1726  case F_BOTTOM: readSFBool(node->bottom); break;
1727  case F_BOTTOM_RADIUS: readSFFloat(node->bottomRadius); break;
1728  case F_HEIGHT: readSFFloat(node->height); break;
1729  case F_SIDE: readSFBool(node->side); break;
1730 
1731  default: scanner->throwException("Undefined field");
1732  }
1733  }
1734 
1735  return node;
1736 }
1737 
1738 
1740 {
1741  VrmlCylinderPtr node(new VrmlCylinder);
1742 
1743  while(scanner->readSymbol()){
1744 
1745  switch(scanner->symbolValue){
1746 
1747  case F_BOTTOM: readSFBool(node->bottom); break;
1748  case F_HEIGHT: readSFFloat(node->height); break;
1749  case F_RADIUS: readSFFloat(node->radius); break;
1750  case F_SIDE: readSFBool(node->side); break;
1751  case F_TOP: readSFBool(node->top); break;
1752 
1753  default: scanner->throwException("Undefined field");
1754  }
1755  }
1756 
1757  return node;
1758 }
1759 
1760 
1762 {
1763  VrmlSpherePtr node(new VrmlSphere);
1764 
1765  if(scanner->readSymbol()){
1766  if(scanner->symbolValue != F_RADIUS)
1767  scanner->throwException("Undefined field");
1768  readSFFloat(node->radius);
1769  }
1770 
1771  return node;
1772 }
1773 
1774 
1776 {
1777  VrmlTextPtr node(new VrmlText);
1778 
1779  while(scanner->readSymbol()){
1780 
1781  switch(scanner->symbolValue){
1782 
1783  case F_STRING: readMFString(node->fstring); break;
1784  case F_LENGTH: readMFFloat(node->length); break;
1785  case F_MAX_EXTENT: readSFFloat(node->maxExtent); break;
1786  case F_FONT_STYLE: node->fontStyle = dynamic_pointer_cast<VrmlFontStyle>(readSFNode(FONT_STYLE_NODE)); break;
1787 
1788  default: scanner->throwException("Undefined field");
1789  }
1790  }
1791 
1792  return node;
1793 }
1794 
1795 
1797 {
1798  VrmlFontStylePtr node(new VrmlFontStyle);
1799 
1800  while(scanner->readSymbol()){
1801 
1802  switch(scanner->symbolValue){
1803 
1804  case F_FAMILY: readMFString(node->family); break;
1805  case F_HORIZONTAL: readSFBool(node->horizontal); break;
1806  case F_JUSTIFY: readMFString(node->justify); break;
1807  case F_LANGUAGE: readSFString(node->language); break;
1808  case F_LEFT_TO_RIGHT: readSFBool(node->leftToRight); break;
1809  case F_SIZE: readSFFloat(node->size); break;
1810  case F_SPACING: readSFFloat(node->spacing); break;
1811  case F_STYLE: readSFString(node->style); break;
1812  case F_TOP_TO_BOTTOM: readSFBool(node->topToBottom); break;
1813 
1814  default: scanner->throwException("Undefined field");
1815  }
1816  }
1817 
1818  return node;
1819 }
1820 
1821 
1823 {
1825 
1826  while(scanner->readSymbol()){
1827 
1828  switch(scanner->symbolValue){
1829 
1830  case F_COLOR: node->color = dynamic_pointer_cast<VrmlColor>(readSFNode(COLOR_NODE)); break;
1831  case F_COORD: node->coord = dynamic_pointer_cast<VrmlCoordinate>(readSFNode(COORDINATE_NODE)); break;
1832  case F_COLOR_INDEX: readMFInt32(node->colorIndex); break;
1833  case F_COLOR_PER_VERTEX: readSFBool(node->colorPerVertex); break;
1834  case F_COORD_INDEX: readMFInt32(node->coordIndex); break;
1835 
1836  default: scanner->throwException("Undefined field");
1837  }
1838  }
1839 
1840  return node;
1841 }
1842 
1843 
1845 {
1847 
1848  while(scanner->readSymbol()){
1849 
1850  switch(scanner->symbolValue){
1851 
1852  case F_COLOR: node->color = dynamic_pointer_cast<VrmlColor>(readSFNode(COLOR_NODE)); break;
1853  case F_COORD: node->coord = dynamic_pointer_cast<VrmlCoordinate>(readSFNode(COORDINATE_NODE)); break;
1854 
1855  case F_COLOR_INDEX: readMFInt32(node->colorIndex); break;
1856  case F_COLOR_PER_VERTEX: readSFBool(node->colorPerVertex); break;
1857  case F_COORD_INDEX: readMFInt32(node->coordIndex); break;
1858 
1859  case F_CCW: readSFBool(node->ccw); break;
1860  case F_CONVEX: readSFBool(node->convex); break;
1861  case F_SOLID: readSFBool(node->solid); break;
1862  case F_CREASE_ANGLE: readSFFloat(node->creaseAngle); break;
1863  case F_NORMAL_INDEX: readMFInt32(node->normalIndex); break;
1864  case F_NORMAL_PER_VERTEX: readSFBool(node->normalPerVertex); break;
1865  case F_TEX_COORD_INDEX: readMFInt32(node->texCoordIndex); break;
1866 
1867  case F_TEX_COORD:
1868  node->texCoord = dynamic_pointer_cast<VrmlTextureCoordinate>(readSFNode(TEXTURE_COORDINATE_NODE));
1869  break;
1870  case F_NORMAL:
1871  node->normal = dynamic_pointer_cast<VrmlNormal>(readSFNode(NORMAL_NODE));
1872  break;
1873 
1874  default: scanner->throwException("Undefined field");
1875  }
1876  }
1877 
1878  //checkIndexedFaceSet(node);
1879 
1880  return node;
1881 }
1882 
1883 
1885 {
1886  MFInt32& index = node->coordIndex;
1887  MFVec3f& coord = node->coord->point;
1888 
1889  int numUsedVertices = 0;
1890  vector<bool> usedVertices(coord.size(), false);
1891 
1892  int n = index.size();
1893 
1894  int i = 0;
1895  vector<int> polygon;
1896  while(i < n){
1897  polygon.resize(0);
1898  bool isSeparated = false;
1899  while(i < n){
1900  if(index[i] < 0){
1901  isSeparated = true;
1902  i++;
1903  break;
1904  }
1905  polygon.push_back(index[i]);
1906  if(!usedVertices[index[i]]){
1907  usedVertices[index[i]] = true;
1908  numUsedVertices++;
1909  }
1910  i++;
1911  }
1912 
1913  const int numVertices = polygon.size();
1914 
1915  if(numVertices < 3){
1916  cerr << "Number of vertices is less than 3 !" << endl;
1917  }
1918  if(numVertices > 3){
1919  cerr << "Polygon is not a triangle in ";
1920  cerr << scanner->filename << endl;
1921  for(int j=0; j < numVertices; j++){
1922  cerr << polygon[j] << ",";
1923  }
1924  cerr << endl;
1925  }
1926  if(!isSeparated){
1927  cerr << "Vertex index is not correctly separated by '-1'" << endl;
1928  }
1929 
1930  int n = coord.size();
1931  for(int j=0; j < numVertices; j++){
1932  if(polygon[j] >= n){
1933  cerr << "index " << polygon[j] << " is over the number of vertices" << endl;
1934  }
1935  }
1936 
1937  bool isIndexOverlapped = false;
1938  bool isVertexOverlapped = false;
1939  for(int j = 0; j < numVertices - 1; j++){
1940  for(int k = j+1; k < numVertices; k++){
1941  if(polygon[j] == polygon[k]){
1942  isIndexOverlapped = true;
1943  }
1944  SFVec3f& v1 = coord[polygon[j]];
1945  SFVec3f& v2 = coord[polygon[k]];
1946  if(v1[0] == v2[0] && v1[1] == v2[1] && v1[2] == v2[2]){
1947  isVertexOverlapped = true;
1948  }
1949  }
1950  }
1951  if(isIndexOverlapped){
1952  cerr << "overlapped vertex index in one polygon: ";
1953  for(int l = 0; l < numVertices; l++){
1954  cerr << polygon[l] << ",";
1955  }
1956  cerr << endl;
1957  }
1958 
1959  if(isVertexOverlapped){
1960  cerr << "In " << scanner->filename << ":";
1961  cerr << "two vertices in one polygon have the same position\n";
1962 
1963  for(int l = 0; l < numVertices; l++){
1964  SFVec3f& v = coord[polygon[l]];
1965  cerr << polygon[l] << " = (" << v[0] << "," << v[1] << "," << v[2] << ") ";
1966  }
1967  cerr << endl;
1968  }
1969  }
1970 
1971  if(numUsedVertices < static_cast<int>(coord.size())){
1972  cerr << "There are vertices which are not used in" << scanner->filename << ".\n";
1973  cerr << "Number of vertices is " << coord.size();
1974  cerr << ", Number of used ones is " << numUsedVertices << endl;
1975  }
1976 }
1977 
1978 
1980 {
1982 
1983  if(scanner->readSymbol()){
1984  if(scanner->symbolValue != F_POINT)
1985  scanner->throwException("Undefined field");
1986  readMFVec3f(node->point);
1987  }
1988 
1989  return node;
1990 }
1991 
1992 
1994 {
1996 
1997  if(scanner->readSymbol()){
1998  if(scanner->symbolValue != F_POINT)
1999  scanner->throwException("Undefined field");
2000  readMFVec2f(node->point);
2001  }
2002 
2003  return node;
2004 }
2005 
2006 
2008 {
2009  VrmlColorPtr node(new VrmlColor);
2010 
2011  if(scanner->readSymbol()){
2012  if(scanner->symbolValue != F_COLOR)
2013  scanner->throwException("Undefined field");
2014  readMFColor(node->color);
2015  }
2016 
2017  return node;
2018 }
2019 
2020 
2022 {
2023  VrmlNormalPtr node(new VrmlNormal);
2024 
2025  if(scanner->readSymbol()){
2026  if(scanner->symbolValue != F_VECTOR)
2027  scanner->throwException("Undefined field");
2028  readMFVec3f(node->vector);
2029  }
2030 
2031  return node;
2032 }
2033 
2034 
2036 {
2038 
2039  while(scanner->readSymbol()){
2040 
2041  switch(scanner->symbolValue){
2042 
2043  case F_MATERIAL: node->material = dynamic_pointer_cast<VrmlMaterial>(readSFNode(MATERIAL_NODE)); break;
2044  case F_TEXTURE: node->texture = dynamic_pointer_cast<VrmlTexture>(readSFNode(TEXTURE_NODE)); break;
2045  case F_TEXTURE_TRANSFORM:
2046  node->textureTransform = dynamic_pointer_cast<VrmlTextureTransform>(readSFNode(TEXTURE_TRANSFORM_NODE)); break;
2047 
2048  default: scanner->throwException("Undefined field");
2049  }
2050  }
2051 
2052  return node;
2053 }
2054 
2055 
2057 {
2058  VrmlMaterialPtr node(new VrmlMaterial);
2059 
2060  while(scanner->readSymbol()){
2061 
2062  switch(scanner->symbolValue){
2063 
2064  case F_AMBIENT_INTENSITY: readSFFloat(node->ambientIntensity); break;
2065  case F_DIFFUSE_COLOR: readSFColor(node->diffuseColor); break;
2066  case F_EMISSIVE_COLOR: readSFColor(node->emissiveColor); break;
2067  case F_SHININESS: readSFFloat(node->shininess); break;
2068  case F_SPECULAR_COLOR: readSFColor(node->specularColor); break;
2069  case F_TRANSPARANCY: readSFFloat(node->transparency); break;
2070 
2071  default: scanner->throwException("Undefined field");
2072  }
2073  }
2074 
2075  return node;
2076 }
2077 
2078 
2080 {
2082 
2083  while(scanner->readSymbol()){
2084 
2085  switch(scanner->symbolValue){
2086  case F_URL: readMFString(node->url); break;
2087  case F_REPEAT_S: readSFBool(node->repeatS); break;
2088  case F_REPEAT_T: readSFBool(node->repeatT); break;
2089 
2090  default: scanner->throwException("Undefined field");
2091  }
2092  }
2093 
2094  return node;
2095 }
2096 
2097 
2099 {
2101 
2102  while(scanner->readSymbol()){
2103 
2104  switch(scanner->symbolValue){
2105  case F_CENTER: readSFVec2f(node->center); break;
2106  case F_ROTATION: readSFFloat(node->rotation); break;
2107  case F_SCALE: readSFVec2f(node->scale); break;
2108  case F_TRANSLATION: readSFVec2f(node->translation); break;
2109 
2110  default: scanner->throwException("Undefined field");
2111  }
2112  }
2113 
2114  return node;
2115 }
2116 
2117 
2119 {
2120  if(!currentProtoInstance){
2121  scanner->throwException("cannot use proto field value here");
2122  }
2123  scanner->readWordEx("illegal field");
2124  TProtoFieldMap::iterator p = currentProtoInstance->fields.find(scanner->stringValue);
2125 
2126  if(p == currentProtoInstance->fields.end()){
2127  string msg = "This field(";
2128  msg += scanner->stringValue +") does not exist in proto node";
2129  scanner->throwException(msg);
2130  }
2131  if(p->second.typeId() != fieldTypeId){
2132  scanner->throwException("Unmatched field type");
2133  }
2134 
2135  return p->second;
2136 }
2137 
2138 
2140 {
2141  if(scanner->readSymbol(F_IS)){
2143  out_value = field.sfInt32();
2144  } else {
2145  out_value = scanner->readIntEx("illegal int value");
2146  }
2147 }
2148 
2149 
2151 {
2152  if(scanner->readSymbol(F_IS)){
2154  out_value = field.mfInt32();
2155  } else {
2156  int v;
2157  out_value.clear();
2158  if(!scanner->readChar('[')){
2159  readSFInt32(v);
2160  out_value.push_back(v);
2161  } else {
2162  while(!scanner->readChar(']')){
2163  readSFInt32(v);
2164  out_value.push_back(v);
2165  }
2166  }
2167  }
2168 }
2169 
2170 
2172 {
2173  if(scanner->readSymbol(F_IS)){
2175  out_value = field.sfFloat();
2176  } else {
2177  out_value = scanner->readDoubleEx("illegal float value");
2178  }
2179 }
2180 
2181 
2183 {
2184  if(scanner->readSymbol(F_IS)){
2186  out_value = field.mfFloat();
2187  } else {
2188  SFFloat v;
2189  out_value.clear();
2190  if(!scanner->readChar('[')){
2191  readSFFloat(v);
2192  out_value.push_back(v);
2193  } else {
2194  while(!scanner->readChar(']')){
2195  readSFFloat(v);
2196  out_value.push_back(v);
2197  }
2198  }
2199  }
2200 }
2201 
2202 
2204 {
2205  if(scanner->readSymbol(F_IS)){
2207  out_value = field.sfString();
2208  } else {
2209  out_value = scanner->readQuotedStringEx("illegal string");
2210  }
2211 }
2212 
2213 
2215 {
2216  if(scanner->readSymbol(F_IS)){
2218  out_value = field.mfString();
2219  } else {
2220  string s;
2221  out_value.clear();
2222  if(!scanner->readChar('[')){
2223  readSFString(s);
2224  out_value.push_back(s);
2225  } else {
2226  while(!scanner->readChar(']')){
2227  readSFString(s);
2228  out_value.push_back(s);
2229  }
2230  }
2231  }
2232 }
2233 
2234 
2236 {
2237  if(scanner->readSymbol(F_IS)){
2239  out_value = field.sfVec2f();
2240  } else {
2241  readSFFloat(out_value[0]);
2242  readSFFloat(out_value[1]);
2243  }
2244 }
2245 
2246 
2248 {
2249  if(scanner->readSymbol(F_IS)){
2251  out_value = field.mfVec2f();
2252  } else {
2253  SFVec2f v;
2254  out_value.clear();
2255  if(!scanner->readChar('[')){
2256  readSFVec2f(v);
2257  out_value.push_back(v);
2258  } else {
2259  while(!scanner->readChar(']')){
2260  readSFVec2f(v);
2261  out_value.push_back(v);
2262  }
2263  }
2264  }
2265 }
2266 
2267 
2269 {
2270  if(scanner->readSymbol(F_IS)){
2272  out_value = field.sfVec3f();
2273  } else {
2274  readSFFloat(out_value[0]);
2275  readSFFloat(out_value[1]);
2276  readSFFloat(out_value[2]);
2277  }
2278 }
2279 
2280 
2282 {
2283  if(scanner->readSymbol(F_IS)){
2285  out_value = field.mfVec3f();
2286  } else {
2287  SFVec3f v;
2288  out_value.clear();
2289  if(!scanner->readChar('[')){
2290  readSFVec3f(v);
2291  out_value.push_back(v);
2292  } else {
2293  while(!scanner->readChar(']')){
2294  readSFVec3f(v);
2295  out_value.push_back(v);
2296  }
2297  }
2298  }
2299 }
2300 
2301 
2303 {
2304  if(scanner->readSymbol(F_IS)){
2306  out_value = field.sfColor();
2307  } else {
2308  readSFVec3f(out_value);
2309  }
2310 }
2311 
2312 
2313 
2315 {
2316  if(scanner->readSymbol(F_IS)){
2318  out_value = field.mfColor();
2319  } else {
2320  readMFVec3f(out_value);
2321  }
2322 }
2323 
2324 
2326 {
2327  if(scanner->readSymbol(F_IS)){
2329  out_value = field.sfRotation();
2330  } else {
2331  double len2 = 0.0;
2332  // axis
2333  for(int i=0; i < 3; i++){
2334  readSFFloat(out_value[i]);
2335  len2 += out_value[i] * out_value[i];
2336  }
2337  readSFFloat(out_value[3]); // angle
2338 
2339  const double len = sqrt(len2);
2340 
2341  if(fabs(len) < 1.0e-6){
2342  scanner->throwException("Rotation axis is zero vector");
2343  }
2344 
2345  // force normalize
2346  for(int i=0; i < 3; i++){
2347  out_value[i] /= len;
2348  }
2349  }
2350 }
2351 
2352 
2354 {
2355  if(scanner->readSymbol(F_IS)){
2357  out_value = field.mfRotation();
2358  } else {
2359  SFRotation r;
2360  out_value.clear();
2361  if(!scanner->readChar('[')){
2362  readSFRotation(r);
2363  out_value.push_back(r);
2364  } else {
2365  while(!scanner->readChar(']')){
2366  readSFRotation(r);
2367  out_value.push_back(r);
2368  }
2369  }
2370  }
2371 }
2372 
2373 
2375 {
2376  if(scanner->readSymbol(F_IS)){
2378  out_value = field.sfBool();
2379  } else {
2380  switch(scanner->readSymbolEx("no bool value")){
2381  case V_TRUE: out_value = true; break;
2382  case V_FALSE: out_value = false; break;
2383 
2384  default: scanner->throwException("no bool value");
2385  }
2386  }
2387 }
2388 
2389 
2390 
2391 // #####
2392 //==================================================================================================
2402 //==================================================================================================
2404  SFImage& out_image )
2405 {
2406  if( scanner->readSymbol( F_IS ) )
2407  {
2409  out_image = field.sfImage(); //##### 要チェック
2410  }
2411  else
2412  {
2413  SFInt32 pixelValue;
2414  unsigned char componentValue;
2415 
2416  readSFInt32( out_image.width );
2417  readSFInt32( out_image.height );
2418  readSFInt32( out_image.numComponents );
2419 
2424  int w, h, i;
2425  int shift;
2426  const SFInt32 comps = out_image.numComponents;
2427 
2428  for( h=0; h<out_image.height; h++ )
2429  {
2430  for( w=0; w<out_image.width; w++ )
2431  {
2432  readSFInt32( pixelValue );
2433  for( i=0, shift=8*( comps - 1 ); i<comps; i++, shift-=8 )
2434  {
2435  // get each component values from left 8 bytes
2436  componentValue = (unsigned char)( (pixelValue>>shift) & 0x000000FF );
2437  out_image.pixels.push_back( componentValue );
2438  }
2439  }
2440  }
2441  }
2442 }
2443 
2444 
2446 {
2447  if(scanner->readSymbol( F_IS )){
2449  out_value = field.sfFloat();
2450  } else {
2451  out_value = scanner->readDoubleEx( "illegal time value" );
2452  }
2453 }
2454 
2455 
2457 {
2458  if(scanner->readSymbol(F_IS)){
2460  out_value = field.mfFloat();
2461  } else {
2462  SFFloat v;
2463  out_value.clear();
2464  if(!scanner->readChar('[' )){
2465  readSFTime( v );
2466  out_value.push_back( v );
2467  } else {
2468  while(!scanner->readChar(']')){
2469  readSFTime(v);
2470  out_value.push_back(v);
2471  }
2472  }
2473  }
2474 }
2475 
2476 
2477 // This API should be obsolete
2479 {
2480  if(scanner->readSymbol(F_IS)){
2482  out_node = field.sfNode();
2483  } else if(scanner->readSymbol(V_NULL)){
2484  out_node = 0;
2485  } else {
2486  out_node = readNode(nodeCategory);
2487  }
2488 }
2489 
2490 
2492 {
2493  if(scanner->readSymbol(F_IS)){
2495  return field.sfNode();
2496  } else if(scanner->readSymbol(V_NULL)){
2497  return 0;
2498  } else {
2499  return readNode(nodeCategory);
2500  }
2501 }
2502 
2503 
2505 {
2506  if(scanner->readSymbol(F_IS)){
2508  out_nodes = field.mfNode();
2509  } else {
2510  SFNode sfnode;
2511  out_nodes.clear();
2512  if(!scanner->readChar('[')){
2513  readSFNode(sfnode, nodeCategory);
2514  out_nodes.push_back(sfnode);
2515  } else {
2516  while(true) {
2517  readSFNode(sfnode, nodeCategory);
2518  if(sfnode){
2519  out_nodes.push_back(sfnode);
2520  }
2521  bool closed = scanner->readChar(']');
2522  if(closed){
2523  break;
2524  }
2525  if(!sfnode && !closed){
2526  scanner->throwException("syntax error");
2527  }
2528  }
2529  }
2530  }
2531 }
2532 
2534 {
2537 
2538  scanner = boost::shared_ptr<EasyScanner>( new EasyScanner() );
2539  setSymbols();
2540 }
2541 
2543 {
2544  struct TSymbol {
2545  int id;
2546  const char* symbol;
2547  };
2548 
2549  static TSymbol symbols[] = {
2550 
2551  // values
2552  { V_TRUE, "TRUE" },
2553  { V_FALSE, "FALSE" },
2554  { V_NULL, "NULL" },
2555 
2556  // types
2557  { T_SFINT32, "SFInt32" },
2558  { T_MFINT32, "MFInt32" },
2559  { T_SFFLOAT, "SFFloat" },
2560  { T_MFFLOAT, "MFFloat" },
2561  { T_SFVEC2F, "SFVec2f" },
2562  { T_MFVEC2F, "MFVec2f" },
2563  { T_SFVEC3F, "SFVec3f" },
2564  { T_MFVEC3F, "MFVec3f" },
2565  { T_SFROTATION, "SFRotation" },
2566  { T_MFROTATION, "MFRotation" },
2567  { T_SFTIME, "SFTime" },
2568  { T_MFTIME, "MFTime" },
2569  { T_SFCOLOR, "SFColor" },
2570  { T_MFCOLOR, "MFColor" },
2571  { T_SFSTRING, "SFString" },
2572  { T_MFSTRING, "MFString" },
2573  { T_SFNODE, "SFNode" },
2574  { T_MFNODE, "MFNode" },
2575  { T_SFBOOL, "SFBool" },
2576  { T_SFIMAGE, "SFImage" },
2577 
2578  // Nodes
2579  { N_PROTO, "PROTO" },
2580  { N_INLINE, "Inline" },
2581  { N_BACKGROUND, "Background" },
2582  { N_NAVIGATION_INFO, "NavigationInfo" },
2583  { N_VIEWPOINT, "Viewpoint" },
2584  { N_GROUP, "Group" },
2585  { N_TRANSFORM, "Transform" },
2586  { N_SHAPE, "Shape" },
2587  { N_APPEARANCE, "Appearance" },
2588  { N_MATERIAL, "Material" },
2589  { N_IMAGE_TEXTURE, "ImageTexture" },
2590  { N_TEXTURE_TRANSFORM, "TextureTransform" },
2591  { N_BOX, "Box" },
2592  { N_CONE, "Cone" },
2593  { N_CYLINDER, "Cylinder" },
2594  { N_SPHERE, "Sphere" },
2595  { N_TEXT, "Text" },
2596  { N_FONT_STYLE, "FontStyle" },
2597  { N_INDEXED_LINE_SET, "IndexedLineSet" },
2598  { N_INDEXED_FACE_SET, "IndexedFaceSet" },
2599  { N_COLOR, "Color" },
2600  { N_COORDINATE, "Coordinate" },
2601  { N_TEXTURE_COORDINATE, "TextureCoordinate" },
2602  { N_NORMAL, "Normal" },
2603  { N_CYLINDER_SENSOR, "CylinderSensor" },
2604 
2605  { N_POINTSET, "PointSet" },
2606  { N_PIXEL_TEXTURE,"PixelTexture" },
2607  { N_MOVIE_TEXTURE, "MovieTexture" },
2608  { N_ELEVATION_GRID, "ElevationGrid" },
2609  { N_EXTRUSION, "Extrusion" },
2610  { N_SWITCH, "Switch" },
2611  { N_LOD,"LOD" },
2612  { N_COLLISION, "Collision" },
2613  { N_ANCHOR, "Anchor" },
2614  { N_FOG, "Fog" },
2615  { N_BILLBOARD, "Billboard" },
2616  { N_WORLD_INFO, "WorldInfo" },
2617  { N_POINT_LIGHT, "PointLight" },
2618  { N_DIRECTIONAL_LIGHT, "DirectionalLight" },
2619  { N_SPOT_LIGHT, "SpotLight" },
2620 
2621  // unsupported nodes
2622  { N_AUDIO_CLIP, "AudioClip" },
2623  { N_SOUND, "Sound" },
2624  { N_COLOR_INTERPOLATOR, "ColorInterpolator" },
2625  { N_COORDINATE_INTERPOLATOR, "CoordinateInterpolator" },
2626  { N_ORIENTATION_INTERPOLATOR, "OrientationInterpolator" },
2627  { N_NORMAL_INTERPOLATOR, "NormalInterpolator" },
2628  { N_POSITION_INTERPOLATOR, "PositionInterpolator" },
2629  { N_SCALAR_INTERPOLATOR, "ScalarInterpolator" },
2630  { N_PLANE_SENSOR, "PlaneSensor" },
2631  { N_PROXIMITY_SENSOR, "ProximitySensor" },
2632  { N_SPHERE_SENSOR, "SphereSensor" },
2633  { N_TIME_SENSOR, "TimeSensor" },
2634  { N_TOUCH_SENSOR, "TouchSensor" },
2635  { N_VISIBILITY_SENSOR, "VisibilitySensor" },
2636 
2637  // Fields
2638  { F_IS, "IS" },
2639 
2640  { F_URL, "url" },
2641 
2642  { F_GROUND_ANGLE, "groundAngle" },
2643  { F_GROUND_COLOR, "groundColor" },
2644  { F_SKY_ANGLE, "skyAngle" },
2645  { F_SKY_COLOR, "skyColor" },
2646  { F_BACK_URL, "backUrl" },
2647  { F_BOTTOM_URL, "bottomUrl" },
2648  { F_FRONT_URL, "frontUrl" },
2649  { F_LEFT_URL, "leftUrl" },
2650  { F_RIGHT_URL, "rightUrl" },
2651  { F_TOP_URL, "topUrl" },
2652 
2653  { F_AVATAR_SIZE, "avatarSize" },
2654  { F_HEADLIGHT, "headlight" },
2655  { F_SPEED, "speed" },
2656  { F_TYPE, "type" },
2657  { F_VISIBILITY_LIMIT, "visibilityLimit" },
2658 
2659  { F_FIELD_OF_VIEW, "fieldOfView" },
2660  { F_JUMP, "jump" },
2661  { F_ORIENTATION, "orientation" },
2662  { F_POSITION, "position" },
2663  { F_DESCRIPTION, "description" },
2664 
2665  { F_CHILDREN, "children" },
2666  { F_ADD_CHILDREN, "addChildren" },
2667  { F_REMOVE_CHILDREN, "removeChildren" },
2668  { F_BBOX_CENTER, "bboxCenter" },
2669  { F_BBOX_SIZE, "bboxSize" },
2670 
2671  { F_CENTER, "center" },
2672  { F_ROTATION, "rotation" },
2673  { F_SCALE, "scale" },
2674  { F_SCALE_ORIENTATION, "scaleOrientation" },
2675  { F_TRANSLATION, "translation" },
2676 
2677  { F_APPEARANCE, "appearance" },
2678  { F_GEOMETRY, "geometry" },
2679 
2680  { F_MATERIAL, "material" },
2681  { F_TEXTURE, "texture" },
2682  { F_TEXTURE_TRANSFORM, "textureTransform" },
2683 
2684  { F_AMBIENT_INTENSITY, "ambientIntensity" },
2685  { F_DIFFUSE_COLOR, "diffuseColor" },
2686  { F_EMISSIVE_COLOR, "emissiveColor" },
2687  { F_SHININESS, "shininess" },
2688  { F_SPECULAR_COLOR, "specularColor" },
2689  { F_TRANSPARANCY, "transparency" },
2690  { F_DIRECTION, "direction" },
2691 
2692  { F_REPEAT_S, "repeatS" },
2693  { F_REPEAT_T, "repeatT" },
2694 
2695  { F_SIZE, "size" },
2696 
2697  { F_BOTTOM, "bottom" },
2698  { F_BOTTOM_RADIUS, "bottomRadius" },
2699  { F_HEIGHT, "height" },
2700  { F_SIDE, "side" },
2701 
2702  { F_RADIUS, "radius" },
2703  { F_TOP, "top" },
2704 
2705  { F_STRING, "string" },
2706  { F_FONT_STYLE, "fontStyle" },
2707  { F_LENGTH, "length" },
2708  { F_MAX_EXTENT, "maxExtent" },
2709 
2710  { F_FAMILY, "family" },
2711  { F_HORIZONTAL, "horizontal" },
2712  { F_JUSTIFY, "justify" },
2713  { F_LANGUAGE, "language" },
2714  { F_LEFT_TO_RIGHT, "leftToRight" },
2715  { F_SPACING, "spacing" },
2716  { F_STYLE, "style" },
2717  { F_TOP_TO_BOTTOM, "topToBottom" },
2718 
2719  { F_COLOR, "color" },
2720  { F_COORD, "coord" },
2721  { F_COLOR_INDEX, "colorIndex" },
2722  { F_COLOR_PER_VERTEX, "colorPerVertex" },
2723  { F_COORD_INDEX, "coordIndex" },
2724 
2725  { F_CCW, "ccw" },
2726  { F_CONVEX, "convex" },
2727  { F_SOLID, "solid" },
2728  { F_CREASE_ANGLE, "creaseAngle" },
2729  { F_NORMAL_INDEX, "normalIndex" },
2730  { F_NORMAL, "normal" },
2731  { F_NORMAL_PER_VERTEX, "normalPerVertex" },
2732  { F_TEX_COORD_INDEX, "texCoordIndex" },
2733  { F_TEX_COORD, "texCoord" },
2734 
2735  { F_POINT, "point" },
2736  { F_VECTOR, "vector" },
2737 
2738  { F_AUTO_OFFSET, "autoOffset" },
2739  { F_DISK_ANGLE, "diskAngle" },
2740  { F_ENABLED, "enabled" },
2741  { F_MAX_ANGLE, "maxAngle" },
2742  { F_MIN_ANGLE, "minAngle" },
2743  { F_OFFSET, "offset" },
2744 
2745  { F_IMAGE, "image" },
2746 
2747  { F_X_DIMENSION, "xDimension" },
2748  { F_Z_DIMENSION, "zDimension" },
2749  { F_X_SPACING, "xSpacing" },
2750  { F_Z_SPACING, "zSpacing" },
2751 
2752  { F_CROSS_SECTION, "crossSection" },
2753  { F_SPINE, "spine" },
2754  { F_BEGIN_CAP, "beginCap" },
2755  { F_END_CAP, "endCap" },
2756 
2757  { F_CHOICE, "choice" },
2758  { F_WHICH_CHOICE, "whichChoice" },
2759 
2760  { F_COLLIDE, "collide" },
2761  { F_PROXY, "proxy" },
2762 
2763  { F_PARAMETER, "parameter" },
2764 
2765  { F_VISIBILITY_RANGE, "visibilityRange" },
2766  { F_FOG_TYPE, "fogType" },
2767 
2768  { F_AXIS_OF_ROTATION, "axisOfRotation" },
2769 
2770  { F_TITLE, "title" },
2771  { F_INFO, "info" },
2772 
2773  { F_LOCATION, "location" },
2774  { F_ON, "on" },
2775  { F_INTENSITY, "intensity" },
2776  { F_ATTENUATION, "attenuation" },
2777  { F_DIRECTION, "direction" },
2778  { F_BEAM_WIDTH, "beamWidth" },
2779  { F_CUT_OFF_RANGE, "cutOffAngle" },
2780 
2781  // event type
2782  { E_FIELD, "field" },
2783  { E_EXPOSED_FIELD, "exposedField" },
2784  { E_EVENTIN, "eventIn" },
2785  { E_EVENTOUT, "eventOut" },
2786 
2787  // def & route
2788  { D_DEF, "DEF" },
2789  { D_USE, "USE" },
2790  { D_ROUTE, "ROUTE" },
2791 
2792  // unsupported keywords
2793  { U_SCRIPT, "Script" },
2794  { U_EXTERNPROTO, "EXTERNPROTO" },
2795 
2796  { 0, "" }
2797  };
2798 
2799  for(int i=0; symbols[i].id != 0; i++){
2800  scanner->registerSymbol(symbols[i].id, symbols[i].symbol);
2801  }
2802 }
VrmlGroupPtr readGroupNode()
std::vector< SFNode > MFNode
Definition: VrmlNodes.h:158
MFRotation & mfRotation()
Definition: VrmlNodes.h:843
std::vector< SFFloat > MFFloat
Definition: VrmlNodes.h:70
boost::intrusive_ptr< VrmlTextureTransform > VrmlTextureTransformPtr
Definition: VrmlNodes.h:301
void readMFVec2f(MFVec2f &out_value)
double SFFloat
Definition: VrmlNodes.h:50
bool SFBool
Definition: VrmlNodes.h:48
boost::intrusive_ptr< VrmlCollision > VrmlCollisionPtr
Definition: VrmlNodes.h:698
boost::intrusive_ptr< VrmlBackground > VrmlBackgroundPtr
Definition: VrmlNodes.h:217
VrmlColorPtr readColorNode()
VrmlPointSetPtr readPointSetNode()
std::vector< SFColor > MFColor
Definition: VrmlNodes.h:76
VRML Background node.
Definition: VrmlNodes.h:201
VrmlSpherePtr readSphereNode()
VrmlNavigationInfoPtr readNavigationInfoNode()
VRML Material node.
Definition: VrmlNodes.h:318
VRML ImageTexture node.
Definition: VrmlNodes.h:341
Modifications controlling boost library behavior.
Definition: ColladaUtil.h:306
char * filename
Definition: cdjpeg.h:133
EasyScannerPtr scanner
Definition: VrmlParser.cpp:310
boost::intrusive_ptr< VrmlUnsupportedNode > VrmlUnsupportedNodePtr
Definition: VrmlNodes.h:167
boost::intrusive_ptr< VrmlText > VrmlTextPtr
Definition: VrmlNodes.h:451
VRML FontStyle node.
Definition: VrmlNodes.h:422
boost::intrusive_ptr< VrmlImageTexture > VrmlImageTexturePtr
Definition: VrmlNodes.h:350
boost::intrusive_ptr< VrmlTransform > VrmlTransformPtr
Definition: VrmlNodes.h:265
MFColor & mfColor()
Definition: VrmlNodes.h:847
std::pair< std::string, VrmlVariantField > TProtoFieldPair
Definition: VrmlNodes.h:855
std::vector< unsigned char > pixels
Definition: VrmlNodes.h:65
boost::intrusive_ptr< VrmlGroup > VrmlGroupPtr
Definition: VrmlNodes.h:250
VrmlUnsupportedNodePtr skipScriptNode()
Definition: VrmlParser.cpp:699
boost::intrusive_ptr< VrmlElevationGrid > VrmlElevationGridPtr
Definition: VrmlNodes.h:628
void readSFBool(SFBool &out_value)
VRML Color node.
Definition: VrmlNodes.h:502
VRML Shape node.
Definition: VrmlNodes.h:285
VRML Cone node.
Definition: VrmlNodes.h:383
boost::intrusive_ptr< VrmlProtoInstance > VrmlProtoInstancePtr
Definition: VrmlNodes.h:898
VrmlIndexedFaceSetPtr readIndexedFaceSetNode()
VrmlBillboardPtr readBillboardNode()
boost::intrusive_ptr< VrmlNavigationInfo > VrmlNavigationInfoPtr
Definition: VrmlNodes.h:197
VRML Coordinate node.
Definition: VrmlNodes.h:512
VRML Group node.
Definition: VrmlNodes.h:236
VRML IndexedFaseSet node.
Definition: VrmlNodes.h:483
VrmlShapePtr readShapeNode()
boost::intrusive_ptr< VrmlMovieTexture > VrmlMovieTexturePtr
Definition: VrmlNodes.h:602
w
VRML TextureCoordinate node.
Definition: VrmlNodes.h:521
boost::intrusive_ptr< VrmlBillboard > VrmlBillboardPtr
Definition: VrmlNodes.h:720
boost::intrusive_ptr< VrmlPixelTexture > VrmlPixelTexturePtr
Definition: VrmlNodes.h:582
png_uint_32 i
Definition: png.h:2735
VrmlLODPtr readLODNode()
boost::intrusive_ptr< VrmlCone > VrmlConePtr
Definition: VrmlNodes.h:393
MFVec3f & mfVec3f()
Definition: VrmlNodes.h:841
void readSFColor(SFColor &out_value)
const list< string > * getAncestorPathsList() const
Definition: VrmlParser.cpp:406
void readMFColor(MFColor &out_value)
VrmlNodePtr evalProtoInstance(VrmlProtoInstancePtr proto, VrmlNodeCategory nodeCategory)
Definition: VrmlParser.cpp:970
VrmlTransformPtr readTransformNode()
void setProtoInstanceActualNodeExtractionMode(bool isOn)
Definition: VrmlParser.cpp:453
VrmlCoordinatePtr readCoordNode()
VrmlUnsupportedNodePtr skipUnsupportedNode(const std::string &nodeTypeName)
Definition: VrmlParser.cpp:684
SFString & sfString()
Definition: VrmlNodes.h:844
ProtoToEntityScannerMap protoToEntityScannerMap
Definition: VrmlParser.cpp:316
boost::intrusive_ptr< VrmlLOD > VrmlLODPtr
Definition: VrmlNodes.h:687
boost::intrusive_ptr< VrmlShape > VrmlShapePtr
Definition: VrmlNodes.h:292
VrmlIndexedLineSetPtr readIndexedLineSetNode()
boost::intrusive_ptr< VrmlFontStyle > VrmlFontStylePtr
Definition: VrmlNodes.h:437
VrmlNodePtr readNode()
Definition: VrmlParser.cpp:496
VRML Inline node.
Definition: VrmlNodes.h:268
boost::intrusive_ptr< VrmlSwitch > VrmlSwitchPtr
Definition: VrmlNodes.h:669
VRML Text node.
Definition: VrmlNodes.h:441
list< string > ancestorPathsList
Definition: VrmlParser.cpp:409
void readSFImage(SFImage &out_image)
read "SFImage" node
VrmlNodePtr readInlineNode(VrmlNodeCategory nodeCategory)
Definition: VrmlParser.cpp:745
VrmlElevationGridPtr readElevationGridNode()
VrmlFogPtr readFogNode()
void readMFString(MFString &out_value)
MFInt32 & mfInt32()
Definition: VrmlNodes.h:832
void readSFInt32(SFInt32 &out_value)
VrmlNodePtr readSpecificNode(VrmlNodeCategory nodeCategory, int symbol, const std::string &symbolString)
Definition: VrmlParser.cpp:604
std::string SFString
Definition: VrmlNodes.h:52
MFString & mfString()
Definition: VrmlNodes.h:845
void readSFString(SFString &out_value)
VrmlPixelTexturePtr readPixelTextureNode()
VRML IndexedLineSet node.
Definition: VrmlNodes.h:461
map< VrmlProto *, EasyScannerPtr > ProtoToEntityScannerMap
Definition: VrmlParser.cpp:315
VrmlNormalPtr readNormalNode()
VrmlTextureTransformPtr readTextureTransformNode()
MFVec2f & mfVec2f()
Definition: VrmlNodes.h:839
boost::intrusive_ptr< VrmlBox > VrmlBoxPtr
Definition: VrmlNodes.h:379
boost::intrusive_ptr< VrmlProto > VrmlProtoPtr
Definition: VrmlNodes.h:879
SFFloat SFTime
Definition: VrmlNodes.h:51
void readSFNode(SFNode &out_node, VrmlNodeCategory nodeCategory)
VrmlUnsupportedNodePtr skipExternProto()
Definition: VrmlParser.cpp:721
pair< string, VrmlProtoPtr > TProtoPair
Definition: VrmlParser.cpp:321
map< string, VrmlProtoPtr > TProtoMap
Definition: VrmlParser.cpp:320
VRML TextureTransform node.
Definition: VrmlNodes.h:354
boost::intrusive_ptr< VrmlCylinderSensor > VrmlCylinderSensorPtr
Definition: VrmlNodes.h:551
def j(str, encoding="cp932")
std::vector< SFRotation > MFRotation
Definition: VrmlNodes.h:74
boost::intrusive_ptr< VrmlIndexedLineSet > VrmlIndexedLineSetPtr
Definition: VrmlNodes.h:472
VrmlVariantField & readProtoField(VrmlFieldTypeId fieldTypeId)
VrmlTextureCoordinatePtr readTextureCoordinateNode()
VrmlNodeCategory
Definition: VrmlNodes.h:81
list index
void readSFVec3f(SFVec3f &out_value)
VRML Box node.
Definition: VrmlNodes.h:373
std::vector< SFVec3f > MFVec3f
Definition: VrmlNodes.h:72
map< string, VrmlNodePtr > TDefNodeMap
Definition: VrmlParser.cpp:318
void load(const std::string &filename)
Definition: VrmlParser.cpp:463
VRML Sphere node.
Definition: VrmlNodes.h:412
VrmlNodePtr readNode(VrmlNodeCategory nodeCategory)
Definition: VrmlParser.cpp:502
VrmlAppearancePtr readAppearanceNode()
void readMFNode(MFNode &out_nodes, VrmlNodeCategory nodeCategory)
VrmlConePtr readConeNode()
boost::array< SFFloat, 2 > SFVec2f
Definition: VrmlNodes.h:54
boost::intrusive_ptr< VrmlColor > VrmlColorPtr
Definition: VrmlNodes.h:454
boost::intrusive_ptr< VrmlAppearance > VrmlAppearancePtr
Definition: VrmlNodes.h:277
VRML Viewpoint node.
Definition: VrmlNodes.h:171
void setType(VrmlFieldTypeId typeId0)
This can be called once.
Definition: VrmlNodes.cpp:636
int SFInt32
Definition: VrmlNodes.h:49
self
VrmlDirectionalLightPtr readDirectionalLightNode()
VrmlProtoInstancePtr currentProtoInstance
Definition: VrmlParser.cpp:311
VRML Proto definition.
Definition: VrmlNodes.h:859
VrmlSwitchPtr readSwitchNode()
VrmlCollisionPtr readCollisionNode()
SFVec3f SFColor
Definition: VrmlNodes.h:58
pair< string, VrmlNodePtr > TDefNodePair
Definition: VrmlParser.cpp:319
VrmlWorldInfoPtr readWorldInfoNode()
SFRotation sfRotation
Definition: VrmlNodes.h:805
boost::intrusive_ptr< VrmlPointLight > VrmlPointLightPtr
Definition: VrmlNodes.h:759
int numComponents
Definition: VrmlNodes.h:64
void readSFTime(SFTime &out_value)
VRML node which is instance of VRML Prototype.
Definition: VrmlNodes.h:883
boost::intrusive_ptr< VrmlAnchor > VrmlAnchorPtr
Definition: VrmlNodes.h:710
VrmlBackgroundPtr readBackgroundNode()
boost::intrusive_ptr< VrmlSphere > VrmlSpherePtr
Definition: VrmlNodes.h:418
VrmlPointLightPtr readPointLightNode()
boost::intrusive_ptr< VrmlInline > VrmlInlinePtr
Definition: VrmlNodes.h:274
VrmlProtoInstancePtr readProtoInstanceNode(const std::string &proto_name, VrmlNodeCategory nodeCategory)
Definition: VrmlParser.cpp:920
void readSFFloat(SFFloat &out_value)
VrmlProtoPtr defineProto()
Definition: VrmlParser.cpp:817
std::vector< SFVec2f > MFVec2f
Definition: VrmlNodes.h:71
VrmlParser * self
Definition: VrmlParser.cpp:308
Base class of VRML Texture nodes.
Definition: VrmlNodes.h:333
void readMFRotation(MFRotation &out_value)
boost::intrusive_ptr< VrmlNode > VrmlNodePtr
Definition: VrmlNodes.h:155
id
VRML Cylinder node.
Definition: VrmlNodes.h:397
HRP_UTIL_EXPORT string deleteURLScheme(string url)
Definition: UrlUtil.cpp:25
VRML Appearance node.
Definition: VrmlNodes.h:306
VrmlAnchorPtr readAnchorNode()
boost::intrusive_ptr< VrmlWorldInfo > VrmlWorldInfoPtr
Definition: VrmlNodes.h:743
VrmlMaterialPtr readMaterialNode()
VrmlSpotLightPtr readSpotLightNode()
bool protoInstanceActualNodeExtractionMode
Definition: VrmlParser.cpp:313
boost::array< SFFloat, 3 > SFVec3f
Definition: VrmlNodes.h:55
boost::intrusive_ptr< VrmlExtrusion > VrmlExtrusionPtr
Definition: VrmlNodes.h:651
Parser for VRML97 format.
Definition: VrmlParser.h:30
SFVec4f SFRotation
Definition: VrmlNodes.h:59
boost::intrusive_ptr< VrmlSpotLight > VrmlSpotLightPtr
Definition: VrmlNodes.h:792
VRML CylinderSensor node.
Definition: VrmlNodes.h:539
boost::shared_ptr< EasyScanner > EasyScannerPtr
Definition: EasyScanner.h:280
std::vector< SFString > MFString
Definition: VrmlNodes.h:77
void readMFVec3f(MFVec3f &out_value)
boost::intrusive_ptr< VrmlDirectionalLight > VrmlDirectionalLightPtr
Definition: VrmlNodes.h:773
boost::intrusive_ptr< VrmlIndexedFaceSet > VrmlIndexedFaceSetPtr
Definition: VrmlNodes.h:498
void readSFVec2f(SFVec2f &out_value)
void readSFRotation(SFRotation &out_value)
VrmlTextPtr readTextNode()
void readMFFloat(MFFloat &out_value)
boost::intrusive_ptr< VrmlCoordinate > VrmlCoordinatePtr
Definition: VrmlNodes.h:457
VRML Transform node.
Definition: VrmlNodes.h:254
VrmlCylinderPtr readCylinderNode()
VRML PointSet node.
Definition: VrmlNodes.h:557
VrmlFieldTypeId typeId()
Definition: VrmlNodes.h:828
void load(const string &filename)
Definition: VrmlParser.cpp:469
HRP_UTIL_EXPORT bool isFileProtocol(const string &ref)
Definition: UrlUtil.cpp:105
boost::intrusive_ptr< VrmlCylinder > VrmlCylinderPtr
Definition: VrmlNodes.h:408
boost::intrusive_ptr< VrmlPointSet > VrmlPointSetPtr
Definition: VrmlNodes.h:566
VrmlCylinderSensorPtr readCylinderSensorNode()
void readMFTime(MFTime &out_value)
VrmlBoxPtr readBoxNode()
VRML ElevationGrid node.
Definition: VrmlNodes.h:608
VrmlParserImpl(VrmlParser *self)
Definition: VrmlParser.cpp:435
VRML PixelTexture node.
Definition: VrmlNodes.h:572
VrmlViewpointPtr readViewpointNode()
Definition: VrmlParser.cpp:996
TDefNodeMap defNodeMap
Definition: VrmlParser.cpp:324
boost::intrusive_ptr< VrmlViewpoint > VrmlViewpointPtr
Definition: VrmlNodes.h:182
std::vector< SFInt32 > MFInt32
Definition: VrmlNodes.h:69
boost::intrusive_ptr< VrmlFog > VrmlFogPtr
Definition: VrmlNodes.h:732
boost::intrusive_ptr< VrmlTextureCoordinate > VrmlTextureCoordinatePtr
Definition: VrmlNodes.h:478
void checkIndexedFaceSet(VrmlIndexedFaceSetPtr node)
VRML NavigationInfo node.
Definition: VrmlNodes.h:186
void readMFInt32(MFInt32 &out_value)
VRML MovieTexture node.
Definition: VrmlNodes.h:588
VrmlImageTexturePtr readImageTextureNode()
boost::intrusive_ptr< VrmlNormal > VrmlNormalPtr
Definition: VrmlNodes.h:475
VrmlNodePtr newInlineSource(std::string &io_filename)
Definition: VrmlParser.cpp:765
VrmlFieldTypeId
Definition: VrmlNodes.h:33
The header file of a text scanner class.
VrmlNodePtr SFNode
Definition: VrmlNodes.h:157
VrmlFontStylePtr readFontStyleNode()
boost::intrusive_ptr< VrmlMaterial > VrmlMaterialPtr
Definition: VrmlNodes.h:295
MFFloat & mfFloat()
Definition: VrmlNodes.h:834
std::vector< SFTime > MFTime
Definition: VrmlNodes.h:75
VrmlMovieTexturePtr readMovieTextureNode()
SFImage & sfImage()
Definition: VrmlNodes.h:850
VrmlExtrusionPtr readExtrusionNode()
VRML Normal node.
Definition: VrmlNodes.h:530
VRML Extrusion node.
Definition: VrmlNodes.h:634


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:26