fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Base / OSGTextureBaseChunkBase.cpp
blobd9ea468ea81daaa7f0b55e62e360658c654e3d44
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 TextureBaseChunk!
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" // Target default header
67 #include "OSGTextureBaseChunkBase.h"
68 #include "OSGTextureBaseChunk.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::TextureBaseChunk
79 See \ref PageSystemTextureBaseChunk for a description.
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var GLenum TextureBaseChunkBase::_sfTarget
87 Texture target. Overwrite automatically determined texture target
88 based on the parameters of the assigned image if set to anything
89 else than GL_NONE. Used for nVidia's rectangle textures. Be careful
90 when using it!
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<TextureBaseChunk *, nsOSG>::_type(
100 "TextureBaseChunkPtr",
101 "StateChunkPtr",
102 TextureBaseChunk::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(TextureBaseChunk *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 TextureBaseChunk *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 TextureBaseChunk *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void TextureBaseChunkBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new SFGLenum::Description(
126 SFGLenum::getClassType(),
127 "target",
128 "Texture target. Overwrite automatically determined texture target\n"
129 "based on the parameters of the assigned image if set to anything \n"
130 "else than GL_NONE. Used for nVidia's rectangle textures. Be careful\n"
131 "when using it!\n",
132 TargetFieldId, TargetFieldMask,
133 false,
134 (Field::SFDefaultFlags | Field::FStdAccess),
135 static_cast<FieldEditMethodSig>(&TextureBaseChunk::editHandleTarget),
136 static_cast<FieldGetMethodSig >(&TextureBaseChunk::getHandleTarget));
138 oType.addInitialDesc(pDesc);
142 TextureBaseChunkBase::TypeObject TextureBaseChunkBase::_type(
143 TextureBaseChunkBase::getClassname(),
144 Inherited::getClassname(),
145 "NULL",
146 nsOSG, //Namespace
147 NULL,
148 reinterpret_cast<InitContainerF>(&TextureBaseChunk::initMethod),
149 reinterpret_cast<ExitContainerF>(&TextureBaseChunk::exitMethod),
150 reinterpret_cast<InitalInsertDescFunc>(
151 reinterpret_cast<void *>(&TextureBaseChunk::classDescInserter)),
152 false,
154 "<?xml version=\"1.0\"?>\n"
155 "\n"
156 "<FieldContainer\n"
157 " name=\"TextureBaseChunk\"\n"
158 " parent=\"StateChunk\"\n"
159 " library=\"System\"\n"
160 " pointerfieldtypes=\"both\"\n"
161 " structure=\"abstract\"\n"
162 " systemcomponent=\"true\"\n"
163 " parentsystemcomponent=\"true\"\n"
164 " decoratable=\"false\"\n"
165 " useLocalIncludes=\"false\"\n"
166 " docGroupBase=\"GrpSystemState\"\n"
167 " >\n"
168 " \n"
169 " See \\ref PageSystemTextureBaseChunk for a description.\n"
170 " <Field\n"
171 " name=\"target\"\n"
172 " type=\"GLenum\"\n"
173 " cardinality=\"single\"\n"
174 " visibility=\"external\"\n"
175 " defaultValue=\"GL_NONE\"\n"
176 " defaultHeader=\"&quot;OSGGL.h&quot;\"\n"
177 " access=\"public\"\n"
178 " >\n"
179 " Texture target. Overwrite automatically determined texture target\n"
180 " based on the parameters of the assigned image if set to anything \n"
181 " else than GL_NONE. Used for nVidia's rectangle textures. Be careful\n"
182 " when using it!\n"
183 " </Field>\n"
184 "</FieldContainer>\n",
185 "See \\ref PageSystemTextureBaseChunk for a description.\n"
188 /*------------------------------ get -----------------------------------*/
190 FieldContainerType &TextureBaseChunkBase::getType(void)
192 return _type;
195 const FieldContainerType &TextureBaseChunkBase::getType(void) const
197 return _type;
200 UInt32 TextureBaseChunkBase::getContainerSize(void) const
202 return sizeof(TextureBaseChunk);
205 /*------------------------- decorator get ------------------------------*/
208 SFGLenum *TextureBaseChunkBase::editSFTarget(void)
210 editSField(TargetFieldMask);
212 return &_sfTarget;
215 const SFGLenum *TextureBaseChunkBase::getSFTarget(void) const
217 return &_sfTarget;
225 /*------------------------------ access -----------------------------------*/
227 SizeT TextureBaseChunkBase::getBinSize(ConstFieldMaskArg whichField)
229 SizeT returnValue = Inherited::getBinSize(whichField);
231 if(FieldBits::NoField != (TargetFieldMask & whichField))
233 returnValue += _sfTarget.getBinSize();
236 return returnValue;
239 void TextureBaseChunkBase::copyToBin(BinaryDataHandler &pMem,
240 ConstFieldMaskArg whichField)
242 Inherited::copyToBin(pMem, whichField);
244 if(FieldBits::NoField != (TargetFieldMask & whichField))
246 _sfTarget.copyToBin(pMem);
250 void TextureBaseChunkBase::copyFromBin(BinaryDataHandler &pMem,
251 ConstFieldMaskArg whichField)
253 Inherited::copyFromBin(pMem, whichField);
255 if(FieldBits::NoField != (TargetFieldMask & whichField))
257 editSField(TargetFieldMask);
258 _sfTarget.copyFromBin(pMem);
265 /*------------------------- constructors ----------------------------------*/
267 TextureBaseChunkBase::TextureBaseChunkBase(void) :
268 Inherited(),
269 _sfTarget (GLenum(GL_NONE))
273 TextureBaseChunkBase::TextureBaseChunkBase(const TextureBaseChunkBase &source) :
274 Inherited(source),
275 _sfTarget (source._sfTarget )
280 /*-------------------------- destructors ----------------------------------*/
282 TextureBaseChunkBase::~TextureBaseChunkBase(void)
287 GetFieldHandlePtr TextureBaseChunkBase::getHandleTarget (void) const
289 SFGLenum::GetHandlePtr returnValue(
290 new SFGLenum::GetHandle(
291 &_sfTarget,
292 this->getType().getFieldDesc(TargetFieldId),
293 const_cast<TextureBaseChunkBase *>(this)));
295 return returnValue;
298 EditFieldHandlePtr TextureBaseChunkBase::editHandleTarget (void)
300 SFGLenum::EditHandlePtr returnValue(
301 new SFGLenum::EditHandle(
302 &_sfTarget,
303 this->getType().getFieldDesc(TargetFieldId),
304 this));
307 editSField(TargetFieldMask);
309 return returnValue;
313 #ifdef OSG_MT_CPTR_ASPECT
314 void TextureBaseChunkBase::execSyncV( FieldContainer &oFrom,
315 ConstFieldMaskArg whichField,
316 AspectOffsetStore &oOffsets,
317 ConstFieldMaskArg syncMode,
318 const UInt32 uiSyncInfo)
320 TextureBaseChunk *pThis = static_cast<TextureBaseChunk *>(this);
322 pThis->execSync(static_cast<TextureBaseChunk *>(&oFrom),
323 whichField,
324 oOffsets,
325 syncMode,
326 uiSyncInfo);
328 #endif
332 void TextureBaseChunkBase::resolveLinks(void)
334 Inherited::resolveLinks();
340 OSG_END_NAMESPACE