00001 00013 #pragma once 00014 #ifndef SAMPLER_H 00015 #define SAMPLER_H 00016 00017 #include "Types.h" 00018 #include "Image.h" 00019 #include "BindingInterface.h" 00020 00021 namespace RenderTools { 00022 00023 class Sampler : public BindingInterface, public Image { 00024 public: 00025 00026 Sampler( GLuint width, GLuint height, GLubyte * data = 0 ); 00027 Sampler( void ); 00028 virtual ~Sampler( void ); 00029 00030 static PropertyPtr create( const XMLNodePtr & xml = XMLNodePtr() ); 00031 virtual void createProperties( void ); 00032 virtual const string getTypeName( bool ofComponent = false ) const; 00033 00034 virtual void onInitialize( void ); 00035 virtual void onBind( int unit ); 00036 virtual void onUnbind( int unit ); 00037 00038 void setTexEnv( void ); 00039 void setData( const void * data ); 00040 void clear( void ); 00041 void download( string filename = "" ); 00042 void setDefaultColor( const Vec4 & color ); 00043 const Vec4 & getDefaultColor( void ) const; 00044 GLuint getWidth( void ) const; 00045 GLuint getHeight( void ) const; 00046 GLuint getWidth2( void ) const; 00047 GLuint getHeight2( void ) const; 00048 Vec2 getSize( void ) const; 00049 Vec2 getSize2( void ) const; 00050 GLuint getID( void ) const; 00051 GLenum getInternalFormat( void ) const; 00052 GLenum getTarget( void ) const; 00053 GLenum getMode( void ) const; 00054 GLenum getWrap( void ) const; 00055 GLenum getFilter( void ) const; 00056 GLboolean isResident( void ) const; 00057 00058 protected: 00059 GLuint m_w2; 00060 GLuint m_h2; 00061 GLuint m_id; 00062 GLenum m_internal; 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 GLenum m_target; 00088 00089 GLenum m_mode; 00090 00091 GLenum m_wrap; 00092 00093 GLenum m_filter; 00094 00095 00096 00097 GLuint m_formatGL; 00098 00099 00100 GLuint m_typeGL; 00101 00102 00103 00104 00105 GLboolean m_makePOT; 00106 GLboolean m_doMipMap; 00107 GLboolean m_doCleanup; 00108 Vec4 m_defaultColor; 00109 bool m_overrideDefaultColor; 00110 00111 00112 private: 00113 #ifdef RT_DEVIL 00114 static ILenum getILFormat( GLenum formatGL ); 00115 static ILenum getILType( GLenum typeGL ); 00116 static GLenum getGLFormat( ILenum formatIL ); 00117 static GLenum getGLType( ILenum typeIL ); 00118 #endif 00119 }; 00120 00121 00122 }; // namespace 00123 00124 #endif
1.5.8