Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
ITextureSource Class Referenceabstract

#include <texturesource.h>

+ Inheritance diagram for ITextureSource:
+ Collaboration diagram for ITextureSource:

Public Member Functions

 ITextureSource ()=default
 
virtual ~ITextureSource ()=default
 
virtual u32 getTextureId (const std::string &image)=0
 Generates a texture string into a standard texture.
 
virtual std::string getTextureName (u32 id)=0
 Returns name of existing texture by ID.
 
virtual video::ITexture * getTexture (u32 id)=0
 Returns existing texture by ID.
 
virtual video::ITexture * addArrayTexture (const std::vector< std::string > &images, u32 *id=nullptr)=0
 Generates texture string(s) into an array texture.
 
video::ITexture * getTextureForMesh (const std::string &image, u32 *id=nullptr)
 Generates a texture string into a standard texture Filters will be applied to make the texture suitable for mipmapping and linear filtering during rendering.
 
virtual bool needFilterForMesh () const =0
 
virtual PalettegetPalette (const std::string &image)=0
 Returns a palette from the given texture string.
 
virtual bool isKnownSourceImage (const std::string &name)=0
 Check if given image name exists.
 
virtual core::dimension2du getTextureDimensions (const std::string &image)=0
 Return dimensions of a texture string (will avoid actually creating the texture)
 
virtual video::SColor getTextureAverageColor (const std::string &image)=0
 Return average color of a texture string.
 
virtual void setImageCaching (bool enabled)
 Enables or disables the caching of finished texture images.
 
virtual video::ITexture * getTexture (const std::string &name, u32 *id=nullptr)=0
 Generates a texture string into a standard texture.
 
- Public Member Functions inherited from ISimpleTextureSource
 ISimpleTextureSource ()=default
 
virtual ~ISimpleTextureSource ()=default
 

Static Public Attributes

static constexpr const char * FILTER_FOR_MESH = "^[applyfiltersformesh"
 Filter needed for mesh-suitable textures, including leading ^.
 

Constructor & Destructor Documentation

◆ ITextureSource()

ITextureSource::ITextureSource ( )
default

◆ ~ITextureSource()

virtual ITextureSource::~ITextureSource ( )
virtualdefault

Member Function Documentation

◆ addArrayTexture()

virtual video::ITexture * ITextureSource::addArrayTexture ( const std::vector< std::string > & images,
u32 * id = nullptr )
pure virtual

Generates texture string(s) into an array texture.

Note
Unlike the other getters this will always add a new texture.
Returns
its ID

Implemented in TextureSource.

Referenced by NodeVisuals::fillNodeVisuals().

+ Here is the caller graph for this function:

◆ getPalette()

virtual Palette * ITextureSource::getPalette ( const std::string & image)
pure virtual

Returns a palette from the given texture string.

The pointer is valid until the texture source is destructed. Must be called from the main thread.

Implemented in TextureSource.

Referenced by ItemVisualsManager::createItemVisuals(), and NodeVisuals::updateTextures().

+ Here is the caller graph for this function:

◆ getTexture() [1/2]

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

Generates a texture string into a standard texture.

Implements ISimpleTextureSource.

Reimplemented in TextureSource.

◆ getTexture() [2/2]

virtual video::ITexture * ITextureSource::getTexture ( u32 id)
pure virtual

◆ getTextureAverageColor()

virtual video::SColor ITextureSource::getTextureAverageColor ( const std::string & image)
pure virtual

Return average color of a texture string.

Implemented in TextureSource.

Referenced by NodeVisuals::updateTextures().

+ Here is the caller graph for this function:

◆ getTextureDimensions()

virtual core::dimension2du ITextureSource::getTextureDimensions ( const std::string & image)
pure virtual

Return dimensions of a texture string (will avoid actually creating the texture)

Implemented in TextureSource.

Referenced by createAnimationFrames(), Game::createClient(), and NodeVisuals::fillNodeVisuals().

+ Here is the caller graph for this function:

◆ getTextureForMesh()

video::ITexture * ITextureSource::getTextureForMesh ( const std::string & image,
u32 * id = nullptr )
inline

Generates a texture string into a standard texture Filters will be applied to make the texture suitable for mipmapping and linear filtering during rendering.

Returns
its ID

References FILTER_FOR_MESH, getTexture(), and needFilterForMesh().

Referenced by Hud::Hud(), MapBlockMesh::MapBlockMesh(), Sky::Sky(), SmokePuffCSO::SmokePuffCSO(), Sky::addTextureToSkybox(), GenericCAO::addToScene(), createAnimationFrames(), extractTexture(), setMaterialTextureAndFilters(), Sky::setMoonTexture(), Sky::setSunriseTexture(), and Sky::setSunTexture().

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

◆ getTextureId()

virtual u32 ITextureSource::getTextureId ( const std::string & image)
pure virtual

Generates a texture string into a standard texture.

Returns
its ID

Implemented in TextureSource.

◆ getTextureName()

virtual std::string ITextureSource::getTextureName ( u32 id)
pure virtual

Returns name of existing texture by ID.

Warning
Use sparingly. Mostly useful for debugging.

Implemented in TextureSource.

◆ isKnownSourceImage()

virtual bool ITextureSource::isKnownSourceImage ( const std::string & name)
pure virtual

Check if given image name exists.

Implemented in TextureSource.

Referenced by GUIChatConsole::GUIChatConsole(), Hud::Hud(), getTextureAsImage(), Sky::setMoonTexture(), and Sky::setSunTexture().

+ Here is the caller graph for this function:

◆ needFilterForMesh()

virtual bool ITextureSource::needFilterForMesh ( ) const
pure virtual
Returns
true if getTextureForMesh will apply a filter

Implemented in TextureSource.

Referenced by getTextureForMesh(), and NodeVisuals::preUpdateTextures().

+ Here is the caller graph for this function:

◆ setImageCaching()

virtual void ITextureSource::setImageCaching ( bool enabled)
inlinevirtual

Enables or disables the caching of finished texture images.

This can be useful if you want to call getTextureAverageColor without duplicating work.

Note
Disabling caching will flush the cache.

Reimplemented in TextureSource.

Referenced by NodeVisuals::fillNodeVisuals().

+ Here is the caller graph for this function:

Member Data Documentation

◆ FILTER_FOR_MESH

const char* ITextureSource::FILTER_FOR_MESH = "^[applyfiltersformesh"
staticconstexpr

Filter needed for mesh-suitable textures, including leading ^.

Referenced by getTextureForMesh(), and NodeVisuals::preUpdateTextures().


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