1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 #ifndef _OSGGEOPROPERTY_H_
40 #define _OSGGEOPROPERTY_H_
45 #include "OSGGeoPropertyBase.h"
46 #include "OSGWindow.h"
52 /*! \brief GeoProperty class. See \ref
53 PageSystemGeoProperty for a description.
54 \ingroup GrpDrawablesGeometryProperties
55 \ingroup GrpLibOSGDrawables
59 class OSG_SYSTEM_DLLMAPPING GeoProperty
: public GeoPropertyBase
63 /*========================== 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 */
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
99 virtual UInt8
*editData (void)
101 virtual GeoPropertyTransitPtr
clone (void) = 0;
104 /*---------------------------------------------------------------------*/
108 virtual void changed(ConstFieldMaskArg whichField
,
113 /*---------------------------------------------------------------------*/
117 virtual void dump( UInt32 uiIndent
= 0,
118 const BitVector bvFlags
= 0) const;
121 /*---------------------------------------------------------------------*/
122 /*! \name Chunk Class Access */
125 virtual const StateChunkClass
* getClass (void) const;
128 /*---------------------------------------------------------------------*/
129 /*! \name Static Chunk Class Access */
132 inline static UInt32
getStaticClassId (void);
133 inline static const StateChunkClass
* getStaticClass (void);
136 /*---------------------------------------------------------------------*/
137 /*! \name State Commands */
140 virtual void activate (DrawEnv
*pEnv
, UInt32 index
= 0) = 0;
142 virtual void changeFrom (DrawEnv
*pEnv
,
144 UInt32 index
= 0) = 0;
146 virtual void deactivate (DrawEnv
*pEnv
, UInt32 index
= 0) = 0;
148 virtual bool isTransparent (void) const;
151 /*---------------------------------------------------------------------*/
152 /*! \name Limited Access */
155 UInt32
getGLId(void) const;
158 /*---------------------------------------------------------------------*/
159 /*! \name Comparison */
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;
170 /*---------------------------------------------------------------------*/
174 inline static UInt32
MapFormatToSize(GLenum format
);
177 /*========================= PROTECTED ===============================*/
181 // Variables should all be in GeoPropertyBase.
183 /*---------------------------------------------------------------------*/
187 UInt32
handleGL (DrawEnv
*pEnv
,
189 Window::GLObjectStatusE mode
,
191 static void handleDestroyGL(DrawEnv
*pEnv
,
193 Window::GLObjectStatusE mode
);
196 /*---------------------------------------------------------------------*/
197 /*! \name Constructors */
201 GeoProperty(const GeoProperty
&source
);
204 /*---------------------------------------------------------------------*/
205 /*! \name Destructors */
208 virtual ~GeoProperty(void);
212 virtual GLenum
getBufferType(void) = 0; // buffer type for VBOs
214 static StateChunkClass _class
;
216 /*---------------------------------------------------------------------*/
217 /*! \name OpenGL Extensions Used */
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
;
243 /*---------------------------------------------------------------------*/
247 static void initMethod(InitPhase ePhase
);
250 /*========================== 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
;
266 #include "OSGGeoPropertyBase.inl"
267 #include "OSGGeoProperty.inl"
269 #endif /* _OSGGEOPROPERTY_H_ */