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

◆ toggle()

MAYAFLUX_API GeometryFn< bool > MayaFlux::Portal::Forma::Geometry::toggle ( Kinesis::AABB2D  region,
glm::vec3  color_off = glm::vec3(0.25F),
glm::vec3  color_on = glm::vec3(0.2F, 0.7F, 0.4F) 
)

Geometry function for a boolean toggle in NDC space.

Renders region as a filled rect in color_off or color_on based on the current bool value. Interaction is the caller's responsibility.

Parameters
regionNDC bounds of the toggle.
color_offFill color when false.
color_onFill color when true.

Definition at line 221 of file Geometry.cpp.

225{
226 return [region, color_off, color_on](
227 bool v, std::vector<uint8_t>& out, Element& el) {
228 write_verts(out, Kakshya::to_mesh_vertices(Kinesis::filled_rect(region, v ? color_on : color_off)));
229 el.bounds_hint = region;
230 el.contains = {};
231 };
232}
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
bool contains(glm::vec2 p) const noexcept
Definition Bounds.hpp:25
A bounded, renderable region on a window surface.
Definition Element.hpp:58

References MayaFlux::Kinesis::AABB2D::contains(), MayaFlux::Kinesis::filled_rect(), MayaFlux::Kakshya::to_mesh_vertices(), and write_verts().

+ Here is the call graph for this function: