Loading...
Searching...
No Matches
scaledmodel.h
Go to the documentation of this file.
1#ifndef _BBM_SCALED_MODEL_H_
2#define _BBM_SCALED_MODEL_H_
3
4#include "bbm/bsdfmodel.h"
5
6/************************************************************************/
7/*! \file scaledmodel.h
8
9 \brief Add an 'albedo' parameter to an existing bsdfmodel and scale the
10 albedo and eval respectively.
11
12************************************************************************/
13
14namespace bbm {
15
16 /*********************************************************************/
17 /*! \brief Scaled BSDF model.
18
19 \tparam BSDFMODEL = bsdf model to scale; must be default constructible.
20 \tparam FLAG = bsdf_attr flag of the albedo attribute
21 \tparam NAME = model name (default copy name from BSDFMODEL)
22
23 Implements: concepts::bsdfmodel
24 **********************************************************************/
25 template<typename BSDFMODEL,
27 string_literal NAME = BSDFMODEL::name
28 > requires concepts::bsdfmodel<BSDFMODEL> && concepts::reflection::attributes<BSDFMODEL> && std::constructible_from<BSDFMODEL>
29 struct scaledmodel : public BSDFMODEL
30 {
31 BBM_BASETYPES( BSDFMODEL );
32 BBM_IMPORT_CONFIG( BSDFMODEL );
33 static constexpr string_literal name = NAME;
35
36 // Copy sample and pdf unchanged from BSDFMODEL.
37 using BSDFMODEL::sample;
38 using BSDFMODEL::pdf;
39
40 /********************************************************************/
41 /*! \brief Evaluate the albedo*BSDFMODEL::eval
42
43 \param in = incident direction
44 \param out = outgoing direction
45 \param component = which reflectance component to eval
46 \param unit = unit of computation (ignored)
47 \param mask = masking of lanes (e.g., for Packet eval)
48 \returns Evaluation of the BSDF per spectrum.
49 *********************************************************************/
50 Spectrum eval(const Vec3d& in, const Vec3d& out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
51 {
52 return BSDFMODEL::eval(in, out, component, unit, mask) * albedo;
53 }
54
55 /*******************************************************************/
56 /*! \brief Return albedo*BSSFMODEL::reflectance
57
58 \param out = the outgoing direction
59 \param component = which reflectance component to eval
60 \param unit = unit of computation (ignored)
61 \param mask = masking of lanes
62 \returns the approximate hemispherical reflectance of the BSDF for a given direction
63 ********************************************************************/
64 Spectrum reflectance(const Vec3d& out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
65 {
66 return BSDFMODEL::reflectance(out, component, unit, mask) * albedo;
67 }
68
69
70 //////////////////////////
71 //! @{ Class Attributes
72 //////////////////////////
74
76 //! @}
77
78 //! \brief Default constructor
80 };
81
82} // end bbm namespace
83
84#endif /* _BBM_SCALED_MODEL_H_ */
All includes and helpers needed for declaring new bsdfmodels.
Definition: aggregatebsdf.h:29
bsdf_attr
Attribute Property Flags.
Definition: bsdf_attr_flag.h:17
unit_t
Light Unit.
Definition: unit.h:21
Base declaration of attribute; further specialized below.
Definition: attribute.h:26
Scaled BSDF model.
Definition: scaledmodel.h:30
BBM_BSDF_FORWARD
Definition: scaledmodel.h:34
BBM_DEFAULT_CONSTRUCTOR(scaledmodel)
Default constructor.
Definition: scaledmodel.h:79
bsdf_scale< Spectrum, FLAG > albedo
Class Attributes.
Definition: scaledmodel.h:73
Spectrum eval(const Vec3d &in, const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
Evaluate the albedo*BSDFMODELeval.
Definition: scaledmodel.h:50
Spectrum reflectance(const Vec3d &out, BsdfFlag component=bsdf_flag::All, unit_t unit=unit_t::Radiance, Mask mask=true) const
Return albedo*BSSFMODELreflectance.
Definition: scaledmodel.h:64
BBM_BASETYPES(BSDFMODEL)
BBM_IMPORT_CONFIG(BSDFMODEL)
BBM_ATTRIBUTES(albedo)
static constexpr string_literal name
Definition: scaledmodel.h:33
Definition: string_literal.h:16