Loading...
Searching...
No Matches
Namespaces | Macros | Typedefs | Functions
config.h File Reference

All BBM methods are defined to operate on a variety of value types and spectrum types. Each BBM class takes a config structure as a template parameter (that satisfies concepts::config). To import common typedefs into the current scope add the macro BBM_IMPORT_CONFIG with the config template parameters as parameter. To import a single 'core' type use Core_t<Config>. More...

#include "concepts/macro.h"
#include "concepts/config.h"
#include "core/vec.h"
#include "core/color.h"
#include "core/mat.h"
#include "core/constants.h"
#include "core/stringconvert.h"
#include "bbm/bsdf_flag.h"
#include "bbm/bsdfsample.h"
#include "bbm/vec3dpair.h"

Go to the source code of this file.

Namespaces

namespace  bbm
 

Macros

#define BBM_CHECK_CONFIG(CONF)
 Helper Macro to validate a configuration.
 
#define BBM_DECLARE_FORWARD_IMPORT(STRUCT)   template<typename CONF> requires concepts::config<CONF> struct STRUCT;
 
#define BBM_DECLARE_CORE_TYPE(Core, Type, ...)
 
#define BBM_DECLARE_SHORTHAND(SHORTHAND, TYPE)
 
#define BBM_IMPORT_CONFIG(...)
 Import the configs typedefs in the current scope

 

Typedefs

template<typename T >
using get_config = typename std::decay_t< T >::Config
 get_config type trait
 
template<typename T >
using Value_t = typename get_config< T >::Value
 
template<typename T >
using Spectrum_t = typename get_config< T >::Spectrum
 

Functions

 BBM_DECLARE_FORWARD_IMPORT (bsdfsample)
 
 BBM_DECLARE_FORWARD_IMPORT (vec3dpair)
 
 BBM_DECLARE_CORE_TYPE (Scalar, T, bbm::scalar_t< Value_t< T > >)
 
 BBM_DECLARE_CORE_TYPE (Mask, T, bbm::mask_t< Value_t< T > >)
 
 BBM_DECLARE_CORE_TYPE (Size, T, bbm::index_t< Value_t< T > >)
 
 BBM_DECLARE_CORE_TYPE (BsdfFlag, T, bbm::replace_scalar_t< bbm::remove_diff_t< Value_t< T > >, bbm::bsdf_flag >)
 
 BBM_DECLARE_CORE_TYPE (Constants, T, bbm::constants< Scalar_t< T > >)
 
 BBM_DECLARE_CORE_TYPE (Vec2d, T, bbm::vec2d< Value_t< T > >)
 
 BBM_DECLARE_CORE_TYPE (Mat2d, T, bbm::mat2d< Value_t< T > >)
 
 BBM_DECLARE_CORE_TYPE (Vec3d, T, bbm::vec3d< Value_t< T > >)
 
 BBM_DECLARE_CORE_TYPE (Mat3d, T, bbm::mat3d< Value_t< T > >)
 
 BBM_DECLARE_CORE_TYPE (Complex, T, bbm::complex< Value_t< T > >)
 
 BBM_DECLARE_SHORTHAND (BsdfSample_t, bsdfsample)
 
 BBM_DECLARE_SHORTHAND (Vec3dPair_t, vec3dpair)
 

Detailed Description

All BBM methods are defined to operate on a variety of value types and spectrum types. Each BBM class takes a config structure as a template parameter (that satisfies concepts::config). To import common typedefs into the current scope add the macro BBM_IMPORT_CONFIG with the config template parameters as parameter. To import a single 'core' type use Core_t<Config>.

Macro Definition Documentation

◆ BBM_CHECK_CONFIG

#define BBM_CHECK_CONFIG (   CONF)
Value:
BBM_VALIDATE_BACKBONE(typename CONF::Value); \
BBM_VALIDATE_BACKBONE(typename CONF::Spectrum); \
BBM_VALIDATE_BACKBONE( bbm::vec2d<typename CONF::Value> ); \
BBM_VALIDATE_BACKBONE( bbm::vec3d<typename CONF::Value> ); \
BBM_VALIDATE_BACKBONE( bbm::complex<typename CONF::Value> ); \
BBM_CHECK_RAW_CONCEPT( std::constructible_from, bbm::vec2d<typename CONF::Value>, typename CONF::Value, typename CONF::Value ); \
BBM_CHECK_RAW_CONCEPT( std::constructible_from, bbm::vec3d<typename CONF::Value>, typename CONF::Value, typename CONF::Value, typename CONF::Value ); \
Addiional requirements for complex data-type.
Definition: complex.h:22
config concept
Definition: config.h:31
#define BBM_CHECK_RAW_CONCEPT(CONCEPTNAME, CLASSNAME,...)
Check a class for a concept.
Definition: macro.h:32
Complex numbers.
Definition: complex.h:22

Helper Macro to validate a configuration.

◆ BBM_DECLARE_CORE_TYPE

#define BBM_DECLARE_CORE_TYPE (   Core,
  Type,
  ... 
)
Value:
namespace detail { \
template<typename Type> struct Core { using type = __VA_ARGS__; }; \
template<typename Type> requires requires { typename std::decay_t<Type>::Core; } \
struct Core<Type> { using type = typename std::decay_t<Type>::Core; }; \
} \
template<typename T> requires bbm::concepts::has_config<T> \
using Core ## _t = typename bbm::detail::Core<get_config<T>>::type;\
has_config
Definition: config.h:53

◆ BBM_DECLARE_FORWARD_IMPORT

#define BBM_DECLARE_FORWARD_IMPORT (   STRUCT)    template<typename CONF> requires concepts::config<CONF> struct STRUCT;

◆ BBM_DECLARE_SHORTHAND

#define BBM_DECLARE_SHORTHAND (   SHORTHAND,
  TYPE 
)
Value:
template<typename T> requires bbm::concepts::has_config<T> \
using SHORTHAND = TYPE<bbm::get_config<T>>; \

◆ BBM_IMPORT_CONFIG

#define BBM_IMPORT_CONFIG (   ...)
Value:
using Config = bbm::get_config<__VA_ARGS__>; \
BBM_CHECK_CONFIG( Config ); \
BBM_BACKBONE_IMPORT( Config ); \
\
/* Core types */\
using Value = bbm::Value_t<Config>; \
using Spectrum = bbm::Spectrum_t<Config>; \
using Scalar = bbm::Scalar_t<Config>; \
using Mask = bbm::Mask_t<Config>; \
using Size_t = bbm::Size_t<Config>; \
using BsdfFlag = bbm::BsdfFlag_t<Config>; \
\
using Constants = bbm::Constants_t<Config>; \
using Vec2d = bbm::Vec2d_t<Config>; \
using Mat2d = bbm::Mat2d_t<Config>; \
using Vec3d = bbm::Vec3d_t<Config>; \
using Mat3d = bbm::Mat3d_t<Config>; \
using Complex = bbm::Complex_t<Config>; \
\
/* Convenient Shorthands */\
using BsdfSample = bbm::bsdfsample<Config>; \
using Vec3dPair = bbm::vec3dpair<Config>; \
typename std::decay_t< T >::Config get_config
get_config type trait
Definition: config.h:49
typename get_config< T >::Value Value_t
Definition: config.h:67
typename get_config< T >::Spectrum Spectrum_t
Definition: config.h:68
Structure to hold a sample's direction and PDF.
Definition: bsdfsample.h:21
Structure to hold a pair of directions.
Definition: vec3dpair.h:21

Import the configs typedefs in the current scope

A macro to define common shorthand type aliases in the current scope based on a BBM config structure type.

Any class that meets concepts::has_config can be passed.

Using VA_ARGS for passing the CONFIG argument to handle passing a configs with commas.

Any class that IMPORTs a CONFIG will satisfies concepts::has_config.