This commit is contained in:
2026-08-12 13:46:53 +08:00
parent 898a58b554
commit d7cf626c25
22 changed files with 1639 additions and 292 deletions
+6 -6
View File
@@ -67,7 +67,7 @@ void Afterglow_Control::publish() {
void Afterglow_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
auto& output = impl_->render_frame;
const auto view = render_state_view();
const auto& state = render_properties(view);
const auto state = properties();
const auto& history = view.get(impl_->history);
const int width = history.empty()
? 0
@@ -84,7 +84,7 @@ void Afterglow_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
static_cast<int>(Scene_Base::task_executor_worker_count()), work_size, 4096);
const auto prepare = graph.emplace([this, partition_count](const Scene_Render_Context&) {
prepare_render_frame(render_state_view(), partition_count);
}, "prepare afterglow");
}, "准备余晖图");
std::vector<Renderable_Task_Graph::Task> accumulation;
accumulation.reserve(static_cast<std::size_t>(partition_count));
for (int index = 0; index < partition_count; ++index) {
@@ -92,13 +92,13 @@ void Afterglow_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
[this, index](const Scene_Render_Context&) {
accumulate_partition(render_state_view(), index);
},
"accumulate afterglow partition " + std::to_string(index + 1));
"累积余晖图分区 " + std::to_string(index + 1));
graph.precede(prepare, task);
accumulation.push_back(task);
}
const auto normalize = graph.emplace([this](const Scene_Render_Context&) {
normalize_render_frame();
}, "normalize afterglow");
}, "归一化余晖图");
for (const auto task : accumulation)
graph.precede(task, normalize);
std::vector<Renderable_Task_Graph::Task> coloring;
@@ -108,12 +108,12 @@ void Afterglow_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
[this, index](const Scene_Render_Context&) {
color_partition(render_state_view(), index);
},
"color afterglow partition " + std::to_string(index + 1));
"着色余晖图分区 " + std::to_string(index + 1));
graph.precede(normalize, task);
coloring.push_back(task);
}
const auto paint_image = add_paint_task(
graph, "paint afterglow shared image",
graph, "绘制余晖图共享图像",
[this](Painter& painter, const Render_State_View& frame_view,
const Scene_Render_Context& context) {
paint_render_frame(painter, frame_view,
+11 -4
View File
@@ -52,11 +52,19 @@ namespace detail {
class Paint_Overlay {};
template <Property_Set Properties_Type>
class Plottable_State : public Double_State_Strategy<Renderable, Properties_Type> {
class Plottable_State
: public Double_State_Strategy<Renderable, Properties_Type, Atomic_Spin_Mutex,
Observer_State<Renderable_State_Observer>> {
public:
using Properties = Properties_Type;
using Base = Double_State_Strategy<Renderable, Properties>;
Plottable_State(Plot_Core& plot, const Properties& properties) : Base(properties, plot) {}
using State_Observer = Observer_State<Renderable_State_Observer>;
using Base = Double_State_Strategy<Renderable, Properties, Atomic_Spin_Mutex,
State_Observer>;
Plottable_State(Plot_Core& plot, const Properties& properties)
: Base(properties,
With_Observer<State_Observer>{
State_Observer(Renderable_State_Observer(this))},
plot) {}
template <auto Member, Property_Member_Assignable<Properties, Member> Value>
Plottable_State& set(Value&& value) {
Base::template set<Member>(std::forward<Value>(value));
@@ -76,7 +84,6 @@ public:
}
}
}
this->changed();
return *this;
}
template <auto Member>
+17 -8
View File
@@ -66,11 +66,20 @@ void draw_curve(Painter& painter, std::span<const double> values, Range domain,
if(brush.enabled()) {
std::vector<PointF> polygon;
polygon.reserve(points.size() + 2);
polygon.push_back(mapped_point(frequency_axis, domain.origin, power_axis,
power_axis.coordinate_range.target));
PointF first_baseline = points.front();
PointF last_baseline = points.back();
const double baseline =
power_axis.coord_to_pixel(power_axis.coordinate_range.target);
if (power_axis.orientation == Orientation::Horizontal) {
first_baseline.x = baseline;
last_baseline.x = baseline;
} else {
first_baseline.y = baseline;
last_baseline.y = baseline;
}
polygon.push_back(first_baseline);
polygon.insert(polygon.end(), points.begin(), points.end());
polygon.push_back(mapped_point(frequency_axis, domain.target, power_axis,
power_axis.coordinate_range.target));
polygon.push_back(last_baseline);
painter.polygon(polygon, Pen{.style = Line_Style::None}, brush);
}
painter.polyline(points, pen);
@@ -244,14 +253,14 @@ void Spectrum_Control::publish() {
void Spectrum_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
auto& output = impl_->render_frame;
const auto view = render_state_view();
const auto& state = render_properties(view);
const auto state = properties();
const auto& published_frame = view.get(impl_->frame);
const std::size_t work_size = published_frame ? published_frame->samples.size() : 0;
const int partition_count = output.partitioner.graph_partition_count(
state.partition_mode, state.partition_count.get(),
static_cast<int>(Scene_Base::task_executor_worker_count()), work_size, 128);
const auto prepare = add_paint_task(
graph, "prepare spectrum and paint background",
graph, "准备频谱并绘制背景",
[this, partition_count](Painter& painter, const Render_State_View& frame_view,
const Scene_Render_Context&) {
prepare_render_frame(frame_view, partition_count);
@@ -261,7 +270,7 @@ void Spectrum_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
partitions.reserve(static_cast<std::size_t>(partition_count));
for (int index = 0; index < partition_count; ++index) {
const auto partition = add_paint_task(
graph, "paint spectrum partition " + std::to_string(index + 1),
graph, "绘制频谱分区 " + std::to_string(index + 1),
[this, index](Painter& painter, const Render_State_View& frame_view,
const Scene_Render_Context&) {
render_partition(painter, frame_view, index);
@@ -270,7 +279,7 @@ void Spectrum_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
partitions.push_back(partition);
}
const auto overlay = add_paint_task(
graph, "paint spectrum overlay",
graph, "绘制频谱覆盖层",
[this](Painter& painter, const Render_State_View& frame_view,
const Scene_Render_Context& context) {
paint_overlay(painter, frame_view,
+4 -4
View File
@@ -99,7 +99,7 @@ void Waterfall_Control::publish() {
void Waterfall_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
auto& output = impl_->render_frame;
const auto view = render_state_view();
const auto& state = render_properties(view);
const auto state = properties();
const auto& rows = view.get(impl_->rows);
std::size_t work_size{};
if (!rows.empty()) {
@@ -117,7 +117,7 @@ void Waterfall_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
static_cast<int>(Scene_Base::task_executor_worker_count()), work_size, 4096);
const auto prepare = graph.emplace([this, partition_count](const Scene_Render_Context&) {
prepare_render_frame(render_state_view(), partition_count);
}, "prepare waterfall");
}, "准备瀑布图");
std::vector<Renderable_Task_Graph::Task> partitions;
partitions.reserve(static_cast<std::size_t>(partition_count));
for (int index = 0; index < partition_count; ++index) {
@@ -125,12 +125,12 @@ void Waterfall_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
[this, index](const Scene_Render_Context&) {
render_partition(render_state_view(), index);
},
"raster waterfall partition " + std::to_string(index + 1));
"光栅化瀑布图分区 " + std::to_string(index + 1));
graph.precede(prepare, partition);
partitions.push_back(partition);
}
const auto paint_image = add_paint_task(
graph, "paint waterfall shared image",
graph, "绘制瀑布图共享图像",
[this](Painter& painter, const Render_State_View& frame_view,
const Scene_Render_Context& context) {
paint_render_frame(painter, frame_view,