1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGVRMLFILE_H_
40 #define _OSGVRMLFILE_H_
45 #include "OSGFileIODef.h"
51 #include "OSGBaseTypes.h"
52 #include "OSGScanParseSkel.h"
53 #include "OSGScanParseFieldTypeMapper.h"
56 #include "OSGFieldContainer.h"
58 #include "OSGVRMLPrototypeHandler.h"
62 /*! \ingroup GrpFileIOWRL
65 typedef VRMLNodePrototypeHandler
<
66 ScanParseFieldTypeMapper
<ScanParseSkel
> > Parent
;
68 /*! \brief VRML97 Loader (Geometry only)
70 \ingroup GrpLibOSGFileIO
73 class OSG_FILEIO_DLLMAPPING VRMLFile
: public Parent
75 /*========================= PROTECTED ===============================*/
79 typedef Parent Inherited
;
80 typedef VRMLFile Self
;
82 /*========================== PUBLIC =================================*/
88 CreateNormals
= Inherited::LastOption
<< 1,
89 StripeGeometry
= CreateNormals
<< 1,
90 LogProtoGeneration
= StripeGeometry
<< 1,
91 LogObjectGeneration
= LogProtoGeneration
<< 1,
92 PushNames
= LogObjectGeneration
<< 1,
94 LastOption
= PushNames
97 /*---------------------------------------------------------------------*/
98 /*! \name Constructors */
104 /*---------------------------------------------------------------------*/
105 /*! \name Destructor */
108 virtual ~VRMLFile(void);
111 /*---------------------------------------------------------------------*/
112 /*! \name Skel replacements */
115 virtual NodeTransitPtr
scanStream(std::istream
&iStream
);
118 /*---------------------------------------------------------------------*/
119 /*! \name Skel replacements */
122 virtual bool checkHeader ( void );
124 virtual void handleError (void *pSelf
, const Char8
*szErrorText
);
126 virtual void beginProto (const Char8
*szProtoname
);
127 virtual void endProtoInterface ( void);
128 virtual void endProto ( void);
130 virtual void beginFieldDecl(const Char8
*szFieldType
,
131 const UInt32 uiFieldTypeId
,
132 const Char8
*szFieldName
);
134 virtual void endFieldDecl (void );
136 virtual void beginNode (const Char8
*szNodeTypename
,
137 const Char8
*szNodename
,
138 const BitVector bvLocalFlags
);
140 virtual void endNode (void);
142 virtual void beginScript (const Char8
*szNodename
);
144 virtual void endScript (void);
147 virtual void beginField (const Char8
*szFieldname
,
148 const UInt32 uiFieldTypeId
);
150 virtual void endField (void);
153 virtual void addFieldValue(const Char8
*szFieldVal
);
155 virtual void addImageValue( Image
*pImage
);
158 virtual UInt32
getFieldType (const Char8
*szFieldname
);
161 virtual void use (const Char8
*szName
);
163 virtual void addRoute (const Char8
*szOutNodename
,
164 const Char8
*szOutFieldname
,
165 const Char8
*szInNodename
,
166 const Char8
*szInFieldname
);
169 /*---------------------------------------------------------------------*/
173 void scanStandardPrototypes (const Char8
*szFilename
);
175 void createStandardPrototypes(void);
178 /*========================= PROTECTED ===============================*/
181 typedef std::map
<std::string
, FieldContainerUnrecPtr
> NameContainerMap
;
183 /*---------------------------------------------------------------------*/
187 NodeUnrecPtr _pSceneRootNode
;
189 VRMLNodeHelper
* _pCurrNodeHelper
;
190 std::stack
<VRMLNodeHelper
*> _sNodeHelpers
;
192 FieldContainerUnrecPtr _pCurrentFC
;
193 FieldContainer
*_pCurrentFieldFC
;
194 EditFieldHandlePtr _pCurrentField
;
195 const FieldDescriptionBase
*_pCurrentFieldDesc
;
197 std::stack
< FieldContainerUnrecPtr
> _fcStack
;
198 std::stack
< EditFieldHandlePtr
> _fStack
;
199 std::stack
<const FieldDescriptionBase
*> _fdStack
;
201 NameContainerMap _nameFCMap
;
204 void initIntExtFieldTypeMapper(void);
205 void initExtIntFieldTypeMapper(void);
207 FieldContainer
*findFCByName (const Char8
*szName
,
210 FieldContainer
*findReference (const Char8
*szName
);
213 /*========================== PRIVATE ================================*/
216 /*!\brief prohibit default function (move to 'public' if needed) */
217 VRMLFile(const VRMLFile
&source
);
218 /*!\brief prohibit default function (move to 'public' if needed) */
219 void operator =(const VRMLFile
&source
);
224 #endif /* _OSGVRMLFILE_H_ */