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

◆ scroll_indicator()

MAYAFLUX_API Form< glm::vec2 > MayaFlux::Portal::Forma::Geometry::scroll_indicator ( Kinesis::AABB2D  track,
glm::vec3  color = glm::vec3(0.5F, 0.5F, 0.55F) 
)

Geometry function for Scrollable's default scroll indicator visual.

Parameters
trackNDC region the bar travels within, the same region passed to Scrollable::indicator()'s own track parameter.
colorBar fill color.

Definition at line 474 of file FormFactory.cpp.

477{
478 GeometryFn<glm::vec2> fn = [track, color](
479 glm::vec2 extent, std::vector<uint8_t>& out, Element& el) {
480 const float len = std::clamp(extent.y, 0.F, 1.F) * track.height();
481 const float top = track.max.y - std::clamp(extent.x, 0.F, 1.F) * (track.height() - len);
482 const Kinesis::AABB2D bar { .min = { track.min.x, top - len }, .max = { track.max.x, top } };
483
484 write_verts(out, Kakshya::to_mesh_vertices(Kinesis::filled_rect(bar, color)));
485
486 el.bounds_hint = track;
487 el.contains = {};
488 };
489
490 return { std::move(fn),
491 Graphics::PrimitiveTopology::TRIANGLE_STRIP,
492 static_cast<size_t>(4) * sizeof(Kakshya::MeshVertex) };
493}
glm::vec3 color
Definition Decoder.cpp:97
std::vector< float > * out
std::function< void(T value, std::vector< uint8_t > &out_bytes, Element &element)> GeometryFn
Geometry function signature.
Definition Mapped.hpp:71
float height() const noexcept
Definition Bounds.hpp:80
bool contains(glm::vec2 p) const noexcept
Definition Bounds.hpp:67
Axis-aligned bounding rectangle in a 2D coordinate space.
Definition Bounds.hpp:63
A bounded, renderable region on a window surface.
Definition Element.hpp:61

References color, MayaFlux::Kinesis::AABB2D::contains(), MayaFlux::Kinesis::filled_rect(), MayaFlux::Kinesis::AABB2D::height(), MayaFlux::Kinesis::AABB2D::max, MayaFlux::Kinesis::AABB2D::min, out, MayaFlux::Kakshya::to_mesh_vertices(), MayaFlux::Portal::Graphics::TRIANGLE_STRIP, and write_verts().

+ Here is the call graph for this function: