MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Inspector.cpp
Go to the documentation of this file.
1#include "Inspector.hpp"
2
5
7
8std::optional<InspectResult> Inspector::s_node_graph_result;
9std::optional<InspectResult> Inspector::s_buffer_result;
10std::optional<InspectResult> Inspector::s_scheduler_result;
11std::optional<InspectResult> Inspector::s_event_result;
12
14 const std::shared_ptr<Core::Window>& window,
15 std::string_view text,
16 glm::uvec2 pixel_dims) const
17{
19 .color = { 1.F, 1.F, 1.F, 1.F },
20 .budget_h = pixel_dims.y,
21 };
22 auto text_image = Portal::Text::press(text, pixel_dims, params);
23
24 const size_t cap = static_cast<const size_t>(12) * Kakshya::VertexLayout::for_meshes().stride_bytes;
25 auto buf = std::make_shared<Buffers::FormaBuffer>(
28 buf->setup_rendering({
29 .target_window = window,
30 .additional_textures = { { "text", text_image } },
31 });
32
33 return { .buf = std::move(buf), .text_image = std::move(text_image) };
34}
35
37{
38 if (s_node_graph_result && &result == &*s_node_graph_result) {
39 s_node_graph_result.reset();
40 return;
41 }
42 if (s_buffer_result && &result == &*s_buffer_result) {
43 s_buffer_result.reset();
44 return;
45 }
46 if (s_scheduler_result && &result == &*s_scheduler_result) {
47 s_scheduler_result.reset();
48 return;
49 }
50 if (s_event_result && &result == &*s_event_result) {
51 s_event_result.reset();
52 return;
53 }
54 result = InspectResult {};
55}
56
57} // namespace MayaFlux::Portal::Forma
void add_buffer(const std::shared_ptr< Buffer > &buffer, ProcessingToken token, uint32_t channel=0)
Adds a buffer to a token and channel.
static std::optional< InspectResult > s_buffer_result
static std::optional< InspectResult > s_node_graph_result
static std::optional< InspectResult > s_event_result
RowBuffer make_row_buffer(const std::shared_ptr< Core::Window > &window, std::string_view text, glm::uvec2 pixel_dims) const
Definition Inspector.cpp:13
void destroy(InspectResult &result)
Destroy an InspectResult and release its resources.
Definition Inspector.cpp:36
static std::optional< InspectResult > s_scheduler_result
Buffers::BufferManager & m_bm
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
std::shared_ptr< Buffers::TextBuffer > press(std::string_view text, const PressParams &params)
Composite a UTF-8 string into a new TextBuffer.
Definition InkPress.cpp:237
uint32_t stride_bytes
Total bytes per vertex (stride in Vulkan terms) e.g., 3 floats (position) + 3 floats (normal) = 24 by...
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)
Result of an introspect call.
A pre-created buffer and its bound text image, passed to make_value_row.
glm::vec4 color
RGBA color applied to all glyphs.
Definition InkPress.hpp:53
Construction parameters for press().
Definition InkPress.hpp:48