MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Agent.cpp
Go to the documentation of this file.
1#include "Agent.hpp"
2
5
7
8namespace MayaFlux::Nexus {
9
10void Agent::set_vertices(const void* data, size_t byte_count)
11{
12 for (auto& s : m_render_sinks)
13 s.writer->set_vertices(data, byte_count);
14}
15
16void Agent::attach(const std::shared_ptr<Buffers::VKBuffer>& buf, const AttachConfig& config)
17{
18 if (!buf) {
20 "Cannot attach null buffer");
21 return;
22 }
23
24 detach();
27}
28
30{
31 if (m_attachment) {
33 m_attachment.reset();
34 }
35}
36
43
50
51} // namespace MayaFlux::Nexus
#define MF_ERROR(comp, ctx,...)
std::optional< glm::quat > m_orientation
Definition Agent.hpp:381
void set_vertices(const void *data, size_t byte_count)
Set pre-packed interleaved vertex bytes to all registered render sinks.
Definition Agent.cpp:10
void detach()
Release the attached buffer and reset its placement.
Definition Agent.cpp:29
std::optional< glm::vec3 > m_position
Definition Agent.hpp:380
void attach(const std::shared_ptr< Buffers::VKBuffer > &buf, const AttachConfig &config={})
Make an existing, already rendered buffer the look of this object.
Definition Agent.cpp:16
std::optional< Attachment > m_attachment
Definition Agent.hpp:396
std::vector< RenderSink > m_render_sinks
Definition Agent.hpp:395
void recenter()
Read the attached buffer's geometry again and move the anchor to match.
Definition Agent.cpp:37
@ Init
Engine/subsystem initialization.
@ Nexus
Spatial indexing and scheduling for user-defined behaviour.
void recenter_attachment(Attachment &attachment, std::optional< glm::vec3 > &position, const std::optional< glm::quat > &orientation)
Read the buffer's geometry again and move the anchor to match.
void follow_attachment(Attachment &attachment, std::optional< glm::vec3 > &position, const std::optional< glm::quat > &orientation)
Set position from the buffer, or fold an outside move into the attachment.
void release_attachment(Attachment &attachment)
Give every placed render processor back the geometry transform it had.
Attachment make_attachment(std::shared_ptr< Buffers::VKBuffer > buf, const AttachConfig &config, const std::optional< glm::quat > &orientation)
Build an attachment to buf.
How an Agent attaches to a buffer that already exists.