MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Portal::Forma::Element Struct Reference

A bounded, renderable region on a window surface. More...

#include <Element.hpp>

+ Collaboration diagram for MayaFlux::Portal::Forma::Element:

Public Member Functions

Elementhidden ()
 Start hidden.
 
Elementnon_interactive ()
 Exclude from hit testing.
 
void set_text (std::string_view text, std::optional< Portal::Text::PressParams > params)
 Re-composite text into the retained GPU texture.
 
Elementwith_bounds (Kinesis::AABB2D b)
 Set the fast-reject AABB.
 
Elementwith_buffer (std::shared_ptr< Buffers::FormaBuffer > buf)
 Attach a FormaBuffer as the rendered output for this region.
 
Elementwith_circle (glm::vec2 center, float radius)
 Set a circular containment predicate.
 
Elementwith_contains (std::function< bool(glm::vec2)> fn)
 Set an explicit containment predicate.
 
Elementwith_name (std::string n)
 Set the human-readable name used in Lila introspection and debug output.
 
Elementwith_polygon (std::span< const glm::vec2 > verts)
 Set a polygon containment predicate.
 
Elementwith_rect (glm::vec2 ndc_min, glm::vec2 ndc_max)
 Convenience: rectangular region specified as two NDC corners.
 
Elementwith_stroke (std::span< const glm::vec2 > pts, float half_thickness)
 Set a stroke-based containment predicate.
 
Elementwith_text (std::string_view text, std::optional< Portal::Text::PressParams > params, Kinesis::AABB2D region={ .min=glm::vec2(-1.F),.max=glm::vec2(1.F) })
 Press text into a new GPU texture and bind it to the attached FormaBuffer.
 
Elementwith_texture (const std::shared_ptr< Buffers::TextureBuffer > &buf, Kinesis::AABB2D region={ .min=glm::vec2(-1.F),.max=glm::vec2(1.F) })
 Convenience overload extracting the GPU texture from a TextureBuffer (or TextBuffer, which inherits it).
 
Elementwith_texture (const std::shared_ptr< Core::VKImage > &image, Kinesis::AABB2D region={ .min=glm::vec2(-1.F),.max=glm::vec2(1.F) })
 Submit a UV quad covering region and bind image as "texSampler" on the attached FormaBuffer.
 

Public Attributes

std::optional< Kinesis::AABB2Dbounds_hint
 Optional fast-reject bounds in NDC space.
 
std::shared_ptr< Buffers::FormaBufferbuffer
 Buffer whose rendered output occupies this region.
 
std::function< bool(glm::vec2)> contains
 Authoritative containment test in NDC space.
 
uint32_t id { 0 }
 Stable id assigned by Layer::add. Never zero.
 
bool interactive { true }
 When false, hit testing skips this element.
 
std::string name
 Optional human-readable label for Lila introspection and debug logging.
 
std::shared_ptr< Core::VKImagetexture
 Optional GPU texture to bind to the attached buffer. Used for.
 
bool visible { true }
 When false, the element is excluded from Layer iteration.
 

Detailed Description

A bounded, renderable region on a window surface.

An Element pairs a spatial description with a GPU buffer whose output occupies that region. The spatial description is deliberately open:

  • bounds_hint: optional AABB2D in NDC space, used as a fast-reject pre-filter before contains is evaluated. Not required.
  • contains: authoritative point-in-element test. If absent and bounds_hint is set, bounds_hint::contains is used directly. If both are absent the element never hits. For a rectangle, set only bounds_hint. For a circle, arbitrary polygon, or curve region, set contains (and optionally bounds_hint as the circumscribed rect for performance).

buffer is optional. An Element with no buffer is a pure spatial registration: it participates in hit testing and relation cascades but contributes no rendered output. A voice node with a spatial position, a named region driving a compute shader, an invisible trigger zone; all are valid Elements with no buffer.

Fluent setters return Element& for chained construction:

auto el = Element{}
.with_name("kick_voice")
.with_bounds(region)
Element & with_bounds(Kinesis::AABB2D b)
Set the fast-reject AABB.
Definition Element.hpp:95
Element & non_interactive()
Exclude from hit testing.
Definition Element.hpp:253
Element & with_name(std::string n)
Set the human-readable name used in Lila introspection and debug output.
Definition Element.hpp:278
A bounded, renderable region on a window surface.
Definition Element.hpp:58

Layer::add() assigns the stable id. All setters that affect spatial or visibility state can also be applied post-registration via Layer::Slot.

Note
Elements do not participate in the graphics subsystem scheduler directly. The caller registers the underlying buffer with the BufferManager and attaches a RenderProcessor as usual. Element holds only the spatial and identity metadata that Layer and Context need.

Definition at line 58 of file Element.hpp.


The documentation for this struct was generated from the following files: