MDL SDK API nvidia_logo_transpbg.gif Up
bsdf_isotropic_data.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
7
8#ifndef MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H
9#define MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H
10
11#include <mi/base/handle.h>
14
15namespace mi {
16
17namespace neuraylib {
18
29class Bsdf_buffer : public mi::base::Interface_implement<neuraylib::IBsdf_buffer>
30{
31public:
35 Bsdf_buffer( Size size) : m_buffer( new Float32[size]()) { }
36
38 ~Bsdf_buffer() { delete[] m_buffer; }
39
41 const Float32* get_data() const { return m_buffer; }
42
44 Float32* get_data() { return m_buffer; }
45
46private:
47 Float32* m_buffer;
48};
49
59class Bsdf_isotropic_data : public mi::base::Interface_implement<neuraylib::IBsdf_isotropic_data>
60{
61public:
63 Bsdf_isotropic_data( Uint32 resolution_theta, Uint32 resolution_phi, Bsdf_type type)
64 : m_resolution_theta( resolution_theta),
65 m_resolution_phi( resolution_phi),
66 m_type( type)
67 {
68 Size size = resolution_theta * resolution_theta * resolution_phi;
69 if( type == BSDF_RGB)
70 size *= 3;
71 m_bsdf_buffer = new Bsdf_buffer( size);
72 }
73
75 Uint32 get_resolution_theta() const { return m_resolution_theta; }
76
78 Uint32 get_resolution_phi() const { return m_resolution_phi; }
79
81 Bsdf_type get_type() const { return m_type; }
82
85 { m_bsdf_buffer->retain(); return m_bsdf_buffer.get(); }
86
89 { m_bsdf_buffer->retain(); return m_bsdf_buffer.get(); }
90
91private:
92 Uint32 m_resolution_theta;
93 Uint32 m_resolution_phi;
94 Bsdf_type m_type;
95 base::Handle<Bsdf_buffer> m_bsdf_buffer;
96};
97 // end group mi_neuray_misc
99
100} // namespace neuraylib
101
102} // namespace mi
103
104#endif // MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:113
Mixin class template for deriving interface implementations.
Definition: interface_implement.h:41
Example implementation of the abstract interface mi::neuraylib::IBsdf_buffer.
Definition: bsdf_isotropic_data.h:30
const Float32 * get_data() const
Gives access to the memory block (const).
Definition: bsdf_isotropic_data.h:41
Float32 * get_data()
Gives access to the memory block (mutable).
Definition: bsdf_isotropic_data.h:44
~Bsdf_buffer()
Destructor.
Definition: bsdf_isotropic_data.h:38
Bsdf_buffer(Size size)
Constructor.
Definition: bsdf_isotropic_data.h:35
Example implementation of the abstract interface mi::neuraylib::IBsdf_isotropic_data.
Definition: bsdf_isotropic_data.h:60
Uint32 get_resolution_phi() const
Returns the number of values in phi direction.
Definition: bsdf_isotropic_data.h:78
Uint32 get_resolution_theta() const
Returns the number of values in theta direction.
Definition: bsdf_isotropic_data.h:75
Bsdf_type get_type() const
Returns the type of the values.
Definition: bsdf_isotropic_data.h:81
Bsdf_buffer * get_bsdf_buffer()
Returns the buffer containing the values (mutable).
Definition: bsdf_isotropic_data.h:88
Bsdf_isotropic_data(Uint32 resolution_theta, Uint32 resolution_phi, Bsdf_type type)
Constructor.
Definition: bsdf_isotropic_data.h:63
const Bsdf_buffer * get_bsdf_buffer() const
Returns the buffer containing the values (const).
Definition: bsdf_isotropic_data.h:84
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
float Float32
32-bit float.
Definition: types.h:51
Bsdf_type
The BSDF type.
Definition: ibsdf_isotropic_data.h:23
@ BSDF_RGB
Three scalars (RGB) per grid value.
Definition: ibsdf_isotropic_data.h:25
Smart-pointer handle class for interfaces, const and non-const version.
Abstract interfaces related to scene element Bsdf_measurement.
Mixin class template for deriving interface implementations.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5