Graphics: Move scissor box from InstancedRenderable to GraphicsComponent

This commit is contained in:
Jérôme Leclercq
2022-02-21 20:44:54 +01:00
parent 29c798a683
commit cc0fc53bd3
16 changed files with 38 additions and 38 deletions

View File

@@ -33,6 +33,7 @@ namespace Nz
inline void DetachRenderable(const std::shared_ptr<InstancedRenderable>& renderable);
inline const std::vector<Renderable>& GetRenderables() const;
inline const Recti& GetScissorBox() const;
inline const WorldInstancePtr& GetWorldInstance() const;
inline void Hide();
@@ -41,6 +42,8 @@ namespace Nz
inline void Show(bool show = true);
inline void UpdateScissorBox(const Recti& scissorBox);
GraphicsComponent& operator=(const GraphicsComponent&) = default;
GraphicsComponent& operator=(GraphicsComponent&&) = default;
@@ -56,6 +59,7 @@ namespace Nz
private:
std::vector<Renderable> m_renderables;
Recti m_scissorBox;
WorldInstancePtr m_worldInstance;
bool m_isVisible;
};

View File

@@ -8,6 +8,7 @@
namespace Nz
{
inline GraphicsComponent::GraphicsComponent(bool initialyVisible) :
m_scissorBox(-1, -1, -1, -1),
m_isVisible(initialyVisible)
{
m_worldInstance = std::make_shared<WorldInstance>(); //< FIXME: Use pools
@@ -46,6 +47,11 @@ namespace Nz
return m_renderables;
}
inline const Recti& GraphicsComponent::GetScissorBox() const
{
return m_scissorBox;
}
inline const WorldInstancePtr& GraphicsComponent::GetWorldInstance() const
{
return m_worldInstance;
@@ -69,6 +75,15 @@ namespace Nz
m_isVisible = show;
}
}
inline void GraphicsComponent::UpdateScissorBox(const Recti& scissorBox)
{
if (m_scissorBox != scissorBox)
{
OnScissorBoxUpdate(this, scissorBox);
m_scissorBox = scissorBox;
}
}
}
#include <Nazara/Graphics/DebugOff.hpp>