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
60 OPACITY_FORCE_32_BIT = 0xffffffffU
61};
62
63mi_static_assert( sizeof( Material_opacity) == sizeof( mi::Uint32));
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
110 virtual const IExpression* get_temporary( Size index) const = 0;
111
124 template<class T>
125 const T* get_temporary( Size index) const
126 {
127 const IExpression* ptr_iexpression = get_temporary( index);
128 if ( !ptr_iexpression)
129 return 0;
130 const T* ptr_T = static_cast<const T*>( ptr_iexpression->get_interface( typename T::IID()));
131 ptr_iexpression->release();
132 return ptr_T;
133 }
134
137
139 virtual Float32 get_mdl_wavelength_min() const = 0;
140
142 virtual Float32 get_mdl_wavelength_max() const = 0;
143
146 virtual bool depends_on_state_transform() const = 0;
147
149 virtual bool depends_on_state_object_id() const = 0;
150
152 virtual bool depends_on_global_distribution() const = 0;
153
155 virtual bool depends_on_uniform_scene_data() const = 0;
156
159
163 virtual const char* get_referenced_scene_data_name( Size index) const = 0;
164
166
168
170 virtual Size get_parameter_count() const = 0;
171
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
227 virtual base::Uuid get_hash() const = 0;
228
249 virtual base::Uuid get_slot_hash( Material_slot slot) const = 0;
250
257 virtual const IExpression* lookup_sub_expression( const char* path) const = 0;
258
259
292 const char* material_instance_name,
293 Size parameter_index,
294 Sint32* errors = 0) const = 0;
295
301 virtual Material_opacity get_opacity() const = 0;
302
307
314 virtual bool get_cutout_opacity( Float32* cutout_opacity) const = 0;
315
323 virtual bool is_valid( IMdl_execution_context* context) const = 0;
324
326};
327 // end group mi_neuray_mdl_elements
329
330} // namespace neuraylib
331
332} // namespace mi
333
334#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 used by this compiled material.
const T * get_temporary(Size index) const
Returns the expression of a temporary.
Definition: icompiled_material.h:125
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 this 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 this 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 database name of the mdl instance connected to the argument of a compiled material.
virtual const IExpression_direct_call * get_body() const =0
Returns the direct call expression that represents the body of the compiled material.
virtual Float32 get_mdl_meters_per_scene_unit() const =0
Returns the conversion ration between meters and scene units for this material.
virtual bool get_cutout_opacity(Float32 *cutout_opacity) const =0
Returns the cutout opacity of the material if it is 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 this material depends on coordinate space transformations like state::transform() a...
virtual Material_opacity get_surface_opacity() const =0
Returns the surface opacity of the material by checking, if a transmissive BSDF is present in the sur...
virtual Float32 get_mdl_wavelength_max() const =0
Returns the largest supported wavelength.
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 instance.
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 material.
virtual const IExpression * get_temporary(Size index) const =0
Returns the expression of 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 instance.
virtual bool depends_on_uniform_scene_data() const =0
Indicates whether this material depends on uniform scene data.
virtual bool is_valid(IMdl_execution_context *context) const =0
Returns true, if the compiled material is valid, false otherwise.
A direct call expression.
Definition: iexpression.h:239
The interface to MDL expressions.
Definition: iexpression.h:48
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 compiled material's opacity.
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
material is transparent
Definition: icompiled_material.h:58
@ OPACITY_UNKNOWN
material might be transparent
Definition: icompiled_material.h:59
@ OPACITY_OPAQUE
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: example_derivatives.dox:5
A 128 bit representation of a universally unique identifier (UUID or GUID).
Definition: uuid.h:26