fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / OpenGL / OSGStencilChunkBase.cpp
blobb8a0534ed12408f9127e675d427ef028264e8b79
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 StencilChunk!
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 "OSGGL.h" // StencilFunc default header
65 #include "OSGGL.h" // StencilOpFail default header
66 #include "OSGGL.h" // StencilOpZFail default header
67 #include "OSGGL.h" // StencilOpZPass default header
70 #include "OSGStencilChunkBase.h"
71 #include "OSGStencilChunk.h"
73 #include <boost/bind.hpp>
75 OSG_BEGIN_NAMESPACE
77 /***************************************************************************\
78 * Description *
79 \***************************************************************************/
81 /*! \class OSG::StencilChunk
82 The stencil chunk handles OpenGL stencil tests by wrapping glStencilFunc()
83 and glStencilOp().
86 /***************************************************************************\
87 * Field Documentation *
88 \***************************************************************************/
90 /*! \var GLenum StencilChunkBase::_sfStencilFunc
91 The stencilFunc defines how fragments which do not fulfill a certain
92 condition are handled.
93 See glStencilFunc() for details. GL_NONE is used to disable stencil.
96 /*! \var Int32 StencilChunkBase::_sfStencilValue
97 The stencilFunc defines how fragments which do not fulfill a certain
98 condition are handled.
99 See glStencilFunc() for details. GL_NONE is used to disable stencil.
102 /*! \var UInt32 StencilChunkBase::_sfStencilMask
103 The stencilFunc defines how fragments which do not fulfill a certain
104 condition are handled.
105 See glStencilFunc() for details. GL_NONE is used to disable stencil.
108 /*! \var GLenum StencilChunkBase::_sfStencilOpFail
109 The stencilFunc defines how fragments which do not fulfill a certain
110 condition are handled.
111 See glStencilFunc() for details. GL_NONE is used to disable stencil.
114 /*! \var GLenum StencilChunkBase::_sfStencilOpZFail
115 The stencilFunc defines how fragments which do not fulfill a certain
116 condition are handled.
117 See glStencilFunc() for details. GL_NONE is used to disable stencil.
120 /*! \var GLenum StencilChunkBase::_sfStencilOpZPass
121 The stencilFunc defines how fragments which do not fulfill a certain
122 condition are handled.
123 See glStencilFunc() for details. GL_NONE is used to disable stencil.
126 /*! \var Int32 StencilChunkBase::_sfClearBuffer
127 Clear buffer on activate(1) or deactivate(2).
130 /*! \var UInt32 StencilChunkBase::_sfBitMask
131 Controls writing of individual bits in stencil planes, with 0 means write
132 protected and 1 write enabled.
136 /***************************************************************************\
137 * FieldType/FieldTrait Instantiation *
138 \***************************************************************************/
140 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
141 PointerType FieldTraits<StencilChunk *, nsOSG>::_type(
142 "StencilChunkPtr",
143 "StateChunkPtr",
144 StencilChunk::getClassType(),
145 nsOSG);
146 #endif
148 OSG_FIELDTRAITS_GETTYPE_NS(StencilChunk *, nsOSG)
150 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
151 StencilChunk *,
152 nsOSG)
154 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
155 StencilChunk *,
156 nsOSG)
158 /***************************************************************************\
159 * Field Description *
160 \***************************************************************************/
162 void StencilChunkBase::classDescInserter(TypeObject &oType)
164 FieldDescriptionBase *pDesc = NULL;
167 pDesc = new SFGLenum::Description(
168 SFGLenum::getClassType(),
169 "stencilFunc",
170 "The stencilFunc defines how fragments which do not fulfill a certain\n"
171 "condition are handled. \n"
172 "See glStencilFunc() for details. GL_NONE is used to disable stencil.\n",
173 StencilFuncFieldId, StencilFuncFieldMask,
174 false,
175 (Field::SFDefaultFlags | Field::FStdAccess),
176 static_cast<FieldEditMethodSig>(&StencilChunk::editHandleStencilFunc),
177 static_cast<FieldGetMethodSig >(&StencilChunk::getHandleStencilFunc));
179 oType.addInitialDesc(pDesc);
181 pDesc = new SFInt32::Description(
182 SFInt32::getClassType(),
183 "stencilValue",
184 "The stencilFunc defines how fragments which do not fulfill a certain\n"
185 "condition are handled. \n"
186 "See glStencilFunc() for details. GL_NONE is used to disable stencil.\n",
187 StencilValueFieldId, StencilValueFieldMask,
188 false,
189 (Field::SFDefaultFlags | Field::FStdAccess),
190 static_cast<FieldEditMethodSig>(&StencilChunk::editHandleStencilValue),
191 static_cast<FieldGetMethodSig >(&StencilChunk::getHandleStencilValue));
193 oType.addInitialDesc(pDesc);
195 pDesc = new SFUInt32::Description(
196 SFUInt32::getClassType(),
197 "stencilMask",
198 "The stencilFunc defines how fragments which do not fulfill a certain\n"
199 "condition are handled. \n"
200 "See glStencilFunc() for details. GL_NONE is used to disable stencil.\n",
201 StencilMaskFieldId, StencilMaskFieldMask,
202 false,
203 (Field::SFDefaultFlags | Field::FStdAccess),
204 static_cast<FieldEditMethodSig>(&StencilChunk::editHandleStencilMask),
205 static_cast<FieldGetMethodSig >(&StencilChunk::getHandleStencilMask));
207 oType.addInitialDesc(pDesc);
209 pDesc = new SFGLenum::Description(
210 SFGLenum::getClassType(),
211 "stencilOpFail",
212 "The stencilFunc defines how fragments which do not fulfill a certain\n"
213 "condition are handled. \n"
214 "See glStencilFunc() for details. GL_NONE is used to disable stencil.\n",
215 StencilOpFailFieldId, StencilOpFailFieldMask,
216 false,
217 (Field::SFDefaultFlags | Field::FStdAccess),
218 static_cast<FieldEditMethodSig>(&StencilChunk::editHandleStencilOpFail),
219 static_cast<FieldGetMethodSig >(&StencilChunk::getHandleStencilOpFail));
221 oType.addInitialDesc(pDesc);
223 pDesc = new SFGLenum::Description(
224 SFGLenum::getClassType(),
225 "stencilOpZFail",
226 "The stencilFunc defines how fragments which do not fulfill a certain\n"
227 "condition are handled. \n"
228 "See glStencilFunc() for details. GL_NONE is used to disable stencil.\n",
229 StencilOpZFailFieldId, StencilOpZFailFieldMask,
230 false,
231 (Field::SFDefaultFlags | Field::FStdAccess),
232 static_cast<FieldEditMethodSig>(&StencilChunk::editHandleStencilOpZFail),
233 static_cast<FieldGetMethodSig >(&StencilChunk::getHandleStencilOpZFail));
235 oType.addInitialDesc(pDesc);
237 pDesc = new SFGLenum::Description(
238 SFGLenum::getClassType(),
239 "stencilOpZPass",
240 "The stencilFunc defines how fragments which do not fulfill a certain\n"
241 "condition are handled. \n"
242 "See glStencilFunc() for details. GL_NONE is used to disable stencil.\n",
243 StencilOpZPassFieldId, StencilOpZPassFieldMask,
244 false,
245 (Field::SFDefaultFlags | Field::FStdAccess),
246 static_cast<FieldEditMethodSig>(&StencilChunk::editHandleStencilOpZPass),
247 static_cast<FieldGetMethodSig >(&StencilChunk::getHandleStencilOpZPass));
249 oType.addInitialDesc(pDesc);
251 pDesc = new SFInt32::Description(
252 SFInt32::getClassType(),
253 "clearBuffer",
254 "Clear buffer on activate(1) or deactivate(2).\n",
255 ClearBufferFieldId, ClearBufferFieldMask,
256 false,
257 (Field::SFDefaultFlags | Field::FStdAccess),
258 static_cast<FieldEditMethodSig>(&StencilChunk::editHandleClearBuffer),
259 static_cast<FieldGetMethodSig >(&StencilChunk::getHandleClearBuffer));
261 oType.addInitialDesc(pDesc);
263 pDesc = new SFUInt32::Description(
264 SFUInt32::getClassType(),
265 "bitMask",
266 "Controls writing of individual bits in stencil planes, with 0 means write\n"
267 "protected and 1 write enabled.\n",
268 BitMaskFieldId, BitMaskFieldMask,
269 false,
270 (Field::SFDefaultFlags | Field::FStdAccess),
271 static_cast<FieldEditMethodSig>(&StencilChunk::editHandleBitMask),
272 static_cast<FieldGetMethodSig >(&StencilChunk::getHandleBitMask));
274 oType.addInitialDesc(pDesc);
278 StencilChunkBase::TypeObject StencilChunkBase::_type(
279 StencilChunkBase::getClassname(),
280 Inherited::getClassname(),
281 "NULL",
282 nsOSG, //Namespace
283 reinterpret_cast<PrototypeCreateF>(&StencilChunkBase::createEmptyLocal),
284 reinterpret_cast<InitContainerF>(&StencilChunk::initMethod),
285 reinterpret_cast<ExitContainerF>(&StencilChunk::exitMethod),
286 reinterpret_cast<InitalInsertDescFunc>(
287 reinterpret_cast<void *>(&StencilChunk::classDescInserter)),
288 false,
290 "<?xml version=\"1.0\"?>\n"
291 "\n"
292 "<FieldContainer\n"
293 " name=\"StencilChunk\"\n"
294 " parent=\"StateChunk\"\n"
295 " library=\"State\"\n"
296 " pointerfieldtypes=\"both\"\n"
297 " structure=\"concrete\"\n"
298 " systemcomponent=\"true\"\n"
299 " parentsystemcomponent=\"true\"\n"
300 " decoratable=\"false\"\n"
301 " useLocalIncludes=\"false\"\n"
302 " docGroupBase=\"GrpStateOpenGL\"\n"
303 " >\n"
304 " The stencil chunk handles OpenGL stencil tests by wrapping glStencilFunc()\n"
305 " and glStencilOp(). \n"
306 " <Field\n"
307 "\t name=\"stencilFunc\"\n"
308 "\t type=\"GLenum\"\n"
309 "\t cardinality=\"single\"\n"
310 "\t visibility=\"external\"\n"
311 "\t defaultValue=\"GL_NONE\"\n"
312 "\t defaultHeader=\"OSGGL.h\"\n"
313 "\t access=\"public\"\n"
314 "\t >\n"
315 "\tThe stencilFunc defines how fragments which do not fulfill a certain\n"
316 "\tcondition are handled. \n"
317 " See glStencilFunc() for details. GL_NONE is used to disable stencil.\n"
318 " </Field>\n"
319 " <Field\n"
320 "\t name=\"stencilValue\"\n"
321 "\t type=\"Int32\"\n"
322 "\t cardinality=\"single\"\n"
323 "\t visibility=\"external\"\n"
324 "\t defaultValue=\"0\"\n"
325 "\t access=\"public\"\n"
326 "\t >\n"
327 "\tThe stencilFunc defines how fragments which do not fulfill a certain\n"
328 "\tcondition are handled. \n"
329 " See glStencilFunc() for details. GL_NONE is used to disable stencil.\n"
330 " </Field>\n"
331 " <Field\n"
332 "\t name=\"stencilMask\"\n"
333 "\t type=\"UInt32\"\n"
334 "\t cardinality=\"single\"\n"
335 "\t visibility=\"external\"\n"
336 "\t defaultValue=\"0x1\"\n"
337 "\t access=\"public\"\n"
338 "\t >\n"
339 "\tThe stencilFunc defines how fragments which do not fulfill a certain\n"
340 "\tcondition are handled. \n"
341 " See glStencilFunc() for details. GL_NONE is used to disable stencil.\n"
342 " </Field>\n"
343 " <Field\n"
344 "\t name=\"stencilOpFail\"\n"
345 "\t type=\"GLenum\"\n"
346 "\t cardinality=\"single\"\n"
347 "\t visibility=\"external\"\n"
348 "\t defaultValue=\"GL_KEEP\"\n"
349 "\t defaultHeader=\"OSGGL.h\"\n"
350 "\t access=\"public\"\n"
351 "\t >\n"
352 "\tThe stencilFunc defines how fragments which do not fulfill a certain\n"
353 "\tcondition are handled. \n"
354 " See glStencilFunc() for details. GL_NONE is used to disable stencil.\n"
355 " </Field>\n"
356 " <Field\n"
357 "\t name=\"stencilOpZFail\"\n"
358 "\t type=\"GLenum\"\n"
359 "\t cardinality=\"single\"\n"
360 "\t visibility=\"external\"\n"
361 "\t defaultValue=\"GL_KEEP\"\n"
362 "\t defaultHeader=\"OSGGL.h\"\n"
363 "\t access=\"public\"\n"
364 "\t >\n"
365 "\tThe stencilFunc defines how fragments which do not fulfill a certain\n"
366 "\tcondition are handled. \n"
367 " See glStencilFunc() for details. GL_NONE is used to disable stencil.\n"
368 " </Field>\n"
369 " <Field\n"
370 "\t name=\"stencilOpZPass\"\n"
371 "\t type=\"GLenum\"\n"
372 "\t cardinality=\"single\"\n"
373 "\t visibility=\"external\"\n"
374 "\t defaultValue=\"GL_KEEP\"\n"
375 "\t defaultHeader=\"OSGGL.h\"\n"
376 "\t access=\"public\"\n"
377 "\t >\n"
378 "\tThe stencilFunc defines how fragments which do not fulfill a certain\n"
379 "\tcondition are handled. \n"
380 " See glStencilFunc() for details. GL_NONE is used to disable stencil.\n"
381 " </Field>\n"
382 " <Field\n"
383 "\t name=\"clearBuffer\"\n"
384 "\t type=\"Int32\"\n"
385 "\t cardinality=\"single\"\n"
386 "\t visibility=\"external\"\n"
387 "\t defaultValue=\"0\"\n"
388 "\t access=\"public\"\n"
389 "\t >\n"
390 "\tClear buffer on activate(1) or deactivate(2).\n"
391 " </Field>\n"
392 " <Field\n"
393 "\t name=\"bitMask\"\n"
394 "\t type=\"UInt32\"\n"
395 "\t cardinality=\"single\"\n"
396 "\t visibility=\"external\"\n"
397 "\t defaultValue=\"0xFFFFFFFF\"\n"
398 "\t access=\"public\"\n"
399 "\t >\n"
400 "\tControls writing of individual bits in stencil planes, with 0 means write\n"
401 "\tprotected and 1 write enabled.\n"
402 " </Field>\n"
403 "</FieldContainer>\n",
404 "The stencil chunk handles OpenGL stencil tests by wrapping glStencilFunc()\n"
405 "and glStencilOp(). \n"
408 /*------------------------------ get -----------------------------------*/
410 FieldContainerType &StencilChunkBase::getType(void)
412 return _type;
415 const FieldContainerType &StencilChunkBase::getType(void) const
417 return _type;
420 UInt32 StencilChunkBase::getContainerSize(void) const
422 return sizeof(StencilChunk);
425 /*------------------------- decorator get ------------------------------*/
428 SFGLenum *StencilChunkBase::editSFStencilFunc(void)
430 editSField(StencilFuncFieldMask);
432 return &_sfStencilFunc;
435 const SFGLenum *StencilChunkBase::getSFStencilFunc(void) const
437 return &_sfStencilFunc;
441 SFInt32 *StencilChunkBase::editSFStencilValue(void)
443 editSField(StencilValueFieldMask);
445 return &_sfStencilValue;
448 const SFInt32 *StencilChunkBase::getSFStencilValue(void) const
450 return &_sfStencilValue;
454 SFUInt32 *StencilChunkBase::editSFStencilMask(void)
456 editSField(StencilMaskFieldMask);
458 return &_sfStencilMask;
461 const SFUInt32 *StencilChunkBase::getSFStencilMask(void) const
463 return &_sfStencilMask;
467 SFGLenum *StencilChunkBase::editSFStencilOpFail(void)
469 editSField(StencilOpFailFieldMask);
471 return &_sfStencilOpFail;
474 const SFGLenum *StencilChunkBase::getSFStencilOpFail(void) const
476 return &_sfStencilOpFail;
480 SFGLenum *StencilChunkBase::editSFStencilOpZFail(void)
482 editSField(StencilOpZFailFieldMask);
484 return &_sfStencilOpZFail;
487 const SFGLenum *StencilChunkBase::getSFStencilOpZFail(void) const
489 return &_sfStencilOpZFail;
493 SFGLenum *StencilChunkBase::editSFStencilOpZPass(void)
495 editSField(StencilOpZPassFieldMask);
497 return &_sfStencilOpZPass;
500 const SFGLenum *StencilChunkBase::getSFStencilOpZPass(void) const
502 return &_sfStencilOpZPass;
506 SFInt32 *StencilChunkBase::editSFClearBuffer(void)
508 editSField(ClearBufferFieldMask);
510 return &_sfClearBuffer;
513 const SFInt32 *StencilChunkBase::getSFClearBuffer(void) const
515 return &_sfClearBuffer;
519 SFUInt32 *StencilChunkBase::editSFBitMask(void)
521 editSField(BitMaskFieldMask);
523 return &_sfBitMask;
526 const SFUInt32 *StencilChunkBase::getSFBitMask(void) const
528 return &_sfBitMask;
536 /*------------------------------ access -----------------------------------*/
538 SizeT StencilChunkBase::getBinSize(ConstFieldMaskArg whichField)
540 SizeT returnValue = Inherited::getBinSize(whichField);
542 if(FieldBits::NoField != (StencilFuncFieldMask & whichField))
544 returnValue += _sfStencilFunc.getBinSize();
546 if(FieldBits::NoField != (StencilValueFieldMask & whichField))
548 returnValue += _sfStencilValue.getBinSize();
550 if(FieldBits::NoField != (StencilMaskFieldMask & whichField))
552 returnValue += _sfStencilMask.getBinSize();
554 if(FieldBits::NoField != (StencilOpFailFieldMask & whichField))
556 returnValue += _sfStencilOpFail.getBinSize();
558 if(FieldBits::NoField != (StencilOpZFailFieldMask & whichField))
560 returnValue += _sfStencilOpZFail.getBinSize();
562 if(FieldBits::NoField != (StencilOpZPassFieldMask & whichField))
564 returnValue += _sfStencilOpZPass.getBinSize();
566 if(FieldBits::NoField != (ClearBufferFieldMask & whichField))
568 returnValue += _sfClearBuffer.getBinSize();
570 if(FieldBits::NoField != (BitMaskFieldMask & whichField))
572 returnValue += _sfBitMask.getBinSize();
575 return returnValue;
578 void StencilChunkBase::copyToBin(BinaryDataHandler &pMem,
579 ConstFieldMaskArg whichField)
581 Inherited::copyToBin(pMem, whichField);
583 if(FieldBits::NoField != (StencilFuncFieldMask & whichField))
585 _sfStencilFunc.copyToBin(pMem);
587 if(FieldBits::NoField != (StencilValueFieldMask & whichField))
589 _sfStencilValue.copyToBin(pMem);
591 if(FieldBits::NoField != (StencilMaskFieldMask & whichField))
593 _sfStencilMask.copyToBin(pMem);
595 if(FieldBits::NoField != (StencilOpFailFieldMask & whichField))
597 _sfStencilOpFail.copyToBin(pMem);
599 if(FieldBits::NoField != (StencilOpZFailFieldMask & whichField))
601 _sfStencilOpZFail.copyToBin(pMem);
603 if(FieldBits::NoField != (StencilOpZPassFieldMask & whichField))
605 _sfStencilOpZPass.copyToBin(pMem);
607 if(FieldBits::NoField != (ClearBufferFieldMask & whichField))
609 _sfClearBuffer.copyToBin(pMem);
611 if(FieldBits::NoField != (BitMaskFieldMask & whichField))
613 _sfBitMask.copyToBin(pMem);
617 void StencilChunkBase::copyFromBin(BinaryDataHandler &pMem,
618 ConstFieldMaskArg whichField)
620 Inherited::copyFromBin(pMem, whichField);
622 if(FieldBits::NoField != (StencilFuncFieldMask & whichField))
624 editSField(StencilFuncFieldMask);
625 _sfStencilFunc.copyFromBin(pMem);
627 if(FieldBits::NoField != (StencilValueFieldMask & whichField))
629 editSField(StencilValueFieldMask);
630 _sfStencilValue.copyFromBin(pMem);
632 if(FieldBits::NoField != (StencilMaskFieldMask & whichField))
634 editSField(StencilMaskFieldMask);
635 _sfStencilMask.copyFromBin(pMem);
637 if(FieldBits::NoField != (StencilOpFailFieldMask & whichField))
639 editSField(StencilOpFailFieldMask);
640 _sfStencilOpFail.copyFromBin(pMem);
642 if(FieldBits::NoField != (StencilOpZFailFieldMask & whichField))
644 editSField(StencilOpZFailFieldMask);
645 _sfStencilOpZFail.copyFromBin(pMem);
647 if(FieldBits::NoField != (StencilOpZPassFieldMask & whichField))
649 editSField(StencilOpZPassFieldMask);
650 _sfStencilOpZPass.copyFromBin(pMem);
652 if(FieldBits::NoField != (ClearBufferFieldMask & whichField))
654 editSField(ClearBufferFieldMask);
655 _sfClearBuffer.copyFromBin(pMem);
657 if(FieldBits::NoField != (BitMaskFieldMask & whichField))
659 editSField(BitMaskFieldMask);
660 _sfBitMask.copyFromBin(pMem);
664 //! create a new instance of the class
665 StencilChunkTransitPtr StencilChunkBase::createLocal(BitVector bFlags)
667 StencilChunkTransitPtr fc;
669 if(getClassType().getPrototype() != NULL)
671 FieldContainerTransitPtr tmpPtr =
672 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
674 fc = dynamic_pointer_cast<StencilChunk>(tmpPtr);
677 return fc;
680 //! create a new instance of the class, copy the container flags
681 StencilChunkTransitPtr StencilChunkBase::createDependent(BitVector bFlags)
683 StencilChunkTransitPtr fc;
685 if(getClassType().getPrototype() != NULL)
687 FieldContainerTransitPtr tmpPtr =
688 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
690 fc = dynamic_pointer_cast<StencilChunk>(tmpPtr);
693 return fc;
696 //! create a new instance of the class
697 StencilChunkTransitPtr StencilChunkBase::create(void)
699 StencilChunkTransitPtr fc;
701 if(getClassType().getPrototype() != NULL)
703 FieldContainerTransitPtr tmpPtr =
704 getClassType().getPrototype()-> shallowCopy();
706 fc = dynamic_pointer_cast<StencilChunk>(tmpPtr);
709 return fc;
712 StencilChunk *StencilChunkBase::createEmptyLocal(BitVector bFlags)
714 StencilChunk *returnValue;
716 newPtr<StencilChunk>(returnValue, bFlags);
718 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
720 return returnValue;
723 //! create an empty new instance of the class, do not copy the prototype
724 StencilChunk *StencilChunkBase::createEmpty(void)
726 StencilChunk *returnValue;
728 newPtr<StencilChunk>(returnValue, Thread::getCurrentLocalFlags());
730 returnValue->_pFieldFlags->_bNamespaceMask &=
731 ~Thread::getCurrentLocalFlags();
733 return returnValue;
737 FieldContainerTransitPtr StencilChunkBase::shallowCopyLocal(
738 BitVector bFlags) const
740 StencilChunk *tmpPtr;
742 newPtr(tmpPtr, dynamic_cast<const StencilChunk *>(this), bFlags);
744 FieldContainerTransitPtr returnValue(tmpPtr);
746 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
748 return returnValue;
751 FieldContainerTransitPtr StencilChunkBase::shallowCopyDependent(
752 BitVector bFlags) const
754 StencilChunk *tmpPtr;
756 newPtr(tmpPtr, dynamic_cast<const StencilChunk *>(this), ~bFlags);
758 FieldContainerTransitPtr returnValue(tmpPtr);
760 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
762 return returnValue;
765 FieldContainerTransitPtr StencilChunkBase::shallowCopy(void) const
767 StencilChunk *tmpPtr;
769 newPtr(tmpPtr,
770 dynamic_cast<const StencilChunk *>(this),
771 Thread::getCurrentLocalFlags());
773 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
775 FieldContainerTransitPtr returnValue(tmpPtr);
777 return returnValue;
783 /*------------------------- constructors ----------------------------------*/
785 StencilChunkBase::StencilChunkBase(void) :
786 Inherited(),
787 _sfStencilFunc (GLenum(GL_NONE)),
788 _sfStencilValue (Int32(0)),
789 _sfStencilMask (UInt32(0x1)),
790 _sfStencilOpFail (GLenum(GL_KEEP)),
791 _sfStencilOpZFail (GLenum(GL_KEEP)),
792 _sfStencilOpZPass (GLenum(GL_KEEP)),
793 _sfClearBuffer (Int32(0)),
794 _sfBitMask (UInt32(0xFFFFFFFF))
798 StencilChunkBase::StencilChunkBase(const StencilChunkBase &source) :
799 Inherited(source),
800 _sfStencilFunc (source._sfStencilFunc ),
801 _sfStencilValue (source._sfStencilValue ),
802 _sfStencilMask (source._sfStencilMask ),
803 _sfStencilOpFail (source._sfStencilOpFail ),
804 _sfStencilOpZFail (source._sfStencilOpZFail ),
805 _sfStencilOpZPass (source._sfStencilOpZPass ),
806 _sfClearBuffer (source._sfClearBuffer ),
807 _sfBitMask (source._sfBitMask )
812 /*-------------------------- destructors ----------------------------------*/
814 StencilChunkBase::~StencilChunkBase(void)
819 GetFieldHandlePtr StencilChunkBase::getHandleStencilFunc (void) const
821 SFGLenum::GetHandlePtr returnValue(
822 new SFGLenum::GetHandle(
823 &_sfStencilFunc,
824 this->getType().getFieldDesc(StencilFuncFieldId),
825 const_cast<StencilChunkBase *>(this)));
827 return returnValue;
830 EditFieldHandlePtr StencilChunkBase::editHandleStencilFunc (void)
832 SFGLenum::EditHandlePtr returnValue(
833 new SFGLenum::EditHandle(
834 &_sfStencilFunc,
835 this->getType().getFieldDesc(StencilFuncFieldId),
836 this));
839 editSField(StencilFuncFieldMask);
841 return returnValue;
844 GetFieldHandlePtr StencilChunkBase::getHandleStencilValue (void) const
846 SFInt32::GetHandlePtr returnValue(
847 new SFInt32::GetHandle(
848 &_sfStencilValue,
849 this->getType().getFieldDesc(StencilValueFieldId),
850 const_cast<StencilChunkBase *>(this)));
852 return returnValue;
855 EditFieldHandlePtr StencilChunkBase::editHandleStencilValue (void)
857 SFInt32::EditHandlePtr returnValue(
858 new SFInt32::EditHandle(
859 &_sfStencilValue,
860 this->getType().getFieldDesc(StencilValueFieldId),
861 this));
864 editSField(StencilValueFieldMask);
866 return returnValue;
869 GetFieldHandlePtr StencilChunkBase::getHandleStencilMask (void) const
871 SFUInt32::GetHandlePtr returnValue(
872 new SFUInt32::GetHandle(
873 &_sfStencilMask,
874 this->getType().getFieldDesc(StencilMaskFieldId),
875 const_cast<StencilChunkBase *>(this)));
877 return returnValue;
880 EditFieldHandlePtr StencilChunkBase::editHandleStencilMask (void)
882 SFUInt32::EditHandlePtr returnValue(
883 new SFUInt32::EditHandle(
884 &_sfStencilMask,
885 this->getType().getFieldDesc(StencilMaskFieldId),
886 this));
889 editSField(StencilMaskFieldMask);
891 return returnValue;
894 GetFieldHandlePtr StencilChunkBase::getHandleStencilOpFail (void) const
896 SFGLenum::GetHandlePtr returnValue(
897 new SFGLenum::GetHandle(
898 &_sfStencilOpFail,
899 this->getType().getFieldDesc(StencilOpFailFieldId),
900 const_cast<StencilChunkBase *>(this)));
902 return returnValue;
905 EditFieldHandlePtr StencilChunkBase::editHandleStencilOpFail (void)
907 SFGLenum::EditHandlePtr returnValue(
908 new SFGLenum::EditHandle(
909 &_sfStencilOpFail,
910 this->getType().getFieldDesc(StencilOpFailFieldId),
911 this));
914 editSField(StencilOpFailFieldMask);
916 return returnValue;
919 GetFieldHandlePtr StencilChunkBase::getHandleStencilOpZFail (void) const
921 SFGLenum::GetHandlePtr returnValue(
922 new SFGLenum::GetHandle(
923 &_sfStencilOpZFail,
924 this->getType().getFieldDesc(StencilOpZFailFieldId),
925 const_cast<StencilChunkBase *>(this)));
927 return returnValue;
930 EditFieldHandlePtr StencilChunkBase::editHandleStencilOpZFail (void)
932 SFGLenum::EditHandlePtr returnValue(
933 new SFGLenum::EditHandle(
934 &_sfStencilOpZFail,
935 this->getType().getFieldDesc(StencilOpZFailFieldId),
936 this));
939 editSField(StencilOpZFailFieldMask);
941 return returnValue;
944 GetFieldHandlePtr StencilChunkBase::getHandleStencilOpZPass (void) const
946 SFGLenum::GetHandlePtr returnValue(
947 new SFGLenum::GetHandle(
948 &_sfStencilOpZPass,
949 this->getType().getFieldDesc(StencilOpZPassFieldId),
950 const_cast<StencilChunkBase *>(this)));
952 return returnValue;
955 EditFieldHandlePtr StencilChunkBase::editHandleStencilOpZPass (void)
957 SFGLenum::EditHandlePtr returnValue(
958 new SFGLenum::EditHandle(
959 &_sfStencilOpZPass,
960 this->getType().getFieldDesc(StencilOpZPassFieldId),
961 this));
964 editSField(StencilOpZPassFieldMask);
966 return returnValue;
969 GetFieldHandlePtr StencilChunkBase::getHandleClearBuffer (void) const
971 SFInt32::GetHandlePtr returnValue(
972 new SFInt32::GetHandle(
973 &_sfClearBuffer,
974 this->getType().getFieldDesc(ClearBufferFieldId),
975 const_cast<StencilChunkBase *>(this)));
977 return returnValue;
980 EditFieldHandlePtr StencilChunkBase::editHandleClearBuffer (void)
982 SFInt32::EditHandlePtr returnValue(
983 new SFInt32::EditHandle(
984 &_sfClearBuffer,
985 this->getType().getFieldDesc(ClearBufferFieldId),
986 this));
989 editSField(ClearBufferFieldMask);
991 return returnValue;
994 GetFieldHandlePtr StencilChunkBase::getHandleBitMask (void) const
996 SFUInt32::GetHandlePtr returnValue(
997 new SFUInt32::GetHandle(
998 &_sfBitMask,
999 this->getType().getFieldDesc(BitMaskFieldId),
1000 const_cast<StencilChunkBase *>(this)));
1002 return returnValue;
1005 EditFieldHandlePtr StencilChunkBase::editHandleBitMask (void)
1007 SFUInt32::EditHandlePtr returnValue(
1008 new SFUInt32::EditHandle(
1009 &_sfBitMask,
1010 this->getType().getFieldDesc(BitMaskFieldId),
1011 this));
1014 editSField(BitMaskFieldMask);
1016 return returnValue;
1020 #ifdef OSG_MT_CPTR_ASPECT
1021 void StencilChunkBase::execSyncV( FieldContainer &oFrom,
1022 ConstFieldMaskArg whichField,
1023 AspectOffsetStore &oOffsets,
1024 ConstFieldMaskArg syncMode,
1025 const UInt32 uiSyncInfo)
1027 StencilChunk *pThis = static_cast<StencilChunk *>(this);
1029 pThis->execSync(static_cast<StencilChunk *>(&oFrom),
1030 whichField,
1031 oOffsets,
1032 syncMode,
1033 uiSyncInfo);
1035 #endif
1038 #ifdef OSG_MT_CPTR_ASPECT
1039 FieldContainer *StencilChunkBase::createAspectCopy(
1040 const FieldContainer *pRefAspect) const
1042 StencilChunk *returnValue;
1044 newAspectCopy(returnValue,
1045 dynamic_cast<const StencilChunk *>(pRefAspect),
1046 dynamic_cast<const StencilChunk *>(this));
1048 return returnValue;
1050 #endif
1052 void StencilChunkBase::resolveLinks(void)
1054 Inherited::resolveLinks();
1060 OSG_END_NAMESPACE