MCPcopy Create free account
hub / github.com/RobLoach/raylib-cpp / Camera3D

Class Camera3D

include/Camera3D.hpp:12–137  ·  view source on GitHub ↗

* Camera type, defines a camera position/orientation in 3d space */

Source from the content-addressed store, hash-verified

10 * Camera type, defines a camera position/orientation in 3d space
11 */
12class Camera3D : public ::Camera3D {
13public:
14 Camera3D(const ::Camera3D& camera) : ::Camera3D(camera) { }
15
16 /**
17 * Create a new Camera3D.
18 *
19 * @param position Camera position
20 * @param target Camera target it looks-at
21 * @param up Camera up vector (rotation over its axis)
22 * @param fovy Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in
23 * orthographic
24 * @param projection Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
25 */
26 Camera3D(
27 ::Vector3 position = ::Vector3{0.0f, 0.0f, 0.0f},
28 ::Vector3 target = ::Vector3{0.0f, 0.0f, -1.0f},
29 ::Vector3 up = ::Vector3{0.0f, 1.0f, 0.0f},
30 float fovy = 45.0f,
31 int projection = CAMERA_PERSPECTIVE)
32 : ::Camera3D{position, target, up, fovy, projection} {}
33
34 GETTERSETTER(::Vector3, Position, position)
35 GETTERSETTER(::Vector3, Target, target)
36 GETTERSETTER(::Vector3, Up, up)
37 GETTERSETTER(float, Fovy, fovy)
38 GETTERSETTER(int, Projection, projection)
39
40 Camera3D& operator=(const ::Camera3D& camera) {
41 set(camera);
42 return *this;
43 }
44
45 [[nodiscard]] std::string ToString() const {
46 return TextFormat(
47 "Camera3D(position=(%f, %f, %f), target=(%f, %f, %f), fovy=%f)",
48 position.x, position.y, position.z,
49 target.x, target.y, target.z,
50 fovy
51 );
52 }
53
54 operator std::string() const { return ToString(); }
55
56 /**
57 * Initializes 3D mode with custom camera (3D)
58 */
59 Camera3D& BeginMode() {
60 ::BeginMode3D(*this);
61 return *this;
62 }
63
64 /**
65 * Ends 3D mode and returns to default 2D orthographic mode
66 */
67 Camera3D& EndMode() {
68 ::EndMode3D();
69 return *this;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected