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

◆ make_attachment()

MAYAFLUX_API Attachment MayaFlux::Nexus::make_attachment ( std::shared_ptr< Buffers::VKBuffer >  buf,
const AttachConfig &  config,
const std::optional< glm::quat > &  orientation 
)

Build an attachment to buf.

Parameters
bufBuffer to attach to. Must not be null.
configAnchor vertex, offset and move behaviour.
orientationOrientation of the Agent, if it has one.

Definition at line 85 of file Attachment.cpp.

89{
90 Attachment attachment {
91 .buf = std::move(buf),
92 .config = config,
93 .transform = std::make_shared<glm::mat4>(1.0F),
94 };
95
96 if (const auto anchor = read_anchor(attachment.buf, config.index)) {
97 attachment.anchor = *anchor;
98 } else {
99 MF_WARN(Journal::Component::Nexus, Journal::Context::Init,
100 "Attachment anchors at the buffer's local origin: no geometry could be read from it");
101 }
102
103 attachment.applied = attachment.anchor + frame(orientation) * config.offset;
104 return attachment;
105}
#define MF_WARN(comp, ctx,...)
std::optional< uint32_t > index
Vertex whose position anchors the Agent.
glm::vec3 offset
Offset of the Agent from the anchor, in the Agent's own frame.
std::shared_ptr< Buffers::VKBuffer > buf
State of one Agent attached to an existing buffer.

References MayaFlux::Nexus::Attachment::buf, MayaFlux::Nexus::AttachConfig::index, MayaFlux::Journal::Init, MF_WARN, MayaFlux::Journal::Nexus, MayaFlux::Nexus::AttachConfig::offset, and read_anchor().

Referenced by MayaFlux::Nexus::Agent::attach(), and MayaFlux::Nexus::Emitter::attach().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: