1 /*---------------------------------------------------------------------------*\
2 * OpenSG openNURBS SceneFileType *
5 * Copyright (C) 2007-2008 by Seac02 S.r.l. http://www.seac02.it *
6 * Copyright (C) 2008 by Patrik Mueller muellerptr@users.sourceforge.net *
7 * Copyright (C) 2008 by Akos Balazs edhellon@cs.uni-bonn.de *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
13 * This library is free software; you can redistribute it and/or modify it *
14 * under the terms of the GNU Library General Public License as published *
15 * by the Free Software Foundation, version 2. *
17 * This library is distributed in the hope that it will be useful, but *
18 * WITHOUT ANY WARRANTY; without even the implied warranty of *
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
20 * Library General Public License for more details. *
22 * You should have received a copy of the GNU Library General Public *
23 * License along with this library; if not, write to the Free Software *
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
35 \*---------------------------------------------------------------------------*/
37 //-------------------------------
39 //-------------------------------
41 #if __GNUC__ >= 4 || __GNUC_MINOR__ >=3
42 #pragma GCC diagnostic warning "-Wold-style-cast"
43 #pragma GCC diagnostic warning "-Wignored-qualifiers"
49 #include <OSGConfig.h>
56 #include "OSGSceneFileHandler.h"
57 #include "OSGRhinoSceneFileType.h"
59 #include "OSGrhino2osb.h"
63 #if defined(OSG_WIN32_ICL) && !defined(OSG_CHECK_FIELDSETARG)
64 #pragma warning (disable : 383)
68 /*! \class OSG::RhinoSceneFileType
69 \ingroup GrpSystemFileIO
73 /*****************************
75 *****************************/
76 // Static Class Varible implementations:
78 const Char8
*RhinoSceneFileType::_suffixA
[] = { "3dm" };
80 RhinoSceneFileType
RhinoSceneFileType::_the(_suffixA
,
84 SceneFileType::OSG_READ_SUPPORTED
);
86 NodeTransitPtr
RhinoSceneFileType::read3DM(const Char8
*fileName
) const
88 bool bImportRenderMeshes
= false;
89 int iCurveInterpolationSteps
= 100;
90 float fTessellationError
= 0.1f
;
91 bool bDoTessellation
= true;
93 IOFileTypeBase::getOptionAs
<Int32
>(this->getOptions(),
94 "curveInterpolationSteps",
95 iCurveInterpolationSteps
);
97 IOFileTypeBase::getOptionAs
<Real32
>(this->getOptions(),
101 IOFileTypeBase::getOptionAs
<bool> (this->getOptions(),
105 IOFileTypeBase::getOptionAs
<bool> (this->getOptions(),
106 "importRenderMeshes",
107 bImportRenderMeshes
);
109 if(iCurveInterpolationSteps
<= 0)
111 iCurveInterpolationSteps
= 100;
114 if(fTessellationError
<= 0.f
)
116 fTessellationError
= 0.1f
;
119 rhino2osb
ro(iCurveInterpolationSteps
,
122 bImportRenderMeshes
);
124 NodeTransitPtr root
= ro
.load(fileName
);
130 NodeTransitPtr
RhinoSceneFileType::read(
132 const Char8
*fileNameOrExtension
,
133 Resolver resolver
) const
135 return read3DM(fileNameOrExtension
);
138 RhinoSceneFileType::RhinoSceneFileType(const Char8
*suffixArray
[],
139 UInt16 suffixByteCount
,
141 UInt32 overridePriority
,
143 SceneFileType(suffixArray
,
151 RhinoSceneFileType
&RhinoSceneFileType::the(void)
156 const Char8
*RhinoSceneFileType::getName(void) const
158 return "Rhinoceros3D";
161 RhinoSceneFileType::~RhinoSceneFileType (void )