NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
imdl_material_instance.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_IMDL_MATERIAL_INSTANCE_H
9 #define MI_NEURAYLIB_IMDL_MATERIAL_INSTANCE_H
10 
13 #include <mi/neuraylib/version.h>
14 
15 namespace mi {
16 
17 namespace neuraylib {
18 
23 class IAttribute_container;
24 class IMdl_compiled_material;
25 
35 class IMdl_material_instance : public
36  mi::base::Interface_declare<0xf265a300,0x01d9,0x4b65,0xb9,0x64,0xd4,0x78,0xde,0x7c,0xeb,0xf2,
37  neuraylib::IScene_element>
38 {
39 public:
45  virtual const char* get_material_definition() const = 0;
46 
54  virtual const char* get_name() const = 0;
55 
59  virtual Uint32 get_parameter_count() const = 0;
60 
65  virtual const char* get_parameter_name( Uint32 index) const = 0;
66 
71  virtual Sint32 get_parameter_index( const char* name) const = 0;
72 
80  virtual const char* get_parameter_type( Uint32 index) const = 0;
81 
86  virtual const char* get_parameter_type( const char* name) const = 0;
87 
93  virtual bool is_parameter_type_uniform( Uint32 index) const = 0;
94 
100  virtual bool is_parameter_type_uniform( const char* name) const = 0;
101 
113  virtual const char* get_argument_type( Uint32 index) const = 0;
114 
123  virtual const char* get_argument_type( const char* name) const = 0;
124 
135  virtual const IAttachable* get_argument( Uint32 index) const = 0;
136 
154  template<class T>
155  const T* get_argument( Uint32 index) const
156  {
157  const IAttachable* ptr_idata = get_argument( index);
158  if ( !ptr_idata)
159  return 0;
160  const T* ptr_T = static_cast<const T*>( ptr_idata->get_interface( typename T::IID()));
161  ptr_idata->release();
162  return ptr_T;
163  }
164 
172  virtual const IAttachable* get_argument( const char* name) const = 0;
173 
188  template<class T>
189  const T* get_argument( const char* name) const
190  {
191  const IAttachable* ptr_idata = get_argument( name);
192  if ( !ptr_idata)
193  return 0;
194  const T* ptr_T = static_cast<const T*>( ptr_idata->get_interface( typename T::IID()));
195  ptr_idata->release();
196  return ptr_T;
197  }
198 
214  virtual Sint32 set_argument( Uint32 index, const IAttachable* value) = 0;
215 
231  virtual Sint32 set_argument( const char* name, const IAttachable* value) = 0;
232 
236  virtual const IAttribute_container* access_arguments() const = 0;
237 
252  virtual Sint32 set_arguments( const IAttribute_container* arguments) = 0;
253 
260  COMPILATION_OPTIONS_FORCE_32_BIT = 0xffffffffU // Undocumented, for alignment only
261  };
262 
263  mi_static_assert( sizeof( Compilation_options) == sizeof( Uint32));
264 
278  Uint32 flags = 0, Float32 mdl_meters_per_scene_unit = 1.0f, Sint32* errors = 0) const = 0;
279 };
280  // end group mi_neuray_materials
282 
283 } // namespace neuraylib
284 
285 #ifdef MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
286 using neuraylib::IAttribute_container;
287 using neuraylib::IMdl_compiled_material;
288 using neuraylib::IMdl_material_instance;
289 using neuraylib::IScene_element;
290 #endif // MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
291 
292 } // namespace mi
293 
294 #endif // MI_NEURAYLIB_IMDL_MATERIAL_INSTANCE_H