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 types

enum (anonymous) { kCompiledStatesLinkGroupID = 0x40212000, kCompiledStatesGroupID = 0x40212001, kShaderFragmentsGroupID = 0x40212002, kShadersGroupID = 0x40212004, kSporeMaterialTypeID = 0x0469A3F7 }

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

void AddRef() pure virtual
void Release() pure virtual
auto func0Ch() -> bool pure virtual
auto func10h() -> bool pure virtual
auto func14h() -> bool pure virtual
void func18h(int) pure virtual
auto func1Ch() -> bool pure virtual
void func20h(int, int) pure virtual
auto IsValidMaterial(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 GetMaterial(uint32_t materialID) -> Material* pure virtual
Gets the material assigned to the given ID.
void GetMaterials(size_t count, const uint32_t* pMaterialIDs, Material** pDst) pure virtual
Gets all the materials assigned to the IDs specified.
auto func30h(uint32_t, int) -> Material* pure virtual
auto GetMaterialID(const Material* pMaterial) const -> uint32_t pure virtual
Returns the ID of the given material.
void GetMaterialsID(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.
void GetTextures(const Material* pMaterial, TextureVector_t& dst, bool(*)(Texture*) filterFunction = nullptr) const pure virtual
Gets the textures used by a certain material.
auto AssignRWMaterial(RenderWare::CompiledState*, RenderWare::RenderWareFile*) -> uint32_t pure virtual
auto func44h(int, int, int, int) -> int pure virtual
auto func48h(int, int, int, int, int) -> int pure virtual
auto func4Ch(int, int, int, int) -> int pure virtual
void func50h(int) pure virtual
void func54h(int) pure virtual
void func58h(int, int, int, int, int) pure virtual
auto WriteMaterials(DatabasePackedFile* pDBPF) -> bool pure virtual
auto WriteShaderFragments(DatabasePackedFile* pDBPF) -> bool pure virtual
auto WriteShaders(DatabasePackedFile* pDBPF) -> bool pure virtual
void func68h() pure virtual
void func6Ch() pure virtual
auto func70h() -> int pure virtual
void func74h(int) pure virtual
auto ReadMaterials(DatabasePackedFile* pDBPF) -> bool pure virtual
auto ReadShaderFragments(DatabasePackedFile* pDBPF) -> bool pure virtual
auto ReadShaders(DatabasePackedFile* pDBPF) -> bool pure virtual

Function documentation

bool Graphics::IMaterialManager::IsValidMaterial(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::GetMaterial(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::GetMaterials(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::GetMaterialID(const Material* pMaterial) const pure virtual

Returns the ID of the given material.

Parameters
pMaterial

void Graphics::IMaterialManager::GetMaterialsID(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::GetTextures(const Material* pMaterial, TextureVector_t& dst, bool(*)(Texture*) filterFunction = 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 TextureVector_t where the textures will be output.
filterFunction in [Optional] A filter function that takes a Texture* as a parameter and returns a bool, whether the texture must be added or not.

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