Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

ITexture.h

Go to the documentation of this file.
00001 // Copyright (C) 2002-2009 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __I_TEXTURE_H_INCLUDED__
00006 #define __I_TEXTURE_H_INCLUDED__
00007 
00008 #include "IReferenceCounted.h"
00009 #include "IImage.h"
00010 #include "dimension2d.h"
00011 #include "EDriverTypes.h"
00012 #include "path.h"
00013 #include "matrix4.h"
00014 
00015 namespace irr
00016 {
00017 namespace video
00018 {
00019 
00020 
00022 enum E_TEXTURE_CREATION_FLAG
00023 {
00032         ETCF_ALWAYS_16_BIT = 0x00000001,
00033 
00041         ETCF_ALWAYS_32_BIT = 0x00000002,
00042 
00049         ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004,
00050 
00056         ETCF_OPTIMIZED_FOR_SPEED = 0x00000008,
00057 
00059         ETCF_CREATE_MIP_MAPS = 0x00000010,
00060 
00062         ETCF_NO_ALPHA_CHANNEL = 0x00000020,
00063 
00065 
00066         ETCF_ALLOW_NON_POWER_2 = 0x00000040,
00067 
00070         ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff
00071 };
00072 
00073 
00075 
00077 inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
00078 {
00079         if (flags & ETCF_OPTIMIZED_FOR_SPEED)
00080                 return ETCF_OPTIMIZED_FOR_SPEED;
00081         if (flags & ETCF_ALWAYS_16_BIT)
00082                 return ETCF_ALWAYS_16_BIT;
00083         if (flags & ETCF_ALWAYS_32_BIT)
00084                 return ETCF_ALWAYS_32_BIT;
00085         if (flags & ETCF_OPTIMIZED_FOR_QUALITY)
00086                 return ETCF_OPTIMIZED_FOR_QUALITY;
00087         return ETCF_OPTIMIZED_FOR_SPEED;
00088 }
00089 
00090 
00092 
00100 class ITexture : public virtual IReferenceCounted
00101 {
00102 public:
00103 
00105         ITexture(const io::path& name) : Name(name)
00106         {
00107                 Name.make_lower();
00108         }
00109 
00111 
00121         virtual void* lock(bool readOnly = false) = 0;
00122 
00124 
00125         virtual void unlock() = 0;
00126 
00128 
00136         virtual const core::dimension2d<u32>& getOriginalSize() const = 0;
00137 
00139 
00140         virtual const core::dimension2d<u32>& getSize() const = 0;
00141 
00143 
00147         virtual E_DRIVER_TYPE getDriverType() const = 0;
00148 
00150 
00151         virtual ECOLOR_FORMAT getColorFormat() const = 0;
00152 
00154 
00157         virtual u32 getPitch() const = 0;
00158 
00160 
00161         virtual bool hasMipMaps() const { return false; }
00162 
00164         virtual bool hasAlpha() const {
00165                 return getColorFormat () == video::ECF_A8R8G8B8 || getColorFormat () == video::ECF_A1R5G5B5;
00166         }
00167 
00169 
00170         virtual void regenerateMipMapLevels() = 0;
00171 
00173 
00174         virtual bool isRenderTarget() const { return false; }
00175 
00177         const io::path& getName() const { return Name; }
00178 
00179 protected:
00180 
00181         io::path Name;
00182 };
00183 
00184 
00185 } // end namespace video
00186 } // end namespace irr
00187 
00188 #endif
00189 

The Irrlicht Engine
The Irrlicht Engine Documentation © 2003-2009 by Nikolaus Gebhardt. Generated on Sun Jan 10 09:24:04 2010 by Doxygen (1.5.6)