Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/Camera.h
Show All 19 Lines | |||||
* which can be used to cull objects for rendering. | * which can be used to cull objects for rendering. | ||||
*/ | */ | ||||
#ifndef INCLUDED_CAMERA | #ifndef INCLUDED_CAMERA | ||||
#define INCLUDED_CAMERA | #define INCLUDED_CAMERA | ||||
#include "graphics/Frustum.h" | #include "graphics/Frustum.h" | ||||
#include "maths/BoundingBoxAligned.h" | #include "maths/BoundingBoxAligned.h" | ||||
#include "maths/Matrix3D.h" | #include "maths/Matrix3D.h" | ||||
elexis: tanf in <math.h> | |||||
#include <array> | |||||
// view port | // view port | ||||
struct SViewPort | struct SViewPort | ||||
{ | { | ||||
int m_X; | int m_X; | ||||
int m_Y; | int m_Y; | ||||
int m_Width; | int m_Width; | ||||
int m_Height; | int m_Height; | ||||
}; | }; | ||||
Show All 18 Lines | public: | ||||
// everytime the view or projection matrices are | // everytime the view or projection matrices are | ||||
// altered. | // altered. | ||||
void UpdateFrustum(const CBoundingBoxAligned& scissor = CBoundingBoxAligned(CVector3D(-1.0f, -1.0f, -1.0f), CVector3D(1.0f, 1.0f, 1.0f))); | void UpdateFrustum(const CBoundingBoxAligned& scissor = CBoundingBoxAligned(CVector3D(-1.0f, -1.0f, -1.0f), CVector3D(1.0f, 1.0f, 1.0f))); | ||||
void ClipFrustum(const CPlane& clipPlane); | void ClipFrustum(const CPlane& clipPlane); | ||||
const CFrustum& GetFrustum() const { return m_ViewFrustum; } | const CFrustum& GetFrustum() const { return m_ViewFrustum; } | ||||
void SetViewPort(const SViewPort& viewport); | void SetViewPort(const SViewPort& viewport); | ||||
const SViewPort& GetViewPort() const { return m_ViewPort; } | const SViewPort& GetViewPort() const { return m_ViewPort; } | ||||
float GetAspectRatio() const; | |||||
float GetNearPlane() const { return m_NearPlane; } | float GetNearPlane() const { return m_NearPlane; } | ||||
float GetFarPlane() const { return m_FarPlane; } | float GetFarPlane() const { return m_FarPlane; } | ||||
float GetFOV() const { return m_FOV; } | float GetFOV() const { return m_FOV; } | ||||
// Returns four points in camera space at given distance from camera | // Returns four points in camera space at given distance from camera | ||||
void GetCameraPlanePoints(float dist, CVector3D pts[4]) const; | void GetCameraPlanePoints(float dist, std::array<CVector3D, 4>& pts) const; | ||||
// Build a ray passing through the screen coordinate (px, py) and the camera | // Build a ray passing through the screen coordinate (px, py) and the camera | ||||
///////////////////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////////////////// | ||||
// BuildCameraRay: calculate origin and ray direction of a ray through | // BuildCameraRay: calculate origin and ray direction of a ray through | ||||
// the pixel (px,py) on the screen | // the pixel (px,py) on the screen | ||||
void BuildCameraRay(int px, int py, CVector3D& origin, CVector3D& dir) const; | void BuildCameraRay(int px, int py, CVector3D& origin, CVector3D& dir) const; | ||||
// General helpers that seem to fit here | // General helpers that seem to fit here | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
tanf in <math.h>