 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
1 #ifndef RAYLIB_CPP_INCLUDE_CAMERA3D_HPP_
2 #define RAYLIB_CPP_INCLUDE_CAMERA3D_HPP_
4 #include "./raylib.hpp"
5 #include "./Vector3.hpp"
6 #include "./raylib-cpp-utils.hpp"
31 int projection = CAMERA_PERSPECTIVE) : ::Camera3D{position, target, up, fovy, projection} {}
35 GETTERSETTER(::
Vector3, Position, position)
38 GETTERSETTER(
float, Fovy, fovy)
39 GETTERSETTER(
int, Projection, projection)
66 return ::GetCameraMatrix(*
this);
73 ::SetCameraMode(*
this, mode);
81 ::SetCameraAltControl(altKey);
89 ::SetCameraSmoothZoomControl(szKey);
97 int frontKey,
int backKey,
98 int rightKey,
int leftKey,
99 int upKey,
int downKey) {
100 ::SetCameraMoveControls(frontKey, backKey, rightKey, leftKey, upKey, downKey);
116 return ::GetMouseRay(mousePosition, *
this);
123 return ::GetWorldToScreen(position, *
this);
130 const ::Texture2D& texture,
133 ::
Color tint = {255, 255, 255, 255}) {
142 const ::Texture2D& texture,
146 ::
Color tint = {255, 255, 255, 255}) {
147 ::DrawBillboardRec(*
this, texture, sourceRec, center, size, tint);
152 inline void set(const ::Camera3D& camera) {
153 position = camera.position;
154 target = camera.target;
157 projection = camera.projection;
161 typedef Camera3D Camera;
164 #endif // RAYLIB_CPP_INCLUDE_CAMERA3D_HPP_
All raylib-cpp classes and functions appear in the raylib namespace.
Matrix type (OpenGL style 4x4 - right handed, column major)
static void UpdateCamera(const ::Camera &camera)
Update camera depending on selected mode.
Ray GetMouseRay(::Vector2 mousePosition) const
Returns a ray trace from mouse position.
Camera3D & SetMode(int mode)
Set camera mode (multiple camera modes available)
Matrix GetMatrix() const
Get transform matrix for camera.
Camera3D & BeginMode()
Initializes 3D mode with custom camera (3D)
Camera3D & EndMode()
Ends 3D mode and returns to default 2D orthographic mode.
Ray type (useful for raycast)
Camera3D & Update()
Update camera position for selected mode.
Camera3D & SetMoveControls(int frontKey, int backKey, int rightKey, int leftKey, int upKey, int downKey)
Set camera move controls (1st person and 3rd person cameras)
Camera3D & DrawBillboard(const ::Texture2D &texture, ::Rectangle sourceRec, ::Vector3 center, ::Vector2 size, ::Color tint={255, 255, 255, 255})
Draw a billboard texture defined by source.
Camera3D & SetAltControl(int altKey)
Set camera alt key to combine with mouse movement (free camera)
Camera3D & DrawBillboard(const ::Texture2D &texture, ::Vector3 center, float size, ::Color tint={255, 255, 255, 255})
Draw a billboard texture.
Camera type, defines a camera position/orientation in 3d space.
Camera3D(::Vector3 position, ::Vector3 target=::Vector3{0.0f, 0.0f, 0.0f}, ::Vector3 up=::Vector3{0.0f, 1.0f, 0.0f}, float fovy=0, int projection=CAMERA_PERSPECTIVE)
Create a new Camera3D.
Camera3D & SetSmoothZoomControl(int szKey)
Set camera smooth zoom key to combine with mouse (free camera)
Vector2 GetWorldToScreen(::Vector3 position) const
Returns the screen space position for a 3d world space position.