1
// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
5
#ifndef __C_SOFTWARE_2_TEXTURE_H_INCLUDED__
6
#define __C_SOFTWARE_2_TEXTURE_H_INCLUDED__
8
#include "SoftwareDriver2_compile_config.h"
19
interface for a Video Driver dependent Texture.
21
class CSoftwareTexture2 : public ITexture
33
CSoftwareTexture2(IImage* surface, const io::path& name, u32 flags, void* mipmapData=0);
36
virtual ~CSoftwareTexture2();
39
virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0)
41
if (Flags & GEN_MIPMAP)
42
MipMapLOD=mipmapLevel;
43
return MipMap[MipMapLOD]->lock();
49
MipMap[MipMapLOD]->unlock();
52
//! Returns original size of the texture.
53
virtual const core::dimension2d<u32>& getOriginalSize() const
55
//return MipMap[0]->getDimension();
59
//! Returns the size of the largest mipmap.
60
f32 getLODFactor( const f32 texArea ) const
62
return OrigImageDataSizeInPixels * texArea;
63
//return MipMap[0]->getImageDataSizeInPixels () * texArea;
66
//! Returns (=size) of the texture.
67
virtual const core::dimension2d<u32>& getSize() const
69
return MipMap[MipMapLOD]->getDimension();
72
//! returns unoptimized surface
73
virtual CImage* getImage() const
78
//! returns texture surface
79
virtual CImage* getTexture() const
81
return MipMap[MipMapLOD];
85
//! returns driver type of texture (=the driver, who created the texture)
86
virtual E_DRIVER_TYPE getDriverType() const
88
return EDT_BURNINGSVIDEO;
91
//! returns color format of texture
92
virtual ECOLOR_FORMAT getColorFormat() const
94
return BURNINGSHADER_COLOR_FORMAT;
97
//! returns pitch of texture (in bytes)
98
virtual u32 getPitch() const
100
return MipMap[MipMapLOD]->getPitch();
103
//! Regenerates the mip map levels of the texture. Useful after locking and
104
//! modifying the texture
105
virtual void regenerateMipMapLevels(void* mipmapData=0);
108
virtual bool hasMipMaps() const
110
return (Flags & GEN_MIPMAP ) != 0;
113
//! Returns if the texture has an alpha channel
114
virtual bool hasAlpha() const
116
return (Flags & HAS_ALPHA ) != 0;
119
//! is a render target
120
virtual bool isRenderTarget() const
122
return (Flags & IS_RENDERTARGET) != 0;
126
f32 OrigImageDataSizeInPixels;
127
core::dimension2d<u32> OrigSize;
129
CImage * MipMap[SOFTWARE_DRIVER_2_MIPMAPPING_MAX];
133
ECOLOR_FORMAT OriginalFormat;
137
} // end namespace video
138
} // end namespace irr