Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
TextureSource Class Referencefinal
+ Inheritance diagram for TextureSource:
+ Collaboration diagram for TextureSource:

Public Member Functions

 TextureSource ()
 
virtual ~TextureSource ()
 
u32 getTextureId (const std::string &name)
 
std::string getTextureName (u32 id)
 
video::ITexture * getTexture (u32 id)
 
video::ITexture * getTexture (const std::string &name, u32 *id=NULL)
 
video::ITexture * getTextureForMesh (const std::string &name, u32 *id)
 
virtual PalettegetPalette (const std::string &name)
 
bool isKnownSourceImage (const std::string &name)
 
void processQueue ()
 
void insertSourceImage (const std::string &name, video::IImage *img)
 
void rebuildImagesAndTextures ()
 
video::ITexture * getNormalTexture (const std::string &name)
 
video::SColor getTextureAverageColor (const std::string &name)
 
- Public Member Functions inherited from IWritableTextureSource
 IWritableTextureSource ()=default
 
virtual ~IWritableTextureSource ()=default
 
- Public Member Functions inherited from ITextureSource
 ITextureSource ()=default
 
virtual ~ITextureSource ()=default
 
- Public Member Functions inherited from ISimpleTextureSource
 ISimpleTextureSource ()=default
 
virtual ~ISimpleTextureSource ()=default
 

Private Member Functions

void rebuildTexture (video::IVideoDriver *driver, TextureInfo &ti)
 
u32 generateTexture (const std::string &name)
 

Private Attributes

std::thread::id m_main_thread
 
ImageSource m_imagesource
 
MutexedMap< std::string, bool > m_source_image_existence
 
std::vector< TextureInfom_textureinfo_cache
 
std::map< std::string, u32 > m_name_to_id
 
std::mutex m_textureinfo_cache_mutex
 
RequestQueue< std::string, u32, std::thread::id, u8 > m_get_texture_queue
 
std::vector< video::ITexture * > m_texture_trash
 
std::unordered_map< std::string, Palettem_palettes
 
bool mesh_filter_needed
 

Constructor & Destructor Documentation

◆ TextureSource()

TextureSource::TextureSource ( )

References g_settings, Settings::getBool(), m_main_thread, m_name_to_id, m_textureinfo_cache, and mesh_filter_needed.

+ Here is the call graph for this function:

◆ ~TextureSource()

TextureSource::~TextureSource ( )
virtual

References RenderingEngine::get_video_driver(), infostream, m_texture_trash, and m_textureinfo_cache.

+ Here is the call graph for this function:

Member Function Documentation

◆ generateTexture()

u32 TextureSource::generateTexture ( const std::string & name)
private

References Align2Npot2(), errorstream, ImageSource::generateImage(), RenderingEngine::get_video_driver(), guiScalingCache(), infostream, m_imagesource, m_main_thread, m_name_to_id, m_textureinfo_cache, m_textureinfo_cache_mutex, and sanity_check.

Referenced by getTextureId(), and processQueue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNormalTexture()

video::ITexture * TextureSource::getNormalTexture ( const std::string & name)
virtual

Implements IWritableTextureSource.

References getTexture(), and isKnownSourceImage().

+ Here is the call graph for this function:

◆ getPalette()

Palette * TextureSource::getPalette ( const std::string & name)
virtual

Returns a palette from the given texture name. The pointer is valid until the texture source is destructed. Should be called from the main thread.

Implements ITextureSource.

References ImageSource::generateImage(), m_imagesource, m_main_thread, m_palettes, sanity_check, and warningstream.

+ Here is the call graph for this function:

◆ getTexture() [1/2]

video::ITexture * TextureSource::getTexture ( const std::string & name,
u32 * id = NULL )
virtual

Implements IWritableTextureSource.

References getTexture(), and getTextureId().

+ Here is the call graph for this function:

◆ getTexture() [2/2]

video::ITexture * TextureSource::getTexture ( u32 id)
virtual

Implements IWritableTextureSource.

References m_textureinfo_cache, and m_textureinfo_cache_mutex.

Referenced by getNormalTexture(), getTexture(), getTextureAverageColor(), and getTextureForMesh().

+ Here is the caller graph for this function:

◆ getTextureAverageColor()

video::SColor TextureSource::getTextureAverageColor ( const std::string & name)
virtual

Implements IWritableTextureSource.

References RenderingEngine::get_video_driver(), ImageSource::getImageAverageColor(), and getTexture().

+ Here is the call graph for this function:

◆ getTextureForMesh()

video::ITexture * TextureSource::getTextureForMesh ( const std::string & name,
u32 * id )
virtual

Implements ITextureSource.

References getTexture(), and mesh_filter_needed.

+ Here is the call graph for this function:

◆ getTextureId()

u32 TextureSource::getTextureId ( const std::string & name)
virtual

Implements IWritableTextureSource.

References RequestQueue< Key, T, Caller, CallerData >::add(), errorstream, generateTexture(), infostream, GetResult< Key, T, Caller, CallerData >::item, GetResult< Key, T, Caller, CallerData >::key, m_get_texture_queue, m_main_thread, m_name_to_id, m_textureinfo_cache_mutex, and MutexedQueue< T >::pop_front().

Referenced by getTexture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextureName()

std::string TextureSource::getTextureName ( u32 id)
virtual

◆ insertSourceImage()

void TextureSource::insertSourceImage ( const std::string & name,
video::IImage * img )
virtual

Implements IWritableTextureSource.

References RenderingEngine::get_video_driver(), ImageSource::insertSourceImage(), m_imagesource, m_main_thread, m_source_image_existence, m_textureinfo_cache, m_textureinfo_cache_mutex, rebuildTexture(), sanity_check, MutexedMap< Key, Value >::set(), and verbosestream.

+ Here is the call graph for this function:

◆ isKnownSourceImage()

bool TextureSource::isKnownSourceImage ( const std::string & name)
inlinevirtual

Implements IWritableTextureSource.

References MutexedMap< Key, Value >::get(), getTexturePath(), m_source_image_existence, and MutexedMap< Key, Value >::set().

Referenced by getNormalTexture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processQueue()

void TextureSource::processQueue ( )
virtual

Implements IWritableTextureSource.

References RequestQueue< Key, T, Caller, CallerData >::empty(), generateTexture(), GetRequest< Key, T, Caller, CallerData >::key, m_get_texture_queue, RequestQueue< Key, T, Caller, CallerData >::pop(), and RequestQueue< Key, T, Caller, CallerData >::pushResult().

+ Here is the call graph for this function:

◆ rebuildImagesAndTextures()

void TextureSource::rebuildImagesAndTextures ( )
virtual

Implements IWritableTextureSource.

References RenderingEngine::get_video_driver(), infostream, m_textureinfo_cache, m_textureinfo_cache_mutex, rebuildTexture(), and sanity_check.

+ Here is the call graph for this function:

◆ rebuildTexture()

void TextureSource::rebuildTexture ( video::IVideoDriver * driver,
TextureInfo & ti )
private

References Align2Npot2(), ImageSource::generateImage(), guiScalingCache(), m_imagesource, m_main_thread, m_texture_trash, TextureInfo::name, sanity_check, TextureInfo::sourceImages, and TextureInfo::texture.

Referenced by insertSourceImage(), and rebuildImagesAndTextures().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_get_texture_queue

RequestQueue<std::string, u32, std::thread::id, u8> TextureSource::m_get_texture_queue
private

Referenced by getTextureId(), and processQueue().

◆ m_imagesource

ImageSource TextureSource::m_imagesource
private

◆ m_main_thread

std::thread::id TextureSource::m_main_thread
private

◆ m_name_to_id

std::map<std::string, u32> TextureSource::m_name_to_id
private

◆ m_palettes

std::unordered_map<std::string, Palette> TextureSource::m_palettes
private

Referenced by getPalette().

◆ m_source_image_existence

MutexedMap<std::string, bool> TextureSource::m_source_image_existence
private

◆ m_texture_trash

std::vector<video::ITexture*> TextureSource::m_texture_trash
private

Referenced by ~TextureSource(), and rebuildTexture().

◆ m_textureinfo_cache

std::vector<TextureInfo> TextureSource::m_textureinfo_cache
private

◆ m_textureinfo_cache_mutex

std::mutex TextureSource::m_textureinfo_cache_mutex
private

◆ mesh_filter_needed

bool TextureSource::mesh_filter_needed
private

Referenced by TextureSource(), and getTextureForMesh().


The documentation for this class was generated from the following file: