MDL SDK API nvidia_logo_transpbg.gif Up
MDL type system

The MDL type system mainly consists of four sets of interfaces: More...

Classes

class  mi::neuraylib::IExpression
 The interface to MDL expressions. More...
 
class  mi::neuraylib::IExpression_constant
 A constant expression. More...
 
class  mi::neuraylib::IExpression_call
 An indirect call expression. More...
 
class  mi::neuraylib::IExpression_parameter
 A parameter reference expression. More...
 
class  mi::neuraylib::IExpression_direct_call
 A direct call expression. More...
 
class  mi::neuraylib::IExpression_temporary
 A temporary reference expression. More...
 
class  mi::neuraylib::IExpression_list
 An ordered collection of expressions identified by name or index. More...
 
class  mi::neuraylib::IAnnotation_definition
 An annotation definition. More...
 
class  mi::neuraylib::IAnnotation
 An annotation is similar to a direct call expression, but without return type. More...
 
class  mi::neuraylib::IAnnotation_block
 An annotation block is an array of annotations. More...
 
class  mi::neuraylib::IAnnotation_list
 An ordered collection of annotation blocks identified by name or index. More...
 
class  mi::neuraylib::IExpression_factory
 The interface for creating expressions. More...
 
class  mi::neuraylib::IStruct_category
 Represents the optional struct category for struct types. More...
 
class  mi::neuraylib::IStruct_category_list
 An ordered collection of struct categories identified by name or index. More...
 
class  mi::neuraylib::IType
 The interface to MDL types. More...
 
class  mi::neuraylib::IType_alias
 The type of kind alias. More...
 
class  mi::neuraylib::IType_atomic
 An atomic type. More...
 
class  mi::neuraylib::IType_bool
 The type of kind bool. More...
 
class  mi::neuraylib::IType_int
 The type of kind int. More...
 
class  mi::neuraylib::IType_enum
 A type of kind enum. More...
 
class  mi::neuraylib::IType_float
 The type of kind float. More...
 
class  mi::neuraylib::IType_double
 The type of kind double. More...
 
class  mi::neuraylib::IType_string
 The type of kind string. More...
 
class  mi::neuraylib::IType_compound
 A compound type. More...
 
class  mi::neuraylib::IType_vector
 The type of kind vector. More...
 
class  mi::neuraylib::IType_matrix
 The type of kind matrix. More...
 
class  mi::neuraylib::IType_color
 The type of kind color. More...
 
class  mi::neuraylib::IType_array
 The type of kind array. More...
 
class  mi::neuraylib::IType_struct
 The type of kind struct. More...
 
class  mi::neuraylib::IType_reference
 The reference types. More...
 
class  mi::neuraylib::IType_resource
 A string valued resource type. More...
 
class  mi::neuraylib::IType_texture
 The type of kind texture. More...
 
class  mi::neuraylib::IType_light_profile
 The type of kind light_profile. More...
 
class  mi::neuraylib::IType_bsdf_measurement
 The type of kind bsdf_measurement. More...
 
class  mi::neuraylib::IType_df
 The type of distribution functions. More...
 
class  mi::neuraylib::IType_bsdf
 The type of kind bsdf. More...
 
class  mi::neuraylib::IType_hair_bsdf
 The type of kind bsdf. More...
 
class  mi::neuraylib::IType_edf
 The type of kind edf. More...
 
class  mi::neuraylib::IType_vdf
 The type of kind vdf. More...
 
class  mi::neuraylib::IType_list
 An ordered collection of types identified by name or index. More...
 
class  mi::neuraylib::IType_factory
 The interface for creating types. More...
 
class  mi::neuraylib::IValue
 The interface to MDL values. More...
 
class  mi::neuraylib::IValue_atomic
 An atomic value. More...
 
class  mi::neuraylib::IValue_bool
 A value of type boolean. More...
 
class  mi::neuraylib::IValue_int
 A value of type integer. More...
 
class  mi::neuraylib::IValue_enum
 A value of type enum. More...
 
class  mi::neuraylib::IValue_float
 A value of type float. More...
 
class  mi::neuraylib::IValue_double
 A value of type double. More...
 
class  mi::neuraylib::IValue_string
 A value of type string. More...
 
class  mi::neuraylib::IValue_string_localized
 A value of type string which can be used to obtain the original, non-localized value of a localized string. More...
 
class  mi::neuraylib::IValue_compound
 A compound value. More...
 
class  mi::neuraylib::IValue_vector
 A value of type vector. More...
 
class  mi::neuraylib::IValue_matrix
 A value of type matrix. More...
 
class  mi::neuraylib::IValue_color
 A value of type color. More...
 
class  mi::neuraylib::IValue_array
 A value of type array. More...
 
class  mi::neuraylib::IValue_struct
 A value of type struct. More...
 
class  mi::neuraylib::IValue_resource
 Base class for resource values. More...
 
class  mi::neuraylib::IValue_texture
 A texture value. More...
 
class  mi::neuraylib::IValue_light_profile
 A light profile value. More...
 
class  mi::neuraylib::IValue_bsdf_measurement
 A BSDF measurement value. More...
 
class  mi::neuraylib::IValue_invalid_df
 An invalid distribution function value. More...
 
class  mi::neuraylib::IValue_list
 An ordered collection of values identified by name or index. More...
 
class  mi::neuraylib::IValue_factory
 The interface for creating values. More...
 

Enumerations

enum  mi::neuraylib::Mdl_version {
  mi::neuraylib::MDL_VERSION_1_0 ,
  mi::neuraylib::MDL_VERSION_1_1 ,
  mi::neuraylib::MDL_VERSION_1_2 ,
  mi::neuraylib::MDL_VERSION_1_3 ,
  mi::neuraylib::MDL_VERSION_1_4 ,
  mi::neuraylib::MDL_VERSION_1_5 ,
  mi::neuraylib::MDL_VERSION_1_6 ,
  mi::neuraylib::MDL_VERSION_1_7 ,
  mi::neuraylib::MDL_VERSION_1_8 ,
  mi::neuraylib::MDL_VERSION_1_9 ,
  mi::neuraylib::MDL_VERSION_EXP ,
  mi::neuraylib::MDL_VERSION_LATEST = MDL_VERSION_1_9 ,
  mi::neuraylib::MDL_VERSION_INVALID = 0xffffffffU ,
  MDL_VERSION_FORCE_32_BIT = 0xffffffffU
}
 The MDL version. More...
 

Functions

template<class T>
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const T &v)
 Simplifies setting the value of mi::neuraylib::IValue from the corresponding classes from the base and math API. More...
 
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const bool &v)
 This specialization handles mi::neuraylib::IValue_bool. More...
 
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const mi::Float32 &v)
 This specialization handles mi::neuraylib::IValue_float and mi::neuraylib::IValue_double. More...
 
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const mi::Float64 &v)
 This specialization handles mi::neuraylib::IValue_float and mi::neuraylib::IValue_double. More...
 
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const char *v)
 This specialization handles mi::neuraylib::IValue_enum, mi::neuraylib::IValue_string and mi::neuraylib::IValue_resource. More...
 
template<class T , Size DIM>
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const mi::math::Vector<T, DIM> &v)
 This specialization handles mi::neuraylib::IValue_vector. More...
 
template<class T , Size ROW, Size COL>
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const mi::math::Matrix<T, ROW, COL> &v)
 This specialization handles mi::neuraylib::IValue_matrix. More...
 
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const mi::math::Color &v)
 This specialization handles mi::neuraylib::IValue_color. More...
 
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const mi::math::Spectrum &v)
 This specialization handles mi::neuraylib::IValue_color. More...
 
template<class T>
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, mi::Size index, const T &v)
 This variant handles elements of compounds identified via an additional index. More...
 
template<class T>
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const char *name, const T &v)
 This variant handles fields of structs identified via an additional field name. More...
 
template<class T>
mi::Sint32 mi::neuraylib::set_value (mi::neuraylib::IValue *value, const T *v, mi::Size n)
 This variant handles entire arrays. More...
 
template<class T>
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, T &v)
 Simplifies reading the value of mi::neuraylib::IValue into the corresponding classes from the base and math API. More...
 
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, bool &v)
 This specialization handles mi::neuraylib::IValue_bool. More...
 
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, mi::Float32 &v)
 This specialization handles mi::neuraylib::IValue_float and mi::neuraylib::IValue_double. More...
 
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, mi::Float64 &v)
 This specialization handles mi::neuraylib::IValue_float and mi::neuraylib::IValue_double. More...
 
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, const char *&v)
 This specialization handles mi::neuraylib::IValue_enum, mi::neuraylib::IValue_string and mi::neuraylib::IValue_resource. More...
 
template<class T , Size DIM>
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, mi::math::Vector<T, DIM> &v)
 This specialization handles mi::neuraylib::IValue_vector. More...
 
template<class T , Size ROW, Size COL>
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, mi::math::Matrix<T, ROW, COL> &v)
 This specialization handles mi::neuraylib::IValue_matrix. More...
 
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, mi::math::Color &v)
 This specialization handles mi::neuraylib::IValue_color. More...
 
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, mi::math::Spectrum &v)
 This specialization handles mi::neuraylib::IValue_color. More...
 
template<class T>
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, mi::Size index, T &v)
 This variant handles elements of compounds identified via an additional index. More...
 
template<class T>
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, const char *name, T &v)
 This variant handles fields of structs identified via an additional field name. More...
 
template<class T>
mi::Sint32 mi::neuraylib::get_value (const mi::neuraylib::IValue *value, T *v, mi::Size n)
 This variant handles entire arrays. More...
 

Detailed Description

The MDL type system mainly consists of four sets of interfaces:

The three factories mentioned above can be obtained from mi::neuraylib::IMdl_factory.

In addition, the free functions mi::neuraylib::get_value() and mi::neuraylib::set_value() are useful to read and write instances of mi::neuraylib::IValue.

See MDL-related elements and Miscellaneous MDL-related Interfaces for interfaces that make use of this type system.

Enumeration Type Documentation

 Mdl_version

The MDL version.

Enumerator
MDL_VERSION_1_0 

MDL version 1.0.

MDL_VERSION_1_1 

MDL version 1.1.

MDL_VERSION_1_2 

MDL version 1.2.

MDL_VERSION_1_3 

MDL version 1.3.

MDL_VERSION_1_4 

MDL version 1.4.

MDL_VERSION_1_5 

MDL version 1.5.

MDL_VERSION_1_6 

MDL version 1.6.

MDL_VERSION_1_7 

MDL version 1.7.

MDL_VERSION_1_8 

MDL version 1.8.

MDL_VERSION_1_9 

MDL version 1.9.

MDL_VERSION_EXP 

MDL experimental features.

MDL_VERSION_LATEST 

Latest MDL version.

MDL_VERSION_INVALID 

Invalid MDL version.

Function Documentation

 get_value() [1/12]

mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
bool &  v 
)
inline

This specialization handles mi::neuraylib::IValue_bool.

It expects a bool as second argument. See mi::neuraylib::get_value() for details.

 get_value() [2/12]

mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
const char *&  v 
)
inline

This specialization handles mi::neuraylib::IValue_enum, mi::neuraylib::IValue_string and mi::neuraylib::IValue_resource.

It expects a const char* as second argument. See mi::neuraylib::get_value() for details.

 get_value() [3/12]

template<class T>
mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
const char *  name,
T &  v 
)

This variant handles fields of structs identified via an additional field name.

See also mi::neuraylib::get_value() for more details about overloads.

Parameters
valueThe instance of mi::neuraylib::IValue to read.
nameThe name of the affected struct field.
vThe new value will be stored here.
Returns
  • 0: Success.
  • -1: The dynamic type of value does not match the static type of v.
  • -3: The field name is not valid.

 get_value() [4/12]

mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
mi::Float32 v 
)
inline

This specialization handles mi::neuraylib::IValue_float and mi::neuraylib::IValue_double.

It expects an mi::Float32 as second argument. See mi::neuraylib::get_value() for details.

 get_value() [5/12]

mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
mi::Float64 v 
)
inline

This specialization handles mi::neuraylib::IValue_float and mi::neuraylib::IValue_double.

It expects an mi::Float64 as second argument. See mi::neuraylib::get_value() for details.

 get_value() [6/12]

mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
mi::math::Color v 
)
inline

This specialization handles mi::neuraylib::IValue_color.

It expects an mi::math::Color as second argument. See mi::neuraylib::get_value() for details.

 get_value() [7/12]

template<class T , Size ROW, Size COL>
mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
mi::math::Matrix<T, ROW, COL> &  v 
)

This specialization handles mi::neuraylib::IValue_matrix.

It expects an mi::math::Matrix of matching dimensions and element type as second argument. See mi::neuraylib::get_value() for details.

Note
The conversion between mi::neuraylib::IValue_matrix and mi::math::Matrix is supposed to preserve the memory layout. Since mi::neuraylib::IValue_matrix uses a column-major layout and mi::math::Matrix uses a row-major layout, the conversion process effectively transposes the matrix.

 get_value() [8/12]

mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
mi::math::Spectrum v 
)
inline

This specialization handles mi::neuraylib::IValue_color.

It expects an mi::math::Spectrum as second argument. See mi::neuraylib::get_value() for details.

 get_value() [9/12]

template<class T , Size DIM>
mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
mi::math::Vector<T, DIM> &  v 
)

This specialization handles mi::neuraylib::IValue_vector.

It expects an mi::math::Vector of matching dimension and element type as second argument. See mi::neuraylib::get_value() for details.

 get_value() [10/12]

template<class T>
mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
mi::Size  index,
T &  v 
)

This variant handles elements of compounds identified via an additional index.

See also mi::neuraylib::get_value() for more details about overloads.

Parameters
valueThe instance of mi::neuraylib::IValue to read.
indexThe index of the affected compound element.
vThe new value will be stored here.
Returns
  • 0: Success.
  • -1: The dynamic type of value does not match the static type of v.
  • -3: The index is not valid.

 get_value() [11/12]

template<class T>
mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
T &  v 
)

Simplifies reading the value of mi::neuraylib::IValue into the corresponding classes from the base and math API.

The various overloads of this method support all atomic MDL types with the corresponding C-type as type of v (and int for mi::neuraylib::IValue_enum). Vectors and matrices are supported if v is of type mi::math::Vector and mi::math::Matrix, respectively. For arrays, see get_value(const mi::neuraylib::IValue*,T*,Size). For components of compounds, see get_value(const mi::neuraylib::IValue*,Size,T&) and get_value(const mi::neuraylib::IValue*,const char*,T&).

It is not possible to read entire structs with a single call (in general there is no corresponding C++ class, and absence of introspection machinery). Struct fields need to be read one by one.

There is no support for inner-most components of multi-dimensional compounds (arrays of compounds or structs of compounds) -- this would require additional overloads accepting two or more component indices and/or field names.

Parameters
valueThe instance of mi::neuraylib::IValue to read.
[out]vThe new value will be stored here.
Returns
  • 0: Success.
  • -1: The dynamic type of value does not match the static type of v.

This general template handles mi::neuraylib::IValue_int and mi::neuraylib::IValue_enum and expects mi::Uint32 as second argument. Since it is a template it will handle other types as second argument if they are accepted in place of parameters of type mi::Uint32, e.g., mi::Sint32.

 get_value() [12/12]

template<class T>
mi::Sint32 mi::neuraylib::get_value ( const mi::neuraylib::IValue value,
T *  v,
mi::Size  n 
)

This variant handles entire arrays.

See also mi::neuraylib::get_value() for more details about overloads.

Parameters
valueThe instance of mi::neuraylib::IValue to read.
vThe new values will be stored here (as pointer to a C-like array).
nThe size of the C-like array (needs to match the size of value).
Returns
  • 0: Success.
  • -1: The dynamic type of value is not an array, or the dynamic type of the array elements does not match the static type of v.
  • -5: The array sizes do not match.

 set_value() [1/12]

mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const bool &  v 
)
inline

This specialization handles mi::neuraylib::IValue_bool.

It expects a bool as second argument. See mi::neuraylib::set_value() for details.

 set_value() [2/12]

template<class T>
mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const char *  name,
const T &  v 
)

This variant handles fields of structs identified via an additional field name.

See also mi::neuraylib::set_value() for more details about overloads.

Parameters
valueThe instance of mi::neuraylib::IValue to modify.
nameThe name of the affected struct field.
vThe new value to be set.
Returns
  • 0: Success.
  • -1: The dynamic type of value does not match the static type of v.
  • -2: The value of v is not valid.
  • -3: The field name is not valid.

 set_value() [3/12]

mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const char *  v 
)
inline

This specialization handles mi::neuraylib::IValue_enum, mi::neuraylib::IValue_string and mi::neuraylib::IValue_resource.

It expects a const char* as second argument. See mi::neuraylib::set_value() for details.

 set_value() [4/12]

mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const mi::Float32 v 
)
inline

This specialization handles mi::neuraylib::IValue_float and mi::neuraylib::IValue_double.

It expects an mi::Float32 as second argument. See mi::neuraylib::set_value() for details.

 set_value() [5/12]

mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const mi::Float64 v 
)
inline

This specialization handles mi::neuraylib::IValue_float and mi::neuraylib::IValue_double.

It expects an mi::Float64 as second argument. See mi::neuraylib::set_value() for details.

 set_value() [6/12]

mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const mi::math::Color v 
)
inline

This specialization handles mi::neuraylib::IValue_color.

It expects an mi::math::Color as second argument. See mi::neuraylib::set_value() for details.

 set_value() [7/12]

template<class T , Size ROW, Size COL>
mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const mi::math::Matrix<T, ROW, COL> &  v 
)

This specialization handles mi::neuraylib::IValue_matrix.

It expects an mi::math::Matrix of matching dimensions and element type as second argument. See mi::neuraylib::set_value() for details.

Note
The conversion between mi::neuraylib::IValue_matrix and mi::math::Matrix is supposed to preserve the memory layout. Since mi::neuraylib::IValue_matrix uses a column-major layout and mi::math::Matrix uses a row-major layout, the conversion process effectively transposes the matrix.

 set_value() [8/12]

mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const mi::math::Spectrum v 
)
inline

This specialization handles mi::neuraylib::IValue_color.

It expects an mi::math::Spectrum as second argument. See mi::neuraylib::set_value() for details.

 set_value() [9/12]

template<class T , Size DIM>
mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const mi::math::Vector<T, DIM> &  v 
)

This specialization handles mi::neuraylib::IValue_vector.

It expects an mi::math::Vector of matching dimension and element type as second argument. See mi::neuraylib::set_value() for details.

 set_value() [10/12]

template<class T>
mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const T &  v 
)

Simplifies setting the value of mi::neuraylib::IValue from the corresponding classes from the base and math API.

The various overloads of this method support all atomic MDL types with the corresponding C-type as type of v (and int for mi::neuraylib::IValue_enum). Vectors and matrices are supported if v is of type mi::math::Vector and mi::math::Matrix, respectively. For arrays, see set_value(mi::neuraylib::IValue*,const T*,Size). For components of compounds, see set_value(mi::neuraylib::IValue*,Size,const T&) and set_value(mi::neuraylib::IValue*,const char*,const T&).

It is not possible to set entire structs with a single call (in general there is no corresponding C++ class, and absence of introspection machinery). Struct fields need to be set one by one.

There is no support for inner-most components of multi-dimensional compounds (arrays of compounds or structs of compounds) -- this would require additional overloads accepting two or more component indices and/or field names.

Parameters
valueThe instance of mi::neuraylib::IValue to modify.
vThe new value to be set.
Returns
  • 0: Success.
  • -1: The dynamic type of value does not match the static type of v.
  • -2: The value of v is not valid.

This general template handles mi::neuraylib::IValue_int and mi::neuraylib::IValue_enum and expects mi::Uint32 as second argument. Since it is a template it will handle other types as second argument if they are accepted in place of parameters of type mi::Uint32, e.g., mi::Sint32.

 set_value() [11/12]

template<class T>
mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
const T *  v,
mi::Size  n 
)

This variant handles entire arrays.

See also mi::neuraylib::set_value() for more details about overloads.

Parameters
valueThe instance of mi::neuraylib::IValue to modify.
vThe new values to be set (as pointer to a C-like array).
nThe size of the C-like array (needs to match the size of value).
Returns
  • 0: Success.
  • -1: The dynamic type of value is not an array, or the dynamic type of the array elements does not match the static type of v.
  • -2: The value of v is not valid.
  • -5: The array sizes do not match.

 set_value() [12/12]

template<class T>
mi::Sint32 mi::neuraylib::set_value ( mi::neuraylib::IValue value,
mi::Size  index,
const T &  v 
)

This variant handles elements of compounds identified via an additional index.

See also mi::neuraylib::set_value() for more details about overloads.

Parameters
valueThe instance of mi::neuraylib::IValue to modify.
indexThe index of the affected compound element.
vThe new value to be set.
Returns
  • 0: Success.
  • -1: The dynamic type of value does not match the static type of v.
  • -2: The value of v is not valid.
  • -3: The index is not valid.