From 926846bc4a84b6c6617e529046e750d0d5215995 Mon Sep 17 00:00:00 2001 From: Achal Pandey Date: Wed, 18 Mar 2020 00:52:15 +0530 Subject: [PATCH 01/16] ScenePicker is no longer created everytime we pick something --- src/appleseed.studio/mainwindow/mainwindow.cpp | 5 +++++ .../mainwindow/rendering/materialdrophandler.cpp | 11 +++++++++-- .../mainwindow/rendering/materialdrophandler.h | 12 ++++++++---- .../mainwindow/rendering/rendertab.cpp | 9 +++++++++ .../mainwindow/rendering/rendertab.h | 1 + .../mainwindow/rendering/scenepickinghandler.cpp | 11 +++++++++-- .../mainwindow/rendering/scenepickinghandler.h | 3 +++ 7 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/appleseed.studio/mainwindow/mainwindow.cpp b/src/appleseed.studio/mainwindow/mainwindow.cpp index 380444ed29..2262c13e8a 100644 --- a/src/appleseed.studio/mainwindow/mainwindow.cpp +++ b/src/appleseed.studio/mainwindow/mainwindow.cpp @@ -1450,6 +1450,11 @@ void MainWindow::slot_open_cornellbox_builtin_project() if (!can_close_project()) return; + // Reset the ScenePickers for certain handlers, so that they don't hold a reference to + // Lazy and consequently it can be destroyed without obstruction. + for (const_each i = m_render_tabs; i; ++i) + i->second->update_handlers(); + APPLESEED_UNUSED const bool successful = m_project_manager.load_builtin_project("cornell_box"); assert(successful); diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp index a68b25dcdb..bde7998fbc 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp @@ -49,6 +49,11 @@ MaterialDropHandler::MaterialDropHandler( { } +void MaterialDropHandler::reset_scene_picker() +{ + m_scene_picker = nullptr; +} + void MaterialDropHandler::slot_material_dropped( const foundation::Vector2d& drop_pos, const QString& material_name) @@ -62,6 +67,9 @@ void MaterialDropHandler::slot_material_dropped( return; } + if (!m_scene_picker) + m_scene_picker = std::make_unique(m_project); + QMenu* selection_menu = new QMenu(); connect(selection_menu->addAction("Front Side"), SIGNAL(triggered()), SLOT(slot_apply_to_front())); connect(selection_menu->addAction("Back Side"), SIGNAL(triggered()), SLOT(slot_apply_to_back())); @@ -111,8 +119,7 @@ namespace void MaterialDropHandler::assign_material(const renderer::ObjectInstance::Side side) { - const renderer::ScenePicker scene_picker(m_project); - const renderer::ScenePicker::PickingResult result = scene_picker.pick(m_drop_pos); + const renderer::ScenePicker::PickingResult result = m_scene_picker->pick(m_drop_pos); renderer::ObjectInstance* instance = result.m_object_instance; std::vector material_slots; diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h index 6a1c77330e..8faec6581a 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h @@ -29,6 +29,7 @@ #pragma once // appleseed.renderer headers. +#include "renderer/api/scenepicker.h" #include "renderer/modeling/project/project.h" #include "renderer/modeling/scene/objectinstance.h" @@ -58,16 +59,19 @@ class MaterialDropHandler const renderer::Project& project, RenderingManager& rendering_manager); + void reset_scene_picker(); + public slots: void slot_material_dropped( const foundation::Vector2d& drop_pos, const QString& material_name); private: - const renderer::Project& m_project; - RenderingManager& m_rendering_manager; - foundation::Vector2d m_drop_pos; - std::string m_material_name; + const renderer::Project& m_project; + RenderingManager& m_rendering_manager; + foundation::Vector2d m_drop_pos; + std::string m_material_name; + std::unique_ptr m_scene_picker = nullptr; void assign_material(const renderer::ObjectInstance::Side side); diff --git a/src/appleseed.studio/mainwindow/rendering/rendertab.cpp b/src/appleseed.studio/mainwindow/rendering/rendertab.cpp index 7552f27ca9..bceacfb17e 100644 --- a/src/appleseed.studio/mainwindow/rendering/rendertab.cpp +++ b/src/appleseed.studio/mainwindow/rendering/rendertab.cpp @@ -160,6 +160,15 @@ void RenderTab::update_size() recreate_handlers(); } +void RenderTab::update_handlers() +{ + if (m_scene_picking_handler) + m_scene_picking_handler->reset_scene_picker(); + + if (m_material_drop_handler) + m_material_drop_handler->reset_scene_picker(); +} + RenderTab::State RenderTab::save_state() const { State state; diff --git a/src/appleseed.studio/mainwindow/rendering/rendertab.h b/src/appleseed.studio/mainwindow/rendering/rendertab.h index 62008a2979..d664faa601 100644 --- a/src/appleseed.studio/mainwindow/rendering/rendertab.h +++ b/src/appleseed.studio/mainwindow/rendering/rendertab.h @@ -99,6 +99,7 @@ class RenderTab void update(); void update_size(); + void update_handlers(); struct State { diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp index 328b866e5b..8d4848b424 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp @@ -118,6 +118,11 @@ void ScenePickingHandler::set_enabled(const bool enabled) m_enabled = enabled; } +void ScenePickingHandler::reset_scene_picker() +{ + m_scene_picker = nullptr; +} + bool ScenePickingHandler::eventFilter(QObject* object, QEvent* event) { if (m_enabled) @@ -231,11 +236,13 @@ ItemBase* ScenePickingHandler::pick(const QPoint& point) return nullptr; } + if (!m_scene_picker) + m_scene_picker = std::make_unique(m_project); + const Vector2i pix = m_mouse_tracker.widget_to_pixel(point); const Vector2d ndc = m_mouse_tracker.widget_to_ndc(point); - const ScenePicker scene_picker(m_project); - const ScenePicker::PickingResult result = scene_picker.pick(ndc); + const ScenePicker::PickingResult result = m_scene_picker->pick(ndc); std::stringstream sstr; diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h index 6871231342..88109721e0 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h @@ -72,6 +72,8 @@ class ScenePickingHandler void set_enabled(const bool enabled); + void reset_scene_picker(); + signals: void signal_entity_picked(renderer::ScenePicker::PickingResult result); @@ -82,6 +84,7 @@ class ScenePickingHandler const ProjectExplorer& m_project_explorer; const renderer::Project& m_project; bool m_enabled; + std::unique_ptr m_scene_picker = nullptr; bool eventFilter(QObject* object, QEvent* event) override; From 5329b09c3bcc593823ff32a6e92f30d9382bbea9 Mon Sep 17 00:00:00 2001 From: Achal Pandey Date: Sat, 21 Mar 2020 21:09:38 +0530 Subject: [PATCH 02/16] TraceContext in ScenePicker gets updated after AssemblyTree is built --- .../rendering/qtrenderercontroller.cpp | 5 ++++ .../rendering/qtrenderercontroller.h | 4 +++ .../bindrenderercontroller.cpp | 16 +++++++++++ .../mainwindow/mainwindow.cpp | 10 ++----- .../rendering/materialdrophandler.cpp | 27 +++++++++---------- .../rendering/materialdrophandler.h | 12 +++++---- .../rendering/qtrenderercontroller.cpp | 5 ++++ .../rendering/qtrenderercontroller.h | 4 +++ .../mainwindow/rendering/renderingmanager.cpp | 10 +++++++ .../mainwindow/rendering/renderingmanager.h | 1 + .../mainwindow/rendering/rendertab.cpp | 23 ++++++++-------- .../mainwindow/rendering/rendertab.h | 3 ++- .../rendering/scenepickinghandler.cpp | 22 +++++---------- .../rendering/scenepickinghandler.h | 9 +++---- .../rendering/defaultrenderercontroller.cpp | 4 +++ .../rendering/defaultrenderercontroller.h | 3 +++ .../kernel/rendering/irenderercontroller.h | 3 +++ .../kernel/rendering/masterrenderer.cpp | 2 ++ .../renderercontrollercollection.cpp | 6 +++++ .../rendering/renderercontrollercollection.h | 1 + .../rendering/serialrenderercontroller.cpp | 5 ++++ .../rendering/serialrenderercontroller.h | 1 + 22 files changed, 114 insertions(+), 62 deletions(-) diff --git a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.cpp b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.cpp index 0497d952ae..4aa8acdb51 100644 --- a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.cpp +++ b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.cpp @@ -86,6 +86,11 @@ void QtRendererController::on_frame_end() emit signal_frame_end(); } +void QtRendererController::on_assembly_tree_built() +{ + emit signal_assembly_tree_built(); +} + void QtRendererController::set_status(const Status status) { m_status = status; diff --git a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h index d3b47ffaf3..7776b7c4aa 100644 --- a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h +++ b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h @@ -72,6 +72,9 @@ class QtRendererController // This method is called after rendering a single frame. void on_frame_end() override; + // This method is called after assembly tree is built. + void on_assembly_tree_built() override; + // Store a new status value. void set_status(const Status status); @@ -86,6 +89,7 @@ class QtRendererController void signal_rendering_resume(); void signal_frame_begin(); void signal_frame_end(); + void signal_assembly_tree_built(); private: boost::atomic m_status; diff --git a/src/appleseed.python/bindrenderercontroller.cpp b/src/appleseed.python/bindrenderercontroller.cpp index b1ae732007..54fb0df189 100644 --- a/src/appleseed.python/bindrenderercontroller.cpp +++ b/src/appleseed.python/bindrenderercontroller.cpp @@ -177,6 +177,22 @@ namespace } } + void on_assembly_tree_built() override + { + // Lock Python's global interpreter lock (GIL), + // it was released in MasterRenderer.render. + ScopedGILLock lock; + + try + { + get_override("on_assembly_tree_built")(); + } + catch (bpy::error_already_set) + { + PyErr_Print(); + } + } + Status get_status() const override { // Lock Python's global interpreter lock (GIL), diff --git a/src/appleseed.studio/mainwindow/mainwindow.cpp b/src/appleseed.studio/mainwindow/mainwindow.cpp index 2262c13e8a..574b88a0f8 100644 --- a/src/appleseed.studio/mainwindow/mainwindow.cpp +++ b/src/appleseed.studio/mainwindow/mainwindow.cpp @@ -300,6 +300,7 @@ bool MainWindow::pack_project(QString filepath) void MainWindow::close_project() { + remove_render_tabs(); m_project_manager.close_project(); on_project_change(); } @@ -899,10 +900,6 @@ void MainWindow::set_rendering_widgets_enabled(const bool is_enabled, const Rend // Set/clear rendering region. render_tab->set_render_region_buttons_enabled( is_enabled && is_project_open && rendering_mode != RenderingMode::FinalRendering); - - // Scene picker. - render_tab->get_scene_picking_handler()->set_enabled( - is_enabled && is_project_open && rendering_mode != RenderingMode::FinalRendering); } } } @@ -1450,10 +1447,7 @@ void MainWindow::slot_open_cornellbox_builtin_project() if (!can_close_project()) return; - // Reset the ScenePickers for certain handlers, so that they don't hold a reference to - // Lazy and consequently it can be destroyed without obstruction. - for (const_each i = m_render_tabs; i; ++i) - i->second->update_handlers(); + remove_render_tabs(); APPLESEED_UNUSED const bool successful = m_project_manager.load_builtin_project("cornell_box"); assert(successful); diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp index bde7998fbc..bfff23f696 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp @@ -43,32 +43,29 @@ namespace appleseed { namespace studio { MaterialDropHandler::MaterialDropHandler( - const renderer::Project& project, - RenderingManager& rendering_manager) - : m_project(project), m_rendering_manager(rendering_manager) + renderer::Project& project, + RenderingManager& rendering_manager, + const renderer::ScenePicker& scene_picker) + : m_project(project), m_rendering_manager(rendering_manager), m_enabled(false), m_scene_picker(scene_picker) { } -void MaterialDropHandler::reset_scene_picker() +void MaterialDropHandler::set_enabled(const bool enabled) { - m_scene_picker = nullptr; + m_enabled = enabled; + + m_project.update_trace_context(); } void MaterialDropHandler::slot_material_dropped( - const foundation::Vector2d& drop_pos, - const QString& material_name) + const foundation::Vector2d& drop_pos, + const QString& material_name) { m_drop_pos = drop_pos; m_material_name = material_name.toStdString(); - if (!m_project.has_trace_context()) - { - RENDERER_LOG_INFO("the scene must be rendering or must have been rendered at least once for drag and drop to be available."); + if (!m_enabled) return; - } - - if (!m_scene_picker) - m_scene_picker = std::make_unique(m_project); QMenu* selection_menu = new QMenu(); connect(selection_menu->addAction("Front Side"), SIGNAL(triggered()), SLOT(slot_apply_to_front())); @@ -119,7 +116,7 @@ namespace void MaterialDropHandler::assign_material(const renderer::ObjectInstance::Side side) { - const renderer::ScenePicker::PickingResult result = m_scene_picker->pick(m_drop_pos); + const renderer::ScenePicker::PickingResult result = m_scene_picker.pick(m_drop_pos); renderer::ObjectInstance* instance = result.m_object_instance; std::vector material_slots; diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h index 8faec6581a..711c0f543f 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h @@ -56,10 +56,11 @@ class MaterialDropHandler public: MaterialDropHandler( - const renderer::Project& project, - RenderingManager& rendering_manager); + renderer::Project& project, + RenderingManager& rendering_manager, + const renderer::ScenePicker& scene_picker); - void reset_scene_picker(); + void set_enabled(const bool enabled); public slots: void slot_material_dropped( @@ -67,11 +68,12 @@ class MaterialDropHandler const QString& material_name); private: - const renderer::Project& m_project; + renderer::Project& m_project; RenderingManager& m_rendering_manager; foundation::Vector2d m_drop_pos; std::string m_material_name; - std::unique_ptr m_scene_picker = nullptr; + bool m_enabled; + const renderer::ScenePicker& m_scene_picker; void assign_material(const renderer::ObjectInstance::Side side); diff --git a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.cpp b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.cpp index 0364883386..3a7a186188 100644 --- a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.cpp +++ b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.cpp @@ -86,6 +86,11 @@ void QtRendererController::on_frame_end() emit signal_frame_end(); } +void QtRendererController::on_assembly_tree_built() +{ + emit signal_assembly_tree_built(); +} + void QtRendererController::set_status(const Status status) { m_status = status; diff --git a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h index 6cbae1c838..af44f9017d 100644 --- a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h +++ b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h @@ -72,6 +72,9 @@ class QtRendererController // This method is called after rendering a single frame. void on_frame_end() override; + // This method is called after the assembly tree is built. + void on_assembly_tree_built() override; + // Store a new status value. void set_status(const Status status); @@ -86,6 +89,7 @@ class QtRendererController void signal_rendering_resume(); void signal_frame_begin(); void signal_frame_end(); + void signal_assembly_tree_built(); private: boost::atomic m_status; diff --git a/src/appleseed.studio/mainwindow/rendering/renderingmanager.cpp b/src/appleseed.studio/mainwindow/rendering/renderingmanager.cpp index 2c34708b21..5894b72df5 100644 --- a/src/appleseed.studio/mainwindow/rendering/renderingmanager.cpp +++ b/src/appleseed.studio/mainwindow/rendering/renderingmanager.cpp @@ -174,6 +174,11 @@ RenderingManager::RenderingManager(StatusBar& status_bar) SLOT(slot_rendering_resume()), Qt::BlockingQueuedConnection); + connect( + &m_renderer_controller, SIGNAL(signal_assembly_tree_built()), + SLOT(slot_assembly_tree_built()), + Qt::BlockingQueuedConnection); + connect( &m_renderer_controller, SIGNAL(signal_rendering_success()), SIGNAL(signal_rendering_end())); @@ -523,6 +528,11 @@ void RenderingManager::slot_camera_change_end() { } +void RenderingManager::slot_assembly_tree_built() +{ + m_render_tab->enable_scene_picking(); +} + void RenderingManager::slot_master_renderer_thread_finished() { m_master_renderer.reset(); diff --git a/src/appleseed.studio/mainwindow/rendering/renderingmanager.h b/src/appleseed.studio/mainwindow/rendering/renderingmanager.h index 8fa8995dce..07fe73d1f5 100644 --- a/src/appleseed.studio/mainwindow/rendering/renderingmanager.h +++ b/src/appleseed.studio/mainwindow/rendering/renderingmanager.h @@ -199,6 +199,7 @@ class RenderingManager void slot_camera_change_begin(); void slot_camera_changed(); void slot_camera_change_end(); + void slot_assembly_tree_built(); void slot_master_renderer_thread_finished(); }; diff --git a/src/appleseed.studio/mainwindow/rendering/rendertab.cpp b/src/appleseed.studio/mainwindow/rendering/rendertab.cpp index bceacfb17e..a1bb1f7b61 100644 --- a/src/appleseed.studio/mainwindow/rendering/rendertab.cpp +++ b/src/appleseed.studio/mainwindow/rendering/rendertab.cpp @@ -83,6 +83,7 @@ RenderTab::RenderTab( : m_project_explorer(project_explorer) , m_project(project) , m_rendering_manager(rendering_manager) + , m_scene_picker(project) , m_ocio_config(ocio_config) { setObjectName("render_widget_tab"); @@ -137,6 +138,12 @@ void RenderTab::darken() m_render_widget->multiply(0.2f); } +void RenderTab::enable_scene_picking() +{ + m_scene_picking_handler->set_enabled(true); + m_material_drop_handler->set_enabled(true); +} + void RenderTab::reset_zoom() { m_zoom_handler->reset_zoom(); @@ -160,15 +167,6 @@ void RenderTab::update_size() recreate_handlers(); } -void RenderTab::update_handlers() -{ - if (m_scene_picking_handler) - m_scene_picking_handler->reset_scene_picker(); - - if (m_material_drop_handler) - m_material_drop_handler->reset_scene_picker(); -} - RenderTab::State RenderTab::save_state() const { State state; @@ -472,7 +470,8 @@ void RenderTab::recreate_handlers() m_picking_mode_combo, *m_mouse_tracker.get(), m_project_explorer, - m_project)); + m_project, + m_scene_picker)); connect( m_scene_picking_handler.get(), SIGNAL(signal_entity_picked(renderer::ScenePicker::PickingResult)), SIGNAL(signal_entity_picked(renderer::ScenePicker::PickingResult))); @@ -499,7 +498,8 @@ void RenderTab::recreate_handlers() m_material_drop_handler.reset( new MaterialDropHandler( m_project, - m_rendering_manager)); + m_rendering_manager, + m_scene_picker)); connect( m_render_widget, SIGNAL(signal_material_dropped(const foundation::Vector2d&, const QString&)), m_material_drop_handler.get(), SLOT(slot_material_dropped(const foundation::Vector2d&, const QString&))); @@ -507,7 +507,6 @@ void RenderTab::recreate_handlers() // Set initial state. m_pixel_inspector_handler->set_enabled(false); m_camera_controller->set_enabled(false); - m_scene_picking_handler->set_enabled(true); } } // namespace studio diff --git a/src/appleseed.studio/mainwindow/rendering/rendertab.h b/src/appleseed.studio/mainwindow/rendering/rendertab.h index d664faa601..be7d629790 100644 --- a/src/appleseed.studio/mainwindow/rendering/rendertab.h +++ b/src/appleseed.studio/mainwindow/rendering/rendertab.h @@ -95,11 +95,11 @@ class RenderTab void clear(); void darken(); + void enable_scene_picking(); void reset_zoom(); void update(); void update_size(); - void update_handlers(); struct State { @@ -149,6 +149,7 @@ class RenderTab ProjectExplorer& m_project_explorer; renderer::Project& m_project; RenderingManager& m_rendering_manager; + renderer::ScenePicker m_scene_picker; std::unique_ptr m_zoom_handler; std::unique_ptr m_pan_handler; diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp index 8d4848b424..37ddb13715 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp @@ -84,13 +84,15 @@ ScenePickingHandler::ScenePickingHandler( QComboBox* picking_mode_combo, const MouseCoordinatesTracker& mouse_tracker, const ProjectExplorer& project_explorer, - const Project& project) + Project& project, + const ScenePicker& scene_picker) : m_widget(widget) , m_picking_mode_combo(picking_mode_combo) , m_mouse_tracker(mouse_tracker) , m_project_explorer(project_explorer) , m_project(project) - , m_enabled(true) + , m_enabled(false) + , m_scene_picker(scene_picker) { m_widget->installEventFilter(this); @@ -116,11 +118,8 @@ ScenePickingHandler::~ScenePickingHandler() void ScenePickingHandler::set_enabled(const bool enabled) { m_enabled = enabled; -} -void ScenePickingHandler::reset_scene_picker() -{ - m_scene_picker = nullptr; + m_project.update_trace_context(); } bool ScenePickingHandler::eventFilter(QObject* object, QEvent* event) @@ -230,19 +229,10 @@ namespace ItemBase* ScenePickingHandler::pick(const QPoint& point) { - if (!m_project.has_trace_context()) - { - RENDERER_LOG_INFO("the scene must be rendering or must have been rendered at least once for picking to be available."); - return nullptr; - } - - if (!m_scene_picker) - m_scene_picker = std::make_unique(m_project); - const Vector2i pix = m_mouse_tracker.widget_to_pixel(point); const Vector2d ndc = m_mouse_tracker.widget_to_ndc(point); - const ScenePicker::PickingResult result = m_scene_picker->pick(ndc); + const ScenePicker::PickingResult result = m_scene_picker.pick(ndc); std::stringstream sstr; diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h index 88109721e0..c8be7af006 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h @@ -66,14 +66,13 @@ class ScenePickingHandler QComboBox* picking_mode_combo, const qtcommon::MouseCoordinatesTracker& mouse_tracker, const ProjectExplorer& project_explorer, - const renderer::Project& project); + renderer::Project& project, + const renderer::ScenePicker& scene_picker); ~ScenePickingHandler() override; void set_enabled(const bool enabled); - void reset_scene_picker(); - signals: void signal_entity_picked(renderer::ScenePicker::PickingResult result); @@ -82,9 +81,9 @@ class ScenePickingHandler QComboBox* m_picking_mode_combo; const qtcommon::MouseCoordinatesTracker& m_mouse_tracker; const ProjectExplorer& m_project_explorer; - const renderer::Project& m_project; + renderer::Project& m_project; bool m_enabled; - std::unique_ptr m_scene_picker = nullptr; + const renderer::ScenePicker& m_scene_picker; bool eventFilter(QObject* object, QEvent* event) override; diff --git a/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.cpp b/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.cpp index fb198ad0a8..5813c70873 100644 --- a/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.cpp +++ b/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.cpp @@ -69,6 +69,10 @@ void DefaultRendererController::on_progress() { } +void DefaultRendererController::on_assembly_tree_built() +{ +} + IRendererController::Status DefaultRendererController::get_status() const { return ContinueRendering; diff --git a/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.h b/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.h index 4040720080..d11c3178f8 100644 --- a/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.h +++ b/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.h @@ -73,6 +73,9 @@ class APPLESEED_DLLSYMBOL DefaultRendererController // This method is called continuously during rendering. void on_progress() override; + // This method is called after assembly tree is built. + void on_assembly_tree_built() override; + // Return the current rendering status. Status get_status() const override; }; diff --git a/src/appleseed/renderer/kernel/rendering/irenderercontroller.h b/src/appleseed/renderer/kernel/rendering/irenderercontroller.h index 842aa6c45b..f3eb03d8ee 100644 --- a/src/appleseed/renderer/kernel/rendering/irenderercontroller.h +++ b/src/appleseed/renderer/kernel/rendering/irenderercontroller.h @@ -73,6 +73,9 @@ class APPLESEED_DLLSYMBOL IRendererController // This method is called continuously during rendering. virtual void on_progress() = 0; + // This method is called after assembly tree is built. + virtual void on_assembly_tree_built() = 0; + enum Status { // Continue/resume rendering. diff --git a/src/appleseed/renderer/kernel/rendering/masterrenderer.cpp b/src/appleseed/renderer/kernel/rendering/masterrenderer.cpp index eb0d305e87..82511237ea 100644 --- a/src/appleseed/renderer/kernel/rendering/masterrenderer.cpp +++ b/src/appleseed/renderer/kernel/rendering/masterrenderer.cpp @@ -392,6 +392,8 @@ struct MasterRenderer::Impl return IRendererController::AbortRendering; } + renderer_controller.on_assembly_tree_built(); + // Load the checkpoint if any. Frame& frame = *m_project.get_frame(); const size_t pass_count = m_params.get_optional("passes", 1); diff --git a/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.cpp b/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.cpp index 37dbfcd57a..0a51237f38 100644 --- a/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.cpp +++ b/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.cpp @@ -102,6 +102,12 @@ void RendererControllerCollection::on_progress() i->on_progress(); } +void RendererControllerCollection::on_assembly_tree_built() +{ + for (auto i : impl->m_renderer_controller) + i->on_assembly_tree_built(); +} + IRendererController::Status RendererControllerCollection::get_status() const { for (auto i : impl->m_renderer_controller) diff --git a/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.h b/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.h index d469928640..eb1d795b1a 100644 --- a/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.h +++ b/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.h @@ -59,6 +59,7 @@ class APPLESEED_DLLSYMBOL RendererControllerCollection void on_frame_begin() override; void on_frame_end() override; void on_progress() override; + void on_assembly_tree_built() override; Status get_status() const override; // Insert a renderer controller into the collection. diff --git a/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.cpp b/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.cpp index ef38142767..8ae1b2e82a 100644 --- a/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.cpp +++ b/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.cpp @@ -99,6 +99,11 @@ void SerialRendererController::on_progress() m_controller->on_progress(); } +void SerialRendererController::on_assembly_tree_built() +{ + m_controller->on_assembly_tree_built(); +} + IRendererController::Status SerialRendererController::get_status() const { return m_controller->get_status(); diff --git a/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.h b/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.h index f8fe2dcffa..d5a8b8e243 100644 --- a/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.h +++ b/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.h @@ -70,6 +70,7 @@ class SerialRendererController void on_frame_begin() override; void on_frame_end() override; void on_progress() override; + void on_assembly_tree_built() override; Status get_status() const override; void add_on_tiled_frame_begin_callback( From a7ee4efb0015205405821fee0d1d2d955997c838 Mon Sep 17 00:00:00 2001 From: Achal Pandey Date: Sun, 22 Mar 2020 19:06:30 +0530 Subject: [PATCH 03/16] Super simplification! --- .../rendering/qtrenderercontroller.cpp | 5 ----- .../rendering/qtrenderercontroller.h | 1 - .../bindrenderercontroller.cpp | 16 ---------------- .../rendering/materialdrophandler.cpp | 19 +++++++++---------- .../rendering/materialdrophandler.h | 7 ++----- .../rendering/qtrenderercontroller.cpp | 5 ----- .../rendering/qtrenderercontroller.h | 3 --- .../mainwindow/rendering/renderingmanager.cpp | 10 ---------- .../mainwindow/rendering/renderingmanager.h | 1 - .../mainwindow/rendering/rendertab.cpp | 6 ------ .../mainwindow/rendering/rendertab.h | 1 - .../rendering/scenepickinghandler.cpp | 15 +++++++++++---- .../rendering/scenepickinghandler.h | 4 ++-- src/appleseed/foundation/math/bvh/bvh_tree.h | 9 +++++++++ .../rendering/defaultrenderercontroller.cpp | 4 ---- .../rendering/defaultrenderercontroller.h | 3 --- .../kernel/rendering/irenderercontroller.h | 3 --- .../kernel/rendering/masterrenderer.cpp | 2 -- .../renderercontrollercollection.cpp | 6 ------ .../rendering/renderercontrollercollection.h | 1 - .../rendering/serialrenderercontroller.cpp | 5 ----- .../rendering/serialrenderercontroller.h | 1 - 22 files changed, 33 insertions(+), 94 deletions(-) diff --git a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.cpp b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.cpp index 4aa8acdb51..0497d952ae 100644 --- a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.cpp +++ b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.cpp @@ -86,11 +86,6 @@ void QtRendererController::on_frame_end() emit signal_frame_end(); } -void QtRendererController::on_assembly_tree_built() -{ - emit signal_assembly_tree_built(); -} - void QtRendererController::set_status(const Status status) { m_status = status; diff --git a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h index 7776b7c4aa..f582d50c80 100644 --- a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h +++ b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h @@ -89,7 +89,6 @@ class QtRendererController void signal_rendering_resume(); void signal_frame_begin(); void signal_frame_end(); - void signal_assembly_tree_built(); private: boost::atomic m_status; diff --git a/src/appleseed.python/bindrenderercontroller.cpp b/src/appleseed.python/bindrenderercontroller.cpp index 54fb0df189..b1ae732007 100644 --- a/src/appleseed.python/bindrenderercontroller.cpp +++ b/src/appleseed.python/bindrenderercontroller.cpp @@ -177,22 +177,6 @@ namespace } } - void on_assembly_tree_built() override - { - // Lock Python's global interpreter lock (GIL), - // it was released in MasterRenderer.render. - ScopedGILLock lock; - - try - { - get_override("on_assembly_tree_built")(); - } - catch (bpy::error_already_set) - { - PyErr_Print(); - } - } - Status get_status() const override { // Lock Python's global interpreter lock (GIL), diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp index bfff23f696..2b19a5bb04 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp @@ -33,6 +33,8 @@ #include "mainwindow/rendering/renderingmanager.h" // appleseed.renderer headers. +#include "renderer/kernel/intersection/assemblytree.h" +#include "renderer/kernel/intersection/tracecontext.h" #include "renderer/kernel/rendering/scenepicker.h" // Qt headers. @@ -43,20 +45,13 @@ namespace appleseed { namespace studio { MaterialDropHandler::MaterialDropHandler( - renderer::Project& project, + const renderer::Project& project, RenderingManager& rendering_manager, const renderer::ScenePicker& scene_picker) - : m_project(project), m_rendering_manager(rendering_manager), m_enabled(false), m_scene_picker(scene_picker) + : m_project(project), m_rendering_manager(rendering_manager), m_scene_picker(scene_picker) { } -void MaterialDropHandler::set_enabled(const bool enabled) -{ - m_enabled = enabled; - - m_project.update_trace_context(); -} - void MaterialDropHandler::slot_material_dropped( const foundation::Vector2d& drop_pos, const QString& material_name) @@ -64,8 +59,12 @@ void MaterialDropHandler::slot_material_dropped( m_drop_pos = drop_pos; m_material_name = material_name.toStdString(); - if (!m_enabled) + // Tell the user to render once, if assembly tree hasn't been built yet. + if (m_project.get_trace_context().get_assembly_tree().get_nodes().size() == 0) + { + RENDERER_LOG_INFO("the scene must be rendering or must have been rendered at least once for drag and drop to be available."); return; + } QMenu* selection_menu = new QMenu(); connect(selection_menu->addAction("Front Side"), SIGNAL(triggered()), SLOT(slot_apply_to_front())); diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h index 711c0f543f..989e2bf3f0 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h @@ -56,23 +56,20 @@ class MaterialDropHandler public: MaterialDropHandler( - renderer::Project& project, + const renderer::Project& project, RenderingManager& rendering_manager, const renderer::ScenePicker& scene_picker); - void set_enabled(const bool enabled); - public slots: void slot_material_dropped( const foundation::Vector2d& drop_pos, const QString& material_name); private: - renderer::Project& m_project; + const renderer::Project& m_project; RenderingManager& m_rendering_manager; foundation::Vector2d m_drop_pos; std::string m_material_name; - bool m_enabled; const renderer::ScenePicker& m_scene_picker; void assign_material(const renderer::ObjectInstance::Side side); diff --git a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.cpp b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.cpp index 3a7a186188..0364883386 100644 --- a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.cpp +++ b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.cpp @@ -86,11 +86,6 @@ void QtRendererController::on_frame_end() emit signal_frame_end(); } -void QtRendererController::on_assembly_tree_built() -{ - emit signal_assembly_tree_built(); -} - void QtRendererController::set_status(const Status status) { m_status = status; diff --git a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h index af44f9017d..9e68aacedf 100644 --- a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h +++ b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h @@ -72,9 +72,6 @@ class QtRendererController // This method is called after rendering a single frame. void on_frame_end() override; - // This method is called after the assembly tree is built. - void on_assembly_tree_built() override; - // Store a new status value. void set_status(const Status status); diff --git a/src/appleseed.studio/mainwindow/rendering/renderingmanager.cpp b/src/appleseed.studio/mainwindow/rendering/renderingmanager.cpp index 5894b72df5..2c34708b21 100644 --- a/src/appleseed.studio/mainwindow/rendering/renderingmanager.cpp +++ b/src/appleseed.studio/mainwindow/rendering/renderingmanager.cpp @@ -174,11 +174,6 @@ RenderingManager::RenderingManager(StatusBar& status_bar) SLOT(slot_rendering_resume()), Qt::BlockingQueuedConnection); - connect( - &m_renderer_controller, SIGNAL(signal_assembly_tree_built()), - SLOT(slot_assembly_tree_built()), - Qt::BlockingQueuedConnection); - connect( &m_renderer_controller, SIGNAL(signal_rendering_success()), SIGNAL(signal_rendering_end())); @@ -528,11 +523,6 @@ void RenderingManager::slot_camera_change_end() { } -void RenderingManager::slot_assembly_tree_built() -{ - m_render_tab->enable_scene_picking(); -} - void RenderingManager::slot_master_renderer_thread_finished() { m_master_renderer.reset(); diff --git a/src/appleseed.studio/mainwindow/rendering/renderingmanager.h b/src/appleseed.studio/mainwindow/rendering/renderingmanager.h index 07fe73d1f5..8fa8995dce 100644 --- a/src/appleseed.studio/mainwindow/rendering/renderingmanager.h +++ b/src/appleseed.studio/mainwindow/rendering/renderingmanager.h @@ -199,7 +199,6 @@ class RenderingManager void slot_camera_change_begin(); void slot_camera_changed(); void slot_camera_change_end(); - void slot_assembly_tree_built(); void slot_master_renderer_thread_finished(); }; diff --git a/src/appleseed.studio/mainwindow/rendering/rendertab.cpp b/src/appleseed.studio/mainwindow/rendering/rendertab.cpp index a1bb1f7b61..211cab69d1 100644 --- a/src/appleseed.studio/mainwindow/rendering/rendertab.cpp +++ b/src/appleseed.studio/mainwindow/rendering/rendertab.cpp @@ -138,12 +138,6 @@ void RenderTab::darken() m_render_widget->multiply(0.2f); } -void RenderTab::enable_scene_picking() -{ - m_scene_picking_handler->set_enabled(true); - m_material_drop_handler->set_enabled(true); -} - void RenderTab::reset_zoom() { m_zoom_handler->reset_zoom(); diff --git a/src/appleseed.studio/mainwindow/rendering/rendertab.h b/src/appleseed.studio/mainwindow/rendering/rendertab.h index be7d629790..e8e3770041 100644 --- a/src/appleseed.studio/mainwindow/rendering/rendertab.h +++ b/src/appleseed.studio/mainwindow/rendering/rendertab.h @@ -95,7 +95,6 @@ class RenderTab void clear(); void darken(); - void enable_scene_picking(); void reset_zoom(); void update(); diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp index 37ddb13715..7a54cb4a61 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp @@ -48,6 +48,8 @@ #include "renderer/api/project.h" #include "renderer/api/scene.h" #include "renderer/api/surfaceshader.h" +#include "renderer/kernel/intersection/assemblytree.h" +#include "renderer/kernel/intersection/tracecontext.h" // appleseed.foundation headers. #include "foundation/math/basis.h" @@ -84,14 +86,14 @@ ScenePickingHandler::ScenePickingHandler( QComboBox* picking_mode_combo, const MouseCoordinatesTracker& mouse_tracker, const ProjectExplorer& project_explorer, - Project& project, + const Project& project, const ScenePicker& scene_picker) : m_widget(widget) , m_picking_mode_combo(picking_mode_combo) , m_mouse_tracker(mouse_tracker) , m_project_explorer(project_explorer) , m_project(project) - , m_enabled(false) + , m_enabled(true) , m_scene_picker(scene_picker) { m_widget->installEventFilter(this); @@ -118,8 +120,6 @@ ScenePickingHandler::~ScenePickingHandler() void ScenePickingHandler::set_enabled(const bool enabled) { m_enabled = enabled; - - m_project.update_trace_context(); } bool ScenePickingHandler::eventFilter(QObject* object, QEvent* event) @@ -229,6 +229,13 @@ namespace ItemBase* ScenePickingHandler::pick(const QPoint& point) { + // Tell the user to render once, if assembly tree hasn't been built yet. + if (m_project.get_trace_context().get_assembly_tree().get_nodes().size() == 0) + { + RENDERER_LOG_INFO("the scene must be rendering or must have been rendered at least once for picking to be available."); + return nullptr; + } + const Vector2i pix = m_mouse_tracker.widget_to_pixel(point); const Vector2d ndc = m_mouse_tracker.widget_to_ndc(point); diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h index c8be7af006..0dbb84fbda 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h @@ -66,7 +66,7 @@ class ScenePickingHandler QComboBox* picking_mode_combo, const qtcommon::MouseCoordinatesTracker& mouse_tracker, const ProjectExplorer& project_explorer, - renderer::Project& project, + const renderer::Project& project, const renderer::ScenePicker& scene_picker); ~ScenePickingHandler() override; @@ -81,7 +81,7 @@ class ScenePickingHandler QComboBox* m_picking_mode_combo; const qtcommon::MouseCoordinatesTracker& m_mouse_tracker; const ProjectExplorer& m_project_explorer; - renderer::Project& m_project; + const renderer::Project& m_project; bool m_enabled; const renderer::ScenePicker& m_scene_picker; diff --git a/src/appleseed/foundation/math/bvh/bvh_tree.h b/src/appleseed/foundation/math/bvh/bvh_tree.h index 1285cd1189..a0ad434d7b 100644 --- a/src/appleseed/foundation/math/bvh/bvh_tree.h +++ b/src/appleseed/foundation/math/bvh/bvh_tree.h @@ -58,6 +58,9 @@ class Tree // Return the size (in bytes) of this object in memory. size_t get_memory_size() const; + // Return the nodes in the tree. + const NodeVector& get_nodes() const; + protected: template friend class Builder; @@ -104,5 +107,11 @@ size_t Tree::get_memory_size() const + m_nodes.capacity() * sizeof(NodeType); } +template +const NodeVector& Tree::get_nodes() const +{ + return m_nodes; +} + } // namespace bvh } // namespace foundation diff --git a/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.cpp b/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.cpp index 5813c70873..fb198ad0a8 100644 --- a/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.cpp +++ b/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.cpp @@ -69,10 +69,6 @@ void DefaultRendererController::on_progress() { } -void DefaultRendererController::on_assembly_tree_built() -{ -} - IRendererController::Status DefaultRendererController::get_status() const { return ContinueRendering; diff --git a/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.h b/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.h index d11c3178f8..4040720080 100644 --- a/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.h +++ b/src/appleseed/renderer/kernel/rendering/defaultrenderercontroller.h @@ -73,9 +73,6 @@ class APPLESEED_DLLSYMBOL DefaultRendererController // This method is called continuously during rendering. void on_progress() override; - // This method is called after assembly tree is built. - void on_assembly_tree_built() override; - // Return the current rendering status. Status get_status() const override; }; diff --git a/src/appleseed/renderer/kernel/rendering/irenderercontroller.h b/src/appleseed/renderer/kernel/rendering/irenderercontroller.h index f3eb03d8ee..842aa6c45b 100644 --- a/src/appleseed/renderer/kernel/rendering/irenderercontroller.h +++ b/src/appleseed/renderer/kernel/rendering/irenderercontroller.h @@ -73,9 +73,6 @@ class APPLESEED_DLLSYMBOL IRendererController // This method is called continuously during rendering. virtual void on_progress() = 0; - // This method is called after assembly tree is built. - virtual void on_assembly_tree_built() = 0; - enum Status { // Continue/resume rendering. diff --git a/src/appleseed/renderer/kernel/rendering/masterrenderer.cpp b/src/appleseed/renderer/kernel/rendering/masterrenderer.cpp index 82511237ea..eb0d305e87 100644 --- a/src/appleseed/renderer/kernel/rendering/masterrenderer.cpp +++ b/src/appleseed/renderer/kernel/rendering/masterrenderer.cpp @@ -392,8 +392,6 @@ struct MasterRenderer::Impl return IRendererController::AbortRendering; } - renderer_controller.on_assembly_tree_built(); - // Load the checkpoint if any. Frame& frame = *m_project.get_frame(); const size_t pass_count = m_params.get_optional("passes", 1); diff --git a/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.cpp b/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.cpp index 0a51237f38..37dbfcd57a 100644 --- a/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.cpp +++ b/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.cpp @@ -102,12 +102,6 @@ void RendererControllerCollection::on_progress() i->on_progress(); } -void RendererControllerCollection::on_assembly_tree_built() -{ - for (auto i : impl->m_renderer_controller) - i->on_assembly_tree_built(); -} - IRendererController::Status RendererControllerCollection::get_status() const { for (auto i : impl->m_renderer_controller) diff --git a/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.h b/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.h index eb1d795b1a..d469928640 100644 --- a/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.h +++ b/src/appleseed/renderer/kernel/rendering/renderercontrollercollection.h @@ -59,7 +59,6 @@ class APPLESEED_DLLSYMBOL RendererControllerCollection void on_frame_begin() override; void on_frame_end() override; void on_progress() override; - void on_assembly_tree_built() override; Status get_status() const override; // Insert a renderer controller into the collection. diff --git a/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.cpp b/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.cpp index 8ae1b2e82a..ef38142767 100644 --- a/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.cpp +++ b/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.cpp @@ -99,11 +99,6 @@ void SerialRendererController::on_progress() m_controller->on_progress(); } -void SerialRendererController::on_assembly_tree_built() -{ - m_controller->on_assembly_tree_built(); -} - IRendererController::Status SerialRendererController::get_status() const { return m_controller->get_status(); diff --git a/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.h b/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.h index d5a8b8e243..f8fe2dcffa 100644 --- a/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.h +++ b/src/appleseed/renderer/kernel/rendering/serialrenderercontroller.h @@ -70,7 +70,6 @@ class SerialRendererController void on_frame_begin() override; void on_frame_end() override; void on_progress() override; - void on_assembly_tree_built() override; Status get_status() const override; void add_on_tiled_frame_begin_callback( From 898ff11e897b1b0f9700cb4c4872b9c55f18bcf8 Mon Sep 17 00:00:00 2001 From: Achal Pandey Date: Sun, 22 Mar 2020 19:16:09 +0530 Subject: [PATCH 04/16] Remove unnecessary declarations --- .../mainwindow/rendering/qtrenderercontroller.h | 3 --- .../mainwindow/rendering/qtrenderercontroller.h | 1 - 2 files changed, 4 deletions(-) diff --git a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h index f582d50c80..d3b47ffaf3 100644 --- a/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h +++ b/src/appleseed.bench/mainwindow/rendering/qtrenderercontroller.h @@ -72,9 +72,6 @@ class QtRendererController // This method is called after rendering a single frame. void on_frame_end() override; - // This method is called after assembly tree is built. - void on_assembly_tree_built() override; - // Store a new status value. void set_status(const Status status); diff --git a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h index 9e68aacedf..6cbae1c838 100644 --- a/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h +++ b/src/appleseed.studio/mainwindow/rendering/qtrenderercontroller.h @@ -86,7 +86,6 @@ class QtRendererController void signal_rendering_resume(); void signal_frame_begin(); void signal_frame_end(); - void signal_assembly_tree_built(); private: boost::atomic m_status; From ac105afabf0fbfa8dd69bf515c18ef9573a325e8 Mon Sep 17 00:00:00 2001 From: Achal Pandey Date: Mon, 23 Mar 2020 00:12:34 +0530 Subject: [PATCH 05/16] Add a snippet back in & fix a typo --- src/appleseed.studio/mainwindow/mainwindow.cpp | 4 ++++ .../renderer/kernel/lighting/backwardlightsampler.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/appleseed.studio/mainwindow/mainwindow.cpp b/src/appleseed.studio/mainwindow/mainwindow.cpp index 574b88a0f8..762ef24cbc 100644 --- a/src/appleseed.studio/mainwindow/mainwindow.cpp +++ b/src/appleseed.studio/mainwindow/mainwindow.cpp @@ -900,6 +900,10 @@ void MainWindow::set_rendering_widgets_enabled(const bool is_enabled, const Rend // Set/clear rendering region. render_tab->set_render_region_buttons_enabled( is_enabled && is_project_open && rendering_mode != RenderingMode::FinalRendering); + + // Scene picker. + render_tab->get_scene_picking_handler()->set_enabled( + is_enabled && is_project_open && rendering_mode != RenderingMode::FinalRendering); } } } diff --git a/src/appleseed/renderer/kernel/lighting/backwardlightsampler.cpp b/src/appleseed/renderer/kernel/lighting/backwardlightsampler.cpp index 06e8ce70f6..7717fbe419 100644 --- a/src/appleseed/renderer/kernel/lighting/backwardlightsampler.cpp +++ b/src/appleseed/renderer/kernel/lighting/backwardlightsampler.cpp @@ -178,7 +178,7 @@ BackwardLightSampler::BackwardLightSampler( } else { - // Prepare the light-emitting shapes CDF for smapling. + // Prepare the light-emitting shapes CDF for sampling. if (m_emitting_shapes_cdf.valid()) m_emitting_shapes_cdf.prepare(); From 8e193b745c8d66e89f05b13b0a3c50bf9efbe4c9 Mon Sep 17 00:00:00 2001 From: Achal Pandey Date: Wed, 25 Mar 2020 14:11:41 +0530 Subject: [PATCH 06/16] Centralize TextureStore --- src/appleseed.studio/mainwindow/mainwindow.cpp | 3 --- .../rendering/materialdrophandler.cpp | 11 +++++------ .../mainwindow/rendering/materialdrophandler.h | 4 +--- .../mainwindow/rendering/rendertab.cpp | 7 ++----- .../mainwindow/rendering/rendertab.h | 1 - .../rendering/scenepickinghandler.cpp | 10 ++++------ .../mainwindow/rendering/scenepickinghandler.h | 4 +--- .../foundation/string/internedstring.h | 2 +- .../renderer/device/cpu/cpurenderdevice.cpp | 2 +- .../renderer/device/cpu/cpurenderdevice.h | 2 +- .../kernel/intersection/assemblytree.cpp | 14 +++++++------- .../kernel/intersection/assemblytree.h | 6 +++--- .../kernel/intersection/tracecontext.cpp | 6 +++--- .../kernel/intersection/tracecontext.h | 9 ++++++--- .../kernel/intersection/triangletree.cpp | 7 +++---- .../kernel/intersection/triangletree.h | 7 ++++--- .../renderer/kernel/rendering/scenepicker.cpp | 4 ++-- .../renderer/meta/tests/test_intersector.cpp | 6 +++--- .../renderer/meta/tests/test_tracer.cpp | 6 +++--- .../renderer/modeling/project/project.cpp | 18 ++++++++++++++---- .../renderer/modeling/project/project.h | 5 +++++ 21 files changed, 69 insertions(+), 65 deletions(-) diff --git a/src/appleseed.studio/mainwindow/mainwindow.cpp b/src/appleseed.studio/mainwindow/mainwindow.cpp index 762ef24cbc..380444ed29 100644 --- a/src/appleseed.studio/mainwindow/mainwindow.cpp +++ b/src/appleseed.studio/mainwindow/mainwindow.cpp @@ -300,7 +300,6 @@ bool MainWindow::pack_project(QString filepath) void MainWindow::close_project() { - remove_render_tabs(); m_project_manager.close_project(); on_project_change(); } @@ -1451,8 +1450,6 @@ void MainWindow::slot_open_cornellbox_builtin_project() if (!can_close_project()) return; - remove_render_tabs(); - APPLESEED_UNUSED const bool successful = m_project_manager.load_builtin_project("cornell_box"); assert(successful); diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp index 2b19a5bb04..eda0bf6ca1 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp @@ -46,9 +46,8 @@ namespace studio { MaterialDropHandler::MaterialDropHandler( const renderer::Project& project, - RenderingManager& rendering_manager, - const renderer::ScenePicker& scene_picker) - : m_project(project), m_rendering_manager(rendering_manager), m_scene_picker(scene_picker) + RenderingManager& rendering_manager) + : m_project(project), m_rendering_manager(rendering_manager) { } @@ -59,8 +58,7 @@ void MaterialDropHandler::slot_material_dropped( m_drop_pos = drop_pos; m_material_name = material_name.toStdString(); - // Tell the user to render once, if assembly tree hasn't been built yet. - if (m_project.get_trace_context().get_assembly_tree().get_nodes().size() == 0) + if (!m_project.has_trace_context()) { RENDERER_LOG_INFO("the scene must be rendering or must have been rendered at least once for drag and drop to be available."); return; @@ -115,7 +113,8 @@ namespace void MaterialDropHandler::assign_material(const renderer::ObjectInstance::Side side) { - const renderer::ScenePicker::PickingResult result = m_scene_picker.pick(m_drop_pos); + const renderer::ScenePicker scene_picker(m_project); + const renderer::ScenePicker::PickingResult result = scene_picker.pick(m_drop_pos); renderer::ObjectInstance* instance = result.m_object_instance; std::vector material_slots; diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h index 989e2bf3f0..9d98a1a1bc 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h @@ -57,8 +57,7 @@ class MaterialDropHandler public: MaterialDropHandler( const renderer::Project& project, - RenderingManager& rendering_manager, - const renderer::ScenePicker& scene_picker); + RenderingManager& rendering_manager); public slots: void slot_material_dropped( @@ -70,7 +69,6 @@ class MaterialDropHandler RenderingManager& m_rendering_manager; foundation::Vector2d m_drop_pos; std::string m_material_name; - const renderer::ScenePicker& m_scene_picker; void assign_material(const renderer::ObjectInstance::Side side); diff --git a/src/appleseed.studio/mainwindow/rendering/rendertab.cpp b/src/appleseed.studio/mainwindow/rendering/rendertab.cpp index 211cab69d1..b47f7a8aff 100644 --- a/src/appleseed.studio/mainwindow/rendering/rendertab.cpp +++ b/src/appleseed.studio/mainwindow/rendering/rendertab.cpp @@ -83,7 +83,6 @@ RenderTab::RenderTab( : m_project_explorer(project_explorer) , m_project(project) , m_rendering_manager(rendering_manager) - , m_scene_picker(project) , m_ocio_config(ocio_config) { setObjectName("render_widget_tab"); @@ -464,8 +463,7 @@ void RenderTab::recreate_handlers() m_picking_mode_combo, *m_mouse_tracker.get(), m_project_explorer, - m_project, - m_scene_picker)); + m_project)); connect( m_scene_picking_handler.get(), SIGNAL(signal_entity_picked(renderer::ScenePicker::PickingResult)), SIGNAL(signal_entity_picked(renderer::ScenePicker::PickingResult))); @@ -492,8 +490,7 @@ void RenderTab::recreate_handlers() m_material_drop_handler.reset( new MaterialDropHandler( m_project, - m_rendering_manager, - m_scene_picker)); + m_rendering_manager)); connect( m_render_widget, SIGNAL(signal_material_dropped(const foundation::Vector2d&, const QString&)), m_material_drop_handler.get(), SLOT(slot_material_dropped(const foundation::Vector2d&, const QString&))); diff --git a/src/appleseed.studio/mainwindow/rendering/rendertab.h b/src/appleseed.studio/mainwindow/rendering/rendertab.h index e8e3770041..62008a2979 100644 --- a/src/appleseed.studio/mainwindow/rendering/rendertab.h +++ b/src/appleseed.studio/mainwindow/rendering/rendertab.h @@ -148,7 +148,6 @@ class RenderTab ProjectExplorer& m_project_explorer; renderer::Project& m_project; RenderingManager& m_rendering_manager; - renderer::ScenePicker m_scene_picker; std::unique_ptr m_zoom_handler; std::unique_ptr m_pan_handler; diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp index 7a54cb4a61..43108d14fe 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp @@ -86,15 +86,13 @@ ScenePickingHandler::ScenePickingHandler( QComboBox* picking_mode_combo, const MouseCoordinatesTracker& mouse_tracker, const ProjectExplorer& project_explorer, - const Project& project, - const ScenePicker& scene_picker) + const Project& project) : m_widget(widget) , m_picking_mode_combo(picking_mode_combo) , m_mouse_tracker(mouse_tracker) , m_project_explorer(project_explorer) , m_project(project) , m_enabled(true) - , m_scene_picker(scene_picker) { m_widget->installEventFilter(this); @@ -229,8 +227,7 @@ namespace ItemBase* ScenePickingHandler::pick(const QPoint& point) { - // Tell the user to render once, if assembly tree hasn't been built yet. - if (m_project.get_trace_context().get_assembly_tree().get_nodes().size() == 0) + if (!m_project.has_trace_context()) { RENDERER_LOG_INFO("the scene must be rendering or must have been rendered at least once for picking to be available."); return nullptr; @@ -239,7 +236,8 @@ ItemBase* ScenePickingHandler::pick(const QPoint& point) const Vector2i pix = m_mouse_tracker.widget_to_pixel(point); const Vector2d ndc = m_mouse_tracker.widget_to_ndc(point); - const ScenePicker::PickingResult result = m_scene_picker.pick(ndc); + const ScenePicker scene_picker(m_project); + const ScenePicker::PickingResult result = scene_picker.pick(ndc); std::stringstream sstr; diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h index 0dbb84fbda..6871231342 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.h @@ -66,8 +66,7 @@ class ScenePickingHandler QComboBox* picking_mode_combo, const qtcommon::MouseCoordinatesTracker& mouse_tracker, const ProjectExplorer& project_explorer, - const renderer::Project& project, - const renderer::ScenePicker& scene_picker); + const renderer::Project& project); ~ScenePickingHandler() override; @@ -83,7 +82,6 @@ class ScenePickingHandler const ProjectExplorer& m_project_explorer; const renderer::Project& m_project; bool m_enabled; - const renderer::ScenePicker& m_scene_picker; bool eventFilter(QObject* object, QEvent* event) override; diff --git a/src/appleseed/foundation/string/internedstring.h b/src/appleseed/foundation/string/internedstring.h index 6e9f1e5eb8..6735b0a929 100644 --- a/src/appleseed/foundation/string/internedstring.h +++ b/src/appleseed/foundation/string/internedstring.h @@ -49,7 +49,7 @@ namespace foundation // // There are also some disadvantages: // -// - Constructing an interned string can be slower that a normal string. +// - Constructing an interned string can be slower than a normal string. // - Memory for the string characters is never freed. // // This implementation relies internally on OpenImageIO's ustring class. diff --git a/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp b/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp index 261d07ace8..d5e2f8fc69 100644 --- a/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp +++ b/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp @@ -59,7 +59,7 @@ CPURenderDevice::CPURenderDevice( Project& project, const ParamArray& params) : RenderDeviceBase(project, params) - , m_texture_store(*project.get_scene(), params.child("texture_store")) + , m_texture_store(project.get_texture_store(params.child("texture_store"))) { m_error_handler = new OIIOErrorHandler(); #ifndef NDEBUG diff --git a/src/appleseed/renderer/device/cpu/cpurenderdevice.h b/src/appleseed/renderer/device/cpu/cpurenderdevice.h index f295e9c4c7..1e1a179cbc 100644 --- a/src/appleseed/renderer/device/cpu/cpurenderdevice.h +++ b/src/appleseed/renderer/device/cpu/cpurenderdevice.h @@ -99,7 +99,7 @@ class CPURenderDevice RendererServices* m_renderer_services; OSLShadingSystem* m_shading_system; foundation::auto_release_ptr m_osl_compiler; - TextureStore m_texture_store; + TextureStore& m_texture_store; std::unique_ptr m_components; }; diff --git a/src/appleseed/renderer/kernel/intersection/assemblytree.cpp b/src/appleseed/renderer/kernel/intersection/assemblytree.cpp index 5dac26b63c..2eecfdd1cd 100644 --- a/src/appleseed/renderer/kernel/intersection/assemblytree.cpp +++ b/src/appleseed/renderer/kernel/intersection/assemblytree.cpp @@ -77,9 +77,9 @@ namespace renderer // AssemblyTree class implementation. // -AssemblyTree::AssemblyTree(const Scene& scene) +AssemblyTree::AssemblyTree(const Project& project) : TreeType(AlignedAllocator(System::get_l1_data_cache_line_size())) - , m_scene(scene) + , m_project(project) #ifdef APPLESEED_WITH_EMBREE , m_use_embree(false) , m_dirty(false) @@ -163,7 +163,7 @@ void AssemblyTree::rebuild_assembly_tree() RENDERER_LOG_INFO("collecting assembly instances..."); AABBVector assembly_instance_bboxes; collect_assembly_instances( - m_scene.assembly_instances(), + m_project.get_scene()->assembly_instances(), TransformSequence(), assembly_instance_bboxes); @@ -185,7 +185,7 @@ void AssemblyTree::rebuild_assembly_tree() Builder builder; builder.build(*this, partitioner, m_items.size(), AssemblyTreeMaxLeafSize); statistics.insert_time("build time", builder.get_build_time()); - statistics.merge(bvh::TreeStatistics(*this, AABB3d(m_scene.compute_bbox()))); + statistics.merge(bvh::TreeStatistics(*this, AABB3d(m_project.get_scene()->compute_bbox()))); if (!m_items.empty()) { @@ -407,7 +407,7 @@ void AssemblyTree::create_triangle_tree(const Assembly& assembly) std::unique_ptr> triangle_tree_factory( new TriangleTreeFactory( TriangleTree::Arguments( - m_scene, + m_project, assembly.get_uid(), assembly_bbox, assembly))); @@ -435,7 +435,7 @@ void AssemblyTree::create_curve_tree(const Assembly& assembly) std::unique_ptr> curve_tree_factory( new CurveTreeFactory( CurveTree::Arguments( - m_scene, + *m_project.get_scene(), assembly.get_uid(), assembly_bbox, assembly))); @@ -473,7 +473,7 @@ void AssemblyTree::create_embree_scene(const Assembly& assembly) std::unique_ptr> embree_scene_factory( new EmbreeSceneFactory( EmbreeScene::Arguments( - m_scene.get_embree_device(), + m_project.get_scene()->get_embree_device(), assembly ))); diff --git a/src/appleseed/renderer/kernel/intersection/assemblytree.h b/src/appleseed/renderer/kernel/intersection/assemblytree.h index baa5daa81c..456c6af99f 100644 --- a/src/appleseed/renderer/kernel/intersection/assemblytree.h +++ b/src/appleseed/renderer/kernel/intersection/assemblytree.h @@ -58,7 +58,7 @@ // Forward declarations. namespace foundation { class Statistics; } namespace renderer { class AssemblyInstance; } -namespace renderer { class Scene; } +namespace renderer { class Project; } namespace renderer { class ShadingPoint; } namespace renderer @@ -77,7 +77,7 @@ class AssemblyTree { public: // Constructor, builds the tree for a given scene. - explicit AssemblyTree(const Scene& scene); + explicit AssemblyTree(const Project& project); // Destructor. ~AssemblyTree(); @@ -126,7 +126,7 @@ class AssemblyTree typedef std::vector AssemblyVector; typedef std::map AssemblyVersionMap; - const Scene& m_scene; + const Project& m_project; ItemVector m_items; AssemblyVersionMap m_assembly_versions; diff --git a/src/appleseed/renderer/kernel/intersection/tracecontext.cpp b/src/appleseed/renderer/kernel/intersection/tracecontext.cpp index 9080ee5d48..7254b2921b 100644 --- a/src/appleseed/renderer/kernel/intersection/tracecontext.cpp +++ b/src/appleseed/renderer/kernel/intersection/tracecontext.cpp @@ -56,9 +56,9 @@ namespace renderer // TraceContext class implementation. // -TraceContext::TraceContext(const Scene& scene) - : m_scene(scene) - , m_assembly_tree(new AssemblyTree(scene)) +TraceContext::TraceContext(const Project& project) + : m_project(project) + , m_assembly_tree(new AssemblyTree(project)) { RENDERER_LOG_DEBUG( "data structures size:\n" diff --git a/src/appleseed/renderer/kernel/intersection/tracecontext.h b/src/appleseed/renderer/kernel/intersection/tracecontext.h index 2ec597bb46..17d398492e 100644 --- a/src/appleseed/renderer/kernel/intersection/tracecontext.h +++ b/src/appleseed/renderer/kernel/intersection/tracecontext.h @@ -32,6 +32,9 @@ // appleseed.foundation headers. #include "foundation/core/concepts/noncopyable.h" +// appleseed.renderer headers. +#include "renderer/modeling/project/project.h" + // appleseed.main headers. #include "main/dllsymbol.h" @@ -54,7 +57,7 @@ class APPLESEED_DLLSYMBOL TraceContext { public: // Constructor, initializes the trace context for a given scene. - explicit TraceContext(const Scene& scene); + explicit TraceContext(const Project& project); // Destructor. ~TraceContext(); @@ -73,7 +76,7 @@ class APPLESEED_DLLSYMBOL TraceContext #endif private: - const Scene& m_scene; + const Project& m_project; AssemblyTree* m_assembly_tree; }; @@ -84,7 +87,7 @@ class APPLESEED_DLLSYMBOL TraceContext inline const Scene& TraceContext::get_scene() const { - return m_scene; + return *m_project.get_scene(); } inline const AssemblyTree& TraceContext::get_assembly_tree() const diff --git a/src/appleseed/renderer/kernel/intersection/triangletree.cpp b/src/appleseed/renderer/kernel/intersection/triangletree.cpp index e6ca78d54b..238388bb2b 100644 --- a/src/appleseed/renderer/kernel/intersection/triangletree.cpp +++ b/src/appleseed/renderer/kernel/intersection/triangletree.cpp @@ -383,11 +383,11 @@ namespace } TriangleTree::Arguments::Arguments( - const Scene& scene, + const Project& project, const UniqueID triangle_tree_uid, const GAABB3& bbox, const Assembly& assembly) - : m_scene(scene) + : m_project(project) , m_triangle_tree_uid(triangle_tree_uid) , m_bbox(bbox) , m_assembly(assembly) @@ -1262,8 +1262,7 @@ void TriangleTree::update_intersection_filters() object_instances_to_filter_keys); // Create missing intersection filters and update existing ones. - TextureStore texture_store(m_arguments.m_scene); - TextureCache texture_cache(texture_store); + TextureCache texture_cache(m_arguments.m_project.get_texture_store()); create_missing_intersection_filters( texture_cache, filter_keys, diff --git a/src/appleseed/renderer/kernel/intersection/triangletree.h b/src/appleseed/renderer/kernel/intersection/triangletree.h index 8222f1599e..32661418e9 100644 --- a/src/appleseed/renderer/kernel/intersection/triangletree.h +++ b/src/appleseed/renderer/kernel/intersection/triangletree.h @@ -35,6 +35,7 @@ #include "renderer/kernel/intersection/probevisitorbase.h" #include "renderer/kernel/intersection/trianglekey.h" #include "renderer/kernel/intersection/trianglevertexinfo.h" +#include "renderer/modeling/project/project.h" #include "renderer/modeling/scene/visibilityflags.h" // appleseed.foundation headers. @@ -59,7 +60,7 @@ namespace foundation { class Statistics; } namespace renderer { class Assembly; } namespace renderer { class IntersectionFilter; } namespace renderer { class ParamArray; } -namespace renderer { class Scene; } +namespace renderer { class Project; } namespace renderer { class ShadingPoint; } namespace renderer @@ -83,14 +84,14 @@ class TriangleTree // Construction arguments. struct Arguments { - const Scene& m_scene; + const Project& m_project; const foundation::UniqueID m_triangle_tree_uid; const GAABB3 m_bbox; const Assembly& m_assembly; // Constructor. Arguments( - const Scene& scene, + const Project& project, const foundation::UniqueID triangle_tree_uid, const GAABB3& bbox, const Assembly& assembly); diff --git a/src/appleseed/renderer/kernel/rendering/scenepicker.cpp b/src/appleseed/renderer/kernel/rendering/scenepicker.cpp index 3b9bedfa5b..5f7811af8b 100644 --- a/src/appleseed/renderer/kernel/rendering/scenepicker.cpp +++ b/src/appleseed/renderer/kernel/rendering/scenepicker.cpp @@ -66,14 +66,14 @@ struct ScenePicker::Impl { const Project& m_project; const TraceContext& m_trace_context; - TextureStore m_texture_store; + TextureStore& m_texture_store; TextureCache m_texture_cache; Intersector m_intersector; explicit Impl(const Project& project) : m_project(project) , m_trace_context(m_project.get_trace_context()) - , m_texture_store(m_trace_context.get_scene()) + , m_texture_store(m_project.get_texture_store()) , m_texture_cache(m_texture_store) , m_intersector(m_trace_context, m_texture_cache) { diff --git a/src/appleseed/renderer/meta/tests/test_intersector.cpp b/src/appleseed/renderer/meta/tests/test_intersector.cpp index b7e39e6b23..03c5ce016b 100644 --- a/src/appleseed/renderer/meta/tests/test_intersector.cpp +++ b/src/appleseed/renderer/meta/tests/test_intersector.cpp @@ -96,13 +96,13 @@ TEST_SUITE(Renderer_Kernel_Intersection_Intersector) : public StaticTestSceneContext { TraceContext m_trace_context; - TextureStore m_texture_store; + TextureStore& m_texture_store; TextureCache m_texture_cache; Intersector m_intersector; Fixture() - : m_trace_context(m_scene) - , m_texture_store(m_scene) + : m_trace_context(m_project) + , m_texture_store(m_project.get_texture_store()) , m_texture_cache(m_texture_store) , m_intersector(m_trace_context, m_texture_cache) { diff --git a/src/appleseed/renderer/meta/tests/test_tracer.cpp b/src/appleseed/renderer/meta/tests/test_tracer.cpp index 10c252cfc1..2ae1a4c759 100644 --- a/src/appleseed/renderer/meta/tests/test_tracer.cpp +++ b/src/appleseed/renderer/meta/tests/test_tracer.cpp @@ -216,7 +216,7 @@ TEST_SUITE(Renderer_Kernel_Lighting_Tracer) : public StaticTestSceneContext { TraceContext m_trace_context; - TextureStore m_texture_store; + TextureStore& m_texture_store; TextureCache m_texture_cache; Intersector m_intersector; std::shared_ptr m_texture_system; @@ -228,8 +228,8 @@ TEST_SUITE(Renderer_Kernel_Lighting_Tracer) Tracer m_tracer; Fixture() - : m_trace_context(FixtureParams::FixtureBaseClass::m_scene) - , m_texture_store(FixtureParams::FixtureBaseClass::m_scene) + : m_trace_context(FixtureParams::FixtureBaseClass::m_project) + , m_texture_store(FixtureParams::FixtureBaseClass::m_project.get_texture_store()) , m_texture_cache(m_texture_store) , m_intersector(m_trace_context, m_texture_cache) , m_texture_system( diff --git a/src/appleseed/renderer/modeling/project/project.cpp b/src/appleseed/renderer/modeling/project/project.cpp index e1f5f11dfe..2619f66b40 100644 --- a/src/appleseed/renderer/modeling/project/project.cpp +++ b/src/appleseed/renderer/modeling/project/project.cpp @@ -34,6 +34,7 @@ #include "renderer/global/globallogger.h" #include "renderer/kernel/intersection/tracecontext.h" #include "renderer/kernel/lighting/lightpathrecorder.h" +#include "renderer/kernel/texturing/texturestore.h" #include "renderer/modeling/aov/aovfactoryregistrar.h" #include "renderer/modeling/bsdf/bsdffactoryregistrar.h" #include "renderer/modeling/bssrdf/bssrdffactoryregistrar.h" @@ -126,6 +127,7 @@ struct Project::Impl LightPathRecorder m_light_path_recorder; std::unique_ptr m_trace_context; RenderingTimer m_rendering_timer; + std::unique_ptr m_texture_store = nullptr; explicit Impl(const Project& project) : m_format_revision(ProjectFormatRevision) @@ -358,10 +360,7 @@ bool Project::has_trace_context() const const TraceContext& Project::get_trace_context() const { if (!impl->m_trace_context) - { - assert(impl->m_scene.get()); - impl->m_trace_context.reset(new TraceContext(*impl->m_scene)); - } + impl->m_trace_context.reset(new TraceContext(*this)); return *impl->m_trace_context; } @@ -436,6 +435,17 @@ void Project::on_frame_end( impl->m_rendering_timer.measure(); } +TextureStore& Project::get_texture_store(const ParamArray& params) const +{ + if (!impl->m_texture_store) + { + assert(impl->m_scene.get()); + impl->m_texture_store.reset(new TextureStore(*impl->m_scene, params)); + } + + return *impl->m_texture_store; +} + void Project::add_base_configurations() { impl->m_configurations.insert(BaseConfigurationFactory::create_base_final()); diff --git a/src/appleseed/renderer/modeling/project/project.h b/src/appleseed/renderer/modeling/project/project.h index 3855f717f7..2ee7fb3660 100644 --- a/src/appleseed/renderer/modeling/project/project.h +++ b/src/appleseed/renderer/modeling/project/project.h @@ -49,6 +49,7 @@ #include "renderer/modeling/surfaceshader/surfaceshadertraits.h" #include "renderer/modeling/texture/texturetraits.h" #include "renderer/modeling/volume/volumetraits.h" +#include "renderer/utility/paramarray.h" // appleseed.foundation headers. #include "foundation/memory/autoreleaseptr.h" @@ -85,6 +86,7 @@ namespace renderer { class PostProcessingStage; } namespace renderer { class Scene; } namespace renderer { class SurfaceShader; } namespace renderer { class Texture; } +namespace renderer { class TextureStore; } namespace renderer { class TraceContext; } namespace renderer { class Volume; } @@ -192,6 +194,9 @@ class APPLESEED_DLLSYMBOL Project const Project& project, const BaseGroup* parent) override; + // Get the texture store. + TextureStore& get_texture_store(const ParamArray& params = ParamArray()) const; + private: friend class ProjectFactory; From b7825963cf849f749029f4d3e53e782b0b88abd2 Mon Sep 17 00:00:00 2001 From: Achal Pandey Date: Wed, 25 Mar 2020 20:43:22 +0530 Subject: [PATCH 07/16] Minor modifications --- .../mainwindow/mainwindow.cpp | 3 +++ .../rendering/materialdrophandler.cpp | 2 -- .../rendering/materialdrophandler.h | 1 - .../rendering/scenepickinghandler.cpp | 2 -- src/appleseed/foundation/math/bvh/bvh_tree.h | 9 -------- .../renderer/device/cpu/cpurenderdevice.cpp | 2 +- .../renderer/modeling/project/project.cpp | 22 +++++++++++++------ .../renderer/modeling/project/project.h | 8 ++++++- 8 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/appleseed.studio/mainwindow/mainwindow.cpp b/src/appleseed.studio/mainwindow/mainwindow.cpp index 380444ed29..55ebcf1f19 100644 --- a/src/appleseed.studio/mainwindow/mainwindow.cpp +++ b/src/appleseed.studio/mainwindow/mainwindow.cpp @@ -1254,6 +1254,9 @@ void MainWindow::start_rendering(const RenderingMode rendering_mode) rendering_mode == RenderingMode::InteractiveRendering ? "interactive" : "final"; const ParamArray params = get_project_params(configuration_name); + if (!project->has_texture_store()) + project->initialize_texture_store(params.child("texture_store")); + // Effectively start rendering. m_rendering_manager.start_rendering( project, diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp index eda0bf6ca1..86b86e8841 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.cpp @@ -33,8 +33,6 @@ #include "mainwindow/rendering/renderingmanager.h" // appleseed.renderer headers. -#include "renderer/kernel/intersection/assemblytree.h" -#include "renderer/kernel/intersection/tracecontext.h" #include "renderer/kernel/rendering/scenepicker.h" // Qt headers. diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h index 9d98a1a1bc..79e29f2a78 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h @@ -29,7 +29,6 @@ #pragma once // appleseed.renderer headers. -#include "renderer/api/scenepicker.h" #include "renderer/modeling/project/project.h" #include "renderer/modeling/scene/objectinstance.h" diff --git a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp index 43108d14fe..328b866e5b 100644 --- a/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp +++ b/src/appleseed.studio/mainwindow/rendering/scenepickinghandler.cpp @@ -48,8 +48,6 @@ #include "renderer/api/project.h" #include "renderer/api/scene.h" #include "renderer/api/surfaceshader.h" -#include "renderer/kernel/intersection/assemblytree.h" -#include "renderer/kernel/intersection/tracecontext.h" // appleseed.foundation headers. #include "foundation/math/basis.h" diff --git a/src/appleseed/foundation/math/bvh/bvh_tree.h b/src/appleseed/foundation/math/bvh/bvh_tree.h index a0ad434d7b..1285cd1189 100644 --- a/src/appleseed/foundation/math/bvh/bvh_tree.h +++ b/src/appleseed/foundation/math/bvh/bvh_tree.h @@ -58,9 +58,6 @@ class Tree // Return the size (in bytes) of this object in memory. size_t get_memory_size() const; - // Return the nodes in the tree. - const NodeVector& get_nodes() const; - protected: template friend class Builder; @@ -107,11 +104,5 @@ size_t Tree::get_memory_size() const + m_nodes.capacity() * sizeof(NodeType); } -template -const NodeVector& Tree::get_nodes() const -{ - return m_nodes; -} - } // namespace bvh } // namespace foundation diff --git a/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp b/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp index d5e2f8fc69..80c40f1ed3 100644 --- a/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp +++ b/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp @@ -59,7 +59,7 @@ CPURenderDevice::CPURenderDevice( Project& project, const ParamArray& params) : RenderDeviceBase(project, params) - , m_texture_store(project.get_texture_store(params.child("texture_store"))) + , m_texture_store(project.get_texture_store()) { m_error_handler = new OIIOErrorHandler(); #ifndef NDEBUG diff --git a/src/appleseed/renderer/modeling/project/project.cpp b/src/appleseed/renderer/modeling/project/project.cpp index 2619f66b40..d11ed0cebe 100644 --- a/src/appleseed/renderer/modeling/project/project.cpp +++ b/src/appleseed/renderer/modeling/project/project.cpp @@ -127,7 +127,7 @@ struct Project::Impl LightPathRecorder m_light_path_recorder; std::unique_ptr m_trace_context; RenderingTimer m_rendering_timer; - std::unique_ptr m_texture_store = nullptr; + std::unique_ptr m_texture_store; explicit Impl(const Project& project) : m_format_revision(ProjectFormatRevision) @@ -435,13 +435,21 @@ void Project::on_frame_end( impl->m_rendering_timer.measure(); } -TextureStore& Project::get_texture_store(const ParamArray& params) const +void Project::initialize_texture_store(const ParamArray& params) { - if (!impl->m_texture_store) - { - assert(impl->m_scene.get()); - impl->m_texture_store.reset(new TextureStore(*impl->m_scene, params)); - } + assert(impl->m_scene.get()); + + impl->m_texture_store.reset(new TextureStore(*impl->m_scene, params)); +} + +bool Project::has_texture_store() const +{ + return impl->m_texture_store.get() != nullptr; +} + +TextureStore& Project::get_texture_store() const +{ + assert(impl->m_texture_store); return *impl->m_texture_store; } diff --git a/src/appleseed/renderer/modeling/project/project.h b/src/appleseed/renderer/modeling/project/project.h index 2ee7fb3660..91768aff4e 100644 --- a/src/appleseed/renderer/modeling/project/project.h +++ b/src/appleseed/renderer/modeling/project/project.h @@ -194,8 +194,14 @@ class APPLESEED_DLLSYMBOL Project const Project& project, const BaseGroup* parent) override; + // Initialize the texture store. + void initialize_texture_store(const ParamArray& params); + + // Return true if the texture store has already been initialized. + bool has_texture_store() const; + // Get the texture store. - TextureStore& get_texture_store(const ParamArray& params = ParamArray()) const; + TextureStore& get_texture_store() const; private: friend class ProjectFactory; From dcf1bb9cc3d98677c58c42e8b2bb6096f990e658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:14:27 +0200 Subject: [PATCH 08/16] Update project.h --- src/appleseed/renderer/modeling/project/project.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/appleseed/renderer/modeling/project/project.h b/src/appleseed/renderer/modeling/project/project.h index 91768aff4e..4e58c92733 100644 --- a/src/appleseed/renderer/modeling/project/project.h +++ b/src/appleseed/renderer/modeling/project/project.h @@ -49,7 +49,6 @@ #include "renderer/modeling/surfaceshader/surfaceshadertraits.h" #include "renderer/modeling/texture/texturetraits.h" #include "renderer/modeling/volume/volumetraits.h" -#include "renderer/utility/paramarray.h" // appleseed.foundation headers. #include "foundation/memory/autoreleaseptr.h" @@ -81,6 +80,7 @@ namespace renderer { class LightPathRecorder; } namespace renderer { class Material; } namespace renderer { class Object; } namespace renderer { class OnFrameBeginRecorder; } +namespace renderer { class ParamArray; } namespace renderer { class PluginStore; } namespace renderer { class PostProcessingStage; } namespace renderer { class Scene; } From 77d1602c18823d4a57fc4514f74631eb40cf8e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:16:14 +0200 Subject: [PATCH 09/16] Update cpurenderdevice.h --- src/appleseed/renderer/device/cpu/cpurenderdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/appleseed/renderer/device/cpu/cpurenderdevice.h b/src/appleseed/renderer/device/cpu/cpurenderdevice.h index 1e1a179cbc..5e83f95f21 100644 --- a/src/appleseed/renderer/device/cpu/cpurenderdevice.h +++ b/src/appleseed/renderer/device/cpu/cpurenderdevice.h @@ -31,7 +31,6 @@ // appleseed.renderer headers. #include "renderer/device/cpu/cpurendercontext.h" #include "renderer/device/renderdevicebase.h" -#include "renderer/kernel/texturing/texturestore.h" #include "renderer/modeling/shadergroup/shadercompiler.h" // appleseed.foundation headers. @@ -47,6 +46,7 @@ namespace renderer { class OIIOTextureSystem; } namespace renderer { class OSLShadingSystem; } namespace renderer { class RendererComponents; } namespace renderer { class RendererServices; } +namespace renderer { class TextureStore; } namespace renderer { From e79116bfecaeb2630fd3066cab23cd77cceafa54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:17:46 +0200 Subject: [PATCH 10/16] Update materialdrophandler.h --- .../mainwindow/rendering/materialdrophandler.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h index 79e29f2a78..bc3b047b4b 100644 --- a/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h +++ b/src/appleseed.studio/mainwindow/rendering/materialdrophandler.h @@ -60,14 +60,14 @@ class MaterialDropHandler public slots: void slot_material_dropped( - const foundation::Vector2d& drop_pos, - const QString& material_name); + const foundation::Vector2d& drop_pos, + const QString& material_name); private: - const renderer::Project& m_project; - RenderingManager& m_rendering_manager; - foundation::Vector2d m_drop_pos; - std::string m_material_name; + const renderer::Project& m_project; + RenderingManager& m_rendering_manager; + foundation::Vector2d m_drop_pos; + std::string m_material_name; void assign_material(const renderer::ObjectInstance::Side side); From fd4cc46515fb5350e183c6a8388106db907af4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:22:58 +0200 Subject: [PATCH 11/16] Update triangletree.h --- src/appleseed/renderer/kernel/intersection/triangletree.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/appleseed/renderer/kernel/intersection/triangletree.h b/src/appleseed/renderer/kernel/intersection/triangletree.h index 32661418e9..883a7ddad6 100644 --- a/src/appleseed/renderer/kernel/intersection/triangletree.h +++ b/src/appleseed/renderer/kernel/intersection/triangletree.h @@ -35,7 +35,6 @@ #include "renderer/kernel/intersection/probevisitorbase.h" #include "renderer/kernel/intersection/trianglekey.h" #include "renderer/kernel/intersection/trianglevertexinfo.h" -#include "renderer/modeling/project/project.h" #include "renderer/modeling/scene/visibilityflags.h" // appleseed.foundation headers. From ded1dfc4b8df3474fdffed0a3ebdcc7f65c34002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:23:33 +0200 Subject: [PATCH 12/16] Update triangletree.cpp --- src/appleseed/renderer/kernel/intersection/triangletree.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/appleseed/renderer/kernel/intersection/triangletree.cpp b/src/appleseed/renderer/kernel/intersection/triangletree.cpp index 238388bb2b..ad010a0f32 100644 --- a/src/appleseed/renderer/kernel/intersection/triangletree.cpp +++ b/src/appleseed/renderer/kernel/intersection/triangletree.cpp @@ -46,6 +46,7 @@ #include "renderer/modeling/object/meshobject.h" #include "renderer/modeling/object/object.h" #include "renderer/modeling/object/triangle.h" +#include "renderer/modeling/project/project.h" #include "renderer/modeling/scene/assembly.h" #include "renderer/modeling/scene/containers.h" #include "renderer/modeling/scene/objectinstance.h" From 9a6303d7242c21e9df0c69f04d9ff16134e248c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:27:02 +0200 Subject: [PATCH 13/16] Update scenepicker.cpp --- src/appleseed/renderer/kernel/rendering/scenepicker.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/appleseed/renderer/kernel/rendering/scenepicker.cpp b/src/appleseed/renderer/kernel/rendering/scenepicker.cpp index 5f7811af8b..96184db5aa 100644 --- a/src/appleseed/renderer/kernel/rendering/scenepicker.cpp +++ b/src/appleseed/renderer/kernel/rendering/scenepicker.cpp @@ -36,7 +36,6 @@ #include "renderer/kernel/intersection/tracecontext.h" #include "renderer/kernel/shading/shadingray.h" #include "renderer/kernel/texturing/texturecache.h" -#include "renderer/kernel/texturing/texturestore.h" #include "renderer/modeling/bsdf/bsdftraits.h" #include "renderer/modeling/bssrdf/bssrdftraits.h" #include "renderer/modeling/camera/camera.h" @@ -57,6 +56,9 @@ #include #include +// Forward declarations. +namespace renderer { class TextureStore; } + using namespace foundation; namespace renderer From 22b7a3eccadb892ceccec9feff40875405e94dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:28:20 +0200 Subject: [PATCH 14/16] Update test_tracer.cpp --- src/appleseed/renderer/meta/tests/test_tracer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/appleseed/renderer/meta/tests/test_tracer.cpp b/src/appleseed/renderer/meta/tests/test_tracer.cpp index 2ae1a4c759..90ba4e4c0f 100644 --- a/src/appleseed/renderer/meta/tests/test_tracer.cpp +++ b/src/appleseed/renderer/meta/tests/test_tracer.cpp @@ -40,7 +40,6 @@ #include "renderer/kernel/shading/shadingray.h" #include "renderer/kernel/texturing/oiiotexturesystem.h" #include "renderer/kernel/texturing/texturecache.h" -#include "renderer/kernel/texturing/texturestore.h" #include "renderer/modeling/camera/pinholecamera.h" #include "renderer/modeling/color/colorentity.h" #include "renderer/modeling/entity/onframebeginrecorder.h" @@ -79,6 +78,9 @@ // Standard headers. #include +// Forward declarations. +namespace renderer { class TextureStore; } + using namespace foundation; using namespace renderer; From d394c846df9cda1afc0933bd85a451d90907b0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:29:10 +0200 Subject: [PATCH 15/16] Update test_intersector.cpp --- src/appleseed/renderer/meta/tests/test_intersector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/appleseed/renderer/meta/tests/test_intersector.cpp b/src/appleseed/renderer/meta/tests/test_intersector.cpp index 03c5ce016b..4bb9a78794 100644 --- a/src/appleseed/renderer/meta/tests/test_intersector.cpp +++ b/src/appleseed/renderer/meta/tests/test_intersector.cpp @@ -34,7 +34,6 @@ #include "renderer/kernel/shading/shadingpoint.h" #include "renderer/kernel/shading/shadingray.h" #include "renderer/kernel/texturing/texturecache.h" -#include "renderer/kernel/texturing/texturestore.h" #include "renderer/modeling/object/object.h" #include "renderer/modeling/scene/assembly.h" #include "renderer/modeling/scene/assemblyinstance.h" @@ -53,6 +52,9 @@ #include "foundation/memory/autoreleaseptr.h" #include "foundation/utility/test.h" +// Forward declarations. +namespace renderer { class TextureStore; } + using namespace foundation; using namespace renderer; From 2ecf1d8e43e6c5ef8cadc26d72c05e31718016c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaune?= Date: Thu, 9 Apr 2020 09:31:12 +0200 Subject: [PATCH 16/16] Update assemblytree.cpp --- src/appleseed/renderer/kernel/intersection/assemblytree.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/appleseed/renderer/kernel/intersection/assemblytree.cpp b/src/appleseed/renderer/kernel/intersection/assemblytree.cpp index 2eecfdd1cd..95fdcea1c7 100644 --- a/src/appleseed/renderer/kernel/intersection/assemblytree.cpp +++ b/src/appleseed/renderer/kernel/intersection/assemblytree.cpp @@ -40,6 +40,7 @@ #include "renderer/modeling/object/meshobject.h" #include "renderer/modeling/object/object.h" #include "renderer/modeling/object/proceduralobject.h" +#include "renderer/modeling/project/project.h" #include "renderer/modeling/scene/assemblyinstance.h" #include "renderer/modeling/scene/objectinstance.h" #include "renderer/modeling/scene/scene.h"