changed: gcc8 base update
[opensg.git] / Source / System / Material / PreBuild / OSGFresnelMaterialBase.cpp
blob010deaa5e7249d7b84567712fcf5c965149f9fd8
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 FresnelMaterial!
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> // ColorMaterial default header
66 #include "OSGImage.h" // Image Class
68 #include "OSGFresnelMaterialBase.h"
69 #include "OSGFresnelMaterial.h"
71 #include <boost/bind.hpp>
73 OSG_BEGIN_NAMESPACE
75 /***************************************************************************\
76 * Description *
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",
143 "ChunkMaterialPtr",
144 FresnelMaterial::getClassType(),
145 nsOSG);
146 #endif
148 OSG_FIELDTRAITS_GETTYPE_NS(FresnelMaterial *, nsOSG)
150 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
151 FresnelMaterial *,
152 nsOSG)
154 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
155 FresnelMaterial *,
156 nsOSG)
158 /***************************************************************************\
159 * Field Description *
160 \***************************************************************************/
162 void FresnelMaterialBase::classDescInserter(TypeObject &oType)
164 FieldDescriptionBase *pDesc = NULL;
167 pDesc = new SFColor3f::Description(
168 SFColor3f::getClassType(),
169 "ambient",
171 AmbientFieldId, AmbientFieldMask,
172 false,
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(),
181 "diffuse",
183 DiffuseFieldId, DiffuseFieldMask,
184 false,
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(),
193 "specular",
195 SpecularFieldId, SpecularFieldMask,
196 false,
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(),
205 "shininess",
207 ShininessFieldId, ShininessFieldMask,
208 false,
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(),
217 "emission",
219 EmissionFieldId, EmissionFieldMask,
220 false,
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(),
229 "transparency",
231 TransparencyFieldId, TransparencyFieldMask,
232 false,
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(),
241 "lit",
243 LitFieldId, LitFieldMask,
244 false,
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(),
253 "colorMaterial",
255 ColorMaterialFieldId, ColorMaterialFieldMask,
256 false,
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(),
265 "index",
267 IndexFieldId, IndexFieldMask,
268 false,
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(),
277 "scale",
279 ScaleFieldId, ScaleFieldMask,
280 false,
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(),
289 "bias",
291 BiasFieldId, BiasFieldMask,
292 false,
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(),
301 "image",
303 ImageFieldId, ImageFieldMask,
304 false,
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(),
316 "NULL",
317 nsOSG, //Namespace
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)),
323 false,
325 "<?xml version=\"1.0\"?>\n"
326 "\n"
327 "<FieldContainer\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"
337 " >\n"
338 " <Field\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"
345 "\t >\n"
346 " </Field>\n"
347 " <Field\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"
354 "\t >\n"
355 " </Field>\n"
356 " <Field\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"
363 "\t >\n"
364 " </Field>\n"
365 " <Field\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"
372 "\t >\n"
373 " </Field>\n"
374 " <Field\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"
381 "\t >\n"
382 " </Field>\n"
383 " <Field\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"
390 "\t >\n"
391 " </Field>\n"
392 " <Field\n"
393 "\t name=\"lit\"\n"
394 "\t type=\"bool\"\n"
395 "\t cardinality=\"single\"\n"
396 "\t visibility=\"external\"\n"
397 "\t defaultValue=\"true\"\n"
398 "\t access=\"public\"\n"
399 "\t >\n"
400 " </Field>\n"
401 " <Field\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=\"&lt;OSGGL.h&gt;\"\n"
408 "\t access=\"public\"\n"
409 "\t >\n"
410 " </Field>\n"
411 " <Field\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"
418 "\t >\n"
419 " </Field>\n"
420 " <Field\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"
427 "\t >\n"
428 " </Field>\n"
429 " <Field\n"
430 "\t name=\"bias\"\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"
436 "\t >\n"
437 " </Field>\n"
438 " <Field\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"
444 "\t >\n"
445 " </Field>\n"
446 "</FieldContainer>\n",
450 /*------------------------------ get -----------------------------------*/
452 FieldContainerType &FresnelMaterialBase::getType(void)
454 return _type;
457 const FieldContainerType &FresnelMaterialBase::getType(void) const
459 return _type;
462 UInt32 FresnelMaterialBase::getContainerSize(void) const
464 return sizeof(FresnelMaterial);
467 /*------------------------- decorator get ------------------------------*/
470 SFColor3f *FresnelMaterialBase::editSFAmbient(void)
472 editSField(AmbientFieldMask);
474 return &_sfAmbient;
477 const SFColor3f *FresnelMaterialBase::getSFAmbient(void) const
479 return &_sfAmbient;
483 SFColor3f *FresnelMaterialBase::editSFDiffuse(void)
485 editSField(DiffuseFieldMask);
487 return &_sfDiffuse;
490 const SFColor3f *FresnelMaterialBase::getSFDiffuse(void) const
492 return &_sfDiffuse;
496 SFColor3f *FresnelMaterialBase::editSFSpecular(void)
498 editSField(SpecularFieldMask);
500 return &_sfSpecular;
503 const SFColor3f *FresnelMaterialBase::getSFSpecular(void) const
505 return &_sfSpecular;
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);
526 return &_sfEmission;
529 const SFColor3f *FresnelMaterialBase::getSFEmission(void) const
531 return &_sfEmission;
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);
552 return &_sfLit;
555 const SFBool *FresnelMaterialBase::getSFLit(void) const
557 return &_sfLit;
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);
578 return &_sfIndex;
581 const SFReal32 *FresnelMaterialBase::getSFIndex(void) const
583 return &_sfIndex;
587 SFReal32 *FresnelMaterialBase::editSFScale(void)
589 editSField(ScaleFieldMask);
591 return &_sfScale;
594 const SFReal32 *FresnelMaterialBase::getSFScale(void) const
596 return &_sfScale;
600 SFReal32 *FresnelMaterialBase::editSFBias(void)
602 editSField(BiasFieldMask);
604 return &_sfBias;
607 const SFReal32 *FresnelMaterialBase::getSFBias(void) const
609 return &_sfBias;
613 //! Get the FresnelMaterial::_sfImage field.
614 const SFUnrecImagePtr *FresnelMaterialBase::getSFImage(void) const
616 return &_sfImage;
619 SFUnrecImagePtr *FresnelMaterialBase::editSFImage (void)
621 editSField(ImageFieldMask);
623 return &_sfImage;
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();
700 return returnValue;
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);
838 return fc;
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);
854 return fc;
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);
870 return fc;
873 FresnelMaterial *FresnelMaterialBase::createEmptyLocal(BitVector bFlags)
875 FresnelMaterial *returnValue;
877 newPtr<FresnelMaterial>(returnValue, bFlags);
879 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
881 return returnValue;
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();
894 return returnValue;
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;
909 return returnValue;
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;
923 return returnValue;
926 FieldContainerTransitPtr FresnelMaterialBase::shallowCopy(void) const
928 FresnelMaterial *tmpPtr;
930 newPtr(tmpPtr,
931 dynamic_cast<const FresnelMaterial *>(this),
932 Thread::getCurrentLocalFlags());
934 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
936 FieldContainerTransitPtr returnValue(tmpPtr);
938 return returnValue;
944 /*------------------------- constructors ----------------------------------*/
946 FresnelMaterialBase::FresnelMaterialBase(void) :
947 Inherited(),
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)),
954 _sfLit (bool(true)),
955 _sfColorMaterial (GLenum(GL_DIFFUSE)),
956 _sfIndex (Real32(0)),
957 _sfScale (Real32(1)),
958 _sfBias (Real32(1)),
959 _sfImage (NULL)
963 FresnelMaterialBase::FresnelMaterialBase(const FresnelMaterialBase &source) :
964 Inherited(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 ),
976 _sfImage (NULL)
981 /*-------------------------- destructors ----------------------------------*/
983 FresnelMaterialBase::~FresnelMaterialBase(void)
987 void FresnelMaterialBase::onCreate(const FresnelMaterial *source)
989 Inherited::onCreate(source);
991 if(source != NULL)
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(
1003 &_sfAmbient,
1004 this->getType().getFieldDesc(AmbientFieldId),
1005 const_cast<FresnelMaterialBase *>(this)));
1007 return returnValue;
1010 EditFieldHandlePtr FresnelMaterialBase::editHandleAmbient (void)
1012 SFColor3f::EditHandlePtr returnValue(
1013 new SFColor3f::EditHandle(
1014 &_sfAmbient,
1015 this->getType().getFieldDesc(AmbientFieldId),
1016 this));
1019 editSField(AmbientFieldMask);
1021 return returnValue;
1024 GetFieldHandlePtr FresnelMaterialBase::getHandleDiffuse (void) const
1026 SFColor3f::GetHandlePtr returnValue(
1027 new SFColor3f::GetHandle(
1028 &_sfDiffuse,
1029 this->getType().getFieldDesc(DiffuseFieldId),
1030 const_cast<FresnelMaterialBase *>(this)));
1032 return returnValue;
1035 EditFieldHandlePtr FresnelMaterialBase::editHandleDiffuse (void)
1037 SFColor3f::EditHandlePtr returnValue(
1038 new SFColor3f::EditHandle(
1039 &_sfDiffuse,
1040 this->getType().getFieldDesc(DiffuseFieldId),
1041 this));
1044 editSField(DiffuseFieldMask);
1046 return returnValue;
1049 GetFieldHandlePtr FresnelMaterialBase::getHandleSpecular (void) const
1051 SFColor3f::GetHandlePtr returnValue(
1052 new SFColor3f::GetHandle(
1053 &_sfSpecular,
1054 this->getType().getFieldDesc(SpecularFieldId),
1055 const_cast<FresnelMaterialBase *>(this)));
1057 return returnValue;
1060 EditFieldHandlePtr FresnelMaterialBase::editHandleSpecular (void)
1062 SFColor3f::EditHandlePtr returnValue(
1063 new SFColor3f::EditHandle(
1064 &_sfSpecular,
1065 this->getType().getFieldDesc(SpecularFieldId),
1066 this));
1069 editSField(SpecularFieldMask);
1071 return returnValue;
1074 GetFieldHandlePtr FresnelMaterialBase::getHandleShininess (void) const
1076 SFReal32::GetHandlePtr returnValue(
1077 new SFReal32::GetHandle(
1078 &_sfShininess,
1079 this->getType().getFieldDesc(ShininessFieldId),
1080 const_cast<FresnelMaterialBase *>(this)));
1082 return returnValue;
1085 EditFieldHandlePtr FresnelMaterialBase::editHandleShininess (void)
1087 SFReal32::EditHandlePtr returnValue(
1088 new SFReal32::EditHandle(
1089 &_sfShininess,
1090 this->getType().getFieldDesc(ShininessFieldId),
1091 this));
1094 editSField(ShininessFieldMask);
1096 return returnValue;
1099 GetFieldHandlePtr FresnelMaterialBase::getHandleEmission (void) const
1101 SFColor3f::GetHandlePtr returnValue(
1102 new SFColor3f::GetHandle(
1103 &_sfEmission,
1104 this->getType().getFieldDesc(EmissionFieldId),
1105 const_cast<FresnelMaterialBase *>(this)));
1107 return returnValue;
1110 EditFieldHandlePtr FresnelMaterialBase::editHandleEmission (void)
1112 SFColor3f::EditHandlePtr returnValue(
1113 new SFColor3f::EditHandle(
1114 &_sfEmission,
1115 this->getType().getFieldDesc(EmissionFieldId),
1116 this));
1119 editSField(EmissionFieldMask);
1121 return returnValue;
1124 GetFieldHandlePtr FresnelMaterialBase::getHandleTransparency (void) const
1126 SFReal32::GetHandlePtr returnValue(
1127 new SFReal32::GetHandle(
1128 &_sfTransparency,
1129 this->getType().getFieldDesc(TransparencyFieldId),
1130 const_cast<FresnelMaterialBase *>(this)));
1132 return returnValue;
1135 EditFieldHandlePtr FresnelMaterialBase::editHandleTransparency (void)
1137 SFReal32::EditHandlePtr returnValue(
1138 new SFReal32::EditHandle(
1139 &_sfTransparency,
1140 this->getType().getFieldDesc(TransparencyFieldId),
1141 this));
1144 editSField(TransparencyFieldMask);
1146 return returnValue;
1149 GetFieldHandlePtr FresnelMaterialBase::getHandleLit (void) const
1151 SFBool::GetHandlePtr returnValue(
1152 new SFBool::GetHandle(
1153 &_sfLit,
1154 this->getType().getFieldDesc(LitFieldId),
1155 const_cast<FresnelMaterialBase *>(this)));
1157 return returnValue;
1160 EditFieldHandlePtr FresnelMaterialBase::editHandleLit (void)
1162 SFBool::EditHandlePtr returnValue(
1163 new SFBool::EditHandle(
1164 &_sfLit,
1165 this->getType().getFieldDesc(LitFieldId),
1166 this));
1169 editSField(LitFieldMask);
1171 return returnValue;
1174 GetFieldHandlePtr FresnelMaterialBase::getHandleColorMaterial (void) const
1176 SFGLenum::GetHandlePtr returnValue(
1177 new SFGLenum::GetHandle(
1178 &_sfColorMaterial,
1179 this->getType().getFieldDesc(ColorMaterialFieldId),
1180 const_cast<FresnelMaterialBase *>(this)));
1182 return returnValue;
1185 EditFieldHandlePtr FresnelMaterialBase::editHandleColorMaterial (void)
1187 SFGLenum::EditHandlePtr returnValue(
1188 new SFGLenum::EditHandle(
1189 &_sfColorMaterial,
1190 this->getType().getFieldDesc(ColorMaterialFieldId),
1191 this));
1194 editSField(ColorMaterialFieldMask);
1196 return returnValue;
1199 GetFieldHandlePtr FresnelMaterialBase::getHandleIndex (void) const
1201 SFReal32::GetHandlePtr returnValue(
1202 new SFReal32::GetHandle(
1203 &_sfIndex,
1204 this->getType().getFieldDesc(IndexFieldId),
1205 const_cast<FresnelMaterialBase *>(this)));
1207 return returnValue;
1210 EditFieldHandlePtr FresnelMaterialBase::editHandleIndex (void)
1212 SFReal32::EditHandlePtr returnValue(
1213 new SFReal32::EditHandle(
1214 &_sfIndex,
1215 this->getType().getFieldDesc(IndexFieldId),
1216 this));
1219 editSField(IndexFieldMask);
1221 return returnValue;
1224 GetFieldHandlePtr FresnelMaterialBase::getHandleScale (void) const
1226 SFReal32::GetHandlePtr returnValue(
1227 new SFReal32::GetHandle(
1228 &_sfScale,
1229 this->getType().getFieldDesc(ScaleFieldId),
1230 const_cast<FresnelMaterialBase *>(this)));
1232 return returnValue;
1235 EditFieldHandlePtr FresnelMaterialBase::editHandleScale (void)
1237 SFReal32::EditHandlePtr returnValue(
1238 new SFReal32::EditHandle(
1239 &_sfScale,
1240 this->getType().getFieldDesc(ScaleFieldId),
1241 this));
1244 editSField(ScaleFieldMask);
1246 return returnValue;
1249 GetFieldHandlePtr FresnelMaterialBase::getHandleBias (void) const
1251 SFReal32::GetHandlePtr returnValue(
1252 new SFReal32::GetHandle(
1253 &_sfBias,
1254 this->getType().getFieldDesc(BiasFieldId),
1255 const_cast<FresnelMaterialBase *>(this)));
1257 return returnValue;
1260 EditFieldHandlePtr FresnelMaterialBase::editHandleBias (void)
1262 SFReal32::EditHandlePtr returnValue(
1263 new SFReal32::EditHandle(
1264 &_sfBias,
1265 this->getType().getFieldDesc(BiasFieldId),
1266 this));
1269 editSField(BiasFieldMask);
1271 return returnValue;
1274 GetFieldHandlePtr FresnelMaterialBase::getHandleImage (void) const
1276 SFUnrecImagePtr::GetHandlePtr returnValue(
1277 new SFUnrecImagePtr::GetHandle(
1278 &_sfImage,
1279 this->getType().getFieldDesc(ImageFieldId),
1280 const_cast<FresnelMaterialBase *>(this)));
1282 return returnValue;
1285 EditFieldHandlePtr FresnelMaterialBase::editHandleImage (void)
1287 SFUnrecImagePtr::EditHandlePtr returnValue(
1288 new SFUnrecImagePtr::EditHandle(
1289 &_sfImage,
1290 this->getType().getFieldDesc(ImageFieldId),
1291 this));
1293 returnValue->setSetMethod(
1294 boost::bind(&FresnelMaterial::setImage,
1295 static_cast<FresnelMaterial *>(this), _1));
1297 editSField(ImageFieldMask);
1299 return returnValue;
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),
1313 whichField,
1314 oOffsets,
1315 syncMode,
1316 uiSyncInfo);
1318 #endif
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));
1331 return returnValue;
1333 #endif
1335 void FresnelMaterialBase::resolveLinks(void)
1337 Inherited::resolveLinks();
1339 static_cast<FresnelMaterial *>(this)->setImage(NULL);
1345 OSG_END_NAMESPACE