Iray SDK API nvidia_logo_transpbg.gif Up
icompiled_material.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2025 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_ICOMPILED_MATERIAL_H
8#define MI_NEURAYLIB_ICOMPILED_MATERIAL_H
9
12#include <mi/neuraylib/version.h> // for MI_NEURAYLIB_DEPRECATED_ENUM_VALUE
13
14namespace mi {
15
16namespace neuraylib {
17
18class IMdl_execution_context;
19
48 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(SLOT_FORCE_32_BIT, 0xffffffffU)
49};
50
62 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(OPACITY_FORCE_32_BIT, 0xffffffffU)
63};
64
91class ICompiled_material : public
92 mi::base::Interface_declare<0x3115ab0f,0x7a91,0x4651,0xa5,0x9a,0xfd,0xb0,0x23,0x16,0xb4,0xb7,
93 neuraylib::IScene_element>
94{
95public:
97
98
100 virtual const IExpression_direct_call* get_body() const = 0;
101
103 virtual Size get_temporary_count() const = 0;
104
109 virtual const IExpression* get_temporary( Size index) const = 0;
110
122 template<class T>
123 const T* get_temporary( Size index) const
124 {
125 const IExpression* ptr_iexpression = get_temporary( index);
126 if ( !ptr_iexpression)
127 return 0;
128 const T* ptr_T = static_cast<const T*>( ptr_iexpression->get_interface( typename T::IID()));
129 ptr_iexpression->release();
130 return ptr_T;
131 }
132
138 virtual const IExpression* lookup_sub_expression( const char* path) const = 0;
139
152 template<class T>
153 const T* lookup_sub_expression( const char* path) const
154 {
155 const IExpression* ptr_iexpression = lookup_sub_expression( path);
156 if ( !ptr_iexpression)
157 return 0;
158 const T* ptr_T = static_cast<const T*>( ptr_iexpression->get_interface( typename T::IID()));
159 ptr_iexpression->release();
160 return ptr_T;
161 }
162
170 virtual bool is_valid( IMdl_execution_context* context) const = 0;
171
173
175
180 virtual Size get_parameter_count() const = 0;
181
196 virtual const char* get_parameter_name( Size index) const = 0;
197
202 virtual const IValue* get_argument( Size index) const = 0;
203
215 template<class T>
216 const T* get_argument( Size index) const
217 {
218 const IValue* ptr_ivalue = get_argument( index);
219 if ( !ptr_ivalue)
220 return 0;
221 const T* ptr_T = static_cast<const T*>( ptr_ivalue->get_interface( typename T::IID()));
222 ptr_ivalue->release();
223 return ptr_T;
224 }
225
250 const char* material_instance_name,
251 Size parameter_index,
252 Sint32* errors = nullptr) const = 0;
253
255
257
260
262 virtual Float32 get_mdl_wavelength_min() const = 0;
263
265 virtual Float32 get_mdl_wavelength_max() const = 0;
266
275 virtual Material_opacity get_opacity() const = 0;
276
284
292
293 virtual bool get_cutout_opacity( Float32* cutout_opacity) const = 0;
294
297
301 virtual const char* get_referenced_scene_data_name( Size index) const = 0;
302
305 virtual bool depends_on_state_transform() const = 0;
306
308 virtual bool depends_on_state_object_id() const = 0;
309
311 virtual bool depends_on_global_distribution() const = 0;
312
314 virtual bool depends_on_uniform_scene_data() const = 0;
315
317
319
340 virtual base::Uuid get_hash() const = 0;
341
351 virtual base::Uuid get_slot_hash( Material_slot slot) const = 0;
352
372 virtual base::Uuid get_sub_expression_hash( const char* path) const = 0;
373
375};
376 // end group mi_neuray_mdl_elements
378
379} // namespace neuraylib
380
381} // namespace mi
382
383#endif // MI_NEURAYLIB_ICOMPILED_MATERIAL_H
A simple string class.
Definition: istring.h:22
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
This interface represents a compiled material.
Definition: icompiled_material.h:94
virtual const IExpression * lookup_sub_expression(const char *path) const =0
Looks up a sub-expression of the compiled material.
virtual Size get_temporary_count() const =0
Returns the number of temporaries.
const T * get_temporary(Size index) const
Returns the expression of a temporary.
Definition: icompiled_material.h:123
virtual const IValue * get_argument(Size index) const =0
Returns the value of an argument.
virtual bool depends_on_state_object_id() const =0
Indicates whether the compiled material depends on state::object_id().
virtual Size get_parameter_count() const =0
Returns the number of parameters used by this compiled material.
virtual bool depends_on_global_distribution() const =0
Indicates whether the compiled material depends on global distribution (edf).
const T * get_argument(Size index) const
Returns the value of an argument.
Definition: icompiled_material.h:216
const T * lookup_sub_expression(const char *path) const
Looks up a sub-expression of the compiled material.
Definition: icompiled_material.h:153
virtual const IExpression_direct_call * get_body() const =0
Returns the body (or material root) of the compiled material.
virtual Float32 get_mdl_meters_per_scene_unit() const =0
Returns the conversion ration between meters and scene units.
virtual bool get_cutout_opacity(Float32 *cutout_opacity) const =0
Returns the cutout opacity (provided it is a constant).
virtual base::Uuid get_hash() const =0
Returns a hash of the body and all temporaries.
virtual bool depends_on_state_transform() const =0
Indicates whether the compiled material depends on coordinate space transformations like state::trans...
virtual Material_opacity get_surface_opacity() const =0
Returns the surface opacity of the compiled material.
virtual Float32 get_mdl_wavelength_max() const =0
Returns the largest supported wavelength.
virtual base::Uuid get_sub_expression_hash(const char *path) const =0
Returns the hash of a sub-expression of the compiled material.
virtual base::Uuid get_slot_hash(Material_slot slot) const =0
Returns the hash of a particular material slot.
virtual Size get_referenced_scene_data_count() const =0
Returns the number of scene data attributes referenced by this compiled material.
virtual Float32 get_mdl_wavelength_min() const =0
Returns the smallest supported wavelength.
virtual Material_opacity get_opacity() const =0
Returns the opacity of the compiled material.
virtual const IExpression * get_temporary(Size index) const =0
Returns a temporary.
virtual const char * get_parameter_name(Size index) const =0
Returns the name of a parameter.
virtual const char * get_referenced_scene_data_name(Size index) const =0
Return the name of a scene data attribute referenced by this compiled material.
virtual const IString * get_connected_function_db_name(const char *material_instance_name, Size parameter_index, Sint32 *errors=nullptr) const =0
Looks up the DB name of a function call connected to the argument of a compiled material.
virtual bool depends_on_uniform_scene_data() const =0
Indicates whether the compiled material depends on uniform scene data.
virtual bool is_valid(IMdl_execution_context *context) const =0
Indicates whether the compiled material is valid.
A direct call expression.
Definition: iexpression.h:239
The interface to MDL expressions.
Definition: iexpression.h:51
The execution context can be used to query status information like error and warning messages concern...
Definition: imdl_execution_context.h:163
The interface to MDL values.
Definition: ivalue.h:34
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
virtual Uint32 release() const =0
Decrements the reference count.
int Sint32
32-bit signed integer.
Definition: types.h:46
float Float32
32-bit float.
Definition: types.h:51
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Material_slot
Material slots identify parts of a compiled material.
Definition: icompiled_material.h:27
Material_opacity
The opacity of a compiled material.
Definition: icompiled_material.h:55
@ SLOT_BACKFACE_EMISSION_INTENSITY
Slot "backface.emission.intensity".
Definition: icompiled_material.h:35
@ SLOT_BACKFACE_SCATTERING
Slot "backface.scattering".
Definition: icompiled_material.h:33
@ SLOT_SURFACE_EMISSION_INTENSITY
Slot "surface.emission.intensity".
Definition: icompiled_material.h:31
@ SLOT_FIRST
First slot.
Definition: icompiled_material.h:46
@ SLOT_IOR
Slot "ior".
Definition: icompiled_material.h:37
@ SLOT_GEOMETRY_DISPLACEMENT
Slot "geometry.displacement".
Definition: icompiled_material.h:42
@ SLOT_VOLUME_EMISSION_INTENSITY
Slot "volume.emission_intensity".
Definition: icompiled_material.h:41
@ SLOT_GEOMETRY_NORMAL
Slot "geometry.normal".
Definition: icompiled_material.h:44
@ SLOT_SURFACE_SCATTERING
Slot "surface.scattering".
Definition: icompiled_material.h:29
@ SLOT_THIN_WALLED
Slot "thin_walled".
Definition: icompiled_material.h:28
@ SLOT_VOLUME_ABSORPTION_COEFFICIENT
Slot "volume.absorption_coefficient".
Definition: icompiled_material.h:39
@ SLOT_HAIR
Slot "hair".
Definition: icompiled_material.h:45
@ SLOT_BACKFACE_EMISSION_EDF_EMISSION
Slot "backface.emission.emission".
Definition: icompiled_material.h:34
@ SLOT_GEOMETRY_CUTOUT_OPACITY
Slot "geometry.cutout_opacity".
Definition: icompiled_material.h:43
@ SLOT_BACKFACE_EMISSION_MODE
Slot "backface.emission.mode".
Definition: icompiled_material.h:36
@ SLOT_LAST
Last slot.
Definition: icompiled_material.h:47
@ SLOT_SURFACE_EMISSION_EDF_EMISSION
Slot "surface.emission.emission".
Definition: icompiled_material.h:30
@ SLOT_VOLUME_SCATTERING
Slot "volume.scattering".
Definition: icompiled_material.h:38
@ SLOT_SURFACE_EMISSION_MODE
Slot "surface.emission.mode".
Definition: icompiled_material.h:32
@ SLOT_VOLUME_SCATTERING_COEFFICIENT
Slot "volume.scattering_coefficient".
Definition: icompiled_material.h:40
@ OPACITY_TRANSPARENT
The material is transparent.
Definition: icompiled_material.h:59
@ OPACITY_UNKNOWN
The opacity of the material is unknown, e.g., because it depends on parameters.
Definition: icompiled_material.h:61
@ OPACITY_OPAQUE
The material is opaque.
Definition: icompiled_material.h:57
Expressions of the MDL type system.
Base class for all scene elements.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: neuraylib.h:179
Major and minor version number and an optional qualifier.
A 128 bit representation of a universally unique identifier (UUID or GUID).
Definition: uuid.h:26