MDL SDK API nvidia_logo_transpbg.gif Up
icompiled_material.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_ICOMPILED_MATERIAL_H
8#define MI_NEURAYLIB_ICOMPILED_MATERIAL_H
9
12
13namespace mi {
14
15namespace neuraylib {
16
17class IMdl_execution_context;
18
47 SLOT_FORCE_32_BIT = 0xffffffffU
48};
49
50mi_static_assert( sizeof( Material_slot) == sizeof( mi::Uint32));
51
63 OPACITY_FORCE_32_BIT = 0xffffffffU
64};
65
66mi_static_assert( sizeof( Material_opacity) == sizeof( mi::Uint32));
67
94class ICompiled_material : public
95 mi::base::Interface_declare<0x3115ab0f,0x7a91,0x4651,0xa5,0x9a,0xfd,0xb0,0x23,0x16,0xb4,0xb7,
96 neuraylib::IScene_element>
97{
98public:
100
101
103 virtual const IExpression_direct_call* get_body() const = 0;
104
106 virtual Size get_temporary_count() const = 0;
107
112 virtual const IExpression* get_temporary( Size index) const = 0;
113
125 template<class T>
126 const T* get_temporary( Size index) const
127 {
128 const IExpression* ptr_iexpression = get_temporary( index);
129 if ( !ptr_iexpression)
130 return 0;
131 const T* ptr_T = static_cast<const T*>( ptr_iexpression->get_interface( typename T::IID()));
132 ptr_iexpression->release();
133 return ptr_T;
134 }
135
142 virtual const IExpression* lookup_sub_expression( const char* path) const = 0;
143
151 virtual bool is_valid( IMdl_execution_context* context) const = 0;
152
154
156
161 virtual Size get_parameter_count() const = 0;
162
177 virtual const char* get_parameter_name( Size index) const = 0;
178
183 virtual const IValue* get_argument( Size index) const = 0;
184
196 template<class T>
197 const T* get_argument( Size index) const
198 {
199 const IValue* ptr_ivalue = get_argument( index);
200 if ( !ptr_ivalue)
201 return 0;
202 const T* ptr_T = static_cast<const T*>( ptr_ivalue->get_interface( typename T::IID()));
203 ptr_ivalue->release();
204 return ptr_T;
205 }
206
231 const char* material_instance_name,
232 Size parameter_index,
233 Sint32* errors = 0) const = 0;
234
236
238
241
243 virtual Float32 get_mdl_wavelength_min() const = 0;
244
246 virtual Float32 get_mdl_wavelength_max() const = 0;
247
256 virtual Material_opacity get_opacity() const = 0;
257
265
273
274 virtual bool get_cutout_opacity( Float32* cutout_opacity) const = 0;
275
278
282 virtual const char* get_referenced_scene_data_name( Size index) const = 0;
283
286 virtual bool depends_on_state_transform() const = 0;
287
289 virtual bool depends_on_state_object_id() const = 0;
290
292 virtual bool depends_on_global_distribution() const = 0;
293
295 virtual bool depends_on_uniform_scene_data() const = 0;
296
298
300
321 virtual base::Uuid get_hash() const = 0;
322
332 virtual base::Uuid get_slot_hash( Material_slot slot) const = 0;
333
353 virtual base::Uuid get_sub_expression_hash( const char* path) const = 0;
354
356};
357 // end group mi_neuray_mdl_elements
359
360} // namespace neuraylib
361
362} // namespace mi
363
364#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:97
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:126
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:197
virtual const IString * get_connected_function_db_name(const char *material_instance_name, Size parameter_index, Sint32 *errors=0) const =0
Looks up the DB name of a function call connected to the argument of a compiled material.
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 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:241
The interface to MDL expressions.
Definition: iexpression.h:50
The execution context can be used to query status information like error and warning messages concern...
Definition: imdl_execution_context.h:131
The interface to MDL values.
Definition: ivalue.h:33
#define mi_static_assert(expr)
Compile time assertion that raises a compilation error if the constant expression expr evaluates to f...
Definition: assert.h:58
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.
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
float Float32
32-bit float.
Definition: types.h:51
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Material_slot
Material slots identify parts of a compiled material.
Definition: icompiled_material.h:26
Material_opacity
The opacity of a compiled material.
Definition: icompiled_material.h:56
@ SLOT_BACKFACE_EMISSION_INTENSITY
Slot "backface.emission.intensity".
Definition: icompiled_material.h:34
@ SLOT_BACKFACE_SCATTERING
Slot "backface.scattering".
Definition: icompiled_material.h:32
@ SLOT_SURFACE_EMISSION_INTENSITY
Slot "surface.emission.intensity".
Definition: icompiled_material.h:30
@ SLOT_FIRST
First slot.
Definition: icompiled_material.h:45
@ SLOT_IOR
Slot "ior".
Definition: icompiled_material.h:36
@ SLOT_GEOMETRY_DISPLACEMENT
Slot "geometry.displacement".
Definition: icompiled_material.h:41
@ SLOT_VOLUME_EMISSION_INTENSITY
Slot "volume.emission_intensity".
Definition: icompiled_material.h:40
@ SLOT_GEOMETRY_NORMAL
Slot "geometry.normal".
Definition: icompiled_material.h:43
@ SLOT_SURFACE_SCATTERING
Slot "surface.scattering".
Definition: icompiled_material.h:28
@ SLOT_THIN_WALLED
Slot "thin_walled".
Definition: icompiled_material.h:27
@ SLOT_VOLUME_ABSORPTION_COEFFICIENT
Slot "volume.absorption_coefficient".
Definition: icompiled_material.h:38
@ SLOT_HAIR
Slot "hair".
Definition: icompiled_material.h:44
@ SLOT_BACKFACE_EMISSION_EDF_EMISSION
Slot "backface.emission.emission".
Definition: icompiled_material.h:33
@ SLOT_GEOMETRY_CUTOUT_OPACITY
Slot "geometry.cutout_opacity".
Definition: icompiled_material.h:42
@ SLOT_BACKFACE_EMISSION_MODE
Slot "backface.emission.mode".
Definition: icompiled_material.h:35
@ SLOT_LAST
Last slot.
Definition: icompiled_material.h:46
@ SLOT_SURFACE_EMISSION_EDF_EMISSION
Slot "surface.emission.emission".
Definition: icompiled_material.h:29
@ SLOT_VOLUME_SCATTERING
Slot "volume.scattering".
Definition: icompiled_material.h:37
@ SLOT_SURFACE_EMISSION_MODE
Slot "surface.emission.mode".
Definition: icompiled_material.h:31
@ SLOT_VOLUME_SCATTERING_COEFFICIENT
Slot "volume.scattering_coefficient".
Definition: icompiled_material.h:39
@ OPACITY_TRANSPARENT
The material is transparent.
Definition: icompiled_material.h:60
@ OPACITY_UNKNOWN
The opacity of the material is unknown, e.g., because it depends on parameters.
Definition: icompiled_material.h:62
@ OPACITY_OPAQUE
The material is opaque.
Definition: icompiled_material.h:58
Expressions of the MDL type system.
Base class for all scene elements.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
A 128 bit representation of a universally unique identifier (UUID or GUID).
Definition: uuid.h:26