17#ifndef _FGE_GRAPHIC_C_VIEW_HPP_INCLUDED
18#define _FGE_GRAPHIC_C_VIEW_HPP_INCLUDED
27#include "FastEngine/fge_extern.hpp"
28#include "FastEngine/C_rect.hpp"
29#include "FastEngine/C_vector.hpp"
30#include "FastEngine/vulkan/C_viewport.hpp"
39using ObjectDataWeak = std::weak_ptr<fge::ObjectData>;
53 View(Vector2f
const& center, Vector2f
const& size);
55 void setCenter(Vector2f
const& center);
56 Vector2f
const& getCenter()
const;
67 Vector2f
const& getSize()
const;
69 void setRotation(
float angleDeg);
70 float getRotation()
const;
84 fge::RectFloat
const& getFactorViewport()
const;
100 void move(Vector2f
const& offset);
128 [[nodiscard]] glm::mat4
const& getInverseTransform()
const;
137 [[nodiscard]] glm::mat4
const& getInverseProjection()
const;
140 fge::Vector2f g_center;
141 fge::Vector2f g_size;
143 fge::RectFloat g_factorViewport;
145 mutable glm::mat4 g_transform;
146 mutable glm::mat4 g_projection;
147 mutable glm::mat4 g_inverseTransform;
148 mutable glm::mat4 g_inverseProjection;
149 mutable bool g_transformUpdated;
150 mutable bool g_projectionUpdated;
151 mutable bool g_invTransformUpdated;
152 mutable bool g_invProjectionUpdated;
159 OwnView(OwnView
const& r);
160 OwnView(OwnView&& r)
noexcept =
default;
161 virtual ~OwnView() =
default;
163 OwnView& operator=(OwnView
const& r);
164 OwnView& operator=(OwnView&& r)
noexcept =
default;
166 View& createOwnView();
167 void removeOwnView();
168 [[nodiscard]]
bool hasOwnView()
const;
169 [[nodiscard]] std::shared_ptr<View>
const& getOwnView()
const;
170 void setOwnView(std::shared_ptr<View> view);
172 void ownViewOverrideParent(
bool enable);
173 [[nodiscard]]
bool isOwnViewOverridingParent()
const;
174 void ownViewExplicitlySetDefaultView(
bool enable);
175 [[nodiscard]]
bool isOwnViewUsingExplicitDefaultView()
const;
177 [[nodiscard]]
View const& requestView(
View const& source, fge::ObjectDataWeak
object)
const;
178 [[nodiscard]]
View const& requestView(
View const& source, OwnView
const& parent)
const;
179 [[nodiscard]]
View const& requestView(
View const& source)
const;
181 [[nodiscard]]
View const& requestView(
fge::RenderTarget const& source, fge::ObjectDataWeak
object)
const;
186 std::shared_ptr<View> g_ownView{
nullptr};
187 bool g_overrideParents{
false};
188 bool g_explicitDefaultView{
false};
Data wrapper representing an Object in a Scene.
Definition C_scene.hpp:170
Definition C_renderTarget.hpp:56
Define a camera in a 2D scene.
Definition C_view.hpp:49
void move(Vector2f const &offset)
Helper function to move the view.
glm::mat4 const & getTransform() const
Get the transform of the view.
void rotate(float angle)
Helper function to rotate the view.
glm::mat4 const & getProjection() const
Get the projection matrix of the view.
void zoom(float factor)
Helper function to zoom the view.
void setSize(Vector2f const &size)
Set the size of the view.
void resizeFixCenter(fge::Vector2f const &newSize)
Resize the view and move it relatively to old center in order to expand it.
void reset(fge::vulkan::Viewport const &viewport)
Reset the view to the given viewport.
void setFactorViewport(fge::RectFloat const &factorViewport)
Set the viewport rectangle of the view.
Definition C_viewport.hpp:27