四个方向 分块渲染
This commit is contained in:
@@ -54,6 +54,35 @@ void Renderable::render(const ::Scene_Render_Context& context) {
|
||||
}
|
||||
}
|
||||
|
||||
void Renderable::build_task_graph(Renderable_Task_Graph& graph) {
|
||||
build_paint_task_graph(graph);
|
||||
}
|
||||
|
||||
void Renderable::build_paint_task_graph(Renderable_Task_Graph& graph) {
|
||||
add_paint_task(graph, "paint", [this](detail::Painter& painter,
|
||||
const Render_State_View& state) {
|
||||
paint(painter, state);
|
||||
});
|
||||
}
|
||||
|
||||
Renderable_Task_Graph::Task Renderable::add_paint_task(
|
||||
Renderable_Task_Graph& graph,
|
||||
std::string name,
|
||||
Paint_Task_Function function) {
|
||||
return graph.emplace(
|
||||
[this, function = std::move(function)](const Scene_Render_Context& context) {
|
||||
if (!is_visible() || context.color_cache == nullptr)
|
||||
return;
|
||||
auto* cache = dynamic_cast<detail::Blend2D_Color_Cache*>(context.color_cache);
|
||||
if (!cache)
|
||||
return;
|
||||
detail::Painter painter(*cache, viewport_size());
|
||||
if (painter)
|
||||
function(painter, render_state_view());
|
||||
},
|
||||
std::move(name));
|
||||
}
|
||||
|
||||
void Renderable::changed() noexcept {
|
||||
invalidate_cache();
|
||||
plot_.notify_model_dirty();
|
||||
|
||||
Reference in New Issue
Block a user