MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kinesis::DualField< D, R > Struct Template Reference

One authored expression carried as both a host callable and shader text. More...

#include <DualField.hpp>

+ Collaboration diagram for MayaFlux::Kinesis::DualField< D, R >:

Public Member Functions

bool has_source () const noexcept
 Whether the shader half parsed into a usable function definition.
 
operator() (const D &d) const
 Evaluate the host half.
 

Public Attributes

Tendency< D, R > cpu
 
FieldSource source
 

Detailed Description

template<typename D, typename R>
struct MayaFlux::Kinesis::DualField< D, R >

One authored expression carried as both a host callable and shader text.

Template Parameters
DDomain type.
RRange type.

The cpu member is an ordinary Tendency and is accepted anywhere a Tendency is, including FieldOperator::bind. It composes with combine, chain, scale, clamp, threshold, invert, lerp and select as any Tendency does. Those free functions build closures, so a composed Tendency has no shader half: composition on the GPU is textual and happens in the kernel body, where several emitted functions are called with whatever arithmetic is wanted.

Field bodies must be authored outside namespace Kinesis. See the authoring rules in ShaderCompat.hpp.

namespace MayaFlux::Fields {
using namespace MayaFlux::ShaderCompat;
const auto swirl = MF_FIELD(swirl, [](vec3 p) -> vec3 {
return cross(vec3(0.0f, 1.0f, 0.0f), p) * 2.0f;
});
}
field_op->bind(FieldTarget::POSITION, Fields::swirl.cpu);
#define MF_FIELD(name, lambda)
Bind one authored expression to both the host and shader backends.

Definition at line 69 of file DualField.hpp.


The documentation for this struct was generated from the following file: