Class CameraController

Synopsis

#include <Source/Falcor/Scene/Camera/CameraController.h>

class dlldecl CameraController

Description

Camera controller interface. Camera controllers should inherit from this object.

Inheritance

Decsendents: OrbiterCameraController, FirstPersonCameraControllerCommon

Methods

CameraController
~CameraController
onKeyEvent
onMouseEventHandle mouse events
setCameraSpeedSet the camera's speed
updateUpdate the camera position and orientation.

Source

Lines 39-67 in Source/Falcor/Scene/Camera/CameraController.h.

class dlldecl CameraController
{
public:
    using SharedPtr = std::shared_ptr<CameraController>;
    virtual ~CameraController() = default;
    /** Handle mouse events
    */
    virtual bool onMouseEvent(const MouseEvent& mouseEvent) { return false; }
    /* Handle keyboard events
    */
    virtual bool onKeyEvent(const KeyboardEvent& keyboardEvent) { return false; }
    /** Update the camera position and orientation.
        \return Whether the camera was updated/changed
    */
    virtual bool update() = 0;
    /** Set the camera's speed
        \param[in] Speed Camera speed. Measured in WorldUnits per second.
    */
    void setCameraSpeed(float speed) { mSpeed = speed; }
protected:
    CameraController(const Camera::SharedPtr& pCamera) : mpCamera(pCamera) {}
    Camera::SharedPtr mpCamera = nullptr;
    float mSpeed = 1;
};





Add Discussion as Guest

Log in to DocsForge