neuray API Programmer's Manual

mi::neuraylib::ITarget_value_layout Class Reference

[MDL compiler]

Description

Represents the layout of an mi::neuraylib::ITarget_argument_block with support for nested elements. The structure of the layout corresponds to the structure of the arguments of the compiled material not of the original material. Especially note, that the i'th argument of a compiled material does not in general correspond to the i'th argument of the original material.

See mi_neuray_compilation_modes for more details.

Public Member Functions

virtual Size get_layout( IValue::​Kind& kind, Size& arg_size, Target_value_layout_state state = Target_value_layout_state()) const =0
Get the offset, the size and the kind of the argument / element inside the argument block at the given layout state. More...
virtual Target_value_layout_state get_nested_state( Size i, Target_value_layout_state state = Target_value_layout_state()) const =0
Get the layout state for the i'th argument / element inside the argument value block at the given layout state. More...
virtual Size get_num_elements( Target_value_layout_state state = Target_value_layout_state()) const =0
Get the number of arguments / elements at the given layout state. More...
virtual Size get_size() const =0
Returns the size of the target argument block.
virtual Sint32 set_value( char* block, const IValue* value, ITarget_resource_callback* resource_callback, Target_value_layout_state state = Target_value_layout_state()) const =0
Set the value inside the given block at the given layout state. More...

Member Functions

virtual Size mi::​neuraylib::​ITarget_value_layout::get_layout( IValue::​Kind& kind, Size& arg_size, Target_value_layout_state state = Target_value_layout_state()) const [pure virtual]

Get the offset, the size and the kind of the argument / element inside the argument block at the given layout state.

Parameters

kind
Receives the kind of the argument.
arg_size
Receives the size of the argument.
state
The layout state representing the current nesting within the argument value block. The default value is used for the top-level.

Returns

the offset of the requested argument / element or "~mi::Size(0)" if the state is invalid.

virtual Target_value_layout_state mi::​neuraylib::​ITarget_value_layout::get_nested_state( Size i, Target_value_layout_state state = Target_value_layout_state()) const [pure virtual]

Get the layout state for the i'th argument / element inside the argument value block at the given layout state.

Parameters

i
The index of the argument / element.
state
The layout state representing the current nesting within the argument value block. The default value is used for the top-level.

Returns

the layout state for the nested element or a state with "~mi::Uint32(0)" as m_state_offs if the element is atomic.

virtual Size mi::​neuraylib::​ITarget_value_layout::get_num_elements( Target_value_layout_state state = Target_value_layout_state()) const [pure virtual]

Get the number of arguments / elements at the given layout state.

Parameters

state
The layout state representing the current nesting within the argument value block. The default value is used for the top-level.
virtual Size mi::​neuraylib::​ITarget_value_layout::get_size() const [pure virtual]

Returns the size of the target argument block.

virtual Sint32 mi::​neuraylib::​ITarget_value_layout::set_value( char* block, const IValue* value, ITarget_resource_callback* resource_callback, Target_value_layout_state state = Target_value_layout_state()) const [pure virtual]

Set the value inside the given block at the given layout state.

Parameters

block
value
The value to be set. It has to match the expected kind.
resource_callback
Callback for retrieving resource indices for resource values.
state
The layout state representing the current nesting within the argument value block. The default value is used for the top-level.

Returns

  • 0: Success.
  • -1: Invalid parameters, block or value is a NULL pointer.
  • -2: Invalid state provided.
  • -3: Value kind does not match expected kind.
  • -4: Size of compound value does not match expected size.
  • -5: Unsupported value type.