Loading...
Searching...
No Matches
bsdf_properties.h
Go to the documentation of this file.
1#ifndef _BBM_BSDF_PROPERTIES_H_
2#define _BBM_BSDF_PROPERTIES_H_
3
4#include <ostream>
5
6#include "util/flags.h"
8
9/************************************************************************/
10/*! \file bsdf_properties.h
11
12 \brief Flags to record and indicate specific properties of BSDF models.
13
14*************************************************************************/
15
16namespace bbm {
17
18 /**********************************************************************/
19 /*! \brief BSDF property flags.
20 **********************************************************************/
21 enum struct bsdf_prop
22 {
23 None = 0x0,
24
25 // Static BSDF
26 Static = 0x1000000, //< Indicates the model is static (no fittable parameters)
27
28 // Reflectance Component Flags
29 Diffuse = 0x00000001, //< models diffuse reflections
30 Specular = 0x00000002, //< models specular reflections
31 Combined = Diffuse | Specular, //< includes both diffuse and specular models
32
33 // Deprication Flags
34 Depricated = 0x00000004, //< Model is depricated; included for historical reasons
35 Alternative = 0x00000008 | Depricated, //< Depricated model with alternative model specified
36 Convertible = 0x00000010 | Alternative, //< Depricated model that can be parameter converted to an alternative
37
38 // Deficiencies
39 Unnormalized = 0x0000100, //< Model is not normalized (integral depends on non-albedo parameters)
40 NonReciprocal = 0x0000200, //< Model does not obey reciprocity
41 GrazingAngle = 0x0000400, //< Model possible fails to conserve energy at grazing angles.
42 NonEnergyConservative = 0x0000800 | GrazingAngle, //< Model does not converse energy (general)
43 ApproximateReflectance = 000001000, //< the reflectance method returns incorrect estimate.
44 };
45
46 /**********************************************************************/
47 /*! \brief Forward declaration of alternative. Should be specified if a
48 model provides an alternative.
49 ***********************************************************************/
50 template<typename BSDFMODEL> struct alternative { using type = BSDFMODEL; };
51
52 /**********************************************************************/
53 /*! \brief COnstruct an equivalent alternative BSDF. Should be specialized
54 for each model that provides this option.
55 ***********************************************************************/
56 template<typename BSDFMODEL>
57 typename alternative<BSDFMODEL>::type make_alternative(const BSDFMODEL& src);
58
59 ////////////////////
60 // Ostream suppoert
61 /////////////////////
62 std::ostream& operator<<(std::ostream& s, const bbm::bsdf_prop& prop)
63 {
64 if(flag == bbm::bsdf_prop::None) s << "No properties";
65 else {
66 s << "Properties:" << std::endl;
67
68 // Report reflectance components modeled
69 if( bbm::is_set(prop, bbm::bsdf_prop::Combined) ) s << " + Models Diffuse & Specular Reflectance";
70 else if( bbm::is_set(prop, bbm::bsdf_prop::Diffuse) ) s << " + Models only Diffuse Reflectance";
71 else if( bbm::is_set(prop, bbm::bsdf_prop::Specular) ) s << " + Models only Specular Reflectance";
72 else s << " + Models Unknown Reflectance Components";
73 s << std::endl;
74
75 // Report deprication
76 if( is_set(prop, bbm::bsdf_prop::Depricated) ) s << " + Model is DEPRICATED";
77 if( is_set(prop, bbm::bsdf_prop::Alternative) ) s << "; alternate model available";
78 if( is_set(prop, bbm::bsdf_prop:Convertible) ) s << " with parameter conversion";
79 s << std::endl;
80
81 // Report Deficiencies
82 if( is_set(prop, bbm::bsdf_prop::Unnormalized) ) s << " + Model is unnormalized";
83 if( is_set(prop, bbm::bsdf_prop::NonReciprocal) ) s << " + Model is not reciprocal";
84 if( is_set(prop, bbm::bsdf_prop::GrazingAngle) ) << s << " + Model might break energy conservation at grazing angles";
85 else if( is_set(prop, bbm::bsdf_prop::NonEnergyConservative) ) s << " + Model break energy conservation";
86 if( is_set(prop, bbm::bsdf_prop::ApproximateReflectance) ) << " + Model reports approximate reflectance";
87 s << std::endl;
88 }
89
90 return s;
91 }
92
93} // end bbm namespace
94
95#endif /* _BBM_BSDF_PROPERTIES_H_ */
bsdfmodel contract
Scoped enum operators and methods.
Definition: aggregatebsdf.h:29
BSDFMODEL type
Definition: bsdf_properties.h:50
alternative< BSDFMODEL >::type make_alternative(const BSDFMODEL &src)
COnstruct an equivalent alternative BSDF. Should be specialized for each model that provides this opt...
bsdf_prop
BSDF property flags.
Definition: bsdf_properties.h:22
std::ostream & operator<<(std::ostream &s, const BSDF &bsdf)
Definition: bsdf_base.h:138
constexpr auto is_set(const FLAGNAME &a, const FLAG &flag)
Check if all in 'flag' are also set in 'a'; compatible with packet types.
Definition: flags.h:100
Forward declaration of alternative. Should be specified if a model provides an alternative.
Definition: bsdf_properties.h:50