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 2019 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 
24 enum Material_slot {
42  SLOT_FORCE_32_BIT = 0xffffffffU
43 };
44 
45 mi_static_assert( sizeof( Material_slot) == sizeof( mi::Uint32));
46 
73 class ICompiled_material : public
74  mi::base::Interface_declare<0x3115ab0f,0x7a91,0x4651,0xa5,0x9a,0xfd,0xb0,0x23,0x16,0xb4,0xb7,
75  neuraylib::IScene_element>
76 {
77 public:
79 
80 
82  virtual const IExpression_direct_call* get_body() const = 0;
83 
84 #ifdef MI_NEURAYLIB_DEPRECATED_8_1
85  const IExpression* get_field( const char* name) const
86  {
88  mi::base::Handle<const IExpression_list> arguments( body->get_arguments());
89  return arguments->get_expression( name);
90  }
91 
92  template<class T>
93  const T* get_field( const char* name) const
94  {
96  mi::base::Handle<const IExpression_list> arguments( body->get_arguments());
97  return arguments->get_expression<T>( name);
98  }
99 #endif
100 
102  virtual Size get_temporary_count() const = 0;
103 
109  virtual const IExpression* get_temporary( Size index) const = 0;
110 
123  template<class T>
124  const T* get_temporary( Size index) const
125  {
126  const IExpression* ptr_iexpression = get_temporary( index);
127  if ( !ptr_iexpression)
128  return 0;
129  const T* ptr_T = static_cast<const T*>( ptr_iexpression->get_interface( typename T::IID()));
130  ptr_iexpression->release();
131  return ptr_T;
132  }
133 
135  virtual Float32 get_mdl_meters_per_scene_unit() const = 0;
136 
138  virtual Float32 get_mdl_wavelength_min() const = 0;
139 
141  virtual Float32 get_mdl_wavelength_max() const = 0;
142 
145  virtual bool depends_on_state_transform() const = 0;
146 
148  virtual bool depends_on_state_object_id() const = 0;
149 
151  virtual bool depends_on_global_distribution() const = 0;
152 
154 
156 
158  virtual Size get_parameter_count() const = 0;
159 
165  virtual const char* get_parameter_name( Size index) const = 0;
166 
171  virtual const IValue* get_argument( Size index) const = 0;
172 
184  template<class T>
185  const T* get_argument( Size index) const
186  {
187  const IValue* ptr_ivalue = get_argument( index);
188  if ( !ptr_ivalue)
189  return 0;
190  const T* ptr_T = static_cast<const T*>( ptr_ivalue->get_interface( typename T::IID()));
191  ptr_ivalue->release();
192  return ptr_T;
193  }
194 
214  virtual base::Uuid get_hash() const = 0;
215 
235  virtual base::Uuid get_slot_hash( Material_slot slot) const = 0;
236 
243  virtual const IExpression* lookup_sub_expression( const char* path) const = 0;
244 
245 
278  const char* material_instance_name,
279  Size parameter_index,
280  Sint32* errors = 0) const = 0;
281 
283 };
284  // end group mi_neuray_mdl_elements
286 
287 } // namespace neuraylib
288 
289 } // namespace mi
290 
291 #endif // MI_NEURAYLIB_ICOMPILED_MATERIAL_H