Graphics::IMaterialManager class

This manager stores the information of materials, which are used to control the visual appearance of game objects.

Materials are mapped in this manager using an ID, and they link to one or multiple CompiledState and Texture objects. For more information, check the Material class.

Derived classes

class cMaterialManager
The implementation of IMaterialManager; this should only be used for extending and detouring.

Public static functions

static auto Get() -> IMaterialManager*
Gets the active material manager.
static auto ReadCompiledShaders(uint32_t instanceID) -> bool
static auto ReadCompiledShaders(IO::IStream* pStream) -> bool
static auto ReadMaterials(uint32_t instanceID) -> bool

Constructors, destructors, conversion operators

~IMaterialManager() pure virtual

Public functions

auto AddRef() -> void pure virtual
auto Release() -> void pure virtual
auto Initialize() -> bool pure virtual
auto Dispose() -> bool pure virtual
auto Update() -> bool pure virtual
auto SetScriptFile(const char*) -> void pure virtual
auto LoadMaterials() -> bool pure virtual
auto HasMaterial2(uint32_t instanceID, uint32_t groupID) -> void pure virtual
auto HasMaterial(uint32_t materialID) -> bool pure virtual
Tells whether a material with this materialID is valid (that is, it has at least one compiled state).
auto GetMaterialInstance(uint32_t materialID) -> Material* pure virtual
Gets the material assigned to the given ID.
auto GetMaterialInstances(size_t count, const uint32_t* pMaterialIDs, Material** pDst) -> void pure virtual
Gets all the materials assigned to the IDs specified.
auto func30h(uint32_t, int) -> Material* pure virtual
auto GetIDFromMaterial(const Material* pMaterial) const -> uint32_t pure virtual
Returns the ID of the given material.
auto GetIDsFromMaterials(size_t count, const Material*const* pMaterials, uint32_t* pDst) const -> void pure virtual
Puts the ID of all the materials specified into the given array.
auto GetTexturesFromMaterial(const Material* pMaterial, eastl::vector<TexturePtr>& dst, TextureFilterCallback_t = nullptr) const -> void pure virtual
Gets the textures used by a certain material.
auto GetIDFromCompiledState(RenderWare::CompiledState*, RenderWare::RenderWareFile*) -> uint32_t pure virtual
auto WriteExternalReferences(int count, int* indices, IO::IStream* stream, eastl::vector<ResourceKey>* dstKeys) -> int pure virtual
auto ReadExternalReferences(IO::IStream* stream, int count, uint32_t* materialIDs, void** dstAutoListRC, const ResourceKey*) -> int pure virtual
auto GetExternalReferenceKeys(int count, int* indices, eastl::vector<ResourceKey>*& dstKeys, const ResourceKey*) -> int pure virtual
auto func50h(int) -> void pure virtual
auto UnregisterArenaContents(int) -> void pure virtual
auto func58h(int, int, int, int, int) -> void pure virtual
auto WriteMaterials(Resource::Database* database) -> bool pure virtual
auto WriteFragments(Resource::Database* database) -> bool pure virtual
auto WriteShaders(Resource::Database* database) -> bool pure virtual
auto ReleaseShaders() -> void pure virtual
auto RecreateShaders() -> void pure virtual
auto GetScriptParser() -> void* pure virtual
auto DumpNextFrame(int) -> void pure virtual
auto ReadMaterials(Resource::Database* database) -> bool pure virtual
auto ReadFragments(Resource::Database* database) -> bool pure virtual
auto ReadShaders(Resource::Database* database) -> bool pure virtual

Function documentation

bool Graphics::IMaterialManager::HasMaterial(uint32_t materialID) pure virtual

Tells whether a material with this materialID is valid (that is, it has at least one compiled state).

Parameters
materialID The ID the material is assigned to.

If the materialID wasn't assigned to any material, it will return false.

Material* Graphics::IMaterialManager::GetMaterialInstance(uint32_t materialID) pure virtual

Gets the material assigned to the given ID.

Parameters
materialID The ID the material is assigned to.

If no material exists with that ID, a new one will be created; therefore, this method always returns an object.

void Graphics::IMaterialManager::GetMaterialInstances(size_t count, const uint32_t* pMaterialIDs, Material** pDst) pure virtual

Gets all the materials assigned to the IDs specified.

Parameters
count in The number of elements in the IDs array.
pMaterialIDs in The IDs of the materials to get.
pDst out A Material* array of nCount elements where the Material pointers will be written.

If a certain ID does not have any material assigned, a new one will be created; therefore, this method always puts an object into the output array.

uint32_t Graphics::IMaterialManager::GetIDFromMaterial(const Material* pMaterial) const pure virtual

Returns the ID of the given material.

Parameters
pMaterial

void Graphics::IMaterialManager::GetIDsFromMaterials(size_t count, const Material*const* pMaterials, uint32_t* pDst) const pure virtual

Puts the ID of all the materials specified into the given array.

Parameters
count in The number of elements in the materials array.
pMaterials in The materials whose ID will be got.
pDst out A uint32_t array of nCount elements where the IDs will be written.

void Graphics::IMaterialManager::GetTexturesFromMaterial(const Material* pMaterial, eastl::vector<TexturePtr>& dst, TextureFilterCallback_t = nullptr) const pure virtual

Gets the textures used by a certain material.

Parameters
pMaterial in The Material whose textures will be returned.
dst out A vector where the textures will be output.

Optionally, a filter function can be specified to get only certain textures.