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 00072 TextureType getTextureType(void) const { return mTextureType; } 00073 00076 unsigned short getNumMipMaps(void) const {return mNumMipMaps;} 00077 00082 void setNumMipMaps(unsigned short num) {mNumMipMaps = num;} 00083 00086 float getGamma(void) const { return mGamma; } 00087 00092 void setGamma(float g) { mGamma = g; } 00093 00096 unsigned int getHeight(void) const { return mHeight; } 00097 00100 unsigned int getWidth(void) const { return mWidth; } 00101 00104 unsigned int getDepth(void) const { return mDepth; } 00105 00108 std::pair< uint, uint > getDimensions() const { return std::pair< uint, uint >( mWidth, mHeight ); } 00109 00112 TextureUsage getUsage() const 00113 { 00114 return mUsage; 00115 } 00116 00123 virtual void blitToTexture( 00124 const Image &src, unsigned uStartX, unsigned uStartY ) = 0; 00125 00134 virtual void blitImage( 00135 const Image& src, const Image::Rect imgRect, const Image::Rect texRect ) 00136 { 00137 } 00138 00141 virtual void copyToTexture( Texture * target ) {} 00142 00145 virtual void loadImage( const Image &img ) = 0; 00146 00149 virtual void loadRawData( const DataChunk &pData, 00150 ushort uWidth, ushort uHeight, PixelFormat eFormat) ; 00151 00152 void enable32Bit( bool setting = true ) 00153 { 00154 setting ? mFinalBpp = 32 : mFinalBpp = 16; 00155 } 00156 00158 virtual PixelFormat getFormat() const 00159 { 00160 return mFormat; 00161 } 00162 00164 virtual bool hasAlpha(void) const 00165 { 00166 return mHasAlpha; 00167 } 00168 00169 protected: 00170 unsigned long mHeight; 00171 unsigned long mWidth; 00172 unsigned long mDepth; 00173 00174 unsigned short mNumMipMaps; 00175 float mGamma; 00176 00177 TextureType mTextureType; 00178 PixelFormat mFormat; 00179 TextureUsage mUsage; 00180 00181 unsigned short mSrcBpp; 00182 unsigned long mSrcWidth, mSrcHeight; 00183 unsigned short mFinalBpp; 00184 bool mHasAlpha; 00185 }; 00186 } 00187 00188 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:30 2004