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

◆ attach()

void MayaFlux::Nexus::Agent::attach ( const std::shared_ptr< Buffers::VKBuffer > &  buf,
const AttachConfig &  config = {} 
)

Make an existing, already rendered buffer the look of this object.

The buffer is neither registered nor written to. Its geometry is read once and the object takes its position from the centroid, or from the vertex at config.index, plus config.offset. Every render processor the buffer has is placed at the object's position and orientation. If the object is moved from outside, config.on_move decides whether the move becomes the new offset or carries the buffer. If the object already has a position, that position is kept and becomes the offset. Replaces any previous attachment. The buffer is a live object, so an attachment is not part of encoded state and must be made again after decoding.

Parameters
bufBuffer to attach. Ignored if null.
configAnchor vertex, offset and move behaviour.

Definition at line 16 of file Agent.cpp.

17{
18 if (!buf) {
20 "Cannot attach null buffer");
21 return;
22 }
23
24 detach();
27}
#define MF_ERROR(comp, ctx,...)
std::optional< glm::quat > m_orientation
Definition Agent.hpp:381
void detach()
Release the attached buffer and reset its placement.
Definition Agent.cpp:29
std::optional< Attachment > m_attachment
Definition Agent.hpp:396
@ Init
Engine/subsystem initialization.
@ Nexus
Spatial indexing and scheduling for user-defined behaviour.
Attachment make_attachment(std::shared_ptr< Buffers::VKBuffer > buf, const AttachConfig &config, const std::optional< glm::quat > &orientation)
Build an attachment to buf.

References detach(), follow_attachment(), MayaFlux::Journal::Init, m_attachment, m_orientation, MayaFlux::Nexus::make_attachment(), MF_ERROR, and MayaFlux::Journal::Nexus.

+ Here is the call graph for this function: