HDK
|
Global cache of vulkan textures sourced from files. More...
#include <RV_TextureCache.h>
Classes | |
class | Image |
class | ImageInfo |
Public Types | |
enum | PlaceholderType { MISSING_BLACK_CLEAR, MISSING_BLACK_SOLID, MISSING_WHITE_SOLID, MISSING_RED_SOLID, MISSING_NORMAL_MAP, MISSING_FALLBACK, MAX_PLACEHOLDER } |
If the texture is missing, one of these generic placeholders is used. More... | |
Static Public Member Functions | |
static void | init () |
Initialize the cache (only used by the system during startup) More... | |
static void | cleanup () |
Destroy the cache (only used by the system during exit) More... | |
static void | clear () |
Clear all images out of the cache. More... | |
static void | updateTextures () |
Mark any textures as dirty if their file source has been modified. More... | |
static exint | cacheVersion () |
The serial version of the cache. Incremented when a texture is added. More... | |
static exint | cacheRefresh () |
static bool | bindTexture (RV_Render *r, RV_TextureRef &map, const RV_TextureParms &map_parms, const UT_StringHolder &map_name, const UT_StringHolder &relative_to_node, RV_ImageDim tex_type, RV_ShaderVariableSet *set, const UT_StringHolder &sampler_name, bool deferred_load, bool &deferred_loaded, int &op_id, PlaceholderType missing=MISSING_WHITE_SOLID, UT_Vector4F *fallback_color=nullptr) |
static bool | bindTextureRef (RV_Render *r, RV_TextureRef &ref, RV_ShaderVariableSet *set, const UT_StringHolder &sampler_name) |
static bool | bindPlaceholder (RV_Render *r, RV_ImageDim tex_type, RV_ShaderVariableSet *set, const UT_StringHolder &sampler_name, PlaceholderType placeholder_type, const UT_Vector4F *fallbackcolor=nullptr) |
static bool | loadTextureRef (RV_Render *r, RV_TextureRef &map, const RV_TextureParms &map_parms, const UT_StringHolder &map_name, const UT_StringHolder &relative_to_node, RV_ImageDim tex_type, bool allow_deferred_load, bool &defer_load_finished, int &op_id, UT_Vector3i *resolution=nullptr) |
static void | checkTextureDirty (RV_TextureRef &map, bool &dirty) |
static void | checkTextureHasAlpha (const RV_TextureRef &ref, bool &has_alpha) |
Check if the texture has an alpha channel. More... | |
static const char * | getFileSeparator () |
Protected Member Functions | |
exint | resolveTexture (RV_Render *r, const UT_StringHolder &map_name, const UT_StringHolder &relative_to_node, const RV_TextureParms &tex_parms, RV_ImageDim tex_type, bool force_update, bool deferred_load, bool &defer_loaded, int &op_id, bool &missing_texture, UT_Vector3i *resolution) |
RV_TextureCache::Image | privGetTexture (exint id) |
virtual | ~RV_TextureCache () |
Protected Member Functions inherited from UT_NonCopyableNS::UT_NonCopyable | |
UT_NonCopyable ()=default | |
~UT_NonCopyable ()=default | |
UT_NonCopyable (const UT_NonCopyable &)=delete | |
UT_NonCopyable & | operator= (const UT_NonCopyable &)=delete |
Static Protected Member Functions | |
static RV_TextureCache::Image | getTexture (exint id) |
static RV_VKImage * | getPlaceholder (RV_Render *r, RV_ImageDim tex_type, PlaceholderType type=MISSING_WHITE_SOLID, const UT_Vector4F *fallbackcolor=nullptr) |
Global cache of vulkan textures sourced from files.
Definition at line 34 of file RV_TextureCache.h.
If the texture is missing, one of these generic placeholders is used.
Enumerator | |
---|---|
MISSING_BLACK_CLEAR | |
MISSING_BLACK_SOLID | |
MISSING_WHITE_SOLID | |
MISSING_RED_SOLID | |
MISSING_NORMAL_MAP | |
MISSING_FALLBACK | |
MAX_PLACEHOLDER |
Definition at line 54 of file RV_TextureCache.h.
|
protectedvirtual |
|
static |
Bind a small placeholder texture (1x1) to 'sampler_name' in 'set'. The RGBA texture color is defined by the placeholder_type, or can be a custom/ color if the type is FALLBACK. The texture is 8b unorm RGBA.
|
static |
Load the map (if needed) and bind the resulting texture to 'sampler_name' in 'set'. If it cannot be loaded, bind a placeholder texture instead. This method is equivalent to calling loadTextureRef() and then bindTextureRef() or bindPlaceholder(). If the map is a reference to a mofr with op:, op_id will contain its unique ID.
|
static |
Binds an existing texture ref to the set at 'sampler_name'. It should not be a placeholder image (use bindPlaceholder instead).
|
static |
The serial refresh count of the cache. Incremented when the user explicity updates the textures
|
static |
The serial version of the cache. Incremented when a texture is added.
|
static |
Check if the texture is out of date. Flag the ref and set dirty
if so. doesn't touch either if it's current.
|
static |
Check if the texture has an alpha channel.
|
static |
Destroy the cache (only used by the system during exit)
|
static |
Clear all images out of the cache.
|
inlinestatic |
For resolving a bunch of files to a 2D array, this is the separator character between the filenames.
Definition at line 126 of file RV_TextureCache.h.
|
staticprotected |
|
staticprotected |
|
static |
Initialize the cache (only used by the system during startup)
|
static |
Load the map info a texture ref without binding it to a shader. If the map could not be loaded, map.isPlaceholder() will be true. If allow_deferred_load is true, background load the texture. Keep calling this in subsequent redraws until defer_load_finished is true.
|
protected |
|
protected |
|
static |
Mark any textures as dirty if their file source has been modified.