1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGVIEWPORTBASE_H_
55 #define _OSGVIEWPORTBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGSystemDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGViewarea.h" // Parent
68 #include "OSGFieldContainerFields.h" // Parent type
69 #include "OSGCameraFields.h" // Camera type
70 #include "OSGNodeFields.h" // Root type
71 #include "OSGBackgroundFields.h" // Background type
72 #include "OSGForegroundFields.h" // Foregrounds type
74 #include "OSGViewportFields.h"
81 //! \brief Viewport Base Class.
83 class OSG_SYSTEM_DLLMAPPING ViewportBase
: public Viewarea
87 typedef Viewarea Inherited
;
88 typedef Viewarea ParentContainer
;
90 typedef Inherited::TypeObject TypeObject
;
91 typedef TypeObject::InitPhase InitPhase
;
93 OSG_GEN_INTERNALPTR(Viewport
);
95 /*========================== PUBLIC =================================*/
101 ParentFieldId
= Inherited::NextFieldId
,
102 CameraFieldId
= ParentFieldId
+ 1,
103 RootFieldId
= CameraFieldId
+ 1,
104 BackgroundFieldId
= RootFieldId
+ 1,
105 ForegroundsFieldId
= BackgroundFieldId
+ 1,
106 NextFieldId
= ForegroundsFieldId
+ 1
109 static const OSG::BitVector ParentFieldMask
=
110 (TypeTraits
<BitVector
>::One
<< ParentFieldId
);
111 static const OSG::BitVector CameraFieldMask
=
112 (TypeTraits
<BitVector
>::One
<< CameraFieldId
);
113 static const OSG::BitVector RootFieldMask
=
114 (TypeTraits
<BitVector
>::One
<< RootFieldId
);
115 static const OSG::BitVector BackgroundFieldMask
=
116 (TypeTraits
<BitVector
>::One
<< BackgroundFieldId
);
117 static const OSG::BitVector ForegroundsFieldMask
=
118 (TypeTraits
<BitVector
>::One
<< ForegroundsFieldId
);
119 static const OSG::BitVector NextFieldMask
=
120 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
122 typedef SFParentFieldContainerPtr SFParentType
;
123 typedef SFUnrecCameraPtr SFCameraType
;
124 typedef SFUnrecNodePtr SFRootType
;
125 typedef SFUnrecBackgroundPtr SFBackgroundType
;
126 typedef MFUnrecForegroundPtr MFForegroundsType
;
128 /*---------------------------------------------------------------------*/
129 /*! \name Class Get */
132 static FieldContainerType
&getClassType (void);
133 static UInt32
getClassTypeId (void);
134 static UInt16
getClassGroupId(void);
137 /*---------------------------------------------------------------------*/
138 /*! \name FieldContainer Get */
141 virtual FieldContainerType
&getType (void);
142 virtual const FieldContainerType
&getType (void) const;
144 virtual UInt32
getContainerSize(void) const;
147 /*---------------------------------------------------------------------*/
148 /*! \name Field Get */
151 const SFUnrecCameraPtr
*getSFCamera (void) const;
152 SFUnrecCameraPtr
*editSFCamera (void);
153 const SFUnrecNodePtr
*getSFRoot (void) const;
154 SFUnrecNodePtr
*editSFRoot (void);
155 const SFUnrecBackgroundPtr
*getSFBackground (void) const;
156 SFUnrecBackgroundPtr
*editSFBackground (void);
157 const MFUnrecForegroundPtr
*getMFForegrounds (void) const;
158 MFUnrecForegroundPtr
*editMFForegrounds (void);
161 Camera
* getCamera (void) const;
163 Node
* getRoot (void) const;
165 Background
* getBackground (void) const;
167 Foreground
* getForegrounds (const UInt32 index
) const;
170 /*---------------------------------------------------------------------*/
171 /*! \name Field Set */
174 void setCamera (Camera
* const value
);
175 void setRoot (Node
* const value
);
176 void setBackground (Background
* const value
);
179 /*---------------------------------------------------------------------*/
180 /*! \name Ptr Field Set */
184 /*---------------------------------------------------------------------*/
185 /*! \name Ptr MField Set */
188 void addForeground (Foreground
* const value
);
189 void assignForegrounds (const MFUnrecForegroundPtr
&value
);
190 void removeFromForegrounds (UInt32 uiIndex
);
191 void removeObjFromForegrounds(Foreground
* const value
);
192 void clearForegrounds (void );
195 /*---------------------------------------------------------------------*/
196 /*! \name Binary Access */
199 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
200 virtual void copyToBin (BinaryDataHandler
&pMem
,
201 ConstFieldMaskArg whichField
);
202 virtual void copyFromBin(BinaryDataHandler
&pMem
,
203 ConstFieldMaskArg whichField
);
207 /*---------------------------------------------------------------------*/
208 /*! \name Construction */
211 static ViewportTransitPtr
create (void);
212 static Viewport
*createEmpty (void);
214 static ViewportTransitPtr
createLocal (
215 BitVector bFlags
= FCLocal::All
);
217 static Viewport
*createEmptyLocal(
218 BitVector bFlags
= FCLocal::All
);
220 static ViewportTransitPtr
createDependent (BitVector bFlags
);
223 /*---------------------------------------------------------------------*/
227 virtual FieldContainerTransitPtr
shallowCopy (void) const;
228 virtual FieldContainerTransitPtr
shallowCopyLocal(
229 BitVector bFlags
= FCLocal::All
) const;
230 virtual FieldContainerTransitPtr
shallowCopyDependent(
231 BitVector bFlags
) const;
234 /*========================= PROTECTED ===============================*/
238 static TypeObject _type
;
240 static void classDescInserter(TypeObject
&oType
);
241 static const Char8
*getClassname (void );
243 /*---------------------------------------------------------------------*/
247 SFParentFieldContainerPtr _sfParent
;
248 SFUnrecCameraPtr _sfCamera
;
249 SFUnrecNodePtr _sfRoot
;
250 SFUnrecBackgroundPtr _sfBackground
;
251 MFUnrecForegroundPtr _mfForegrounds
;
254 /*---------------------------------------------------------------------*/
255 /*! \name Constructors */
259 ViewportBase(const ViewportBase
&source
);
262 /*---------------------------------------------------------------------*/
263 /*! \name Destructors */
266 virtual ~ViewportBase(void);
269 /*---------------------------------------------------------------------*/
270 /*! \name onCreate */
273 void onCreate(const Viewport
*source
= NULL
);
276 /*---------------------------------------------------------------------*/
277 /*! \name Parent linking */
280 virtual bool linkParent (FieldContainer
* const pParent
,
281 UInt16
const childFieldId
,
282 UInt16
const parentFieldId
);
283 virtual bool unlinkParent(FieldContainer
* const pParent
,
284 UInt16
const parentFieldId
);
287 /*---------------------------------------------------------------------*/
288 /*! \name Generic Field Access */
291 GetFieldHandlePtr
getHandleParent (void) const;
292 EditFieldHandlePtr
editHandleParent (void);
293 GetFieldHandlePtr
getHandleCamera (void) const;
294 EditFieldHandlePtr
editHandleCamera (void);
295 GetFieldHandlePtr
getHandleRoot (void) const;
296 EditFieldHandlePtr
editHandleRoot (void);
297 GetFieldHandlePtr
getHandleBackground (void) const;
298 EditFieldHandlePtr
editHandleBackground (void);
299 GetFieldHandlePtr
getHandleForegrounds (void) const;
300 EditFieldHandlePtr
editHandleForegrounds (void);
303 /*---------------------------------------------------------------------*/
307 #ifdef OSG_MT_CPTR_ASPECT
308 virtual void execSyncV( FieldContainer
&oFrom
,
309 ConstFieldMaskArg whichField
,
310 AspectOffsetStore
&oOffsets
,
311 ConstFieldMaskArg syncMode
,
312 const UInt32 uiSyncInfo
);
314 void execSync ( ViewportBase
*pFrom
,
315 ConstFieldMaskArg whichField
,
316 AspectOffsetStore
&oOffsets
,
317 ConstFieldMaskArg syncMode
,
318 const UInt32 uiSyncInfo
);
322 /*---------------------------------------------------------------------*/
327 /*---------------------------------------------------------------------*/
328 /*! \name Aspect Create */
331 #ifdef OSG_MT_CPTR_ASPECT
332 virtual FieldContainer
*createAspectCopy(
333 const FieldContainer
*pRefAspect
) const;
337 /*---------------------------------------------------------------------*/
341 /*---------------------------------------------------------------------*/
345 virtual void resolveLinks(void);
348 /*========================== PRIVATE ================================*/
351 /*---------------------------------------------------------------------*/
353 // prohibit default functions (move to 'public' if you need one)
354 void operator =(const ViewportBase
&source
);
357 typedef ViewportBase
*ViewportBaseP
;
361 #endif /* _OSGVIEWPORTBASE_H_ */