1#ifndef _BBM_SAMPLEDLOSSFUNCTION_H_
2#define _BBM_SAMPLEDLOSSFUNCTION_H_
28 template<
typename BSDF,
typename REFERENCE,
typename SAMPLELOSSFUNC,
typename LINEARIZER, bsdf_flag COMPONENT=bsdf_flag::All, unit_t UNIT=unit_t::Radiance>
29 requires concepts::bsdfmodel<BSDF> &&
30 concepts::bsdfmodel<REFERENCE> &&
31 concepts::inout_linearizer<LINEARIZER> &&
32 concepts::samplelossfunction<SAMPLELOSSFUNC> &&
33 concepts::matching_config<BSDF, REFERENCE, LINEARIZER>
62 inline Value
operator()(Size_t idx, Mask mask=
true)
const
66 if(bbm::none(mask))
return 0;
70 _bsdf.eval(directions.in, directions.out, COMPONENT, UNIT, mask),
71 _reference.eval(directions.in, directions.out, COMPONENT, UNIT, mask)
83 for(
size_t i=0; i < bbm::hmax(numsamples); ++i)
84 err +=
operator()(i, mask && (i < numsamples));
86 return err / Value(numsamples);
All BBM methods are defined to operate on a variety of value types and spectrum types....
BSDF implementation of a BSDF model.
Definition: bsdf.h:30
sampled loss function concept
Definition: sampledlossfunction.h:27
sampled loss function contract
inout_linearizer contract
#define BBM_CHECK_CONCEPT(CONCEPTNAME, CLASSNAME,...)
Check a class for a concept with bbm::concepts::archetypes in the namespace.
Definition: macro.h:35
Definition: aggregatebsdf.h:29
Assignable reference with wrapper support for rvalues.
Non-persistent reference (i.e., cannot take rvalues)
Definition: reference.h:86
sampledlossfunction
Definition: sampledlossfunction.h:35
const BSDF & _bsdf
Definition: sampledlossfunction.h:93
SAMPLELOSSFUNC _samplelossfunc
Definition: sampledlossfunction.h:96
Value operator()(Size_t idx, Mask mask=true) const
Compute the loss over the idx-th sample.
Definition: sampledlossfunction.h:62
const REFERENCE & _reference
Definition: sampledlossfunction.h:94
sampledlossfunction(const BSDF &bsdf, const REFERENCE &reference, const SAMPLELOSSFUNC &samplelossfunc, const LINEARIZER &linearizer)
Constructor.
Definition: sampledlossfunction.h:47
void update(void)
Init (does nothing)
Definition: sampledlossfunction.h:52
Size_t samples(void) const
Returns the number of samples.
Definition: sampledlossfunction.h:57
Value operator()(Mask mask=true) const
Compute loss over all samples.
Definition: sampledlossfunction.h:78
LINEARIZER _linearizer
Definition: sampledlossfunction.h:95