MayaFlux 1.0.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

Element & hidden ()
 Start hidden.
 
Element & non_interactive ()
 Exclude from hit testing.
 
Element & retarget (Kinesis::AABB2D region)
 Move the element's output to a new NDC region.
 
void set_text (std::string_view text, std::optional< Portal::Text::PressParams > params)
 Replace the text drawn by with_text().
 
Element & with_bounds (Kinesis::AABB2D b)
 Set the fast-reject AABB.
 
Element & with_buffer (FormaTarget target)
 Attach a FormaBuffer, or a slice of one, as the rendered output for this region.
 
Element & with_circle (glm::vec2 center, float radius)
 Set a circular containment predicate.
 
Element & with_contains (std::function< bool(glm::vec2)> fn)
 Set an explicit containment predicate.
 
Element & with_name (std::string n)
 Set the human-readable name used in Lila introspection and debug output.
 
Element & with_polygon (std::span< const glm::vec2 > verts)
 Set a polygon containment predicate.
 
Element & with_rect (glm::vec2 ndc_min, glm::vec2 ndc_max)
 Convenience: rectangular region specified as two NDC corners.
 
Element & with_stroke (std::span< const glm::vec2 > pts, float half_thickness)
 Set a stroke-based containment predicate.
 
Element & with_text (std::string_view text, std::optional< Portal::Text::PressParams > params, Kinesis::AABB2D region={ .min=glm::vec2(-1.F),.max=glm::vec2(1.F) })
 Draw text as glyph quads into the attached buffer.
 
Element & with_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).
 
Element & with_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::AABB2D > bounds_hint
 Optional fast-reject bounds in NDC space.
 
FormaTarget buffer
 Where this region's rendered output is written: a buffer of its own, or a slice of one it shares.
 
std::optional< Kinesis::AABB2D > clip
 Optional region outside which hit testing rejects the element.
 
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< internal::TextSlice > text_slice
 Text drawn into the attached buffer by with_text().
 
std::shared_ptr< Core::VKImage > texture
 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:109
Element & non_interactive()
Exclude from hit testing.
Definition Element.hpp:279
Element & with_name(std::string n)
Set the human-readable name used in Lila introspection and debug output.
Definition Element.hpp:304
A bounded, renderable region on a window surface.
Definition Element.hpp:61

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 61 of file Element.hpp.


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