00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef _Texture_H__ 00026 #define _Texture_H__ 00027 00028 #include "OgrePrerequisites.h" 00029 00030 #include "OgreResource.h" 00031 #include "OgreImage.h" 00032 00033 namespace Ogre { 00034 00037 enum TextureUsage 00038 { 00039 TU_DEFAULT = 0x0, 00040 TU_RENDERTARGET = 0x1 00041 }; 00042 00045 enum TextureType 00046 { 00048 TEX_TYPE_1D = 1, 00050 TEX_TYPE_2D = 2, 00052 TEX_TYPE_3D = 3, 00054 TEX_TYPE_CUBE_MAP = 4 00055 }; 00056 00066 class _OgreExport Texture : public Resource 00067 { 00068 public: 00069 Texture() {} 00070 Texture(const String& name, TextureType texType, uint width, uint height, uint depth, uint num_mips, PixelFormat format, TextureUsage usage); 00071 00074 TextureType getTextureType(void) const { return mTextureType; } 00075 00078 unsigned short getNumMipMaps(void) const {return mNumMipMaps;} 00079 00084 void setNumMipMaps(unsigned short num) {mNumMipMaps = num;} 00085 00088 float getGamma(void) const { return mGamma; } 00089 00094 void setGamma(float g) { mGamma = g; } 00095 00098 unsigned int getHeight(void) const { return mHeight; } 00099 00102 unsigned int getWidth(void) const { return mWidth; } 00103 00106 unsigned int getDepth(void) const { return mDepth; } 00107 00110 std::pair< uint, uint > getDimensions() const { return std::pair< uint, uint >( mWidth, mHeight ); } 00111 00114 TextureUsage getUsage() const 00115 { 00116 return mUsage; 00117 } 00118 00125 virtual void blitToTexture( 00126 const Image &src, unsigned uStartX, unsigned uStartY ) = 0; 00127 00136 virtual void blitImage( 00137 const Image& src, const Image::Rect imgRect, const Image::Rect texRect ) 00138 { 00139 } 00140 00143 virtual void copyToTexture( Texture * target ) {} 00144 00147 virtual void loadImage( const Image &img ) = 0; 00148 00151 virtual void loadRawData( const DataChunk &pData, 00152 ushort uWidth, ushort uHeight, PixelFormat eFormat) ; 00153 00154 void enable32Bit( bool setting = true ) 00155 { 00156 setting ? mFinalBpp = 32 : mFinalBpp = 16; 00157 } 00158 00160 virtual PixelFormat getFormat() const 00161 { 00162 return mFormat; 00163 } 00164 00166 virtual bool hasAlpha(void) const 00167 { 00168 return mHasAlpha; 00169 } 00170 00171 protected: 00172 unsigned long mHeight; 00173 unsigned long mWidth; 00174 unsigned long mDepth; 00175 00176 unsigned short mNumMipMaps; 00177 float mGamma; 00178 00179 TextureType mTextureType; 00180 PixelFormat mFormat; 00181 TextureUsage mUsage; 00182 00183 unsigned short mSrcBpp; 00184 unsigned long mSrcWidth, mSrcHeight; 00185 unsigned short mFinalBpp; 00186 bool mHasAlpha; 00187 }; 00188 } 00189 00190 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:49 2004