This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Materials Class

Unigine materials. This interface provides access to Unigine material manager functions.

To use this class, include the UnigineMaterials.h file.

Materials Class

Members


int removeWorldLibrary (const char * name)

Deletes a given library from the list of material libraries that belong to the world (such libraries are specified in the *.world file and automatically loaded on the world initialization). This function does not unload the library if it has already been loaded.

Arguments

  • const char * name - Name of the library to be dissociated:
    • A full path (relative to the data folder); also used if a library is loaded from *.world file.
    • The same name as passed to engine.materials.addWorldLibrary()). The first found library with this name is used in this case.

Return value

1 if the library is removed successfully; otherwise, 0.

int getNumLibraries ()

Returns the number of loaded material libraries.

Return value

The number of loaded material libraries.

int load (const char * filename, int addToWorldLibrary = 0)

Loads the material library from the file.

Arguments

  • const char * filename - File with the library to load.
  • int addToWorldLibrary - Set 1 to add material to the world library.

Return value

1 if the material library is loaded successfully; otherwise, 0.

Ptr<Material> findMaterial (const char * name)

Finds the material by its name.

Arguments

  • const char * name - Material name.

Return value

Material smart pointer.

int inheritMaterial (const char * name, const char * dest_library, const char * new_name)

Inherits material into the specified material library.

Arguments

  • const char * name - Material name.
  • const char * dest_library - New material library name.
  • const char * new_name - New material name.

Return value

1 if the material is inherited successfully; otherwise, 0.

const char * getWorldLibraryName (int index)

Returns the name of a library belonging to the current world by its index.

Arguments

  • int index - Index of the library.

Return value

Name of the library.

int cloneMaterial (const char * name, const char * dest_library, const char * dest_name)

Clones material into the specified material library.

Arguments

  • const char * name - Material name.
  • const char * dest_library - New material library name.
  • const char * dest_name - New material name.

Return value

1 if the material is cloned successfully; otherwise, 0.

int getNumMaterials (int index)

Returns the number of library materials.

Arguments

  • int index - Library number.

Return value

The number of library materials.

const char * getLibraryName (int index)

Returns the material library name.

Arguments

  • int index - Material library number.

Return value

The name of material library.

int replaceMaterial (const Ptr<Material> & material, const char * new_name)

Replaces material with a new one.

Arguments

  • const Ptr<Material> & material - Name of the material to be replaced.
  • const char * new_name - Name of the new material.

Return value

1 if the material is replaced successfully; otherwise, 0.

int replaceMaterial (const char * name, const char * new_name)

Replaces material with a new one.

Arguments

  • const char * name - Name of the material to be replaced.
  • const char * new_name - Name of the new material.

Return value

1 if the material is replaced successfully; otherwise, 0.

int isMaterial (const char * name)

Checks the material by its name.

Arguments

  • const char * name - Material name.

Return value

1 if the material exists; otherwise, 0.

int findLibraryMaterial (int library, const char * name)

Finds the material in the specified material library.

Arguments

  • int library - Library number.
  • const char * name - Material name.

Return value

Material number.

void reloadMaterials ()

Reloads all material libraries

int getNumWorldLibraries ()

Returns the number of material libraries that belong to the current world (such libraries are specified in the *.world file and automatically loaded on the world initialization).

Return value

Number of libraries belonging to the world.

int isLibrary (const char * name)

Checks the material library by its name.

Arguments

  • const char * name - Material library name.

Return value

1 if the material library exists; otherwise, 0.

int addWorldLibrary (const char * filename)

Loads a library and associates it with the current world (such libraries are specified in the *.world file and automatically loaded on the world initialization). If the library file does not exist, an empty library is created. (For simple loading without association, see engine.materials.load().)

Arguments

  • const char * filename - Name of a material library to be loaded:
    • A full path (relative to the data folder).
    • Name without a file path. The first found library with this name is used in this case.

Return value

1 if the library is loaded or created successfully; otherwise, 0.

int moveMaterial (const char * name, const char * dest_library, const char * dest_name)

Moves material into the specified material library.

Arguments

  • const char * name - Material name.
  • const char * dest_library - New material library name.
  • const char * dest_name - New material name.

Return value

1 if the material is moved successfully; otherwise, 0.

int create (const char * name)

Creates an empty material library.

Arguments

  • const char * name - Material library name.

Return value

1 if the material library is created successfully; otherwise, 0.

int findMaterialLibrary (const char * name)

Finds the material library by material name.

Arguments

  • const char * name - Material name.

Return value

Material library number.

int findLibrary (const char * name)

Finds the material library by its name.

Arguments

  • const char * name - Material library name.

Return value

Material library number.

int removeMaterial (const char * name)

Removes material by its name.

Arguments

  • const char * name - Material name.

Return value

1 if the material is removed successfully; otherwise, 0.

int clear (const char * library)

Clears the material library by its name.

Arguments

  • const char * library - Material library name.

Return value

1 if the material library is cleared successfully; otherwise, 0.

const char * getMaterialName (int library, int num)

Returns the material name.

Arguments

  • int library - Library number.
  • int num - Material number.

Return value

The name of material.

int save (const char * name)

Saves the material library into the file.

Arguments

  • const char * name - Material library name.

Return value

1 if the material library is saved successfully; otherwise, 0.

int reload (const char * name)

Reloads the material library from the file.

Arguments

  • const char * name - Material library name.

Return value

1 if the material library is reloaded successfully; otherwise, 0.

int isLibraryEditable (int index)

Returns the material library editable flag.

Arguments

  • int index - Material library number.

Return value

The editable flag.

Ptr<Material> getMaterial (int library, int num)

Returns the material.

Arguments

  • int library - Library number.
  • int num - Material number.

Return value

Material smart pointer.
Last update: 2017-07-03
Build: ()