Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
icompiled_material.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  * Copyright 2020 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>
13 
14 namespace mi {
15 
16 namespace neuraylib {
17 
18  class IMaterial_instance;
19  class IMdl_execution_context;
20 
25 enum Material_slot {
44  SLOT_FORCE_32_BIT = 0xffffffffU
45 };
46 
47 mi_static_assert( sizeof( Material_slot) == sizeof( mi::Uint32));
48 
54  OPACITY_FORCE_32_BIT = 0xffffffffU
55 };
56 
57 mi_static_assert( sizeof( Material_opacity) == sizeof( mi::Uint32));
58 
85 class ICompiled_material : public
86  mi::base::Interface_declare<0x3115ab0f,0x7a91,0x4651,0xa5,0x9a,0xfd,0xb0,0x23,0x16,0xb4,0xb7,
87  neuraylib::IScene_element>
88 {
89 public:
91 
92 
94  virtual const IExpression_direct_call* get_body() const = 0;
95 
97  virtual Size get_temporary_count() const = 0;
98 
104  virtual const IExpression* get_temporary( Size index) const = 0;
105 
118  template<class T>
119  const T* get_temporary( Size index) const
120  {
121  const IExpression* ptr_iexpression = get_temporary( index);
122  if ( !ptr_iexpression)
123  return 0;
124  const T* ptr_T = static_cast<const T*>( ptr_iexpression->get_interface( typename T::IID()));
125  ptr_iexpression->release();
126  return ptr_T;
127  }
128 
130  virtual Float32 get_mdl_meters_per_scene_unit() const = 0;
131 
133  virtual Float32 get_mdl_wavelength_min() const = 0;
134 
136  virtual Float32 get_mdl_wavelength_max() const = 0;
137 
140  virtual bool depends_on_state_transform() const = 0;
141 
143  virtual bool depends_on_state_object_id() const = 0;
144 
146  virtual bool depends_on_global_distribution() const = 0;
147 
149  virtual Size get_referenced_scene_data_count() const = 0;
150 
154  virtual char const *get_referenced_scene_data_name(Size index) const = 0;
155 
157 
159 
161  virtual Size get_parameter_count() const = 0;
162 
168  virtual const char* get_parameter_name( Size index) const = 0;
169 
174  virtual const IValue* get_argument( Size index) const = 0;
175 
187  template<class T>
188  const T* get_argument( Size index) const
189  {
190  const IValue* ptr_ivalue = get_argument( index);
191  if ( !ptr_ivalue)
192  return 0;
193  const T* ptr_T = static_cast<const T*>( ptr_ivalue->get_interface( typename T::IID()));
194  ptr_ivalue->release();
195  return ptr_T;
196  }
197 
217  virtual base::Uuid get_hash() const = 0;
218 
238  virtual base::Uuid get_slot_hash( Material_slot slot) const = 0;
239 
246  virtual const IExpression* lookup_sub_expression( const char* path) const = 0;
247 
248 
281  const char* material_instance_name,
282  Size parameter_index,
283  Sint32* errors = 0) const = 0;
284 
290  virtual Material_opacity get_opacity() const = 0;
291 
295  virtual Material_opacity get_surface_opacity() const = 0;
296 
303  virtual bool get_cutout_opacity(Float32 *cutout_opacity) const = 0;
304 
312  virtual bool is_valid(IMdl_execution_context *context) const = 0;
313 
315 };
316  // end group mi_neuray_mdl_elements
318 
319 } // namespace neuraylib
320 
321 } // namespace mi
322 
323 #endif // MI_NEURAYLIB_ICOMPILED_MATERIAL_H