Rename SMaterial::TextureLayer -> SMaterial::TextureLayers

It's not the "texture layer" of the material, but an array of texture layers.
This commit is contained in:
Gregor Parzefall 2023-06-24 15:18:06 +02:00 committed by sfan5
parent c0ef1092c0
commit c40045a40a
11 changed files with 107 additions and 107 deletions

@ -303,7 +303,7 @@ namespace video
{ }
//! Texture layer array.
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];
SMaterialLayer TextureLayers[MATERIAL_MAX_TEXTURES];
//! Type of the material. Specifies how everything is blended together
E_MATERIAL_TYPE MaterialType;
@ -465,7 +465,7 @@ namespace video
template <typename F>
void forEachTexture(F &&fn) {
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; i++) {
fn(TextureLayer[i]);
fn(TextureLayers[i]);
}
}
@ -474,7 +474,7 @@ namespace video
\return Texture matrix for texture level i. */
core::matrix4& getTextureMatrix(u32 i)
{
return TextureLayer[i].getTextureMatrix();
return TextureLayers[i].getTextureMatrix();
}
//! Gets the immutable texture transformation matrix for level i
@ -483,7 +483,7 @@ namespace video
const core::matrix4& getTextureMatrix(u32 i) const
{
if (i<MATERIAL_MAX_TEXTURES)
return TextureLayer[i].getTextureMatrix();
return TextureLayers[i].getTextureMatrix();
else
return core::IdentityMatrix;
}
@ -495,7 +495,7 @@ namespace video
{
if (i>=MATERIAL_MAX_TEXTURES)
return;
TextureLayer[i].setTextureMatrix(mat);
TextureLayers[i].setTextureMatrix(mat);
}
//! Gets the i-th texture
@ -503,7 +503,7 @@ namespace video
\return Texture for texture level i, if defined, else 0. */
ITexture* getTexture(u32 i) const
{
return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0;
return i < MATERIAL_MAX_TEXTURES ? TextureLayers[i].Texture : 0;
}
//! Sets the i-th texture
@ -514,7 +514,7 @@ namespace video
{
if (i>=MATERIAL_MAX_TEXTURES)
return;
TextureLayer[i].Texture = tex;
TextureLayers[i].Texture = tex;
}
//! Inequality operator
@ -554,7 +554,7 @@ namespace video
;
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)
{
different |= (TextureLayer[i] != b.TextureLayer[i]);
different |= (TextureLayers[i] != b.TextureLayers[i]);
}
return different;
}

@ -109,7 +109,7 @@ namespace video
{
if ( EnableLayerProps[i] )
{
material.TextureLayer[i].MinFilter = Material.TextureLayer[i].MinFilter;
material.TextureLayers[i].MinFilter = Material.TextureLayers[i].MinFilter;
}
}
break;
@ -118,7 +118,7 @@ namespace video
{
if ( EnableLayerProps[i] )
{
material.TextureLayer[i].MagFilter = Material.TextureLayer[i].MagFilter;
material.TextureLayers[i].MagFilter = Material.TextureLayers[i].MagFilter;
}
}
break;
@ -127,7 +127,7 @@ namespace video
{
if ( EnableLayerProps[i] )
{
material.TextureLayer[i].AnisotropicFilter = Material.TextureLayer[i].AnisotropicFilter;
material.TextureLayers[i].AnisotropicFilter = Material.TextureLayers[i].AnisotropicFilter;
}
}
break;
@ -138,9 +138,9 @@ namespace video
{
if ( EnableLayerProps[i] )
{
material.TextureLayer[i].TextureWrapU = Material.TextureLayer[i].TextureWrapU;
material.TextureLayer[i].TextureWrapV = Material.TextureLayer[i].TextureWrapV;
material.TextureLayer[i].TextureWrapW = Material.TextureLayer[i].TextureWrapW;
material.TextureLayers[i].TextureWrapU = Material.TextureLayers[i].TextureWrapU;
material.TextureLayers[i].TextureWrapV = Material.TextureLayers[i].TextureWrapV;
material.TextureLayers[i].TextureWrapW = Material.TextureLayers[i].TextureWrapW;
}
}
break;
@ -163,11 +163,11 @@ namespace video
{
if ( EnableLayers[i] )
{
material.TextureLayer[i] = Material.TextureLayer[i];
material.TextureLayers[i] = Material.TextureLayers[i];
}
else if ( EnableTextures[i] )
{
material.TextureLayer[i].Texture = Material.TextureLayer[i].Texture;
material.TextureLayers[i].Texture = Material.TextureLayers[i].Texture;
}
}
}

@ -264,7 +264,7 @@ COGLES2Driver::~COGLES2Driver()
bool COGLES2Driver::setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture)
{
Material.TextureLayer[layerIdx].Texture = const_cast<ITexture*>(texture); // function uses const-pointer for texture because all draw functions use const-pointers already
Material.TextureLayers[layerIdx].Texture = const_cast<ITexture*>(texture); // function uses const-pointer for texture because all draw functions use const-pointers already
return CacheHandler->getTextureCache().set(0, texture);
}
@ -1696,9 +1696,9 @@ COGLES2Driver::~COGLES2Driver()
if (resetAllRenderstates)
tmpTexture->getStatesCache().IsCached = false;
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].MagFilter != tmpTexture->getStatesCache().MagFilter)
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MagFilter != tmpTexture->getStatesCache().MagFilter)
{
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayer[i].MagFilter;
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayers[i].MagFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MAG_FILTER,
magFilter == ETMAGF_BILINEAR ? GL_LINEAR : GL_NEAREST);
@ -1707,10 +1707,10 @@ COGLES2Driver::~COGLES2Driver()
if (material.UseMipMaps && tmpTexture->hasMipMaps())
{
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
!tmpTexture->getStatesCache().MipMapStatus)
{
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayer[i].MinFilter;
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER,
minFilter == ETMINF_TRILINEAR ? GL_LINEAR_MIPMAP_LINEAR :
minFilter == ETMINF_BILINEAR ? GL_LINEAR_MIPMAP_NEAREST :
@ -1722,10 +1722,10 @@ COGLES2Driver::~COGLES2Driver()
}
else
{
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
tmpTexture->getStatesCache().MipMapStatus)
{
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayer[i].MinFilter;
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER,
(minFilter == ETMINF_TRILINEAR || minFilter == ETMINF_BILINEAR) ? GL_LINEAR : GL_NEAREST);
@ -1736,25 +1736,25 @@ COGLES2Driver::~COGLES2Driver()
#ifdef GL_EXT_texture_filter_anisotropic
if (FeatureAvailable[COGLESCoreExtensionHandler::IRR_GL_EXT_texture_filter_anisotropic] &&
(!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].AnisotropicFilter != tmpTexture->getStatesCache().AnisotropicFilter))
(!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].AnisotropicFilter != tmpTexture->getStatesCache().AnisotropicFilter))
{
glTexParameteri(tmpTextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT,
material.TextureLayer[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayer[i].AnisotropicFilter) : 1);
material.TextureLayers[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayers[i].AnisotropicFilter) : 1);
tmpTexture->getStatesCache().AnisotropicFilter = material.TextureLayer[i].AnisotropicFilter;
tmpTexture->getStatesCache().AnisotropicFilter = material.TextureLayers[i].AnisotropicFilter;
}
#endif
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].TextureWrapU != tmpTexture->getStatesCache().WrapU)
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].TextureWrapU != tmpTexture->getStatesCache().WrapU)
{
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayer[i].TextureWrapU));
tmpTexture->getStatesCache().WrapU = material.TextureLayer[i].TextureWrapU;
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayers[i].TextureWrapU));
tmpTexture->getStatesCache().WrapU = material.TextureLayers[i].TextureWrapU;
}
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].TextureWrapV != tmpTexture->getStatesCache().WrapV)
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].TextureWrapV != tmpTexture->getStatesCache().WrapV)
{
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayer[i].TextureWrapV));
tmpTexture->getStatesCache().WrapV = material.TextureLayer[i].TextureWrapV;
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayers[i].TextureWrapV));
tmpTexture->getStatesCache().WrapV = material.TextureLayers[i].TextureWrapV;
}
tmpTexture->getStatesCache().IsCached = true;

@ -112,7 +112,7 @@ void COGLES2MaterialSolidCB::OnSetMaterial(const SMaterial& material)
COGLES2MaterialBaseCB::OnSetMaterial(material);
AlphaRef = material.MaterialTypeParam;
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0;
TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
}
void COGLES2MaterialSolidCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
@ -169,7 +169,7 @@ void COGLES2MaterialOneTextureBlendCB::OnSetMaterial(const SMaterial& material)
}
}
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0;
TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
}
void COGLES2MaterialOneTextureBlendCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)

@ -71,7 +71,7 @@ void COGLES2Renderer2D::OnSetMaterial(const video::SMaterial& material,
if ( WithTexture )
{
s32 TextureUsage = material.TextureLayer[0].Texture ? 1 : 0;
s32 TextureUsage = material.TextureLayers[0].Texture ? 1 : 0;
setPixelShaderConstant(TextureUsageID, &TextureUsage, 1);
}
}

@ -1841,7 +1841,7 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
for (s32 i = Feature.MaxTextureUnits - 1; i >= 0; --i)
{
CacheHandler->getTextureCache().set(i, material.TextureLayer[i].Texture);
CacheHandler->getTextureCache().set(i, material.TextureLayers[i].Texture);
const COGLES1Texture* tmpTexture = CacheHandler->getTextureCache().get(i);
@ -1878,24 +1878,24 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
#ifdef GL_VERSION_2_1
if (Version >= 210)
{
if (!statesCache.IsCached || material.TextureLayer[i].LODBias != statesCache.LODBias)
if (!statesCache.IsCached || material.TextureLayers[i].LODBias != statesCache.LODBias)
{
if (material.TextureLayer[i].LODBias)
if (material.TextureLayers[i].LODBias)
{
const float tmp = core::clamp(material.TextureLayer[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
const float tmp = core::clamp(material.TextureLayers[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
glTexParameterf(tmpTextureType, GL_TEXTURE_LOD_BIAS, tmp);
}
else
glTexParameterf(tmpTextureType, GL_TEXTURE_LOD_BIAS, 0.f);
statesCache.LODBias = material.TextureLayer[i].LODBias;
statesCache.LODBias = material.TextureLayers[i].LODBias;
}
}
else if (FeatureAvailable[IRR_EXT_texture_lod_bias])
{
if (material.TextureLayer[i].LODBias)
if (material.TextureLayers[i].LODBias)
{
const float tmp = core::clamp(material.TextureLayer[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
const float tmp = core::clamp(material.TextureLayers[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, tmp);
}
else
@ -1904,9 +1904,9 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
#elif defined(GL_EXT_texture_lod_bias)
if (FeatureAvailable[COGLESCoreExtensionHandler::IRR_GL_EXT_texture_lod_bias])
{
if (material.TextureLayer[i].LODBias)
if (material.TextureLayers[i].LODBias)
{
const float tmp = core::clamp(material.TextureLayer[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
const float tmp = core::clamp(material.TextureLayers[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, tmp);
}
else
@ -1914,9 +1914,9 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
}
#endif
if (!statesCache.IsCached || material.TextureLayer[i].MagFilter != statesCache.MagFilter)
if (!statesCache.IsCached || material.TextureLayers[i].MagFilter != statesCache.MagFilter)
{
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayer[i].MagFilter;
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayers[i].MagFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MAG_FILTER,
magFilter == ETMAGF_BILINEAR ? GL_LINEAR : GL_NEAREST);
@ -1925,10 +1925,10 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
if (material.UseMipMaps && tmpTexture->hasMipMaps())
{
if (!statesCache.IsCached || material.TextureLayer[i].MinFilter != statesCache.MinFilter ||
if (!statesCache.IsCached || material.TextureLayers[i].MinFilter != statesCache.MinFilter ||
!statesCache.MipMapStatus)
{
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayer[i].MinFilter;
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER,
minFilter == ETMINF_TRILINEAR ? GL_LINEAR_MIPMAP_LINEAR :
minFilter == ETMINF_BILINEAR ? GL_LINEAR_MIPMAP_NEAREST :
@ -1940,10 +1940,10 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
}
else
{
if (!statesCache.IsCached || material.TextureLayer[i].MinFilter != statesCache.MinFilter ||
if (!statesCache.IsCached || material.TextureLayers[i].MinFilter != statesCache.MinFilter ||
statesCache.MipMapStatus)
{
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayer[i].MinFilter;
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER,
(minFilter == ETMINF_TRILINEAR || minFilter == ETMINF_BILINEAR) ? GL_LINEAR : GL_NEAREST);
@ -1954,25 +1954,25 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
#ifdef GL_EXT_texture_filter_anisotropic
if (FeatureAvailable[COGLESCoreExtensionHandler::IRR_GL_EXT_texture_filter_anisotropic] &&
(!statesCache.IsCached || material.TextureLayer[i].AnisotropicFilter != statesCache.AnisotropicFilter))
(!statesCache.IsCached || material.TextureLayers[i].AnisotropicFilter != statesCache.AnisotropicFilter))
{
glTexParameteri(tmpTextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT,
material.TextureLayer[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayer[i].AnisotropicFilter) : 1);
material.TextureLayers[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayers[i].AnisotropicFilter) : 1);
statesCache.AnisotropicFilter = material.TextureLayer[i].AnisotropicFilter;
statesCache.AnisotropicFilter = material.TextureLayers[i].AnisotropicFilter;
}
#endif
if (!statesCache.IsCached || material.TextureLayer[i].TextureWrapU != statesCache.WrapU)
if (!statesCache.IsCached || material.TextureLayers[i].TextureWrapU != statesCache.WrapU)
{
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayer[i].TextureWrapU));
statesCache.WrapU = material.TextureLayer[i].TextureWrapU;
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayers[i].TextureWrapU));
statesCache.WrapU = material.TextureLayers[i].TextureWrapU;
}
if (!statesCache.IsCached || material.TextureLayer[i].TextureWrapV != statesCache.WrapV)
if (!statesCache.IsCached || material.TextureLayers[i].TextureWrapV != statesCache.WrapV)
{
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayer[i].TextureWrapV));
statesCache.WrapV = material.TextureLayer[i].TextureWrapV;
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayers[i].TextureWrapV));
statesCache.WrapV = material.TextureLayers[i].TextureWrapV;
}
statesCache.IsCached = true;
@ -2013,7 +2013,7 @@ void COGLES1Driver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
Material = (OverrideMaterial2DEnabled) ? OverrideMaterial2D : InitMaterial2D;
Material.Lighting = false;
Material.TextureLayer[0].Texture = (texture) ? const_cast<COGLES1Texture*>(CacheHandler->getTextureCache().get(0)) : 0;
Material.TextureLayers[0].Texture = (texture) ? const_cast<COGLES1Texture*>(CacheHandler->getTextureCache().get(0)) : 0;
setTransform(ETS_TEXTURE_0, core::IdentityMatrix);
setBasicRenderStates(Material, LastMaterial, false);

@ -590,9 +590,9 @@ public:
// Fix textures which got removed
for ( u32 i=0; i < MATERIAL_MAX_TEXTURES; ++i )
{
if ( material.TextureLayer[i].Texture && !TextureCache[i] )
if ( material.TextureLayers[i].Texture && !TextureCache[i] )
{
material.TextureLayer[i].Texture = 0;
material.TextureLayers[i].Texture = 0;
}
}
}

@ -2673,24 +2673,24 @@ void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool reset
#ifdef GL_VERSION_2_1
if (Version >= 201)
{
if (!statesCache.IsCached || material.TextureLayer[i].LODBias != statesCache.LODBias)
if (!statesCache.IsCached || material.TextureLayers[i].LODBias != statesCache.LODBias)
{
if (material.TextureLayer[i].LODBias)
if (material.TextureLayers[i].LODBias)
{
const float tmp = core::clamp(material.TextureLayer[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
const float tmp = core::clamp(material.TextureLayers[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
glTexParameterf(tmpType, GL_TEXTURE_LOD_BIAS, tmp);
}
else
glTexParameterf(tmpType, GL_TEXTURE_LOD_BIAS, 0.f);
statesCache.LODBias = material.TextureLayer[i].LODBias;
statesCache.LODBias = material.TextureLayers[i].LODBias;
}
}
else if (FeatureAvailable[IRR_EXT_texture_lod_bias])
{
if (material.TextureLayer[i].LODBias)
if (material.TextureLayers[i].LODBias)
{
const float tmp = core::clamp(material.TextureLayer[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
const float tmp = core::clamp(material.TextureLayers[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, tmp);
}
else
@ -2699,9 +2699,9 @@ void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool reset
#elif defined(GL_EXT_texture_lod_bias)
if (FeatureAvailable[IRR_EXT_texture_lod_bias])
{
if (material.TextureLayer[i].LODBias)
if (material.TextureLayers[i].LODBias)
{
const float tmp = core::clamp(material.TextureLayer[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
const float tmp = core::clamp(material.TextureLayers[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, tmp);
}
else
@ -2709,9 +2709,9 @@ void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool reset
}
#endif
if (!statesCache.IsCached || material.TextureLayer[i].MagFilter != statesCache.MagFilter)
if (!statesCache.IsCached || material.TextureLayers[i].MagFilter != statesCache.MagFilter)
{
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayer[i].MagFilter;
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayers[i].MagFilter;
glTexParameteri(tmpType, GL_TEXTURE_MAG_FILTER,
magFilter == ETMAGF_BILINEAR ? GL_LINEAR : GL_NEAREST);
@ -2720,10 +2720,10 @@ void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool reset
if (material.UseMipMaps && tmpTexture->hasMipMaps())
{
if (!statesCache.IsCached || material.TextureLayer[i].MinFilter != statesCache.MinFilter ||
if (!statesCache.IsCached || material.TextureLayers[i].MinFilter != statesCache.MinFilter ||
!statesCache.MipMapStatus)
{
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayer[i].MinFilter;
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpType, GL_TEXTURE_MIN_FILTER,
minFilter == ETMINF_TRILINEAR ? GL_LINEAR_MIPMAP_LINEAR :
minFilter == ETMINF_BILINEAR ? GL_LINEAR_MIPMAP_NEAREST :
@ -2735,10 +2735,10 @@ void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool reset
}
else
{
if (!statesCache.IsCached || material.TextureLayer[i].MinFilter != statesCache.MinFilter ||
if (!statesCache.IsCached || material.TextureLayers[i].MinFilter != statesCache.MinFilter ||
statesCache.MipMapStatus)
{
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayer[i].MinFilter;
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpType, GL_TEXTURE_MIN_FILTER,
(minFilter == ETMINF_TRILINEAR || minFilter == ETMINF_BILINEAR) ? GL_LINEAR : GL_NEAREST);
@ -2749,31 +2749,31 @@ void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool reset
#ifdef GL_EXT_texture_filter_anisotropic
if (FeatureAvailable[IRR_EXT_texture_filter_anisotropic] &&
(!statesCache.IsCached || material.TextureLayer[i].AnisotropicFilter != statesCache.AnisotropicFilter))
(!statesCache.IsCached || material.TextureLayers[i].AnisotropicFilter != statesCache.AnisotropicFilter))
{
glTexParameteri(tmpType, GL_TEXTURE_MAX_ANISOTROPY_EXT,
material.TextureLayer[i].AnisotropicFilter > 1 ? core::min_(MaxAnisotropy, material.TextureLayer[i].AnisotropicFilter) : 1);
material.TextureLayers[i].AnisotropicFilter > 1 ? core::min_(MaxAnisotropy, material.TextureLayers[i].AnisotropicFilter) : 1);
statesCache.AnisotropicFilter = material.TextureLayer[i].AnisotropicFilter;
statesCache.AnisotropicFilter = material.TextureLayers[i].AnisotropicFilter;
}
#endif
if (!statesCache.IsCached || material.TextureLayer[i].TextureWrapU != statesCache.WrapU)
if (!statesCache.IsCached || material.TextureLayers[i].TextureWrapU != statesCache.WrapU)
{
glTexParameteri(tmpType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayer[i].TextureWrapU));
statesCache.WrapU = material.TextureLayer[i].TextureWrapU;
glTexParameteri(tmpType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayers[i].TextureWrapU));
statesCache.WrapU = material.TextureLayers[i].TextureWrapU;
}
if (!statesCache.IsCached || material.TextureLayer[i].TextureWrapV != statesCache.WrapV)
if (!statesCache.IsCached || material.TextureLayers[i].TextureWrapV != statesCache.WrapV)
{
glTexParameteri(tmpType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayer[i].TextureWrapV));
statesCache.WrapV = material.TextureLayer[i].TextureWrapV;
glTexParameteri(tmpType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayers[i].TextureWrapV));
statesCache.WrapV = material.TextureLayers[i].TextureWrapV;
}
if (!statesCache.IsCached || material.TextureLayer[i].TextureWrapW != statesCache.WrapW)
if (!statesCache.IsCached || material.TextureLayers[i].TextureWrapW != statesCache.WrapW)
{
glTexParameteri(tmpType, GL_TEXTURE_WRAP_R, getTextureWrapMode(material.TextureLayer[i].TextureWrapW));
statesCache.WrapW = material.TextureLayer[i].TextureWrapW;
glTexParameteri(tmpType, GL_TEXTURE_WRAP_R, getTextureWrapMode(material.TextureLayers[i].TextureWrapW));
statesCache.WrapW = material.TextureLayers[i].TextureWrapW;
}
statesCache.IsCached = true;

@ -402,7 +402,7 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
bool COpenGL3DriverBase::setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture)
{
Material.TextureLayer[layerIdx].Texture = const_cast<ITexture*>(texture); // function uses const-pointer for texture because all draw functions use const-pointers already
Material.TextureLayers[layerIdx].Texture = const_cast<ITexture*>(texture); // function uses const-pointer for texture because all draw functions use const-pointers already
return CacheHandler->getTextureCache().set(0, texture);
}
@ -1456,9 +1456,9 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
if (resetAllRenderstates)
tmpTexture->getStatesCache().IsCached = false;
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].MagFilter != tmpTexture->getStatesCache().MagFilter)
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MagFilter != tmpTexture->getStatesCache().MagFilter)
{
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayer[i].MagFilter;
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayers[i].MagFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MAG_FILTER,
magFilter == ETMAGF_BILINEAR ? GL_LINEAR : GL_NEAREST);
@ -1467,10 +1467,10 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
if (material.UseMipMaps && tmpTexture->hasMipMaps())
{
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
!tmpTexture->getStatesCache().MipMapStatus)
{
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayer[i].MinFilter;
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER,
minFilter == ETMINF_TRILINEAR ? GL_LINEAR_MIPMAP_LINEAR :
minFilter == ETMINF_BILINEAR ? GL_LINEAR_MIPMAP_NEAREST :
@ -1482,10 +1482,10 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
}
else
{
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
tmpTexture->getStatesCache().MipMapStatus)
{
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayer[i].MinFilter;
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER,
(minFilter == ETMINF_TRILINEAR || minFilter == ETMINF_BILINEAR) ? GL_LINEAR : GL_NEAREST);
@ -1495,24 +1495,24 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
}
if (AnisotropicFilterSupported &&
(!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].AnisotropicFilter != tmpTexture->getStatesCache().AnisotropicFilter))
(!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].AnisotropicFilter != tmpTexture->getStatesCache().AnisotropicFilter))
{
glTexParameteri(tmpTextureType, GL.TEXTURE_MAX_ANISOTROPY,
material.TextureLayer[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayer[i].AnisotropicFilter) : 1);
material.TextureLayers[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayers[i].AnisotropicFilter) : 1);
tmpTexture->getStatesCache().AnisotropicFilter = material.TextureLayer[i].AnisotropicFilter;
tmpTexture->getStatesCache().AnisotropicFilter = material.TextureLayers[i].AnisotropicFilter;
}
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].TextureWrapU != tmpTexture->getStatesCache().WrapU)
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].TextureWrapU != tmpTexture->getStatesCache().WrapU)
{
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayer[i].TextureWrapU));
tmpTexture->getStatesCache().WrapU = material.TextureLayer[i].TextureWrapU;
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayers[i].TextureWrapU));
tmpTexture->getStatesCache().WrapU = material.TextureLayers[i].TextureWrapU;
}
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].TextureWrapV != tmpTexture->getStatesCache().WrapV)
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].TextureWrapV != tmpTexture->getStatesCache().WrapV)
{
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayer[i].TextureWrapV));
tmpTexture->getStatesCache().WrapV = material.TextureLayer[i].TextureWrapV;
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayers[i].TextureWrapV));
tmpTexture->getStatesCache().WrapV = material.TextureLayers[i].TextureWrapV;
}
tmpTexture->getStatesCache().IsCached = true;

@ -106,7 +106,7 @@ void COpenGL3MaterialSolidCB::OnSetMaterial(const SMaterial& material)
COpenGL3MaterialBaseCB::OnSetMaterial(material);
AlphaRef = material.MaterialTypeParam;
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0;
TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
}
void COpenGL3MaterialSolidCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
@ -163,7 +163,7 @@ void COpenGL3MaterialOneTextureBlendCB::OnSetMaterial(const SMaterial& material)
}
}
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0;
TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
}
void COpenGL3MaterialOneTextureBlendCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)

@ -69,7 +69,7 @@ void COpenGL3Renderer2D::OnSetMaterial(const video::SMaterial& material,
if ( WithTexture )
{
s32 TextureUsage = material.TextureLayer[0].Texture ? 1 : 0;
s32 TextureUsage = material.TextureLayers[0].Texture ? 1 : 0;
setPixelShaderConstant(TextureUsageID, &TextureUsage, 1);
}
}