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
3
namespace
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
*/
26
enum 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
36
MF_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
*/
44
enum class
FieldMode
: uint8_t {
45
ABSOLUTE
,
46
ACCUMULATE
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
*/
57
inline
constexpr
std::array<FieldTarget, 6>
k_field_targets
{
58
FieldTarget::POSITION
,
59
FieldTarget::COLOR
,
60
FieldTarget::NORMAL
,
61
FieldTarget::TANGENT
,
62
FieldTarget::SCALAR
,
63
FieldTarget::UV
,
64
};
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
*/
72
inline
constexpr
FieldTarget
k_vector_targets
73
=
FieldTarget::POSITION
|
FieldTarget::COLOR
74
|
FieldTarget::NORMAL
|
FieldTarget::TANGENT
;
75
76
}
// namespace MayaFlux::Kinesis
MayaFlux::Kinesis::FieldTarget
FieldTarget
What a Tendency drives when applied to a vertex record.
Definition
FieldBinding.hpp:26
MayaFlux::Kinesis::FieldTarget::COLOR
@ COLOR
MayaFlux::Kinesis::FieldTarget::NORMAL
@ NORMAL
MayaFlux::Kinesis::FieldTarget::TANGENT
@ TANGENT
MayaFlux::Kinesis::FieldTarget::SCALAR
@ SCALAR
MayaFlux::Kinesis::FieldTarget::POSITION
@ POSITION
MayaFlux::Kinesis::FieldTarget::NONE
@ NONE
MayaFlux::Kinesis::FieldTarget::UV
@ UV
MayaFlux::Kinesis::FieldMode
FieldMode
How a field result combines with the value already present.
Definition
FieldBinding.hpp:44
MayaFlux::Kinesis::FieldMode::ABSOLUTE
@ ABSOLUTE
MayaFlux::Kinesis::FieldMode::ACCUMULATE
@ ACCUMULATE
MayaFlux::Kinesis::k_vector_targets
constexpr FieldTarget k_vector_targets
Targets that accept a three-component field.
Definition
FieldBinding.hpp:73
MayaFlux::Kinesis::k_field_targets
constexpr std::array< FieldTarget, 6 > k_field_targets
Single-bit targets known to this version, in vertex layout order.
Definition
FieldBinding.hpp:57
MayaFlux::Kinesis
Definition
API/Random.hpp:5
src
MayaFlux
Kinesis
Tendency
FieldBinding.hpp
Generated by
1.9.8