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 **
48 ** class LogicOpChunk!
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 "OSGGL.h" // LogicOp default header
67 #include "OSGLogicOpChunkBase.h"
68 #include "OSGLogicOpChunk.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::LogicOpChunk
79 The logic op chunk contains the parameters that specify the logic operation
80 applied to fragments before writing them to the framebuffer. The following
81 OpenGL functionality is wrapped here:
82 glLogicOp(OSG::LogicOpChunk::_sfLogicOp).
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var GLenum LogicOpChunkBase::_sfLogicOp
90 The logic operation applied to fragments.
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits
<LogicOpChunk
*, nsOSG
>::_type(
102 LogicOpChunk::getClassType(),
106 OSG_FIELDTRAITS_GETTYPE_NS(LogicOpChunk
*, nsOSG
)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void LogicOpChunkBase::classDescInserter(TypeObject
&oType
)
122 FieldDescriptionBase
*pDesc
= NULL
;
125 pDesc
= new SFGLenum::Description(
126 SFGLenum::getClassType(),
128 "The logic operation applied to fragments.\n",
129 LogicOpFieldId
, LogicOpFieldMask
,
131 (Field::SFDefaultFlags
| Field::FStdAccess
),
132 static_cast<FieldEditMethodSig
>(&LogicOpChunk::editHandleLogicOp
),
133 static_cast<FieldGetMethodSig
>(&LogicOpChunk::getHandleLogicOp
));
135 oType
.addInitialDesc(pDesc
);
139 LogicOpChunkBase::TypeObject
LogicOpChunkBase::_type(
140 LogicOpChunkBase::getClassname(),
141 Inherited::getClassname(),
144 reinterpret_cast<PrototypeCreateF
>(&LogicOpChunkBase::createEmptyLocal
),
145 reinterpret_cast<InitContainerF
>(&LogicOpChunk::initMethod
),
146 reinterpret_cast<ExitContainerF
>(&LogicOpChunk::exitMethod
),
147 reinterpret_cast<InitalInsertDescFunc
>(
148 reinterpret_cast<void *>(&LogicOpChunk::classDescInserter
)),
151 "<?xml version=\"1.0\"?>\n"
154 " name=\"LogicOpChunk\"\n"
155 " parent=\"StateChunk\"\n"
156 " library=\"State\"\n"
157 " pointerfieldtypes=\"both\"\n"
158 " structure=\"concrete\"\n"
159 " systemcomponent=\"true\"\n"
160 " parentsystemcomponent=\"true\"\n"
161 " docGroupBase=\"GrpStateOpenGL\"\n"
163 " The logic op chunk contains the parameters that specify the logic operation\n"
164 " applied to fragments before writing them to the framebuffer. The following\n"
165 " OpenGL functionality is wrapped here: \n"
166 " glLogicOp(OSG::LogicOpChunk::_sfLogicOp). \n"
168 " name=\"LogicOp\"\n"
169 " category=\"data\"\n"
171 " cardinality=\"single\"\n"
172 " visibility=\"external\"\n"
173 " defaultValue=\"GL_COPY\"\n"
174 " defaultHeader=\"OSGGL.h\"\n"
175 " access=\"public\"\n"
177 " The logic operation applied to fragments.\n"
179 "</FieldContainer>\n",
180 "The logic op chunk contains the parameters that specify the logic operation\n"
181 "applied to fragments before writing them to the framebuffer. The following\n"
182 "OpenGL functionality is wrapped here: \n"
183 "glLogicOp(OSG::LogicOpChunk::_sfLogicOp). \n"
186 /*------------------------------ get -----------------------------------*/
188 FieldContainerType
&LogicOpChunkBase::getType(void)
193 const FieldContainerType
&LogicOpChunkBase::getType(void) const
198 UInt32
LogicOpChunkBase::getContainerSize(void) const
200 return sizeof(LogicOpChunk
);
203 /*------------------------- decorator get ------------------------------*/
206 SFGLenum
*LogicOpChunkBase::editSFLogicOp(void)
208 editSField(LogicOpFieldMask
);
213 const SFGLenum
*LogicOpChunkBase::getSFLogicOp(void) const
223 /*------------------------------ access -----------------------------------*/
225 SizeT
LogicOpChunkBase::getBinSize(ConstFieldMaskArg whichField
)
227 SizeT returnValue
= Inherited::getBinSize(whichField
);
229 if(FieldBits::NoField
!= (LogicOpFieldMask
& whichField
))
231 returnValue
+= _sfLogicOp
.getBinSize();
237 void LogicOpChunkBase::copyToBin(BinaryDataHandler
&pMem
,
238 ConstFieldMaskArg whichField
)
240 Inherited::copyToBin(pMem
, whichField
);
242 if(FieldBits::NoField
!= (LogicOpFieldMask
& whichField
))
244 _sfLogicOp
.copyToBin(pMem
);
248 void LogicOpChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
249 ConstFieldMaskArg whichField
)
251 Inherited::copyFromBin(pMem
, whichField
);
253 if(FieldBits::NoField
!= (LogicOpFieldMask
& whichField
))
255 editSField(LogicOpFieldMask
);
256 _sfLogicOp
.copyFromBin(pMem
);
260 //! create a new instance of the class
261 LogicOpChunkTransitPtr
LogicOpChunkBase::createLocal(BitVector bFlags
)
263 LogicOpChunkTransitPtr fc
;
265 if(getClassType().getPrototype() != NULL
)
267 FieldContainerTransitPtr tmpPtr
=
268 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
270 fc
= dynamic_pointer_cast
<LogicOpChunk
>(tmpPtr
);
276 //! create a new instance of the class, copy the container flags
277 LogicOpChunkTransitPtr
LogicOpChunkBase::createDependent(BitVector bFlags
)
279 LogicOpChunkTransitPtr fc
;
281 if(getClassType().getPrototype() != NULL
)
283 FieldContainerTransitPtr tmpPtr
=
284 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
286 fc
= dynamic_pointer_cast
<LogicOpChunk
>(tmpPtr
);
292 //! create a new instance of the class
293 LogicOpChunkTransitPtr
LogicOpChunkBase::create(void)
295 LogicOpChunkTransitPtr fc
;
297 if(getClassType().getPrototype() != NULL
)
299 FieldContainerTransitPtr tmpPtr
=
300 getClassType().getPrototype()-> shallowCopy();
302 fc
= dynamic_pointer_cast
<LogicOpChunk
>(tmpPtr
);
308 LogicOpChunk
*LogicOpChunkBase::createEmptyLocal(BitVector bFlags
)
310 LogicOpChunk
*returnValue
;
312 newPtr
<LogicOpChunk
>(returnValue
, bFlags
);
314 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
319 //! create an empty new instance of the class, do not copy the prototype
320 LogicOpChunk
*LogicOpChunkBase::createEmpty(void)
322 LogicOpChunk
*returnValue
;
324 newPtr
<LogicOpChunk
>(returnValue
, Thread::getCurrentLocalFlags());
326 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
327 ~Thread::getCurrentLocalFlags();
333 FieldContainerTransitPtr
LogicOpChunkBase::shallowCopyLocal(
334 BitVector bFlags
) const
336 LogicOpChunk
*tmpPtr
;
338 newPtr(tmpPtr
, dynamic_cast<const LogicOpChunk
*>(this), bFlags
);
340 FieldContainerTransitPtr
returnValue(tmpPtr
);
342 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
347 FieldContainerTransitPtr
LogicOpChunkBase::shallowCopyDependent(
348 BitVector bFlags
) const
350 LogicOpChunk
*tmpPtr
;
352 newPtr(tmpPtr
, dynamic_cast<const LogicOpChunk
*>(this), ~bFlags
);
354 FieldContainerTransitPtr
returnValue(tmpPtr
);
356 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
361 FieldContainerTransitPtr
LogicOpChunkBase::shallowCopy(void) const
363 LogicOpChunk
*tmpPtr
;
366 dynamic_cast<const LogicOpChunk
*>(this),
367 Thread::getCurrentLocalFlags());
369 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
371 FieldContainerTransitPtr
returnValue(tmpPtr
);
379 /*------------------------- constructors ----------------------------------*/
381 LogicOpChunkBase::LogicOpChunkBase(void) :
383 _sfLogicOp (GLenum(GL_COPY
))
387 LogicOpChunkBase::LogicOpChunkBase(const LogicOpChunkBase
&source
) :
389 _sfLogicOp (source
._sfLogicOp
)
394 /*-------------------------- destructors ----------------------------------*/
396 LogicOpChunkBase::~LogicOpChunkBase(void)
401 GetFieldHandlePtr
LogicOpChunkBase::getHandleLogicOp (void) const
403 SFGLenum::GetHandlePtr
returnValue(
404 new SFGLenum::GetHandle(
406 this->getType().getFieldDesc(LogicOpFieldId
),
407 const_cast<LogicOpChunkBase
*>(this)));
412 EditFieldHandlePtr
LogicOpChunkBase::editHandleLogicOp (void)
414 SFGLenum::EditHandlePtr
returnValue(
415 new SFGLenum::EditHandle(
417 this->getType().getFieldDesc(LogicOpFieldId
),
421 editSField(LogicOpFieldMask
);
427 #ifdef OSG_MT_CPTR_ASPECT
428 void LogicOpChunkBase::execSyncV( FieldContainer
&oFrom
,
429 ConstFieldMaskArg whichField
,
430 AspectOffsetStore
&oOffsets
,
431 ConstFieldMaskArg syncMode
,
432 const UInt32 uiSyncInfo
)
434 LogicOpChunk
*pThis
= static_cast<LogicOpChunk
*>(this);
436 pThis
->execSync(static_cast<LogicOpChunk
*>(&oFrom
),
445 #ifdef OSG_MT_CPTR_ASPECT
446 FieldContainer
*LogicOpChunkBase::createAspectCopy(
447 const FieldContainer
*pRefAspect
) const
449 LogicOpChunk
*returnValue
;
451 newAspectCopy(returnValue
,
452 dynamic_cast<const LogicOpChunk
*>(pRefAspect
),
453 dynamic_cast<const LogicOpChunk
*>(this));
459 void LogicOpChunkBase::resolveLinks(void)
461 Inherited::resolveLinks();