Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Engine::Data::EngineMaterialConverters Namespace Reference

Typedefs

using AssetMaterialPtr = const Ra::Core::Asset::MaterialData*
 
using RadiumMaterialPtr = Ra::Engine::Data::Material*
 
using ConverterFunction = std::function<RadiumMaterialPtr( AssetMaterialPtr )>
 

Functions

bool registerMaterialConverter (const std::string &name, ConverterFunction converter)
 
bool removeMaterialConverter (const std::string &name)
 
std::pair< bool, ConverterFunctiongetMaterialConverter (const std::string &name)
 
bool cleanup ()
 

Variables

static std::map< std::string, std::function< RadiumMaterialPtr(AssetMaterialPtr)> > MaterialConverterRegistry
 Map that stores each conversion function.
 

Detailed Description

A material converter is a couple <std::string, std::function<Ra::Engine::Material*(Ra::Core::Asset::MaterialData*)> where the string gives the mname of the material and the function is whatever is compatible with std::function :

  • a lambda
  • a functor
  • a function with bind parameters .... The function is in charge of converting a concrete Ra::Core::Asset::MaterialData* to a concrete Ra::Engine::Material* according to the type of material described by the string ...
    See also
    documentation on materials for instructions on how to extend the material system

Typedef Documentation

◆ AssetMaterialPtr

Type of a pointer to an IO/ASSET representation of the material

Definition at line 45 of file MaterialConverters.hpp.

◆ ConverterFunction

Type of the conversion functor from IO/ASSET representation to Engine representation

Definition at line 54 of file MaterialConverters.hpp.

◆ RadiumMaterialPtr

Type of a pointer to an Engine representation of the material

Definition at line 49 of file MaterialConverters.hpp.

Function Documentation

◆ cleanup()

RA_ENGINE_API bool Ra::Engine::Data::EngineMaterialConverters::cleanup ( )

Definition at line 45 of file MaterialConverters.cpp.

◆ getMaterialConverter()

RA_ENGINE_API std::pair< bool, ConverterFunction > Ra::Engine::Data::EngineMaterialConverters::getMaterialConverter ( const std::string & name)
Parameters
namename of the material to convert
Returns
a pair containing the search result and, if true, the functor to call to convert the material

Definition at line 35 of file MaterialConverters.cpp.

+ Here is the call graph for this function:

◆ registerMaterialConverter()

RA_ENGINE_API bool Ra::Engine::Data::EngineMaterialConverters::registerMaterialConverter ( const std::string & name,
ConverterFunction converter )

register a new material converter

Returns
true if converter added, false else (e.g, a converter with the same name exists)

Definition at line 25 of file MaterialConverters.cpp.

◆ removeMaterialConverter()

RA_ENGINE_API bool Ra::Engine::Data::EngineMaterialConverters::removeMaterialConverter ( const std::string & name)

remove a material converter

Returns
true if converter removed, false else (e.g, a converter with the same name does't exists)

Definition at line 30 of file MaterialConverters.cpp.

Variable Documentation

◆ MaterialConverterRegistry

std::map<std::string, std::function<RadiumMaterialPtr( AssetMaterialPtr )> > Ra::Engine::Data::EngineMaterialConverters::MaterialConverterRegistry
static

Map that stores each conversion function.

Definition at line 23 of file MaterialConverters.cpp.