ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
CameraLayout.h
Go to the documentation of this file.
1/**
2 * @file CameraLayout.h
3 * @brief Declares the CameraLayout class for managing camera orientation and axis alignment.
4 *
5 * This file defines the CameraLayout class, which provides functionality for configuring
6 * camera orientation based on forward and up axes, and calculates the necessary transformations.
7 *
8 * @date 22/12/2024
9 * @author Coela Can't
10 */
11
12#pragma once
13
14#include "../Utils/Math/Transform.h" // Include for mathematical transformations.
15
16/**
17 * @class CameraLayout
18 * @brief Manages camera orientation and axis alignment.
19 *
20 * The CameraLayout class defines the camera's orientation using forward and up axes.
21 * It provides methods for retrieving orientation vectors and rotation information.
22 */
24public:
25 /**
26 * @enum ForwardAxis
27 * @brief Defines possible forward axes for the camera.
28 */
30 XForward, ///< Forward along the positive X-axis.
31 YForward, ///< Forward along the positive Y-axis.
32 ZForward, ///< Forward along the positive Z-axis.
33 XNForward, ///< Forward along the negative X-axis.
34 YNForward, ///< Forward along the negative Y-axis.
35 ZNForward ///< Forward along the negative Z-axis.
36 };
37
38 /**
39 * @enum UpAxis
40 * @brief Defines possible up axes for the camera.
41 */
42 enum UpAxis {
43 XUp, ///< Up along the positive X-axis.
44 YUp, ///< Up along the positive Y-axis.
45 ZUp, ///< Up along the positive Z-axis.
46 XNUp, ///< Up along the negative X-axis.
47 YNUp, ///< Up along the negative Y-axis.
48 ZNUp ///< Up along the negative Z-axis.
49 };
50
51private:
52 Quaternion rotation; ///< Rotation representing the camera's orientation.
53 ForwardAxis forwardAxis; ///< The camera's forward axis.
54 UpAxis upAxis; ///< The camera's up axis.
55
56 /**
57 * @brief Verifies the validity of the camera's transformation.
58 *
59 * @return True if the transformation is valid, otherwise false.
60 */
61 bool VerifyTransform();
62
63 /**
64 * @brief Calculates the camera's transformation based on its axes.
65 */
66 void CalculateTransform();
67
68public:
69 /**
70 * @brief Constructs a CameraLayout with specified forward and up axes.
71 *
72 * @param forwardAxis The forward axis of the camera.
73 * @param upAxis The up axis of the camera.
74 */
76
77 /**
78 * @brief Retrieves the camera's forward axis.
79 *
80 * @return The camera's forward axis.
81 */
83
84 /**
85 * @brief Retrieves the camera's up axis.
86 *
87 * @return The camera's up axis.
88 */
90
91 /**
92 * @brief Retrieves the camera's forward vector.
93 *
94 * @return The forward vector as a Vector3D.
95 */
97
98 /**
99 * @brief Retrieves the camera's up vector.
100 *
101 * @return The up vector as a Vector3D.
102 */
104
105 /**
106 * @brief Retrieves the camera's rotation.
107 *
108 * @return The rotation as a Quaternion.
109 */
111};
Manages camera orientation and axis alignment.
UpAxis
Defines possible up axes for the camera.
@ XNUp
Up along the negative X-axis.
@ XUp
Up along the positive X-axis.
@ ZNUp
Up along the negative Z-axis.
@ ZUp
Up along the positive Z-axis.
@ YUp
Up along the positive Y-axis.
@ YNUp
Up along the negative Y-axis.
void CalculateTransform()
Calculates the camera's transformation based on its axes.
Quaternion rotation
Rotation representing the camera's orientation.
Quaternion GetRotation()
Retrieves the camera's rotation.
ForwardAxis GetForwardAxis()
Retrieves the camera's forward axis.
ForwardAxis
Defines possible forward axes for the camera.
@ XForward
Forward along the positive X-axis.
@ XNForward
Forward along the negative X-axis.
@ ZNForward
Forward along the negative Z-axis.
@ YNForward
Forward along the negative Y-axis.
@ YForward
Forward along the positive Y-axis.
@ ZForward
Forward along the positive Z-axis.
UpAxis upAxis
The camera's up axis.
bool VerifyTransform()
Verifies the validity of the camera's transformation.
ForwardAxis forwardAxis
The camera's forward axis.
Vector3D GetForwardVector()
Retrieves the camera's forward vector.
UpAxis GetUpAxis()
Retrieves the camera's up axis.
Vector3D GetUpVector()
Retrieves the camera's up vector.
A mathematical construct representing a rotation in 3D space.
Definition Quaternion.h:30
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26