Loading...
Searching...
No Matches
bsdfmodel.h
Go to the documentation of this file.
1#ifndef _BBM_BSDFMODEL_H_
2#define _BBM_BSDFMODEL_H_
3
4#include "concepts/macro.h"
6
7#include "util/reflection.h"
8
9#include "core/spherical.h"
10#include "core/transform.h"
11#include "core/precompute.h"
12#include "core/vec_transform.h"
13#include "core/shading_frame.h"
14
15#include "bbm/unit.h"
16#include "bbm/config.h"
17#include "bbm/fresnel.h"
18#include "bbm/constructor.h"
19#include "bbm/bsdfsample.h"
20#include "bbm/bsdf_attribute.h"
21#include "bbm/bsdf_symmetry.h"
22
23
24/************************************************************************/
25/*! \file bsdfmodel.h
26
27 \brief All includes and helpers needed for declaring new bsdfmodels
28
29 Convention regarding 'in' and 'out directions. BSDF models follow the in-out
30 convention of Eric Veach, namely 'in' is the sampled direction, and
31 transport flows from -in to out. The physical meaning of 'in' and 'out'
32 switches between the regular bsdf (Radiance) and the adjoint bsdf
33 (Importance).
34
35 Thus for unit_t:Radiance: in == light and out = view.
36
37*************************************************************************/
38
39namespace bbm{
40 namespace detail {
41
42 //! @{ \name Predefine common default argument types; this will speed up compilation significantly
43 using DefBsdfAll = ArgDef(bbm::bsdf_flag::All);
44 using DefUnitRad = ArgDef(bbm::unit_t::Radiance);
45 using DefTrue = ArgDef(true);
46 //! @}
47
48 } // end detail namespace
49} // end bbm namespace
50
51
52#ifdef BBM_BSDF_ENABLE_FORWARD
53/************************************************************************/
54/*! \brief Helper Macro to forward bbm::args arguments to eval, sample, pdf,
55 and reflectance
56*************************************************************************/
57 #define BBM_BSDF_FORWARD \
58 BBM_FORWARD_CPP_ARGS_CONST(eval, bbm::arg<const Vec3d&, "in">, \
59 bbm::arg<const Vec3d&, "out">, \
60 bbm::arg<BsdfFlag, "component", bbm::detail::DefBsdfAll>, \
61 bbm::arg<bbm::unit_t, "unit", bbm::detail::DefUnitRad>, \
62 bbm::arg<Mask, "mask", bbm::detail::DefTrue>); \
63 BBM_FORWARD_CPP_ARGS_CONST(sample, bbm::arg<const Vec3d&, "out">, \
64 bbm::arg<const Vec2d&, "xi">, \
65 bbm::arg<BsdfFlag, "component", bbm::detail::DefBsdfAll>, \
66 bbm::arg<bbm::unit_t, "unit", bbm::detail::DefUnitRad>, \
67 bbm::arg<Mask, "mask", bbm::detail::DefTrue>); \
68 BBM_FORWARD_CPP_ARGS_CONST(pdf, bbm::arg<const Vec3d&, "in">, \
69 bbm::arg<const Vec3d&, "out">, \
70 bbm::arg<BsdfFlag, "component", bbm::detail::DefBsdfAll>, \
71 bbm::arg<bbm::unit_t, "unit", bbm::detail::DefUnitRad>, \
72 bbm::arg<Mask, "mask", bbm::detail::DefTrue>); \
73 BBM_FORWARD_CPP_ARGS_CONST(reflectance, bbm::arg<const Vec3d&, "out">, \
74 bbm::arg<BsdfFlag, "component", bbm::detail::DefBsdfAll>, \
75 bbm::arg<bbm::unit_t, "unit", bbm::detail::DefUnitRad>, \
76 bbm::arg<Mask, "mask", bbm::detail::DefTrue>); \
77
78#else
79 #define BBM_BSDF_FORWARD
80#endif /* BBM_BSDF_FORWARD */
81
82
83namespace bbm {
84
85 /**********************************************************************/
86 /*! \brief ostream output uses toString conversion
87 **********************************************************************/
88 template<typename BSDFMODEL> requires bbm::concepts::bsdfmodel<BSDFMODEL>
89 std::ostream& operator<<(std::ostream& s, const BSDFMODEL& model)
90 {
91 s << bbm::toString(model);
92 return s;
93 }
94
95} // end std namespace
96
97#endif /* _BBM_BSDFMODEL_H_ */
#define ArgDef(value)
Helper Macro for creating the type of a lambda that returns a value.
Definition: arg.h:259
Default bsdf attribute types.
All BBM methods are defined to operate on a variety of value types and spectrum types....
Tools for easy creation of a constructors.
Fresnel reflectance.
Enum for passing Isotropic or Anisotropic options to a BSDF.
Structure to hold a sampled direction and corresponding pdf.
bsdfmodel concept
Definition: bsdfmodel.h:33
bsdfmodel contract
Macros for checking if a class meets a concept.
Definition: aggregatebsdf.h:29
std::ostream & operator<<(std::ostream &s, const BSDF &bsdf)
Definition: bsdf_base.h:138
std::string toString(const T &)
toString alias
Definition: stringconvert.h:594
Helper structures and methods for storing precomputed compiled data.
Shading frame transformations.
Methods for handling spherical coordinates.
Basic matrix transformations.
Light unit: Radiance or Importance.
Compile-time reflection of:
Vector transformation operations.