BLT-With-Graphics-Template/include/blt/gfx/renderer/camera.h

90 lines
2.4 KiB
C++

/*
* <Short Description>
* Copyright (C) 2024 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef BLT_WITH_GRAPHICS_CAMERA_H
#define BLT_WITH_GRAPHICS_CAMERA_H
#include "blt/gfx/state.h"
namespace blt::gfx
{
class lockable_camera
{
public:
static void handle_lock();
};
class first_person_camera
{
private:
blt::vec3 position_;
blt::vec3 rotation_;
blt::vec3 speed_{25, 25, 25};
public:
void update();
inline void speed(const blt::vec3& speed)
{
speed_ = speed;
}
[[nodiscard]] inline const vec3& speed() const
{
return speed_;
}
[[nodiscard]] inline const vec3& position() const
{
return position_;
}
void update_view(matrix_state_manager& manager);
};
class first_person_camera_2d
{
private:
blt::vec3 position_;
blt::vec3 rotation_;
blt::vec3 speed_{165, 165, 165};
blt::vec3 world_scale_{1,1,1};
public:
void update();
inline void speed(const blt::vec3& speed)
{
speed_ = speed;
}
[[nodiscard]] inline const vec3& speed() const
{
return speed_;
}
[[nodiscard]] inline const vec3& position() const
{
return position_;
}
void update_view(matrix_state_manager& manager);
};
}
#endif //BLT_WITH_GRAPHICS_CAMERA_H