ifunction_definition.h File Reference
Description
Scene element Function_definition.
Code Example
ifunction_definition.h
/***************************************************************************************************
* Copyright 2024 NVIDIA Corporation. All rights reserved.
**************************************************************************************************/
#ifndef MI_NEURAYLIB_IFUNCTION_DEFINITION_H
#define MI_NEURAYLIB_IFUNCTION_DEFINITION_H
#include <cstring>
#include <mi/neuraylib/iexpression.h>
#include <mi/neuraylib/iscene_element.h>
namespace mi {
namespace neuraylib {
class IFunction_call;
class IMdl_execution_context;
class IFunction_definition : public
mi::base::Interface_declare<0x3504744d,0xd45b,0x4a99,0xb6,0x21,0x10,0x9e,0xd5,0xcb,0x36,0xc1,
neuraylib::IScene_element>
{
public:
enum Semantics
{
DS_UNKNOWN = 0,
DS_CONV_CONSTRUCTOR,
DS_ELEM_CONSTRUCTOR,
DS_COLOR_SPECTRUM_CONSTRUCTOR,
DS_MATRIX_ELEM_CONSTRUCTOR,
DS_MATRIX_DIAG_CONSTRUCTOR,
DS_INVALID_REF_CONSTRUCTOR,
DS_DEFAULT_STRUCT_CONSTRUCTOR,
DS_TEXTURE_CONSTRUCTOR,
DS_CONV_OPERATOR,
DS_COPY_CONSTRUCTOR,
// Unary operators
DS_BITWISE_COMPLEMENT = 0x0200,
DS_UNARY_FIRST = DS_BITWISE_COMPLEMENT,
DS_OPERATOR_FIRST = DS_UNARY_FIRST,
DS_LOGICAL_NOT,
DS_POSITIVE,
DS_NEGATIVE,
DS_PRE_INCREMENT,
DS_PRE_DECREMENT,
DS_POST_INCREMENT,
DS_POST_DECREMENT,
DS_CAST,
DS_UNARY_LAST = DS_CAST,
// Binary operators
DS_SELECT,
DS_BINARY_FIRST = DS_SELECT,
DS_ARRAY_INDEX,
DS_MULTIPLY,
DS_DIVIDE,
DS_MODULO,
DS_PLUS,
DS_MINUS,
DS_SHIFT_LEFT,
DS_SHIFT_RIGHT,
DS_UNSIGNED_SHIFT_RIGHT,
DS_LESS,
DS_LESS_OR_EQUAL,
DS_GREATER_OR_EQUAL,
DS_GREATER,
DS_EQUAL,
DS_NOT_EQUAL,
DS_BITWISE_AND,
DS_BITWISE_XOR,
DS_BITWISE_OR,
DS_LOGICAL_AND,
DS_LOGICAL_OR,
DS_ASSIGN,
DS_MULTIPLY_ASSIGN,
DS_DIVIDE_ASSIGN,
DS_MODULO_ASSIGN,
DS_PLUS_ASSIGN,
DS_MINUS_ASSIGN,
DS_SHIFT_LEFT_ASSIGN,
DS_SHIFT_RIGHT_ASSIGN,
DS_UNSIGNED_SHIFT_RIGHT_ASSIGN,
DS_BITWISE_OR_ASSIGN,
DS_BITWISE_XOR_ASSIGN,
DS_BITWISE_AND_ASSIGN,
DS_BINARY_LAST = DS_BITWISE_AND_ASSIGN,
// Ternary operator
DS_TERNARY,
DS_OPERATOR_LAST = DS_TERNARY,
// ::math module intrinsics
DS_INTRINSIC_MATH_ABS = 0x0300,
DS_INTRINSIC_MATH_FIRST = DS_INTRINSIC_MATH_ABS,
DS_INTRINSIC_MATH_ACOS,
DS_INTRINSIC_MATH_ALL,
DS_INTRINSIC_MATH_ANY,
DS_INTRINSIC_MATH_ASIN,
DS_INTRINSIC_MATH_ATAN,
DS_INTRINSIC_MATH_ATAN2,
DS_INTRINSIC_MATH_AVERAGE,
DS_INTRINSIC_MATH_CEIL,
DS_INTRINSIC_MATH_CLAMP,
DS_INTRINSIC_MATH_COS,
DS_INTRINSIC_MATH_CROSS,
DS_INTRINSIC_MATH_DEGREES,
DS_INTRINSIC_MATH_DISTANCE,
DS_INTRINSIC_MATH_DOT,
DS_INTRINSIC_MATH_EVAL_AT_WAVELENGTH,
DS_INTRINSIC_MATH_EXP,
DS_INTRINSIC_MATH_EXP2,
DS_INTRINSIC_MATH_FLOOR,
DS_INTRINSIC_MATH_FMOD,
DS_INTRINSIC_MATH_FRAC,
DS_INTRINSIC_MATH_ISNAN,
DS_INTRINSIC_MATH_ISFINITE,
DS_INTRINSIC_MATH_LENGTH,
DS_INTRINSIC_MATH_LERP,
DS_INTRINSIC_MATH_LOG,
DS_INTRINSIC_MATH_LOG2,
DS_INTRINSIC_MATH_LOG10,
DS_INTRINSIC_MATH_LUMINANCE,
DS_INTRINSIC_MATH_MAX,
DS_INTRINSIC_MATH_MAX_VALUE,
DS_INTRINSIC_MATH_MAX_VALUE_WAVELENGTH,
DS_INTRINSIC_MATH_MIN,
DS_INTRINSIC_MATH_MIN_VALUE,
DS_INTRINSIC_MATH_MIN_VALUE_WAVELENGTH,
DS_INTRINSIC_MATH_MODF,
DS_INTRINSIC_MATH_NORMALIZE,
DS_INTRINSIC_MATH_POW,
DS_INTRINSIC_MATH_RADIANS,
DS_INTRINSIC_MATH_ROUND,
DS_INTRINSIC_MATH_RSQRT,
DS_INTRINSIC_MATH_SATURATE,
DS_INTRINSIC_MATH_SIGN,
DS_INTRINSIC_MATH_SIN,
DS_INTRINSIC_MATH_SINCOS,
DS_INTRINSIC_MATH_SMOOTHSTEP,
DS_INTRINSIC_MATH_SQRT,
DS_INTRINSIC_MATH_STEP,
DS_INTRINSIC_MATH_TAN,
DS_INTRINSIC_MATH_TRANSPOSE,
DS_INTRINSIC_MATH_BLACKBODY,
DS_INTRINSIC_MATH_EMISSION_COLOR,
DS_INTRINSIC_MATH_COSH,
DS_INTRINSIC_MATH_SINH,
DS_INTRINSIC_MATH_TANH,
DS_INTRINSIC_MATH_INT_BITS_TO_FLOAT,
DS_INTRINSIC_MATH_FLOAT_BITS_TO_INT,
DS_INTRINSIC_MATH_ROUND_AWAY_FROM_ZERO,
DS_INTRINSIC_MATH_DX,
DS_INTRINSIC_MATH_DY,
DS_INTRINSIC_MATH_LAST = DS_INTRINSIC_MATH_DY,
// ::state module intrinsics
DS_INTRINSIC_STATE_POSITION = 0x0400,
DS_INTRINSIC_STATE_FIRST = DS_INTRINSIC_STATE_POSITION,
DS_INTRINSIC_STATE_NORMAL,
DS_INTRINSIC_STATE_GEOMETRY_NORMAL,
DS_INTRINSIC_STATE_MOTION,
DS_INTRINSIC_STATE_TEXTURE_SPACE_MAX,
DS_INTRINSIC_STATE_TEXTURE_COORDINATE,
DS_INTRINSIC_STATE_TEXTURE_TANGENT_U,
DS_INTRINSIC_STATE_TEXTURE_TANGENT_V,
DS_INTRINSIC_STATE_TANGENT_SPACE,
DS_INTRINSIC_STATE_GEOMETRY_TANGENT_U,
DS_INTRINSIC_STATE_GEOMETRY_TANGENT_V,
DS_INTRINSIC_STATE_DIRECTION,
DS_INTRINSIC_STATE_ANIMATION_TIME,
DS_INTRINSIC_STATE_WAVELENGTH_BASE,
DS_INTRINSIC_STATE_TRANSFORM,
DS_INTRINSIC_STATE_TRANSFORM_POINT,
DS_INTRINSIC_STATE_TRANSFORM_VECTOR,
DS_INTRINSIC_STATE_TRANSFORM_NORMAL,
DS_INTRINSIC_STATE_TRANSFORM_SCALE,
DS_INTRINSIC_STATE_ROUNDED_CORNER_NORMAL,
DS_INTRINSIC_STATE_METERS_PER_SCENE_UNIT,
DS_INTRINSIC_STATE_SCENE_UNITS_PER_METER,
DS_INTRINSIC_STATE_OBJECT_ID,
DS_INTRINSIC_STATE_WAVELENGTH_MIN,
DS_INTRINSIC_STATE_WAVELENGTH_MAX,
DS_INTRINSIC_STATE_LAST = DS_INTRINSIC_STATE_WAVELENGTH_MAX,
// ::tex module intrinsics
DS_INTRINSIC_TEX_WIDTH = 0x0500,
DS_INTRINSIC_TEX_FIRST = DS_INTRINSIC_TEX_WIDTH,
DS_INTRINSIC_TEX_HEIGHT,
DS_INTRINSIC_TEX_DEPTH,
DS_INTRINSIC_TEX_LOOKUP_FLOAT,
DS_INTRINSIC_TEX_LOOKUP_FLOAT2,
DS_INTRINSIC_TEX_LOOKUP_FLOAT3,
DS_INTRINSIC_TEX_LOOKUP_FLOAT4,
DS_INTRINSIC_TEX_LOOKUP_COLOR,
DS_INTRINSIC_TEX_TEXEL_FLOAT,
DS_INTRINSIC_TEX_TEXEL_FLOAT2,
DS_INTRINSIC_TEX_TEXEL_FLOAT3,
DS_INTRINSIC_TEX_TEXEL_FLOAT4,
DS_INTRINSIC_TEX_TEXEL_COLOR,
DS_INTRINSIC_TEX_TEXTURE_ISVALID,
DS_INTRINSIC_TEX_WIDTH_OFFSET,
DS_INTRINSIC_TEX_HEIGHT_OFFSET,
DS_INTRINSIC_TEX_DEPTH_OFFSET,
DS_INTRINSIC_TEX_FIRST_FRAME,
DS_INTRINSIC_TEX_LAST_FRAME,
DS_INTRINSIC_TEX_GRID_TO_OBJECT_SPACE,
DS_INTRINSIC_TEX_LAST = DS_INTRINSIC_TEX_GRID_TO_OBJECT_SPACE,
// ::df module intrinsics
DS_INTRINSIC_DF_DIFFUSE_REFLECTION_BSDF = 0x0600,
DS_INTRINSIC_DF_FIRST = DS_INTRINSIC_DF_DIFFUSE_REFLECTION_BSDF,
DS_INTRINSIC_DF_DUSTY_DIFFUSE_REFLECTION_BSDF,
DS_INTRINSIC_DF_DIFFUSE_TRANSMISSION_BSDF,
DS_INTRINSIC_DF_SPECULAR_BSDF,
DS_INTRINSIC_DF_SIMPLE_GLOSSY_BSDF,
DS_INTRINSIC_DF_BACKSCATTERING_GLOSSY_REFLECTION_BSDF,
DS_INTRINSIC_DF_MEASURED_BSDF,
DS_INTRINSIC_DF_DIFFUSE_EDF,
DS_INTRINSIC_DF_MEASURED_EDF,
DS_INTRINSIC_DF_SPOT_EDF,
DS_INTRINSIC_DF_ANISOTROPIC_VDF,
DS_INTRINSIC_DF_FOG_VDF,
DS_INTRINSIC_DF_NORMALIZED_MIX,
DS_INTRINSIC_DF_CLAMPED_MIX,
DS_INTRINSIC_DF_WEIGHTED_LAYER,
DS_INTRINSIC_DF_FRESNEL_LAYER,
DS_INTRINSIC_DF_CUSTOM_CURVE_LAYER,
DS_INTRINSIC_DF_MEASURED_CURVE_LAYER,
DS_INTRINSIC_DF_THIN_FILM,
DS_INTRINSIC_DF_TINT,
DS_INTRINSIC_DF_DIRECTIONAL_FACTOR,
DS_INTRINSIC_DF_MEASURED_CURVE_FACTOR,
DS_INTRINSIC_DF_LIGHT_PROFILE_POWER,
DS_INTRINSIC_DF_LIGHT_PROFILE_MAXIMUM,
DS_INTRINSIC_DF_LIGHT_PROFILE_ISVALID,
DS_INTRINSIC_DF_BSDF_MEASUREMENT_ISVALID,
DS_INTRINSIC_DF_MICROFACET_BECKMANN_SMITH_BSDF,
DS_INTRINSIC_DF_MICROFACET_GGX_SMITH_BSDF,
DS_INTRINSIC_DF_MICROFACET_BECKMANN_VCAVITIES_BSDF,
DS_INTRINSIC_DF_MICROFACET_GGX_VCAVITIES_BSDF,
DS_INTRINSIC_DF_WARD_GEISLER_MORODER_BSDF,
DS_INTRINSIC_DF_COLOR_NORMALIZED_MIX,
DS_INTRINSIC_DF_COLOR_CLAMPED_MIX,
DS_INTRINSIC_DF_COLOR_WEIGHTED_LAYER,
DS_INTRINSIC_DF_COLOR_FRESNEL_LAYER,
DS_INTRINSIC_DF_COLOR_CUSTOM_CURVE_LAYER,
DS_INTRINSIC_DF_COLOR_MEASURED_CURVE_LAYER,
DS_INTRINSIC_DF_FRESNEL_FACTOR,
DS_INTRINSIC_DF_MEASURED_FACTOR,
DS_INTRINSIC_DF_CHIANG_HAIR_BSDF,
DS_INTRINSIC_DF_SHEEN_BSDF,
DS_INTRINSIC_DF_UNBOUNDED_MIX,
DS_INTRINSIC_DF_COLOR_UNBOUNDED_MIX,
DS_INTRINSIC_DF_LAST = DS_INTRINSIC_DF_COLOR_UNBOUNDED_MIX,
#ifndef MDL_SOURCE_RELEASE
// ::nvidia::df module intrinsics
DS_INTRINSIC_NVIDIA_DF_ASHIKHMIN_SHIRLEY_GLOSSY_BSDF = 0x0700,
DS_INTRINSIC_NVIDIA_DF_FIRST = DS_INTRINSIC_NVIDIA_DF_ASHIKHMIN_SHIRLEY_GLOSSY_BSDF,
DS_INTRINSIC_NVIDIA_DF_SIMPLE_GLOSSY_BSDF_LEGACY,
DS_INTRINSIC_NVIDIA_DF_LEGACY_MCP_GLOSSY_BSDF,
DS_INTRINSIC_NVIDIA_DF_COAT_ABSORPTION,
DS_INTRINSIC_NVIDIA_DF_SHEEN_LTC_BSDF,
DS_INTRINSIC_NVIDIA_DF_LAST = DS_INTRINSIC_NVIDIA_DF_SHEEN_LTC_BSDF,
#endif
// ::scene module intrinsics
DS_INTRINSIC_SCENE_DATA_ISVALID = 0x0800,
DS_INTRINSIC_SCENE_FIRST = DS_INTRINSIC_SCENE_DATA_ISVALID,
DS_INTRINSIC_SCENE_DATA_LOOKUP_INT,
DS_INTRINSIC_SCENE_DATA_LOOKUP_INT2,
DS_INTRINSIC_SCENE_DATA_LOOKUP_INT3,
DS_INTRINSIC_SCENE_DATA_LOOKUP_INT4,
DS_INTRINSIC_SCENE_DATA_LOOKUP_FLOAT,
DS_INTRINSIC_SCENE_DATA_LOOKUP_FLOAT2,
DS_INTRINSIC_SCENE_DATA_LOOKUP_FLOAT3,
DS_INTRINSIC_SCENE_DATA_LOOKUP_FLOAT4,
DS_INTRINSIC_SCENE_DATA_LOOKUP_COLOR,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_INT,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_INT2,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_INT3,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_INT4,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_FLOAT,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_FLOAT2,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_FLOAT3,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_FLOAT4,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_COLOR,
DS_INTRINSIC_SCENE_DATA_LOOKUP_FLOAT4X4,
DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_FLOAT4X4,
DS_INTRINSIC_SCENE_LAST = DS_INTRINSIC_SCENE_DATA_LOOKUP_UNIFORM_FLOAT4X4,
// ::debug module intrinsics
DS_INTRINSIC_DEBUG_BREAKPOINT = 0x0900,
DS_INTRINSIC_DEBUG_FIRST = DS_INTRINSIC_DEBUG_BREAKPOINT,
DS_INTRINSIC_DEBUG_ASSERT,
DS_INTRINSIC_DEBUG_PRINT,
DS_INTRINSIC_DEBUG_LAST = DS_INTRINSIC_DEBUG_PRINT,
// DAG backend intrinsics
DS_INTRINSIC_DAG_FIELD_ACCESS = 0x0A00,
DS_INTRINSIC_DAG_FIRST = DS_INTRINSIC_DAG_FIELD_ACCESS,
DS_INTRINSIC_DAG_ARRAY_CONSTRUCTOR,
DS_INTRINSIC_DAG_ARRAY_LENGTH,
DS_INTRINSIC_DAG_DECL_CAST,
DS_INTRINSIC_DAG_LAST = DS_INTRINSIC_DAG_DECL_CAST,
DS_FORCE_32_BIT = 0xffffffffU // Undocumented, for alignment only.
};
virtual const char* get_module() const = 0;
virtual const char* get_mdl_name() const = 0;
virtual const char* get_mdl_module_name() const = 0;
virtual const char* get_mdl_simple_name() const = 0;
virtual const char* get_mdl_parameter_type_name( Size index) const = 0;
virtual const char* get_prototype() const = 0;
virtual void get_mdl_version( Mdl_version& since, Mdl_version& removed) const = 0;
virtual Semantics
get_semantic() const = 0;
inline bool is_array_constructor() const { return strcmp( get_mdl_name(), "T[](...)") == 0; }
virtual bool is_exported() const = 0;
// to be declarative.
virtual bool is_declarative() const = 0;
virtual bool is_uniform() const = 0;
virtual bool is_material() const = 0;
virtual const IType* get_return_type() const = 0;
template<class T>
const T* get_return_type() const
{
const IType* ptr_itype = get_return_type();
if ( !ptr_itype)
return 0;
const T* ptr_T = static_cast<const T*>( ptr_itype->get_interface( typename T::IID()));
ptr_itype->release();
return ptr_T;
}
virtual Size
get_parameter_count() const = 0;
virtual const char* get_parameter_name( Size index) const = 0;
virtual Size
get_parameter_index( const char* name) const = 0;
virtual const IType_list* get_parameter_types() const = 0;
virtual const IExpression_list* get_defaults() const = 0;
virtual const IExpression_list* get_enable_if_conditions() const = 0;
virtual Size
get_enable_if_users( Size index) const = 0;
virtual Size
get_enable_if_user( Size index, Size u_index) const = 0;
virtual const IAnnotation_block* get_annotations() const = 0;
virtual const IAnnotation_block* get_return_annotations() const = 0;
virtual const IAnnotation_list* get_parameter_annotations() const = 0;
virtual const char* get_thumbnail() const = 0;
virtual bool is_valid( IMdl_execution_context* context) const = 0;
virtual const IExpression* get_body() const = 0;
virtual Size
get_temporary_count() const = 0;
virtual const IExpression* get_temporary( Size index) const = 0;
virtual const char* get_temporary_name( Size index) const = 0;
template<class T>
const T* get_temporary( Size index) const
{
const IExpression* ptr_iexpression = get_temporary( index);
if ( !ptr_iexpression)
return 0;
const T* ptr_T = static_cast<const T*>( ptr_iexpression->get_interface( typename T::IID()));
ptr_iexpression->release();
return ptr_T;
}
virtual IFunction_call* create_function_call(
const IExpression_list* arguments, Sint32* errors = 0) const = 0;
virtual const char* get_mangled_name() const = 0;
#ifdef MI_NEURAYLIB_DEPRECATED_15_0
inline const char* get_mdl_mangled_name() const { return get_mangled_name(); }
#endif // MI_NEURAYLIB_DEPRECATED_15_0
};
mi_static_assert( sizeof( IFunction_definition::Semantics) == sizeof( Uint32));
// end group mi_neuray_mdl_elements
} // namespace neuraylib
} // namespace mi
#endif // MI_NEURAYLIB_IFUNCTION_DEFINITION_H
Namespaces
- namespace
- Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
- namespace
- Namespace for the neuray API. More...
Classes
- class
- This interface represents a function definition. More...