Voltray Engine Docs
Loading...
Searching...
No Matches
PerspectiveCamera.h
Go to the documentation of this file.
1#pragma once
2
3#include "BaseCamera.h"
4
14{
15public:
24 PerspectiveCamera(const std::string &name, float fovDeg, float aspect, float nearPlane, float farPlane);
25
26 // Perspective-specific operations
27 virtual void SetFieldOfView(float fovDeg);
28 virtual float GetFieldOfView() const { return m_Fov; }
29
30 // Basic perspective projection (can be overridden for specialized projections)
31 virtual Mat4 GetProjectionMatrix() const override; // Ray casting for perspective cameras
32 virtual Ray ScreenToWorldRay(float screenX, float screenY) const override;
33
34 // Camera type identification
35 virtual CameraType GetType() const override { return CameraType::PERSPECTIVE; }
36 virtual std::string GetTypeName() const override { return "Perspective"; }
37
38protected:
39 float m_Fov; // Field of view in degrees
40
41 // Helper methods for specialized perspective projections
42 virtual Mat4 CreatePerspectiveMatrix(float fov, float aspect, float nearPlane, float farPlane) const;
43 virtual Mat4 ApplyPerspectiveCorrection(const Mat4 &baseProjection) const;
44};
CameraType
Enumeration of all supported camera types.
Definition BaseCamera.h:17
Abstract base class for all camera types.
Definition BaseCamera.h:34
Base class for all perspective projection cameras.
Definition PerspectiveCamera.h:14
virtual CameraType GetType() const override
Definition PerspectiveCamera.h:35
float m_Fov
Definition PerspectiveCamera.h:39
virtual Mat4 ApplyPerspectiveCorrection(const Mat4 &baseProjection) const
Definition PerspectiveCamera.cpp:59
virtual Ray ScreenToWorldRay(float screenX, float screenY) const override
Definition PerspectiveCamera.cpp:21
virtual void SetFieldOfView(float fovDeg)
Definition PerspectiveCamera.cpp:11
virtual Mat4 GetProjectionMatrix() const override
Definition PerspectiveCamera.cpp:16
virtual Mat4 CreatePerspectiveMatrix(float fov, float aspect, float nearPlane, float farPlane) const
Definition PerspectiveCamera.cpp:52
virtual std::string GetTypeName() const override
Definition PerspectiveCamera.h:36
virtual float GetFieldOfView() const
Definition PerspectiveCamera.h:28
4x4 Matrix structure for 3D transformations and projections.
Definition Mat4.h:16
Represents a ray in 3D space with an origin and direction.
Definition Ray.h:15