Function ptex_sys::ffi::ptexcache_get

source ·
pub unsafe fn ptexcache_get(
    cache: *mut PtexCache,
    filename: &str,
    error_str: *mut CxxString
) -> *mut PtexTexture
Expand description

Access a texture. If the specified path was previously accessed from the cache, then a pointer to the cached texture will be returned.

If the specified path hasn’t been opened yet or was purged from the cache (via the purge or purgeAll methods) then the file will be opened. If the path is relative (i.e. doesn’t begin with a ‘/’) then the search path will be used to locate the file.

The texture will be accessible until the PtexTexture::release method is called, at which point the texture will be returned to the cache. Once released, the texture may have it’s data pruned (immediately or some time later) to stay within the maximum cache size.

If the texture could not be opened, null will be returned and an error string will be set. If an error were previously encountered with the file (include the file not being found), null will be returned and no error string will be set.

Parameters:

  • filename: File path. If path is relative, search path will be used to find the file.
  • error_str: Error string to set if texture could not be opened.

§Safety

The Texture must not outlive its owning Cache.