ezEngine  Milestone 9
Camera_inl.h
1 #pragma once
2 
3 EZ_ALWAYS_INLINE ezVec3 ezCamera::GetPosition(ezCameraEye eye) const
4 {
5  return m_vCameraPosition[static_cast<int>(eye)];
6 }
7 
8 EZ_ALWAYS_INLINE ezVec3 ezCamera::GetDirForwards(ezCameraEye eye) const
9 {
10  return m_mViewMatrix[static_cast<int>(eye)].GetRow(2).GetAsVec3();
11 }
12 
13 EZ_ALWAYS_INLINE ezVec3 ezCamera::GetDirUp(ezCameraEye eye) const
14 {
15  return m_mViewMatrix[static_cast<int>(eye)].GetRow(1).GetAsVec3();
16 }
17 
18 EZ_ALWAYS_INLINE ezVec3 ezCamera::GetDirRight(ezCameraEye eye) const
19 {
20  return m_mViewMatrix[static_cast<int>(eye)].GetRow(0).GetAsVec3();
21 }
22 
24 {
25  if (m_Mode == ezCameraMode::Stereo)
26  return (GetPosition(ezCameraEye::Left) + GetPosition(ezCameraEye::Right)) * 0.5f;
27  else
28  return GetPosition();
29 }
30 
32 {
33  if (m_Mode == ezCameraMode::Stereo)
34  return (GetDirForwards(ezCameraEye::Left) + GetDirForwards(ezCameraEye::Right)).GetNormalized();
35  else
36  return GetDirForwards();
37 }
38 
40 {
41  if (m_Mode == ezCameraMode::Stereo)
42  return (GetDirUp(ezCameraEye::Left) + GetDirUp(ezCameraEye::Right)).GetNormalized();
43  else
44  return GetDirUp();
45 }
46 
48 {
49  if (m_Mode == ezCameraMode::Stereo)
50  return (GetDirRight(ezCameraEye::Left) + GetDirRight(ezCameraEye::Right)).GetNormalized();
51  else
52  return GetDirRight();
53 }
54 
55 EZ_ALWAYS_INLINE float ezCamera::GetNearPlane() const
56 {
57  return m_fNearPlane;
58 }
59 
60 EZ_ALWAYS_INLINE float ezCamera::GetFarPlane() const
61 {
62  return m_fFarPlane;
63 }
64 
65 EZ_ALWAYS_INLINE float ezCamera::GetFovOrDim() const
66 {
67  return m_fFovOrDim;
68 }
69 
71 {
72  return m_Mode;
73 }
74 
75 EZ_ALWAYS_INLINE bool ezCamera::IsPerspective() const
76 {
78  m_Mode == ezCameraMode::Stereo; // All HMD stereo cameras are perspective!
79 }
80 
81 EZ_ALWAYS_INLINE bool ezCamera::IsOrthographic() const
82 {
84 }
85 
86 EZ_ALWAYS_INLINE bool ezCamera::IsStereoscopic() const
87 {
88  return m_Mode == ezCameraMode::Stereo;
89 }
90 
91 EZ_ALWAYS_INLINE float ezCamera::GetExposure() const
92 {
93  return m_fExposure;
94 }
95 
96 EZ_ALWAYS_INLINE void ezCamera::SetExposure(float fExposure)
97 {
98  m_fExposure = fExposure;
99 }
100 
101 EZ_ALWAYS_INLINE const ezMat4& ezCamera::GetViewMatrix(ezCameraEye eye) const
102 {
103  return m_mViewMatrix[static_cast<int>(eye)];
104 }
105 
Perspective camera, the fov for X is fixed, Y depends on the aspect ratio.
Definition: Camera.h:15
ezVec3 GetPosition(ezCameraEye eye=ezCameraEye::Left) const
Returns the position of the camera that should be used for rendering etc.
Definition: Camera_inl.h:3
ezVec3 GetDirForwards(ezCameraEye eye=ezCameraEye::Left) const
Returns the forwards vector that should be used for rendering etc.
Definition: Camera_inl.h:8
ezVec3 GetCenterDirUp() const
Returns the average up vector.
Definition: Camera_inl.h:39
ezVec3 GetCenterPosition() const
Returns the average camera position.
Definition: Camera_inl.h:23
const ezVec3Template GetNormalized() const
Returns a normalized version of this vector, leaves the vector itself unchanged.
Definition: Vec3_inl.h:86
ezVec3 GetCenterDirRight() const
Returns the average right vector.
Definition: Camera_inl.h:47
float GetFarPlane() const
Returns the far plane distance that was passed to SetCameraProjectionAndMode().
Definition: Camera_inl.h:60
Orthographic camera, the height is fixed, the width depends on the aspect ratio.
Definition: Camera.h:18
Perspective camera, the fov for Y is fixed, X depends on the aspect ratio.
Definition: Camera.h:16
ezVec3 GetDirUp(ezCameraEye eye=ezCameraEye::Left) const
Returns the up vector that should be used for rendering etc.
Definition: Camera_inl.h:13
ezVec3 GetCenterDirForwards() const
Returns the average forwards vector.
Definition: Camera_inl.h:31
Enum
Definition: Camera.h:12
Orthographic camera, the width is fixed, the height depends on the aspect ratio.
Definition: Camera.h:17
float GetNearPlane() const
Returns the near plane distance that was passed to SetCameraProjectionAndMode().
Definition: Camera_inl.h:55
float GetFovOrDim() const
Returns the fFovOrDim parameter that was passed to SetCameraProjectionAndMode().
Definition: Camera_inl.h:65
const ezMat4 & GetViewMatrix(ezCameraEye eye=ezCameraEye::Left) const
Returns the view matrix for the given eye.
Definition: Camera_inl.h:101
A stereo camera with view/projection matrices provided by an HMD.
Definition: Camera.h:19
ezCameraMode::Enum GetCameraMode() const
Returns the current camera mode.
Definition: Camera_inl.h:70
bool IsStereoscopic() const
Whether this is a stereoscopic camera.
Definition: Camera_inl.h:86
ezVec3 GetDirRight(ezCameraEye eye=ezCameraEye::Left) const
Returns the right vector that should be used for rendering etc.
Definition: Camera_inl.h:18