mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 09:15:29 +01:00 
			
		
		
		
	Remove normal map leftovers (#15609)
leftovers from #10487 / ed22260822
			
			
This commit is contained in:
		@@ -188,7 +188,6 @@ Mod directory structure
 | 
			
		||||
    │   ├── models
 | 
			
		||||
    │   ├── textures
 | 
			
		||||
    │   │   ├── modname_stuff.png
 | 
			
		||||
    │   │   ├── modname_stuff_normal.png
 | 
			
		||||
    │   │   ├── modname_something_else.png
 | 
			
		||||
    │   │   ├── subfolder_foo
 | 
			
		||||
    │   │   │   ├── modname_more_stuff.png
 | 
			
		||||
 
 | 
			
		||||
@@ -980,13 +980,6 @@ bool ImageSource::generateImagePart(std::string_view part_of_name,
 | 
			
		||||
			if (part_of_name.empty())
 | 
			
		||||
				return true;
 | 
			
		||||
 | 
			
		||||
			// Do not create normalmap dummies
 | 
			
		||||
			if (str_ends_with(part_of_name, "_normal.png")) {
 | 
			
		||||
				warningstream << "generateImagePart(): Could not load normal map \""
 | 
			
		||||
					<< part_of_name << "\"" << std::endl;
 | 
			
		||||
				return true;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			errorstream << "generateImagePart(): Could not load image \""
 | 
			
		||||
				<< part_of_name << "\" while building texture; "
 | 
			
		||||
				"Creating a dummy image" << std::endl;
 | 
			
		||||
 
 | 
			
		||||
@@ -121,7 +121,6 @@ public:
 | 
			
		||||
	// Shall be called from the main thread.
 | 
			
		||||
	void rebuildImagesAndTextures();
 | 
			
		||||
 | 
			
		||||
	video::ITexture* getNormalTexture(const std::string &name);
 | 
			
		||||
	video::SColor getTextureAverageColor(const std::string &name);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
@@ -488,27 +487,6 @@ void TextureSource::rebuildTexture(video::IVideoDriver *driver, TextureInfo &ti)
 | 
			
		||||
		m_texture_trash.push_back(t_old);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
video::ITexture* TextureSource::getNormalTexture(const std::string &name)
 | 
			
		||||
{
 | 
			
		||||
	if (isKnownSourceImage("override_normal.png"))
 | 
			
		||||
		return getTexture("override_normal.png");
 | 
			
		||||
	std::string fname_base = name;
 | 
			
		||||
	static const char *normal_ext = "_normal.png";
 | 
			
		||||
	static const u32 normal_ext_size = strlen(normal_ext);
 | 
			
		||||
	size_t pos = fname_base.find('.');
 | 
			
		||||
	std::string fname_normal = fname_base.substr(0, pos) + normal_ext;
 | 
			
		||||
	if (isKnownSourceImage(fname_normal)) {
 | 
			
		||||
		// look for image extension and replace it
 | 
			
		||||
		size_t i = 0;
 | 
			
		||||
		while ((i = fname_base.find('.', i)) != std::string::npos) {
 | 
			
		||||
			fname_base.replace(i, 4, normal_ext);
 | 
			
		||||
			i += normal_ext_size;
 | 
			
		||||
		}
 | 
			
		||||
		return getTexture(fname_base);
 | 
			
		||||
	}
 | 
			
		||||
	return nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
video::SColor TextureSource::getTextureAverageColor(const std::string &name)
 | 
			
		||||
{
 | 
			
		||||
	video::IVideoDriver *driver = RenderingEngine::get_video_driver();
 | 
			
		||||
 
 | 
			
		||||
@@ -54,7 +54,6 @@ public:
 | 
			
		||||
	 */
 | 
			
		||||
	virtual Palette* getPalette(const std::string &name) = 0;
 | 
			
		||||
	virtual bool isKnownSourceImage(const std::string &name)=0;
 | 
			
		||||
	virtual video::ITexture* getNormalTexture(const std::string &name)=0;
 | 
			
		||||
	virtual video::SColor getTextureAverageColor(const std::string &name)=0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -75,7 +74,6 @@ public:
 | 
			
		||||
	virtual void processQueue()=0;
 | 
			
		||||
	virtual void insertSourceImage(const std::string &name, video::IImage *img)=0;
 | 
			
		||||
	virtual void rebuildImagesAndTextures()=0;
 | 
			
		||||
	virtual video::ITexture* getNormalTexture(const std::string &name)=0;
 | 
			
		||||
	virtual video::SColor getTextureAverageColor(const std::string &name)=0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user