2020-04-26 21:37:49 +00:00
|
|
|
// Copyright 2020 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
#include "Common/Matrix.h"
|
|
|
|
#include "VideoCommon/VideoConfig.h"
|
|
|
|
|
|
|
|
class PointerWrap;
|
|
|
|
|
|
|
|
class CameraController
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CameraController() = default;
|
|
|
|
virtual ~CameraController() = default;
|
|
|
|
|
|
|
|
CameraController(const CameraController&) = delete;
|
|
|
|
CameraController& operator=(const CameraController&) = delete;
|
|
|
|
|
|
|
|
CameraController(CameraController&&) = delete;
|
|
|
|
CameraController& operator=(CameraController&&) = delete;
|
|
|
|
|
|
|
|
virtual Common::Matrix44 GetView() = 0;
|
|
|
|
|
|
|
|
virtual void MoveVertical(float amt) = 0;
|
|
|
|
virtual void MoveHorizontal(float amt) = 0;
|
|
|
|
|
|
|
|
virtual void Zoom(float amt) = 0;
|
|
|
|
|
|
|
|
virtual void Rotate(const Common::Vec3& amt) = 0;
|
|
|
|
|
|
|
|
virtual void Reset() = 0;
|
|
|
|
|
|
|
|
virtual void DoState(PointerWrap& p) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class FreeLookCamera
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void SetControlType(FreelookControlType type);
|
|
|
|
Common::Matrix44 GetView();
|
2020-05-18 22:22:41 +00:00
|
|
|
Common::Vec2 GetFieldOfView() const;
|
2020-04-26 21:37:49 +00:00
|
|
|
|
|
|
|
void MoveVertical(float amt);
|
|
|
|
void MoveHorizontal(float amt);
|
|
|
|
|
|
|
|
void Zoom(float amt);
|
|
|
|
|
|
|
|
void Rotate(const Common::Vec3& amt);
|
|
|
|
|
2020-05-18 22:22:41 +00:00
|
|
|
void IncreaseFovX(float fov);
|
|
|
|
void IncreaseFovY(float fov);
|
|
|
|
|
2020-04-26 21:37:49 +00:00
|
|
|
void Reset();
|
|
|
|
|
|
|
|
void DoState(PointerWrap& p);
|
|
|
|
|
|
|
|
bool IsDirty() const;
|
2020-06-17 17:07:40 +00:00
|
|
|
void SetClean();
|
2020-04-26 21:37:49 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_dirty = false;
|
2020-05-18 22:22:41 +00:00
|
|
|
float m_fov_x = 1.0f;
|
|
|
|
float m_fov_y = 1.0f;
|
2020-04-26 21:37:49 +00:00
|
|
|
std::optional<FreelookControlType> m_current_type;
|
|
|
|
std::unique_ptr<CameraController> m_camera_controller;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern FreeLookCamera g_freelook_camera;
|