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 SimpleMaterial!
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
67 #include "OSGSimpleMaterialBase.h"
68 #include "OSGSimpleMaterial.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::SimpleMaterial
79 The simple material class. See \ref PageSystemMaterialSimpleMaterial for a
82 This material wraps the standard calls to glMaterial() in
83 OSG::SimpleMaterial::_sfAmbient, OSG::SimpleMaterial::_sfDiffuse,
84 OSG::SimpleMaterial::_sfEmission, OSG::SimpleMaterial::_sfSpecular,
85 OSG::SimpleMaterial::_sfShininess. In addition it supports transparency
86 (OSG::SimpleMaterial::_sfTransparency), can switch lighting
87 (OSG::SimpleMaterial::_sfLit) and the color material
88 (OSG::SimpleMaterial::_sfColorMaterial).
91 /***************************************************************************\
92 * Field Documentation *
93 \***************************************************************************/
95 /*! \var Color3f SimpleMaterialBase::_sfAmbient
96 The ambient color for the material.
99 /*! \var Color3f SimpleMaterialBase::_sfDiffuse
100 The diffuse color for the material.
103 /*! \var Color3f SimpleMaterialBase::_sfSpecular
104 The color used for the specular highlight on the object.
107 /*! \var Real32 SimpleMaterialBase::_sfShininess
108 The shininess value to use when lighting the object. Higher values equal smaller and brighter highlights.
111 /*! \var Color3f SimpleMaterialBase::_sfEmission
115 /*! \var Real32 SimpleMaterialBase::_sfTransparency
116 Defines how transparent objects are rendered with this material.
119 /*! \var bool SimpleMaterialBase::_sfLit
123 /*! \var GLenum SimpleMaterialBase::_sfColorMaterial
124 Defines which color material mode this material affects.
128 /***************************************************************************\
129 * FieldType/FieldTrait Instantiation *
130 \***************************************************************************/
132 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
133 PointerType FieldTraits
<SimpleMaterial
*, nsOSG
>::_type(
136 SimpleMaterial::getClassType(),
140 OSG_FIELDTRAITS_GETTYPE_NS(SimpleMaterial
*, nsOSG
)
142 /***************************************************************************\
143 * Field Description *
144 \***************************************************************************/
146 void SimpleMaterialBase::classDescInserter(TypeObject
&oType
)
148 FieldDescriptionBase
*pDesc
= NULL
;
151 pDesc
= new SFColor3f::Description(
152 SFColor3f::getClassType(),
154 "The ambient color for the material.\n",
155 AmbientFieldId
, AmbientFieldMask
,
157 (Field::SFDefaultFlags
| Field::FStdAccess
),
158 static_cast<FieldEditMethodSig
>(&SimpleMaterial::editHandleAmbient
),
159 static_cast<FieldGetMethodSig
>(&SimpleMaterial::getHandleAmbient
));
161 oType
.addInitialDesc(pDesc
);
163 pDesc
= new SFColor3f::Description(
164 SFColor3f::getClassType(),
166 "The diffuse color for the material.\n",
167 DiffuseFieldId
, DiffuseFieldMask
,
169 (Field::SFDefaultFlags
| Field::FStdAccess
),
170 static_cast<FieldEditMethodSig
>(&SimpleMaterial::editHandleDiffuse
),
171 static_cast<FieldGetMethodSig
>(&SimpleMaterial::getHandleDiffuse
));
173 oType
.addInitialDesc(pDesc
);
175 pDesc
= new SFColor3f::Description(
176 SFColor3f::getClassType(),
178 "The color used for the specular highlight on the object.\n",
179 SpecularFieldId
, SpecularFieldMask
,
181 (Field::SFDefaultFlags
| Field::FStdAccess
),
182 static_cast<FieldEditMethodSig
>(&SimpleMaterial::editHandleSpecular
),
183 static_cast<FieldGetMethodSig
>(&SimpleMaterial::getHandleSpecular
));
185 oType
.addInitialDesc(pDesc
);
187 pDesc
= new SFReal32::Description(
188 SFReal32::getClassType(),
190 "The shininess value to use when lighting the object. Higher values equal smaller and brighter highlights.\n",
191 ShininessFieldId
, ShininessFieldMask
,
193 (Field::SFDefaultFlags
| Field::FStdAccess
),
194 static_cast<FieldEditMethodSig
>(&SimpleMaterial::editHandleShininess
),
195 static_cast<FieldGetMethodSig
>(&SimpleMaterial::getHandleShininess
));
197 oType
.addInitialDesc(pDesc
);
199 pDesc
= new SFColor3f::Description(
200 SFColor3f::getClassType(),
203 EmissionFieldId
, EmissionFieldMask
,
205 (Field::SFDefaultFlags
| Field::FStdAccess
),
206 static_cast<FieldEditMethodSig
>(&SimpleMaterial::editHandleEmission
),
207 static_cast<FieldGetMethodSig
>(&SimpleMaterial::getHandleEmission
));
209 oType
.addInitialDesc(pDesc
);
211 pDesc
= new SFReal32::Description(
212 SFReal32::getClassType(),
214 "Defines how transparent objects are rendered with this material.\n",
215 TransparencyFieldId
, TransparencyFieldMask
,
217 (Field::SFDefaultFlags
| Field::FStdAccess
),
218 static_cast<FieldEditMethodSig
>(&SimpleMaterial::editHandleTransparency
),
219 static_cast<FieldGetMethodSig
>(&SimpleMaterial::getHandleTransparency
));
221 oType
.addInitialDesc(pDesc
);
223 pDesc
= new SFBool::Description(
224 SFBool::getClassType(),
227 LitFieldId
, LitFieldMask
,
229 (Field::SFDefaultFlags
| Field::FStdAccess
),
230 static_cast<FieldEditMethodSig
>(&SimpleMaterial::editHandleLit
),
231 static_cast<FieldGetMethodSig
>(&SimpleMaterial::getHandleLit
));
233 oType
.addInitialDesc(pDesc
);
235 pDesc
= new SFGLenum::Description(
236 SFGLenum::getClassType(),
238 "Defines which color material mode this material affects.\n",
239 ColorMaterialFieldId
, ColorMaterialFieldMask
,
241 (Field::SFDefaultFlags
| Field::FStdAccess
),
242 static_cast<FieldEditMethodSig
>(&SimpleMaterial::editHandleColorMaterial
),
243 static_cast<FieldGetMethodSig
>(&SimpleMaterial::getHandleColorMaterial
));
245 oType
.addInitialDesc(pDesc
);
249 SimpleMaterialBase::TypeObject
SimpleMaterialBase::_type(
250 SimpleMaterialBase::getClassname(),
251 Inherited::getClassname(),
254 reinterpret_cast<PrototypeCreateF
>(&SimpleMaterialBase::createEmptyLocal
),
255 reinterpret_cast<InitContainerF
>(&SimpleMaterial::initMethod
),
256 reinterpret_cast<ExitContainerF
>(&SimpleMaterial::exitMethod
),
257 reinterpret_cast<InitalInsertDescFunc
>(
258 reinterpret_cast<void *>(&SimpleMaterial::classDescInserter
)),
261 "<?xml version=\"1.0\" ?>\n"
264 " name=\"SimpleMaterial\"\n"
265 " parent=\"ChunkMaterial\"\n"
266 " library=\"System\"\n"
267 " structure=\"concrete\"\n"
268 " pointerfieldtypes=\"none\"\n"
269 " systemcomponent=\"true\"\n"
270 " parentsystemcomponent=\"true\"\n"
271 " docGroupBase=\"GrpSystemMaterial\"\n"
274 " The simple material class. See \\ref PageSystemMaterialSimpleMaterial for a\n"
277 " This material wraps the standard calls to glMaterial() in\n"
278 " OSG::SimpleMaterial::_sfAmbient, OSG::SimpleMaterial::_sfDiffuse, \n"
279 " OSG::SimpleMaterial::_sfEmission, OSG::SimpleMaterial::_sfSpecular, \n"
280 " OSG::SimpleMaterial::_sfShininess. In addition it supports transparency \n"
281 " (OSG::SimpleMaterial::_sfTransparency), can switch lighting \n"
282 " (OSG::SimpleMaterial::_sfLit) and the color material \n"
283 " (OSG::SimpleMaterial::_sfColorMaterial).\n"
285 "\t name=\"ambient\"\n"
286 "\t type=\"Color3f\"\n"
287 "\t cardinality=\"single\"\n"
288 "\t visibility=\"external\"\n"
289 "\t defaultValue=\"0.f,0.f,0.f\"\n"
291 " The ambient color for the material.\n"
294 "\t name=\"diffuse\"\n"
295 "\t type=\"Color3f\"\n"
296 "\t cardinality=\"single\"\n"
297 "\t visibility=\"external\"\n"
298 "\t defaultValue=\"0.f,0.f,0.f\"\n"
300 " The diffuse color for the material.\n"
303 "\t name=\"specular\"\n"
304 "\t type=\"Color3f\"\n"
305 "\t cardinality=\"single\"\n"
306 "\t visibility=\"external\"\n"
307 "\t defaultValue=\"0.f,0.f,0.f\"\n"
309 " The color used for the specular highlight on the object.\n"
312 "\t name=\"shininess\"\n"
313 "\t type=\"Real32\"\n"
314 "\t cardinality=\"single\"\n"
315 "\t visibility=\"external\"\n"
316 "\t defaultValue=\"1.f\"\n"
317 " min_value=\"0.0\"\n"
318 " max_value=\"128.0\"\n"
320 " The shininess value to use when lighting the object. Higher values equal smaller and brighter highlights.\n"
323 "\t name=\"emission\"\n"
324 "\t type=\"Color3f\"\n"
325 "\t cardinality=\"single\"\n"
326 "\t visibility=\"external\"\n"
327 "\t defaultValue=\"0.f,0.f,0.f\"\n"
331 "\t name=\"transparency\"\n"
332 "\t type=\"Real32\"\n"
333 "\t cardinality=\"single\"\n"
334 "\t visibility=\"external\"\n"
335 "\t defaultValue=\"0.f\"\n"
336 " min_value=\"0.0\"\n"
337 " max_value=\"1.0\"\n"
339 " Defines how transparent objects are rendered with this material.\n"
344 "\t cardinality=\"single\"\n"
345 "\t visibility=\"external\"\n"
346 "\t defaultValue=\"true\"\n"
350 "\t name=\"colorMaterial\"\n"
351 "\t type=\"GLenum\"\n"
352 "\t cardinality=\"single\"\n"
353 "\t visibility=\"external\"\n"
354 "\t defaultValue=\"GL_DIFFUSE\"\n"
355 "\t defaultHeader=\""OSGGL.h"\"\n"
356 " potential_values=\"GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_AMBIENT_AND_DIFFUSE,GL_EMISSION\"\n"
358 " Defines which color material mode this material affects.\n"
360 "</FieldContainer>\n"
363 "The simple material class. See \\ref PageSystemMaterialSimpleMaterial for a\n"
366 "This material wraps the standard calls to glMaterial() in\n"
367 "OSG::SimpleMaterial::_sfAmbient, OSG::SimpleMaterial::_sfDiffuse, \n"
368 "OSG::SimpleMaterial::_sfEmission, OSG::SimpleMaterial::_sfSpecular, \n"
369 "OSG::SimpleMaterial::_sfShininess. In addition it supports transparency \n"
370 "(OSG::SimpleMaterial::_sfTransparency), can switch lighting \n"
371 "(OSG::SimpleMaterial::_sfLit) and the color material \n"
372 "(OSG::SimpleMaterial::_sfColorMaterial).\n"
375 /*------------------------------ get -----------------------------------*/
377 FieldContainerType
&SimpleMaterialBase::getType(void)
382 const FieldContainerType
&SimpleMaterialBase::getType(void) const
387 UInt32
SimpleMaterialBase::getContainerSize(void) const
389 return sizeof(SimpleMaterial
);
392 /*------------------------- decorator get ------------------------------*/
395 SFColor3f
*SimpleMaterialBase::editSFAmbient(void)
397 editSField(AmbientFieldMask
);
402 const SFColor3f
*SimpleMaterialBase::getSFAmbient(void) const
408 SFColor3f
*SimpleMaterialBase::editSFDiffuse(void)
410 editSField(DiffuseFieldMask
);
415 const SFColor3f
*SimpleMaterialBase::getSFDiffuse(void) const
421 SFColor3f
*SimpleMaterialBase::editSFSpecular(void)
423 editSField(SpecularFieldMask
);
428 const SFColor3f
*SimpleMaterialBase::getSFSpecular(void) const
434 SFReal32
*SimpleMaterialBase::editSFShininess(void)
436 editSField(ShininessFieldMask
);
438 return &_sfShininess
;
441 const SFReal32
*SimpleMaterialBase::getSFShininess(void) const
443 return &_sfShininess
;
447 SFColor3f
*SimpleMaterialBase::editSFEmission(void)
449 editSField(EmissionFieldMask
);
454 const SFColor3f
*SimpleMaterialBase::getSFEmission(void) const
460 SFReal32
*SimpleMaterialBase::editSFTransparency(void)
462 editSField(TransparencyFieldMask
);
464 return &_sfTransparency
;
467 const SFReal32
*SimpleMaterialBase::getSFTransparency(void) const
469 return &_sfTransparency
;
473 SFBool
*SimpleMaterialBase::editSFLit(void)
475 editSField(LitFieldMask
);
480 const SFBool
*SimpleMaterialBase::getSFLit(void) const
486 SFGLenum
*SimpleMaterialBase::editSFColorMaterial(void)
488 editSField(ColorMaterialFieldMask
);
490 return &_sfColorMaterial
;
493 const SFGLenum
*SimpleMaterialBase::getSFColorMaterial(void) const
495 return &_sfColorMaterial
;
503 /*------------------------------ access -----------------------------------*/
505 SizeT
SimpleMaterialBase::getBinSize(ConstFieldMaskArg whichField
)
507 SizeT returnValue
= Inherited::getBinSize(whichField
);
509 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
511 returnValue
+= _sfAmbient
.getBinSize();
513 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
515 returnValue
+= _sfDiffuse
.getBinSize();
517 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
519 returnValue
+= _sfSpecular
.getBinSize();
521 if(FieldBits::NoField
!= (ShininessFieldMask
& whichField
))
523 returnValue
+= _sfShininess
.getBinSize();
525 if(FieldBits::NoField
!= (EmissionFieldMask
& whichField
))
527 returnValue
+= _sfEmission
.getBinSize();
529 if(FieldBits::NoField
!= (TransparencyFieldMask
& whichField
))
531 returnValue
+= _sfTransparency
.getBinSize();
533 if(FieldBits::NoField
!= (LitFieldMask
& whichField
))
535 returnValue
+= _sfLit
.getBinSize();
537 if(FieldBits::NoField
!= (ColorMaterialFieldMask
& whichField
))
539 returnValue
+= _sfColorMaterial
.getBinSize();
545 void SimpleMaterialBase::copyToBin(BinaryDataHandler
&pMem
,
546 ConstFieldMaskArg whichField
)
548 Inherited::copyToBin(pMem
, whichField
);
550 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
552 _sfAmbient
.copyToBin(pMem
);
554 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
556 _sfDiffuse
.copyToBin(pMem
);
558 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
560 _sfSpecular
.copyToBin(pMem
);
562 if(FieldBits::NoField
!= (ShininessFieldMask
& whichField
))
564 _sfShininess
.copyToBin(pMem
);
566 if(FieldBits::NoField
!= (EmissionFieldMask
& whichField
))
568 _sfEmission
.copyToBin(pMem
);
570 if(FieldBits::NoField
!= (TransparencyFieldMask
& whichField
))
572 _sfTransparency
.copyToBin(pMem
);
574 if(FieldBits::NoField
!= (LitFieldMask
& whichField
))
576 _sfLit
.copyToBin(pMem
);
578 if(FieldBits::NoField
!= (ColorMaterialFieldMask
& whichField
))
580 _sfColorMaterial
.copyToBin(pMem
);
584 void SimpleMaterialBase::copyFromBin(BinaryDataHandler
&pMem
,
585 ConstFieldMaskArg whichField
)
587 Inherited::copyFromBin(pMem
, whichField
);
589 if(FieldBits::NoField
!= (AmbientFieldMask
& whichField
))
591 editSField(AmbientFieldMask
);
592 _sfAmbient
.copyFromBin(pMem
);
594 if(FieldBits::NoField
!= (DiffuseFieldMask
& whichField
))
596 editSField(DiffuseFieldMask
);
597 _sfDiffuse
.copyFromBin(pMem
);
599 if(FieldBits::NoField
!= (SpecularFieldMask
& whichField
))
601 editSField(SpecularFieldMask
);
602 _sfSpecular
.copyFromBin(pMem
);
604 if(FieldBits::NoField
!= (ShininessFieldMask
& whichField
))
606 editSField(ShininessFieldMask
);
607 _sfShininess
.copyFromBin(pMem
);
609 if(FieldBits::NoField
!= (EmissionFieldMask
& whichField
))
611 editSField(EmissionFieldMask
);
612 _sfEmission
.copyFromBin(pMem
);
614 if(FieldBits::NoField
!= (TransparencyFieldMask
& whichField
))
616 editSField(TransparencyFieldMask
);
617 _sfTransparency
.copyFromBin(pMem
);
619 if(FieldBits::NoField
!= (LitFieldMask
& whichField
))
621 editSField(LitFieldMask
);
622 _sfLit
.copyFromBin(pMem
);
624 if(FieldBits::NoField
!= (ColorMaterialFieldMask
& whichField
))
626 editSField(ColorMaterialFieldMask
);
627 _sfColorMaterial
.copyFromBin(pMem
);
631 //! create a new instance of the class
632 SimpleMaterialTransitPtr
SimpleMaterialBase::createLocal(BitVector bFlags
)
634 SimpleMaterialTransitPtr fc
;
636 if(getClassType().getPrototype() != NULL
)
638 FieldContainerTransitPtr tmpPtr
=
639 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
641 fc
= dynamic_pointer_cast
<SimpleMaterial
>(tmpPtr
);
647 //! create a new instance of the class, copy the container flags
648 SimpleMaterialTransitPtr
SimpleMaterialBase::createDependent(BitVector bFlags
)
650 SimpleMaterialTransitPtr fc
;
652 if(getClassType().getPrototype() != NULL
)
654 FieldContainerTransitPtr tmpPtr
=
655 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
657 fc
= dynamic_pointer_cast
<SimpleMaterial
>(tmpPtr
);
663 //! create a new instance of the class
664 SimpleMaterialTransitPtr
SimpleMaterialBase::create(void)
666 SimpleMaterialTransitPtr fc
;
668 if(getClassType().getPrototype() != NULL
)
670 FieldContainerTransitPtr tmpPtr
=
671 getClassType().getPrototype()-> shallowCopy();
673 fc
= dynamic_pointer_cast
<SimpleMaterial
>(tmpPtr
);
679 SimpleMaterial
*SimpleMaterialBase::createEmptyLocal(BitVector bFlags
)
681 SimpleMaterial
*returnValue
;
683 newPtr
<SimpleMaterial
>(returnValue
, bFlags
);
685 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
690 //! create an empty new instance of the class, do not copy the prototype
691 SimpleMaterial
*SimpleMaterialBase::createEmpty(void)
693 SimpleMaterial
*returnValue
;
695 newPtr
<SimpleMaterial
>(returnValue
, Thread::getCurrentLocalFlags());
697 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
698 ~Thread::getCurrentLocalFlags();
704 FieldContainerTransitPtr
SimpleMaterialBase::shallowCopyLocal(
705 BitVector bFlags
) const
707 SimpleMaterial
*tmpPtr
;
709 newPtr(tmpPtr
, dynamic_cast<const SimpleMaterial
*>(this), bFlags
);
711 FieldContainerTransitPtr
returnValue(tmpPtr
);
713 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
718 FieldContainerTransitPtr
SimpleMaterialBase::shallowCopyDependent(
719 BitVector bFlags
) const
721 SimpleMaterial
*tmpPtr
;
723 newPtr(tmpPtr
, dynamic_cast<const SimpleMaterial
*>(this), ~bFlags
);
725 FieldContainerTransitPtr
returnValue(tmpPtr
);
727 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
732 FieldContainerTransitPtr
SimpleMaterialBase::shallowCopy(void) const
734 SimpleMaterial
*tmpPtr
;
737 dynamic_cast<const SimpleMaterial
*>(this),
738 Thread::getCurrentLocalFlags());
740 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
742 FieldContainerTransitPtr
returnValue(tmpPtr
);
750 /*------------------------- constructors ----------------------------------*/
752 SimpleMaterialBase::SimpleMaterialBase(void) :
754 _sfAmbient (Color3f(0.f
,0.f
,0.f
)),
755 _sfDiffuse (Color3f(0.f
,0.f
,0.f
)),
756 _sfSpecular (Color3f(0.f
,0.f
,0.f
)),
757 _sfShininess (Real32(1.f
)),
758 _sfEmission (Color3f(0.f
,0.f
,0.f
)),
759 _sfTransparency (Real32(0.f
)),
761 _sfColorMaterial (GLenum(GL_DIFFUSE
))
765 SimpleMaterialBase::SimpleMaterialBase(const SimpleMaterialBase
&source
) :
767 _sfAmbient (source
._sfAmbient
),
768 _sfDiffuse (source
._sfDiffuse
),
769 _sfSpecular (source
._sfSpecular
),
770 _sfShininess (source
._sfShininess
),
771 _sfEmission (source
._sfEmission
),
772 _sfTransparency (source
._sfTransparency
),
773 _sfLit (source
._sfLit
),
774 _sfColorMaterial (source
._sfColorMaterial
)
779 /*-------------------------- destructors ----------------------------------*/
781 SimpleMaterialBase::~SimpleMaterialBase(void)
786 GetFieldHandlePtr
SimpleMaterialBase::getHandleAmbient (void) const
788 SFColor3f::GetHandlePtr
returnValue(
789 new SFColor3f::GetHandle(
791 this->getType().getFieldDesc(AmbientFieldId
),
792 const_cast<SimpleMaterialBase
*>(this)));
797 EditFieldHandlePtr
SimpleMaterialBase::editHandleAmbient (void)
799 SFColor3f::EditHandlePtr
returnValue(
800 new SFColor3f::EditHandle(
802 this->getType().getFieldDesc(AmbientFieldId
),
806 editSField(AmbientFieldMask
);
811 GetFieldHandlePtr
SimpleMaterialBase::getHandleDiffuse (void) const
813 SFColor3f::GetHandlePtr
returnValue(
814 new SFColor3f::GetHandle(
816 this->getType().getFieldDesc(DiffuseFieldId
),
817 const_cast<SimpleMaterialBase
*>(this)));
822 EditFieldHandlePtr
SimpleMaterialBase::editHandleDiffuse (void)
824 SFColor3f::EditHandlePtr
returnValue(
825 new SFColor3f::EditHandle(
827 this->getType().getFieldDesc(DiffuseFieldId
),
831 editSField(DiffuseFieldMask
);
836 GetFieldHandlePtr
SimpleMaterialBase::getHandleSpecular (void) const
838 SFColor3f::GetHandlePtr
returnValue(
839 new SFColor3f::GetHandle(
841 this->getType().getFieldDesc(SpecularFieldId
),
842 const_cast<SimpleMaterialBase
*>(this)));
847 EditFieldHandlePtr
SimpleMaterialBase::editHandleSpecular (void)
849 SFColor3f::EditHandlePtr
returnValue(
850 new SFColor3f::EditHandle(
852 this->getType().getFieldDesc(SpecularFieldId
),
856 editSField(SpecularFieldMask
);
861 GetFieldHandlePtr
SimpleMaterialBase::getHandleShininess (void) const
863 SFReal32::GetHandlePtr
returnValue(
864 new SFReal32::GetHandle(
866 this->getType().getFieldDesc(ShininessFieldId
),
867 const_cast<SimpleMaterialBase
*>(this)));
872 EditFieldHandlePtr
SimpleMaterialBase::editHandleShininess (void)
874 SFReal32::EditHandlePtr
returnValue(
875 new SFReal32::EditHandle(
877 this->getType().getFieldDesc(ShininessFieldId
),
881 editSField(ShininessFieldMask
);
886 GetFieldHandlePtr
SimpleMaterialBase::getHandleEmission (void) const
888 SFColor3f::GetHandlePtr
returnValue(
889 new SFColor3f::GetHandle(
891 this->getType().getFieldDesc(EmissionFieldId
),
892 const_cast<SimpleMaterialBase
*>(this)));
897 EditFieldHandlePtr
SimpleMaterialBase::editHandleEmission (void)
899 SFColor3f::EditHandlePtr
returnValue(
900 new SFColor3f::EditHandle(
902 this->getType().getFieldDesc(EmissionFieldId
),
906 editSField(EmissionFieldMask
);
911 GetFieldHandlePtr
SimpleMaterialBase::getHandleTransparency (void) const
913 SFReal32::GetHandlePtr
returnValue(
914 new SFReal32::GetHandle(
916 this->getType().getFieldDesc(TransparencyFieldId
),
917 const_cast<SimpleMaterialBase
*>(this)));
922 EditFieldHandlePtr
SimpleMaterialBase::editHandleTransparency (void)
924 SFReal32::EditHandlePtr
returnValue(
925 new SFReal32::EditHandle(
927 this->getType().getFieldDesc(TransparencyFieldId
),
931 editSField(TransparencyFieldMask
);
936 GetFieldHandlePtr
SimpleMaterialBase::getHandleLit (void) const
938 SFBool::GetHandlePtr
returnValue(
939 new SFBool::GetHandle(
941 this->getType().getFieldDesc(LitFieldId
),
942 const_cast<SimpleMaterialBase
*>(this)));
947 EditFieldHandlePtr
SimpleMaterialBase::editHandleLit (void)
949 SFBool::EditHandlePtr
returnValue(
950 new SFBool::EditHandle(
952 this->getType().getFieldDesc(LitFieldId
),
956 editSField(LitFieldMask
);
961 GetFieldHandlePtr
SimpleMaterialBase::getHandleColorMaterial (void) const
963 SFGLenum::GetHandlePtr
returnValue(
964 new SFGLenum::GetHandle(
966 this->getType().getFieldDesc(ColorMaterialFieldId
),
967 const_cast<SimpleMaterialBase
*>(this)));
972 EditFieldHandlePtr
SimpleMaterialBase::editHandleColorMaterial (void)
974 SFGLenum::EditHandlePtr
returnValue(
975 new SFGLenum::EditHandle(
977 this->getType().getFieldDesc(ColorMaterialFieldId
),
981 editSField(ColorMaterialFieldMask
);
987 #ifdef OSG_MT_CPTR_ASPECT
988 void SimpleMaterialBase::execSyncV( FieldContainer
&oFrom
,
989 ConstFieldMaskArg whichField
,
990 AspectOffsetStore
&oOffsets
,
991 ConstFieldMaskArg syncMode
,
992 const UInt32 uiSyncInfo
)
994 SimpleMaterial
*pThis
= static_cast<SimpleMaterial
*>(this);
996 pThis
->execSync(static_cast<SimpleMaterial
*>(&oFrom
),
1005 #ifdef OSG_MT_CPTR_ASPECT
1006 FieldContainer
*SimpleMaterialBase::createAspectCopy(
1007 const FieldContainer
*pRefAspect
) const
1009 SimpleMaterial
*returnValue
;
1011 newAspectCopy(returnValue
,
1012 dynamic_cast<const SimpleMaterial
*>(pRefAspect
),
1013 dynamic_cast<const SimpleMaterial
*>(this));
1019 void SimpleMaterialBase::resolveLinks(void)
1021 Inherited::resolveLinks();