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-2010 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
    00083 class ITexture : public virtual IReferenceCounted
    00084 {
    00085 public:
    00086
    00088         ITexture(const io::path& name) : NamedPath(name)
    00089         {
    00090         }
    00091
    00093
    00105         virtual void* lock(bool readOnly = false, u32 mipmapLevel=0) = 0;
    00106
    00108
    00109         virtual void unlock() = 0;
    00110
    00112
    00119         virtual const core::dimension2d<u32>& getOriginalSize() const = 0;
    00120
    00122
    00123         virtual const core::dimension2d<u32>& getSize() const = 0;
    00124
    00126
    00130         virtual E_DRIVER_TYPE getDriverType() const = 0;
    00131
    00133
    00134         virtual ECOLOR_FORMAT getColorFormat() const = 0;
    00135
    00137
    00140         virtual u32 getPitch() const = 0;
    00141
    00143
    00144         virtual bool hasMipMaps() const { return false; }
    00145
    00147         virtual bool hasAlpha() const {
    00148                 return getColorFormat () == video::ECF_A8R8G8B8 || getColorFormat () == video::ECF_A1R5G5B5;
    00149         }
    00150
    00152
    00153         virtual void regenerateMipMapLevels(void* mipmapData=0) = 0;
    00154
    00156
    00157         virtual bool isRenderTarget() const { return false; }
    00158
    00160         const io::SNamedPath& getName() const { return NamedPath; }
    00161
    00162 protected:
    00163
    00165
    00167         inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
    00168         {
    00169                 if (flags & ETCF_OPTIMIZED_FOR_SPEED)
    00170                         return ETCF_OPTIMIZED_FOR_SPEED;
    00171                 if (flags & ETCF_ALWAYS_16_BIT)
    00172                         return ETCF_ALWAYS_16_BIT;
    00173                 if (flags & ETCF_ALWAYS_32_BIT)
    00174                         return ETCF_ALWAYS_32_BIT;
    00175                 if (flags & ETCF_OPTIMIZED_FOR_QUALITY)
    00176                         return ETCF_OPTIMIZED_FOR_QUALITY;
    00177                 return ETCF_OPTIMIZED_FOR_SPEED;
    00178         }
    00179
    00180         io::SNamedPath NamedPath;
    00181 };
    00182
    00183
    00184 } // end namespace video
    00185 } // end namespace irr
    00186
    00187 #endif
    00188

| The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Sun Oct 24 12:41:57 2010 by Doxygen (1.6.2)