8 #ifndef NDK_COMPONENTS_CAMERACOMPONENT_HPP 9 #define NDK_COMPONENTS_CAMERACOMPONENT_HPP 11 #include <Nazara/Math/Frustum.hpp> 12 #include <Nazara/Math/Matrix4.hpp> 13 #include <Nazara/Math/Vector3.hpp> 14 #include <Nazara/Graphics/AbstractViewer.hpp> 15 #include <Nazara/Renderer/RenderTarget.hpp> 16 #include <Nazara/Utility/Node.hpp> 17 #include <NDK/Component.hpp> 21 class CameraComponent;
32 void ApplyView()
const override;
34 inline void EnsureFrustumUpdate()
const;
35 inline void EnsureProjectionMatrixUpdate()
const;
36 inline void EnsureViewMatrixUpdate()
const;
37 inline void EnsureViewportUpdate()
const;
39 float GetAspectRatio()
const override;
42 inline float GetFOV()
const;
44 inline unsigned int GetLayer()
const;
45 const Nz::Matrix4f& GetProjectionMatrix()
const override;
46 Nz::ProjectionType GetProjectionType()
const override;
48 const Nz::RenderTarget* GetTarget()
const override;
49 inline const Nz::Rectf& GetTargetRegion()
const;
51 const Nz::Recti& GetViewport()
const override;
52 float GetZFar()
const override;
53 float GetZNear()
const override;
55 inline void SetFOV(
float fov);
56 void SetLayer(
unsigned int layer);
57 inline void SetProjectionType(Nz::ProjectionType projection);
59 inline void SetSize(
float width,
float height);
60 inline void SetTarget(
const Nz::RenderTarget* renderTarget);
61 inline void SetTargetRegion(
const Nz::Rectf& region);
62 inline void SetViewport(
const Nz::Recti& viewport);
63 inline void SetZFar(
float zFar);
64 inline void SetZNear(
float zNear);
66 inline bool UpdateVisibility(std::size_t visibilityHash);
68 static ComponentIndex componentIndex;
71 inline void InvalidateFrustum()
const;
72 inline void InvalidateProjectionMatrix()
const;
73 inline void InvalidateViewMatrix()
const;
74 inline void InvalidateViewport()
const;
76 void OnAttached()
override;
79 void OnDetached()
override;
80 void OnNodeInvalidated(
const Nz::Node* node);
81 void OnRenderTargetRelease(
const Nz::RenderTarget* renderTarget);
82 void OnRenderTargetSizeChange(
const Nz::RenderTarget* renderTarget);
84 void UpdateFrustum()
const;
85 void UpdateProjectionMatrix()
const;
86 void UpdateViewMatrix()
const;
87 void UpdateViewport()
const;
89 NazaraSlot(Nz::Node, OnNodeInvalidation, m_nodeInvalidationSlot);
90 NazaraSlot(Nz::RenderTarget, OnRenderTargetRelease, m_targetReleaseSlot);
91 NazaraSlot(Nz::RenderTarget, OnRenderTargetSizeChange, m_targetResizeSlot);
93 std::size_t m_visibilityHash;
94 Nz::ProjectionType m_projectionType;
100 const Nz::RenderTarget* m_target;
102 mutable bool m_frustumUpdated;
103 mutable bool m_projectionMatrixUpdated;
104 mutable bool m_viewMatrixUpdated;
105 mutable bool m_viewportUpdated;
106 mutable float m_aspectRatio;
110 unsigned int m_layer;
114 #include <NDK/Components/CameraComponent.inl> 116 #endif // NDK_COMPONENTS_CAMERACOMPONENT_HPP TODO: For now is unable to display different color in the history, it needs a RichTextDrawer to do so...
Definition: Algorithm.hpp:12
Math class that represents a frustum in the three dimensional vector space.
Definition: Frustum.hpp:24
Graphics class that represents the viewer for our scene.
Definition: AbstractViewer.hpp:21
NDK class that represents the component for camera.
Definition: CameraComponent.hpp:25
NDK class that represents the common base of all components.
Definition: BaseComponent.hpp:17