00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef _OSGTEXTURECHUNK_H_
00041 #define _OSGTEXTURECHUNK_H_
00042 #ifdef __sgi
00043 #pragma once
00044 #endif
00045
00046 #include <OSGConfig.h>
00047 #include <OSGGLEXT.h>
00048 #include <OSGWindow.h>
00049 #include <OSGTextureChunkBase.h>
00050
00051 OSG_BEGIN_NAMESPACE
00052
00053 #define osgMaxTexImages 16
00054 #define osgMaxTexCoords 8
00055
00060 class OSG_SYSTEMLIB_DLLMAPPING TextureChunk : public TextureChunkBase
00061 {
00062
00063 public:
00064
00066 enum NPOTMatrixScaleE
00067 {
00068 None_TT = 0,
00069 NPotTexScale_TT = 1,
00070 XFlip_TT = 2,
00071 YFlip_TT = 4,
00072 ZFlip_TT = 8
00073 };
00074
00075
00079 virtual const StateChunkClass * getClass (void) const;
00080
00082
00086 inline static UInt32 getStaticClassId (void);
00087 inline static const StateChunkClass * getStaticClass (void);
00088
00090
00094 virtual void changed(BitVector whichField,
00095 UInt32 origin );
00096
00098
00102 virtual void dump( UInt32 uiIndent = 0,
00103 const BitVector bvFlags = 0) const;
00104
00106
00110 virtual void activate (DrawActionBase * action, UInt32 index = 0);
00111
00112 virtual void changeFrom (DrawActionBase * action, StateChunk * old,
00113 UInt32 index = 0);
00114
00115 virtual void deactivate (DrawActionBase * action, UInt32 index = 0);
00116
00117 virtual bool isTransparent (void) const;
00118
00120
00124 virtual Real32 switchCost (StateChunk * chunk);
00125
00126 virtual bool operator < (const StateChunk &other) const;
00127
00128 virtual bool operator == (const StateChunk &other) const;
00129 virtual bool operator != (const StateChunk &other) const;
00130
00132
00136 void imageContentChanged(Int32 minx = -1, Int32 maxx = -1,
00137 Int32 miny = -1, Int32 maxy = -1,
00138 Int32 minz = -1, Int32 maxz = -1 );
00139
00140 void setImage (ImagePtr &pImage);
00141
00142 inline void setShaderOffsetMatrix(Real32 m11, Real32 m12,
00143 Real32 m21, Real32 m22);
00144
00146
00150 static bool hasMultiTexture(Window *win);
00151 static void activeTexture (Window *win, UInt16 texture);
00152 static bool activateTexture(Window *win, UInt16 texture);
00153
00156
00157 protected:
00158
00159
00163 void onCreate(const TextureChunk *source = NULL);
00164 void onDestroy(void);
00165
00167
00171 TextureChunk(void);
00172 TextureChunk(const TextureChunk &source);
00173
00175
00179 virtual ~TextureChunk(void);
00180
00182
00186 void handleTexture(Window *win, UInt32 id, GLenum bindtarget,
00187 GLenum paramtarget,
00188 GLenum imgtarget,
00189 Window::GLObjectStatusE mode,
00190 ImagePtr img, int side = 0);
00191
00192 void handleTextureShader(Window *win, GLenum bindtarget);
00193
00196
00197 static UInt32 _extTex3D;
00198 static UInt32 _arbMultiTex;
00199 static UInt32 _nvPointSprite;
00200 static UInt32 _nvTextureShader;
00201 static UInt32 _nvTextureShader2;
00202 static UInt32 _nvTextureShader3;
00203 static UInt32 _sgisGenerateMipmap;
00204 static UInt32 _extTextureLodBias;
00205 static UInt32 _arbTextureCompression;
00206 static UInt32 _arbTextureRectangle;
00207 static UInt32 _arbTextureNonPowerOfTwo;
00208 static UInt32 _extTextureFilterAnisotropic;
00209
00210
00211 static UInt32 _funcTexImage3D;
00212 static UInt32 _funcTexSubImage3D;
00213 static UInt32 _funcActiveTexture;
00214 static UInt32 _arbCubeTex;
00215 static UInt32 _funcCompressedTexImage1D;
00216 static UInt32 _funcCompressedTexSubImage1D;
00217 static UInt32 _funcCompressedTexImage2D;
00218 static UInt32 _funcCompressedTexSubImage2D;
00219 static UInt32 _funcCompressedTexImage3D;
00220 static UInt32 _funcCompressedTexSubImage3D;
00221
00222
00223
00224 static StateChunkClass _class;
00225
00226
00227 static void initMethod(void);
00228
00229
00230 private:
00231
00232 typedef TextureChunkBase Inherited;
00233
00234 friend class FieldContainer;
00235 friend class TextureChunkBase;
00236
00237 static char cvsid[];
00238
00239
00243 void handleGL(Window *win, UInt32 id);
00244
00247
00248
00249 void operator =(const TextureChunk &source);
00250 };
00251
00252 typedef TextureChunk *TextureChunkP;
00253
00254 OSG_END_NAMESPACE
00255
00256 #include <OSGTextureChunkBase.inl>
00257 #include <OSGTextureChunk.inl>
00258
00259 #define OSGTEXTURECHUNK_HEADER_CVSID "@(#)$Id: FCTemplate_h.h,v 1.15 2002/06/01 10:37:25 vossg Exp $"
00260
00261 #endif