Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreTexture.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://ogre.sourceforge.net/
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 
00035     enum TextureUsage
00036     {
00037         TU_DEFAULT = 0x0,
00038         TU_RENDERTARGET = 0x1
00039     };
00040 
00050     class _OgreExport Texture : public Resource
00051     {
00052     public:
00053 
00056         unsigned short getNumMipMaps(void) {return mNumMipMaps;}
00057 
00062         void setNumMipMaps(unsigned short num) {mNumMipMaps = num;}
00063 
00066         float getGamma(void) { return mGamma; }
00067 
00072         void setGamma(float g) { mGamma = g; }
00073 
00076         unsigned int getHeight(void) { return mHeight; }
00077 
00080         unsigned int getWidth(void) { return mWidth; }
00081 
00084         std::pair< uint, uint > getDimensions() { return std::pair< uint, uint >( mWidth, mHeight ); }
00085 
00086         TextureUsage getUsage() const
00087         {
00088             return mUsage;
00089         }
00090 
00097         virtual void blitToTexture( 
00098             const Image &src, unsigned uStartX, unsigned uStartY ) = 0;
00099 
00108         virtual void blitImage(
00109             const Image& src, const Image::Rect imgRect, const Image::Rect texRect )
00110         {
00111         }
00112 
00115         virtual void copyToTexture( Texture * target ) {};
00116 
00119         virtual void loadImage( const Image &img ) = 0;
00120 
00121         void enable32Bit( bool setting = true ) 
00122         {
00123             setting ? mFinalBpp = 32 : mFinalBpp = 16;
00124         }
00125 
00127         virtual PixelFormat getFormat() const
00128         {
00129             return mFormat;
00130         }
00131 
00133         virtual bool hasAlpha(void)
00134         {
00135             return mHasAlpha;
00136         }
00137 
00138     protected:
00139         unsigned long mHeight;
00140         unsigned long mWidth;
00141 
00142         unsigned short mNumMipMaps;
00143         float mGamma;
00144 
00145         PixelFormat mFormat;
00146         TextureUsage mUsage;
00147 
00148         unsigned short mSrcBpp;
00149         unsigned long mSrcWidth, mSrcHeight;
00150         unsigned short mFinalBpp;
00151         bool mHasAlpha;
00152     };
00153 }
00154 
00155 #endif

Copyright © 2002 by The OGRE Team