MDL SDK API nvidia_logo_transpbg.gif Up
icompiled_material.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2022 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_ICOMPILED_MATERIAL_H
8#define MI_NEURAYLIB_ICOMPILED_MATERIAL_H
9
13
14namespace mi {
15
16namespace neuraylib {
17
18class IMdl_execution_context;
19
48 SLOT_FORCE_32_BIT = 0xffffffffU
49};
50
51mi_static_assert( sizeof( Material_slot) == sizeof( mi::Uint32));
52
61 OPACITY_FORCE_32_BIT = 0xffffffffU
62};
63
64mi_static_assert( sizeof( Material_opacity) == sizeof( mi::Uint32));
65
92class ICompiled_material : public
93 mi::base::Interface_declare<0x3115ab0f,0x7a91,0x4651,0xa5,0x9a,0xfd,0xb0,0x23,0x16,0xb4,0xb7,
94 neuraylib::IScene_element>
95{
96public:
98
99
101 virtual const IExpression_direct_call* get_body() const = 0;
102
104 virtual Size get_temporary_count() const = 0;
105
111 virtual const IExpression* get_temporary( Size index) const = 0;
112
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
138
140 virtual Float32 get_mdl_wavelength_min() const = 0;
141
143 virtual Float32 get_mdl_wavelength_max() const = 0;
144
147 virtual bool depends_on_state_transform() const = 0;
148
150 virtual bool depends_on_state_object_id() const = 0;
151
153 virtual bool depends_on_global_distribution() const = 0;
154
156 virtual bool depends_on_uniform_scene_data() const = 0;
157
160
164 virtual const char* get_referenced_scene_data_name( Size index) const = 0;
165
167
169
171 virtual Size get_parameter_count() const = 0;
172
178 virtual const char* get_parameter_name( Size index) const = 0;
179
184 virtual const IValue* get_argument( Size index) const = 0;
185
197 template<class T>
198 const T* get_argument( Size index) const
199 {
200 const IValue* ptr_ivalue = get_argument( index);
201 if ( !ptr_ivalue)
202 return 0;
203 const T* ptr_T = static_cast<const T*>( ptr_ivalue->get_interface( typename T::IID()));
204 ptr_ivalue->release();
205 return ptr_T;
206 }
207
227 virtual base::Uuid get_hash() const = 0;
228
248 virtual base::Uuid get_slot_hash( Material_slot slot) const = 0;
249
256 virtual const IExpression* lookup_sub_expression( const char* path) const = 0;
257
258
291 const char* material_instance_name,
292 Size parameter_index,
293 Sint32* errors = 0) const = 0;
294
300 virtual Material_opacity get_opacity() const = 0;
301
306
313 virtual bool get_cutout_opacity( Float32* cutout_opacity) const = 0;
314
322 virtual bool is_valid( IMdl_execution_context* context) const = 0;
323
325};
326 // end group mi_neuray_mdl_elements
328
329} // namespace neuraylib
330
331} // namespace mi
332
333#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:95
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: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 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:198
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:202
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:126
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:65
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:47
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:110
float Float32
32-bit float.
Definition: types.h:49
signed int Sint32
32-bit signed integer.
Definition: types.h:44
Material_slot
Material slots identify parts of a compiled material.
Definition: icompiled_material.h:27
Material_opacity
The compiled material's opacity.
Definition: icompiled_material.h:57
@ 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
material is transparent
Definition: icompiled_material.h:59
@ OPACITY_UNKNOWN
material might be transparent
Definition: icompiled_material.h:60
@ OPACITY_OPAQUE
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
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