Graphics::ITextureManager class

Derived classes

class cTextureManager
The implementation of ITextureManager; this should only be used for extending and detouring.

Public static functions

static auto Get() -> ITextureManager*
Returns the active texture manager.

Constructors, destructors, conversion operators

~ITextureManager() virtual

Public functions

auto AddRef() -> int pure virtual
auto Release() -> int pure virtual
auto Initialize() -> bool pure virtual
auto Dispose() -> bool pure virtual
void Update() pure virtual
auto EvictManagedResources() -> int pure virtual
auto GetTexture(const struct ResourceKey name, int flags = 0) -> Texture* pure virtual
Gets the texture stored with the given file name.
auto GetRasterTexture(uint32_t instanceID, uint32_t groupID, char arg_8 = 0) -> Texture* pure virtual
Same as GetTexture().
auto HasTexture(const struct ResourceKey name) const -> bool pure virtual
Tells whether a texture with this name is loaded in this manager, or a .raster texture exists with this name.
auto HasRasterTexture(uint32_t instanceID, uint32_t groupID) const -> bool pure virtual
Same as HasTexture().
auto GetTextureName(const Texture* pTexture) const -> ResourceKey pure virtual
Returns the ResourceKey name of the given Texture.
auto GetRasterResource(Texture* texture) -> cRwRasterDirectResource* pure virtual
Returns the resource object for a given texture, which can be used to read and write the texture into a file.
auto WaitForLoadInternal(Texture* texture) -> bool pure virtual
Waits (blocks execution) until a texture has completely loaded.
auto AddTextureLoadDependency(Texture* texture, App::cJob* job) -> bool pure virtual
For textures that have to be loaded asynchronously, adds the texture loading as a dependency for a job (that is, the job won't execute until the texture finishes loading).
auto CreateTexture(uint32_t intanceID, uint32_t groupID, int width, int height, int mipmapLevels, int flags, D3DFORMAT format, int = 0) -> Texture* pure virtual
Creates a new raster texture and adds it to the raster manager, referenced by the given group and instance IDs.
auto CreateTextureAutoKey(int width, int height, int mipmapLevels, int flags, D3DFORMAT format, int) -> Texture* pure virtual
Generates an automatic instance ID for group ID 0x40002200 and type ID .raster, then creates a new raster texture and adds it to the raster manager, referenced by the given group and instance IDs.
auto WriteTexture(Texture* texture, Resource::Database* database, bool async) -> bool pure virtual
Saves a texture into the given database (package or folder), as a .raster file (it will use the .raster type ID regardless of the texture key)
auto AddRasterAutoKey(RenderWare::Raster* pRaster, int flags = 0) -> Texture* pure virtual
Generates an automatic instance ID for group ID 0x40002200 and type ID .raster, then adds the given raster with that name to the manager.
auto AddRaster(uint32_t instanceID, uint32_t groupID, RenderWare::Raster* pRaster, int flags = 0) -> Texture* pure virtual
Adds the given raster to the manager, where it can be obtained again using the group and instance IDs specified.
auto CopyTextureAsReference(uint32_t instanceID, uint32_t groupID, Texture* pTexture, int flags = 0) -> Texture* pure virtual
Creates a new Texture that references the same underlying RenderWare::Raster as the given texture.
void SetTextureModified(Texture* texture, bool modified) pure virtual
Marks the given texture as (not) modified.
auto ExtractTextureRaster(RenderWare::Raster* pRaster, cImageDataRawPtr& dst, bool async, uint32_t messageID = 0) -> bool pure virtual
Extracts the raw contents of a raster texture.
auto ExtractTexture(Texture* texture, cImageDataRawPtr& dst, bool async, uint32_t messageID = 0) -> bool pure virtual
Extracts the raw contents of a texture.
auto ReloadTextureByKey(const struct ResourceKey name) -> bool pure virtual
Calls ReloadTexture() for the texture with the given key (type ID is ignored).
auto ReloadTextureByID(uint32_t instanceID, uint32_t groupID) -> bool pure virtual
Calls ReloadTexture() for the texture with the given group and instance IDs.
auto ReloadTexture(Texture* texture) -> bool pure virtual
Reloads the texture by reading it from its file again.
void RegisterRenderWareContents(RenderWare::RenderWareFile* pRenderWare) pure virtual
Adds all the textures from the given RW4 file (all the RenderWare::Raster sections).
void UnregisterRenderWareContents(RenderWare::RenderWareFile* pRenderWare) pure virtual
Removes all the textures that are contained in the given RW4 file.
auto func74h() -> int pure virtual
void func78h(int) pure virtual

Function documentation

Texture* Graphics::ITextureManager::GetTexture(const struct ResourceKey name, int flags = 0) pure virtual

Gets the texture stored with the given file name.

Parameters
name
flags

If the texture is not already loaded, it will be loaded in this method. The type ID will be ignored; generally it tries to load .raster textures.

In order to load textures that are not .raster, you must pass kForceLoad as a parameter.

Texture* Graphics::ITextureManager::GetRasterTexture(uint32_t instanceID, uint32_t groupID, char arg_8 = 0) pure virtual

Same as GetTexture().

Parameters
instanceID
groupID
arg_8

bool Graphics::ITextureManager::HasTexture(const struct ResourceKey name) const pure virtual

Tells whether a texture with this name is loaded in this manager, or a .raster texture exists with this name.

Parameters
name The name of the texture. The type ID will be ignored.

bool Graphics::ITextureManager::HasRasterTexture(uint32_t instanceID, uint32_t groupID) const pure virtual

Same as HasTexture().

Parameters
instanceID
groupID

ResourceKey Graphics::ITextureManager::GetTextureName(const Texture* pTexture) const pure virtual

Returns the ResourceKey name of the given Texture.

Parameters
pTexture The Texture whose name will be returned.

The type ID might be irrelevant.

cRwRasterDirectResource* Graphics::ITextureManager::GetRasterResource(Texture* texture) pure virtual

Returns the resource object for a given texture, which can be used to read and write the texture into a file.

Parameters
texture

bool Graphics::ITextureManager::WaitForLoadInternal(Texture* texture) pure virtual

Waits (blocks execution) until a texture has completely loaded.

Parameters
texture

bool Graphics::ITextureManager::AddTextureLoadDependency(Texture* texture, App::cJob* job) pure virtual

For textures that have to be loaded asynchronously, adds the texture loading as a dependency for a job (that is, the job won't execute until the texture finishes loading).

Parameters
texture
job

Texture* Graphics::ITextureManager::CreateTexture(uint32_t intanceID, uint32_t groupID, int width, int height, int mipmapLevels, int flags, D3DFORMAT format, int = 0) pure virtual

Creates a new raster texture and adds it to the raster manager, referenced by the given group and instance IDs.

Parameters
intanceID
groupID
width
height
mipmapLevels
flags
format
Returns The new created texture.

Texture* Graphics::ITextureManager::CreateTextureAutoKey(int width, int height, int mipmapLevels, int flags, D3DFORMAT format, int) pure virtual

Generates an automatic instance ID for group ID 0x40002200 and type ID .raster, then creates a new raster texture and adds it to the raster manager, referenced by the given group and instance IDs.

Parameters
width
height
mipmapLevels
flags
format
Returns The new created texture.

bool Graphics::ITextureManager::WriteTexture(Texture* texture, Resource::Database* database, bool async) pure virtual

Saves a texture into the given database (package or folder), as a .raster file (it will use the .raster type ID regardless of the texture key)

Parameters
texture
database
async If true, texture will be saved asynchronously

Texture* Graphics::ITextureManager::AddRasterAutoKey(RenderWare::Raster* pRaster, int flags = 0) pure virtual

Generates an automatic instance ID for group ID 0x40002200 and type ID .raster, then adds the given raster with that name to the manager.

Parameters
pRaster
flags
Returns The Texture object for the raster

Texture* Graphics::ITextureManager::AddRaster(uint32_t instanceID, uint32_t groupID, RenderWare::Raster* pRaster, int flags = 0) pure virtual

Adds the given raster to the manager, where it can be obtained again using the group and instance IDs specified.

Parameters
instanceID
groupID
pRaster
flags
Returns The Texture object for the raster

Texture* Graphics::ITextureManager::CopyTextureAsReference(uint32_t instanceID, uint32_t groupID, Texture* pTexture, int flags = 0) pure virtual

Creates a new Texture that references the same underlying RenderWare::Raster as the given texture.

Parameters
instanceID
groupID
pTexture
flags
Returns The new Texture object

void Graphics::ITextureManager::SetTextureModified(Texture* texture, bool modified) pure virtual

Marks the given texture as (not) modified.

Parameters
texture
modified

bool Graphics::ITextureManager::ExtractTextureRaster(RenderWare::Raster* pRaster, cImageDataRawPtr& dst, bool async, uint32_t messageID = 0) pure virtual

Extracts the raw contents of a raster texture.

Parameters
pRaster The source texture
dst Pointer where the extracted data will be created
async If true, extract asynchronously, in the background; if false, block the execution until extraction is complete.
messageID For async extraction, ID of message sent when extraction has finished (defaults to 0x522264D)

bool Graphics::ITextureManager::ExtractTexture(Texture* texture, cImageDataRawPtr& dst, bool async, uint32_t messageID = 0) pure virtual

Extracts the raw contents of a texture.

Parameters
texture The source texture
dst Pointer where the extracted data will be created
async If true, extract asynchronously, in the background; if false, block the execution until extraction is complete.
messageID For async extraction, ID of message sent when extraction has finished (defaults to 0x522264D)

bool Graphics::ITextureManager::ReloadTextureByKey(const struct ResourceKey name) pure virtual

Calls ReloadTexture() for the texture with the given key (type ID is ignored).

Parameters
name

bool Graphics::ITextureManager::ReloadTextureByID(uint32_t instanceID, uint32_t groupID) pure virtual

Calls ReloadTexture() for the texture with the given group and instance IDs.

Parameters
instanceID
groupID

It actually calls ReloadTextureByKey() with a .raster typeID, but that function ignores typeID, so it doesn't matter.

bool Graphics::ITextureManager::ReloadTexture(Texture* texture) pure virtual

Reloads the texture by reading it from its file again.

Parameters
texture

Removes the RasterResourceObject of the given texture and loads it from the resource manager again, using the same ResourceKey.

void Graphics::ITextureManager::RegisterRenderWareContents(RenderWare::RenderWareFile* pRenderWare) pure virtual

Adds all the textures from the given RW4 file (all the RenderWare::Raster sections).

Parameters
pRenderWare

void Graphics::ITextureManager::UnregisterRenderWareContents(RenderWare::RenderWareFile* pRenderWare) pure virtual

Removes all the textures that are contained in the given RW4 file.

Parameters
pRenderWare