Unigine::Materials Class
Header: | #include <UnigineMaterials.h> |
Interface for managing loaded materials via the code. All materials existing in the project are loaded on its start-up and saved on world's saving or on calling the materials_save console command.
Materials Class
Members
Materials * get()
Returns a pointer to the materials manager.int isMaterial(const char * name)
Checks if there is a material with a given name.Arguments
- const char * name - Material name.
Return value
1 if the material exists; otherwise, 0.int isMaterial(const UGUID & guid)
Checks if there is a material with a given GUID.Arguments
- const UGUID & guid - A material GUID.
Return value
1 if the material exists; otherwise, 0.Ptr<Material> findMaterial(const char * name)
Searches for a material with a given name.Arguments
- const char * name - Material name.
Return value
Material smart pointer.void reloadMaterials()
Reloads all loaded materials.void destroyTextures()
Deletes all textures used by the loaded materials.int replaceMaterial(const Ptr<Material> & material, const Ptr<Material> & new_material)
Replaces the material with the given one.Arguments
- const Ptr<Material> & material - A material to be replaced.
- const Ptr<Material> & new_material - A replacing material.
Return value
1 if the material is replaced successfully; otherwise, 0.Ptr<Material> findManualMaterial(const char * name)
Searches for a manual material by the given name.Arguments
- const char * name - A manual material name.
Return value
A manual material.Ptr<Material> findBaseMaterial(const char * name)
Searches for a base material by the given name.Arguments
- const char * name - A base material name.
Return value
A base material.void createShaders()
Creates all shaders for the loaded materials.int saveMaterials()
Saves changes made for all loaded materials.Return value
1 if materials are saved successfully; otherwise, 0.Ptr<Material> getMaterial(int num)
Returns the material by its number.Arguments
- int num - Material number.
Return value
A material.Ptr<Material> findMaterialByPath(const char * path)
Searches for a material stored by the specified path.Arguments
- const char * path - A loading path of the material (including a material's name).
Return value
A material.Ptr<Material> loadMaterial(const char * path)
Loads a material stored by the given path. The function can be used to load materials created during application execution or stored outside the data directory.Arguments
- const char * path - A path to the material (including its name).
Return value
A loaded material.void reloadShaders()
Reloads all shaders used by the loaded materials.Ptr<Material> findMaterialByGUID(const UGUID & guid)
Searches for a material with the given GUID.Arguments
- const UGUID & guid - A material GUID.
Return value
A material.int isManualMaterial(const char * name)
Checks if the material with the given name is the manual one.Arguments
- const char * name - A material name.
Return value
1 if the material is the manual one; otherwise, 0.int isBaseMaterial(const char * name)
Checks if the material with the given name is the base one.Arguments
- const char * name - A material name.
Return value
1 if the material is the base one; otherwise, 0.void destroyShaders()
Deletes all shaders used for the loaded materials.int getNumMaterials()
Returns the number of materials loaded for the current project.Return value
The number of materials.const char * getMaterialName(int num)
Returns a name of the material with the given number.Arguments
- int num - A material number.
Return value
A material name.int removeMaterial(const UGUID & guid, int remove_file = 0)
Deletes a material. If the remove_file flag is enabled, the material file will be deleted as well. If the flag is disabled, the deleted material will be loaded again on the next application start-up.Arguments
- const UGUID & guid - A material GUID.
- int remove_file - A flag indicating if the material file will be deleted.
Return value
1 if the material has been deleted successfully; otherwise, 0.Last update: 20.10.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter