The rule engine handles the transformation of a compiled material by a rule set. More...
#include <mdl_distiller_plugin_api.h>
Classes | |
struct | strcmp_string_less |
== Node attributes ============================================================= More... | |
Public Types | |
enum | Field_selector { FS_NONE = 0x0000 , FS_MATERIAL_THIN_WALLED = 0x0001 , FS_MATERIAL_SURFACE_SCATTERING = 0x0002 , FS_MATERIAL_SURFACE_EMISSION_EMISSION = 0x0004 , FS_MATERIAL_SURFACE_EMISSION_INTENSITY = 0x0008 , FS_MATERIAL_SURFACE_EMISSION_MODE = 0x0010 , FS_MATERIAL_SURFACE_EMISSION = 0x001c , FS_MATERIAL_SURFACE = 0x001e , FS_MATERIAL_BACKFACE_SCATTERING = 0x0020 , FS_MATERIAL_BACKFACE_EMISSION_EMISSION = 0x0040 , FS_MATERIAL_BACKFACE_EMISSION_INTENSITY = 0x0080 , FS_MATERIAL_BACKFACE_EMISSION_MODE = 0x0100 , FS_MATERIAL_BACKFACE_EMISSION = 0x01c0 , FS_MATERIAL_BACKFACE = 0x01e0 , FS_MATERIAL_IOR = 0x0200 , FS_MATERIAL_VOLUME_SCATTERING = 0x0400 , FS_MATERIAL_VOLUME_ABSORPTION_COEFFICIENT = 0x0800 , FS_MATERIAL_VOLUME_SCATTERING_COEFFICIENT = 0x1000 , FS_MATERIAL_VOLUME = 0x1c00 , FS_MATERIAL_GEOMETRY_DISPLACEMENT = 0x2000 , FS_MATERIAL_GEOMETRY_CUTOUT_OPACITY = 0x4000 , FS_MATERIAL_GEOMETRY_NORMAL = 0x8000 , FS_MATERIAL_GEOMETRY = 0xe000 , FS_MATERIAL_HAIR = 0x10000 } |
================================================================================ More... | |
enum | Unary_operator |
Supported unary operators in the DAG representation. More... | |
enum | Binary_operator { OK_SELECT = IExpression_binary::OK_SELECT , OK_ARRAY_INDEX = IExpression_binary::OK_ARRAY_INDEX , OK_MULTIPLY = IExpression_binary::OK_MULTIPLY , OK_DIVIDE = IExpression_binary::OK_DIVIDE , OK_MODULO = IExpression_binary::OK_MODULO , OK_PLUS = IExpression_binary::OK_PLUS , OK_MINUS = IExpression_binary::OK_MINUS , OK_SHIFT_LEFT = IExpression_binary::OK_SHIFT_LEFT , OK_SHIFT_RIGHT = IExpression_binary::OK_SHIFT_RIGHT , OK_UNSIGNED_SHIFT_RIGHT = IExpression_binary::OK_UNSIGNED_SHIFT_RIGHT , OK_LESS = IExpression_binary::OK_LESS , OK_LESS_OR_EQUAL = IExpression_binary::OK_LESS_OR_EQUAL , OK_GREATER_OR_EQUAL = IExpression_binary::OK_GREATER_OR_EQUAL , OK_GREATER = IExpression_binary::OK_GREATER , OK_EQUAL = IExpression_binary::OK_EQUAL , OK_NOT_EQUAL = IExpression_binary::OK_NOT_EQUAL , OK_BITWISE_AND = IExpression_binary::OK_BITWISE_AND , OK_BITWISE_XOR = IExpression_binary::OK_BITWISE_XOR , OK_BITWISE_OR = IExpression_binary::OK_BITWISE_OR , OK_LOGICAL_AND = IExpression_binary::OK_LOGICAL_AND , OK_LOGICAL_OR = IExpression_binary::OK_LOGICAL_OR } |
Supported binary operators in the DAG representation. More... | |
Public Member Functions | |
virtual IMaterial_instance * | apply_rules (IMaterial_instance const *inst, IRule_matcher &matcher, IRule_matcher_event *event_handler, const Distiller_options *options, mi::Sint32 &error)=0 |
Apply rules using a strategy. More... | |
virtual void | set_attribute (DAG_node const *node, char const *name, DAG_node const *value)=0 |
Set the value of a named attribute of a node. More... | |
virtual void | remove_attributes (DAG_node const *node)=0 |
Remove all attributes from the given DAG node. More... | |
virtual DAG_node const * | get_attribute (DAG_node const *node, char const *name)=0 |
Get the value of an attribute for the given DAG node. More... | |
virtual bool | attribute_exists (DAG_node const *node, char const *name)=0 |
Check whether a named attribute exists for a DAG node. More... | |
virtual void | move_attributes (DAG_node const *to_node, DAG_node const *from_node)=0 |
Move all nodes from from_node to node to_node , removing them from from_node . More... | |
virtual IMaterial_instance * | merge_materials (IMaterial_instance const *m0, IMaterial_instance const *m1, Field_selector field_selector)=0 |
Returns a new material instance as a merge of two material instances based on a material field selection mask choosing the top-level material fields between the two materials. More... | |
virtual DAG_constant const * | create_constant (IValue const *value)=0 |
Create a constant. More... | |
virtual DAG_temporary const * | create_temporary (DAG_node const *node, int index)=0 |
Create a temporary reference. More... | |
virtual DAG_node const * | create_call (char const *name, IDefinition::Semantics sema, DAG_call::Call_argument const call_args[], int num_call_args, IType const *ret_type)=0 |
Create a call. More... | |
virtual DAG_node const * | create_function_call (char const *name, DAG_node const *const call_args[], size_t num_call_args)=0 |
Create a function call for a non-overloaded function. More... | |
virtual DAG_node const * | create_mixer_call (DAG_call::Call_argument const call_args[], int num_call_args)=0 |
Create a 1-, 2-, 3-, or 4-mixer call, with 2, 4, 6, or 8 parameters respectively. More... | |
virtual DAG_node const * | create_color_mixer_call (DAG_call::Call_argument const call_args[], int num_call_args)=0 |
Create a 1-, 2-, 3-, or 4-color-mixer call, with 2, 4, 6, or 8 parameters respectively. More... | |
virtual DAG_parameter const * | create_parameter (IType const *type, int index)=0 |
Create a parameter reference. More... | |
virtual IType_factory * | get_type_factory ()=0 |
Get the type factory associated with this expression factory. More... | |
virtual IValue_factory * | get_value_factory ()=0 |
Get the value factory associated with this expression factory. More... | |
virtual IType const * | get_bsdf_component_type ()=0 |
Return the type for ::df::bsdf_component. More... | |
virtual IType const * | get_edf_component_type ()=0 |
Return the type for ::df::edf_component. More... | |
virtual IType const * | get_vdf_component_type ()=0 |
Return the type for ::df::vdf_component. More... | |
virtual IType const * | get_bsdf_component_array_type (int n_values)=0 |
Return the type for ::df::bsdf_component. More... | |
virtual IType const * | get_edf_component_array_type (int n_values)=0 |
Return the type for ::df::edf_component. More... | |
virtual IType const * | get_vdf_component_array_type (int n_values)=0 |
Return the type for ::df::vdf_component. More... | |
virtual IType const * | get_color_bsdf_component_type ()=0 |
Return the type for ::df::color_bsdf_component. More... | |
virtual IType const * | get_color_edf_component_type ()=0 |
Return the type for ::df::color_edf_component. More... | |
virtual IType const * | get_color_vdf_component_type ()=0 |
Return the type for ::df::color_vdf_component. More... | |
virtual IType const * | get_color_bsdf_component_array_type (int n_values)=0 |
Return the type for ::df::color_bsdf_component. More... | |
virtual IType const * | get_color_edf_component_array_type (int n_values)=0 |
Return the type for ::df::color_edf_component. More... | |
virtual IType const * | get_color_vdf_component_array_type (int n_values)=0 |
Return the type for ::df::color_vdf_component. More... | |
virtual IType const * | get_bool_type ()=0 |
Return the type for bool. More... | |
virtual DAG_node const * | create_unary (Unary_operator op, DAG_node const *o)=0 |
Creates an operator, handles types. More... | |
virtual DAG_node const * | create_binary (Binary_operator op, DAG_node const *l, DAG_node const *r)=0 |
Creates an operator, handles types. More... | |
virtual DAG_node const * | create_ternary (DAG_node const *cond, DAG_node const *t_expr, DAG_node const *f_expr)=0 |
Creates a ternary operator. More... | |
virtual DAG_node const * | create_select (DAG_node const *s, char const *member)=0 |
Creates a SELECT operator on a struct or vector. More... | |
virtual DAG_node const * | create_array (IType const *elem_type, DAG_node const *const values[], size_t n_values)=0 |
Creates an array constructor. More... | |
virtual DAG_constant const * | create_bool_constant (bool f)=0 |
Creates a boolean constant. More... | |
virtual DAG_constant const * | create_int_constant (int i)=0 |
Creates an integer constant. More... | |
virtual DAG_constant const * | create_emission_enum_constant (int i)=0 |
Creates a constant of the predefined intensity_mode enum. More... | |
virtual DAG_constant const * | create_scatter_enum_constant (int i)=0 |
Creates a constant of the df::scatter_mode enum. More... | |
virtual DAG_constant const * | create_wrap_mode_enum_constant (int i)=0 |
Creates a constant of the tex::wrap_mode enum. More... | |
virtual DAG_constant const * | create_float_constant (float f)=0 |
Creates a floating point constant. More... | |
virtual DAG_constant const * | create_float3_constant (float x, float y, float z)=0 |
Creates a float3 constant. More... | |
virtual DAG_constant const * | create_color_constant (float r, float g, float b)=0 |
Creates a RGB color constant. More... | |
virtual DAG_constant const * | create_global_ior ()=0 |
Creates a RGB color constant of the global material IOR value. More... | |
virtual DAG_constant const * | create_global_float_ior ()=0 |
Creates a float constant of the global material IOR green value. More... | |
virtual DAG_constant const * | create_string_constant (char const *s)=0 |
Creates a string constant. More... | |
virtual DAG_constant const * | create_bsdf_constant ()=0 |
Creates an invalid bsdf. More... | |
virtual DAG_constant const * | create_edf_constant ()=0 |
Creates an invalid edf. More... | |
virtual DAG_constant const * | create_vdf_constant ()=0 |
Creates an invalid vdf. More... | |
virtual DAG_constant const * | create_hair_bsdf_constant ()=0 |
Creates an invalid hair_bsdf. More... | |
virtual DAG_node const * | create_bsdf_component (DAG_node const *weight_arg, DAG_node const *bsdf_arg)=0 |
Create a bsdf_component for a mixer; can be a call or a constant. More... | |
virtual DAG_node const * | create_edf_component (DAG_node const *weight_arg, DAG_node const *edf_arg)=0 |
Create a edf_component for a mixer; can be a call or a constant. More... | |
virtual DAG_node const * | create_vdf_component (DAG_node const *weight_arg, DAG_node const *vdf_arg)=0 |
Create a vdf_component for a mixer; can be a call or a constant. More... | |
virtual DAG_node const * | create_color_bsdf_component (DAG_node const *weight_arg, DAG_node const *bsdf_arg)=0 |
Create a bsdf_color_component for a color mixer; can be a call or a constant. More... | |
virtual DAG_node const * | create_color_edf_component (DAG_node const *weight_arg, DAG_node const *edf_arg)=0 |
Create a edf_color_component for a color mixer; can be a call or a constant. More... | |
virtual DAG_node const * | create_color_vdf_component (DAG_node const *weight_arg, DAG_node const *edf_arg)=0 |
Create a vdf_color_component for a color mixer; can be a call or a constant. More... | |
virtual DAG_constant const * | mk_constant (const char *const_type, const char *value)=0 |
Create a constant node for a given type and value. More... | |
virtual DAG_node const * | mk_default (const char *param_type, const char *param_default)=0 |
Create DAG_node's for possible default values of Node_types parameter. More... | |
virtual size_t | get_compound_argument_size (DAG_node const *node)=0 |
Returns the argument count if node is non-null and of the call kind or a compound constant, and 0 otherwise. More... | |
virtual DAG_node const * | get_compound_argument (DAG_node const *node, size_t i)=0 |
Return the i-th argument if node is non-null and of the call kind, or a compound constant, and NULL otherwise. More... | |
virtual DAG_node const * | get_remapped_argument (DAG_node const *node, size_t i)=0 |
Return the i-th argument if node is non-null and of the call kind, or a compound constant, and NULL otherwise; remaps index for special case handling of mixers and parameter order of glossy BSDFs. More... | |
virtual char const * | get_compound_parameter_name (DAG_node const *node, size_t i) const =0 |
Returns the name of the i-th parameter of node, or NULL if there is none or node is NULL. More... | |
virtual bool | eval_if (DAG_node const *node)=0 |
Returns true if node evaluates to true. More... | |
virtual bool | eval_maybe_if (DAG_node const *node)=0 |
Returns true if node is not evaluating to false, i.e., it either evaluates to true or cannot be evaluated. More... | |
virtual int | get_selector (DAG_node const *node) const =0 |
Compute the node selector for the matcher, either the semantic for a DAG_call node, or one of the Distiller_extended_node_semantics covering DAG_constant of type bsdf, edf or vdf respectively, or for DAG_constant's and DAG_call's of one of the material structs, and selectors for mix_1, mix_2, mix_3, mix_4, clamped_mix_1, ..., as well as a special selector for local_normal. More... | |
virtual bool | all_nodes (IRule_matcher::Checker_function test_fct, DAG_node const *node)=0 |
Checks recursively for all call nodes if the property test_fct returns true. More... | |
virtual bool | set_normalize_mixers (bool new_value)=0 |
Set the normalization of mixer node flag and return its previous value. More... | |
virtual IMaterial_instance * | normalize_mixers (IMaterial_instance const *inst, IRule_matcher_event *event_handler, const mi::mdl::Distiller_options *options, mi::Sint32 &error)=0 |
Normalize mixer nodes and set respective flag to keep them normalized. More... | |
virtual void | release () const =0 |
Immediately deletes this distiller plugin API. More... | |
The rule engine handles the transformation of a compiled material by a rule set.
Supported binary operators in the DAG representation.
================================================================================
Field selectors, can be or'ed together to form a bit mask.
Supported unary operators in the DAG representation.
|
pure virtual |
Checks recursively for all call nodes if the property test_fct returns true.
|
pure virtual |
Apply rules using a strategy.
inst | a compiled material instance |
matcher | a rule set matcher |
event_handler | if non-NULL, a event handler to report events during processing |
options | the strategy to use |
error | error codes reported back to the API |
|
pure virtual |
Check whether a named attribute exists for a DAG node.
node | node for which to check for attribute presence (must not be NULL) |
name | name of the attribute (must not be NULL) |
|
pure virtual |
Creates an array constructor.
elem_type | the element type of the array, might be NULL iff n_values > 0 |
values | the array elements |
n_values | number of values |
|
pure virtual |
Creates an operator, handles types.
op | the operator |
l | the left operand |
r | the right operand |
|
pure virtual |
Creates a boolean constant.
|
pure virtual |
Create a bsdf_component for a mixer; can be a call or a constant.
|
pure virtual |
Creates an invalid bsdf.
|
pure virtual |
Create a call.
name | The name of the called function. |
sema | The semantics of the called function. |
call_args | The call arguments of the called function. |
num_call_args | The number of call arguments. |
ret_type | The return type of the function. |
|
pure virtual |
Create a bsdf_color_component for a color mixer; can be a call or a constant.
|
pure virtual |
Creates a RGB color constant.
|
pure virtual |
Create a edf_color_component for a color mixer; can be a call or a constant.
|
pure virtual |
Create a 1-, 2-, 3-, or 4-color-mixer call, with 2, 4, 6, or 8 parameters respectively.
|
pure virtual |
Create a vdf_color_component for a color mixer; can be a call or a constant.
|
pure virtual |
Create a constant.
value | The value of the constant. |
|
pure virtual |
Create a edf_component for a mixer; can be a call or a constant.
|
pure virtual |
Creates an invalid edf.
|
pure virtual |
Creates a constant of the predefined intensity_mode enum.
i | the index of the enum value |
|
pure virtual |
Creates a float3 constant.
|
pure virtual |
Creates a floating point constant.
|
pure virtual |
Create a function call for a non-overloaded function.
All parameter and return types are deduced from the function definition.
name | The name of the called function, e.g., "::state::normal". |
call_args | The call arguments of the called function. |
num_call_args | The number of call arguments. |
|
pure virtual |
Creates a float constant of the global material IOR green value.
|
pure virtual |
Creates a RGB color constant of the global material IOR value.
|
pure virtual |
Creates an invalid hair_bsdf.
|
pure virtual |
Creates an integer constant.
|
pure virtual |
Create a 1-, 2-, 3-, or 4-mixer call, with 2, 4, 6, or 8 parameters respectively.
|
pure virtual |
Create a parameter reference.
type | The type of the parameter |
index | The index of the parameter. |
|
pure virtual |
Creates a constant of the df::scatter_mode enum.
i | the index of the enum value |
|
pure virtual |
Creates a SELECT operator on a struct or vector.
s | a node producing a struct typed result |
member | the name of the member to select |
|
pure virtual |
Creates a string constant.
|
pure virtual |
Create a temporary reference.
node | The DAG node that is "named" by this temporary. |
index | The index of the temporary. |
|
pure virtual |
Creates a ternary operator.
cond | the condition |
t_expr | the true expression |
f_expr | the false expression |
|
pure virtual |
Creates an operator, handles types.
op | the operator |
o | the operand |
|
pure virtual |
Create a vdf_component for a mixer; can be a call or a constant.
|
pure virtual |
Creates an invalid vdf.
|
pure virtual |
Creates a constant of the tex::wrap_mode enum.
i | the index of the enum value |
|
pure virtual |
Returns true if node evaluates to true.
|
pure virtual |
Returns true if node is not evaluating to false, i.e., it either evaluates to true or cannot be evaluated.
|
pure virtual |
Get the value of an attribute for the given DAG node.
node | node for which to get the attribute (must not be NULL) |
name | name of the attribute (must not be NULL) |
|
pure virtual |
Return the type for bool.
|
pure virtual |
Return the type for ::df::bsdf_component.
|
pure virtual |
Return the type for ::df::bsdf_component.
|
pure virtual |
Return the type for ::df::color_bsdf_component.
|
pure virtual |
Return the type for ::df::color_bsdf_component.
|
pure virtual |
Return the type for ::df::color_edf_component.
|
pure virtual |
Return the type for ::df::color_edf_component.
|
pure virtual |
Return the type for ::df::color_vdf_component.
|
pure virtual |
Return the type for ::df::color_vdf_component.
|
pure virtual |
Return the i-th argument if node is non-null and of the call kind, or a compound constant, and NULL otherwise.
|
pure virtual |
Returns the argument count if node is non-null and of the call kind or a compound constant, and 0 otherwise.
|
pure virtual |
Returns the name of the i-th parameter of node, or NULL if there is none or node is NULL.
|
pure virtual |
Return the type for ::df::edf_component.
|
pure virtual |
Return the type for ::df::edf_component.
|
pure virtual |
Return the i-th argument if node is non-null and of the call kind, or a compound constant, and NULL otherwise; remaps index for special case handling of mixers and parameter order of glossy BSDFs.
|
pure virtual |
Compute the node selector for the matcher, either the semantic for a DAG_call node, or one of the Distiller_extended_node_semantics covering DAG_constant of type bsdf, edf or vdf respectively, or for DAG_constant's and DAG_call's of one of the material structs, and selectors for mix_1, mix_2, mix_3, mix_4, clamped_mix_1, ..., as well as a special selector for local_normal.
All other nodes return 0.
|
pure virtual |
Get the type factory associated with this expression factory.
|
pure virtual |
Get the value factory associated with this expression factory.
|
pure virtual |
Return the type for ::df::vdf_component.
|
pure virtual |
Return the type for ::df::vdf_component.
|
pure virtual |
Returns a new material instance as a merge of two material instances based on a material field selection mask choosing the top-level material fields between the two materials.
m0 | the material instance whose fields are chosen if the mask bit is 0. |
m1 | the material instance whose fields are chosen if the mask bit is 1. |
field_selector | mask to select the fields from m0 or m1 respectively. |
|
pure virtual |
Create a constant node for a given type and value.
|
pure virtual |
Create DAG_node's for possible default values of Node_types parameter.
|
pure virtual |
Move all nodes from from_node
to node to_node
, removing them from from_node
.
to_node | node to which to assign the attributes |
from_node | node from which to move the attributes |
|
pure virtual |
Normalize mixer nodes and set respective flag to keep them normalized.
inst | a compiled material instance |
event_handler | if non-NULL, a event handler to report events during processing |
options | options for this rule set, currently none used. |
error | error codes reported back to the API |
|
pure virtual |
Immediately deletes this distiller plugin API.
|
pure virtual |
Remove all attributes from the given DAG node.
node | node for which to remove all attributes |
|
pure virtual |
Set the value of a named attribute of a node.
If the node already has the attribute, its value is overwritten.
node | node to attach attribute to (must not be NULL) |
name | name of the attribute (must not be NULL) |
value | new value of the attribute (must not be NULL) |
|
pure virtual |
Set the normalization of mixer node flag and return its previous value.