Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::IMdl_factory Class Referenceabstract

Factory for various MDL interfaces and functions. More...

Inheritance diagram for mi::neuraylib::IMdl_factory:
mi::base::Interface_declare< 0xba936279, 0x4b71, 0x42a4, 0x95, 0x37, 0x98, 0x69, 0x97, 0xb3, 0x47, 0x72 > mi::base::IInterface

Public Member Functions

virtual IType_factorycreate_type_factory (ITransaction *transaction)=0
 Returns an MDL type factory for the given transaction. More...
 
virtual IValue_factorycreate_value_factory (ITransaction *transaction)=0
 Returns an MDL value factory for the given transaction. More...
 
virtual IExpression_factorycreate_expression_factory (ITransaction *transaction)=0
 Returns an MDL expression factory for the given transaction. More...
 
virtual Sint32 create_variants (ITransaction *transaction, const char *module_name, const IArray *variant_data)=0
 Creates a new MDL module containing variants. More...
 
virtual IValue_texturecreate_texture (ITransaction *transaction, const char *file_path, IType_texture::Shape shape, Float32 gamma, bool shared, Sint32 *errors=0)=0
 Creates a value referencing a texture identified by an MDL file path. More...
 
virtual IValue_light_profilecreate_light_profile (ITransaction *transaction, const char *file_path, bool shared, Sint32 *errors=0)=0
 Creates a value referencing a light profile identified by an MDL file path. More...
 
virtual IValue_bsdf_measurementcreate_bsdf_measurement (ITransaction *transaction, const char *file_path, bool shared, Sint32 *errors=0)=0
 Creates a value referencing a BSDF measurement identified by an MDL file path. More...
 
virtual IMdl_execution_contextcreate_execution_context ()=0
 Creates an execution context. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xba936279, 0x4b71, 0x42a4, 0x95, 0x37, 0x98, 0x69, 0x97, 0xb3, 0x47, 0x72 >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
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 Public Member Functions inherited from mi::base::Interface_declare< 0xba936279, 0x4b71, 0x42a4, 0x95, 0x37, 0x98, 0x69, 0x97, 0xb3, 0x47, 0x72 >
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

Factory for various MDL interfaces and functions.

This interface gives access to the type, value, and expressions factories. It also allows to create material and function variants.

Member Function Documentation

virtual IValue_bsdf_measurement* mi::neuraylib::IMdl_factory::create_bsdf_measurement ( ITransaction transaction,
const char *  file_path,
bool  shared,
Sint32 errors = 0 
)
pure virtual

Creates a value referencing a BSDF measurement identified by an MDL file path.

Parameters
transactionThe transaction to be used.
file_pathThe absolute MDL file path that identifies the BSDF measurement. The MDL search paths are used to resolve the file path. See section 2.2 in [MDLLS] for details.
sharedIndicates whether you want to re-use the DB element for that BSDF measurement if it has already been loaded, or if you want to create a new DB element in all cases. Note that sharing is based on the location where the BSDF measurement is finally located and includes sharing with instances that have not explicitly been loaded via this method, e.g., BSDF measurements in defaults.
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: Invalid parameters (NULL pointer).
  • -2: The file path is not an absolute MDL file path.
  • -3: Failed to resolve the given file path.
Returns
The value referencing the BSDF measurement, or NULL in case of failure.
virtual IMdl_execution_context* mi::neuraylib::IMdl_factory::create_execution_context ( )
pure virtual

Creates an execution context.

virtual IExpression_factory* mi::neuraylib::IMdl_factory::create_expression_factory ( ITransaction transaction)
pure virtual

Returns an MDL expression factory for the given transaction.

virtual IValue_light_profile* mi::neuraylib::IMdl_factory::create_light_profile ( ITransaction transaction,
const char *  file_path,
bool  shared,
Sint32 errors = 0 
)
pure virtual

Creates a value referencing a light profile identified by an MDL file path.

Parameters
transactionThe transaction to be used.
file_pathThe absolute MDL file path that identifies the light profile. The MDL search paths are used to resolve the file path. See section 2.2 in [MDLLS] for details.
sharedIndicates whether you want to re-use the DB element for that light profile if it has already been loaded, or if you want to create a new DB element in all cases. Note that sharing is based on the location where the light profile is finally located and includes sharing with instances that have not explicitly been loaded via this method, e.g., light profiles in defaults.
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: Invalid parameters (NULL pointer).
  • -2: The file path is not an absolute MDL file path.
  • -3: Failed to resolve the given file path.
Returns
The value referencing the light profile, or NULL in case of failure.
virtual IValue_texture* mi::neuraylib::IMdl_factory::create_texture ( ITransaction transaction,
const char *  file_path,
IType_texture::Shape  shape,
Float32  gamma,
bool  shared,
Sint32 errors = 0 
)
pure virtual

Creates a value referencing a texture identified by an MDL file path.

Parameters
transactionThe transaction to be used.
file_pathThe absolute MDL file path that identifies the texture. The MDL search paths are used to resolve the file path. See section 2.2 in [MDLLS] for details.
shapeThe value that is returned by mi::neuraylib::IType_texture::get_shape() on the type corresponding to the return value.
gammaThe value that is returned by mi::neuraylib::ITexture::get_gamma() on the DB element referenced by the return value.
sharedIndicates whether you want to re-use the DB elements for that texture if it has already been loaded, or if you want to create new DB elements in all cases. Note that sharing is based on the location where the texture is finally located and includes sharing with instances that have not explicitly been loaded via this method, e.g., textures in defaults.
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: Invalid parameters (NULL pointer).
  • -2: The file path is not an absolute MDL file path.
  • -3: Failed to resolve the given file path, or no suitable image plugin available.
Returns
The value referencing the texture, or NULL in case of failure.
virtual IType_factory* mi::neuraylib::IMdl_factory::create_type_factory ( ITransaction transaction)
pure virtual

Returns an MDL type factory for the given transaction.

virtual IValue_factory* mi::neuraylib::IMdl_factory::create_value_factory ( ITransaction transaction)
pure virtual

Returns an MDL value factory for the given transaction.

virtual Sint32 mi::neuraylib::IMdl_factory::create_variants ( ITransaction transaction,
const char *  module_name,
const IArray variant_data 
)
pure virtual

Creates a new MDL module containing variants.

A variant is basically a clone of another material or function definition (the prototype) with different defaults.

Parameters
transactionThe transaction to be used.
module_nameThe fully-qualified MDL name of the new module (including package names, starts with "::").
variant_dataA static or dynamic array of structures of type Variant_data. Such a structure has the following members:
  • const char* variant_name
    The name of the variant (non-qualified, without module prefix). The DB name of the variant is created by prefixing this name with the DB name of the new module plus "::".
  • const char* prototype_name
    The DB name of the prototype for this variant.
  • mi::neuraylib::IExpression_list* defaults
    The variant implicitly uses the defaults of the prototype. This member allows to set explicit defaults for the prototype including adding defaults for parameters of the prototype without default. The type of an argument in the expression list must match the type of the corresponding parameter of the prototype.
    Note that the expressions in defaults are copied. This copy operation is a shallow copy, e.g., DB elements referenced in call expressions are not copied.
    NULL is a valid value which is handled like an empty expression list.
  • mi::neuraylib::IAnnotation_block* annotations
    The variant does not inherit any annotations from the prototype. This member allows to specify annotations for the variant, i.e., for the material or function declaration itself (but not for its arguments).
    Note that the annotations are copied. This copy operation is a shallow copy.
    NULL is a valid value which is handled like an empty annotation block.
Returns
  • 1: Success (module exists already, creation was skipped).
  • 0: Success (module was actually created with the variants as its only material or function definitions).
  • -1: The module name module_name is invalid.
  • -2: Failed to compile the module module_name.
  • -3: The DB name for an imported module is already in use but is not an MDL module, or the DB name for a definition in this module is already in use.
  • -4: Initialization of an imported module failed.
  • -5: transaction, module_name or variant_data are invalid, variant_data is empty, or a struct member for the prototype name, defaults, or annotations has an incorrect type.
  • -6: A default for a non-existing parameter was provided.
  • -7: The type of a default does not have the correct type.
  • -8: Unspecified error.
  • -9: One of the annotation arguments is wrong (wrong argument name, not a constant expression, or the argument type does not match the parameter type).
  • -10: One of the annotations does not exist or it has a currently unsupported parameter type like deferred-sized arrays.