You.i Engine
YiPerspectiveCameraSceneNode.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_PERSPECTIVE_CAMERA_SCENE_NODE_H_
3 #define _YI_PERSPECTIVE_CAMERA_SCENE_NODE_H_
4 
6 
40 {
41 public:
48  static const float DEFAULT_FRUSTUM_DISTANCE;
49 
52 
60  static std::unique_ptr<CYIPerspectiveCameraSceneNode> BuildDefaultCamera(const CYIString &name, float fRegionOfInterestDistance, float fRegionOfInterestWidth, float fRegionOfInterestHeight);
61 
65  static void ConfigurePerspective(CYIPerspectiveCameraSceneNode *pCamera, float fRegionOfInterestDistance, float fRegionOfInterestWidth, float fRegionOfInterestHeight);
66 
75  void SetNearPlane(float fNearZ);
76 
85  float GetNearPlane() const;
86 
95  void SetFarPlane(float fFarZ);
96 
105  float GetFarPlane() const;
106 
111  void SetAspectRatio(float fAspectRatio);
112 
117  float GetAspectRatio() const;
118 
122  void SetFOV(float fFovYDegrees);
123 
127  float GetFOV() const;
128 
139  bool IsInViewVolume(CYISceneNode *pCandidate) const;
140 
141 protected:
142  virtual void TransformUpdated() override;
143 
144  virtual glm::mat4 CalculateProjectionMatrix() const override;
145 
146  virtual CYIString GetDumpTreeString() const override;
147 
148 private:
149 
150  //Positions relating to the camera's frustum all in world space
151  glm::vec3 m_nearPlaneNormal;
152  glm::vec3 m_farPlaneNormal;
153  glm::vec3 m_topPlaneNormal;
154  glm::vec3 m_bottomPlaneNormal;
155  glm::vec3 m_rightPlaneNormal;
156  glm::vec3 m_leftPlaneNormal;
157  glm::vec3 m_worldPosition;
158  glm::vec3 m_farPlaneCenter;
159  glm::vec3 m_nearPlaneCenter;
160 
161  float m_fNearPlane;
162  float m_fFarPlane;
163  float m_fAspectRatio;
164  float m_fFovY; // in degrees
165 
166  CYIAABB m_frustumBoundingBox;
167 
169 };
170 
175 #endif // _YI_PERSPECTIVE_CAMERA_SCENE_NODE_H_
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:35
void SetNearPlane(float fNearZ)
void SetFOV(float fFovYDegrees)
Provides a base for the definition of camera objects.
Definition: YiAbstractCameraSceneNode.h:30
#define YI_TYPE_BASES(...)
Definition: YiRtti.h:350
static std::unique_ptr< CYIPerspectiveCameraSceneNode > BuildDefaultCamera(const CYIString &name, float fRegionOfInterestDistance, float fRegionOfInterestWidth, float fRegionOfInterestHeight)
virtual CYIString GetDumpTreeString() const override
virtual void TransformUpdated() override
static const float DEFAULT_FRUSTUM_DISTANCE
Definition: YiPerspectiveCameraSceneNode.h:48
void SetFarPlane(float fFarZ)
bool IsInViewVolume(CYISceneNode *pCandidate) const
void SetAspectRatio(float fAspectRatio)
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:114
virtual glm::mat4 CalculateProjectionMatrix() const override
This class represents an Axis-Aligned Bounding Box.
Definition: YiAABB.h:24
static void ConfigurePerspective(CYIPerspectiveCameraSceneNode *pCamera, float fRegionOfInterestDistance, float fRegionOfInterestWidth, float fRegionOfInterestHeight)
Definition: YiPerspectiveCameraSceneNode.h:39