bsdf_isotropic_data.h File Reference
Description
Example implementations for abstract interfaces related to scene element Bsdf_measurement.
Code Example
bsdf_isotropic_data.h
/***************************************************************************************************
* Copyright 2024 NVIDIA Corporation. All rights reserved.
**************************************************************************************************/
#ifndef MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H
#define MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H
#include <mi/base/handle.h>
#include <mi/base/interface_implement.h>
#include <mi/neuraylib/ibsdf_isotropic_data.h>
namespace mi {
namespace neuraylib {
class Bsdf_buffer : public mi::base::Interface_implement<neuraylib::IBsdf_buffer>
{
public:
Bsdf_buffer( Size size) : m_buffer( new Float32[size]()) { }
~Bsdf_buffer() { delete[] m_buffer; }
const Float32* get_data() const { return m_buffer; }
Float32* get_data() { return m_buffer; }
private:
Float32* m_buffer;
};
class Bsdf_isotropic_data : public mi::base::Interface_implement<neuraylib::IBsdf_isotropic_data>
{
public:
Bsdf_isotropic_data( Uint32 resolution_theta, Uint32 resolution_phi, Bsdf_type type)
: m_resolution_theta( resolution_theta),
m_resolution_phi( resolution_phi),
m_type( type)
{
Size size = resolution_theta * resolution_theta * resolution_phi;
if( type == BSDF_RGB)
size *= 3;
m_bsdf_buffer = new Bsdf_buffer( size);
}
Uint32
get_resolution_theta() const { return m_resolution_theta; }
Uint32
get_resolution_phi() const { return m_resolution_phi; }
Bsdf_type
get_type() const { return m_type; }
const Bsdf_buffer* get_bsdf_buffer() const
{ m_bsdf_buffer->retain(); return m_bsdf_buffer.get(); }
Bsdf_buffer* get_bsdf_buffer()
{ m_bsdf_buffer->retain(); return m_bsdf_buffer.get(); }
private:
Uint32 m_resolution_theta;
Uint32 m_resolution_phi;
Bsdf_type m_type;
base::Handle< Bsdf_buffer> m_bsdf_buffer;
};
// end group mi_neuray_misc
} // namespace neuraylib
} // namespace mi
#endif // MI_NEURAYLIB_BSDF_ISOTROPIC_DATA_H
Namespaces
- namespace
- Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
- namespace
- Namespace for the neuray API. More...