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 FresnelMaterial!
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> // ColorMaterial default header
66 #include "OSGImage.h" // Image Class
68 #include "OSGFresnelMaterialBase.h"
69 #include "OSGFresnelMaterial.h"
71 #include <boost/bind.hpp>
75 /***************************************************************************\
77 \***************************************************************************/
79 /*! \class OSG::FresnelMaterial
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var Color3f FresnelMaterialBase::_sfAmbient
91 /*! \var Color3f FresnelMaterialBase::_sfDiffuse
95 /*! \var Color3f FresnelMaterialBase::_sfSpecular
99 /*! \var Real32 FresnelMaterialBase::_sfShininess
103 /*! \var Color3f FresnelMaterialBase::_sfEmission
107 /*! \var Real32 FresnelMaterialBase::_sfTransparency
111 /*! \var bool FresnelMaterialBase::_sfLit
115 /*! \var GLenum FresnelMaterialBase::_sfColorMaterial
119 /*! \var Real32 FresnelMaterialBase::_sfIndex
123 /*! \var Real32 FresnelMaterialBase::_sfScale
127 /*! \var Real32 FresnelMaterialBase::_sfBias
131 /*! \var Image * FresnelMaterialBase::_sfImage
136 /***************************************************************************\
137 * FieldType/FieldTrait Instantiation *
138 \***************************************************************************/
140 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
141 PointerType FieldTraits
<FresnelMaterial
*, nsOSG
>::_type(
142 "FresnelMaterialPtr",
144 FresnelMaterial::getClassType(),
148 OSG_FIELDTRAITS_GETTYPE_NS(FresnelMaterial
*, nsOSG
)
150 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
154 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
158 /***************************************************************************\
159 * Field Description *
160 \***************************************************************************/
162 void FresnelMaterialBase::classDescInserter(TypeObject
&oType
)
164 FieldDescriptionBase
*pDesc
= NULL
;
167 pDesc
= new SFColor3f::Description(
168 SFColor3f::getClassType(),
171 AmbientFieldId
, AmbientFieldMask
,
173 (Field::SFDefaultFlags
| Field::FStdAccess
),
174 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleAmbient
),
175 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleAmbient
));
177 oType
.addInitialDesc(pDesc
);
179 pDesc
= new SFColor3f::Description(
180 SFColor3f::getClassType(),
183 DiffuseFieldId
, DiffuseFieldMask
,
185 (Field::SFDefaultFlags
| Field::FStdAccess
),
186 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleDiffuse
),
187 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleDiffuse
));
189 oType
.addInitialDesc(pDesc
);
191 pDesc
= new SFColor3f::Description(
192 SFColor3f::getClassType(),
195 SpecularFieldId
, SpecularFieldMask
,
197 (Field::SFDefaultFlags
| Field::FStdAccess
),
198 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleSpecular
),
199 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleSpecular
));
201 oType
.addInitialDesc(pDesc
);
203 pDesc
= new SFReal32::Description(
204 SFReal32::getClassType(),
207 ShininessFieldId
, ShininessFieldMask
,
209 (Field::SFDefaultFlags
| Field::FStdAccess
),
210 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleShininess
),
211 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleShininess
));
213 oType
.addInitialDesc(pDesc
);
215 pDesc
= new SFColor3f::Description(
216 SFColor3f::getClassType(),
219 EmissionFieldId
, EmissionFieldMask
,
221 (Field::SFDefaultFlags
| Field::FStdAccess
),
222 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleEmission
),
223 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleEmission
));
225 oType
.addInitialDesc(pDesc
);
227 pDesc
= new SFReal32::Description(
228 SFReal32::getClassType(),
231 TransparencyFieldId
, TransparencyFieldMask
,
233 (Field::SFDefaultFlags
| Field::FStdAccess
),
234 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleTransparency
),
235 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleTransparency
));
237 oType
.addInitialDesc(pDesc
);
239 pDesc
= new SFBool::Description(
240 SFBool::getClassType(),
243 LitFieldId
, LitFieldMask
,
245 (Field::SFDefaultFlags
| Field::FStdAccess
),
246 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleLit
),
247 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleLit
));
249 oType
.addInitialDesc(pDesc
);
251 pDesc
= new SFGLenum::Description(
252 SFGLenum::getClassType(),
255 ColorMaterialFieldId
, ColorMaterialFieldMask
,
257 (Field::SFDefaultFlags
| Field::FStdAccess
),
258 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleColorMaterial
),
259 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleColorMaterial
));
261 oType
.addInitialDesc(pDesc
);
263 pDesc
= new SFReal32::Description(
264 SFReal32::getClassType(),
267 IndexFieldId
, IndexFieldMask
,
269 (Field::SFDefaultFlags
| Field::FStdAccess
),
270 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleIndex
),
271 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleIndex
));
273 oType
.addInitialDesc(pDesc
);
275 pDesc
= new SFReal32::Description(
276 SFReal32::getClassType(),
279 ScaleFieldId
, ScaleFieldMask
,
281 (Field::SFDefaultFlags
| Field::FStdAccess
),
282 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleScale
),
283 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleScale
));
285 oType
.addInitialDesc(pDesc
);
287 pDesc
= new SFReal32::Description(
288 SFReal32::getClassType(),
291 BiasFieldId
, BiasFieldMask
,
293 (Field::SFDefaultFlags
| Field::FStdAccess
),
294 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleBias
),
295 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleBias
));
297 oType
.addInitialDesc(pDesc
);
299 pDesc
= new SFUnrecImagePtr::Description(
300 SFUnrecImagePtr::getClassType(),
303 ImageFieldId
, ImageFieldMask
,
305 (Field::SFDefaultFlags
| Field::FStdAccess
),
306 static_cast<FieldEditMethodSig
>(&FresnelMaterial::editHandleImage
),
307 static_cast<FieldGetMethodSig
>(&FresnelMaterial::getHandleImage
));
309 oType
.addInitialDesc(pDesc
);
313 FresnelMaterialBase::TypeObject
FresnelMaterialBase::_type(
314 FresnelMaterialBase::getClassname(),
315 Inherited::getClassname(),
318 reinterpret_cast<PrototypeCreateF
>(&FresnelMaterialBase::createEmptyLocal
),
319 reinterpret_cast<InitContainerF
>(&FresnelMaterial::initMethod
),
320 reinterpret_cast<ExitContainerF
>(&FresnelMaterial::exitMethod
),
321 reinterpret_cast<InitalInsertDescFunc
>(
322 reinterpret_cast<void *>(&FresnelMaterial::classDescInserter
)),
325 "<?xml version=\"1.0\"?>\n"
328 "\tname=\"FresnelMaterial\"\n"
329 "\tparent=\"ChunkMaterial\"\n"
330 "\tlibrary=\"Drawable\"\n"
331 "\tpointerfieldtypes=\"both\"\n"
332 "\tstructure=\"concrete\"\n"
333 "\tsystemcomponent=\"true\"\n"
334 "\tparentsystemcomponent=\"true\"\n"
335 "\tdecoratable=\"false\"\n"
336 " docGroupBase=\"GrpDrawablesMaterial\"\n"
339 "\t name=\"ambient\"\n"
340 "\t type=\"Color3f\"\n"
341 "\t cardinality=\"single\"\n"
342 "\t visibility=\"external\"\n"
343 "\t defaultValue=\"0,0,0\"\n"
344 "\t access=\"public\"\n"
348 "\t name=\"diffuse\"\n"
349 "\t type=\"Color3f\"\n"
350 "\t cardinality=\"single\"\n"
351 "\t visibility=\"external\"\n"
352 "\t defaultValue=\"0,0,0\"\n"
353 "\t access=\"public\"\n"
357 "\t name=\"specular\"\n"
358 "\t type=\"Color3f\"\n"
359 "\t cardinality=\"single\"\n"
360 "\t visibility=\"external\"\n"
361 "\t defaultValue=\"0,0,0\"\n"
362 "\t access=\"public\"\n"
366 "\t name=\"shininess\"\n"
367 "\t type=\"Real32\"\n"
368 "\t cardinality=\"single\"\n"
369 "\t visibility=\"external\"\n"
370 "\t defaultValue=\"1\"\n"
371 "\t access=\"public\"\n"
375 "\t name=\"emission\"\n"
376 "\t type=\"Color3f\"\n"
377 "\t cardinality=\"single\"\n"
378 "\t visibility=\"external\"\n"
379 "\t defaultValue=\"0,0,0\"\n"
380 "\t access=\"public\"\n"
384 "\t name=\"transparency\"\n"
385 "\t type=\"Real32\"\n"
386 "\t cardinality=\"single\"\n"
387 "\t visibility=\"external\"\n"
388 "\t defaultValue=\"0\"\n"
389 "\t access=\"public\"\n"
395 "\t cardinality=\"single\"\n"
396 "\t visibility=\"external\"\n"
397 "\t defaultValue=\"true\"\n"
398 "\t access=\"public\"\n"
402 "\t name=\"colorMaterial\"\n"
403 "\t type=\"GLenum\"\n"
404 "\t cardinality=\"single\"\n"
405 "\t visibility=\"external\"\n"
406 "\t defaultValue=\"GL_DIFFUSE\"\n"
407 "\t defaultHeader=\"<OSGGL.h>\"\n"
408 "\t access=\"public\"\n"
412 "\t name=\"index\"\n"
413 "\t type=\"Real32\"\n"
414 "\t cardinality=\"single\"\n"
415 "\t visibility=\"external\"\n"
416 "\t defaultValue=\"0\"\n"
417 "\t access=\"public\"\n"
421 "\t name=\"scale\"\n"
422 "\t type=\"Real32\"\n"
423 "\t cardinality=\"single\"\n"
424 "\t visibility=\"external\"\n"
425 "\t defaultValue=\"1\"\n"
426 "\t access=\"public\"\n"
431 "\t type=\"Real32\"\n"
432 "\t cardinality=\"single\"\n"
433 "\t visibility=\"external\"\n"
434 "\t defaultValue=\"1\"\n"
435 "\t access=\"public\"\n"
439 "\t name=\"image\"\n"
440 "\t type=\"ImagePtr\"\n"
441 "\t cardinality=\"single\"\n"
442 "\t visibility=\"external\"\n"
443 "\t access=\"public\"\n"
446 "</FieldContainer>\n",
450 /*------------------------------ get -----------------------------------*/
452 FieldContainerType
&FresnelMaterialBase::getType(void)
457 const FieldContainerType
&FresnelMaterialBase::getType(void) const
462 UInt32
FresnelMaterialBase::getContainerSize(void) const
464 return sizeof(FresnelMaterial
);
467 /*------------------------- decorator get ------------------------------*/
470 SFColor3f
*FresnelMaterialBase::editSFAmbient(void)
472 editSField(AmbientFieldMask
);
477 const SFColor3f
*FresnelMaterialBase::getSFAmbient(void) const
483 SFColor3f
*FresnelMaterialBase::editSFDiffuse(void)
485 editSField(DiffuseFieldMask
);
490 const SFColor3f
*FresnelMaterialBase::getSFDiffuse(void) const
496 SFColor3f
*FresnelMaterialBase::editSFSpecular(void)
498 editSField(SpecularFieldMask
);
503 const SFColor3f
*FresnelMaterialBase::getSFSpecular(void) const
509 SFReal32
*FresnelMaterialBase::editSFShininess(void)
511 editSField(ShininessFieldMask
);
513 return &_sfShininess
;
516 const SFReal32
*FresnelMaterialBase::getSFShininess(void) const
518 return &_sfShininess
;
522 SFColor3f
*FresnelMaterialBase::editSFEmission(void)
524 editSField(EmissionFieldMask
);
529 const SFColor3f
*FresnelMaterialBase::getSFEmission(void) const
535 SFReal32
*FresnelMaterialBase::editSFTransparency(void)
537 editSField(TransparencyFieldMask
);
539 return &_sfTransparency
;
542 const SFReal32
*FresnelMaterialBase::getSFTransparency(void) const
544 return &_sfTransparency
;
548 SFBool
*FresnelMaterialBase::editSFLit(void)
550 editSField(LitFieldMask
);
555 const SFBool
*FresnelMaterialBase::getSFLit(void) const
561 SFGLenum
*FresnelMaterialBase::editSFColorMaterial(void)
563 editSField(ColorMaterialFieldMask
);
565 return &_sfColorMaterial
;
568 const SFGLenum
*FresnelMaterialBase::getSFColorMaterial(void) const
570 return &_sfColorMaterial
;
574 SFReal32
*FresnelMaterialBase::editSFIndex(void)
576 editSField(IndexFieldMask
);
581 const SFReal32
*FresnelMaterialBase::getSFIndex(void) const
587 SFReal32
*FresnelMaterialBase::editSFScale(void)
589 editSField(ScaleFieldMask
);
594 const SFReal32
*FresnelMaterialBase::getSFScale(void) const
600 SFReal32
*FresnelMaterialBase::editSFBias(void)
602 editSField(BiasFieldMask
);
607 const SFReal32
*FresnelMaterialBase::getSFBias(void) const
613 //! Get the FresnelMaterial::_sfImage field.
614 const SFUnrecImagePtr
*FresnelMaterialBase::getSFImage(void) const
619 SFUnrecImagePtr
*FresnelMaterialBase::editSFImage (void)
621 editSField(ImageFieldMask
);
626 //! Get the value of the FresnelMaterial::_sfImage field.
627 Image
* FresnelMaterialBase::getImage(void) const
629 return _sfImage
.getValue();
632 //! Set the value of the FresnelMaterial::_sfImage field.
633 void FresnelMaterialBase::setImage(Image
* const value
)
635 editSField(ImageFieldMask
);
637 _sfImage
.setValue(value
);
645 /*------------------------------ access -----------------------------------*/
647 SizeT
FresnelMaterialBase::getBinSize(ConstFieldMaskArg whichField
)
649 SizeT returnValue
= Inherited::getBinSize(whichField
);
651 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
653 returnValue
+= _sfAmbient
.getBinSize();
655 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
657 returnValue
+= _sfDiffuse
.getBinSize();
659 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
661 returnValue
+= _sfSpecular
.getBinSize();
663 if(FieldBits::NoField
!= (ShininessFieldMask
& whichField
))
665 returnValue
+= _sfShininess
.getBinSize();
667 if(FieldBits::NoField
!= (EmissionFieldMask
& whichField
))
669 returnValue
+= _sfEmission
.getBinSize();
671 if(FieldBits::NoField
!= (TransparencyFieldMask
& whichField
))
673 returnValue
+= _sfTransparency
.getBinSize();
675 if(FieldBits::NoField
!= (LitFieldMask
& whichField
))
677 returnValue
+= _sfLit
.getBinSize();
679 if(FieldBits::NoField
!= (ColorMaterialFieldMask
& whichField
))
681 returnValue
+= _sfColorMaterial
.getBinSize();
683 if(FieldBits::NoField
!= (IndexFieldMask
& whichField
))
685 returnValue
+= _sfIndex
.getBinSize();
687 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
689 returnValue
+= _sfScale
.getBinSize();
691 if(FieldBits::NoField
!= (BiasFieldMask
& whichField
))
693 returnValue
+= _sfBias
.getBinSize();
695 if(FieldBits::NoField
!= (ImageFieldMask
& whichField
))
697 returnValue
+= _sfImage
.getBinSize();
703 void FresnelMaterialBase::copyToBin(BinaryDataHandler
&pMem
,
704 ConstFieldMaskArg whichField
)
706 Inherited::copyToBin(pMem
, whichField
);
708 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
710 _sfAmbient
.copyToBin(pMem
);
712 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
714 _sfDiffuse
.copyToBin(pMem
);
716 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
718 _sfSpecular
.copyToBin(pMem
);
720 if(FieldBits::NoField
!= (ShininessFieldMask
& whichField
))
722 _sfShininess
.copyToBin(pMem
);
724 if(FieldBits::NoField
!= (EmissionFieldMask
& whichField
))
726 _sfEmission
.copyToBin(pMem
);
728 if(FieldBits::NoField
!= (TransparencyFieldMask
& whichField
))
730 _sfTransparency
.copyToBin(pMem
);
732 if(FieldBits::NoField
!= (LitFieldMask
& whichField
))
734 _sfLit
.copyToBin(pMem
);
736 if(FieldBits::NoField
!= (ColorMaterialFieldMask
& whichField
))
738 _sfColorMaterial
.copyToBin(pMem
);
740 if(FieldBits::NoField
!= (IndexFieldMask
& whichField
))
742 _sfIndex
.copyToBin(pMem
);
744 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
746 _sfScale
.copyToBin(pMem
);
748 if(FieldBits::NoField
!= (BiasFieldMask
& whichField
))
750 _sfBias
.copyToBin(pMem
);
752 if(FieldBits::NoField
!= (ImageFieldMask
& whichField
))
754 _sfImage
.copyToBin(pMem
);
758 void FresnelMaterialBase::copyFromBin(BinaryDataHandler
&pMem
,
759 ConstFieldMaskArg whichField
)
761 Inherited::copyFromBin(pMem
, whichField
);
763 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
765 editSField(AmbientFieldMask
);
766 _sfAmbient
.copyFromBin(pMem
);
768 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
770 editSField(DiffuseFieldMask
);
771 _sfDiffuse
.copyFromBin(pMem
);
773 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
775 editSField(SpecularFieldMask
);
776 _sfSpecular
.copyFromBin(pMem
);
778 if(FieldBits::NoField
!= (ShininessFieldMask
& whichField
))
780 editSField(ShininessFieldMask
);
781 _sfShininess
.copyFromBin(pMem
);
783 if(FieldBits::NoField
!= (EmissionFieldMask
& whichField
))
785 editSField(EmissionFieldMask
);
786 _sfEmission
.copyFromBin(pMem
);
788 if(FieldBits::NoField
!= (TransparencyFieldMask
& whichField
))
790 editSField(TransparencyFieldMask
);
791 _sfTransparency
.copyFromBin(pMem
);
793 if(FieldBits::NoField
!= (LitFieldMask
& whichField
))
795 editSField(LitFieldMask
);
796 _sfLit
.copyFromBin(pMem
);
798 if(FieldBits::NoField
!= (ColorMaterialFieldMask
& whichField
))
800 editSField(ColorMaterialFieldMask
);
801 _sfColorMaterial
.copyFromBin(pMem
);
803 if(FieldBits::NoField
!= (IndexFieldMask
& whichField
))
805 editSField(IndexFieldMask
);
806 _sfIndex
.copyFromBin(pMem
);
808 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
810 editSField(ScaleFieldMask
);
811 _sfScale
.copyFromBin(pMem
);
813 if(FieldBits::NoField
!= (BiasFieldMask
& whichField
))
815 editSField(BiasFieldMask
);
816 _sfBias
.copyFromBin(pMem
);
818 if(FieldBits::NoField
!= (ImageFieldMask
& whichField
))
820 editSField(ImageFieldMask
);
821 _sfImage
.copyFromBin(pMem
);
825 //! create a new instance of the class
826 FresnelMaterialTransitPtr
FresnelMaterialBase::createLocal(BitVector bFlags
)
828 FresnelMaterialTransitPtr fc
;
830 if(getClassType().getPrototype() != NULL
)
832 FieldContainerTransitPtr tmpPtr
=
833 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
835 fc
= dynamic_pointer_cast
<FresnelMaterial
>(tmpPtr
);
841 //! create a new instance of the class, copy the container flags
842 FresnelMaterialTransitPtr
FresnelMaterialBase::createDependent(BitVector bFlags
)
844 FresnelMaterialTransitPtr fc
;
846 if(getClassType().getPrototype() != NULL
)
848 FieldContainerTransitPtr tmpPtr
=
849 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
851 fc
= dynamic_pointer_cast
<FresnelMaterial
>(tmpPtr
);
857 //! create a new instance of the class
858 FresnelMaterialTransitPtr
FresnelMaterialBase::create(void)
860 FresnelMaterialTransitPtr fc
;
862 if(getClassType().getPrototype() != NULL
)
864 FieldContainerTransitPtr tmpPtr
=
865 getClassType().getPrototype()-> shallowCopy();
867 fc
= dynamic_pointer_cast
<FresnelMaterial
>(tmpPtr
);
873 FresnelMaterial
*FresnelMaterialBase::createEmptyLocal(BitVector bFlags
)
875 FresnelMaterial
*returnValue
;
877 newPtr
<FresnelMaterial
>(returnValue
, bFlags
);
879 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
884 //! create an empty new instance of the class, do not copy the prototype
885 FresnelMaterial
*FresnelMaterialBase::createEmpty(void)
887 FresnelMaterial
*returnValue
;
889 newPtr
<FresnelMaterial
>(returnValue
, Thread::getCurrentLocalFlags());
891 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
892 ~Thread::getCurrentLocalFlags();
898 FieldContainerTransitPtr
FresnelMaterialBase::shallowCopyLocal(
899 BitVector bFlags
) const
901 FresnelMaterial
*tmpPtr
;
903 newPtr(tmpPtr
, dynamic_cast<const FresnelMaterial
*>(this), bFlags
);
905 FieldContainerTransitPtr
returnValue(tmpPtr
);
907 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
912 FieldContainerTransitPtr
FresnelMaterialBase::shallowCopyDependent(
913 BitVector bFlags
) const
915 FresnelMaterial
*tmpPtr
;
917 newPtr(tmpPtr
, dynamic_cast<const FresnelMaterial
*>(this), ~bFlags
);
919 FieldContainerTransitPtr
returnValue(tmpPtr
);
921 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
926 FieldContainerTransitPtr
FresnelMaterialBase::shallowCopy(void) const
928 FresnelMaterial
*tmpPtr
;
931 dynamic_cast<const FresnelMaterial
*>(this),
932 Thread::getCurrentLocalFlags());
934 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
936 FieldContainerTransitPtr
returnValue(tmpPtr
);
944 /*------------------------- constructors ----------------------------------*/
946 FresnelMaterialBase::FresnelMaterialBase(void) :
948 _sfAmbient (Color3f(0,0,0)),
949 _sfDiffuse (Color3f(0,0,0)),
950 _sfSpecular (Color3f(0,0,0)),
951 _sfShininess (Real32(1)),
952 _sfEmission (Color3f(0,0,0)),
953 _sfTransparency (Real32(0)),
955 _sfColorMaterial (GLenum(GL_DIFFUSE
)),
956 _sfIndex (Real32(0)),
957 _sfScale (Real32(1)),
963 FresnelMaterialBase::FresnelMaterialBase(const FresnelMaterialBase
&source
) :
965 _sfAmbient (source
._sfAmbient
),
966 _sfDiffuse (source
._sfDiffuse
),
967 _sfSpecular (source
._sfSpecular
),
968 _sfShininess (source
._sfShininess
),
969 _sfEmission (source
._sfEmission
),
970 _sfTransparency (source
._sfTransparency
),
971 _sfLit (source
._sfLit
),
972 _sfColorMaterial (source
._sfColorMaterial
),
973 _sfIndex (source
._sfIndex
),
974 _sfScale (source
._sfScale
),
975 _sfBias (source
._sfBias
),
981 /*-------------------------- destructors ----------------------------------*/
983 FresnelMaterialBase::~FresnelMaterialBase(void)
987 void FresnelMaterialBase::onCreate(const FresnelMaterial
*source
)
989 Inherited::onCreate(source
);
993 FresnelMaterial
*pThis
= static_cast<FresnelMaterial
*>(this);
995 pThis
->setImage(source
->getImage());
999 GetFieldHandlePtr
FresnelMaterialBase::getHandleAmbient (void) const
1001 SFColor3f::GetHandlePtr
returnValue(
1002 new SFColor3f::GetHandle(
1004 this->getType().getFieldDesc(AmbientFieldId
),
1005 const_cast<FresnelMaterialBase
*>(this)));
1010 EditFieldHandlePtr
FresnelMaterialBase::editHandleAmbient (void)
1012 SFColor3f::EditHandlePtr
returnValue(
1013 new SFColor3f::EditHandle(
1015 this->getType().getFieldDesc(AmbientFieldId
),
1019 editSField(AmbientFieldMask
);
1024 GetFieldHandlePtr
FresnelMaterialBase::getHandleDiffuse (void) const
1026 SFColor3f::GetHandlePtr
returnValue(
1027 new SFColor3f::GetHandle(
1029 this->getType().getFieldDesc(DiffuseFieldId
),
1030 const_cast<FresnelMaterialBase
*>(this)));
1035 EditFieldHandlePtr
FresnelMaterialBase::editHandleDiffuse (void)
1037 SFColor3f::EditHandlePtr
returnValue(
1038 new SFColor3f::EditHandle(
1040 this->getType().getFieldDesc(DiffuseFieldId
),
1044 editSField(DiffuseFieldMask
);
1049 GetFieldHandlePtr
FresnelMaterialBase::getHandleSpecular (void) const
1051 SFColor3f::GetHandlePtr
returnValue(
1052 new SFColor3f::GetHandle(
1054 this->getType().getFieldDesc(SpecularFieldId
),
1055 const_cast<FresnelMaterialBase
*>(this)));
1060 EditFieldHandlePtr
FresnelMaterialBase::editHandleSpecular (void)
1062 SFColor3f::EditHandlePtr
returnValue(
1063 new SFColor3f::EditHandle(
1065 this->getType().getFieldDesc(SpecularFieldId
),
1069 editSField(SpecularFieldMask
);
1074 GetFieldHandlePtr
FresnelMaterialBase::getHandleShininess (void) const
1076 SFReal32::GetHandlePtr
returnValue(
1077 new SFReal32::GetHandle(
1079 this->getType().getFieldDesc(ShininessFieldId
),
1080 const_cast<FresnelMaterialBase
*>(this)));
1085 EditFieldHandlePtr
FresnelMaterialBase::editHandleShininess (void)
1087 SFReal32::EditHandlePtr
returnValue(
1088 new SFReal32::EditHandle(
1090 this->getType().getFieldDesc(ShininessFieldId
),
1094 editSField(ShininessFieldMask
);
1099 GetFieldHandlePtr
FresnelMaterialBase::getHandleEmission (void) const
1101 SFColor3f::GetHandlePtr
returnValue(
1102 new SFColor3f::GetHandle(
1104 this->getType().getFieldDesc(EmissionFieldId
),
1105 const_cast<FresnelMaterialBase
*>(this)));
1110 EditFieldHandlePtr
FresnelMaterialBase::editHandleEmission (void)
1112 SFColor3f::EditHandlePtr
returnValue(
1113 new SFColor3f::EditHandle(
1115 this->getType().getFieldDesc(EmissionFieldId
),
1119 editSField(EmissionFieldMask
);
1124 GetFieldHandlePtr
FresnelMaterialBase::getHandleTransparency (void) const
1126 SFReal32::GetHandlePtr
returnValue(
1127 new SFReal32::GetHandle(
1129 this->getType().getFieldDesc(TransparencyFieldId
),
1130 const_cast<FresnelMaterialBase
*>(this)));
1135 EditFieldHandlePtr
FresnelMaterialBase::editHandleTransparency (void)
1137 SFReal32::EditHandlePtr
returnValue(
1138 new SFReal32::EditHandle(
1140 this->getType().getFieldDesc(TransparencyFieldId
),
1144 editSField(TransparencyFieldMask
);
1149 GetFieldHandlePtr
FresnelMaterialBase::getHandleLit (void) const
1151 SFBool::GetHandlePtr
returnValue(
1152 new SFBool::GetHandle(
1154 this->getType().getFieldDesc(LitFieldId
),
1155 const_cast<FresnelMaterialBase
*>(this)));
1160 EditFieldHandlePtr
FresnelMaterialBase::editHandleLit (void)
1162 SFBool::EditHandlePtr
returnValue(
1163 new SFBool::EditHandle(
1165 this->getType().getFieldDesc(LitFieldId
),
1169 editSField(LitFieldMask
);
1174 GetFieldHandlePtr
FresnelMaterialBase::getHandleColorMaterial (void) const
1176 SFGLenum::GetHandlePtr
returnValue(
1177 new SFGLenum::GetHandle(
1179 this->getType().getFieldDesc(ColorMaterialFieldId
),
1180 const_cast<FresnelMaterialBase
*>(this)));
1185 EditFieldHandlePtr
FresnelMaterialBase::editHandleColorMaterial (void)
1187 SFGLenum::EditHandlePtr
returnValue(
1188 new SFGLenum::EditHandle(
1190 this->getType().getFieldDesc(ColorMaterialFieldId
),
1194 editSField(ColorMaterialFieldMask
);
1199 GetFieldHandlePtr
FresnelMaterialBase::getHandleIndex (void) const
1201 SFReal32::GetHandlePtr
returnValue(
1202 new SFReal32::GetHandle(
1204 this->getType().getFieldDesc(IndexFieldId
),
1205 const_cast<FresnelMaterialBase
*>(this)));
1210 EditFieldHandlePtr
FresnelMaterialBase::editHandleIndex (void)
1212 SFReal32::EditHandlePtr
returnValue(
1213 new SFReal32::EditHandle(
1215 this->getType().getFieldDesc(IndexFieldId
),
1219 editSField(IndexFieldMask
);
1224 GetFieldHandlePtr
FresnelMaterialBase::getHandleScale (void) const
1226 SFReal32::GetHandlePtr
returnValue(
1227 new SFReal32::GetHandle(
1229 this->getType().getFieldDesc(ScaleFieldId
),
1230 const_cast<FresnelMaterialBase
*>(this)));
1235 EditFieldHandlePtr
FresnelMaterialBase::editHandleScale (void)
1237 SFReal32::EditHandlePtr
returnValue(
1238 new SFReal32::EditHandle(
1240 this->getType().getFieldDesc(ScaleFieldId
),
1244 editSField(ScaleFieldMask
);
1249 GetFieldHandlePtr
FresnelMaterialBase::getHandleBias (void) const
1251 SFReal32::GetHandlePtr
returnValue(
1252 new SFReal32::GetHandle(
1254 this->getType().getFieldDesc(BiasFieldId
),
1255 const_cast<FresnelMaterialBase
*>(this)));
1260 EditFieldHandlePtr
FresnelMaterialBase::editHandleBias (void)
1262 SFReal32::EditHandlePtr
returnValue(
1263 new SFReal32::EditHandle(
1265 this->getType().getFieldDesc(BiasFieldId
),
1269 editSField(BiasFieldMask
);
1274 GetFieldHandlePtr
FresnelMaterialBase::getHandleImage (void) const
1276 SFUnrecImagePtr::GetHandlePtr
returnValue(
1277 new SFUnrecImagePtr::GetHandle(
1279 this->getType().getFieldDesc(ImageFieldId
),
1280 const_cast<FresnelMaterialBase
*>(this)));
1285 EditFieldHandlePtr
FresnelMaterialBase::editHandleImage (void)
1287 SFUnrecImagePtr::EditHandlePtr
returnValue(
1288 new SFUnrecImagePtr::EditHandle(
1290 this->getType().getFieldDesc(ImageFieldId
),
1293 returnValue
->setSetMethod(
1294 boost::bind(&FresnelMaterial::setImage
,
1295 static_cast<FresnelMaterial
*>(this), _1
));
1297 editSField(ImageFieldMask
);
1303 #ifdef OSG_MT_CPTR_ASPECT
1304 void FresnelMaterialBase::execSyncV( FieldContainer
&oFrom
,
1305 ConstFieldMaskArg whichField
,
1306 AspectOffsetStore
&oOffsets
,
1307 ConstFieldMaskArg syncMode
,
1308 const UInt32 uiSyncInfo
)
1310 FresnelMaterial
*pThis
= static_cast<FresnelMaterial
*>(this);
1312 pThis
->execSync(static_cast<FresnelMaterial
*>(&oFrom
),
1321 #ifdef OSG_MT_CPTR_ASPECT
1322 FieldContainer
*FresnelMaterialBase::createAspectCopy(
1323 const FieldContainer
*pRefAspect
) const
1325 FresnelMaterial
*returnValue
;
1327 newAspectCopy(returnValue
,
1328 dynamic_cast<const FresnelMaterial
*>(pRefAspect
),
1329 dynamic_cast<const FresnelMaterial
*>(this));
1335 void FresnelMaterialBase::resolveLinks(void)
1337 Inherited::resolveLinks();
1339 static_cast<FresnelMaterial
*>(this)->setImage(NULL
);