<commit_before>#pragma once

#include <Gui/RaGui.hpp>

#include <atomic>
#include <memory>

#include <QWindow>

#include <QThread>

#include <Core/CoreMacros.hpp>
#include <Core/Types.hpp>

#include <Engine/RadiumEngine.hpp>
#include <Engine/Rendering/Renderer.hpp>

#include <Engine/Scene/CameraComponent.hpp>
#include <Gui/Utils/KeyMappingManager.hpp>
#include <Gui/Viewer/WindowQt.hpp>

// Forward declarations
class QOpenGLContext;
class QSurfaceFormat;

namespace Ra {
namespace Gui {
class CameraManipulator;
class GizmoManager;
class PickingManager;
} // namespace Gui
} // namespace Ra

namespace Ra {
namespace Gui {

/** The Viewer is the main display class. It could be used as an independant window or
 * can be set as a central widget on a more complex gui by using the adapter from QWindow to QWidget
 * To do that, the following code could be used :
 * \code{.cpp}
 *     m_viewer = new Ra::Gui::Viewer();
 *     QWidget * viewerwidget = QWidget::createWindowContainer(m_viewer);
 *     setCentralWidget(viewerwidget);
 * \endcode
 * Whatever its usage (QWindow or QWidget) the Viewer has the same funtionalities.
 * Its acts as a bridge between the interface, the engine and the renderer
 * Among its responsibilities are :
 * * Owning the renderer and camera, and managing their lifetime.
 * * setting up the renderer and camera by keeping it informed of interfaces changes
 *  (e.g. resize).
 * * catching user interaction (mouse clicks) at the lowest level and forward it to
 * the camera and the rest of the application
 * * Expose the asynchronous rendering interface
 */
class RA_GUI_API Viewer : public WindowQt, public KeyMappingManageable<Viewer>
{
    Q_OBJECT
    friend class KeyMappingManageable<Viewer>;

  public:
    /// Constructor
    explicit Viewer( QScreen* screen = nullptr );

    /// Destructor
    ~Viewer() override;

    /// add observers to keyMappingManager for gizmo, camera and viewer.
    virtual void setupKeyMappingCallbacks();

    /** Prepare the viewer to display a scene.
     * This will ask the renderer to build its specific OenGL related objects
     * and set the camera to its default state
     * @return true if the scene is ready to display.
     */
    virtual bool prepareDisplay();

    //
    // Accessors
    //
    /// Access to the OpenGL context of the Viewer
    QOpenGLContext* getContext() const { return m_context.get(); }

    /// Set the current camera interface.
    void setCameraManipulator( CameraManipulator* ci );

    /// Access to camera interface.
    CameraManipulator* getCameraManipulator();

    /// Set the camera managed by the cameraInterface
    void setCamera( Engine::Scene::CameraComponent* camera );

    void resetToDefaultCamera();<commit_msg>[gui] fix viewer remove set camera.<commit_after>#pragma once

#include <Gui/RaGui.hpp>

#include <atomic>
#include <memory>

#include <QWindow>

#include <QThread>

#include <Core/CoreMacros.hpp>
#include <Core/Types.hpp>

#include <Engine/RadiumEngine.hpp>
#include <Engine/Rendering/Renderer.hpp>

#include <Engine/Scene/CameraComponent.hpp>
#include <Gui/Utils/KeyMappingManager.hpp>
#include <Gui/Viewer/WindowQt.hpp>

// Forward declarations
class QOpenGLContext;
class QSurfaceFormat;

namespace Ra {
namespace Gui {
class CameraManipulator;
class GizmoManager;
class PickingManager;
} // namespace Gui
} // namespace Ra

namespace Ra {
namespace Gui {

/** The Viewer is the main display class. It could be used as an independant window or
 * can be set as a central widget on a more complex gui by using the adapter from QWindow to QWidget
 * To do that, the following code could be used :
 * \code{.cpp}
 *     m_viewer = new Ra::Gui::Viewer();
 *     QWidget * viewerwidget = QWidget::createWindowContainer(m_viewer);
 *     setCentralWidget(viewerwidget);
 * \endcode
 * Whatever its usage (QWindow or QWidget) the Viewer has the same funtionalities.
 * Its acts as a bridge between the interface, the engine and the renderer
 * Among its responsibilities are :
 * * Owning the renderer and camera, and managing their lifetime.
 * * setting up the renderer and camera by keeping it informed of interfaces changes
 *  (e.g. resize).
 * * catching user interaction (mouse clicks) at the lowest level and forward it to
 * the camera and the rest of the application
 * * Expose the asynchronous rendering interface
 */
class RA_GUI_API Viewer : public WindowQt, public KeyMappingManageable<Viewer>
{
    Q_OBJECT
    friend class KeyMappingManageable<Viewer>;

  public:
    /// Constructor
    explicit Viewer( QScreen* screen = nullptr );

    /// Destructor
    ~Viewer() override;

    /// add observers to keyMappingManager for gizmo, camera and viewer.
    virtual void setupKeyMappingCallbacks();

    /** Prepare the viewer to display a scene.
     * This will ask the renderer to build its specific OenGL related objects
     * and set the camera to its default state
     * @return true if the scene is ready to display.
     */
    virtual bool prepareDisplay();

    //
    // Accessors
    //
    /// Access to the OpenGL context of the Viewer
    QOpenGLContext* getContext() const { return m_context.get(); }

    /// Set the current camera interface.
    void setCameraManipulator( CameraManipulator* ci );

    /// Access to camera interface.
    CameraManipulator* getCameraManipulator();

    void resetToDefaultCamera();
{'fraction_non_alphanumeric': 0.08606937488406603, 'fraction_numerical': 0.0, 'mean_word_length': 3.6643598615916955, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1749039', 'n_tokens_mistral': 1546, 'n_tokens_neox': 1498, 'n_words': 587}