This interface represents a material instance.
More...
|
enum | Compilation_options {
DEFAULT_OPTIONS = 0,
CLASS_COMPILATION = 1
} |
| Various options for the creation of compiled materials. More...
|
|
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
neuraylib::IScene_element > | Self |
| Own type. More...
|
|
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > | IID |
| Declares the interface ID (IID) of this interface. More...
|
|
|
static bool | compare_iid (const Uuid &iid) |
| Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
|
|
This interface represents a material instance.
A material instance is a concrete instance of a formal material definition, with a fixed set of arguments (possibly the defaults of the material definition). Material instances can be created from material definitions using mi::neuraylib::IMaterial_definition::create_material_instance().
- See Also
- mi::neuraylib::IMaterial_definition, mi::neuraylib::Argument_editor
Various options for the creation of compiled materials.
- See Also
- create_compiled_material()
Enumerator |
---|
DEFAULT_OPTIONS |
Default compilation options (e.g., instance compilation).
|
CLASS_COMPILATION |
Selects class compilation instead of instance compilation.
|
Creates a compiled material.
- Parameters
-
| flags | A bitmask of flags of type Compilation_options. |
[in,out] | context | An optional pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. The following options are supported for this operation:
- Float32 "mdl_meters_per_scene_unit": The conversion ratio between meters and scene units for this material. Default: 1.0f.
- Float32 "mdl_wavelength_min": The smallest supported wavelength. Default: 380.0f.
- Float32 "mdl_wavelength_max": The largest supported wavelength. Default: 780.0f. During material compilation, messages like errors and warnings will be passed to the context for later evaluation by the caller.
|
- Returns
- The corresponding compiled material, or
NULL
in case of failure.
Creates a compiled material.
- Parameters
-
| flags | A bitmask of flags of type Compilation_options. |
| mdl_meters_per_scene_unit | The conversion ratio between meters and scene units for this material. |
| mdl_wavelength_min | The smallest supported wavelength. Typical value: 380. |
| mdl_wavelength_max | The largest supported wavelength. Typical value: 780. |
[out] | errors | An optional pointer to an mi::Sint32 to which an error code will be written. The error codes have the following meaning:
- 0: Success.
- -1: Type mismatch, call of an unsuitable DB element, or call cycle in the graph of this material instance.
- -2: The thin-walled material instance has different transmission for surface and backface.
- -3: An argument type of the graph of this material instance is varying but the corresponding parameter type is uniform.
|
- Returns
- The corresponding compiled material, or
NULL
in case of failure.
virtual const IExpression_list* mi::neuraylib::IMaterial_instance::get_arguments |
( |
) | |
const |
|
pure virtual |
virtual const char* mi::neuraylib::IMaterial_instance::get_material_definition |
( |
) | |
const |
|
pure virtual |
virtual const char* mi::neuraylib::IMaterial_instance::get_mdl_material_definition |
( |
) | |
const |
|
pure virtual |
Returns the MDL name of the corresponding material definition.
- Note
- The MDL name of the material definition is different from the name of the DB element (see get_material_definition()).
virtual Size mi::neuraylib::IMaterial_instance::get_parameter_count |
( |
) | |
const |
|
pure virtual |
Returns the number of parameters.
virtual Size mi::neuraylib::IMaterial_instance::get_parameter_index |
( |
const char * |
name) | |
const |
|
pure virtual |
Returns the index position of a parameter.
- Parameters
-
name | The name of the parameter. |
- Returns
- The index of the parameter, or -1 if
name
is invalid.
virtual const char* mi::neuraylib::IMaterial_instance::get_parameter_name |
( |
Size |
index) | |
const |
|
pure virtual |
Returns the name of the parameter at index
.
- Parameters
-
index | The index of the parameter. |
- Returns
- The name of the parameter, or
NULL
if index
is out of range.
virtual const IType_list* mi::neuraylib::IMaterial_instance::get_parameter_types |
( |
) | |
const |
|
pure virtual |
Returns the types of all parameters.
virtual Sint32 mi::neuraylib::IMaterial_instance::set_argument |
( |
Size |
index, |
|
|
const IExpression * |
argument |
|
) |
| |
|
pure virtual |
Sets the argument at index
.
- Parameters
-
index | The index of the argument. |
argument | The argument. Note that the expression is copied. This copy operation is a shallow copy, e.g., DB elements referenced in call expressions are not copied. |
- Returns
- 0: Success.
- -1: Invalid parameters (
NULL
pointer).
- -2: Parameter
index
does not exist.
- -3: The argument type does not match the parameter type.
- -4: The material instance is immutable (because it appears in a default of a material definition).
- -5: The parameter type is uniform, but the argument type is varying.
- -6: The argument expression is not a constant nor a call.
- -7: The argument contains references to DB elements in a scope that is more private scope than the scope of this material instance.
- -8: The parameter types is uniform, but the argument is a call expression and the return type of the called function definition is effectively varying since the function definition itself is varying.
virtual Sint32 mi::neuraylib::IMaterial_instance::set_argument |
( |
const char * |
name, |
|
|
const IExpression * |
argument |
|
) |
| |
|
pure virtual |
Sets an argument identified by name.
- Parameters
-
name | The name of the parameter. |
argument | The argument. Note that the expression is copied. This copy operation is a shallow copy, e.g., DB elements referenced in call expressions are not copied. |
- Returns
- 0: Success.
- -1: Invalid parameters (
NULL
pointer).
- -2: Parameter
name
does not exist.
- -3: The argument type does not match the parameter type.
- -4: The material instance is immutable (because it appears in a default of a material definition).
- -5: The parameter type is uniform, but the argument type is varying.
- -6: The argument expression is not a constant nor a call.
- -7: The argument contains references to DB elements in a scope that is more private scope than the scope of this material instance.
- -8: The parameter types is uniform, but the argument is a call expression and the return type of the called function definition is effectively varying since the function definition itself is varying.
Sets multiple arguments.
- Parameters
-
arguments | The arguments. Note that the expressions are copied. This copy operation is a shallow copy, e.g., DB elements referenced in call expressions are not copied. |
- Returns
- 0: Success.
- -1: Invalid parameters (
NULL
pointer).
- -2: One of the parameters in
arguments
does not exist.
- -3: One of the argument types does not match the corresponding parameter type.
- -4: The material instance is immutable (because it appears in a default of a material definition).
- -5: One of the parameter types is uniform, but the corresponding argument type is varying.
- -6: One of the arguments is not a constant nor a call.
- -7: One of the arguments contains references to DB elements in a scope that is more private scope than the scope of this material instance.
- -8: One of the parameter types is uniform, but the corresponding argument is a call expression and the return type of the called function definition is effectively varying since the function definition itself is varying.