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:10 +02:00 committed by sfan5
parent 05ebe2418b
commit 6bf63d4b41
9 changed files with 38 additions and 38 deletions

@ -48,7 +48,7 @@ void MeshBufListList::add(scene::IMeshBuffer *buf, v3s16 position, u8 layer)
for (MeshBufList &l : list) { for (MeshBufList &l : list) {
// comparing a full material is quite expensive so we don't do it if // comparing a full material is quite expensive so we don't do it if
// not even first texture is equal // not even first texture is equal
if (l.m.TextureLayer[0].Texture != m.TextureLayer[0].Texture) if (l.m.TextureLayers[0].Texture != m.TextureLayers[0].Texture)
continue; continue;
if (l.m == m) { if (l.m == m) {
@ -851,7 +851,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
// pass the shadow map texture to the buffer texture // pass the shadow map texture to the buffer texture
ShadowRenderer *shadow = m_rendering_engine->get_shadow_renderer(); ShadowRenderer *shadow = m_rendering_engine->get_shadow_renderer();
if (shadow && shadow->is_active()) { if (shadow && shadow->is_active()) {
auto &layer = material.TextureLayer[ShadowRenderer::TEXTURE_LAYER_SHADOW]; auto &layer = material.TextureLayers[ShadowRenderer::TEXTURE_LAYER_SHADOW];
layer.Texture = shadow->get_texture(); layer.Texture = shadow->get_texture();
layer.TextureWrapU = video::E_TEXTURE_CLAMP::ETC_CLAMP_TO_EDGE; layer.TextureWrapU = video::E_TEXTURE_CLAMP::ETC_CLAMP_TO_EDGE;
layer.TextureWrapV = video::E_TEXTURE_CLAMP::ETC_CLAMP_TO_EDGE; layer.TextureWrapV = video::E_TEXTURE_CLAMP::ETC_CLAMP_TO_EDGE;
@ -864,7 +864,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
} }
driver->setMaterial(material); driver->setMaterial(material);
++material_swaps; ++material_swaps;
material.TextureLayer[ShadowRenderer::TEXTURE_LAYER_SHADOW].Texture = nullptr; material.TextureLayers[ShadowRenderer::TEXTURE_LAYER_SHADOW].Texture = nullptr;
} }
v3f block_wpos = intToFloat(mesh_grid.getMeshPos(descriptor.m_pos) * MAP_BLOCKSIZE, BS); v3f block_wpos = intToFloat(mesh_grid.getMeshPos(descriptor.m_pos) * MAP_BLOCKSIZE, BS);

@ -255,8 +255,8 @@ void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
buf->getMaterial().Lighting = false; buf->getMaterial().Lighting = false;
buf->getMaterial().BackfaceCulling = false; buf->getMaterial().BackfaceCulling = false;
buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png")); buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png"));
buf->getMaterial().TextureLayer[0].MinFilter = video::ETMINF_NEAREST; buf->getMaterial().TextureLayers[0].MinFilter = video::ETMINF_NEAREST;
buf->getMaterial().TextureLayer[0].MagFilter = video::ETMAGF_NEAREST; buf->getMaterial().TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
buf->getMaterial().FogEnable = true; buf->getMaterial().FogEnable = true;
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
// Add to mesh // Add to mesh
@ -847,9 +847,9 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
<< " texture(s) specified, this is deprecated."; << " texture(s) specified, this is deprecated.";
logOnce(oss, warningstream); logOnce(oss, warningstream);
video::ITexture *last = m_animated_meshnode->getMaterial(0).TextureLayer[0].Texture; video::ITexture *last = m_animated_meshnode->getMaterial(0).TextureLayers[0].Texture;
for (u32 i = 1; i < mat_count; i++) { for (u32 i = 1; i < mat_count; i++) {
auto &layer = m_animated_meshnode->getMaterial(i).TextureLayer[0]; auto &layer = m_animated_meshnode->getMaterial(i).TextureLayers[0];
if (!layer.Texture) if (!layer.Texture)
layer.Texture = last; layer.Texture = last;
last = layer.Texture; last = layer.Texture;
@ -1379,7 +1379,7 @@ void GenericCAO::updateTextures(std::string mod)
video::SMaterial &material = m_animated_meshnode->getMaterial(i); video::SMaterial &material = m_animated_meshnode->getMaterial(i);
material.MaterialType = m_material_type; material.MaterialType = m_material_type;
material.MaterialTypeParam = 0.5f; material.MaterialTypeParam = 0.5f;
material.TextureLayer[0].Texture = texture; material.TextureLayers[0].Texture = texture;
material.Lighting = true; material.Lighting = true;
material.BackfaceCulling = m_prop.backface_culling; material.BackfaceCulling = m_prop.backface_culling;

@ -592,7 +592,7 @@ void Hud::drawCompassRotate(HudElement *e, video::ITexture *texture,
driver->setTransform(video::ETS_WORLD, Matrix); driver->setTransform(video::ETS_WORLD, Matrix);
video::SMaterial &material = m_rotation_mesh_buffer.getMaterial(); video::SMaterial &material = m_rotation_mesh_buffer.getMaterial();
material.TextureLayer[0].Texture = texture; material.TextureLayers[0].Texture = texture;
driver->setMaterial(material); driver->setMaterial(material);
driver->drawMeshBuffer(&m_rotation_mesh_buffer); driver->drawMeshBuffer(&m_rotation_mesh_buffer);

@ -613,8 +613,8 @@ void Minimap::drawMinimap(core::rect<s32> rect) {
tex.MagFilter = video::ETMAGF_BILINEAR; tex.MagFilter = video::ETMAGF_BILINEAR;
}); });
material.Lighting = false; material.Lighting = false;
material.TextureLayer[0].Texture = minimap_texture; material.TextureLayers[0].Texture = minimap_texture;
material.TextureLayer[1].Texture = data->heightmap_texture; material.TextureLayers[1].Texture = data->heightmap_texture;
if (m_enable_shaders && data->mode.type == MINIMAP_TYPE_SURFACE) { if (m_enable_shaders && data->mode.type == MINIMAP_TYPE_SURFACE) {
u16 sid = m_shdrsrc->getShader("minimap_shader", TILE_MATERIAL_ALPHA); u16 sid = m_shdrsrc->getShader("minimap_shader", TILE_MATERIAL_ALPHA);
@ -634,7 +634,7 @@ void Minimap::drawMinimap(core::rect<s32> rect) {
// Draw overlay // Draw overlay
video::ITexture *minimap_overlay = data->minimap_shape_round ? video::ITexture *minimap_overlay = data->minimap_shape_round ?
data->minimap_overlay_round : data->minimap_overlay_square; data->minimap_overlay_round : data->minimap_overlay_square;
material.TextureLayer[0].Texture = minimap_overlay; material.TextureLayers[0].Texture = minimap_overlay;
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
driver->setMaterial(material); driver->setMaterial(material);
driver->drawMeshBuffer(m_meshbuffer); driver->drawMeshBuffer(m_meshbuffer);
@ -646,7 +646,7 @@ void Minimap::drawMinimap(core::rect<s32> rect) {
matrix.setRotationDegrees(core::vector3df(0, 0, m_angle)); matrix.setRotationDegrees(core::vector3df(0, 0, m_angle));
} }
material.TextureLayer[0].Texture = data->player_marker; material.TextureLayers[0].Texture = data->player_marker;
driver->setTransform(video::ETS_WORLD, matrix); driver->setTransform(video::ETS_WORLD, matrix);
driver->setMaterial(material); driver->setMaterial(material);
driver->drawMeshBuffer(m_meshbuffer); driver->drawMeshBuffer(m_meshbuffer);

@ -38,11 +38,11 @@ void PostProcessingStep::configureMaterial()
material.ZBuffer = true; material.ZBuffer = true;
material.ZWriteEnable = video::EZW_ON; material.ZWriteEnable = video::EZW_ON;
for (u32 k = 0; k < texture_map.size(); ++k) { for (u32 k = 0; k < texture_map.size(); ++k) {
material.TextureLayer[k].AnisotropicFilter = 0; material.TextureLayers[k].AnisotropicFilter = 0;
material.TextureLayer[k].MinFilter = video::ETMINF_NEAREST; material.TextureLayers[k].MinFilter = video::ETMINF_NEAREST;
material.TextureLayer[k].MagFilter = video::ETMAGF_NEAREST; material.TextureLayers[k].MagFilter = video::ETMAGF_NEAREST;
material.TextureLayer[k].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[k].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
material.TextureLayer[k].TextureWrapV = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[k].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
} }
} }
@ -71,7 +71,7 @@ void PostProcessingStep::run(PipelineContext &context)
auto driver = context.device->getVideoDriver(); auto driver = context.device->getVideoDriver();
for (u32 i = 0; i < texture_map.size(); i++) for (u32 i = 0; i < texture_map.size(); i++)
material.TextureLayer[i].Texture = source->getTexture(texture_map[i]); material.TextureLayers[i].Texture = source->getTexture(texture_map[i]);
static const video::SColor color = video::SColor(0, 0, 0, 255); static const video::SColor color = video::SColor(0, 0, 0, 255);
static const video::S3DVertex vertices[4] = { static const video::S3DVertex vertices[4] = {
@ -92,8 +92,8 @@ void PostProcessingStep::run(PipelineContext &context)
void PostProcessingStep::setBilinearFilter(u8 index, bool value) void PostProcessingStep::setBilinearFilter(u8 index, bool value)
{ {
assert(index < video::MATERIAL_MAX_TEXTURES); assert(index < video::MATERIAL_MAX_TEXTURES);
material.TextureLayer[index].MinFilter = value ? video::ETMINF_BILINEAR : video::ETMINF_NEAREST; material.TextureLayers[index].MinFilter = value ? video::ETMINF_BILINEAR : video::ETMINF_NEAREST;
material.TextureLayer[index].MagFilter = value ? video::ETMAGF_BILINEAR : video::ETMAGF_NEAREST; material.TextureLayers[index].MagFilter = value ? video::ETMAGF_BILINEAR : video::ETMAGF_NEAREST;
} }
RenderStep *addPostProcessing(RenderPipeline *pipeline, RenderStep *previousStep, v2f scale, Client *client) RenderStep *addPostProcessing(RenderPipeline *pipeline, RenderStep *previousStep, v2f scale, Client *client)

@ -42,8 +42,8 @@ static video::SMaterial baseMaterial()
mat.ZBuffer = video::ECFN_DISABLED; mat.ZBuffer = video::ECFN_DISABLED;
mat.ZWriteEnable = video::EZW_OFF; mat.ZWriteEnable = video::EZW_OFF;
mat.AntiAliasing = 0; mat.AntiAliasing = 0;
mat.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; mat.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
mat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; mat.TextureLayers[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
mat.BackfaceCulling = false; mat.BackfaceCulling = false;
return mat; return mat;
} }

@ -230,10 +230,10 @@ struct TileLayer
} }
material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING) != 0; material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING) != 0;
if (!(material_flags & MATERIAL_FLAG_TILEABLE_HORIZONTAL)) { if (!(material_flags & MATERIAL_FLAG_TILEABLE_HORIZONTAL)) {
material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
} }
if (!(material_flags & MATERIAL_FLAG_TILEABLE_VERTICAL)) { if (!(material_flags & MATERIAL_FLAG_TILEABLE_VERTICAL)) {
material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
} }
} }
@ -241,12 +241,12 @@ struct TileLayer
{ {
material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING) != 0; material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING) != 0;
if (!(material_flags & MATERIAL_FLAG_TILEABLE_HORIZONTAL)) { if (!(material_flags & MATERIAL_FLAG_TILEABLE_HORIZONTAL)) {
material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
material.TextureLayer[1].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[1].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
} }
if (!(material_flags & MATERIAL_FLAG_TILEABLE_VERTICAL)) { if (!(material_flags & MATERIAL_FLAG_TILEABLE_VERTICAL)) {
material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
material.TextureLayer[1].TextureWrapV = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[1].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
} }
} }

@ -292,8 +292,8 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
// Customize materials // Customize materials
for (u32 layer = 0; layer < m_meshnode->getMaterialCount(); layer++) { for (u32 layer = 0; layer < m_meshnode->getMaterialCount(); layer++) {
video::SMaterial &material = m_meshnode->getMaterial(layer); video::SMaterial &material = m_meshnode->getMaterial(layer);
material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
material.MaterialType = m_material_type; material.MaterialType = m_material_type;
material.MaterialTypeParam = 0.5f; material.MaterialTypeParam = 0.5f;
material.BackfaceCulling = true; material.BackfaceCulling = true;
@ -700,10 +700,10 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc,
// Customize materials // Customize materials
for (u32 layer = 0; layer < mesh->getMeshBufferCount(); layer++) { for (u32 layer = 0; layer < mesh->getMeshBufferCount(); layer++) {
video::SMaterial &material = mesh->getMeshBuffer(layer)->getMaterial(); video::SMaterial &material = mesh->getMeshBuffer(layer)->getMaterial();
material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; material.TextureLayers[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
material.TextureLayer[0].MinFilter = video::ETMINF_NEAREST; material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST;
material.TextureLayer[0].MagFilter = video::ETMAGF_NEAREST; material.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
material.BackfaceCulling = true; material.BackfaceCulling = true;
material.Lighting = false; material.Lighting = false;
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;

@ -65,11 +65,11 @@ void GUIScene::setTexture(u32 idx, video::ITexture *texture)
video::SMaterial &material = m_mesh->getMaterial(idx); video::SMaterial &material = m_mesh->getMaterial(idx);
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
material.MaterialTypeParam = 0.5f; material.MaterialTypeParam = 0.5f;
material.TextureLayer[0].Texture = texture; material.TextureLayers[0].Texture = texture;
material.Lighting = false; material.Lighting = false;
material.FogEnable = true; material.FogEnable = true;
material.TextureLayer[0].MinFilter = video::ETMINF_NEAREST; material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST;
material.TextureLayer[0].MagFilter = video::ETMAGF_NEAREST; material.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
material.BackfaceCulling = false; material.BackfaceCulling = false;
material.ZWriteEnable = video::EZW_AUTO; material.ZWriteEnable = video::EZW_AUTO;
} }