Sdk/RenderSystem: Regenerate renderqueue only when needed

Former-commit-id: 8883c832e1ea34172cf7b21e949f931f188542cf [formerly 3e5d67644e985fd6b5dc0d24bd431e575b9192b7] [formerly 9240e84ee3e77f9b4fa525c5e614ee32c4a59501 [formerly 4f5f4c5d6f366619e888feb8e7fcc8379cf0fabd]]
Former-commit-id: ebc0908d6be73e8509e322450bfe6c2cfcc89ae8 [formerly b621f6434040e1c78841d51e905eda23fdad9b62]
Former-commit-id: 382e99294b674b9740dc9c9b5f5e6dd39b103c52
This commit is contained in:
Lynix
2016-09-15 14:21:06 +02:00
parent 0062a312a7
commit 416441bd3e
7 changed files with 145 additions and 26 deletions

View File

@@ -61,6 +61,8 @@ namespace Ndk
inline void SetZFar(float zFar);
inline void SetZNear(float zNear);
inline bool UpdateVisibility(std::size_t visibilityHash);
static ComponentIndex componentIndex;
private:
@@ -86,6 +88,7 @@ namespace Ndk
NazaraSlot(Nz::RenderTarget, OnRenderTargetRelease, m_targetReleaseSlot);
NazaraSlot(Nz::RenderTarget, OnRenderTargetSizeChange, m_targetResizeSlot);
std::size_t m_visibilityHash;
Nz::ProjectionType m_projectionType;
mutable Nz::Frustumf m_frustum;
mutable Nz::Matrix4f m_projectionMatrix;

View File

@@ -13,6 +13,7 @@ namespace Ndk
*/
inline CameraComponent::CameraComponent() :
m_visibilityHash(0U),
m_projectionType(Nz::ProjectionType_Perspective),
m_targetRegion(0.f, 0.f, 1.f, 1.f),
m_target(nullptr),
@@ -38,6 +39,7 @@ namespace Ndk
inline CameraComponent::CameraComponent(const CameraComponent& camera) :
Component(camera),
AbstractViewer(camera),
m_visibilityHash(camera.m_visibilityHash),
m_projectionType(camera.m_projectionType),
m_targetRegion(camera.m_targetRegion),
m_target(nullptr),
@@ -371,6 +373,26 @@ namespace Ndk
InvalidateProjectionMatrix();
}
/*!
* \brief Update the camera component visibility hash
*
* This is used with CullingList (which produce a visibility hash)
*
* \param visibilityHash New visibility hash
*
* \return True if the visibility hash is not the same as before
*/
inline bool CameraComponent::UpdateVisibility(std::size_t visibilityHash)
{
if (m_visibilityHash != visibilityHash)
{
m_visibilityHash = visibilityHash;
return true;
}
return false;
}
/*!
* \brief Invalidates the frustum
*/