28 _camera.position = (raylib::Vector3){(float)pos.x, (
float)pos.y, (float)pos.z};
29 _camera.target = (raylib::Vector3){(float)target.
x, (
float)target.
y, (float)target.
z};
30 _camera.up = (raylib::Vector3){0.f, 1.f, 0.0f};
32 _camera.projection = raylib::CAMERA_PERSPECTIVE;
33 _mode = raylib::CAMERA_CUSTOM;
48 case raylib::CameraMode::CAMERA_FREE:
return ICamera::Mode::FREE;
49 case raylib::CameraMode::CAMERA_ORBITAL:
return ICamera::Mode::ORBITAL;
50 case raylib::CameraMode::CAMERA_FIRST_PERSON:
return ICamera::Mode::FIRST_PERSON;
51 case raylib::CameraMode::CAMERA_THIRD_PERSON:
return ICamera::Mode::THIRD_PERSON;
52 default:
return ICamera::Mode::CUSTOM;
56 void setMode(ICamera::Mode mode)
override {
58 case ICamera::Mode::FREE: _mode = raylib::CameraMode::CAMERA_FREE;
break;
59 case ICamera::Mode::ORBITAL: _mode = raylib::CameraMode::CAMERA_ORBITAL;
break;
60 case ICamera::Mode::FIRST_PERSON: _mode = raylib::CameraMode::CAMERA_FIRST_PERSON;
break;
61 case ICamera::Mode::THIRD_PERSON: _mode = raylib::CameraMode::CAMERA_THIRD_PERSON;
break;
62 default: _mode = raylib::CameraMode::CAMERA_CUSTOM;
break;
67 return {_camera.position.x, _camera.position.y, _camera.position.z};
71 _camera.position = {float(position.
x), float(position.
y), float(position.
z)};
75 return _camera.projection == raylib::CAMERA_ORTHOGRAPHIC ? ICamera::ORTHOGRAPHIC : ICamera::PERSPECTIVE;
79 _camera.projection = projection == ICamera::ORTHOGRAPHIC ? raylib::CAMERA_ORTHOGRAPHIC : raylib::CAMERA_PERSPECTIVE;
83 return {_camera.target.x, _camera.target.y, _camera.target.z};
87 _camera.target = {float(target.
x), float(target.
y), float(target.
z)};
91 return {_camera.up.x, _camera.up.y, _camera.up.z};
95 _camera.up = {float(up.
x), float(up.
y), float(up.
z)};
101 raylib::Camera _camera;
102 raylib::CameraMode _mode;
void setPosition(Vector3f position) override
Set the position.
Definition RayCamera.hpp:70
void setProjection(ICamera::Projection projection) override
Definition RayCamera.hpp:78
float getFov() const override
Get the FOV.
Definition RayCamera.hpp:38
Vector3f getPosition() const override
Get the position.
Definition RayCamera.hpp:66
RayCamera(Vector3f pos={100.0f, 100.0f, 100.0f}, Vector3f target={0.f, 0.f, 0.f}, float fov=45.f)
Definition RayCamera.hpp:26
void setTarget(Vector3f target) override
Set the target.
Definition RayCamera.hpp:86
Vector3f getTarget() const override
Get the target.
Definition RayCamera.hpp:82
Vector3f getUp() const override
Get the up vector.
Definition RayCamera.hpp:90
friend class RayWindow
Definition RayCamera.hpp:98
ICamera::Projection getProjection() const override
Get the Projection.
Definition RayCamera.hpp:74
void setUp(Vector3f up) override
Set the up vector.
Definition RayCamera.hpp:94
void setFov(float fov) override
Set the FOV.
Definition RayCamera.hpp:42
void setMode(ICamera::Mode mode) override
Definition RayCamera.hpp:56
ICamera::Mode getMode() const override
Get the mode.
Definition RayCamera.hpp:46
Camera interface.
Definition ICamera.hpp:23
Vector3< double > Vector3f
Definition Vector3.hpp:121
T x
Definition Vector3.hpp:21
T y
Definition Vector3.hpp:21
T z
Definition Vector3.hpp:21