25 template <
typename C,
typename R,
typename A>
31 template <
typename C,
typename R,
typename A,
typename B>
35 using aux = std::decay_t<B>;
38 template <
typename C,
typename R,
typename A,
typename B,
typename P>
42 using aux = std::decay_t<B>;
76template <
typename D,
typename R>
122template <
typename D,
typename R>
160template <
typename D,
typename R>
185template <
typename Lambda>
186[[nodiscard]]
auto dual_field(std::string
name, Lambda&& fn, std::string_view text)
189 using D =
typename Sig::domain;
190 using R =
typename Sig::range;
205template <
typename Lambda>
209 using D =
typename Sig::domain;
210 using R =
typename Sig::range;
212 static_assert(std::is_same_v<typename Sig::aux, float>,
213 "MF_FIELD_T: the second parameter must be float");
227template <
typename Lambda>
231 using D =
typename Sig::domain;
232 using R =
typename Sig::range;
234 static_assert(std::is_same_v<typename Sig::aux, float>,
235 "MF_FIELD_P: the second parameter must be float");
236 static_assert(std::is_same_v<typename Sig::params, glm::vec4>,
237 "MF_FIELD_P: the third parameter must be vec4");
263#define MF_FIELD(name, lambda) \
264 MayaFlux::Kinesis::dual_field(#name, lambda, #lambda)
273#define MF_FIELD_T(name, lambda) \
274 MayaFlux::Kinesis::temporal_field(#name, lambda, #lambda)
282#define MF_FIELD_P(name, lambda) \
283 MayaFlux::Kinesis::parametric_field(#name, lambda, #lambda)
GLSL type and function spellings made valid as C++.
auto temporal_field(std::string name, Lambda &&, std::string_view text)
Build a TemporalField from a lambda and its stringified text.
auto parametric_field(std::string name, Lambda &&, std::string_view text)
Build a ParametricField from a lambda and its stringified text.
auto dual_field(std::string name, Lambda &&fn, std::string_view text)
Build a DualField from a lambda and its stringified text.
R operator()(const D &d) const
Evaluate the host half.
bool has_source() const noexcept
Whether the shader half parsed into a usable function definition.
One authored expression carried as both a host callable and shader text.
static FieldSource parse(std::string fn_name, std::string_view text)
Extract return type, parameter list and body from lambda text.
bool valid() const noexcept
Whether parsing produced a usable function definition.
Parsed representation of a stringified field lambda.
bool has_source() const noexcept
Whether the shader half parsed into a usable function definition.
An authored expression of position, time and a parameter block, shader-only.
bool has_source() const noexcept
Whether the shader half parsed into a usable function definition.
An authored expression of position and time, shader-only.
std::function< R(const D &)> fn
Typed, composable, stateless callable from domain D to range R.
Extracts domain and range types from a non-generic lambda.