Пример #1
0
void LightPathsTab::recreate_handlers()
{
    // Handler for zooming the render widget in and out with the keyboard or the mouse wheel.
    m_zoom_handler.reset(
        new WidgetZoomHandler(
            m_scroll_area,
            m_light_paths_widget));

    // Handler for panning the render widget with the mouse.
    m_pan_handler.reset(
        new ScrollAreaPanHandler(
            m_scroll_area));

    // Handler for tracking and displaying mouse coordinates.
    m_mouse_tracker.reset(
        new MouseCoordinatesTracker(
            m_light_paths_widget,
            m_info_label));

    // The screen-space paths picking handler is used to pick paths from the render widget.
    m_screen_space_paths_picking_handler.reset(
        new LightPathsPickingHandler(
            m_light_paths_widget,
            *m_mouse_tracker.get(),
            m_project));
    m_screen_space_paths_picking_handler->set_enabled(false);

    // The world-space paths picking handler is used to pick paths in the light paths widget.
    // Commented out because we don't want to allow that.
    // m_world_space_paths_picking_handler.reset(
    //     new LightPathsPickingHandler(
    //         m_light_paths_widget,
    //         *m_mouse_tracker.get(),
    //         m_project));

    // Camera handler.
    m_light_paths_widget->setMouseTracking(true);
    m_camera_controller.reset(
        new CameraController(
            m_light_paths_widget,
            m_project,
            m_project.get_uncached_active_camera()));
    connect(
        m_camera_controller.get(), SIGNAL(signal_camera_changed()),
        SLOT(slot_camera_changed()));

    // Clipboard handler.
    m_clipboard_handler.reset(new RenderClipboardHandler(m_light_paths_widget, m_light_paths_widget));
}
Пример #2
0
void RenderingManager::start_rendering(
    Project*                    project,
    const ParamArray&           params,
    const bool                  interactive,
    RenderWidget*               render_widget)
{
    m_project = project;
    m_params = params;
    m_render_widget = render_widget;
    m_camera_changed = false;

    if (interactive)
    {
        m_camera_controller.reset(
            new CameraController(
                m_render_widget,
                m_project->get_scene()));

        connect(
            m_camera_controller.get(), SIGNAL(signal_camera_changed()),
            this, SLOT(slot_camera_changed()));

        connect(
            m_camera_controller.get(), SIGNAL(signal_camera_changed()),
            this, SIGNAL(signal_camera_changed()));
    }

    const bool highlight_tiles = !interactive;

    m_tile_callback_factory.reset(
        new QtTileCallbackFactory(
            m_render_widget,
            highlight_tiles));

    m_master_renderer.reset(
        new MasterRenderer(
            *m_project,
            m_params,
            &m_renderer_controller,
            m_tile_callback_factory.get(),
            &m_abort_switch));

    m_master_renderer_thread.reset(
        new MasterRendererThread(m_master_renderer.get()));

    m_master_renderer_thread->start();
}