1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2010 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 _OSGCOLLADALIGHT_H_
40 #define _OSGCOLLADALIGHT_H_
42 #include "OSGConfig.h"
44 #ifdef OSG_WITH_COLLADA
46 #include "OSGColladaInstantiableElement.h"
47 #include "OSGColladaElementFactoryHelper.h"
48 #include "OSGColladaInstInfo.h"
49 #include "OSGLightModelChunk.h"
51 #include <dom/domLight.h>
52 #include <dom/domTechnique.h>
57 class ColladaInstanceLight
;
59 OSG_GEN_MEMOBJPTR(ColladaLight
);
62 class OSG_FILEIO_DLLMAPPING ColladaLight
: public ColladaInstantiableElement
64 /*========================== PUBLIC =================================*/
66 /*---------------------------------------------------------------------*/
70 typedef ColladaInstantiableElement Inherited
;
71 typedef ColladaLight Self
;
73 OSG_GEN_INTERNAL_MEMOBJPTR(ColladaLight
);
76 class ColladaLightInstInfo
;
77 OSG_GEN_MEMOBJPTR(ColladaLightInstInfo
);
80 class ColladaLightInstInfo
: public ColladaInstInfo
82 /*========================== PUBLIC =============================*/
84 /*-----------------------------------------------------------------*/
88 typedef ColladaInstInfo Inherited
;
89 typedef ColladaLightInstInfo Self
;
91 OSG_GEN_INTERNAL_MEMOBJPTR(ColladaLightInstInfo
);
94 /*-----------------------------------------------------------------*/
98 static ColladaInstInfoTransitPtr
99 create(ColladaElement
*colInstParent
,
100 ColladaInstanceLight
*colInst
,
104 /*-----------------------------------------------------------------*/
108 virtual void process(void);
111 /*-----------------------------------------------------------------*/
115 Node
*getBeacon(void) const;
118 /*========================= PROTECTED ===========================*/
120 /*-----------------------------------------------------------------*/
121 /*! \name Constructors/Destructor */
124 ColladaLightInstInfo(
125 ColladaElement
*colInstParent
,
126 ColladaInstanceLight
*colInst
,
128 virtual ~ColladaLightInstInfo(void );
131 /*-----------------------------------------------------------------*/
137 ColladaLightInstInfo(const ColladaLightInstInfo
&other
);
138 void operator=(const ColladaLightInstInfo
&rhs
);
142 class ColladaLightAmbientInstInfo
;
143 OSG_GEN_MEMOBJPTR(ColladaLightAmbientInstInfo
);
145 class ColladaLightAmbientInstInfo
: public ColladaInstInfo
147 /*========================== PUBLIC =============================*/
149 /*-----------------------------------------------------------------*/
153 typedef ColladaInstInfo Inherited
;
154 typedef ColladaLightAmbientInstInfo Self
;
156 OSG_GEN_INTERNAL_MEMOBJPTR(ColladaLightAmbientInstInfo
);
159 /*-----------------------------------------------------------------*/
163 static ColladaInstInfoTransitPtr
164 create(ColladaElement
*colInstParent
,
165 ColladaInstanceLight
*colInst
);
168 /*-----------------------------------------------------------------*/
172 virtual void process(void);
175 /*========================= PROTECTED ===========================*/
177 /*-----------------------------------------------------------------*/
178 /*! \name Constructors/Destructor */
181 ColladaLightAmbientInstInfo(
182 ColladaElement
*colInstParent
,
183 ColladaInstanceLight
*colInst
);
184 virtual ~ColladaLightAmbientInstInfo(void );
187 /*-----------------------------------------------------------------*/
191 /*---------------------------------------------------------------------*/
195 static ColladaElementTransitPtr
196 create(daeElement
*elem
, ColladaGlobal
*global
);
199 /*---------------------------------------------------------------------*/
203 virtual void read (ColladaElement
*colElemParent
);
204 virtual Node
*createInstance(ColladaInstInfo
*colInstInfo
);
207 /*---------------------------------------------------------------------*/
208 /*! \name Ambient Light */
211 void createAmbientLight(ColladaLightAmbientInstInfo
*colInstInfo
);
214 /*========================= PROTECTED ===============================*/
216 /*---------------------------------------------------------------------*/
221 class LightLoaderState
;
222 OSG_GEN_MEMOBJPTR(LightLoaderState
);
225 class LightLoaderState
: public ColladaLoaderState
227 /*========================== PUBLIC =============================*/
229 /*-----------------------------------------------------------------*/
233 typedef ColladaLoaderState Inherited
;
234 typedef LightLoaderState Self
;
236 OSG_GEN_INTERNAL_MEMOBJPTR(LightLoaderState
);
239 /*-----------------------------------------------------------------*/
243 static LightLoaderStateTransitPtr
create(void);
246 /*-----------------------------------------------------------------*/
250 LightModelChunk
*getLightModelChunk(void ) const;
251 void setLightModelChunk(LightModelChunk
*chunk
);
254 /*========================= PROTECTED ===========================*/
256 /*-----------------------------------------------------------------*/
257 /*! \name Constructors/Destructor */
260 LightLoaderState(void);
261 virtual ~LightLoaderState(void);
264 /*-----------------------------------------------------------------*/
266 LightModelChunkUnrecPtr _lightModel
;
270 /*---------------------------------------------------------------------*/
271 /*! \name Constructors/Destructor */
274 ColladaLight(daeElement
*elem
,
275 ColladaGlobal
*global
);
276 virtual ~ColladaLight(void );
279 /*---------------------------------------------------------------------*/
280 /*! \name Helper Functions */
283 Node
*createInstanceTechnique(ColladaLightInstInfo
*colInstInfo
,
284 domTechnique
*tech
);
285 Node
*createInstanceCommon (ColladaLightInstInfo
*colInstInfo
,
286 domLight::domTechnique_common
*tech
);
289 /*---------------------------------------------------------------------*/
291 static ColladaElementRegistrationHelper _regHelper
;
292 static const std::string _loaderStateName
;
297 // #include "OSGColladaLight.inl"
299 #endif // OSG_WITH_COLLADA
301 #endif // _OSGCOLLADALIGHT_H_