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 _OSGVRMLNODEHELPER_H_
40 #define _OSGVRMLNODEHELPER_H_
45 #define OSG_VRML_IMAGETEXTURE_MAP
47 #include "OSGFileIODef.h"
48 #include "OSGAttachment.h"
49 #include "OSGDynamicAttachmentMixin.h"
50 #include "OSGSingletonHolder.h"
52 #include "OSGVecSFields.h"
53 #include "OSGVecMFields.h"
55 #include "OSGChunkMaterial.h"
56 #include "OSGMaterialChunk.h"
57 #include "OSGVRMLAttachment.h"
60 #include "OSGDeprecatedCPP.h"
67 //---------------------------------------------------------------------------
69 //---------------------------------------------------------------------------
71 /*! \ingroup GrpFileIOWRLObj
75 struct VRMLGenericAttDesc
77 typedef VRMLAttachment Parent
;
78 typedef VRMLAttachment
*ParentPtr
;
80 static const Char8
*getTypeName (void) { return "VRMLGenericAtt"; }
81 static const Char8
*getParentTypeName(void)
83 return "VRMLAttachment";
85 static const Char8
*getGroupName (void) { return "VRMLGenAtt"; }
88 static InitContainerF
getInitMethod(void) { return NULL
; }
90 static FieldDescriptionBase
**getDesc (void) { return NULL
; }
93 /*! \ingroup GrpFileIOWRLObj
96 typedef DynFieldAttachment
<VRMLGenericAttDesc
> VRMLGenericAtt
;
98 /*! \ingroup GrpFileIOWRLObj
100 typedef VRMLGenericAtt::ObjUnrecPtr VRMLGenericAttUnrecPtr
;
104 //---------------------------------------------------------------------------
106 //---------------------------------------------------------------------------
108 /*! \brief General VRML Node Desc
109 \ingroup GrpFileIOWRLObj
113 class OSG_FILEIO_DLLMAPPING VRMLNodeHelperFactoryBase
115 /*========================== PUBLIC =================================*/
119 typedef boost::function
<VRMLNodeHelper
*(void)> CreateHelper
;
123 class OSG_FILEIO_DLLMAPPING RegisterHelper
127 RegisterHelper( CreateHelper fCreate
,
128 const Char8
*szNodeName
,
129 InitFuncF fStaticInit
);
132 /*---------------------------------------------------------------------*/
133 /*! \name Class Get */
137 /*---------------------------------------------------------------------*/
143 /*---------------------------------------------------------------------*/
147 void registerNodeHelper( CreateHelper fHelper
,
148 const Char8
*szNodeName
);
151 /*---------------------------------------------------------------------*/
152 /*! \name Prototypes */
155 VRMLNodeHelper
*createHelper(const Char8
*szNodeName
);
158 /*---------------------------------------------------------------------*/
163 /*---------------------------------------------------------------------*/
164 /*! \name FieldValue */
169 /*---------------------------------------------------------------------*/
174 /*========================= PROTECTED ===============================*/
178 template <class SingletonT
>
179 friend class SingletonHolder
;
181 #ifdef OSG_STL_HAS_HASH_MAP
182 #ifdef OSG_USE_HASH_COMPARE
184 OSG_STDEXTENSION_NAMESPACE::hash_map
<
187 HashCmpString
> NameHelperCreateMap
;
191 OSG_STDEXTENSION_NAMESPACE::hash_map
<
194 OSG_STDEXTENSION_NAMESPACE::hash
<
196 EQString
> NameHelperCreateMap
;
200 std::map
<const Char8
*,
202 LTString
> NameHelperCreateMap
;
207 /*---------------------------------------------------------------------*/
208 /*! \name Constructors */
211 VRMLNodeHelperFactoryBase(void);
214 /*---------------------------------------------------------------------*/
215 /*! \name Destructor */
218 virtual ~VRMLNodeHelperFactoryBase(void);
221 /*---------------------------------------------------------------------*/
226 /*---------------------------------------------------------------------*/
231 NameHelperCreateMap _mRegisteredNodeHelperHash
;
234 /*========================== PRIVATE ================================*/
238 /*!\brief prohibit default function (move to 'public' if needed) */
239 VRMLNodeHelperFactoryBase(const VRMLNodeHelperFactoryBase
&source
);
240 /*!\brief prohibit default function (move to 'public' if needed) */
241 void operator =(const VRMLNodeHelperFactoryBase
&source
);
245 OSG_FILEIO_EXPIMP_TMPL
246 template class OSG_FILEIO_DLLMAPPING SingletonHolder
<VRMLNodeHelperFactoryBase
>;
249 /*! \ingroup GrpFileIOWRLObj
252 typedef SingletonHolder
<VRMLNodeHelperFactoryBase
> VRMLNodeHelperFactory
;
254 //---------------------------------------------------------------------------
256 //---------------------------------------------------------------------------
258 /*! \brief General VRML Node Desc
259 \ingroup GrpFileIOWRLObj
262 This is a helper that knows how to load and handle construction of a single
263 VRML node type. This class will have one derived class for all node
264 types that can be handled by the loader.
267 class OSG_FILEIO_DLLMAPPING VRMLNodeHelper
269 /*========================== PUBLIC =================================*/
273 /*---------------------------------------------------------------------*/
274 /*! \name Class Get */
277 static UInt32
getIndent (void);
278 static void incIndent (void);
279 static void decIndent (void);
280 static void resetIndent(void);
283 /*---------------------------------------------------------------------*/
284 /*! \name Destructor */
287 virtual ~VRMLNodeHelper(void);
290 /*---------------------------------------------------------------------*/
297 /*---------------------------------------------------------------------*/
302 FieldContainerTransitPtr
beginNode(const Char8
*szTypename
,
304 FieldContainer
*pCurrentFC
);
307 void endNode ( FieldContainer
* );
310 /*---------------------------------------------------------------------*/
314 virtual void mapFieldname(const std::string
&szVRMLNodeName
,
315 std::string
&szFieldName
);
318 /*---------------------------------------------------------------------*/
319 /*! \name Prototypes */
322 virtual void init(const Char8
*szName
);
325 /*---------------------------------------------------------------------*/
329 virtual bool prototypeAddField (const Char8
*szFieldType
,
330 const UInt32 uiFieldTypeId
,
331 const Char8
*szFieldName
);
333 virtual void endProtoInterface (void);
336 /*---------------------------------------------------------------------*/
337 /*! \name FieldValue */
340 virtual void getFieldAndDesc( FieldContainer
*pFC
,
341 const Char8
* szFieldname
,
342 FieldContainer
*&pFieldFC
,
343 EditFieldHandlePtr
&pField
,
344 const FieldDescriptionBase
*&pDesc
);
347 /*---------------------------------------------------------------------*/
352 void addFieldValue ( EditFieldHandlePtr pField
,
353 const FieldDescriptionBase
*pFieldDesc
,
354 const Char8
*szFieldVal
);
357 void addImageValue ( EditFieldHandlePtr pField
,
358 const FieldDescriptionBase
*pFieldDesc
,
362 void setContainerFieldValue( FieldContainer
*pFC
,
363 const FieldDescriptionBase
*pFieldDesc
,
364 FieldContainer
*pFieldFC
);
367 /*========================= PROTECTED ===============================*/
371 /*---------------------------------------------------------------------*/
372 /*! \name Constructors */
375 VRMLNodeHelper(void);
378 /*---------------------------------------------------------------------*/
382 static UInt32 _uiIndent
;
385 /*---------------------------------------------------------------------*/
389 bool _bProtoInterfaceDone
;
391 VRMLGenericAttUnrecPtr _pGenAttProto
;
392 FieldContainerUnrecPtr _pNodeProto
;
393 FieldContainerUnrecPtr _pNodeCoreProto
;
396 /*---------------------------------------------------------------------*/
400 SFVec3f ::Description _sfVec3fDesc
;
401 SFUnrecFieldContainerPtr::Description _sfFCPtrDesc
;
402 SFUnrecImagePtr ::Description _sfImagePtrDesc
;
403 SFReal32 ::Description _sfReal32Desc
;
404 SFColor3f ::Description _sfColor3fDesc
;
405 MFString ::Description _mfStringDesc
;
406 SFBool ::Description _sfBoolDesc
;
409 /*---------------------------------------------------------------------*/
413 GetFieldHandlePtr
getField( FieldContainer
*pFC1
,
414 FieldContainer
*pFC2
,
415 VRMLGenericAtt
* pGenAtt
,
416 const Char8
*szFieldname
);
418 void getField(const Char8
*szFieldname
,
419 FieldContainer
*&pFieldFC
,
420 EditFieldHandlePtr
&pField
,
421 const FieldDescriptionBase
*&pDesc
);
423 FieldDescriptionBase
*getFieldDescription(const Char8
*szFieldName
,
424 const UInt32 uiFieldTypeId
);
427 /*========================== PRIVATE ================================*/
431 /*!\brief prohibit default function (move to 'public' if needed) */
432 VRMLNodeHelper(const VRMLNodeHelper
&source
);
433 /*!\brief prohibit default function (move to 'public' if needed) */
434 void operator =(const VRMLNodeHelper
&source
);
441 //---------------------------------------------------------------------------
443 //---------------------------------------------------------------------------
445 /*! \brief VRML Group Helper
446 \ingroup GrpFileIOWRLObj
450 class OSG_FILEIO_DLLMAPPING VRMLDefaultHelper
: public VRMLNodeHelper
452 /*========================== PUBLIC =================================*/
455 /*---------------------------------------------------------------------*/
456 /*! \name Destructor */
459 static VRMLNodeHelper
*create(void);
462 /*---------------------------------------------------------------------*/
463 /*! \name Destructor */
466 virtual ~VRMLDefaultHelper(void);
469 /*---------------------------------------------------------------------*/
473 virtual void init(const Char8
*szName
);
476 /*---------------------------------------------------------------------*/
481 FieldContainerTransitPtr
beginNode(const Char8
*szTypename
,
483 FieldContainer
*pCurrentFC
);
486 /*---------------------------------------------------------------------*/
491 /*---------------------------------------------------------------------*/
495 virtual void dump(const Char8
*szNodeName
);
498 /*========================= PROTECTED ===============================*/
502 /*---------------------------------------------------------------------*/
503 /*! \name Constructors */
506 VRMLDefaultHelper(void);
509 /*---------------------------------------------------------------------*/
514 /*---------------------------------------------------------------------*/
519 /*========================== PRIVATE ================================*/
523 typedef VRMLNodeHelper Inherited
;
525 /*!\brief prohibit default function (move to 'public' if needed) */
526 VRMLDefaultHelper(const VRMLDefaultHelper
&source
);
527 /*!\brief prohibit default function (move to 'public' if needed) */
528 void operator =(const VRMLDefaultHelper
&source
);
533 //---------------------------------------------------------------------------
535 //---------------------------------------------------------------------------
537 /*! \brief VRML Group Helper
538 \ingroup GrpFileIOWRLObj
542 template<class ContainerT
>
543 class VRMLGenericHelper
: public VRMLNodeHelper
545 /*========================== PUBLIC =================================*/
549 /*---------------------------------------------------------------------*/
550 /*! \name Destructor */
553 static VRMLNodeHelper
*create(void);
556 /*---------------------------------------------------------------------*/
557 /*! \name Destructor */
560 virtual ~VRMLGenericHelper(void);
563 /*---------------------------------------------------------------------*/
567 virtual void init(const Char8
*szName
);
570 /*---------------------------------------------------------------------*/
574 static bool initStatic(void);
577 /*---------------------------------------------------------------------*/
581 virtual void mapFieldname(const std::string
&szVRMLNodeName
,
582 std::string
&szFieldName
);
585 /*---------------------------------------------------------------------*/
589 virtual bool prototypeAddField(const Char8
*szFieldType
,
590 const UInt32 uiFieldTypeId
,
591 const Char8
*szFieldName
);
593 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
594 const Char8
* szFieldname
,
595 FieldContainer
*&pFieldFC
,
596 EditFieldHandlePtr
&pField
,
597 const FieldDescriptionBase
*&pDesc
);
599 /*---------------------------------------------------------------------*/
603 virtual void dump(const Char8
*szNodeName
);
606 /*========================= PROTECTED ===============================*/
611 typedef std::map
<std::string
,
612 std::string
> FieldNameMap
;
614 typedef FieldNameMap::const_iterator FieldNameMapConstIt
;
616 static FieldNameMap _mFieldNameMap
;
618 /*---------------------------------------------------------------------*/
619 /*! \name Constructors */
622 VRMLGenericHelper(void);
625 /*---------------------------------------------------------------------*/
630 /*---------------------------------------------------------------------*/
634 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelper
;
637 /*========================== PRIVATE ================================*/
641 typedef VRMLNodeHelper Inherited
;
643 /*!\brief prohibit default function (move to 'public' if needed) */
644 VRMLGenericHelper(const VRMLGenericHelper
&source
);
645 /*!\brief prohibit default function (move to 'public' if needed) */
646 void operator =(const VRMLGenericHelper
&source
);
649 #define OSG_INST_GENERICVRMLHELPER(OSGNODE) \
652 VRMLGenericHelper< OSGNODE >::FieldNameMap \
653 VRMLGenericHelper< OSGNODE >::_mFieldNameMap = \
654 VRMLGenericHelper< OSGNODE >::FieldNameMap(); \
656 template class VRMLGenericHelper< OSGNODE >
658 //---------------------------------------------------------------------------
660 //---------------------------------------------------------------------------
662 /*! \brief VRML Material Desc
663 \ingroup GrpFileIOWRLObj
667 class OSG_FILEIO_DLLMAPPING VRMLMaterialHelper
: public VRMLNodeHelper
669 /*========================== PUBLIC =================================*/
672 /*---------------------------------------------------------------------*/
673 /*! \name Destructor */
676 virtual ~VRMLMaterialHelper(void);
679 /*---------------------------------------------------------------------*/
683 virtual void init (const Char8
*szName
);
685 virtual void reset ( void);
687 virtual Material
*getDefaultMaterial( void);
690 /*---------------------------------------------------------------------*/
694 virtual bool prototypeAddField(const Char8
* szFieldType
,
695 const UInt32 uiFieldTypeId
,
696 const Char8
* szFieldName
);
698 virtual void endProtoInterface( void);
700 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
701 const Char8
* szFieldname
,
702 FieldContainer
*&pFieldFC
,
703 EditFieldHandlePtr
&pField
,
704 const FieldDescriptionBase
*&pDesc
);
707 /*---------------------------------------------------------------------*/
712 FieldContainerTransitPtr
beginNode(const Char8
*szTypename
,
714 FieldContainer
*pCurrentFC
);
717 void endNode ( FieldContainer
* );
720 /*---------------------------------------------------------------------*/
721 /*! \name Type Specific */
724 const std::string
&getName(void) const;
727 /*---------------------------------------------------------------------*/
731 virtual void dump(const Char8
*szNodeName
);
734 /*========================= PROTECTED ===============================*/
738 /*---------------------------------------------------------------------*/
739 /*! \name Destructor */
742 static VRMLNodeHelper
*create(void);
745 /*---------------------------------------------------------------------*/
746 /*! \name Constructors */
749 VRMLMaterialHelper(void);
752 /*---------------------------------------------------------------------*/
756 SFReal32 _defaultAmbientIntensity
;
757 SFColor3f _defaultDiffuseColor
;
758 SFColor3f _defaultEmissiveColor
;
759 SFReal32 _defaultShininess
;
760 SFColor3f _defaultSpecularColor
;
761 SFReal32 _defaultTransparency
;
763 SFReal32 _ambientIntensity
;
764 SFColor3f _diffuseColor
;
765 SFColor3f _emissiveColor
;
767 SFColor3f _specularColor
;
768 SFReal32 _transparency
;
770 ChunkMaterialUnrecPtr _pDefMat
;
771 MaterialChunkUnrecPtr _pMat
;
776 /*---------------------------------------------------------------------*/
780 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelper
;
783 /*========================== PRIVATE ================================*/
787 typedef VRMLNodeHelper Inherited
;
789 /*!\brief prohibit default function (move to 'public' if needed) */
790 VRMLMaterialHelper(const VRMLMaterialHelper
&source
);
791 /*!\brief prohibit default function (move to 'public' if needed) */
792 void operator =(const VRMLMaterialHelper
&source
);
798 //---------------------------------------------------------------------------
800 //---------------------------------------------------------------------------
802 /*! \brief VRML Shape Helper
803 \ingroup GrpFileIOWRLObj
807 class OSG_FILEIO_DLLMAPPING VRMLShapeHelper
: public VRMLNodeHelper
809 /*========================== PUBLIC =================================*/
813 /*---------------------------------------------------------------------*/
814 /*! \name Destructor */
817 virtual ~VRMLShapeHelper(void);
820 /*---------------------------------------------------------------------*/
824 virtual void init (const Char8
*szName
);
826 void setMaterialHelper( VRMLMaterialHelper
*pMaterialHelper
);
829 /*---------------------------------------------------------------------*/
833 virtual bool prototypeAddField(const Char8
*szFieldType
,
834 const UInt32 uiFieldTypeId
,
835 const Char8
*szFieldName
);
837 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
838 const Char8
* szFieldname
,
839 FieldContainer
*&pFieldFC
,
840 EditFieldHandlePtr
&pField
,
841 const FieldDescriptionBase
*&pDesc
);
845 /*---------------------------------------------------------------------*/
849 virtual void endNode(FieldContainer
*pFC
);
852 /*---------------------------------------------------------------------*/
856 virtual void dump(const Char8
*szNodeName
);
859 /*========================= PROTECTED ===============================*/
863 /*---------------------------------------------------------------------*/
864 /*! \name Destructor */
867 static VRMLNodeHelper
*create(void);
870 /*---------------------------------------------------------------------*/
871 /*! \name Constructors */
874 VRMLShapeHelper(void);
877 /*---------------------------------------------------------------------*/
881 VRMLMaterialHelper
*_pMaterialHelper
;
884 /*---------------------------------------------------------------------*/
888 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelper
;
891 /*========================== PRIVATE ================================*/
895 typedef VRMLNodeHelper Inherited
;
897 /*!\brief prohibit default function (move to 'public' if needed) */
898 VRMLShapeHelper(const VRMLShapeHelper
&source
);
899 /*!\brief prohibit default function (move to 'public' if needed) */
900 void operator =(const VRMLShapeHelper
&source
);
907 //---------------------------------------------------------------------------
909 //---------------------------------------------------------------------------
911 /*! \brief VRML Appearance Helper
912 \ingroup GrpFileIOWRLObj
916 class OSG_FILEIO_DLLMAPPING VRMLAppearanceHelper
: public VRMLNodeHelper
918 /*========================== PUBLIC =================================*/
922 /*---------------------------------------------------------------------*/
923 /*! \name Destructor */
926 virtual ~VRMLAppearanceHelper(void);
929 /*---------------------------------------------------------------------*/
933 virtual void init (const Char8
*szName
);
935 virtual void setMaterialHelper( VRMLMaterialHelper
*pMaterialDesc
);
938 /*---------------------------------------------------------------------*/
942 virtual bool prototypeAddField(const Char8
* szFieldType
,
943 const UInt32 uiFieldTypeId
,
944 const Char8
* szFieldName
);
946 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
947 const Char8
* szFieldname
,
948 FieldContainer
*&pFieldFC
,
949 EditFieldHandlePtr
&pField
,
950 const FieldDescriptionBase
*&pDesc
);
953 /*---------------------------------------------------------------------*/
957 virtual void endNode(FieldContainer
*);
960 /*---------------------------------------------------------------------*/
961 /*! \name Field Value */
965 /*---------------------------------------------------------------------*/
969 virtual void dump(const Char8
*szNodeName
);
972 /*========================= PROTECTED ===============================*/
976 /*---------------------------------------------------------------------*/
977 /*! \name Destructor */
980 static VRMLNodeHelper
*create(void);
983 /*---------------------------------------------------------------------*/
984 /*! \name Constructors */
987 VRMLAppearanceHelper(void);
990 /*---------------------------------------------------------------------*/
994 VRMLMaterialHelper
*_pMaterialHelper
;
997 /*---------------------------------------------------------------------*/
1001 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelper
;
1004 /*========================== PRIVATE ================================*/
1008 typedef VRMLNodeHelper Inherited
;
1010 /*!\brief prohibit default function (move to 'public' if needed) */
1011 VRMLAppearanceHelper(const VRMLAppearanceHelper
&source
);
1012 /*!\brief prohibit default function (move to 'public' if needed) */
1013 void operator =(const VRMLAppearanceHelper
&source
);
1019 //---------------------------------------------------------------------------
1021 //---------------------------------------------------------------------------
1023 /*! \brief VRML Indexed Geometry Help
1024 \ingroup GrpFileIOWRLObj
1028 class OSG_FILEIO_DLLMAPPING VRMLIndexedGeometryHelper
:
1029 public VRMLNodeHelper
1031 /*========================== PUBLIC =================================*/
1035 /*---------------------------------------------------------------------*/
1036 /*! \name Destructor */
1039 virtual ~VRMLIndexedGeometryHelper(void);
1042 /*---------------------------------------------------------------------*/
1046 virtual void init(const Char8
*szName
);
1049 /*---------------------------------------------------------------------*/
1053 virtual bool prototypeAddField(const Char8
* szFieldType
,
1054 const UInt32 uiFieldTypeId
,
1055 const Char8
* szFieldName
);
1057 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
1058 const Char8
* szFieldname
,
1059 FieldContainer
*&pFieldFC
,
1060 EditFieldHandlePtr
&pField
,
1061 const FieldDescriptionBase
*&pDesc
);
1064 /*---------------------------------------------------------------------*/
1068 virtual void endNode(FieldContainer
*pFC
);
1071 /*---------------------------------------------------------------------*/
1072 /*! \name Field Value */
1076 void setContainerFieldValue( FieldContainer
*pFC
,
1077 const FieldDescriptionBase
*pFieldDesc
,
1078 FieldContainer
*pFieldFC
);
1081 /*---------------------------------------------------------------------*/
1085 virtual void dump(const Char8
*szNodeName
);
1088 /*========================= PROTECTED ===============================*/
1092 /*---------------------------------------------------------------------*/
1093 /*! \name Destructor */
1096 static VRMLNodeHelper
*create(void);
1099 /*---------------------------------------------------------------------*/
1100 /*! \name Constructors */
1103 VRMLIndexedGeometryHelper(void);
1106 /*---------------------------------------------------------------------*/
1111 UInt16 _uiPropertyIndex
;
1114 /*---------------------------------------------------------------------*/
1118 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperIFS
;
1119 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperILS
;
1122 /*========================== PRIVATE ================================*/
1126 typedef VRMLNodeHelper Inherited
;
1128 /*!\brief prohibit default function (move to 'public' if needed) */
1129 VRMLIndexedGeometryHelper(const VRMLIndexedGeometryHelper
&source
);
1130 /*!\brief prohibit default function (move to 'public' if needed) */
1131 void operator =(const VRMLIndexedGeometryHelper
&source
);
1136 //---------------------------------------------------------------------------
1138 //---------------------------------------------------------------------------
1140 /*! \brief VRML PointSet Geometry Help
1141 \ingroup GrpFileIOWRLObj
1145 class OSG_FILEIO_DLLMAPPING VRMLPointSetGeometryHelper
:
1146 public VRMLNodeHelper
1148 /*========================== PUBLIC =================================*/
1152 /*---------------------------------------------------------------------*/
1153 /*! \name Destructor */
1156 virtual ~VRMLPointSetGeometryHelper(void);
1159 /*---------------------------------------------------------------------*/
1163 virtual void init(const Char8
*szName
);
1166 /*---------------------------------------------------------------------*/
1170 virtual bool prototypeAddField(const Char8
* szFieldType
,
1171 const UInt32 uiFieldTypeId
,
1172 const Char8
* szFieldName
);
1174 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
1175 const Char8
* szFieldname
,
1176 FieldContainer
*&pFieldFC
,
1177 EditFieldHandlePtr
&pField
,
1178 const FieldDescriptionBase
*&pDesc
);
1181 /*---------------------------------------------------------------------*/
1185 virtual void endNode(FieldContainer
*pFC
);
1188 /*---------------------------------------------------------------------*/
1189 /*! \name Field Value */
1193 void setContainerFieldValue( FieldContainer
*pFC
,
1194 const FieldDescriptionBase
*pFieldDesc
,
1195 FieldContainer
*pFieldFC
);
1198 /*---------------------------------------------------------------------*/
1202 virtual void dump(const Char8
*szNodeName
);
1205 /*========================= PROTECTED ===============================*/
1209 /*---------------------------------------------------------------------*/
1210 /*! \name Destructor */
1213 static VRMLNodeHelper
*create(void);
1216 /*---------------------------------------------------------------------*/
1217 /*! \name Constructors */
1220 VRMLPointSetGeometryHelper(void);
1223 /*---------------------------------------------------------------------*/
1227 UInt16 _uiPropertyIndex
;
1230 /*---------------------------------------------------------------------*/
1234 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperPS
;
1237 /*========================== PRIVATE ================================*/
1241 typedef VRMLNodeHelper Inherited
;
1243 /*!\brief prohibit default function (move to 'public' if needed) */
1244 VRMLPointSetGeometryHelper(const VRMLPointSetGeometryHelper
&source
);
1245 /*!\brief prohibit default function (move to 'public' if needed) */
1246 void operator =(const VRMLPointSetGeometryHelper
&source
);
1251 //---------------------------------------------------------------------------
1253 //---------------------------------------------------------------------------
1255 /*! \brief VRML Gemetry Part Helper
1256 \ingroup GrpFileIOWRLObj
1260 class OSG_FILEIO_DLLMAPPING VRMLGeometryPartHelper
: public VRMLNodeHelper
1262 /*========================== PUBLIC =================================*/
1266 /*---------------------------------------------------------------------*/
1267 /*! \name Destructor */
1270 virtual ~VRMLGeometryPartHelper(void);
1273 /*---------------------------------------------------------------------*/
1277 virtual void init(const Char8
*szName
);
1280 /*---------------------------------------------------------------------*/
1284 virtual bool prototypeAddField(const Char8
* szFieldType
,
1285 const UInt32 uiFieldTypeId
,
1286 const Char8
* szFieldName
);
1288 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
1289 const Char8
* szFieldname
,
1290 FieldContainer
*&pFieldFC
,
1291 EditFieldHandlePtr
&pField
,
1292 const FieldDescriptionBase
*&pDesc
);
1295 /*---------------------------------------------------------------------*/
1299 virtual void mapFieldname(const std::string
&szVRMLNodeName
,
1300 std::string
&szFieldName
);
1303 /*---------------------------------------------------------------------*/
1307 virtual void dump(const Char8
*szNodeName
);
1310 /*========================= PROTECTED ===============================*/
1314 /*---------------------------------------------------------------------*/
1315 /*! \name Destructor */
1318 static VRMLNodeHelper
*create(void);
1321 /*---------------------------------------------------------------------*/
1322 /*! \name Constructors */
1325 VRMLGeometryPartHelper(void);
1328 /*---------------------------------------------------------------------*/
1332 std::string _szVRMLPartname
;
1333 std::string _szOSGPartname
;
1334 std::string _szOSGProtoname
;
1337 /*---------------------------------------------------------------------*/
1341 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperCoordinate
;
1342 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperNormal
;
1343 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperColor
;
1344 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperTexCoordinate
;
1347 /*========================== PRIVATE ================================*/
1351 typedef VRMLNodeHelper Inherited
;
1353 /*!\brief prohibit default function (move to 'public' if needed) */
1354 VRMLGeometryPartHelper(const VRMLGeometryPartHelper
&source
);
1355 /*!\brief prohibit default function (move to 'public' if needed) */
1356 void operator =(const VRMLGeometryPartHelper
&source
);
1360 //---------------------------------------------------------------------------
1362 //---------------------------------------------------------------------------
1364 /*! \brief VRML Gemetry Object Desc
1365 \ingroup GrpFileIOWRLObj
1369 class OSG_FILEIO_DLLMAPPING VRMLGeometryObjectHelper
: public VRMLNodeHelper
1371 /*========================== PUBLIC =================================*/
1374 /*---------------------------------------------------------------------*/
1375 /*! \name Destructor */
1378 virtual ~VRMLGeometryObjectHelper(void);
1381 /*---------------------------------------------------------------------*/
1385 virtual void init(const Char8
*szName
);
1388 /*---------------------------------------------------------------------*/
1393 /*---------------------------------------------------------------------*/
1397 virtual void endNode(FieldContainer
*);
1400 /*---------------------------------------------------------------------*/
1404 virtual void dump(const Char8
*szNodeName
);
1407 /*========================= PROTECTED ===============================*/
1413 UnknownGeo
= 0x0000,
1417 CylinderGeo
= 0x0004,
1422 /*---------------------------------------------------------------------*/
1423 /*! \name Constructors */
1426 VRMLGeometryObjectHelper(void);
1429 /*---------------------------------------------------------------------*/
1430 /*! \name Constructors */
1433 static VRMLNodeHelper
*create(void);
1436 /*---------------------------------------------------------------------*/
1440 GeoObjectType _eVRMLObjectType
;
1443 /*---------------------------------------------------------------------*/
1447 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperSphere
;
1448 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperBox
;
1449 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperCone
;
1450 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperCylinder
;
1451 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperTeapot
;
1452 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelperPlane
;
1455 /*========================== PRIVATE ================================*/
1459 typedef VRMLNodeHelper Inherited
;
1461 /*!\brief prohibit default function (move to 'public' if needed) */
1462 VRMLGeometryObjectHelper(const VRMLGeometryObjectHelper
&source
);
1463 /*!\brief prohibit default function (move to 'public' if needed) */
1464 void operator =(const VRMLGeometryObjectHelper
&source
);
1468 //---------------------------------------------------------------------------
1470 //---------------------------------------------------------------------------
1472 /*! \brief VRML Texture Helper
1473 \ingroup GrpFileIOWRLObj
1477 class OSG_FILEIO_DLLMAPPING VRMLTextureHelper
: public VRMLNodeHelper
1479 /*========================== PUBLIC =================================*/
1482 /*---------------------------------------------------------------------*/
1483 /*! \name Destructor */
1486 virtual ~VRMLTextureHelper(void);
1489 /*---------------------------------------------------------------------*/
1494 /*---------------------------------------------------------------------*/
1498 virtual bool prototypeAddField(const Char8
* szFieldType
,
1499 const UInt32 uiFieldTypeId
,
1500 const Char8
* szFieldName
);
1502 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
1503 const Char8
* szFieldname
,
1504 FieldContainer
*&pFieldFC
,
1505 EditFieldHandlePtr
&pField
,
1506 const FieldDescriptionBase
*&pDesc
);
1509 /*---------------------------------------------------------------------*/
1514 FieldContainerTransitPtr
beginNode(const Char8
*szTypename
,
1515 const Char8
*szName
,
1516 FieldContainer
*pCurrentFC
);
1519 void endNode ( FieldContainer
* );
1522 /*---------------------------------------------------------------------*/
1526 virtual void dump(const Char8
*szNodeName
);
1529 /*========================= PROTECTED ===============================*/
1533 /*---------------------------------------------------------------------*/
1534 /*! \name Destructor */
1538 /*---------------------------------------------------------------------*/
1539 /*! \name Constructors */
1542 VRMLTextureHelper(void);
1545 /*---------------------------------------------------------------------*/
1549 SFBool _defaultRepeatS
;
1550 SFBool _defaultRepeatT
;
1556 /*---------------------------------------------------------------------*/
1561 /*========================== PRIVATE ================================*/
1564 typedef VRMLNodeHelper Inherited
;
1566 /*!\brief prohibit default function (move to 'public' if needed) */
1567 VRMLTextureHelper(const VRMLTextureHelper
&source
);
1568 /*!\brief prohibit default function (move to 'public' if needed) */
1569 void operator =(const VRMLTextureHelper
&source
);
1573 //---------------------------------------------------------------------------
1575 //---------------------------------------------------------------------------
1577 /*! \brief VRML Image Texture Helper
1578 \ingroup GrpFileIOWRLObj
1582 class OSG_FILEIO_DLLMAPPING VRMLImageTextureHelper
: public VRMLTextureHelper
1584 /*========================== PUBLIC =================================*/
1587 /*---------------------------------------------------------------------*/
1588 /*! \name Destructor */
1591 virtual ~VRMLImageTextureHelper(void);
1594 /*---------------------------------------------------------------------*/
1599 /*---------------------------------------------------------------------*/
1603 virtual bool prototypeAddField(const Char8
* szFieldType
,
1604 const UInt32 uiFieldTypeId
,
1605 const Char8
* szFieldName
);
1607 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
1608 const Char8
* szFieldname
,
1609 FieldContainer
*&pFieldFC
,
1610 EditFieldHandlePtr
&pField
,
1611 const FieldDescriptionBase
*&pDesc
);
1614 /*---------------------------------------------------------------------*/
1619 FieldContainerTransitPtr
beginNode(const Char8
*szTypename
,
1620 const Char8
*szName
,
1621 FieldContainer
*pCurrentFC
);
1624 void endNode ( FieldContainer
* );
1627 /*---------------------------------------------------------------------*/
1631 virtual void dump(const Char8
*szNodeName
);
1634 /*========================= PROTECTED ===============================*/
1638 typedef std::map
<std::string
, Image
*> UrlImageMap
;
1640 /*---------------------------------------------------------------------*/
1641 /*! \name Destructor */
1644 static VRMLNodeHelper
*create(void);
1647 /*---------------------------------------------------------------------*/
1648 /*! \name Constructors */
1651 VRMLImageTextureHelper(void);
1654 /*---------------------------------------------------------------------*/
1658 MFString _defaultURL
;
1662 #ifdef OSG_VRML_IMAGETEXTURE_MAP
1663 UrlImageMap _urlImageMap
;
1667 /*---------------------------------------------------------------------*/
1671 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelper
;
1674 /*========================== PRIVATE ================================*/
1677 typedef VRMLTextureHelper Inherited
;
1679 /*!\brief prohibit default function (move to 'public' if needed) */
1680 VRMLImageTextureHelper(const VRMLImageTextureHelper
&source
);
1681 /*!\brief prohibit default function (move to 'public' if needed) */
1682 void operator =(const VRMLImageTextureHelper
&source
);
1687 //---------------------------------------------------------------------------
1689 //---------------------------------------------------------------------------
1691 /*! \brief VRML Image Texture Helper
1692 \ingroup GrpFileIOWRLObj
1696 class OSG_FILEIO_DLLMAPPING VRMLPixelTextureHelper
: public VRMLTextureHelper
1698 /*========================== PUBLIC =================================*/
1701 /*---------------------------------------------------------------------*/
1702 /*! \name Destructor */
1705 virtual ~VRMLPixelTextureHelper(void);
1708 /*---------------------------------------------------------------------*/
1713 void addImageValue( EditFieldHandlePtr pField
,
1714 const FieldDescriptionBase
*pFieldDesc
,
1718 /*---------------------------------------------------------------------*/
1722 virtual bool prototypeAddField(const Char8
* szFieldType
,
1723 const UInt32 uiFieldTypeId
,
1724 const Char8
* szFieldName
);
1726 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
1727 const Char8
* szFieldname
,
1728 FieldContainer
*&pFieldFC
,
1729 EditFieldHandlePtr
&pField
,
1730 const FieldDescriptionBase
*&pDesc
);
1733 /*---------------------------------------------------------------------*/
1738 FieldContainerTransitPtr
beginNode(const Char8
*szTypename
,
1739 const Char8
*szName
,
1740 FieldContainer
*pCurrentFC
);
1743 void endNode ( FieldContainer
* );
1746 /*---------------------------------------------------------------------*/
1750 virtual void dump(const Char8
*szNodeName
);
1753 /*========================= PROTECTED ===============================*/
1757 /*---------------------------------------------------------------------*/
1758 /*! \name Destructor */
1761 static VRMLNodeHelper
*create(void);
1764 /*---------------------------------------------------------------------*/
1765 /*! \name Constructors */
1768 VRMLPixelTextureHelper(void);
1771 /*---------------------------------------------------------------------*/
1775 ImageUnrecPtr _pImage
;
1778 /*---------------------------------------------------------------------*/
1782 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelper
;
1785 /*========================== PRIVATE ================================*/
1788 typedef VRMLTextureHelper Inherited
;
1790 /*!\brief prohibit default function (move to 'public' if needed) */
1791 VRMLPixelTextureHelper(const VRMLPixelTextureHelper
&source
);
1792 /*!\brief prohibit default function (move to 'public' if needed) */
1793 void operator =(const VRMLPixelTextureHelper
&source
);
1797 //---------------------------------------------------------------------------
1799 //---------------------------------------------------------------------------
1801 /*! \brief VRML Group Helper
1802 \ingroup GrpFileIOWRLObj
1806 class OSG_FILEIO_DLLMAPPING VRMLInlineHelper
: public VRMLNodeHelper
1808 /*========================== PUBLIC =================================*/
1811 /*---------------------------------------------------------------------*/
1812 /*! \name Destructor */
1815 virtual ~VRMLInlineHelper(void);
1818 /*---------------------------------------------------------------------*/
1822 virtual void init(const Char8
*szName
);
1825 /*---------------------------------------------------------------------*/
1830 /*---------------------------------------------------------------------*/
1834 virtual void endNode(FieldContainer
*pFC
);
1837 /*---------------------------------------------------------------------*/
1841 virtual void dump(const Char8
*szNodeName
);
1844 /*========================= PROTECTED ===============================*/
1848 /*---------------------------------------------------------------------*/
1849 /*! \name Destructor */
1852 static VRMLNodeHelper
*create(void);
1855 /*---------------------------------------------------------------------*/
1856 /*! \name Constructors */
1859 VRMLInlineHelper(void);
1862 /*---------------------------------------------------------------------*/
1867 /*---------------------------------------------------------------------*/
1871 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelper
;
1874 /*========================== PRIVATE ================================*/
1878 typedef VRMLNodeHelper Inherited
;
1880 /*!\brief prohibit default function (move to 'public' if needed) */
1881 VRMLInlineHelper(const VRMLInlineHelper
&source
);
1882 /*!\brief prohibit default function (move to 'public' if needed) */
1883 void operator =(const VRMLInlineHelper
&source
);
1887 //---------------------------------------------------------------------------
1889 //---------------------------------------------------------------------------
1891 /*! \brief VRML Shape Helper
1892 \ingroup GrpFileIOWRLObj
1896 class OSG_FILEIO_DLLMAPPING VRMLSwitchHelper
: public VRMLNodeHelper
1898 /*========================== PUBLIC =================================*/
1902 /*---------------------------------------------------------------------*/
1903 /*! \name Destructor */
1906 virtual ~VRMLSwitchHelper(void);
1909 /*---------------------------------------------------------------------*/
1913 virtual void init(const Char8
*szName
);
1916 /*---------------------------------------------------------------------*/
1920 virtual bool prototypeAddField(const Char8
*szFieldType
,
1921 const UInt32 uiFieldTypeId
,
1922 const Char8
*szFieldName
);
1924 virtual void getFieldAndDesc ( FieldContainer
* pFC
,
1925 const Char8
* szFieldname
,
1926 FieldContainer
*&pFieldFC
,
1927 EditFieldHandlePtr
&pField
,
1928 const FieldDescriptionBase
*&pDesc
);
1932 /*---------------------------------------------------------------------*/
1936 virtual void dump(const Char8
*szNodeName
);
1939 /*========================= PROTECTED ===============================*/
1943 /*---------------------------------------------------------------------*/
1944 /*! \name Destructor */
1947 static VRMLNodeHelper
*create(void);
1950 /*---------------------------------------------------------------------*/
1951 /*! \name Constructors */
1954 VRMLSwitchHelper(void);
1957 /*---------------------------------------------------------------------*/
1962 /*---------------------------------------------------------------------*/
1966 static VRMLNodeHelperFactoryBase::RegisterHelper _regHelper
;
1969 /*========================== PRIVATE ================================*/
1973 typedef VRMLNodeHelper Inherited
;
1975 /*!\brief prohibit default function (move to 'public' if needed) */
1976 VRMLSwitchHelper(const VRMLSwitchHelper
&source
);
1977 /*!\brief prohibit default function (move to 'public' if needed) */
1978 void operator =(const VRMLSwitchHelper
&source
);
1983 #include "OSGVRMLNodeHelper.inl"
1985 #endif /* _OSGVRMLNODEHELPER_H_ */