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

◆ buffer()

InspectResult MayaFlux::Portal::Forma::Inspector::buffer ( const std::shared_ptr< Buffers::Buffer > &  buf,
Surface surface,
LayoutCursor cursor,
float  x_min = -0.95F,
float  x_max = 0.95F,
float  row_h = 0.05F,
int  depth = 0 
)

Inspect a single Buffer: default processor and full processing chain.

Header is the buffer's dynamic type name. Body rows expose the default processor type, then preprocessor, each indexed chain processor, postprocessor, and final processor. Absent slots show "-".

Definition at line 20 of file BufferQuery.cpp.

25{
26 const float ind = x_min + static_cast<float>(depth) * k_inspect_indent;
27 const std::string header_label = Reflect::short_dynamic_type_name(*buf);
28
29 std::vector<ValueSpec> values {
30 ValueSpec {
31 .label = "default_proc",
32 .reader = [buf] {
33 auto p = buf->get_default_processor();
34 return p ? std::string(Reflect::short_dynamic_type_name(*p)) : "-";
35 },
36 },
37 };
38
39 auto chain = buf->get_processing_chain();
40 if (chain) {
41 auto pre = chain->get_preprocessor(buf);
42 values.push_back(ValueSpec {
43 .label = "pre",
44 .reader = [pre] {
45 return pre ? std::string(Reflect::short_dynamic_type_name(*pre)) : "-";
46 },
47 });
48
49 const auto& processors = chain->get_processors(buf);
50 for (size_t i = 0; i < processors.size(); ++i) {
51 auto p = processors[i];
52 values.push_back(ValueSpec {
53 .label = "chain[" + std::to_string(i) + "]",
54 .reader = [p] {
55 return p ? std::string(Reflect::short_dynamic_type_name(*p)) : "-";
56 },
57 });
58 }
59
60 auto post = chain->get_postprocessor(buf);
61 values.push_back(ValueSpec {
62 .label = "post",
63 .reader = [post] {
64 return post ? std::string(Reflect::short_dynamic_type_name(*post)) : "-";
65 },
66 });
67
68 auto final_p = chain->get_final_processor(buf);
69 values.push_back(ValueSpec {
70 .label = "final",
71 .reader = [final_p] {
72 return final_p ? std::string(Reflect::short_dynamic_type_name(*final_p)) : "-";
73 },
74 });
75 }
76
77 const auto dims = row_pixel_dims(surface.window(), ind, x_max, row_h);
78 auto hbuf = make_row_buffer(surface.window(), header_label, dims);
79 std::vector<RowBuffer> rbufs;
80 rbufs.reserve(values.size());
81
82 for (const auto& spec : values)
83 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
84 auto group = make_value_group(values, std::move(hbuf), rbufs,
85 surface, cursor, ind, x_max, row_h, false);
86
87 InspectResult result;
88 result.group = std::move(group);
89 return result;
90}
RowBuffer make_row_buffer(const std::shared_ptr< Core::Window > &window, std::string_view text, glm::uvec2 pixel_dims) const
Definition Inspector.cpp:13
Tendency< A, C > chain(const Tendency< A, B > &first, const Tendency< B, C > &second)
Sequential composition: evaluate first, feed result into second.
Definition Tendency.hpp:82
ValueGroup make_value_group(std::span< const ValueSpec > values, RowBuffer header_buf, std::span< const RowBuffer > row_bufs, Surface &surface, LayoutCursor &cursor, float x_min, float x_max, float row_h, bool initially_open)
Construct a collapsible header followed by N value rows under it.
constexpr float k_inspect_indent
glm::uvec2 row_pixel_dims(const std::shared_ptr< Core::Window > &window, float x_min, float x_max, float row_h)
Convert an NDC row rect into integer pixel dimensions.
std::string short_dynamic_type_name(const T &obj) noexcept
Returns the unqualified dynamic type name of obj.
Definition TypeInfo.hpp:95

References MayaFlux::Portal::Forma::InspectResult::group, MayaFlux::Portal::Forma::k_inspect_indent, MayaFlux::Portal::Forma::ValueSpec::label, make_row_buffer(), MayaFlux::Portal::Forma::make_value_group(), MayaFlux::Portal::Forma::row_pixel_dims(), MayaFlux::Reflect::short_dynamic_type_name(), and MayaFlux::Portal::Forma::Surface::window().

Referenced by buffer_manager(), root_audio_buffer(), and root_graphics_buffer().

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