Remove unused leftovers from normal mapping

This commit is contained in:
sfan5 2024-09-06 11:02:26 +02:00
parent e90ef85e7d
commit 275bef0633
6 changed files with 1 additions and 59 deletions

@ -746,9 +746,6 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
material.MaterialType = m_shdrsrc->getShaderInfo( material.MaterialType = m_shdrsrc->getShaderInfo(
p.layer.shader_id).material; p.layer.shader_id).material;
p.layer.applyMaterialOptionsWithShaders(material); p.layer.applyMaterialOptionsWithShaders(material);
if (p.layer.normal_texture)
material.setTexture(1, p.layer.normal_texture);
material.setTexture(2, p.layer.flags_texture);
} else { } else {
p.layer.applyMaterialOptions(material); p.layer.applyMaterialOptions(material);
} }
@ -858,11 +855,6 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
const FrameSpec &frame = (*tile.frames)[frameno]; const FrameSpec &frame = (*tile.frames)[frameno];
buf->getMaterial().setTexture(0, frame.texture); buf->getMaterial().setTexture(0, frame.texture);
if (m_enable_shaders) {
if (frame.normal_texture)
buf->getMaterial().setTexture(1, frame.normal_texture);
buf->getMaterial().setTexture(2, frame.flags_texture);
}
} }
// Day-night transition // Day-night transition

@ -137,7 +137,6 @@ public:
video::ITexture* getNormalTexture(const std::string &name); video::ITexture* getNormalTexture(const std::string &name);
video::SColor getTextureAverageColor(const std::string &name); video::SColor getTextureAverageColor(const std::string &name);
video::ITexture *getShaderFlagsTexture(bool normamap_present);
private: private:
@ -541,25 +540,3 @@ video::SColor TextureSource::getTextureAverageColor(const std::string &name)
return c; return c;
} }
video::ITexture *TextureSource::getShaderFlagsTexture(bool normalmap_present)
{
std::string tname = "__shaderFlagsTexture";
tname += normalmap_present ? "1" : "0";
if (isKnownSourceImage(tname)) {
return getTexture(tname);
}
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
video::IImage *flags_image = driver->createImage(
video::ECF_A8R8G8B8, core::dimension2d<u32>(1, 1));
sanity_check(flags_image);
video::SColor c(255, normalmap_present ? 255 : 0, 0, 0);
flags_image->setPixel(0, 0, c);
insertSourceImage(tname, flags_image);
flags_image->drop();
return getTexture(tname);
}

@ -71,7 +71,6 @@ public:
virtual bool isKnownSourceImage(const std::string &name)=0; virtual bool isKnownSourceImage(const std::string &name)=0;
virtual video::ITexture* getNormalTexture(const std::string &name)=0; virtual video::ITexture* getNormalTexture(const std::string &name)=0;
virtual video::SColor getTextureAverageColor(const std::string &name)=0; virtual video::SColor getTextureAverageColor(const std::string &name)=0;
virtual video::ITexture *getShaderFlagsTexture(bool normalmap_present)=0;
}; };
class IWritableTextureSource : public ITextureSource class IWritableTextureSource : public ITextureSource
@ -93,7 +92,6 @@ public:
virtual void rebuildImagesAndTextures()=0; virtual void rebuildImagesAndTextures()=0;
virtual video::ITexture* getNormalTexture(const std::string &name)=0; virtual video::ITexture* getNormalTexture(const std::string &name)=0;
virtual video::SColor getTextureAverageColor(const std::string &name)=0; virtual video::SColor getTextureAverageColor(const std::string &name)=0;
virtual video::ITexture *getShaderFlagsTexture(bool normalmap_present)=0;
}; };
IWritableTextureSource *createTextureSource(); IWritableTextureSource *createTextureSource();

@ -62,8 +62,6 @@ struct FrameSpec
u32 texture_id = 0; u32 texture_id = 0;
video::ITexture *texture = nullptr; video::ITexture *texture = nullptr;
video::ITexture *normal_texture = nullptr;
video::ITexture *flags_texture = nullptr;
}; };
#define MAX_TILE_LAYERS 2 #define MAX_TILE_LAYERS 2
@ -114,8 +112,6 @@ struct TileLayer
// Ordered for size, please do not reorder // Ordered for size, please do not reorder
video::ITexture *texture = nullptr; video::ITexture *texture = nullptr;
video::ITexture *normal_texture = nullptr;
video::ITexture *flags_texture = nullptr;
u32 shader_id = 0; u32 shader_id = 0;

@ -306,9 +306,6 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
}); });
// mipmaps cause "thin black line" artifacts // mipmaps cause "thin black line" artifacts
material.UseMipMaps = false; material.UseMipMaps = false;
if (m_enable_shaders) {
material.setTexture(2, tsrc->getShaderFlagsTexture(false));
}
} }
} }
@ -343,7 +340,6 @@ static scene::SMesh *createSpecialNodeMesh(Client *client, MapNode n,
if (p.layer.material_flags & MATERIAL_FLAG_ANIMATION) { if (p.layer.material_flags & MATERIAL_FLAG_ANIMATION) {
const FrameSpec &frame = (*p.layer.frames)[0]; const FrameSpec &frame = (*p.layer.frames)[0];
p.layer.texture = frame.texture; p.layer.texture = frame.texture;
p.layer.normal_texture = frame.normal_texture;
} }
for (video::S3DVertex &v : p.vertices) { for (video::S3DVertex &v : p.vertices) {
v.Color.setAlpha(255); v.Color.setAlpha(255);
@ -772,16 +768,6 @@ void postProcessNodeMesh(scene::SMesh *mesh, const ContentFeatures &f,
} else { } else {
material.setTexture(0, layer->texture); material.setTexture(0, layer->texture);
} }
if (use_shaders) {
if (layer->normal_texture) {
if (layer->animation_frame_count > 1) {
const FrameSpec &animation_frame = (*layer->frames)[0];
material.setTexture(1, animation_frame.normal_texture);
} else
material.setTexture(1, layer->normal_texture);
}
material.setTexture(2, layer->flags_texture);
}
if (apply_scale && tile->world_aligned) { if (apply_scale && tile->world_aligned) {
u32 n = buf->getVertexCount(); u32 n = buf->getVertexCount();

@ -712,8 +712,6 @@ static void fillTileAttribs(ITextureSource *tsrc, TileLayer *layer,
if (!tile.world_aligned) if (!tile.world_aligned)
layer->scale = 1; layer->scale = 1;
layer->flags_texture = tsrc->getShaderFlagsTexture(layer->normal_texture ? true : false);
// Material flags // Material flags
layer->material_flags = 0; layer->material_flags = 0;
if (backface_culling) if (backface_culling)
@ -753,18 +751,13 @@ static void fillTileAttribs(ITextureSource *tsrc, TileLayer *layer,
std::ostringstream os(std::ios::binary); std::ostringstream os(std::ios::binary);
for (int i = 0; i < frame_count; i++) { for (int i = 0; i < frame_count; i++) {
FrameSpec frame;
os.str(""); os.str("");
os << tiledef.name; os << tiledef.name;
tiledef.animation.getTextureModifer(os, tiledef.animation.getTextureModifer(os,
layer->texture->getOriginalSize(), i); layer->texture->getOriginalSize(), i);
FrameSpec &frame = (*layer->frames)[i];
frame.texture = tsrc->getTextureForMesh(os.str(), &frame.texture_id); frame.texture = tsrc->getTextureForMesh(os.str(), &frame.texture_id);
if (layer->normal_texture)
frame.normal_texture = tsrc->getNormalTexture(os.str());
frame.flags_texture = layer->flags_texture;
(*layer->frames)[i] = frame;
} }
} }
} }