- Improved ITexture::hasAlpha method.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5167 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
6911048335
commit
d565cd6a39
|
@ -114,7 +114,7 @@ public:
|
|||
|
||||
//! constructor
|
||||
ITexture(const io::path& name) : NamedPath(name), DriverType(EDT_NULL), ColorFormat(ECF_UNKNOWN),
|
||||
Pitch(0), HasMipMaps(false), HasAlpha(false), IsRenderTarget(false), Source(ETS_UNKNOWN)
|
||||
Pitch(0), HasMipMaps(false), IsRenderTarget(false), Source(ETS_UNKNOWN)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -189,9 +189,6 @@ public:
|
|||
/** \return True if texture has MipMaps, else false. */
|
||||
bool hasMipMaps() const { return HasMipMaps; }
|
||||
|
||||
//! Returns if the texture has an alpha channel
|
||||
bool hasAlpha() const { return HasAlpha; }
|
||||
|
||||
//! Check whether the texture is a render target
|
||||
/** Render targets can be set as such in the video driver, in order to
|
||||
render a scene into the texture. Once unbound as render target, they can
|
||||
|
@ -208,6 +205,31 @@ public:
|
|||
//! Used internally by the engine to update Source status on IVideoDriver::getTexture calls.
|
||||
void updateSource(E_TEXTURE_SOURCE source) { Source = source; }
|
||||
|
||||
//! Returns if the texture has an alpha channel
|
||||
bool hasAlpha() const
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
switch (ColorFormat)
|
||||
{
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_DXT1:
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
case ECF_A16B16G16R16F:
|
||||
case ECF_A32B32G32R32F:
|
||||
status = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Helper function, helps to get the desired texture creation format from the flags.
|
||||
|
@ -233,7 +255,6 @@ protected:
|
|||
ECOLOR_FORMAT ColorFormat;
|
||||
u32 Pitch;
|
||||
bool HasMipMaps;
|
||||
bool HasAlpha;
|
||||
bool IsRenderTarget;
|
||||
E_TEXTURE_SOURCE Source;
|
||||
};
|
||||
|
|
|
@ -139,18 +139,6 @@ void CD3D9Texture::createRenderTarget(const ECOLOR_FORMAT format)
|
|||
d3dformat = Driver->getD3DFormatFromColorFormat(ColorFormat);
|
||||
}
|
||||
|
||||
switch (ColorFormat)
|
||||
{
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_A16B16G16R16F:
|
||||
case ECF_A32B32G32R32F:
|
||||
HasAlpha = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// create texture
|
||||
DWORD usage = (IImage::isDepthFormat(ColorFormat)) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET;
|
||||
|
||||
|
@ -386,23 +374,6 @@ bool CD3D9Texture::createTexture(u32 flags, IImage * image)
|
|||
if (!IsCompressed)
|
||||
ColorFormat = Driver->getColorFormatFromD3DFormat(format);
|
||||
|
||||
switch (ColorFormat)
|
||||
{
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_DXT1:
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
case ECF_A16B16G16R16F:
|
||||
case ECF_A32B32G32R32F:
|
||||
HasAlpha = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
setPitch(format);
|
||||
|
||||
return (SUCCEEDED(hr));
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef __C_OGLCORE_COMMON_H_INCLUDED__
|
||||
#define __C_OGLCORE_COMMON_H_INCLUDED__
|
||||
#ifndef __C_OGLCORE_FEATURE_H_INCLUDED__
|
||||
#define __C_OGLCORE_FEATURE_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
|
|
|
@ -37,23 +37,6 @@ COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mi
|
|||
|
||||
getImageValues(origImage);
|
||||
|
||||
switch (ColorFormat)
|
||||
{
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_DXT1:
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
case ECF_A16B16G16R16F:
|
||||
case ECF_A32B32G32R32F:
|
||||
HasAlpha = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (IImage::isCompressedFormat(ColorFormat))
|
||||
{
|
||||
if (!Driver->queryFeature(EVDF_TEXTURE_COMPRESSED_DXT))
|
||||
|
@ -121,18 +104,6 @@ COpenGLTexture::COpenGLTexture(const io::path& name, const core::dimension2d<u32
|
|||
Size = size;
|
||||
ColorFormat = format;
|
||||
|
||||
switch (ColorFormat)
|
||||
{
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_A16B16G16R16F:
|
||||
case ECF_A32B32G32R32F:
|
||||
HasAlpha = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GLint FilteringType = 0;
|
||||
InternalFormat = getOpenGLFormatAndParametersFromColorFormat(format, FilteringType, PixelFormat, PixelType);
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ CSoftwareTexture::CSoftwareTexture(IImage* image, const io::path& name,
|
|||
DriverType = EDT_SOFTWARE;
|
||||
ColorFormat = ECF_A1R5G5B5;
|
||||
HasMipMaps = false;
|
||||
HasAlpha = true;
|
||||
IsRenderTarget = renderTarget;
|
||||
|
||||
if (image)
|
||||
|
|
|
@ -48,11 +48,6 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const io::path& name,
|
|||
OriginalSize = image->getDimension();
|
||||
OriginalFormat = image->getColorFormat();
|
||||
|
||||
core::setbit_cond(Flags,
|
||||
image->getColorFormat () == video::ECF_A8R8G8B8 ||
|
||||
image->getColorFormat () == video::ECF_A1R5G5B5,
|
||||
HAS_ALPHA);
|
||||
|
||||
core::dimension2d<u32> optSize(
|
||||
OriginalSize.getOptimalSize(0 != (Flags & NP2_SIZE),
|
||||
false, true,
|
||||
|
@ -90,7 +85,6 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const io::path& name,
|
|||
}
|
||||
|
||||
HasMipMaps = (Flags & GEN_MIPMAP) != 0;
|
||||
HasAlpha = (Flags & HAS_ALPHA) != 0;
|
||||
|
||||
regenerateMipMapLevels(mipmapData);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ public:
|
|||
GEN_MIPMAP = 1,
|
||||
IS_RENDERTARGET = 2,
|
||||
NP2_SIZE = 4,
|
||||
HAS_ALPHA = 8
|
||||
};
|
||||
CSoftwareTexture2(IImage* surface, const io::path& name, u32 flags, void* mipmapData=0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue