Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
imagesource.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include <IImage.h>
8#include <unordered_map>
9#include <set>
10#include <string>
11
12using namespace irr;
13
14// This file is only used for internal generation of images.
15// Use texturesource.h to handle textures.
16
17// A cache used for storing source images.
18// (A "source image" is an unmodified image directly taken from the filesystem.)
19// Does not contain modified images.
21public:
23
24 void insert(const std::string &name, video::IImage *img, bool prefer_local);
25
26 video::IImage* get(const std::string &name);
27
28 // Primarily fetches from cache, secondarily tries to read from filesystem.
29 video::IImage *getOrLoad(const std::string &name);
30private:
31 std::unordered_map<std::string, video::IImage*> m_images;
32};
33
34// Generates images using texture modifiers, and caches source images.
37
43 video::IImage* generateImage(std::string_view name, std::set<std::string> &source_image_names);
44
45 // Insert a source image into the cache without touching the filesystem.
46 void insertSourceImage(const std::string &name, video::IImage *img, bool prefer_local);
47
48private:
49
50 // Generate image based on a string like "stone.png" or "[crack:1:0".
51 // If baseimg is NULL, it is created. Otherwise stuff is made on it.
52 // source_image_names is important to determine when to flush the image from a cache (dynamic media).
53 bool generateImagePart(std::string_view part_of_name, video::IImage *& baseimg,
54 std::set<std::string> &source_image_names);
55
56 // Cached settings needed for making textures from meshes
61
62 // Cache of source images
64};
Definition imagesource.h:20
video::IImage * get(const std::string &name)
Definition imagesource.cpp:63
void insert(const std::string &name, video::IImage *img, bool prefer_local)
Definition imagesource.cpp:30
video::IImage * getOrLoad(const std::string &name)
Definition imagesource.cpp:72
~SourceImageCache()
Definition imagesource.cpp:23
std::unordered_map< std::string, video::IImage * > m_images
Definition imagesource.h:31
Definition clientmap.h:30
Definition imagesource.h:35
bool m_setting_mipmap
Definition imagesource.h:57
bool m_setting_anisotropic_filter
Definition imagesource.h:60
bool generateImagePart(std::string_view part_of_name, video::IImage *&baseimg, std::set< std::string > &source_image_names)
Definition imagesource.cpp:957
video::IImage * generateImage(std::string_view name, std::set< std::string > &source_image_names)
Definition imagesource.cpp:1788
ImageSource()
Definition imagesource.cpp:1781
SourceImageCache m_sourcecache
Definition imagesource.h:63
bool m_setting_bilinear_filter
Definition imagesource.h:59
void insertSourceImage(const std::string &name, video::IImage *img, bool prefer_local)
Definition imagesource.cpp:1901
bool m_setting_trilinear_filter
Definition imagesource.h:58