Avara3D 0.2.0
C++ API reference
PerspectiveCamera.h
1//
2// PerspectiveCamera.h
3// avara3d
4//
5// Created by Morgan Davis on 10/22/23.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_VISUAL_CAMERA_PERSPECTIVECAMERA_H
10#define AVARA3D_VISUAL_CAMERA_PERSPECTIVECAMERA_H
11
12#include "a3d/Math.h"
13#include "a3d/visual/camera/Camera.h"
14
15namespace a3d {
16
18 class PerspectiveCamera : public Camera {
19
20 public:
21 // [Public Lifecycle Functions]
22
25
27 PerspectiveCamera(float zNear, float zFar, float yFov);
28
30 PerspectiveCamera(const std::string& name, float zNear, float zFar, float yFov);
31
32 PerspectiveCamera(const PerspectiveCamera&) = default;
33 PerspectiveCamera& operator=(const PerspectiveCamera&) = default;
34
35 PerspectiveCamera(PerspectiveCamera&&) noexcept = default;
36 PerspectiveCamera& operator=(PerspectiveCamera&&) noexcept = default;
37
38 ~PerspectiveCamera() override;
39
40 // [Public Member Functions]
41
43 float zNear() const;
44
46 void zNear(float zNear);
47
49 float zFar() const;
50
52 void zFar(float zFar);
53
55 float yFov() const;
56
58 void yFov(float fov);
59
60 // [Camera Internal Member Functions]
61
62 math::mat4 projection(const math::uvec2& framebufferSize) const override;
63
64 private:
65 // [Private Member Variables]
66
67 float _zNear;
68 float _zFar;
69 float _yFov;
70 };
71
72}
73
74#endif // AVARA3D_VISUAL_CAMERA_PERSPECTIVECAMERA_H
Base class for camera projection models used by VisualWorld.
Definition: Camera.h:26
const std::optional< std::string > & name() const
Returns the optional camera name.
Camera using a perspective projection with a vertical field of view.
float zNear() const
Returns the near clipping distance.
float yFov() const
Returns the vertical field of view in radians.
PerspectiveCamera()
Creates an unnamed camera with a 0.1 near plane, 1000 far plane, and 45-degree vertical FOV.
PerspectiveCamera(float zNear, float zFar, float yFov)
Creates an unnamed perspective camera with the supplied clipping distances and vertical FOV.
PerspectiveCamera(const std::string &name, float zNear, float zFar, float yFov)
Creates a named perspective camera with the supplied clipping distances and vertical FOV.
float zFar() const
Returns the far clipping distance.