changed: gcc8 base update
[opensg.git] / Source / System / Material / Simple / OSGSimpleTexturedMaterialBase.cpp
blob3af90b1c4575fe1589bb02cf0ce27a622bd0cde9
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 SimpleTexturedMaterial!
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" // MinFilter default header
65 #include "OSGGL.h" // MagFilter default header
66 #include "OSGGL.h" // EnvMode default header
68 #include "OSGImage.h" // Image Class
70 #include "OSGSimpleTexturedMaterialBase.h"
71 #include "OSGSimpleTexturedMaterial.h"
73 #include <boost/bind.hpp>
75 OSG_BEGIN_NAMESPACE
77 /***************************************************************************\
78 * Description *
79 \***************************************************************************/
81 /*! \class OSG::SimpleTexturedMaterial
82 The simple textured material class. See \ref
83 PageSystemMaterialTexturedSimpleMaterial for a description.
85 A OSG::SimpleMaterial with an added texture. It doesn't expose all features
86 of the texture, just the ones needed most often.
88 OSG::SimpleTexturedMaterial::_sfImage defines the texture,
89 OSG::SimpleTexturedMaterial::_sfMinFilter and
90 OSG::SimpleTexturedMaterial::_sfMagFilter the used filters and
91 OSG::SimpleTexturedMaterial::_sfEnvMode the environment mode. As a special
92 case
93 OSG::SimpleTexturedMaterial::_sfEnvMap can be used to use the texture as a
94 spherical environment map.
97 /***************************************************************************\
98 * Field Documentation *
99 \***************************************************************************/
101 /*! \var Image * SimpleTexturedMaterialBase::_sfImage
102 Defines the texture image.
105 /*! \var GLenum SimpleTexturedMaterialBase::_sfMinFilter
106 Defines the minification filter, see glTexParameter for details.
107 Default: GL_LINEAR_MIPMAP_LINEAR.
110 /*! \var GLenum SimpleTexturedMaterialBase::_sfMagFilter
111 Defines the magnification filter, see glTexParameter for details.
112 Default: GL_LINEAR
115 /*! \var GLenum SimpleTexturedMaterialBase::_sfEnvMode
116 Sets the environment mode, defining how texture and lighting color interact.
117 Default: GL_REPLACE.
120 /*! \var bool SimpleTexturedMaterialBase::_sfEnvMap
121 Defines whether to use the texture as a spherical environment map.
125 /***************************************************************************\
126 * FieldType/FieldTrait Instantiation *
127 \***************************************************************************/
129 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
130 PointerType FieldTraits<SimpleTexturedMaterial *, nsOSG>::_type(
131 "SimpleTexturedMaterialPtr",
132 "SimpleMaterialPtr",
133 SimpleTexturedMaterial::getClassType(),
134 nsOSG);
135 #endif
137 OSG_FIELDTRAITS_GETTYPE_NS(SimpleTexturedMaterial *, nsOSG)
139 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
140 SimpleTexturedMaterial *,
141 nsOSG)
143 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
144 SimpleTexturedMaterial *,
145 nsOSG)
147 /***************************************************************************\
148 * Field Description *
149 \***************************************************************************/
151 void SimpleTexturedMaterialBase::classDescInserter(TypeObject &oType)
153 FieldDescriptionBase *pDesc = NULL;
156 pDesc = new SFUnrecImagePtr::Description(
157 SFUnrecImagePtr::getClassType(),
158 "image",
159 "Defines the texture image.\n",
160 ImageFieldId, ImageFieldMask,
161 false,
162 (Field::SFDefaultFlags | Field::FStdAccess),
163 static_cast<FieldEditMethodSig>(&SimpleTexturedMaterial::editHandleImage),
164 static_cast<FieldGetMethodSig >(&SimpleTexturedMaterial::getHandleImage));
166 oType.addInitialDesc(pDesc);
168 pDesc = new SFGLenum::Description(
169 SFGLenum::getClassType(),
170 "minFilter",
171 "Defines the minification filter, see glTexParameter for details.\n"
172 "Default: GL_LINEAR_MIPMAP_LINEAR.\n",
173 MinFilterFieldId, MinFilterFieldMask,
174 false,
175 (Field::SFDefaultFlags | Field::FStdAccess),
176 static_cast<FieldEditMethodSig>(&SimpleTexturedMaterial::editHandleMinFilter),
177 static_cast<FieldGetMethodSig >(&SimpleTexturedMaterial::getHandleMinFilter));
179 oType.addInitialDesc(pDesc);
181 pDesc = new SFGLenum::Description(
182 SFGLenum::getClassType(),
183 "magFilter",
184 "Defines the magnification filter, see glTexParameter for details.\n"
185 "Default: GL_LINEAR\n",
186 MagFilterFieldId, MagFilterFieldMask,
187 false,
188 (Field::SFDefaultFlags | Field::FStdAccess),
189 static_cast<FieldEditMethodSig>(&SimpleTexturedMaterial::editHandleMagFilter),
190 static_cast<FieldGetMethodSig >(&SimpleTexturedMaterial::getHandleMagFilter));
192 oType.addInitialDesc(pDesc);
194 pDesc = new SFGLenum::Description(
195 SFGLenum::getClassType(),
196 "envMode",
197 "Sets the environment mode, defining how texture and lighting color interact.\n"
198 "Default: GL_REPLACE.\n",
199 EnvModeFieldId, EnvModeFieldMask,
200 false,
201 (Field::SFDefaultFlags | Field::FStdAccess),
202 static_cast<FieldEditMethodSig>(&SimpleTexturedMaterial::editHandleEnvMode),
203 static_cast<FieldGetMethodSig >(&SimpleTexturedMaterial::getHandleEnvMode));
205 oType.addInitialDesc(pDesc);
207 pDesc = new SFBool::Description(
208 SFBool::getClassType(),
209 "envMap",
210 "Defines whether to use the texture as a spherical environment map.\n",
211 EnvMapFieldId, EnvMapFieldMask,
212 false,
213 (Field::SFDefaultFlags | Field::FStdAccess),
214 static_cast<FieldEditMethodSig>(&SimpleTexturedMaterial::editHandleEnvMap),
215 static_cast<FieldGetMethodSig >(&SimpleTexturedMaterial::getHandleEnvMap));
217 oType.addInitialDesc(pDesc);
221 SimpleTexturedMaterialBase::TypeObject SimpleTexturedMaterialBase::_type(
222 SimpleTexturedMaterialBase::getClassname(),
223 Inherited::getClassname(),
224 "NULL",
225 nsOSG, //Namespace
226 reinterpret_cast<PrototypeCreateF>(&SimpleTexturedMaterialBase::createEmptyLocal),
227 reinterpret_cast<InitContainerF>(&SimpleTexturedMaterial::initMethod),
228 reinterpret_cast<ExitContainerF>(&SimpleTexturedMaterial::exitMethod),
229 reinterpret_cast<InitalInsertDescFunc>(
230 reinterpret_cast<void *>(&SimpleTexturedMaterial::classDescInserter)),
231 false,
233 "<?xml version=\"1.0\"?>\n"
234 "\n"
235 "<FieldContainer\n"
236 " name=\"SimpleTexturedMaterial\"\n"
237 " parent=\"SimpleMaterial\"\n"
238 " library=\"Drawable\"\n"
239 " pointerfieldtypes=\"both\"\n"
240 " structure=\"concrete\"\n"
241 " systemcomponent=\"true\"\n"
242 " parentsystemcomponent=\"true\"\n"
243 " decoratable=\"false\"\n"
244 " docGroupBase=\"GrpDrawablesMaterial\"\n"
245 " >\n"
246 " The simple textured material class. See \\ref\n"
247 " PageSystemMaterialTexturedSimpleMaterial for a description.\n"
248 "\n"
249 " A OSG::SimpleMaterial with an added texture. It doesn't expose all features \n"
250 " of the texture, just the ones needed most often.\n"
251 "\n"
252 " OSG::SimpleTexturedMaterial::_sfImage defines the texture, \n"
253 " OSG::SimpleTexturedMaterial::_sfMinFilter and\n"
254 " OSG::SimpleTexturedMaterial::_sfMagFilter the used filters and \n"
255 " OSG::SimpleTexturedMaterial::_sfEnvMode the environment mode. As a special \n"
256 " case\n"
257 " OSG::SimpleTexturedMaterial::_sfEnvMap can be used to use the texture as a\n"
258 " spherical environment map.\n"
259 " <Field\n"
260 "\t name=\"image\"\n"
261 "\t type=\"ImagePtr\"\n"
262 "\t cardinality=\"single\"\n"
263 "\t visibility=\"external\"\n"
264 "\t access=\"public\"\n"
265 "\t >\n"
266 "\tDefines the texture image.\n"
267 " </Field>\n"
268 " <Field\n"
269 "\t name=\"minFilter\"\n"
270 "\t type=\"GLenum\"\n"
271 "\t cardinality=\"single\"\n"
272 "\t visibility=\"external\"\n"
273 "\t defaultValue=\"GL_LINEAR_MIPMAP_LINEAR\"\n"
274 "\t defaultHeader=\"&quot;OSGGL.h&quot;\"\n"
275 "\t access=\"public\"\n"
276 " potential_values=\"GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_LINEAR\"\n"
277 "\t >\n"
278 "\tDefines the minification filter, see glTexParameter for details.\n"
279 " Default: GL_LINEAR_MIPMAP_LINEAR.\n"
280 " </Field>\n"
281 " <Field\n"
282 "\t name=\"magFilter\"\n"
283 "\t type=\"GLenum\"\n"
284 "\t cardinality=\"single\"\n"
285 "\t visibility=\"external\"\n"
286 "\t defaultValue=\"GL_LINEAR\"\n"
287 "\t defaultHeader=\"&quot;OSGGL.h&quot;\"\n"
288 "\t access=\"public\"\n"
289 " potential_values=\"GL_NEAREST, GL_LINEAR\"\n"
290 "\t >\n"
291 "\tDefines the magnification filter, see glTexParameter for details.\n"
292 " Default: GL_LINEAR\n"
293 " </Field>\n"
294 " <Field\n"
295 "\t name=\"envMode\"\n"
296 "\t type=\"GLenum\"\n"
297 "\t cardinality=\"single\"\n"
298 "\t visibility=\"external\"\n"
299 "\t defaultValue=\"GL_REPLACE\"\n"
300 "\t defaultHeader=\"&quot;OSGGL.h&quot;\"\n"
301 "\t access=\"public\"\n"
302 " potential_values=\"GL_MODULATE, GL_DECAL, GL_BLEND, GL_REPLACE, GL_ADD, GL_COMBINE\"\n"
303 "\t >\n"
304 "\tSets the environment mode, defining how texture and lighting color interact.\n"
305 " Default: GL_REPLACE.\n"
306 " </Field>\n"
307 " <Field\n"
308 "\t name=\"envMap\"\n"
309 "\t type=\"bool\"\n"
310 "\t cardinality=\"single\"\n"
311 "\t visibility=\"external\"\n"
312 "\t defaultValue=\"false\"\n"
313 "\t access=\"public\"\n"
314 "\t >\n"
315 "\tDefines whether to use the texture as a spherical environment map.\n"
316 " </Field>\n"
317 "</FieldContainer>\n",
318 "The simple textured material class. See \\ref\n"
319 "PageSystemMaterialTexturedSimpleMaterial for a description.\n"
320 "\n"
321 "A OSG::SimpleMaterial with an added texture. It doesn't expose all features \n"
322 "of the texture, just the ones needed most often.\n"
323 "\n"
324 "OSG::SimpleTexturedMaterial::_sfImage defines the texture, \n"
325 "OSG::SimpleTexturedMaterial::_sfMinFilter and\n"
326 "OSG::SimpleTexturedMaterial::_sfMagFilter the used filters and \n"
327 "OSG::SimpleTexturedMaterial::_sfEnvMode the environment mode. As a special \n"
328 "case\n"
329 "OSG::SimpleTexturedMaterial::_sfEnvMap can be used to use the texture as a\n"
330 "spherical environment map.\n"
333 /*------------------------------ get -----------------------------------*/
335 FieldContainerType &SimpleTexturedMaterialBase::getType(void)
337 return _type;
340 const FieldContainerType &SimpleTexturedMaterialBase::getType(void) const
342 return _type;
345 UInt32 SimpleTexturedMaterialBase::getContainerSize(void) const
347 return sizeof(SimpleTexturedMaterial);
350 /*------------------------- decorator get ------------------------------*/
353 //! Get the SimpleTexturedMaterial::_sfImage field.
354 const SFUnrecImagePtr *SimpleTexturedMaterialBase::getSFImage(void) const
356 return &_sfImage;
359 SFUnrecImagePtr *SimpleTexturedMaterialBase::editSFImage (void)
361 editSField(ImageFieldMask);
363 return &_sfImage;
366 //! Get the value of the SimpleTexturedMaterial::_sfImage field.
367 Image * SimpleTexturedMaterialBase::getImage(void) const
369 return _sfImage.getValue();
372 //! Set the value of the SimpleTexturedMaterial::_sfImage field.
373 void SimpleTexturedMaterialBase::setImage(Image * const value)
375 editSField(ImageFieldMask);
377 _sfImage.setValue(value);
381 SFGLenum *SimpleTexturedMaterialBase::editSFMinFilter(void)
383 editSField(MinFilterFieldMask);
385 return &_sfMinFilter;
388 const SFGLenum *SimpleTexturedMaterialBase::getSFMinFilter(void) const
390 return &_sfMinFilter;
394 SFGLenum *SimpleTexturedMaterialBase::editSFMagFilter(void)
396 editSField(MagFilterFieldMask);
398 return &_sfMagFilter;
401 const SFGLenum *SimpleTexturedMaterialBase::getSFMagFilter(void) const
403 return &_sfMagFilter;
407 SFGLenum *SimpleTexturedMaterialBase::editSFEnvMode(void)
409 editSField(EnvModeFieldMask);
411 return &_sfEnvMode;
414 const SFGLenum *SimpleTexturedMaterialBase::getSFEnvMode(void) const
416 return &_sfEnvMode;
420 SFBool *SimpleTexturedMaterialBase::editSFEnvMap(void)
422 editSField(EnvMapFieldMask);
424 return &_sfEnvMap;
427 const SFBool *SimpleTexturedMaterialBase::getSFEnvMap(void) const
429 return &_sfEnvMap;
437 /*------------------------------ access -----------------------------------*/
439 SizeT SimpleTexturedMaterialBase::getBinSize(ConstFieldMaskArg whichField)
441 SizeT returnValue = Inherited::getBinSize(whichField);
443 if(FieldBits::NoField != (ImageFieldMask & whichField))
445 returnValue += _sfImage.getBinSize();
447 if(FieldBits::NoField != (MinFilterFieldMask & whichField))
449 returnValue += _sfMinFilter.getBinSize();
451 if(FieldBits::NoField != (MagFilterFieldMask & whichField))
453 returnValue += _sfMagFilter.getBinSize();
455 if(FieldBits::NoField != (EnvModeFieldMask & whichField))
457 returnValue += _sfEnvMode.getBinSize();
459 if(FieldBits::NoField != (EnvMapFieldMask & whichField))
461 returnValue += _sfEnvMap.getBinSize();
464 return returnValue;
467 void SimpleTexturedMaterialBase::copyToBin(BinaryDataHandler &pMem,
468 ConstFieldMaskArg whichField)
470 Inherited::copyToBin(pMem, whichField);
472 if(FieldBits::NoField != (ImageFieldMask & whichField))
474 _sfImage.copyToBin(pMem);
476 if(FieldBits::NoField != (MinFilterFieldMask & whichField))
478 _sfMinFilter.copyToBin(pMem);
480 if(FieldBits::NoField != (MagFilterFieldMask & whichField))
482 _sfMagFilter.copyToBin(pMem);
484 if(FieldBits::NoField != (EnvModeFieldMask & whichField))
486 _sfEnvMode.copyToBin(pMem);
488 if(FieldBits::NoField != (EnvMapFieldMask & whichField))
490 _sfEnvMap.copyToBin(pMem);
494 void SimpleTexturedMaterialBase::copyFromBin(BinaryDataHandler &pMem,
495 ConstFieldMaskArg whichField)
497 Inherited::copyFromBin(pMem, whichField);
499 if(FieldBits::NoField != (ImageFieldMask & whichField))
501 editSField(ImageFieldMask);
502 _sfImage.copyFromBin(pMem);
504 if(FieldBits::NoField != (MinFilterFieldMask & whichField))
506 editSField(MinFilterFieldMask);
507 _sfMinFilter.copyFromBin(pMem);
509 if(FieldBits::NoField != (MagFilterFieldMask & whichField))
511 editSField(MagFilterFieldMask);
512 _sfMagFilter.copyFromBin(pMem);
514 if(FieldBits::NoField != (EnvModeFieldMask & whichField))
516 editSField(EnvModeFieldMask);
517 _sfEnvMode.copyFromBin(pMem);
519 if(FieldBits::NoField != (EnvMapFieldMask & whichField))
521 editSField(EnvMapFieldMask);
522 _sfEnvMap.copyFromBin(pMem);
526 //! create a new instance of the class
527 SimpleTexturedMaterialTransitPtr SimpleTexturedMaterialBase::createLocal(BitVector bFlags)
529 SimpleTexturedMaterialTransitPtr fc;
531 if(getClassType().getPrototype() != NULL)
533 FieldContainerTransitPtr tmpPtr =
534 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
536 fc = dynamic_pointer_cast<SimpleTexturedMaterial>(tmpPtr);
539 return fc;
542 //! create a new instance of the class, copy the container flags
543 SimpleTexturedMaterialTransitPtr SimpleTexturedMaterialBase::createDependent(BitVector bFlags)
545 SimpleTexturedMaterialTransitPtr fc;
547 if(getClassType().getPrototype() != NULL)
549 FieldContainerTransitPtr tmpPtr =
550 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
552 fc = dynamic_pointer_cast<SimpleTexturedMaterial>(tmpPtr);
555 return fc;
558 //! create a new instance of the class
559 SimpleTexturedMaterialTransitPtr SimpleTexturedMaterialBase::create(void)
561 SimpleTexturedMaterialTransitPtr fc;
563 if(getClassType().getPrototype() != NULL)
565 FieldContainerTransitPtr tmpPtr =
566 getClassType().getPrototype()-> shallowCopy();
568 fc = dynamic_pointer_cast<SimpleTexturedMaterial>(tmpPtr);
571 return fc;
574 SimpleTexturedMaterial *SimpleTexturedMaterialBase::createEmptyLocal(BitVector bFlags)
576 SimpleTexturedMaterial *returnValue;
578 newPtr<SimpleTexturedMaterial>(returnValue, bFlags);
580 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
582 return returnValue;
585 //! create an empty new instance of the class, do not copy the prototype
586 SimpleTexturedMaterial *SimpleTexturedMaterialBase::createEmpty(void)
588 SimpleTexturedMaterial *returnValue;
590 newPtr<SimpleTexturedMaterial>(returnValue, Thread::getCurrentLocalFlags());
592 returnValue->_pFieldFlags->_bNamespaceMask &=
593 ~Thread::getCurrentLocalFlags();
595 return returnValue;
599 FieldContainerTransitPtr SimpleTexturedMaterialBase::shallowCopyLocal(
600 BitVector bFlags) const
602 SimpleTexturedMaterial *tmpPtr;
604 newPtr(tmpPtr, dynamic_cast<const SimpleTexturedMaterial *>(this), bFlags);
606 FieldContainerTransitPtr returnValue(tmpPtr);
608 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
610 return returnValue;
613 FieldContainerTransitPtr SimpleTexturedMaterialBase::shallowCopyDependent(
614 BitVector bFlags) const
616 SimpleTexturedMaterial *tmpPtr;
618 newPtr(tmpPtr, dynamic_cast<const SimpleTexturedMaterial *>(this), ~bFlags);
620 FieldContainerTransitPtr returnValue(tmpPtr);
622 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
624 return returnValue;
627 FieldContainerTransitPtr SimpleTexturedMaterialBase::shallowCopy(void) const
629 SimpleTexturedMaterial *tmpPtr;
631 newPtr(tmpPtr,
632 dynamic_cast<const SimpleTexturedMaterial *>(this),
633 Thread::getCurrentLocalFlags());
635 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
637 FieldContainerTransitPtr returnValue(tmpPtr);
639 return returnValue;
645 /*------------------------- constructors ----------------------------------*/
647 SimpleTexturedMaterialBase::SimpleTexturedMaterialBase(void) :
648 Inherited(),
649 _sfImage (NULL),
650 _sfMinFilter (GLenum(GL_LINEAR_MIPMAP_LINEAR)),
651 _sfMagFilter (GLenum(GL_LINEAR)),
652 _sfEnvMode (GLenum(GL_REPLACE)),
653 _sfEnvMap (bool(false))
657 SimpleTexturedMaterialBase::SimpleTexturedMaterialBase(const SimpleTexturedMaterialBase &source) :
658 Inherited(source),
659 _sfImage (NULL),
660 _sfMinFilter (source._sfMinFilter ),
661 _sfMagFilter (source._sfMagFilter ),
662 _sfEnvMode (source._sfEnvMode ),
663 _sfEnvMap (source._sfEnvMap )
668 /*-------------------------- destructors ----------------------------------*/
670 SimpleTexturedMaterialBase::~SimpleTexturedMaterialBase(void)
674 void SimpleTexturedMaterialBase::onCreate(const SimpleTexturedMaterial *source)
676 Inherited::onCreate(source);
678 if(source != NULL)
680 SimpleTexturedMaterial *pThis = static_cast<SimpleTexturedMaterial *>(this);
682 pThis->setImage(source->getImage());
686 GetFieldHandlePtr SimpleTexturedMaterialBase::getHandleImage (void) const
688 SFUnrecImagePtr::GetHandlePtr returnValue(
689 new SFUnrecImagePtr::GetHandle(
690 &_sfImage,
691 this->getType().getFieldDesc(ImageFieldId),
692 const_cast<SimpleTexturedMaterialBase *>(this)));
694 return returnValue;
697 EditFieldHandlePtr SimpleTexturedMaterialBase::editHandleImage (void)
699 SFUnrecImagePtr::EditHandlePtr returnValue(
700 new SFUnrecImagePtr::EditHandle(
701 &_sfImage,
702 this->getType().getFieldDesc(ImageFieldId),
703 this));
705 returnValue->setSetMethod(
706 boost::bind(&SimpleTexturedMaterial::setImage,
707 static_cast<SimpleTexturedMaterial *>(this), _1));
709 editSField(ImageFieldMask);
711 return returnValue;
714 GetFieldHandlePtr SimpleTexturedMaterialBase::getHandleMinFilter (void) const
716 SFGLenum::GetHandlePtr returnValue(
717 new SFGLenum::GetHandle(
718 &_sfMinFilter,
719 this->getType().getFieldDesc(MinFilterFieldId),
720 const_cast<SimpleTexturedMaterialBase *>(this)));
722 return returnValue;
725 EditFieldHandlePtr SimpleTexturedMaterialBase::editHandleMinFilter (void)
727 SFGLenum::EditHandlePtr returnValue(
728 new SFGLenum::EditHandle(
729 &_sfMinFilter,
730 this->getType().getFieldDesc(MinFilterFieldId),
731 this));
734 editSField(MinFilterFieldMask);
736 return returnValue;
739 GetFieldHandlePtr SimpleTexturedMaterialBase::getHandleMagFilter (void) const
741 SFGLenum::GetHandlePtr returnValue(
742 new SFGLenum::GetHandle(
743 &_sfMagFilter,
744 this->getType().getFieldDesc(MagFilterFieldId),
745 const_cast<SimpleTexturedMaterialBase *>(this)));
747 return returnValue;
750 EditFieldHandlePtr SimpleTexturedMaterialBase::editHandleMagFilter (void)
752 SFGLenum::EditHandlePtr returnValue(
753 new SFGLenum::EditHandle(
754 &_sfMagFilter,
755 this->getType().getFieldDesc(MagFilterFieldId),
756 this));
759 editSField(MagFilterFieldMask);
761 return returnValue;
764 GetFieldHandlePtr SimpleTexturedMaterialBase::getHandleEnvMode (void) const
766 SFGLenum::GetHandlePtr returnValue(
767 new SFGLenum::GetHandle(
768 &_sfEnvMode,
769 this->getType().getFieldDesc(EnvModeFieldId),
770 const_cast<SimpleTexturedMaterialBase *>(this)));
772 return returnValue;
775 EditFieldHandlePtr SimpleTexturedMaterialBase::editHandleEnvMode (void)
777 SFGLenum::EditHandlePtr returnValue(
778 new SFGLenum::EditHandle(
779 &_sfEnvMode,
780 this->getType().getFieldDesc(EnvModeFieldId),
781 this));
784 editSField(EnvModeFieldMask);
786 return returnValue;
789 GetFieldHandlePtr SimpleTexturedMaterialBase::getHandleEnvMap (void) const
791 SFBool::GetHandlePtr returnValue(
792 new SFBool::GetHandle(
793 &_sfEnvMap,
794 this->getType().getFieldDesc(EnvMapFieldId),
795 const_cast<SimpleTexturedMaterialBase *>(this)));
797 return returnValue;
800 EditFieldHandlePtr SimpleTexturedMaterialBase::editHandleEnvMap (void)
802 SFBool::EditHandlePtr returnValue(
803 new SFBool::EditHandle(
804 &_sfEnvMap,
805 this->getType().getFieldDesc(EnvMapFieldId),
806 this));
809 editSField(EnvMapFieldMask);
811 return returnValue;
815 #ifdef OSG_MT_CPTR_ASPECT
816 void SimpleTexturedMaterialBase::execSyncV( FieldContainer &oFrom,
817 ConstFieldMaskArg whichField,
818 AspectOffsetStore &oOffsets,
819 ConstFieldMaskArg syncMode,
820 const UInt32 uiSyncInfo)
822 SimpleTexturedMaterial *pThis = static_cast<SimpleTexturedMaterial *>(this);
824 pThis->execSync(static_cast<SimpleTexturedMaterial *>(&oFrom),
825 whichField,
826 oOffsets,
827 syncMode,
828 uiSyncInfo);
830 #endif
833 #ifdef OSG_MT_CPTR_ASPECT
834 FieldContainer *SimpleTexturedMaterialBase::createAspectCopy(
835 const FieldContainer *pRefAspect) const
837 SimpleTexturedMaterial *returnValue;
839 newAspectCopy(returnValue,
840 dynamic_cast<const SimpleTexturedMaterial *>(pRefAspect),
841 dynamic_cast<const SimpleTexturedMaterial *>(this));
843 return returnValue;
845 #endif
847 void SimpleTexturedMaterialBase::resolveLinks(void)
849 Inherited::resolveLinks();
851 static_cast<SimpleTexturedMaterial *>(this)->setImage(NULL);
857 OSG_END_NAMESPACE