This commit is contained in:
2026-08-27 14:54:06 +08:00
parent ecf24cbe50
commit 63bb406a27
34 changed files with 690 additions and 1296 deletions
+26 -34
View File
@@ -89,16 +89,11 @@ std::unique_ptr<detail::Renderable_Descriptor> make_renderable_component(
using State = typename Definition::State;
using Adapter = detail::Renderable_Adapter<Object, Fields...,
detail::Prop_Field < &Renderable_2D::Prop::cache_enabled, "cache_enabled", "Whether this renderable reuses its complete color result across unchanged frames.">,
detail::State_Field<Tag, &State::prepare_dirty, "prepare_dirty", "Whether source changes require the prepare stage to run again.">,
detail::State_Field<Tag, &State::paint_dirty, "paint_dirty", "Whether prepared visual data requires the paint stage to run again.">,
detail::State_Field<Tag, &State::prepare_executed, "prepare_executed", "Whether the prepare stage executed during the latest scene cycle.">,
detail::State_Field<Tag, &State::paint_executed, "paint_executed", "Whether the paint stage executed during the latest scene cycle.">,
detail::State_Field<Tag, &State::prepare_graph_rebuilt, "prepare_graph_rebuilt", "Whether the prepare task graph was rebuilt during the latest cycle.">,
detail::State_Field<Tag, &State::paint_graph_rebuilt, "paint_graph_rebuilt", "Whether the paint task graph was rebuilt during the latest cycle.">,
detail::State_Field<Tag, &State::prepare_task_count, "prepare_task_count", "Number of tasks in the current prepare execution graph.">,
detail::State_Field<Tag, &State::paint_task_count, "paint_task_count", "Number of tasks in the current paint execution graph.">,
detail::State_Field<Tag, &State::prepare_execution_time_ns, "prepare_execution_time_ns", "Measured prepare-stage execution time in nanoseconds.">,
detail::State_Field<Tag, &State::paint_execution_time_ns, "paint_execution_time_ns", "Measured paint-stage execution time in nanoseconds."> >;
detail::State_Field<Tag, &State::render_dirty, "render_dirty", "Whether the render graph was dirty when evaluated.">,
detail::State_Field<Tag, &State::render_executed, "render_executed", "Whether the render graph executed during the latest scene cycle.">,
detail::State_Field<Tag, &State::graph_rebuilt, "graph_rebuilt", "Whether the render graph was rebuilt during the latest cycle.">,
detail::State_Field<Tag, &State::task_count, "task_count", "Number of tasks in the current render graph.">,
detail::State_Field<Tag, &State::execution_time_ns, "execution_time_ns", "Measured render graph execution time in nanoseconds."> >;
return detail::make_renderable_descriptor(std::move(id), std::move(label), std::move(kind), Adapter{object});
}
template <typename Scene_Object>
@@ -309,7 +304,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
std::vector<Plot_Value> values(count);
generate_spectral_row(values, animation_row, generator_count(input, "signal_count", 256), minimum, maximum, generator_number(input, "noise_stddev"), engine);
object.template pending_buffer<Spectrum_Frame_Tag>() = Spectrum_Frame{std::move(values)};
object.template mark_dirty<Prepare_Data_Tag>();
object.template mark_dirty<Render_Graph_Tag>();
generated_count = count;
}
else if constexpr (std::same_as<Definition, Frequency_Trace>) {
@@ -320,7 +315,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
std::vector<Frequency_Trace_Sample> samples(count);
for (std::size_t index = 0; index < count; ++index) samples[index] = {static_cast<Plot_Time_Tick>(index * tick_step), distribution(engine)};
for (const auto& sample : samples) object.template submit_stream<Frequency_Trace_Stream_Tag>(sample);
object.template mark_dirty<Prepare_Data_Tag>();
object.template mark_dirty<Render_Graph_Tag>();
generated_count = count;
}
else if constexpr (std::same_as<Definition, Sweep_Spectrum>) {
@@ -338,7 +333,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
object.template submit_stream<Sweep_Spectrum_Stream_Tag>(
std::make_shared<const Sweep_Spectrum_Block>(
Sweep_Spectrum_Block{block_index, std::move(blocks[block_index])}));
object.template mark_dirty<Prepare_Data_Tag>();
object.template mark_dirty<Render_Graph_Tag>();
generated_count = block_count * width;
}
else if constexpr (std::same_as<Definition, Afterglow>) {
@@ -353,7 +348,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
for (auto& spectrum : spectra)
object.template submit_stream<Afterglow_Stream_Tag>(
std::make_shared<const std::vector<Plot_Value>>(std::move(spectrum)));
object.template mark_dirty<Prepare_Data_Tag>();
object.template mark_dirty<Render_Graph_Tag>();
generated_count = row_count * width;
}
else if constexpr (std::same_as<Definition, Waterfall>) {
@@ -374,7 +369,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
for (auto& row : rows)
object.template submit_stream<Waterfall_Stream_Tag>(
std::make_shared<const Waterfall_Row>(std::move(row)));
object.template mark_dirty<Prepare_Data_Tag>();
object.template mark_dirty<Render_Graph_Tag>();
generated_count = row_count * width;
}
else if constexpr (std::same_as<Definition, Constellation_Diagram>) {
@@ -386,7 +381,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
const auto submitted = monotonic_milliseconds();
for (std::size_t index = 0; index < count; ++index) points[index] = {{i_distribution(engine), q_distribution(engine)}, submitted};
for (const auto& point : points) object.template submit_stream<Constellation_Stream_Tag>(point);
object.template mark_dirty<Prepare_Data_Tag>();
object.template mark_dirty<Render_Graph_Tag>();
generated_count = count;
}
else if constexpr (std::same_as<Definition, Selection_Rectangle_Overlay>) {
@@ -544,12 +539,9 @@ std::shared_ptr<Plot> make_axes_plot() {
.set(&Render_Scene_2D::Prop::viewport, canvas)
.set(&Render_Scene_2D::Prop::background, Color{7, 13, 24, 255})
.set(&Render_Scene_2D::Prop::view_active, true)
.add_dependency_node<Prepare_Data_Tag>(frequency.get())
.add_dependency_node<Prepare_Data_Tag>(numeric.get())
.add_dependency_node<Prepare_Data_Tag>(time.get())
.add_dependency_node<Paint_Tag>(frequency.get())
.add_dependency_node<Paint_Tag>(numeric.get())
.add_dependency_node<Paint_Tag>(time.get())
.add_dependency_node<Render_Graph_Tag>(frequency.get())
.add_dependency_node<Render_Graph_Tag>(numeric.get())
.add_dependency_node<Render_Graph_Tag>(time.get())
.build();
auto update = [scene = scene.get(), frequency = frequency.get(), numeric = numeric.get(), time = time.get()](const Plot_Render_Tick& event, bool) {
resize_axes(scene, {static_cast<int>(event.width), static_cast<int>(event.height)}, frequency, numeric, time);
@@ -617,7 +609,7 @@ std::shared_ptr<Plot> make_spectrum_plot() {
.set(&Render_Scene_2D::Prop::view_active, true)
.add_renderable(spectrum.get())
.add_renderable(selection.get())
.add_dependency<Paint_Tag>(selection.get(), spectrum.get())
.add_dependency<Render_Graph_Tag>(selection.get(), spectrum.get())
.build();
auto update = [scene = scene.get(), raw = spectrum.get(), frequency = frequency.get(), vertical = vertical.get()](const Plot_Render_Tick& event, bool demo_data) {
resize_axes(scene, {static_cast<int>(event.width), static_cast<int>(event.height)}, frequency, vertical);
@@ -631,7 +623,7 @@ std::shared_ptr<Plot> make_spectrum_plot() {
}
raw->template pending_buffer<Spectrum_Frame_Tag>() =
Spectrum_Frame{std::vector<Spectrum_Power>(samples.begin(), samples.end())};
raw->template mark_dirty<Prepare_Data_Tag>();
raw->template mark_dirty<Render_Graph_Tag>();
};
auto view = make_scene_view<
Prop_Field<&Spectrum::Prop::center_frequency, "center_frequency", "Frequency placed at the visual center of the spectrum axis.">,
@@ -677,7 +669,7 @@ std::shared_ptr<Plot> make_frequency_trace_plot() {
.set(&Render_Scene_2D::Prop::view_active, true)
.add_renderable(trace.get())
.add_renderable(selection.get())
.add_dependency<Paint_Tag>(selection.get(), trace.get())
.add_dependency<Render_Graph_Tag>(selection.get(), trace.get())
.build();
auto update = [scene = scene.get(), raw = trace.get(), time = time.get(), vertical = vertical.get()](const Plot_Render_Tick& event, bool demo_data) {
resize_axes(scene, {static_cast<int>(event.width), static_cast<int>(event.height)}, time, vertical);
@@ -691,7 +683,7 @@ std::shared_ptr<Plot> make_frequency_trace_plot() {
tick, std::sin(event.time_milliseconds * 0.0025) * 0.8
+ std::sin(event.time_milliseconds * 0.0007) * 0.2
});
raw->template mark_dirty<Prepare_Data_Tag>();
raw->template mark_dirty<Render_Graph_Tag>();
};
auto view = make_scene_view<
Prop_Field<&Frequency_Trace::Prop::partition_count, "partition_count", "Number of partitions used to prepare the time-ordered trace.">,
@@ -716,7 +708,7 @@ std::shared_ptr<Plot> make_sweep_spectrum_plot() {
.set(&Render_Scene_2D::Prop::view_active, true)
.add_renderable(sweep.get())
.add_renderable(selection.get())
.add_dependency<Paint_Tag>(selection.get(), sweep.get())
.add_dependency<Render_Graph_Tag>(selection.get(), sweep.get())
.build();
auto update = [scene = scene.get(), raw = sweep.get(), frequency = frequency.get(), vertical = vertical.get()](const Plot_Render_Tick& event, bool demo_data) {
resize_axes(scene, {static_cast<int>(event.width), static_cast<int>(event.height)}, frequency, vertical);
@@ -733,7 +725,7 @@ std::shared_ptr<Plot> make_sweep_spectrum_plot() {
raw->template submit_stream<Sweep_Spectrum_Stream_Tag>(
std::make_shared<const Sweep_Spectrum_Block>(
Sweep_Spectrum_Block{block_index, std::move(values)}));
raw->template mark_dirty<Prepare_Data_Tag>();
raw->template mark_dirty<Render_Graph_Tag>();
};
auto view = make_scene_view<
Prop_Field<&Sweep_Spectrum::Prop::bins_per_block, "bins_per_block", "Number of frequency bins stored in each incoming sweep block.">,
@@ -765,7 +757,7 @@ std::shared_ptr<Plot> make_afterglow_plot() {
.set(&Render_Scene_2D::Prop::view_active, true)
.add_renderable(afterglow.get())
.add_renderable(selection.get())
.add_dependency<Paint_Tag>(selection.get(), afterglow.get())
.add_dependency<Render_Graph_Tag>(selection.get(), afterglow.get())
.build();
auto update = [scene = scene.get(), raw = afterglow.get(), frequency = frequency.get(), vertical = vertical.get()](const Plot_Render_Tick& event, bool demo_data) {
resize_axes(scene, {static_cast<int>(event.width), static_cast<int>(event.height)}, frequency, vertical);
@@ -777,7 +769,7 @@ std::shared_ptr<Plot> make_afterglow_plot() {
- 0.18 * std::sin(event.time_milliseconds * 0.0008), 2.0));
raw->template submit_stream<Afterglow_Stream_Tag>(
std::make_shared<const std::vector<Plot_Value>>(values.begin(), values.end()));
raw->template mark_dirty<Prepare_Data_Tag>();
raw->template mark_dirty<Render_Graph_Tag>();
};
auto view = make_scene_view<
Prop_Field<&Afterglow::Prop::frequency_point_size, "frequency_point_size", "Number of frequency cells allocated across each afterglow row.">,
@@ -808,7 +800,7 @@ std::shared_ptr<Plot> make_waterfall_plot() {
.set(&Render_Scene_2D::Prop::view_active, true)
.add_renderable(waterfall.get())
.add_renderable(selection.get())
.add_dependency<Paint_Tag>(selection.get(), waterfall.get())
.add_dependency<Render_Graph_Tag>(selection.get(), waterfall.get())
.build();
auto update = [scene = scene.get(), raw = waterfall.get(), frequency = frequency.get(), time = time.get()](const Plot_Render_Tick& event, bool demo_data) {
resize_axes(scene, {static_cast<int>(event.width), static_cast<int>(event.height)}, frequency, time);
@@ -827,7 +819,7 @@ std::shared_ptr<Plot> make_waterfall_plot() {
std::make_shared<const Waterfall_Row>(Waterfall_Row{
tick, {values.begin(), values.end()}
}));
raw->template mark_dirty<Prepare_Data_Tag>();
raw->template mark_dirty<Render_Graph_Tag>();
};
auto view = make_scene_view<
Prop_Field<&Waterfall::Prop::tooltip_enabled, "tooltip_enabled", "Enables value inspection tooltips over waterfall cells.">,
@@ -862,7 +854,7 @@ std::shared_ptr<Plot> make_constellation_plot() {
.set(&Render_Scene_2D::Prop::view_active, true)
.add_renderable(constellation.get())
.add_renderable(selection.get())
.add_dependency<Paint_Tag>(selection.get(), constellation.get())
.add_dependency<Render_Graph_Tag>(selection.get(), constellation.get())
.build();
auto update = [scene = scene.get(), raw = constellation.get(), horizontal = horizontal.get(), vertical = vertical.get()](const Plot_Render_Tick& event, bool demo_data) {
resize_axes(scene, {static_cast<int>(event.width), static_cast<int>(event.height)}, horizontal, vertical);
@@ -886,7 +878,7 @@ std::shared_ptr<Plot> make_constellation_plot() {
monotonic_milliseconds()
});
}
raw->template mark_dirty<Prepare_Data_Tag>();
raw->template mark_dirty<Render_Graph_Tag>();
};
auto view = make_scene_view<
Prop_Field<&Constellation_Diagram::Prop::partition_count, "partition_count", "Number of partitions used to render received constellation points.">,
+5 -5
View File
@@ -287,11 +287,11 @@ inline std::string_view protocol_field_label(std::string_view key) {
{"selected_regions", "已选区域"}, {"cache_enabled", "启用绘制缓存"},
{"transform", "空间变换"}, {"visible", "是否可见"},
{"depth_test", "深度测试"}, {"items", "项目数据"},
{"prepare_dirty", "准备阶段待更新"}, {"paint_dirty", "绘制阶段待更新"},
{"prepare_executed", "准备阶段已执行"}, {"paint_executed", "绘制阶段已执行"},
{"prepare_graph_rebuilt", "准备任务图已重建"}, {"paint_graph_rebuilt", "绘制任务图已重建"},
{"prepare_task_count", "准备任务数量"}, {"paint_task_count", "绘制任务数量"},
{"prepare_execution_time_ns", "准备耗时"}, {"paint_execution_time_ns", "绘制耗时"},
{"render_dirty", "渲染图待更新"},
{"render_executed", "渲染图已执行"},
{"graph_rebuilt", "渲染图已重建"},
{"task_count", "任务数量"},
{"execution_time_ns", "渲染耗时"},
{"taskflow_rebuilt", "场景任务图已重建"}, {"renderable_count", "可渲染对象数量"},
{"taskflow_task_count", "场景任务数量"}, {"taskflow_dependency_count", "任务依赖数量"},
{"taskflow_max_predecessors", "最大前驱数量"}, {"taskflow_max_successors", "最大后继数量"},