Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::sdl Namespace Reference

Namespaces

namespace  detail
 

Functions

math::Spectrum tristimulus_to_spectrum (const math::TVector3< math::ColorValue > &tristimulus, math::EColorSpace colorSpace, math::EColorUsage usage)
 
math::Spectrum load_spectrum (std::string_view sdlSpectrumStr, std::string_view tag, math::EColorUsage usage)
 
void save_spectrum (const math::Spectrum &spectrum, std::string &out_sdlSpectrumStr, std::string &out_tag)
 
std::string_view category_to_string (const ESdlTypeCategory category)
 
ESdlTypeCategory string_to_category (const std::string_view categoryStr)
 
std::vector< std::string_view > acquire_categories ()
 Returns a list of available categories. This function is not intended to be used in performance critical code paths.
 
void save_field_id (const SdlField *sdlField, SdlOutputClause &clause)
 Save the identity of the field to output clause.
 
auto get_all_callable_functions (const SdlClass *callableParentClass) -> std::vector< std::pair< const SdlFunction *, const SdlClass * > >
 Get a list of callable functions from the class.
 
real load_real (std::string_view sdlRealStr)
 
integer load_integer (std::string_view sdlIntegerStr)
 
template<typename FloatType >
FloatType load_float (std::string_view sdlFloatStr)
 Returns a floating-point number by processing its SDL representation. Supports ph::real, float, double, and long double.
 
template<typename IntType >
IntType load_int (std::string_view sdlIntStr)
 Returns a integer number by processing its SDL representation. Supports ph::integer and all signed and unsigned standard integer types.
 
template<typename NumberType >
NumberType load_number (std::string_view sdlNumberStr)
 Returns a number by processing its SDL representation. Accepts all types supported by load_float() and load_int().
 
template<typename NumberType , std::size_t EXTENT = std::dynamic_extent>
void load_numbers (std::string_view sdlNumbersStr, TSpan< NumberType, EXTENT > out_numbers)
 
template<typename Element >
math::TVector2< Element > load_vector2 (std::string_view sdlVec2Str)
 
template<typename Element >
math::TVector3< Element > load_vector3 (std::string_view sdlVec3Str)
 
template<typename Element >
math::TVector4< Element > load_vector4 (std::string_view sdlVec4Str)
 
template<typename Element >
math::TQuaternion< Element > load_quaternion (std::string_view sdlQuatStr)
 
template<typename NumberType >
std::vector< NumberType > load_number_array (std::string_view sdlNumberArrayStr)
 
template<typename Element >
std::vector< math::TVector3< Element > > load_vector3_array (std::string_view sdlVec3ArrayStr)
 
void save_real (real value, std::string &out_str)
 
void save_integer (integer value, std::string &out_str)
 
template<typename FloatType >
void save_float (FloatType value, std::string &out_str)
 Converts a floating-point number to its SDL representation. Supports ph::real, float, double, and long double.
 
template<typename IntType >
void save_int (IntType value, std::string &out_str)
 Converts a integer number to its SDL representation. Supports ph::real, float, double, and long double.
 
template<typename NumberType >
void save_number (NumberType value, std::string &out_str)
 Converts a number to its SDL representation. Accepts all types supported by save_float() and save_int().
 
template<typename NumberType , std::size_t EXTENT = std::dynamic_extent>
void save_numbers (TSpanView< NumberType, EXTENT > numbers, std::string &out_str)
 
template<typename Element >
void save_vector2 (const math::TVector2< Element > &value, std::string &out_str)
 
template<typename Element >
void save_vector3 (const math::TVector3< Element > &value, std::string &out_str)
 
template<typename Element >
void save_vector4 (const math::TVector4< Element > &value, std::string &out_str)
 
template<typename Element >
void save_quaternion (const math::TQuaternion< Element > &value, std::string &out_str)
 
template<typename NumberType >
void save_number_array (TSpanView< NumberType > values, std::string &out_str)
 
template<typename Element >
void save_vector3_array (TSpanView< math::TVector3< Element > > values, std::string &out_str)
 
template<typename T >
constexpr ESdlTypeCategory category_of ()
 Statically gets the SDL category of T.
 
template<std::integral IntType>
constexpr ESdlDataType int_type_of ()
 
template<std::floating_point FloatType>
constexpr ESdlDataType float_type_of ()
 
template<CNumber NumberType>
constexpr ESdlDataType number_type_of ()
 
template<typename T >
constexpr ESdlDataType resource_type_of ()
 
template<typename DstType , typename SrcType >
DstType * cast_to (SrcType *srcResource)
 Cast between SDL resource types. Cast the input SDL resource instance of SrcType to an instance of DstType. Each of the input types can possibly be const qualified. This is a stricter cast than standard dynamic_cast as both input and output pointer must not be null, and it will throw if the cast cannot be done.
 
std::string gen_pretty_name (const SdlClass *clazz)
 Generate a human-readable name for the SDL types. These helpers allow input types to be null.
 
std::string gen_pretty_name (const SdlStruct *const ztruct)
 
std::string gen_pretty_name (const SdlFunction *const func)
 
std::string gen_pretty_name (const SdlField *const field)
 
std::string gen_pretty_name (const SdlClass *const clazz, const SdlField *const field)
 
std::string name_to_title_case (std::string_view sdlName)
 Make a standard SDL name to canonical capitalized form. Make the SDL name capitalized and separated by spaces. Example: "some-sdl-name" will be "Some Sdl Name".
 
std::string name_to_camel_case (std::string_view sdlName, bool capitalizedFront=false)
 Make a standard SDL name to camel case. Example: "some-sdl-name" will be "someSdlName" (if capitalizedFront is false).
 
std::string name_to_snake_case (std::string_view sdlName)
 Make a standard SDL name to snake case. Example: "some-sdl-name" will be "some_sdl_name".
 

Function Documentation

◆ acquire_categories()

std::vector< std::string_view > ph::sdl::acquire_categories ( )
inline

Returns a list of available categories. This function is not intended to be used in performance critical code paths.

◆ cast_to()

template<typename DstType , typename SrcType >
DstType * ph::sdl::cast_to ( SrcType * srcResource)
inline

Cast between SDL resource types. Cast the input SDL resource instance of SrcType to an instance of DstType. Each of the input types can possibly be const qualified. This is a stricter cast than standard dynamic_cast as both input and output pointer must not be null, and it will throw if the cast cannot be done.

Parameters
srcResourceThe resource to be casted.
Returns
The casted resource. Never null.
Exceptions
SdlExceptionIf srcResource cannot be casted to DstType.

◆ category_of()

template<typename T >
ESdlTypeCategory ph::sdl::category_of ( )
inlineconstexpr

Statically gets the SDL category of T.

Template Parameters
TType that category information is going to be extracted from.
Returns
Category of T. The result is ESdlTypeCategory::Unspecified if category information does not exist, or T is not an ISdlResource.

◆ category_to_string()

std::string_view ph::sdl::category_to_string ( const ESdlTypeCategory category)
inline

◆ float_type_of()

template<std::floating_point FloatType>
ESdlDataType ph::sdl::float_type_of ( )
inlineconstexpr

◆ gen_pretty_name() [1/5]

std::string ph::sdl::gen_pretty_name ( const SdlClass *const clazz)

Generate a human-readable name for the SDL types. These helpers allow input types to be null.

◆ gen_pretty_name() [2/5]

std::string ph::sdl::gen_pretty_name ( const SdlClass *const clazz,
const SdlField *const field )

◆ gen_pretty_name() [3/5]

std::string ph::sdl::gen_pretty_name ( const SdlField *const field)

◆ gen_pretty_name() [4/5]

std::string ph::sdl::gen_pretty_name ( const SdlFunction *const func)

◆ gen_pretty_name() [5/5]

std::string ph::sdl::gen_pretty_name ( const SdlStruct *const ztruct)

◆ get_all_callable_functions()

auto ph::sdl::get_all_callable_functions ( const SdlClass * callableParentClass) -> std::vector< std::pair< const SdlFunction *, const SdlClass * > >

Get a list of callable functions from the class.

Returns
A list of pairs containing {callable function, original parent class}.

◆ int_type_of()

template<std::integral IntType>
ESdlDataType ph::sdl::int_type_of ( )
inlineconstexpr

◆ load_float()

template<typename FloatType >
FloatType ph::sdl::load_float ( std::string_view sdlFloatStr)
inline

Returns a floating-point number by processing its SDL representation. Supports ph::real, float, double, and long double.

◆ load_int()

template<typename IntType >
IntType ph::sdl::load_int ( std::string_view sdlIntStr)
inline

Returns a integer number by processing its SDL representation. Supports ph::integer and all signed and unsigned standard integer types.

◆ load_integer()

integer ph::sdl::load_integer ( std::string_view sdlIntegerStr)
inline

◆ load_number()

template<typename NumberType >
NumberType ph::sdl::load_number ( std::string_view sdlNumberStr)
inline

Returns a number by processing its SDL representation. Accepts all types supported by load_float() and load_int().

◆ load_number_array()

template<typename NumberType >
std::vector< NumberType > ph::sdl::load_number_array ( std::string_view sdlNumberArrayStr)
inline

◆ load_numbers()

template<typename NumberType , std::size_t EXTENT = std::dynamic_extent>
void ph::sdl::load_numbers ( std::string_view sdlNumbersStr,
TSpan< NumberType, EXTENT > out_numbers )
inline

◆ load_quaternion()

template<typename Element >
math::TQuaternion< Element > ph::sdl::load_quaternion ( std::string_view sdlQuatStr)
inline

◆ load_real()

real ph::sdl::load_real ( std::string_view sdlRealStr)
inline

◆ load_spectrum()

math::Spectrum ph::sdl::load_spectrum ( std::string_view sdlSpectrumStr,
std::string_view tag,
math::EColorUsage usage )

◆ load_vector2()

template<typename Element >
math::TVector2< Element > ph::sdl::load_vector2 ( std::string_view sdlVec2Str)
inline

◆ load_vector3()

template<typename Element >
math::TVector3< Element > ph::sdl::load_vector3 ( std::string_view sdlVec3Str)
inline

◆ load_vector3_array()

template<typename Element >
std::vector< math::TVector3< Element > > ph::sdl::load_vector3_array ( std::string_view sdlVec3ArrayStr)
inline

◆ load_vector4()

template<typename Element >
math::TVector4< Element > ph::sdl::load_vector4 ( std::string_view sdlVec4Str)
inline

◆ name_to_camel_case()

std::string ph::sdl::name_to_camel_case ( const std::string_view sdlName,
const bool capitalizedFront )

Make a standard SDL name to camel case. Example: "some-sdl-name" will be "someSdlName" (if capitalizedFront is false).

◆ name_to_snake_case()

std::string ph::sdl::name_to_snake_case ( const std::string_view sdlName)

Make a standard SDL name to snake case. Example: "some-sdl-name" will be "some_sdl_name".

◆ name_to_title_case()

std::string ph::sdl::name_to_title_case ( std::string_view sdlName)

Make a standard SDL name to canonical capitalized form. Make the SDL name capitalized and separated by spaces. Example: "some-sdl-name" will be "Some Sdl Name".

SDL names are commonly being lower-case and separated by dashes (also known as Kebab Case). These helpers transform SDL names into various forms.

◆ number_type_of()

template<CNumber NumberType>
ESdlDataType ph::sdl::number_type_of ( )
inlineconstexpr

◆ resource_type_of()

template<typename T >
ESdlDataType ph::sdl::resource_type_of ( )
inlineconstexpr

◆ save_field_id()

void ph::sdl::save_field_id ( const SdlField *const sdlField,
SdlOutputClause & clause )

Save the identity of the field to output clause.

◆ save_float()

template<typename FloatType >
void ph::sdl::save_float ( FloatType value,
std::string & out_str )
inline

Converts a floating-point number to its SDL representation. Supports ph::real, float, double, and long double.

Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ save_int()

template<typename IntType >
void ph::sdl::save_int ( IntType value,
std::string & out_str )
inline

Converts a integer number to its SDL representation. Supports ph::real, float, double, and long double.

Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ save_integer()

void ph::sdl::save_integer ( integer value,
std::string & out_str )
inline
Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ save_number()

template<typename NumberType >
void ph::sdl::save_number ( NumberType value,
std::string & out_str )
inline

Converts a number to its SDL representation. Accepts all types supported by save_float() and save_int().

Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ save_number_array()

template<typename NumberType >
void ph::sdl::save_number_array ( TSpanView< NumberType > values,
std::string & out_str )
inline
Parameters
valuesThe values to save.
out_strThe string to append the saved data to.

◆ save_numbers()

template<typename NumberType , std::size_t EXTENT = std::dynamic_extent>
void ph::sdl::save_numbers ( TSpanView< NumberType, EXTENT > numbers,
std::string & out_str )
inline
Parameters
numbersThe values to save.
out_strThe string to append the saved data to.

◆ save_quaternion()

template<typename Element >
void ph::sdl::save_quaternion ( const math::TQuaternion< Element > & value,
std::string & out_str )
inline
Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ save_real()

void ph::sdl::save_real ( real value,
std::string & out_str )
inline
Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ save_spectrum()

void ph::sdl::save_spectrum ( const math::Spectrum & spectrum,
std::string & out_sdlSpectrumStr,
std::string & out_tag )
Parameters
out_sdlSpectrumStrStores the saved spectrum. Appends to existing data.
out_tagStores the saved tag (if any). Appends to existing data.

◆ save_vector2()

template<typename Element >
void ph::sdl::save_vector2 ( const math::TVector2< Element > & value,
std::string & out_str )
inline
Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ save_vector3()

template<typename Element >
void ph::sdl::save_vector3 ( const math::TVector3< Element > & value,
std::string & out_str )
inline
Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ save_vector3_array()

template<typename Element >
void ph::sdl::save_vector3_array ( TSpanView< math::TVector3< Element > > values,
std::string & out_str )
inline
Parameters
valuesThe values to save.
out_strThe string to append the saved data to.

◆ save_vector4()

template<typename Element >
void ph::sdl::save_vector4 ( const math::TVector4< Element > & value,
std::string & out_str )
inline
Parameters
valueThe value to save.
out_strThe string to append the saved data to.

◆ string_to_category()

ESdlTypeCategory ph::sdl::string_to_category ( const std::string_view categoryStr)
inline

◆ tristimulus_to_spectrum()

math::Spectrum ph::sdl::tristimulus_to_spectrum ( const math::TVector3< math::ColorValue > & tristimulus,
math::EColorSpace colorSpace,
math::EColorUsage usage )