MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
FieldBinding.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace MayaFlux::Kinesis {
4
5/**
6 * @enum FieldTarget
7 * @brief What a Tendency drives when applied to a vertex record.
8 *
9 * A bitmask. One field may drive several attributes from a single bind, which
10 * is a convenience on the CPU path and a requirement on the GPU one: a
11 * DualField emits exactly one GLSL function, so binding the same field twice
12 * through separate calls would be a redefinition. Binding once against a mask
13 * emits the function once and calls it per target bit.
14 *
15 * The listed bits correspond to the vertex attributes in the offset table
16 * shared by VertexLayout::for_points, for_lines, for_meshes and for_raw. That
17 * list is not a closed set: targets outside it are expected, and an operator
18 * that cannot drive one either ignores it or rejects the bind with a
19 * diagnostic naming the bit. Validity is a property of the operator and the
20 * layout it addresses, not of the enum.
21 *
22 * @code
23 * op->bind(FieldTarget::POSITION | FieldTarget::NORMAL, displacement);
24 * @endcode
25 */
26enum class FieldTarget : uint16_t {
27 NONE = 0U,
28 POSITION = 1U << 0U,
29 COLOR = 1U << 1U,
30 NORMAL = 1U << 2U,
31 TANGENT = 1U << 3U,
32 SCALAR = 1U << 4U,
33 UV = 1U << 5U,
34};
35
36MF_BITMASK_OPERATORS(FieldTarget)
37
38/**
39 * @enum FieldMode
40 * @brief How a field result combines with the value already present.
41 *
42 * Exclusive rather than a mask: a target is either replaced or added to.
43 */
44enum class FieldMode : uint8_t {
47};
48
49/**
50 * @brief Single-bit targets known to this version, in vertex layout order.
51 *
52 * Iteration source for code that expands a mask into per-attribute work. A
53 * target absent from this array is not invalid, only unknown here; operators
54 * that introduce their own extend the iteration rather than the enum's
55 * meaning.
56 */
65
66/**
67 * @brief Targets that accept a three-component field.
68 *
69 * Validate a mask with any_flag(mask & ~k_vector_targets), which is nonzero
70 * exactly when the mask reaches a target a VectorField cannot drive.
71 */
75
76} // namespace MayaFlux::Kinesis
FieldTarget
What a Tendency drives when applied to a vertex record.
FieldMode
How a field result combines with the value already present.
constexpr FieldTarget k_vector_targets
Targets that accept a three-component field.
constexpr std::array< FieldTarget, 6 > k_field_targets
Single-bit targets known to this version, in vertex layout order.