Remove Graphics module and fix compilation
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_SYSTEMS_DEBUGSYSTEM_HPP
|
||||
#define NDK_SYSTEMS_DEBUGSYSTEM_HPP
|
||||
|
||||
#include <Nazara/Graphics/InstancedRenderable.hpp>
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
#include <NazaraSDK/System.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API DebugSystem : public System<DebugSystem>
|
||||
{
|
||||
public:
|
||||
DebugSystem();
|
||||
~DebugSystem() = default;
|
||||
|
||||
void EnableDepthBuffer(bool enable);
|
||||
|
||||
inline bool IsDepthBufferEnabled() const;
|
||||
|
||||
static SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
Nz::InstancedRenderableRef GenerateBox(Nz::Boxf box);
|
||||
Nz::InstancedRenderableRef GenerateCollision2DMesh(Entity* entity, Nz::Vector3f* offset);
|
||||
Nz::InstancedRenderableRef GenerateCollision3DMesh(Entity* entity);
|
||||
|
||||
std::pair<Nz::IndexBufferRef, Nz::VertexBufferRef> GetBoxMesh();
|
||||
Nz::MaterialRef GetCollisionMaterial();
|
||||
Nz::MaterialRef GetGlobalAABBMaterial();
|
||||
Nz::MaterialRef GetLocalAABBMaterial();
|
||||
Nz::MaterialRef GetOBBMaterial();
|
||||
|
||||
void OnEntityValidation(Entity* entity, bool justAdded) override;
|
||||
void OnUpdate(float elapsedTime) override;
|
||||
|
||||
Nz::MaterialRef m_globalAabbMaterial;
|
||||
Nz::MaterialRef m_localAabbMaterial;
|
||||
Nz::MaterialRef m_collisionMaterial;
|
||||
Nz::MaterialRef m_obbMaterial;
|
||||
Nz::IndexBufferRef m_boxMeshIndexBuffer;
|
||||
Nz::VertexBufferRef m_boxMeshVertexBuffer;
|
||||
bool m_isDepthBufferEnabled;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NazaraSDK/Systems/DebugSystem.inl>
|
||||
|
||||
#endif // NDK_SYSTEMS_DEBUGSYSTEM_HPP
|
||||
#endif // NDK_SERVER
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||
|
||||
#include <NazaraSDK/Systems/DebugSystem.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline bool DebugSystem::IsDepthBufferEnabled() const
|
||||
{
|
||||
return m_isDepthBufferEnabled;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_SYSTEMS_PARTICLESYSTEM_HPP
|
||||
#define NDK_SYSTEMS_PARTICLESYSTEM_HPP
|
||||
|
||||
#include <NazaraSDK/System.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API ParticleSystem : public System<ParticleSystem>
|
||||
{
|
||||
public:
|
||||
ParticleSystem();
|
||||
~ParticleSystem() = default;
|
||||
|
||||
static SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
void OnUpdate(float elapsedTime) override;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NazaraSDK/Systems/ParticleSystem.inl>
|
||||
|
||||
#endif // NDK_SYSTEMS_PARTICLESYSTEM_HPP
|
||||
#endif // NDK_SERVER
|
||||
@@ -1,3 +0,0 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||
@@ -1,85 +0,0 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||
#define NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||
|
||||
#include <Nazara/Graphics/AbstractBackground.hpp>
|
||||
#include <Nazara/Graphics/CullingList.hpp>
|
||||
#include <Nazara/Graphics/DepthRenderTechnique.hpp>
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <NazaraSDK/EntityList.hpp>
|
||||
#include <NazaraSDK/System.hpp>
|
||||
#include <NazaraSDK/Components/GraphicsComponent.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class AbstractViewer;
|
||||
|
||||
class NDK_API RenderSystem : public System<RenderSystem>
|
||||
{
|
||||
public:
|
||||
RenderSystem();
|
||||
~RenderSystem() = default;
|
||||
|
||||
template<typename T> T& ChangeRenderTechnique();
|
||||
inline Nz::AbstractRenderTechnique& ChangeRenderTechnique(std::unique_ptr<Nz::AbstractRenderTechnique>&& renderTechnique);
|
||||
|
||||
inline void EnableCulling(bool enable);
|
||||
|
||||
inline const Nz::BackgroundRef& GetDefaultBackground() const;
|
||||
inline const Nz::Matrix4f& GetCoordinateSystemMatrix() const;
|
||||
inline Nz::Vector3f GetGlobalForward() const;
|
||||
inline Nz::Vector3f GetGlobalRight() const;
|
||||
inline Nz::Vector3f GetGlobalUp() const;
|
||||
inline Nz::AbstractRenderTechnique& GetRenderTechnique() const;
|
||||
|
||||
inline bool IsCullingEnabled() const;
|
||||
|
||||
inline void SetDefaultBackground(Nz::BackgroundRef background);
|
||||
inline void SetGlobalForward(const Nz::Vector3f& direction);
|
||||
inline void SetGlobalRight(const Nz::Vector3f& direction);
|
||||
inline void SetGlobalUp(const Nz::Vector3f& direction);
|
||||
|
||||
static SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
inline void InvalidateCoordinateSystem();
|
||||
|
||||
void OnEntityRemoved(Entity* entity) override;
|
||||
void OnEntityValidation(Entity* entity, bool justAdded) override;
|
||||
void OnUpdate(float elapsedTime) override;
|
||||
|
||||
void UpdateDynamicReflections();
|
||||
void UpdateDirectionalShadowMaps(const Nz::AbstractViewer& viewer);
|
||||
void UpdatePointSpotShadowMaps();
|
||||
|
||||
std::unique_ptr<Nz::AbstractRenderTechnique> m_renderTechnique;
|
||||
std::vector<GraphicsComponentCullingList::VolumeEntry> m_volumeEntries;
|
||||
std::vector<EntityHandle> m_cameras;
|
||||
EntityList m_drawables;
|
||||
EntityList m_directionalLights;
|
||||
EntityList m_lights;
|
||||
EntityList m_pointSpotLights;
|
||||
EntityList m_particleGroups;
|
||||
EntityList m_realtimeReflected;
|
||||
GraphicsComponentCullingList m_drawableCulling;
|
||||
Nz::BackgroundRef m_background;
|
||||
Nz::DepthRenderTechnique m_shadowTechnique;
|
||||
Nz::Matrix4f m_coordinateSystemMatrix;
|
||||
Nz::RenderTexture m_shadowRT;
|
||||
bool m_coordinateSystemInvalidated;
|
||||
bool m_forceRenderQueueInvalidation;
|
||||
bool m_isCullingEnabled;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NazaraSDK/Systems/RenderSystem.inl>
|
||||
|
||||
#endif // NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||
#endif // NDK_SERVER
|
||||
@@ -1,186 +0,0 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||
|
||||
#include <NazaraSDK/Systems/RenderSystem.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Changes the render technique used for the system
|
||||
* \return A reference to the render technique type
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
inline T& RenderSystem::ChangeRenderTechnique()
|
||||
{
|
||||
static_assert(std::is_base_of<Nz::AbstractRenderTechnique, T>::value, "RenderTechnique is not a subtype of AbstractRenderTechnique");
|
||||
return static_cast<T&>(ChangeRenderTechnique(std::make_unique<T>()));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Changes the render technique used for the system
|
||||
* \return A reference to the abstract render technique
|
||||
*
|
||||
* \param renderTechnique Render technique to use
|
||||
*/
|
||||
|
||||
inline Nz::AbstractRenderTechnique& RenderSystem::ChangeRenderTechnique(std::unique_ptr<Nz::AbstractRenderTechnique>&& renderTechnique)
|
||||
{
|
||||
m_renderTechnique = std::move(renderTechnique);
|
||||
return *m_renderTechnique;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Enables/disables object culling
|
||||
*
|
||||
* Object culling is an algorithm used by the render system to detect invisible objects (which will not appear on screen) before they are rendered.
|
||||
* This includes Frustum Culling and potentially Occlusion Culling.
|
||||
*
|
||||
* Disabling this is not recommended, as the system will draw every object in the world which could induce a performance loss.
|
||||
*
|
||||
* \param enable Whether to enable or disable culling
|
||||
*
|
||||
* \see IsCullingEnabled
|
||||
*/
|
||||
inline void RenderSystem::EnableCulling(bool enable)
|
||||
{
|
||||
m_isCullingEnabled = enable;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the background used for rendering
|
||||
* \return A reference to the background
|
||||
*/
|
||||
|
||||
inline const Nz::BackgroundRef& RenderSystem::GetDefaultBackground() const
|
||||
{
|
||||
return m_background;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the coordinates matrix used for rendering
|
||||
* \return A constant reference to the matrix of coordinates
|
||||
*/
|
||||
|
||||
inline const Nz::Matrix4f& RenderSystem::GetCoordinateSystemMatrix() const
|
||||
{
|
||||
return m_coordinateSystemMatrix;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the "forward" global direction
|
||||
* \return The forward direction, by default, it's -UnitZ() (Right hand coordinates)
|
||||
*/
|
||||
|
||||
inline Nz::Vector3f RenderSystem::GetGlobalForward() const
|
||||
{
|
||||
return Nz::Vector3f(-m_coordinateSystemMatrix.m13, -m_coordinateSystemMatrix.m23, -m_coordinateSystemMatrix.m33);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the "right" global direction
|
||||
* \return The right direction, by default, it's UnitX() (Right hand coordinates)
|
||||
*/
|
||||
|
||||
inline Nz::Vector3f RenderSystem::GetGlobalRight() const
|
||||
{
|
||||
return Nz::Vector3f(m_coordinateSystemMatrix.m11, m_coordinateSystemMatrix.m21, m_coordinateSystemMatrix.m31);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the "up" global direction
|
||||
* \return The up direction, by default, it's UnitY() (Right hand coordinates)
|
||||
*/
|
||||
|
||||
inline Nz::Vector3f RenderSystem::GetGlobalUp() const
|
||||
{
|
||||
return Nz::Vector3f(m_coordinateSystemMatrix.m12, m_coordinateSystemMatrix.m22, m_coordinateSystemMatrix.m32);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the render technique used for rendering
|
||||
* \return A reference to the abstract render technique being used
|
||||
*/
|
||||
|
||||
inline Nz::AbstractRenderTechnique& RenderSystem::GetRenderTechnique() const
|
||||
{
|
||||
return *m_renderTechnique.get();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Query if culling is enabled (enabled by default)
|
||||
* \return True if culling is enabled, false otherwise
|
||||
*
|
||||
* \see EnableCulling
|
||||
*/
|
||||
inline bool RenderSystem::IsCullingEnabled() const
|
||||
{
|
||||
return m_isCullingEnabled;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the background used for rendering
|
||||
*
|
||||
* \param background A reference to the background
|
||||
*/
|
||||
|
||||
inline void RenderSystem::SetDefaultBackground(Nz::BackgroundRef background)
|
||||
{
|
||||
m_background = std::move(background);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the "forward" global direction
|
||||
*
|
||||
* \param direction The new forward direction
|
||||
*/
|
||||
|
||||
inline void RenderSystem::SetGlobalForward(const Nz::Vector3f& direction)
|
||||
{
|
||||
m_coordinateSystemMatrix.m13 = -direction.x;
|
||||
m_coordinateSystemMatrix.m23 = -direction.y;
|
||||
m_coordinateSystemMatrix.m33 = -direction.z;
|
||||
|
||||
InvalidateCoordinateSystem();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the "right" global direction
|
||||
*
|
||||
* \param direction The new right direction
|
||||
*/
|
||||
|
||||
inline void RenderSystem::SetGlobalRight(const Nz::Vector3f& direction)
|
||||
{
|
||||
m_coordinateSystemMatrix.m11 = direction.x;
|
||||
m_coordinateSystemMatrix.m21 = direction.y;
|
||||
m_coordinateSystemMatrix.m31 = direction.z;
|
||||
|
||||
InvalidateCoordinateSystem();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the "up" global direction
|
||||
*
|
||||
* \param direction The new up direction
|
||||
*/
|
||||
|
||||
inline void RenderSystem::SetGlobalUp(const Nz::Vector3f& direction)
|
||||
{
|
||||
m_coordinateSystemMatrix.m12 = direction.x;
|
||||
m_coordinateSystemMatrix.m22 = direction.y;
|
||||
m_coordinateSystemMatrix.m32 = direction.z;
|
||||
|
||||
InvalidateCoordinateSystem();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the matrix of coordinates for the system
|
||||
*/
|
||||
|
||||
inline void RenderSystem::InvalidateCoordinateSystem()
|
||||
{
|
||||
m_coordinateSystemInvalidated = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user