OSGTextureEnvChunk.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 #ifndef _OSGTEXTUREENVCHUNK_H_
00040 #define _OSGTEXTUREENVCHUNK_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include "OSGConfig.h"
00046 #include "OSGGLEXT.h"
00047 #include "OSGWindow.h"
00048 #include "OSGImage.h"
00049 #include "OSGTextureEnvChunkBase.h"
00050 
00051 OSG_BEGIN_NAMESPACE
00052 
00057 class OSG_SYSTEM_DLLMAPPING TextureEnvChunk : public TextureEnvChunkBase
00058 {
00059     /*==========================  PUBLIC  =================================*/
00060 
00061   public:
00062 
00063     /*---------------------------------------------------------------------*/
00067     virtual const StateChunkClass *getClass(void) const;
00068 
00070     /*---------------------------------------------------------------------*/
00074     static       UInt32           getStaticClassId(void);
00075     static const StateChunkClass *getStaticClass  (void);
00076 
00078     /*---------------------------------------------------------------------*/
00083     /*---------------------------------------------------------------------*/
00087     virtual void changed(ConstFieldMaskArg whichField,
00088                          UInt32            origin,
00089                          BitVector         details);
00090 
00092     /*---------------------------------------------------------------------*/
00096     virtual void dump(      UInt32    uiIndent = 0,
00097                       const BitVector bvFlags  = 0) const;
00098 
00100     /*---------------------------------------------------------------------*/
00104     virtual void activate   (DrawEnv    *pEnv, 
00105                              UInt32      index = 0);
00106 
00107     virtual void changeFrom (DrawEnv    *pEnv, 
00108                              StateChunk *pOld,
00109                              UInt32      index = 0);
00110 
00111     virtual void deactivate (DrawEnv    *pEnv, 
00112                              UInt32      index = 0);
00113 
00114     virtual bool isTransparent (void) const;
00115 
00117     /*---------------------------------------------------------------------*/
00121     //GLenum determineTextureTarget(Window *pWindow) const;
00122 
00124     /*---------------------------------------------------------------------*/
00128     virtual Real32 switchCost(StateChunk * chunk);
00129 
00130     virtual bool   operator <  (const StateChunk &other) const;
00131 
00132     virtual bool   operator == (const StateChunk &other) const;
00133     virtual bool   operator != (const StateChunk &other) const;
00134 
00136     /*---------------------------------------------------------------------*/
00140     void setShaderOffsetMatrix(Real32 m11, 
00141                                Real32 m12, 
00142                                Real32 m21, 
00143                                Real32 m22);
00144 
00146     /*---------------------------------------------------------------------*/
00151     /*=========================  PROTECTED  ===============================*/
00152 
00153   protected:
00154 
00155     /*---------------------------------------------------------------------*/
00159     void onCreate      (const TextureEnvChunk *source      = NULL);
00160     void onCreateAspect(const TextureEnvChunk *createAspect,
00161                         const TextureEnvChunk *source      = NULL);
00162 
00164     /*---------------------------------------------------------------------*/
00168     TextureEnvChunk(void);
00169     TextureEnvChunk(const TextureEnvChunk &source);
00170 
00172     /*---------------------------------------------------------------------*/
00176     virtual ~TextureEnvChunk(void);
00177 
00179     /*---------------------------------------------------------------------*/
00183     static void initMethod(InitPhase ePhase);
00184 
00186     /*---------------------------------------------------------------------*/
00190     static UInt32 _nvPointSprite;
00191     static UInt32 _nvTextureShader;
00192     static UInt32 _nvTextureShader2;
00193     static UInt32 _nvTextureShader3;
00194     static UInt32 _extTextureLodBias;
00195 
00196     void handleTextureShader(Window *win, GLenum bindtarget);
00197 
00200     // class. Used for indexing in State
00201     // protected to give CubeTextureChunk access
00202     static StateChunkClass _class;
00203 
00204     /*==========================  PRIVATE  ================================*/
00205 
00206   private:
00207 
00208     typedef TextureEnvChunkBase Inherited;
00209 
00210     friend class FieldContainer;
00211     friend class TextureEnvChunkBase;
00212 
00213     // prohibit default functions (move to 'public' if you need one)
00214     void operator =(const TextureEnvChunk &source);
00215 };
00216 
00217 typedef TextureEnvChunk *TextureEnvChunkP;
00218 
00219 OSG_END_NAMESPACE
00220 
00221 #include "OSGTextureEnvChunkBase.inl"
00222 #include "OSGTextureEnvChunk.inl"
00223 
00224 #endif /* _OSGTEXTUREENVCHUNK_H_ */