changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Drawables / Geometry / PropertiesBase / OSGGeoPropertyBase.cpp
blobc80ee71a978834a6c74c540b907fea958a39a8d4
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class GeoProperty!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
64 #include "OSGGLEXT.h" // VboUsage default header
67 #include "OSGGeoPropertyBase.h"
68 #include "OSGGeoProperty.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
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(
110 "GeoPropertyPtr",
111 "StateChunkPtr",
112 GeoProperty::getClassType(),
113 nsOSG);
114 #endif
116 OSG_FIELDTRAITS_GETTYPE_NS(GeoProperty *, nsOSG)
118 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
119 GeoProperty *,
120 nsOSG)
122 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
123 GeoProperty *,
124 nsOSG)
126 /***************************************************************************\
127 * Field Description *
128 \***************************************************************************/
130 void GeoPropertyBase::classDescInserter(TypeObject &oType)
132 FieldDescriptionBase *pDesc = NULL;
135 pDesc = new SFBool::Description(
136 SFBool::getClassType(),
137 "useVBO",
138 "The id used to register with the Window, 0 if not set up yet.\n",
139 UseVBOFieldId, UseVBOFieldMask,
140 false,
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(),
149 "usage",
150 "Provides information about the semantics of this property. Valid values\n"
151 "are the GeoProperty::Usage... constants. \n",
152 UsageFieldId, UsageFieldMask,
153 false,
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(),
162 "GLId",
163 "The id used to register with the Window, 0 if not set up yet.\n",
164 GLIdFieldId, GLIdFieldMask,
165 true,
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(),
174 "vboUsage",
175 "The usage pattern, only valid for VBO use.\n",
176 VboUsageFieldId, VboUsageFieldMask,
177 true,
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(),
189 "NULL",
190 nsOSG, //Namespace
191 NULL,
192 reinterpret_cast<InitContainerF>(&GeoProperty::initMethod),
193 reinterpret_cast<ExitContainerF>(&GeoProperty::exitMethod),
194 reinterpret_cast<InitalInsertDescFunc>(
195 reinterpret_cast<void *>(&GeoProperty::classDescInserter)),
196 false,
198 "<?xml version=\"1.0\"?>\n"
199 "\n"
200 "<FieldContainer\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"
210 " >\n"
211 " <Field\n"
212 " name=\"useVBO\"\n"
213 " type=\"bool\"\n"
214 " cardinality=\"single\"\n"
215 " visibility=\"external\"\n"
216 " defaultValue=\"true\"\n"
217 " access=\"public\"\n"
218 " >\n"
219 " The id used to register with the Window, 0 if not set up yet.\n"
220 " </Field>\n"
221 " <Field\n"
222 " name=\"usage\"\n"
223 " type=\"UInt32\"\n"
224 " cardinality=\"single\"\n"
225 " visibility=\"external\"\n"
226 " defaultValue=\"0\"\n"
227 " access=\"public\"\n"
228 " >\n"
229 " Provides information about the semantics of this property. Valid values\n"
230 " are the GeoProperty::Usage... constants. \n"
231 " </Field>\n"
232 " <Field\n"
233 " name=\"GLId\"\n"
234 " type=\"UInt32\"\n"
235 " cardinality=\"single\"\n"
236 " visibility=\"internal\"\n"
237 " defaultValue=\"0\"\n"
238 " access=\"protected\"\n"
239 " fieldFlags=\"FClusterLocal\"\n"
240 " >\n"
241 " The id used to register with the Window, 0 if not set up yet.\n"
242 " </Field>\n"
243 " <Field\n"
244 " name=\"vboUsage\"\n"
245 " type=\"Int32\"\n"
246 " cardinality=\"single\"\n"
247 " visibility=\"internal\"\n"
248 " defaultValue=\"GL_STATIC_DRAW_ARB\"\n"
249 " defaultHeader=\"&quot;OSGGLEXT.h&quot;\"\n"
250 " access=\"public\"\n"
251 " >\n"
252 " The usage pattern, only valid for VBO use.\n"
253 " </Field>\n"
254 "</FieldContainer>\n",
258 /*------------------------------ get -----------------------------------*/
260 FieldContainerType &GeoPropertyBase::getType(void)
262 return _type;
265 const FieldContainerType &GeoPropertyBase::getType(void) const
267 return _type;
270 UInt32 GeoPropertyBase::getContainerSize(void) const
272 return sizeof(GeoProperty);
275 /*------------------------- decorator get ------------------------------*/
278 SFBool *GeoPropertyBase::editSFUseVBO(void)
280 editSField(UseVBOFieldMask);
282 return &_sfUseVBO;
285 const SFBool *GeoPropertyBase::getSFUseVBO(void) const
287 return &_sfUseVBO;
291 SFUInt32 *GeoPropertyBase::editSFUsage(void)
293 editSField(UsageFieldMask);
295 return &_sfUsage;
298 const SFUInt32 *GeoPropertyBase::getSFUsage(void) const
300 return &_sfUsage;
304 SFUInt32 *GeoPropertyBase::editSFGLId(void)
306 editSField(GLIdFieldMask);
308 return &_sfGLId;
311 const SFUInt32 *GeoPropertyBase::getSFGLId(void) const
313 return &_sfGLId;
317 SFInt32 *GeoPropertyBase::editSFVboUsage(void)
319 editSField(VboUsageFieldMask);
321 return &_sfVboUsage;
324 const SFInt32 *GeoPropertyBase::getSFVboUsage(void) const
326 return &_sfVboUsage;
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();
357 return returnValue;
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) :
416 Inherited(),
417 _sfUseVBO (bool(true)),
418 _sfUsage (UInt32(0)),
419 _sfGLId (UInt32(0)),
420 _sfVboUsage (Int32(GL_STATIC_DRAW_ARB))
424 GeoPropertyBase::GeoPropertyBase(const GeoPropertyBase &source) :
425 Inherited(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(
445 &_sfUseVBO,
446 this->getType().getFieldDesc(UseVBOFieldId),
447 const_cast<GeoPropertyBase *>(this)));
449 return returnValue;
452 EditFieldHandlePtr GeoPropertyBase::editHandleUseVBO (void)
454 SFBool::EditHandlePtr returnValue(
455 new SFBool::EditHandle(
456 &_sfUseVBO,
457 this->getType().getFieldDesc(UseVBOFieldId),
458 this));
461 editSField(UseVBOFieldMask);
463 return returnValue;
466 GetFieldHandlePtr GeoPropertyBase::getHandleUsage (void) const
468 SFUInt32::GetHandlePtr returnValue(
469 new SFUInt32::GetHandle(
470 &_sfUsage,
471 this->getType().getFieldDesc(UsageFieldId),
472 const_cast<GeoPropertyBase *>(this)));
474 return returnValue;
477 EditFieldHandlePtr GeoPropertyBase::editHandleUsage (void)
479 SFUInt32::EditHandlePtr returnValue(
480 new SFUInt32::EditHandle(
481 &_sfUsage,
482 this->getType().getFieldDesc(UsageFieldId),
483 this));
486 editSField(UsageFieldMask);
488 return returnValue;
491 GetFieldHandlePtr GeoPropertyBase::getHandleGLId (void) const
493 SFUInt32::GetHandlePtr returnValue(
494 new SFUInt32::GetHandle(
495 &_sfGLId,
496 this->getType().getFieldDesc(GLIdFieldId),
497 const_cast<GeoPropertyBase *>(this)));
499 return returnValue;
502 EditFieldHandlePtr GeoPropertyBase::editHandleGLId (void)
504 SFUInt32::EditHandlePtr returnValue(
505 new SFUInt32::EditHandle(
506 &_sfGLId,
507 this->getType().getFieldDesc(GLIdFieldId),
508 this));
511 editSField(GLIdFieldMask);
513 return returnValue;
516 GetFieldHandlePtr GeoPropertyBase::getHandleVboUsage (void) const
518 SFInt32::GetHandlePtr returnValue(
519 new SFInt32::GetHandle(
520 &_sfVboUsage,
521 this->getType().getFieldDesc(VboUsageFieldId),
522 const_cast<GeoPropertyBase *>(this)));
524 return returnValue;
527 EditFieldHandlePtr GeoPropertyBase::editHandleVboUsage (void)
529 SFInt32::EditHandlePtr returnValue(
530 new SFInt32::EditHandle(
531 &_sfVboUsage,
532 this->getType().getFieldDesc(VboUsageFieldId),
533 this));
536 editSField(VboUsageFieldMask);
538 return returnValue;
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),
552 whichField,
553 oOffsets,
554 syncMode,
555 uiSyncInfo);
557 #endif
561 void GeoPropertyBase::resolveLinks(void)
563 Inherited::resolveLinks();
569 OSG_END_NAMESPACE