NVIDIA Iray SDK API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::IMaterial_instance Class Referenceabstract

This interface represents a material instance. More...

Inheritance diagram for mi::neuraylib::IMaterial_instance:
mi::base::Interface_declare< 0x037ec156, 0x281d, 0x466a, 0xa1, 0x56, 0x3e, 0xd6, 0x83, 0xe9, 0x5a, 0x00, neuraylib::IScene_element > mi::neuraylib::IScene_element mi::base::Interface_declare< 0x8a2a4da9, 0xe323, 0x452c, 0xb8, 0xda, 0x92, 0x45, 0x67, 0x85, 0xd7, 0x78, neuraylib::IAttribute_set > mi::neuraylib::IAttribute_set mi::base::Interface_declare< 0x1bcb8d48, 0x10c1, 0x4b3e, 0x9b, 0xfa, 0x06, 0x23, 0x61, 0x81, 0xd3, 0xe1 > mi::base::IInterface

Public Types

enum  Compilation_options {
  DEFAULT_OPTIONS = 0,
  CLASS_COMPILATION = 1
}
 Various options for the creation of compiled materials. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x037ec156, 0x281d, 0x466a, 0xa1, 0x56, 0x3e, 0xd6, 0x83, 0xe9, 0x5a, 0x00, neuraylib::IScene_element >
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...
 

Public Member Functions

virtual const char * get_material_definition () const =0
 Returns the DB name of the corresponding material definition. More...
 
virtual const char * get_mdl_material_definition () const =0
 Returns the MDL name of the corresponding material definition. More...
 
virtual Size get_parameter_count () const =0
 Returns the number of parameters. More...
 
virtual const char * get_parameter_name (Size index) const =0
 Returns the name of the parameter at index. More...
 
virtual Size get_parameter_index (const char *name) const =0
 Returns the index position of a parameter. More...
 
virtual const IType_listget_parameter_types () const =0
 Returns the types of all parameters. More...
 
virtual const IExpression_listget_arguments () const =0
 Returns all arguments. More...
 
virtual Sint32 set_arguments (const IExpression_list *arguments)=0
 Sets multiple arguments. More...
 
virtual Sint32 set_argument (Size index, const IExpression *argument)=0
 Sets the argument at index. More...
 
virtual Sint32 set_argument (const char *name, const IExpression *argument)=0
 Sets an argument identified by name. More...
 
virtual ICompiled_materialcreate_compiled_material (Uint32 flags, Float32 mdl_meters_per_scene_unit, Float32 mdl_wavelength_min, Float32 mdl_wavelength_max, Sint32 *errors=0) const =0
 Creates a compiled material. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from mi::base::Interface_declare< 0x037ec156, 0x281d, 0x466a, 0xa1, 0x56, 0x3e, 0xd6, 0x83, 0xe9, 0x5a, 0x00, neuraylib::IScene_element >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

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

Member Enumeration Documentation

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.

Member Function Documentation

virtual ICompiled_material* mi::neuraylib::IMaterial_instance::create_compiled_material ( Uint32  flags,
Float32  mdl_meters_per_scene_unit,
Float32  mdl_wavelength_min,
Float32  mdl_wavelength_max,
Sint32 errors = 0 
) const
pure virtual

Creates a compiled material.

Parameters
flagsA bitmask of flags of type Compilation_options.
mdl_meters_per_scene_unitThe conversion ratio between meters and scene units for this material.
mdl_wavelength_minThe smallest supported wavelength. Typical value: 380.
mdl_wavelength_maxThe largest supported wavelength. Typical value: 780.
[out]errorsAn 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

Returns all arguments.

virtual const char* mi::neuraylib::IMaterial_instance::get_material_definition ( ) const
pure virtual

Returns the DB name of the corresponding material definition.

The type of the material definition is mi::neuraylib::IMaterial_definition.

Note
The DB name of the material definition is different from its MDL name (see get_mdl_material_definition()).
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
nameThe 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
indexThe 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
indexThe index of the argument.
argumentThe 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
nameThe name of the parameter.
argumentThe 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.
virtual Sint32 mi::neuraylib::IMaterial_instance::set_arguments ( const IExpression_list arguments)
pure virtual

Sets multiple arguments.

Parameters
argumentsThe 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.