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 /*---------------------------------------------------------------------------*\
32 * 2002/10/16: added transparency path. Thanks to Franck Sourdin *
33 * (sourdin@ai.cluny.ensam.fr) for it! *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGOBJSCENEFILETYPE_H_
40 #define _OSGOBJSCENEFILETYPE_H_
45 #include "OSGFileIODef.h"
46 #include "OSGBaseTypes.h"
47 #include "OSGSceneFileType.h"
54 /*! \brief OBJSceneFileType
56 \ingroup GrpLibOSGFileIO
59 class OSG_FILEIO_DLLMAPPING OBJSceneFileType
: public SceneFileType
61 /*========================== PUBLIC =================================*/
65 /*---------------------------------------------------------------------*/
66 /*! \name Class Get */
69 static OBJSceneFileType
&the(void);
72 /*---------------------------------------------------------------------*/
73 /*! \name Destructors */
76 virtual ~OBJSceneFileType(void);
79 /*---------------------------------------------------------------------*/
83 virtual const Char8
*getName(void) const;
86 /*---------------------------------------------------------------------*/
91 NodeTransitPtr
read( std::istream
&is
,
92 const Char8
*fileNameOrExtension
,
93 Resolver resolver
= NULL
) const;
96 /*---------------------------------------------------------------------*/
100 virtual bool write(Node
* const node
,
102 Char8
const *fileNameOrExtension
) const;
105 /*========================= PROTECTED ===============================*/
109 /*---------------------------------------------------------------------*/
113 static const Char8
*_suffixA
[];
114 static OBJSceneFileType _the
;
117 /*---------------------------------------------------------------------*/
118 /*! \name Constructors */
121 OBJSceneFileType(const Char8
*suffixArray
[],
122 UInt16 suffixByteCount
,
124 UInt32 overridePriority
,
127 OBJSceneFileType(const OBJSceneFileType
&obj
);
130 /*========================== PRIVATE ================================*/
134 typedef SceneFileType Inherited
;
140 VERTEX_DE
, VERTEX_TEXTURECOORD_DE
, VERTEX_NORMAL_DE
,
146 GROUP_DE
, SMOOTHING_GROUP_DE
, OBJECT_DE
149 std::map
<std::string
, DataElem
> _dataElemMap
;
156 MTL_DIFFUSE_ME
, MTL_AMBIENT_ME
, MTL_SPECULAR_ME
,
157 MTL_SHININESS_ME
, MTL_ILLUM_ME
,
158 MTL_TRANSPARENCY_ME
, MTL_DISSOLVE_ME
,
159 MTL_MAP_KD_ME
, MTL_MAP_KA_ME
, MTL_MAP_KS_ME
,
163 std::map
<std::string
, MaterialElem
> _mtlElemMap
;
165 void initElemMap(void);
178 TiePoint( Int32 v
= -1, Int32 vt
= -1, Int32 vn
= -1 )
179 { index
[0] = v
; index
[1] = vt
; index
[2] = vn
; }
180 inline void set ( Int32 v
= -1, Int32 vt
= -1, Int32 vn
= -1 )
181 { index
[0] = v
; index
[1] = vt
; index
[2] = vn
; }
188 std::vector
<TiePoint
> tieVec
;
190 Face(void) : tieVec() {}
198 std::list
<Face
> faceList
;
199 SimpleMaterialUnrecPtr mtlPtr
;
201 Mesh(void) : name(), faceList(), mtlPtr(NULL
) {}
205 Int32
readMTL (const Char8
*fileName
,
206 std::map
<std::string
,
207 SimpleTexturedMaterialUnrecPtr
> &mtlMap
) const;
209 void write(Node
* const node
,
213 UInt32
&tIndex
) const;
215 /* prohibit default function (move to 'public' if needed) */
216 void operator =(const OBJSceneFileType
&source
);
219 typedef OBJSceneFileType
* OBJSceneFileTypeP
;
223 #endif // _OSGOBJSCENEFILETYPE_H_