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

◆ place_rect()

MAYAFLUX_API uint32_t MayaFlux::Portal::Forma::Plot::place_rect ( Surface surface,
std::shared_ptr< Buffers::FormaBuffer buf,
const RectSpec spec,
uint32_t  relate_to = 0 
)

Place a filled rectangle element onto surface using a pre-built buffer.

buf must be a plain TRIANGLE_STRIP FormaBuffer with no texture slot. Buffer construction is the caller's responsibility.

Parameters
surfaceTarget surface.
bufFormaBuffer sized for 4 vertices.
specRectangle geometry and color.
relate_toIf non-zero, the produced element is related to this id.
Returns
Element id of the produced rect element.

Definition at line 53 of file Plot.cpp.

58{
59 const auto verts = Kinesis::filled_rect(spec.bounds, spec.color);
60 buf->submit(verts);
61
62 Element el;
63 el.with_buffer(std::move(buf))
64 .with_bounds(spec.bounds)
65 .with_name(spec.name);
66
67 if (!spec.interactive)
68 el.non_interactive();
69
70 const uint32_t id = surface.layer().add(std::move(el));
71 if (relate_to != 0)
72 surface.layer().relate(relate_to, id);
73
74 return id;
75}
bool relate(uint32_t primary_id, uint32_t related_id)
Record that related_id belongs with primary_id.
Definition Layer.cpp:152
Slot add(Element element)
Add an element to the layer.
Definition Layer.cpp:9
Layer & layer() noexcept
Access the spatial registry.
Definition Surface.hpp:107
Element & with_buffer(std::shared_ptr< Buffers::FormaBuffer > buf)
Attach a FormaBuffer as the rendered output for this region.
Definition Element.hpp:180
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

References MayaFlux::Portal::Forma::Layer::add(), MayaFlux::Portal::Forma::Plot::RectSpec::bounds, MayaFlux::Portal::Forma::Plot::RectSpec::color, MayaFlux::Kinesis::filled_rect(), MayaFlux::Portal::Forma::Plot::RectSpec::interactive, MayaFlux::Portal::Forma::Surface::layer(), MayaFlux::Portal::Forma::Plot::RectSpec::name, MayaFlux::Portal::Forma::Element::non_interactive(), MayaFlux::Portal::Forma::Layer::relate(), MayaFlux::Portal::Forma::Element::with_bounds(), MayaFlux::Portal::Forma::Element::with_buffer(), and MayaFlux::Portal::Forma::Element::with_name().

+ Here is the call graph for this function: