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

◆ vertical_fader()

MAYAFLUX_API GeometryFn< float > MayaFlux::Portal::Forma::Geometry::vertical_fader ( Kinesis::AABB2D  bounds,
float  handle_h,
glm::vec3  track_color = glm::vec3(0.3F),
glm::vec3  handle_color = glm::vec3(0.9F) 
)

Geometry function for a vertical fader in NDC space.

Parameters
boundsFull extent of the fader in NDC.
handle_hHandle height in NDC units.
track_colorTrack quad color.
handle_colorHandle quad color.

Definition at line 35 of file Geometry.cpp.

40{
41 return [bounds, handle_h, track_color, handle_color](
42 float v, std::vector<uint8_t>& out, Element& el) {
43 const float y = bounds.min.y + v * (bounds.height() - handle_h);
44 const float xl = bounds.min.x + bounds.width() * 0.35F;
45 const float xr = bounds.min.x + bounds.width() * 0.65F;
46
47 const Kinesis::AABB2D track { .min = { xl, bounds.min.y }, .max = { xr, bounds.max.y } };
48 const Kinesis::AABB2D handle { .min = { bounds.min.x, y }, .max = { bounds.max.x, y + handle_h } };
49
50 auto verts = Kakshya::to_mesh_vertices(Kinesis::filled_rect(track, track_color));
51 auto herts = Kakshya::to_mesh_vertices(Kinesis::filled_rect(handle, handle_color));
52 verts.insert(verts.end(), herts.begin(), herts.end());
53
54 write_verts(out, verts);
55
56 el.bounds_hint = handle;
57 el.contains = {};
58 };
59}
void write_verts(std::vector< uint8_t > &out, const std::vector< V > &verts)
Write a vertex array into a GeometryFn output buffer.
Definition Geometry.hpp:35
float height() const noexcept
Definition Bounds.hpp:38
float width() const noexcept
Definition Bounds.hpp:37
Axis-aligned bounding rectangle in a 2D coordinate space.
Definition Bounds.hpp:21
A bounded, renderable region on a window surface.
Definition Element.hpp:58

References MayaFlux::Kinesis::filled_rect(), MayaFlux::Kinesis::AABB2D::height(), MayaFlux::Kinesis::AABB2D::max, MayaFlux::Kinesis::AABB2D::min, MayaFlux::Kakshya::to_mesh_vertices(), MayaFlux::Kinesis::AABB2D::width(), and write_verts().

+ Here is the call graph for this function: