Made the Anisotropic Filter degree configurable via the SMaterialLayer member which had been a bool formerly. Using the setFlag in SMaterial should still give MaxAnisotropy level as before.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2034 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
a669b865f1
commit
e7ced16d04
|
@ -1,5 +1,11 @@
|
|||
Changes in version 1.6
|
||||
|
||||
- The Anisotropy filter can now be set to the AF value per texture layer. So no forced MAX_ANISOTROPY anymore. .irr files will probably fail, though.
|
||||
|
||||
- AntiAlias parameter in SIrrCreationParameters is now an u8 value specifying the multisampling level (0 for disabled, 4,6,8, and others for anti-aliasing)
|
||||
|
||||
- D3D devices use DISCARD for windowed renderbuffers now, can be faster.
|
||||
|
||||
- position2d is now a synonym for vector2d. position2d is therefore marked as deprecated, although it's unlikely to be removed.
|
||||
|
||||
- ISceneNodeAnimator now has a hasFinished() method.
|
||||
|
|
|
@ -313,8 +313,12 @@ namespace video
|
|||
break;
|
||||
case EMF_ANISOTROPIC_FILTER:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureLayer[i].AnisotropicFilter = value;
|
||||
if (value)
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureLayer[i].AnisotropicFilter = 0xFF;
|
||||
else
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureLayer[i].AnisotropicFilter = 0;
|
||||
}
|
||||
break;
|
||||
case EMF_FOG_ENABLE:
|
||||
|
@ -360,7 +364,7 @@ namespace video
|
|||
case EMF_TRILINEAR_FILTER:
|
||||
return TextureLayer[0].TrilinearFilter;
|
||||
case EMF_ANISOTROPIC_FILTER:
|
||||
return TextureLayer[0].AnisotropicFilter;
|
||||
return TextureLayer[0].AnisotropicFilter!=0;
|
||||
case EMF_FOG_ENABLE:
|
||||
return FogEnable;
|
||||
case EMF_NORMALIZE_NORMALS:
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace video
|
|||
TextureWrap(ETC_REPEAT),
|
||||
BilinearFilter(true),
|
||||
TrilinearFilter(false),
|
||||
AnisotropicFilter(false), TextureMatrix(0)
|
||||
AnisotropicFilter(0), TextureMatrix(0)
|
||||
{}
|
||||
|
||||
//! Copy constructor
|
||||
|
@ -117,12 +117,14 @@ namespace video
|
|||
the bilinear filtering flag is ignored. */
|
||||
bool TrilinearFilter;
|
||||
|
||||
//! Is anisotropic filtering enabled? Default: false
|
||||
//! Is anisotropic filtering enabled? Default: 0, disabled
|
||||
/** In Irrlicht you can use anisotropic texture filtering
|
||||
in conjunction with bilinear or trilinear texture
|
||||
filtering to improve rendering results. Primitives
|
||||
will look less blurry with this flag switched on. */
|
||||
bool AnisotropicFilter;
|
||||
will look less blurry with this flag switched on. The number gives
|
||||
the maximal anisotropy degree, and is often in the range 2-16.
|
||||
Value 1 is equivalent to 0, but should be avoided. */
|
||||
u8 AnisotropicFilter;
|
||||
|
||||
//! Gets the texture transformation matrix
|
||||
/** \return Texture matrix of this layer. */
|
||||
|
|
|
@ -373,12 +373,6 @@ bool CD3D8Driver::initDriver(const core::dimension2d<s32>& screenSize,
|
|||
// set the renderstates
|
||||
setRenderStates3DMode();
|
||||
|
||||
// set max anisotropy
|
||||
pID3DDevice->SetTextureStageState(0, D3DTSS_MAXANISOTROPY, core::min_( (DWORD) 16, Caps.MaxAnisotropy));
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_MAXANISOTROPY, core::min_( (DWORD) 16, Caps.MaxAnisotropy));
|
||||
pID3DDevice->SetTextureStageState(2, D3DTSS_MAXANISOTROPY, core::min_( (DWORD) 16, Caps.MaxAnisotropy));
|
||||
pID3DDevice->SetTextureStageState(3, D3DTSS_MAXANISOTROPY, core::min_( (DWORD) 16, Caps.MaxAnisotropy));
|
||||
|
||||
// so far so good.
|
||||
return true;
|
||||
}
|
||||
|
@ -1470,7 +1464,7 @@ void CD3D8Driver::setBasicRenderStates(const SMaterial& material, const SMateria
|
|||
lastmaterial.TextureLayer[st].TrilinearFilter != material.TextureLayer[st].TrilinearFilter ||
|
||||
lastmaterial.TextureLayer[st].AnisotropicFilter != material.TextureLayer[st].AnisotropicFilter )
|
||||
{
|
||||
if (material.TextureLayer[st].BilinearFilter || material.TextureLayer[st].TrilinearFilter || material.TextureLayer[st].AnisotropicFilter)
|
||||
if (material.TextureLayer[st].BilinearFilter || material.TextureLayer[st].TrilinearFilter || material.TextureLayer[st].AnisotropicFilter>1)
|
||||
{
|
||||
D3DTEXTUREFILTERTYPE tftMag = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) &&
|
||||
material.TextureLayer[st].AnisotropicFilter) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
|
@ -1478,6 +1472,8 @@ void CD3D8Driver::setBasicRenderStates(const SMaterial& material, const SMateria
|
|||
material.TextureLayer[st].AnisotropicFilter) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMip = material.TextureLayer[st].TrilinearFilter ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
||||
|
||||
if (tftMag==D3DTEXF_ANISOTROPIC || tftMin == D3DTEXF_ANISOTROPIC)
|
||||
pID3DDevice->SetTextureStageState(st, D3DTSS_MAXANISOTROPY, core::min_((DWORD)material.TextureLayer[st].AnisotropicFilter, Caps.MaxAnisotropy));
|
||||
pID3DDevice->SetTextureStageState(st, D3DTSS_MAGFILTER, tftMag);
|
||||
pID3DDevice->SetTextureStageState(st, D3DTSS_MINFILTER, tftMin);
|
||||
pID3DDevice->SetTextureStageState(st, D3DTSS_MIPFILTER, tftMip);
|
||||
|
|
|
@ -427,12 +427,6 @@ bool CD3D9Driver::initDriver(const core::dimension2d<s32>& screenSize,
|
|||
// set the renderstates
|
||||
setRenderStates3DMode();
|
||||
|
||||
// set maximal anisotropy
|
||||
pID3DDevice->SetSamplerState(0, D3DSAMP_MAXANISOTROPY, min(16ul, Caps.MaxAnisotropy));
|
||||
pID3DDevice->SetSamplerState(1, D3DSAMP_MAXANISOTROPY, min(16ul, Caps.MaxAnisotropy));
|
||||
pID3DDevice->SetSamplerState(2, D3DSAMP_MAXANISOTROPY, min(16ul, Caps.MaxAnisotropy));
|
||||
pID3DDevice->SetSamplerState(3, D3DSAMP_MAXANISOTROPY, min(16ul, Caps.MaxAnisotropy));
|
||||
|
||||
// store the screen's depth buffer
|
||||
DepthBuffers.push_back(new SDepthSurface());
|
||||
pID3DDevice->GetDepthStencilSurface(&(DepthBuffers[0]->Surface));
|
||||
|
@ -1794,6 +1788,8 @@ void CD3D9Driver::setBasicRenderStates(const SMaterial& material, const SMateria
|
|||
material.TextureLayer[st].AnisotropicFilter) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMip = material.TextureLayer[st].TrilinearFilter ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
||||
|
||||
if (tftMag==D3DTEXF_ANISOTROPIC || tftMin == D3DTEXF_ANISOTROPIC)
|
||||
pID3DDevice->SetSamplerState(st, D3DSAMP_MAXANISOTROPY, core::min_((DWORD)material.TextureLayer[st].AnisotropicFilter, Caps.MaxAnisotropy));
|
||||
pID3DDevice->SetSamplerState(st, D3DSAMP_MAGFILTER, tftMag);
|
||||
pID3DDevice->SetSamplerState(st, D3DSAMP_MINFILTER, tftMin);
|
||||
pID3DDevice->SetSamplerState(st, D3DSAMP_MIPFILTER, tftMip);
|
||||
|
|
|
@ -1469,7 +1469,7 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria
|
|||
attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter);
|
||||
prefix = "AnisotropicFilter";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter);
|
||||
attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter);
|
||||
prefix="TextureWrap";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrap, aTextureClampNames);
|
||||
|
@ -1535,7 +1535,7 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater
|
|||
outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str()));
|
||||
else
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str());
|
||||
outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str());
|
||||
|
||||
prefix = "TextureWrap";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
|
|
|
@ -2010,9 +2010,9 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
(material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
if (AnisotropyExtension)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
|
||||
material.TextureLayer[i].AnisotropicFilter ? MaxAnisotropy : 1.0f );
|
||||
if (FeatureAvailable[IRR_EXT_texture_filter_anisotropic])
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
|
||||
material.TextureLayer[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayer[i].AnisotropicFilter) : 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace video
|
|||
|
||||
COpenGLExtensionHandler::COpenGLExtensionHandler() :
|
||||
StencilBuffer(false),
|
||||
MultiTextureExtension(false), MultiSamplingExtension(false), AnisotropyExtension(false),
|
||||
MultiTextureExtension(false), MultiSamplingExtension(false),
|
||||
TextureCompressionExtension(false),
|
||||
MaxTextureUnits(1), MaxLights(1), MaxIndices(65535),
|
||||
MaxAnisotropy(1.0f), MaxUserClipPlanes(0),
|
||||
MaxAnisotropy(1), MaxUserClipPlanes(0),
|
||||
Version(0), ShaderLanguageVersion(0)
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0),
|
||||
|
@ -103,7 +103,6 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||
|
||||
MultiTextureExtension = FeatureAvailable[IRR_ARB_multitexture];
|
||||
MultiSamplingExtension = FeatureAvailable[IRR_ARB_multisample];
|
||||
AnisotropyExtension = FeatureAvailable[IRR_EXT_texture_filter_anisotropic];
|
||||
TextureCompressionExtension = FeatureAvailable[IRR_ARB_texture_compression];
|
||||
StencilBuffer=stencilBuffer;
|
||||
|
||||
|
@ -400,8 +399,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||
#endif
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &MaxLights);
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
GLint maxAniso=1; // temporary for size adaption
|
||||
if (FeatureAvailable[IRR_EXT_texture_filter_anisotropic])
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &MaxAnisotropy);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso);
|
||||
MaxAnisotropy=(u8)maxAniso;
|
||||
#endif
|
||||
#ifdef GL_VERSION_1_2
|
||||
if (Version>101)
|
||||
|
|
|
@ -709,7 +709,6 @@ class COpenGLExtensionHandler
|
|||
bool StencilBuffer;
|
||||
bool MultiTextureExtension;
|
||||
bool MultiSamplingExtension;
|
||||
bool AnisotropyExtension;
|
||||
bool TextureCompressionExtension;
|
||||
|
||||
// Some non-boolean properties
|
||||
|
@ -720,7 +719,7 @@ class COpenGLExtensionHandler
|
|||
//! Optimal number of indices per meshbuffer
|
||||
GLint MaxIndices;
|
||||
//! Maximal Anisotropy
|
||||
f32 MaxAnisotropy;
|
||||
u8 MaxAnisotropy;
|
||||
//! Number of user clipplanes
|
||||
u32 MaxUserClipPlanes;
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Test suite pass at GMT Sun Jan 04 16:23:39 2009
|
||||
Test suite pass at GMT Mon Jan 05 00:23:20 2009
|
||||
|
||||
|
|
Loading…
Reference in New Issue