neuray API Programmer's Manual

mi::neuraylib::ILink_unit Class Reference

[MDL compiler]

Description

Represents a link-unit of an MDL backend.

Public Enumerations

enum Function_execution_context{ FEC_ENVIRONMENT = 0, FEC_CORE = 1, FEC_DISPLACEMENT = 2, FEC_FORCE_32_BIT = 0xFFFFFFFFu}
Execution context for functions.

Public Member Functions

virtual Sint32 add_function( const IFunction_call* call, Function_execution_context fexc, const char* fname, IMdl_execution_context* context = 0) =0
Add an MDL function call as a function to this link unit. More...
virtual Sint32 add_function( const IFunction_definition* function, Function_execution_context fexc, const char* fname, IMdl_execution_context* context) =0
Add an MDL function definition as a function to this link unit. More...
virtual Sint32 add_material( const ICompiled_material* material, Target_function_description* function_descriptions, Size description_count, IMdl_execution_context* context) =0
Add (multiple) MDL distribution functions and expressions of a material to this link unit. More...
virtual Sint32 add_material_df( const ICompiled_material* material, const char* path, const char* base_fname, IMdl_execution_context* context) =0
Add an MDL distribution function to this link unit. More...
virtual Sint32 add_material_expression( const ICompiled_material* inst, const char* path, const char* fname, IMdl_execution_context* context) =0
Add an expression that is part of an MDL material instance as a function to this link unit. More...

Enums

enum mi::​neuraylib::​ILink_unit::Function_execution_context

Execution context for functions.

Enumerator:

FEC_ENVIRONMENT = 0
This function will be executed inside the environment.
FEC_CORE = 1
This function will be executed in the renderer core.
FEC_DISPLACEMENT = 2
This function will be executed inside displacement.
FEC_FORCE_32_BIT = 0xFFFFFFFFu

Member Functions

virtual Sint32 mi::​neuraylib::​ILink_unit::add_function( const IFunction_call* call, Function_execution_context fexc, const char* fname, IMdl_execution_context* context = 0) [pure virtual]

Add an MDL function call as a function to this link unit.

Parameters

call
The MDL function call.
fexc
The context from which this function will be called.
fname
The name of the function that is created.
context

Returns

A return code. The return codes have the following meaning:

  • 0: Success.
  • -1: An error occurred. Please check the execution context for details if it has been provided.

virtual Sint32 mi::​neuraylib::​ILink_unit::add_function( const IFunction_definition* function, Function_execution_context fexc, const char* fname, IMdl_execution_context* context) [pure virtual]

Add an MDL function definition as a function to this link unit.

Parameters

function
The MDL function definition.
fexc
The context from which this function will be called.
fname
The name of the function that is created.
context

Returns

A return code. The return codes have the following meaning:

  • 0: Success.
  • -1: An error occurred. Please check the execution context for details if it has been provided.

virtual Sint32 mi::​neuraylib::​ILink_unit::add_material( const ICompiled_material* material, Target_function_description* function_descriptions, Size description_count, IMdl_execution_context* context) [pure virtual]

Add (multiple) MDL distribution functions and expressions of a material to this link unit. Functions can be selected by providing a list of Target_function_descriptions. If the first function in the list uses the path "init", one init function will be generated, precalculating values which will be used by the other requested functions. Each other entry in the list needs to define the path, the root of the expression that should be translated. For each distribution function it results in three or four functions, suffixed with "_init" (if first requested path was not "init"), "_sample", "_evaluate", and "_pdf". After calling this function, each element of the list will contain information for later usage in the application, e.g., the argument_block_index and the function_index.

Note:

Upon unsuccessful return, function_descriptions.return_code might contain further info.

Parameters

material
The compiled MDL material.
function_descriptions
description_count
The size of the list of descriptions.
context

Returns

A return code. The error codes have the following meaning:

  • 0: Success.
  • -1: An error occurred while processing the entries in the list. Please check the execution context for details if it has been provided.

virtual Sint32 mi::​neuraylib::​ILink_unit::add_material_df( const ICompiled_material* material, const char* path, const char* base_fname, IMdl_execution_context* context) [pure virtual]

Add an MDL distribution function to this link unit. For a BSDF it results in four functions, suffixed with "_init", "_sample", "_evaluate" and "_pdf".

Parameters

material
The compiled MDL material.
path
The path from the material root to the expression that should be translated, e.g., "surface.scattering".
base_fname
The base name of the generated functions. If NULL is passed, "lambda" will be used.
context

Returns

A return code. The return codes have the following meaning:

  • 0: Success.
  • -1: An error occurred. Please check the execution context for details if it has been provided.

virtual Sint32 mi::​neuraylib::​ILink_unit::add_material_expression( const ICompiled_material* inst, const char* path, const char* fname, IMdl_execution_context* context) [pure virtual]

Add an expression that is part of an MDL material instance as a function to this link unit.

Parameters

inst
The compiled MDL material instance.
path
The path from the material root to the expression that should be translated, e.g., "geometry.displacement".
fname
The name of the function that is created.
context

Returns

A return code. The return codes have the following meaning:

  • 0: Success.
  • -1: An error occurred. Please check the execution context for details if it has been provided.