Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ifunction_definition.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  * Copyright 2018 NVIDIA Corporation. All rights reserved.
3  **************************************************************************************************/
6 
7 #ifndef MI_NEURAYLIB_IFUNCTION_DEFINITION_H
8 #define MI_NEURAYLIB_IFUNCTION_DEFINITION_H
9 
10 #include <cstring>
11 
14 
15 namespace mi {
16 
17 namespace neuraylib {
18 
23 class IFunction_call;
24 
34 class IFunction_definition : public
35  mi::base::Interface_declare<0x3504744d,0xd45b,0x4a99,0xb6,0x21,0x10,0x9e,0xd5,0xcb,0x36,0xc1,
36  neuraylib::IScene_element>
37 {
38 public:
39 
46  enum Semantics
47  {
48  DS_UNKNOWN = 0,
49 
58 
60 
61  // Unary operators
62  DS_OPERATOR_FIRST = 0x0200,
63  DS_UNARY_FIRST = DS_OPERATOR_FIRST,
64  DS_BITWISE_COMPLEMENT = DS_UNARY_FIRST,
72  DS_UNARY_LAST = DS_POST_DECREMENT,
73 
74  // Binary operators
75  DS_BINARY_FIRST,
76  DS_SELECT = DS_BINARY_FIRST,
110  DS_BINARY_LAST = DS_SEQUENCE,
111 
112  // Ternary operator
114  DS_OPERATOR_LAST = DS_TERNARY,
115 
116  // ::math module intrinsics
117  DS_INTRINSIC_MATH_FIRST = 0x0300,
119  = DS_INTRINSIC_MATH_FIRST,
177  DS_INTRINSIC_MATH_LAST = DS_INTRINSIC_MATH_DY,
178 
179  // ::state module intrinsics
180  DS_INTRINSIC_STATE_FIRST = 0x0400,
182  = DS_INTRINSIC_STATE_FIRST,
207  DS_INTRINSIC_STATE_LAST = DS_INTRINSIC_STATE_WAVELENGTH_MAX,
208 
209  // ::tex module intrinsics
210  DS_INTRINSIC_TEX_FIRST = 0x0500,
212  = DS_INTRINSIC_TEX_FIRST,
226  DS_INTRINSIC_TEX_LAST = DS_INTRINSIC_TEX_TEXTURE_ISVALID,
227 
228  // ::df module intrinsics
229  DS_INTRINSIC_DF_FIRST = 0x0600,
230 
232  = DS_INTRINSIC_DF_FIRST,
236 
276  DS_INTRINSIC_DF_LAST = DS_INTRINSIC_DF_FRESNEL_FACTOR,
277 
278 #ifndef MDL_SOURCE_RELEASE
279  // ::nvidia::df module intrinsics
280  DS_INTRINSIC_NVIDIA_DF_FIRST = 0x0700,
281 
302  DS_INTRINSIC_NVIDIA_DF_LAST = DS_INTRINSIC_NVIDIA_DF_LEGACY_MCP_GLOSSY_BSDF,
303 #endif
304 
305  // ::debug module intrinsics
306  DS_INTRINSIC_DEBUG_FIRST = 0x0800,
307 
309  = DS_INTRINSIC_DEBUG_FIRST,
312  DS_INTRINSIC_DEBUG_LAST = DS_INTRINSIC_DEBUG_PRINT,
313 
314  // DAG backend intrinsics
315  DS_INTRINSIC_DAG_FIRST = 0x0900,
317  DS_INTRINSIC_DAG_FIELD_ACCESS = DS_INTRINSIC_DAG_FIRST,
321  DS_INTRINSIC_DAG_LAST = DS_INTRINSIC_DAG_ARRAY_LENGTH,
322 
323  DS_FORCE_32_BIT = 0xffffffffU // Undocumented, for alignment only.
324  };
325 
329  virtual const char* get_module() const = 0;
330 
337  virtual const char* get_mdl_name() const = 0;
338 
341  virtual const char* get_prototype() const = 0;
342 
344  virtual Semantics get_semantic() const = 0;
345 
349  inline bool is_array_constructor() const { return strcmp( get_mdl_name(), "T[](...)") == 0; }
350 
352  virtual bool is_exported() const = 0;
353 
359  virtual bool is_uniform() const = 0;
360 
364  virtual const IType* get_return_type() const = 0;
365 
376  template<class T>
377  const T* get_return_type() const
378  {
379  const IType* ptr_itype = get_return_type();
380  if ( !ptr_itype)
381  return 0;
382  const T* ptr_T = static_cast<const T*>( ptr_itype->get_interface( typename T::IID()));
383  ptr_itype->release();
384  return ptr_T;
385  }
386 
388  virtual Size get_parameter_count() const = 0;
389 
394  virtual const char* get_parameter_name( Size index) const = 0;
395 
400  virtual Size get_parameter_index( const char* name) const = 0;
401 
403  virtual const IType_list* get_parameter_types() const = 0;
404 
410  virtual const IExpression_list* get_defaults() const = 0;
411 
418  virtual const IExpression_list* get_enable_if_conditions() const = 0;
419 
426  virtual Size get_enable_if_users(Size index) const = 0;
427 
435  virtual Size get_enable_if_user(Size index, Size u_index) const = 0;
436 
439  virtual const IAnnotation_block* get_annotations() const = 0;
440 
443  virtual const IAnnotation_block* get_return_annotations() const = 0;
444 
451  virtual const IAnnotation_list* get_parameter_annotations() const = 0;
452 
461  virtual const char* get_thumbnail() const = 0;
462 
494  const IExpression_list* arguments, Sint32* errors = 0) const = 0;
495 };
496  // end group mi_neuray_mdl_elements
498 
499 } // namespace neuraylib
500 
501 } // namespace mi
502 
503 #endif // MI_NEURAYLIB_IFUNCTION_DEFINITION_H