MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Emitter.cpp
Go to the documentation of this file.
1#include "Emitter.hpp"
2
5
8
9namespace MayaFlux::Nexus {
10
11void Emitter::set_vertices(const void* data, size_t byte_count)
12{
13 for (auto& s : m_render_sinks)
14 s.writer->set_vertices(data, byte_count);
15}
16
17void Emitter::attach(const std::shared_ptr<Buffers::VKBuffer>& buf, const AttachConfig& config)
18{
19 if (!buf) {
21 "Cannot attach null buffer");
22 return;
23 }
24
25 detach();
26 m_attachment = make_attachment(buf, config, {});
28}
29
31{
32 if (m_attachment) {
34 m_attachment.reset();
35 }
36}
37
44
51
52} // namespace MayaFlux::Nexus
#define MF_ERROR(comp, ctx,...)
void set_vertices(const void *data, size_t byte_count)
Set pre-packed interleaved vertex bytes to all registered render sinks.
Definition Emitter.cpp:11
void detach()
Release the attached buffer and reset its placement.
Definition Emitter.cpp:30
void attach(const std::shared_ptr< Buffers::VKBuffer > &buf, const AttachConfig &config={})
Make an existing, already rendered buffer the look of this object.
Definition Emitter.cpp:17
std::optional< glm::vec3 > m_position
Definition Emitter.hpp:271
void recenter()
Read the attached buffer's geometry again and move the anchor to match.
Definition Emitter.cpp:38
std::optional< Attachment > m_attachment
Definition Emitter.hpp:284
std::vector< RenderSink > m_render_sinks
Definition Emitter.hpp:282
@ 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.