fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Drawables / Geometry / PropertiesBase / OSGGeoProperty.h
blob5f8dad32a59b0a62ec03be8ea95bd77d0a7b72f7
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 #ifndef _OSGGEOPROPERTY_H_
40 #define _OSGGEOPROPERTY_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGGeoPropertyBase.h"
46 #include "OSGWindow.h"
48 OSG_BEGIN_NAMESPACE
50 class Window;
52 /*! \brief GeoProperty class. See \ref
53 PageSystemGeoProperty for a description.
54 \ingroup GrpDrawablesGeometryProperties
55 \ingroup GrpLibOSGDrawables
56 \includebasedoc
59 class OSG_SYSTEM_DLLMAPPING GeoProperty : public GeoPropertyBase
61 private:
63 /*========================== PUBLIC =================================*/
65 public:
67 typedef GeoPropertyBase Inherited;
69 static const UInt32 UsageUnspecified = 0x00000000;
71 static const UInt32 UsageSpaceMask = 0x0000000F;
73 static const UInt32 UsageObjectSpace = 0x00000001; // pos
74 static const UInt32 UsageTangentSpace = 0x00000002; // norm, binorm, tang
75 static const UInt32 UsageParameterSpace = 0x00000004; // tex coord
76 static const UInt32 UsageColorSpace = 0x00000008; // color
78 static const UInt32 UsageSystemSet = 0x10000000; // mark as set by OpenSG
81 static const UInt32 VectorTypeScalar = 0x00000000;
82 static const UInt32 VectorTypePoint = 0x00000001;
83 static const UInt32 VectorTypeVector = 0x00000002;
84 static const UInt32 VectorTypeColor = 0x00000003;
86 /*---------------------------------------------------------------------*/
87 /*! \name Property Interface */
88 /*! \{ */
90 virtual UInt32 getFormat (void) const = 0;
91 virtual UInt32 getFormatSize(void) const = 0;
92 virtual UInt32 getVectorType(void) const = 0;
93 virtual UInt32 getStride (void) const = 0;
94 virtual UInt32 getDimension (void) const = 0;
95 virtual SizeT size (void) const = 0;
96 virtual UInt32 size32 (void) const = 0;
97 virtual const UInt8 *getData (void) const
98 { return NULL; }
99 virtual UInt8 *editData (void)
100 { return NULL; }
101 virtual GeoPropertyTransitPtr clone (void) = 0;
103 /*! \} */
104 /*---------------------------------------------------------------------*/
105 /*! \name Sync */
106 /*! \{ */
108 virtual void changed(ConstFieldMaskArg whichField,
109 UInt32 origin,
110 BitVector detail);
112 /*! \} */
113 /*---------------------------------------------------------------------*/
114 /*! \name Output */
115 /*! \{ */
117 virtual void dump( UInt32 uiIndent = 0,
118 const BitVector bvFlags = 0) const;
120 /*! \} */
121 /*---------------------------------------------------------------------*/
122 /*! \name Chunk Class Access */
123 /*! \{ */
125 virtual const StateChunkClass * getClass (void) const;
127 /*! \} */
128 /*---------------------------------------------------------------------*/
129 /*! \name Static Chunk Class Access */
130 /*! \{ */
132 inline static UInt32 getStaticClassId (void);
133 inline static const StateChunkClass * getStaticClass (void);
135 /*! \} */
136 /*---------------------------------------------------------------------*/
137 /*! \name State Commands */
138 /*! \{ */
140 virtual void activate (DrawEnv *pEnv, UInt32 index = 0) = 0;
142 virtual void changeFrom (DrawEnv *pEnv,
143 StateChunk *old,
144 UInt32 index = 0) = 0;
146 virtual void deactivate (DrawEnv *pEnv, UInt32 index = 0) = 0;
148 virtual bool isTransparent (void) const;
150 /*! \} */
151 /*---------------------------------------------------------------------*/
152 /*! \name Limited Access */
153 /*! \{ */
155 UInt32 getGLId(void) const;
157 /*! \} */
158 /*---------------------------------------------------------------------*/
159 /*! \name Comparison */
160 /*! \{ */
162 virtual Real32 switchCost ( StateChunk * chunk );
164 virtual bool operator < (const StateChunk &other) const;
166 virtual bool operator == (const StateChunk &other) const;
167 virtual bool operator != (const StateChunk &other) const;
169 /*! \} */
170 /*---------------------------------------------------------------------*/
171 /*! \name Helper */
172 /*! \{ */
174 inline static UInt32 MapFormatToSize(GLenum format);
176 /*! \} */
177 /*========================= PROTECTED ===============================*/
179 protected:
181 // Variables should all be in GeoPropertyBase.
183 /*---------------------------------------------------------------------*/
184 /*! \name GL */
185 /*! \{ */
187 UInt32 handleGL (DrawEnv *pEnv,
188 UInt32 id,
189 Window::GLObjectStatusE mode,
190 UInt64 uiOptions);
191 static void handleDestroyGL(DrawEnv *pEnv,
192 UInt32 id,
193 Window::GLObjectStatusE mode );
195 /*! \} */
196 /*---------------------------------------------------------------------*/
197 /*! \name Constructors */
198 /*! \{ */
200 GeoProperty(void);
201 GeoProperty(const GeoProperty &source);
203 /*! \} */
204 /*---------------------------------------------------------------------*/
205 /*! \name Destructors */
206 /*! \{ */
208 virtual ~GeoProperty(void);
210 /*! \} */
212 virtual GLenum getBufferType(void) = 0; // buffer type for VBOs
214 static StateChunkClass _class;
216 /*---------------------------------------------------------------------*/
217 /*! \name OpenGL Extensions Used */
218 /*! \{ */
220 static UInt32 _extVertexBufferObject;
221 static UInt32 _extMultitexture;
222 static UInt32 _arbVertexProgram;
223 static UInt32 _extSecondaryColor;
224 static UInt32 _arbInstancedArrays;
226 static UInt32 _funcBindBuffer;
227 static UInt32 _funcMapBuffer;
228 static UInt32 _funcUnmapBuffer;
229 static UInt32 _funcBufferData;
230 static UInt32 _funcBufferSubData;
231 static UInt32 _funcDeleteBuffers;
232 static UInt32 _funcGenBuffers;
233 static UInt32 _funcVertexAttribPointerARB;
234 static UInt32 _funcEnableVertexAttribArrayARB;
235 static UInt32 _funcDisableVertexAttribArrayARB;
237 static UInt32 _funcClientActiveTextureARB;
238 static UInt32 _funcSecondaryColorPointer;
240 static UInt32 _funcVertexAttribDivisorARB;
242 /*! \} */
243 /*---------------------------------------------------------------------*/
244 /*! \name Init */
245 /*! \{ */
247 static void initMethod(InitPhase ePhase);
249 /*! \} */
250 /*========================== PRIVATE ================================*/
252 private:
254 friend class FieldContainer;
255 friend class GeoPropertyBase;
258 // prohibit default functions (move to 'public' if you need one)
259 void operator =(const GeoProperty &source);
262 typedef GeoProperty *GeoPropertyP;
264 OSG_END_NAMESPACE
266 #include "OSGGeoPropertyBase.inl"
267 #include "OSGGeoProperty.inl"
269 #endif /* _OSGGEOPROPERTY_H_ */