MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ position_picker()

MAYAFLUX_API GeometryFn< glm::vec2 > MayaFlux::Portal::Forma::Geometry::position_picker ( Kinesis::AABB2D  bounds,
glm::vec3  color = glm::vec3(0.9F),
float  size = 8.0F 
)

Geometry function for a 2D position picker in NDC space.

Parameters
boundsFull extent of the pick area in NDC.
colorPoint color.
sizePoint size in pixels.

Definition at line 102 of file Geometry.cpp.

106{
107 return [bounds, color, size](
108 glm::vec2 v, std::vector<uint8_t>& out, Element& el) {
109 float x = bounds.min.x + v.x * bounds.width();
110 float y = bounds.min.y + v.y * bounds.height();
111
112 using V = Kakshya::PointVertex;
113 std::vector<V> verts = {
114 { .position = { x, y, 0 }, .color = color, .size = size },
115 };
116
117 write_verts(out, verts);
118
119 el.bounds_hint = bounds;
120 el.contains = Kinesis::polygon_bounds(std::span<const glm::vec2> {
121 std::array<glm::vec2, 4> {
122 bounds.min,
123 glm::vec2(bounds.max.x, bounds.min.y),
124 bounds.max,
125 glm::vec2(bounds.min.x, bounds.max.y) } });
126 };
127}
Vertex type for point primitives (POINT_LIST topology)
float height() const noexcept
Definition Bounds.hpp:38
bool contains(glm::vec2 p) const noexcept
Definition Bounds.hpp:25
float width() const noexcept
Definition Bounds.hpp:37
A bounded, renderable region on a window surface.
Definition Element.hpp:58

References MayaFlux::Kinesis::AABB2D::contains(), MayaFlux::Kinesis::AABB2D::height(), MayaFlux::Kinesis::AABB2D::max, MayaFlux::Kinesis::AABB2D::min, MayaFlux::Kinesis::polygon_bounds(), MayaFlux::Kakshya::PointVertex::position, MayaFlux::Kinesis::AABB2D::width(), and write_verts().

+ Here is the call graph for this function: