NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bsdf_isotropic_data.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
7 //*****************************************************************************
8 
9 #ifndef MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H
10 #define MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H
11 
12 #include <mi/base/handle.h>
15 #include <mi/neuraylib/version.h>
16 
17 namespace mi {
18 
19 namespace neuraylib {
20 
25 class Bsdf_buffer : public mi::base::Interface_implement<neuraylib::IBsdf_buffer>
32 {
33 public:
37  Bsdf_buffer( Size size) : m_buffer( new Float32[size]()) { }
38 
40  ~Bsdf_buffer() { delete[] m_buffer; }
41 
43  const Float32* get_data() const { return m_buffer; }
44 
46  Float32* get_data() { return m_buffer; }
47 
48 private:
49  Float32* m_buffer;
50 };
51 
61 class Bsdf_isotropic_data : public mi::base::Interface_implement<neuraylib::IBsdf_isotropic_data>
62 {
63 public:
65  Bsdf_isotropic_data( Uint32 resolution_theta, Uint32 resolution_phi, Bsdf_type type)
66  : m_resolution_theta( resolution_theta),
67  m_resolution_phi( resolution_phi),
68  m_type( type)
69  {
70  Size size = resolution_theta * resolution_theta * resolution_phi;
71  if( type == BSDF_RGB)
72  size *= 3;
73  m_bsdf_buffer = new Bsdf_buffer( size);
74  }
75 
77  Uint32 get_resolution_theta() const { return m_resolution_theta; }
78 
80  Uint32 get_resolution_phi() const { return m_resolution_phi; }
81 
83  Bsdf_type get_type() const { return m_type; }
84 
86  const Bsdf_buffer* get_bsdf_buffer() const
87  { m_bsdf_buffer->retain(); return m_bsdf_buffer.get(); }
88 
91  { m_bsdf_buffer->retain(); return m_bsdf_buffer.get(); }
92 
93 private:
94  Uint32 m_resolution_theta;
95  Uint32 m_resolution_phi;
96  Bsdf_type m_type;
97  base::Handle<Bsdf_buffer> m_bsdf_buffer;
98 };
99  // end group mi_neuray_misc
101 
102 } // namespace neuraylib
103 
104 #ifdef MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
105 using neuraylib::BSDF_RGB;
106 using neuraylib::Bsdf_buffer;
107 using neuraylib::Bsdf_isotropic_data;
109 using neuraylib::IBsdf_buffer;
110 using neuraylib::IBsdf_isotropic_data;
111 #endif // MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
112 
113 } // namespace mi
114 
115 #endif // MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H