Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGTextureChunk.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zghdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
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     /*==========================  PUBLIC  =================================*/
00063   public:
00064 
00065     /*---------------------------------------------------------------------*/
00069            virtual const StateChunkClass * getClass         (void) const;
00070 
00072     /*---------------------------------------------------------------------*/
00076     inline static        UInt32            getStaticClassId (void);
00077     inline static  const StateChunkClass * getStaticClass   (void);
00078 
00080     /*---------------------------------------------------------------------*/
00084     virtual void changed(BitVector whichField,
00085                          UInt32    origin    );
00086 
00088     /*---------------------------------------------------------------------*/
00092     virtual void dump(      UInt32    uiIndent = 0,
00093                       const BitVector bvFlags  = 0) const;
00094 
00096     /*---------------------------------------------------------------------*/
00100     virtual void activate   (DrawActionBase * action, UInt32 index = 0);
00101 
00102     virtual void changeFrom (DrawActionBase * action, StateChunk * old,
00103                              UInt32 index = 0);
00104 
00105     virtual void deactivate (DrawActionBase * action, UInt32 index = 0);
00106 
00107     virtual bool isTransparent (void) const;
00108 
00110     /*---------------------------------------------------------------------*/
00114     virtual Real32 switchCost  (StateChunk * chunk);
00115 
00116     virtual bool   operator <  (const StateChunk &other) const;
00117 
00118     virtual bool   operator == (const StateChunk &other) const;
00119     virtual bool   operator != (const StateChunk &other) const;
00120 
00122     /*---------------------------------------------------------------------*/
00126     void imageContentChanged(Int32 minx = -1, Int32 maxx = -1, 
00127                              Int32 miny = -1, Int32 maxy = -1,
00128                              Int32 minz = -1, Int32 maxz = -1 );
00129 
00130     void setImage           (ImagePtr &pImage);
00131 
00132     inline void setShaderOffsetMatrix(Real32 m11, Real32 m12, 
00133                                       Real32 m21, Real32 m22);
00134 
00136     /*---------------------------------------------------------------------*/
00140     static bool hasMultiTexture(Window *win);
00141     static void activeTexture  (Window *win, UInt16 texture);
00142     static bool activateTexture(Window *win, UInt16 texture);
00143 
00146     /*=========================  PROTECTED  ===============================*/
00147   protected:
00148 
00149     /*---------------------------------------------------------------------*/
00153     void onCreate(const TextureChunk *source = NULL);
00154 
00156     /*---------------------------------------------------------------------*/
00160     TextureChunk(void);
00161     TextureChunk(const TextureChunk &source);
00162 
00164     /*---------------------------------------------------------------------*/
00168     virtual ~TextureChunk(void);
00169 
00171     /*---------------------------------------------------------------------*/
00175     void handleTexture(Window *win, UInt32 id, GLenum bindtarget,
00176                        GLenum paramtarget,
00177                        GLenum imgtarget, 
00178                        Window::GLObjectStatusE mode, 
00179                        ImagePtr img, int side = 0);
00180 
00181     void handleTextureShader(Window *win, GLenum bindtarget);
00182 
00185     // extension indices for used extensions;
00186     static UInt32 _extTex3D;
00187     static UInt32 _arbMultiTex;
00188     static UInt32 _nvPointSprite;
00189     static UInt32 _nvTextureShader;
00190     static UInt32 _nvTextureShader2;
00191     static UInt32 _nvTextureShader3;
00192     static UInt32 _sgisGenerateMipmap;
00193     static UInt32 _extTextureLodBias;
00194     static UInt32 _arbTextureCompression;
00195     static UInt32 _arbTextureRectangle;
00196     
00197     // extension indices for used fucntions;
00198     static UInt32 _funcTexImage3D;
00199     static UInt32 _funcTexSubImage3D;
00200     static UInt32 _funcActiveTexture;
00201     static UInt32 _arbCubeTex;
00202     static UInt32 _funcCompressedTexImage1D;
00203     static UInt32 _funcCompressedTexSubImage1D;
00204     static UInt32 _funcCompressedTexImage2D;
00205     static UInt32 _funcCompressedTexSubImage2D;
00206     static UInt32 _funcCompressedTexImage3D;
00207     static UInt32 _funcCompressedTexSubImage3D;
00208 
00209     // class. Used for indexing in State
00210     // protected to give CubeTextureChunk access
00211     static StateChunkClass _class;
00212 
00213     // protected to give CubeTextureChunk access
00214     static void initMethod(void);
00215 
00216     /*==========================  PRIVATE  ================================*/
00217   private:
00218 
00219     typedef TextureChunkBase Inherited;
00220 
00221     friend class FieldContainer;
00222     friend class TextureChunkBase;
00223 
00224     static char cvsid[];
00225 
00226     /*---------------------------------------------------------------------*/
00230     void handleGL(Window *win, UInt32 id);
00231     
00234     // prohibit default functions (move to 'public' if you need one)
00235 
00236     void operator =(const TextureChunk &source);
00237 };
00238 
00239 typedef TextureChunk *TextureChunkP;
00240 
00241 OSG_END_NAMESPACE
00242 
00243 #include <OSGTextureChunkBase.inl>
00244 #include <OSGTextureChunk.inl>
00245 
00246 #define OSGTEXTURECHUNK_HEADER_CVSID "@(#)$Id: FCTemplate_h.h,v 1.15 2002/06/01 10:37:25 vossg Exp $"
00247 
00248 #endif /* _OSGTEXTURECHUNK_H_ */

Generated on Thu Aug 25 04:11:22 2005 for OpenSG by  doxygen 1.4.3