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 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
64 #include "OSGGLEXT.h" // VboUsage default header
67 #include "OSGGeoPropertyBase.h"
68 #include "OSGGeoProperty.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::GeoProperty
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var bool GeoPropertyBase::_sfUseVBO
87 The id used to register with the Window, 0 if not set up yet.
90 /*! \var UInt32 GeoPropertyBase::_sfUsage
91 Provides information about the semantics of this property. Valid values
92 are the GeoProperty::Usage... constants.
95 /*! \var UInt32 GeoPropertyBase::_sfGLId
96 The id used to register with the Window, 0 if not set up yet.
99 /*! \var Int32 GeoPropertyBase::_sfVboUsage
100 The usage pattern, only valid for VBO use.
104 /***************************************************************************\
105 * FieldType/FieldTrait Instantiation *
106 \***************************************************************************/
108 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
109 PointerType FieldTraits
<GeoProperty
*, nsOSG
>::_type(
112 GeoProperty::getClassType(),
116 OSG_FIELDTRAITS_GETTYPE_NS(GeoProperty
*, nsOSG
)
118 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
122 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
126 /***************************************************************************\
127 * Field Description *
128 \***************************************************************************/
130 void GeoPropertyBase::classDescInserter(TypeObject
&oType
)
132 FieldDescriptionBase
*pDesc
= NULL
;
135 pDesc
= new SFBool::Description(
136 SFBool::getClassType(),
138 "The id used to register with the Window, 0 if not set up yet.\n",
139 UseVBOFieldId
, UseVBOFieldMask
,
141 (Field::SFDefaultFlags
| Field::FStdAccess
),
142 static_cast<FieldEditMethodSig
>(&GeoProperty::editHandleUseVBO
),
143 static_cast<FieldGetMethodSig
>(&GeoProperty::getHandleUseVBO
));
145 oType
.addInitialDesc(pDesc
);
147 pDesc
= new SFUInt32::Description(
148 SFUInt32::getClassType(),
150 "Provides information about the semantics of this property. Valid values\n"
151 "are the GeoProperty::Usage... constants. \n",
152 UsageFieldId
, UsageFieldMask
,
154 (Field::SFDefaultFlags
| Field::FStdAccess
),
155 static_cast<FieldEditMethodSig
>(&GeoProperty::editHandleUsage
),
156 static_cast<FieldGetMethodSig
>(&GeoProperty::getHandleUsage
));
158 oType
.addInitialDesc(pDesc
);
160 pDesc
= new SFUInt32::Description(
161 SFUInt32::getClassType(),
163 "The id used to register with the Window, 0 if not set up yet.\n",
164 GLIdFieldId
, GLIdFieldMask
,
166 (Field::FClusterLocal
),
167 static_cast<FieldEditMethodSig
>(&GeoProperty::editHandleGLId
),
168 static_cast<FieldGetMethodSig
>(&GeoProperty::getHandleGLId
));
170 oType
.addInitialDesc(pDesc
);
172 pDesc
= new SFInt32::Description(
173 SFInt32::getClassType(),
175 "The usage pattern, only valid for VBO use.\n",
176 VboUsageFieldId
, VboUsageFieldMask
,
178 (Field::SFDefaultFlags
| Field::FStdAccess
),
179 static_cast<FieldEditMethodSig
>(&GeoProperty::editHandleVboUsage
),
180 static_cast<FieldGetMethodSig
>(&GeoProperty::getHandleVboUsage
));
182 oType
.addInitialDesc(pDesc
);
186 GeoPropertyBase::TypeObject
GeoPropertyBase::_type(
187 GeoPropertyBase::getClassname(),
188 Inherited::getClassname(),
192 reinterpret_cast<InitContainerF
>(&GeoProperty::initMethod
),
193 reinterpret_cast<ExitContainerF
>(&GeoProperty::exitMethod
),
194 reinterpret_cast<InitalInsertDescFunc
>(
195 reinterpret_cast<void *>(&GeoProperty::classDescInserter
)),
198 "<?xml version=\"1.0\"?>\n"
201 " name=\"GeoProperty\"\n"
202 " parent=\"StateChunk\"\n"
203 " library=\"System\"\n"
204 " pointerfieldtypes=\"both\"\n"
205 " structure=\"abstract\"\n"
206 " systemcomponent=\"true\"\n"
207 " parentsystemcomponent=\"true\"\n"
208 " decoratable=\"false\"\n"
209 " docGroupBase=\"GrpDrawablesGeometry\"\n"
214 " cardinality=\"single\"\n"
215 " visibility=\"external\"\n"
216 " defaultValue=\"true\"\n"
217 " access=\"public\"\n"
219 " The id used to register with the Window, 0 if not set up yet.\n"
224 " cardinality=\"single\"\n"
225 " visibility=\"external\"\n"
226 " defaultValue=\"0\"\n"
227 " access=\"public\"\n"
229 " Provides information about the semantics of this property. Valid values\n"
230 " are the GeoProperty::Usage... constants. \n"
235 " cardinality=\"single\"\n"
236 " visibility=\"internal\"\n"
237 " defaultValue=\"0\"\n"
238 " access=\"protected\"\n"
239 " fieldFlags=\"FClusterLocal\"\n"
241 " The id used to register with the Window, 0 if not set up yet.\n"
244 " name=\"vboUsage\"\n"
246 " cardinality=\"single\"\n"
247 " visibility=\"internal\"\n"
248 " defaultValue=\"GL_STATIC_DRAW_ARB\"\n"
249 " defaultHeader=\""OSGGLEXT.h"\"\n"
250 " access=\"public\"\n"
252 " The usage pattern, only valid for VBO use.\n"
254 "</FieldContainer>\n",
258 /*------------------------------ get -----------------------------------*/
260 FieldContainerType
&GeoPropertyBase::getType(void)
265 const FieldContainerType
&GeoPropertyBase::getType(void) const
270 UInt32
GeoPropertyBase::getContainerSize(void) const
272 return sizeof(GeoProperty
);
275 /*------------------------- decorator get ------------------------------*/
278 SFBool
*GeoPropertyBase::editSFUseVBO(void)
280 editSField(UseVBOFieldMask
);
285 const SFBool
*GeoPropertyBase::getSFUseVBO(void) const
291 SFUInt32
*GeoPropertyBase::editSFUsage(void)
293 editSField(UsageFieldMask
);
298 const SFUInt32
*GeoPropertyBase::getSFUsage(void) const
304 SFUInt32
*GeoPropertyBase::editSFGLId(void)
306 editSField(GLIdFieldMask
);
311 const SFUInt32
*GeoPropertyBase::getSFGLId(void) const
317 SFInt32
*GeoPropertyBase::editSFVboUsage(void)
319 editSField(VboUsageFieldMask
);
324 const SFInt32
*GeoPropertyBase::getSFVboUsage(void) const
334 /*------------------------------ access -----------------------------------*/
336 SizeT
GeoPropertyBase::getBinSize(ConstFieldMaskArg whichField
)
338 SizeT returnValue
= Inherited::getBinSize(whichField
);
340 if(FieldBits::NoField
!= (UseVBOFieldMask
& whichField
))
342 returnValue
+= _sfUseVBO
.getBinSize();
344 if(FieldBits::NoField
!= (UsageFieldMask
& whichField
))
346 returnValue
+= _sfUsage
.getBinSize();
348 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
350 returnValue
+= _sfGLId
.getBinSize();
352 if(FieldBits::NoField
!= (VboUsageFieldMask
& whichField
))
354 returnValue
+= _sfVboUsage
.getBinSize();
360 void GeoPropertyBase::copyToBin(BinaryDataHandler
&pMem
,
361 ConstFieldMaskArg whichField
)
363 Inherited::copyToBin(pMem
, whichField
);
365 if(FieldBits::NoField
!= (UseVBOFieldMask
& whichField
))
367 _sfUseVBO
.copyToBin(pMem
);
369 if(FieldBits::NoField
!= (UsageFieldMask
& whichField
))
371 _sfUsage
.copyToBin(pMem
);
373 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
375 _sfGLId
.copyToBin(pMem
);
377 if(FieldBits::NoField
!= (VboUsageFieldMask
& whichField
))
379 _sfVboUsage
.copyToBin(pMem
);
383 void GeoPropertyBase::copyFromBin(BinaryDataHandler
&pMem
,
384 ConstFieldMaskArg whichField
)
386 Inherited::copyFromBin(pMem
, whichField
);
388 if(FieldBits::NoField
!= (UseVBOFieldMask
& whichField
))
390 editSField(UseVBOFieldMask
);
391 _sfUseVBO
.copyFromBin(pMem
);
393 if(FieldBits::NoField
!= (UsageFieldMask
& whichField
))
395 editSField(UsageFieldMask
);
396 _sfUsage
.copyFromBin(pMem
);
398 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
400 editSField(GLIdFieldMask
);
401 _sfGLId
.copyFromBin(pMem
);
403 if(FieldBits::NoField
!= (VboUsageFieldMask
& whichField
))
405 editSField(VboUsageFieldMask
);
406 _sfVboUsage
.copyFromBin(pMem
);
413 /*------------------------- constructors ----------------------------------*/
415 GeoPropertyBase::GeoPropertyBase(void) :
417 _sfUseVBO (bool(true)),
418 _sfUsage (UInt32(0)),
420 _sfVboUsage (Int32(GL_STATIC_DRAW_ARB
))
424 GeoPropertyBase::GeoPropertyBase(const GeoPropertyBase
&source
) :
426 _sfUseVBO (source
._sfUseVBO
),
427 _sfUsage (source
._sfUsage
),
428 _sfGLId (source
._sfGLId
),
429 _sfVboUsage (source
._sfVboUsage
)
434 /*-------------------------- destructors ----------------------------------*/
436 GeoPropertyBase::~GeoPropertyBase(void)
441 GetFieldHandlePtr
GeoPropertyBase::getHandleUseVBO (void) const
443 SFBool::GetHandlePtr
returnValue(
444 new SFBool::GetHandle(
446 this->getType().getFieldDesc(UseVBOFieldId
),
447 const_cast<GeoPropertyBase
*>(this)));
452 EditFieldHandlePtr
GeoPropertyBase::editHandleUseVBO (void)
454 SFBool::EditHandlePtr
returnValue(
455 new SFBool::EditHandle(
457 this->getType().getFieldDesc(UseVBOFieldId
),
461 editSField(UseVBOFieldMask
);
466 GetFieldHandlePtr
GeoPropertyBase::getHandleUsage (void) const
468 SFUInt32::GetHandlePtr
returnValue(
469 new SFUInt32::GetHandle(
471 this->getType().getFieldDesc(UsageFieldId
),
472 const_cast<GeoPropertyBase
*>(this)));
477 EditFieldHandlePtr
GeoPropertyBase::editHandleUsage (void)
479 SFUInt32::EditHandlePtr
returnValue(
480 new SFUInt32::EditHandle(
482 this->getType().getFieldDesc(UsageFieldId
),
486 editSField(UsageFieldMask
);
491 GetFieldHandlePtr
GeoPropertyBase::getHandleGLId (void) const
493 SFUInt32::GetHandlePtr
returnValue(
494 new SFUInt32::GetHandle(
496 this->getType().getFieldDesc(GLIdFieldId
),
497 const_cast<GeoPropertyBase
*>(this)));
502 EditFieldHandlePtr
GeoPropertyBase::editHandleGLId (void)
504 SFUInt32::EditHandlePtr
returnValue(
505 new SFUInt32::EditHandle(
507 this->getType().getFieldDesc(GLIdFieldId
),
511 editSField(GLIdFieldMask
);
516 GetFieldHandlePtr
GeoPropertyBase::getHandleVboUsage (void) const
518 SFInt32::GetHandlePtr
returnValue(
519 new SFInt32::GetHandle(
521 this->getType().getFieldDesc(VboUsageFieldId
),
522 const_cast<GeoPropertyBase
*>(this)));
527 EditFieldHandlePtr
GeoPropertyBase::editHandleVboUsage (void)
529 SFInt32::EditHandlePtr
returnValue(
530 new SFInt32::EditHandle(
532 this->getType().getFieldDesc(VboUsageFieldId
),
536 editSField(VboUsageFieldMask
);
542 #ifdef OSG_MT_CPTR_ASPECT
543 void GeoPropertyBase::execSyncV( FieldContainer
&oFrom
,
544 ConstFieldMaskArg whichField
,
545 AspectOffsetStore
&oOffsets
,
546 ConstFieldMaskArg syncMode
,
547 const UInt32 uiSyncInfo
)
549 GeoProperty
*pThis
= static_cast<GeoProperty
*>(this);
551 pThis
->execSync(static_cast<GeoProperty
*>(&oFrom
),
561 void GeoPropertyBase::resolveLinks(void)
563 Inherited::resolveLinks();