ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
CameraLayout Class Reference

Manages camera orientation and axis alignment. More...

#include <CameraLayout.h>

Collaboration diagram for CameraLayout:

Public Types

enum  ForwardAxis {
  XForward , YForward , ZForward , XNForward ,
  YNForward , ZNForward
}
 Defines possible forward axes for the camera. More...
 
enum  UpAxis {
  XUp , YUp , ZUp , XNUp ,
  YNUp , ZNUp
}
 Defines possible up axes for the camera. More...
 

Public Member Functions

 CameraLayout (ForwardAxis forwardAxis, UpAxis upAxis)
 Constructs a CameraLayout with specified forward and up axes.
 
ForwardAxis GetForwardAxis ()
 Retrieves the camera's forward axis.
 
UpAxis GetUpAxis ()
 Retrieves the camera's up axis.
 
Vector3D GetForwardVector ()
 Retrieves the camera's forward vector.
 
Vector3D GetUpVector ()
 Retrieves the camera's up vector.
 
Quaternion GetRotation ()
 Retrieves the camera's rotation.
 

Private Member Functions

bool VerifyTransform ()
 Verifies the validity of the camera's transformation.
 
void CalculateTransform ()
 Calculates the camera's transformation based on its axes.
 

Private Attributes

Quaternion rotation
 Rotation representing the camera's orientation.
 
ForwardAxis forwardAxis
 The camera's forward axis.
 
UpAxis upAxis
 The camera's up axis.
 

Detailed Description

Manages camera orientation and axis alignment.

The CameraLayout class defines the camera's orientation using forward and up axes. It provides methods for retrieving orientation vectors and rotation information.

Definition at line 23 of file CameraLayout.h.

Member Enumeration Documentation

◆ ForwardAxis

Defines possible forward axes for the camera.

Enumerator
XForward 

Forward along the positive X-axis.

YForward 

Forward along the positive Y-axis.

ZForward 

Forward along the positive Z-axis.

XNForward 

Forward along the negative X-axis.

YNForward 

Forward along the negative Y-axis.

ZNForward 

Forward along the negative Z-axis.

Definition at line 29 of file CameraLayout.h.

◆ UpAxis

Defines possible up axes for the camera.

Enumerator
XUp 

Up along the positive X-axis.

YUp 

Up along the positive Y-axis.

ZUp 

Up along the positive Z-axis.

XNUp 

Up along the negative X-axis.

YNUp 

Up along the negative Y-axis.

ZNUp 

Up along the negative Z-axis.

Definition at line 42 of file CameraLayout.h.

Constructor & Destructor Documentation

◆ CameraLayout()

CameraLayout ( ForwardAxis  forwardAxis,
UpAxis  upAxis 
)

Constructs a CameraLayout with specified forward and up axes.

Parameters
forwardAxisThe forward axis of the camera.
upAxisThe up axis of the camera.

Definition at line 3 of file CameraLayout.cpp.

References CalculateTransform(), forwardAxis, and upAxis.

Member Function Documentation

◆ CalculateTransform()

void CalculateTransform ( )
private

Calculates the camera's transformation based on its axes.

Definition at line 20 of file CameraLayout.cpp.

References Vector3D::CrossProduct(), GetForwardVector(), Rotation::GetQuaternion(), GetUpVector(), rotation, Quaternion::UnitQuaternion(), and VerifyTransform().

Referenced by CameraLayout().

◆ GetForwardAxis()

CameraLayout::ForwardAxis GetForwardAxis ( )

Retrieves the camera's forward axis.

Returns
The camera's forward axis.

Definition at line 33 of file CameraLayout.cpp.

References forwardAxis.

◆ GetForwardVector()

Vector3D GetForwardVector ( )

Retrieves the camera's forward vector.

Returns
The forward vector as a Vector3D.

Definition at line 41 of file CameraLayout.cpp.

References forwardAxis, Vector3D::X, XForward, XNForward, Vector3D::Y, YForward, YNForward, Vector3D::Z, and ZNForward.

Referenced by CalculateTransform().

◆ GetRotation()

Quaternion GetRotation ( )

Retrieves the camera's rotation.

Returns
The rotation as a Quaternion.

Definition at line 71 of file CameraLayout.cpp.

References rotation.

Referenced by Rasterizer::Rasterize().

◆ GetUpAxis()

CameraLayout::UpAxis GetUpAxis ( )

Retrieves the camera's up axis.

Returns
The camera's up axis.

Definition at line 37 of file CameraLayout.cpp.

References upAxis.

◆ GetUpVector()

Vector3D GetUpVector ( )

Retrieves the camera's up vector.

Returns
The up vector as a Vector3D.

Definition at line 56 of file CameraLayout.cpp.

References upAxis, Vector3D::X, XNUp, XUp, Vector3D::Y, YNUp, Vector3D::Z, ZNUp, and ZUp.

Referenced by CalculateTransform().

◆ VerifyTransform()

bool VerifyTransform ( )
private

Verifies the validity of the camera's transformation.

Returns
True if the transformation is valid, otherwise false.

Definition at line 10 of file CameraLayout.cpp.

References forwardAxis, upAxis, XForward, XNForward, XNUp, XUp, YForward, YNForward, YNUp, YUp, ZNUp, and ZUp.

Referenced by CalculateTransform().

Member Data Documentation

◆ forwardAxis

ForwardAxis forwardAxis
private

The camera's forward axis.

Definition at line 53 of file CameraLayout.h.

Referenced by CameraLayout(), GetForwardAxis(), GetForwardVector(), and VerifyTransform().

◆ rotation

Quaternion rotation
private

Rotation representing the camera's orientation.

Definition at line 52 of file CameraLayout.h.

Referenced by CalculateTransform(), and GetRotation().

◆ upAxis

UpAxis upAxis
private

The camera's up axis.

Definition at line 54 of file CameraLayout.h.

Referenced by CameraLayout(), GetUpAxis(), GetUpVector(), and VerifyTransform().


The documentation for this class was generated from the following files: