MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Mint.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "StructureConfig.hpp"
5
6namespace MayaFlux::Buffers {
7class ComputeMeshBuffer;
8class InstanceNetworkBuffer;
9class MeshBuffer;
10class MeshNetworkBuffer;
11class NetworkGeometryBuffer;
12}
13
14namespace MayaFlux {
15
16/**
17 * @class Mint
18 * @brief Turns a structural config into a registered and rendered object.
19 *
20 * Each overload performs the complete sequence for one arrangement: resolve
21 * its source, construct any required network, register the network and buffer
22 * in their required order, attach textures and configure rendering. Every
23 * config requires RenderConfig::target_window.
24 *
25 * Nothing here is realtime safe. Call from the thread that constructs the
26 * objects.
27 */
28class MAYAFLUX_API Mint {
29public:
30 Mint();
32
33 Mint(const Mint&) = delete;
34 Mint& operator=(const Mint&) = delete;
35 Mint(Mint&&) noexcept;
36 Mint& operator=(Mint&&) noexcept;
37
38 /**
39 * @brief Mint one independently rendered object and its backing MeshWriterNode.
40 * @return MeshBuffer whose get_node() returns the supplied or created node.
41 */
42 auto operator()(const StructureConfig::Object& config)
43 -> std::shared_ptr<Buffers::MeshBuffer>
44 {
45 auto structure = build(config);
46 if (structure) {
47 MF_LIVE_EXPOSE_AUTO(structure);
48 }
49 return structure;
50 }
51
52 /**
53 * @brief Mint a model and its backing MeshNetwork.
54 * @return MeshNetworkBuffer whose get_network() returns the supplied or created network.
55 */
57 -> std::shared_ptr<Buffers::MeshNetworkBuffer>
58 {
59 auto structure = build(config);
60 if (structure) {
61 MF_LIVE_EXPOSE_AUTO(structure);
62 }
63 return structure;
64 }
65
66 /**
67 * @brief Mint repeated instances and their backing InstanceNetwork.
68 * @return InstanceNetworkBuffer whose get_network() returns the supplied or created network.
69 */
71 -> std::shared_ptr<Buffers::InstanceNetworkBuffer>
72 {
73 auto structure = build(config);
74 if (structure) {
75 MF_LIVE_EXPOSE_AUTO(structure);
76 }
77 return structure;
78 }
79
80 /** @brief Mint independently supplied geometry into one rendered assembly. */
82 -> std::shared_ptr<Buffers::NetworkGeometryBuffer>
83 {
84 auto structure = build(config);
85 if (structure) {
86 MF_LIVE_EXPOSE_AUTO(structure);
87 }
88 return structure;
89 }
90
91 /** @brief Mint a CPU or GPU evaluated isosurface. */
93 -> std::shared_ptr<Buffers::ComputeMeshBuffer>
94 {
95 auto structure = build(config);
96 if (structure) {
97 MF_LIVE_EXPOSE_AUTO(structure);
98 }
99 return structure;
100 }
101
102private:
103 struct Impl;
104 std::unique_ptr<Impl> m_impl;
105
106 std::shared_ptr<Buffers::MeshBuffer> build(
107 const StructureConfig::Object& config);
108 std::shared_ptr<Buffers::MeshNetworkBuffer> build(
109 const StructureConfig::Model& config);
110 std::shared_ptr<Buffers::InstanceNetworkBuffer> build(
111 const StructureConfig::Instances& config);
112 std::shared_ptr<Buffers::NetworkGeometryBuffer> build(
113 const StructureConfig::Assembly& config);
114 std::shared_ptr<Buffers::ComputeMeshBuffer> build(
115 const StructureConfig::Isosurface& config);
116};
117
118} // namespace MayaFlux
#define MF_LIVE_EXPOSE_AUTO(ptr)
Auto-expose variant that deduces the key prefix from the shared_ptr element type.
auto operator()(const StructureConfig::Instances &config) -> std::shared_ptr< Buffers::InstanceNetworkBuffer >
Mint repeated instances and their backing InstanceNetwork.
Definition Mint.hpp:70
std::unique_ptr< Impl > m_impl
Definition Mint.hpp:104
Mint(const Mint &)=delete
auto operator()(const StructureConfig::Assembly &config) -> std::shared_ptr< Buffers::NetworkGeometryBuffer >
Mint independently supplied geometry into one rendered assembly.
Definition Mint.hpp:81
auto operator()(const StructureConfig::Model &config) -> std::shared_ptr< Buffers::MeshNetworkBuffer >
Mint a model and its backing MeshNetwork.
Definition Mint.hpp:56
auto operator()(const StructureConfig::Isosurface &config) -> std::shared_ptr< Buffers::ComputeMeshBuffer >
Mint a CPU or GPU evaluated isosurface.
Definition Mint.hpp:92
Mint & operator=(const Mint &)=delete
Mint(Mint &&) noexcept
Turns a structural config into a registered and rendered object.
Definition Mint.hpp:28
Main namespace for the Maya Flux audio engine.
Definition Runtime.cpp:12
Independent heterogeneous sources and their shared milling policy.
Prototype mesh and world transforms for one InstanceNetworkBuffer.
Existing isosurface buffer or new buffer construction state.
Mesh components and allocation policy for one MeshNetworkBuffer.
One independently rendered mesh-backed object.
API-side playground for a complete visible structure.