四个方向 分块渲染

This commit is contained in:
2026-08-12 09:01:25 +08:00
parent b34c0d31b1
commit 9331b4cbf6
24 changed files with 788 additions and 108 deletions
@@ -74,7 +74,7 @@ TEST(Renderive_Core2, EveryCurveInterpolationModeHasDistinctSamplingSemantics) {
EXPECT_NEAR(cubic[2].value, 5.625, 1e-9);
const std::array<double, 11> visible_values{};
const Axis_Transform visible_x{{4.0, 6.0}, 0.0, 100.0};
const Axis_Transform visible_y{{0.0, 1.0}, 0.0, 100.0};
const Axis_Transform visible_y{{0.0, 1.0}, 0.0, 100.0, Orientation::Vertical};
const auto clipped = detail::curve_points(
visible_values, {0.0, 10.0}, visible_x, visible_y, true,
Line_Interpolation_Mode::Linear_Value);
@@ -608,6 +608,82 @@ TEST(Renderive_Core2, PlottableDataUpdatesReachKernelRealTimeDataStrategy) {
EXPECT_EQ(history.last_event, "real_time_data_updated");
EXPECT_GT(history.observation_count, latest.observation_count);
}
TEST(Renderive_Core2, AxisRasterLayoutCoversAxisSwapAndEveryReversal) {
constexpr Range first_source{0.0, 2.0};
constexpr Range second_source{0.0, 3.0};
for (const bool swapped : {false, true}) {
for (const bool first_reversed : {false, true}) {
for (const bool second_reversed : {false, true}) {
const Axis_Transform first{
first_reversed ? Range{2.0, 0.0} : Range{0.0, 2.0},
swapped ? 20.0 : 10.0, swapped ? 30.0 : 20.0,
swapped ? Orientation::Vertical : Orientation::Horizontal};
const Axis_Transform second{
second_reversed ? Range{3.0, 0.0} : Range{0.0, 3.0},
swapped ? 10.0 : 20.0, swapped ? 20.0 : 30.0,
swapped ? Orientation::Horizontal : Orientation::Vertical};
const auto layout = detail::axis_raster_layout(
first, second, first_source, second_source, 3, 4);
ASSERT_TRUE(layout.valid());
EXPECT_EQ(layout.width, swapped ? 4 : 3);
EXPECT_EQ(layout.height, swapped ? 3 : 4);
const std::size_t origin = layout.index(0, 0, 3, 4);
const int x = static_cast<int>(origin % layout.width);
const int y = static_cast<int>(origin / layout.width);
EXPECT_EQ(x, swapped ? (second_reversed ? 3 : 0)
: (first_reversed ? 2 : 0));
EXPECT_EQ(y, swapped ? (first_reversed ? 2 : 0)
: (second_reversed ? 3 : 0));
}
}
}
const std::array<double, 2> values{1.0, 3.0};
const Axis_Transform vertical_frequency{{0.0, 1.0}, 10.0, 20.0,
Orientation::Vertical};
const Axis_Transform horizontal_power{{0.0, 4.0}, 100.0, 40.0,
Orientation::Horizontal};
const auto points = detail::curve_points(
values, {0.0, 1.0}, vertical_frequency, horizontal_power, false,
Line_Interpolation_Mode::Linear_Value);
ASSERT_EQ(points.size(), 2u);
EXPECT_DOUBLE_EQ(points.front().x, 110.0);
EXPECT_DOUBLE_EQ(points.front().y, 10.0);
EXPECT_DOUBLE_EQ(points.back().x, 130.0);
EXPECT_DOUBLE_EQ(points.back().y, 30.0);
}
TEST(Renderive_Core2, PartitionedPlotsBuildExplicitInternalTaskGraphs) {
Plot_Core plot;
plot.init();
const auto root = plot.root_renderable();
const auto frequency = Frequency_Axis::Builder(root, Orientation::Horizontal)
.set_pixel_length(320)
.set_coord_range({0.0, 10.0})
.build();
const auto power = Axis::Builder(root, Orientation::Vertical)
.set_pixel_length(180)
.set_coord_range({-120.0, 0.0})
.build();
const auto time = Time_Axis::Builder(root, Orientation::Vertical)
.set_pixel_length(180)
.build();
const auto spectrum = Spectrum::Builder{}
.set<&Spectrum::Properties::partition_count>(4)
.build(root, frequency, power);
const auto waterfall = Waterfall::Builder{}
.set<&Waterfall::Properties::partition_count>(4)
.build(root, frequency, time);
const auto afterglow = Afterglow::Builder{}
.set<&Afterglow::Properties::partition_count>(4)
.build(root, frequency, power);
EXPECT_EQ(spectrum->get<&Spectrum::Properties::partition_count>(), 4);
EXPECT_EQ(waterfall->get<&Waterfall::Properties::partition_count>(), 4);
EXPECT_EQ(afterglow->get<&Afterglow::Properties::partition_count>(), 4);
EXPECT_EQ(spectrum->task_graph()->nodes().size(), 18u);
EXPECT_EQ(waterfall->task_graph()->nodes().size(), 18u);
EXPECT_EQ(afterglow->task_graph()->nodes().size(), 35u);
}
TEST(Renderive_Core2, PlottableAxesAreDataDependenciesAndPaintOverlays) {
Plot_Core plot;
plot.init();