Merge branch 'NDK' into NDK-ShadowMapping

Conflicts:
	SDK/include/NDK/Systems/RenderSystem.hpp
	SDK/src/NDK/Systems/RenderSystem.cpp

Former-commit-id: 2772ff703c9d68d536667c469aca85084be4b861
This commit is contained in:
Lynix 2015-09-19 14:47:02 +02:00
commit 025d873228
72 changed files with 349 additions and 136 deletions

View File

@ -40,6 +40,7 @@ namespace Ndk
inline const NzFrustumf& GetFrustum() const;
inline unsigned int GetLayer() const;
inline const NzMatrix4f& GetProjectionMatrix() const;
inline nzProjectionType GetProjectionType() const;
inline const NzRenderTarget* GetTarget() const;
inline const NzRectf& GetTargetRegion() const;
inline const NzMatrix4f& GetViewMatrix() const;
@ -49,6 +50,7 @@ namespace Ndk
inline void SetFOV(float fov);
inline void SetLayer(unsigned int layer);
inline void SetProjectionType(nzProjectionType projection);
inline void SetTarget(const NzRenderTarget* renderTarget);
inline void SetTargetRegion(const NzRectf& region);
inline void SetViewport(const NzRecti& viewport);
@ -80,6 +82,7 @@ namespace Ndk
NazaraSlot(NzRenderTarget, OnRenderTargetRelease, m_targetReleaseSlot);
NazaraSlot(NzRenderTarget, OnRenderTargetSizeChange, m_targetResizeSlot);
nzProjectionType m_projectionType;
mutable NzFrustumf m_frustum;
mutable NzMatrix4f m_projectionMatrix;
mutable NzMatrix4f m_viewMatrix;

View File

@ -8,6 +8,7 @@
namespace Ndk
{
inline CameraComponent::CameraComponent() :
m_projectionType(nzProjectionType_Perspective),
m_targetRegion(0.f, 0.f, 1.f, 1.f),
m_target(nullptr),
m_frustumUpdated(false),
@ -25,8 +26,9 @@ namespace Ndk
inline CameraComponent::CameraComponent(const CameraComponent& camera) :
Component(camera),
NzAbstractViewer(camera),
m_projectionType(camera.m_projectionType),
m_targetRegion(camera.m_targetRegion),
m_target(camera.m_target),
m_target(nullptr),
m_frustumUpdated(false),
m_projectionMatrixUpdated(false),
m_viewMatrixUpdated(false),
@ -37,7 +39,7 @@ namespace Ndk
m_zNear(camera.m_zNear),
m_layer(camera.m_layer)
{
SetTarget(camera.m_target);
}
inline void CameraComponent::EnsureFrustumUpdate() const
@ -95,6 +97,11 @@ namespace Ndk
return m_projectionMatrix;
}
inline nzProjectionType CameraComponent::GetProjectionType() const
{
return m_projectionType;
}
inline const NzRenderTarget* CameraComponent::GetTarget() const
{
return m_target;
@ -132,8 +139,15 @@ namespace Ndk
inline void CameraComponent::SetFOV(float fov)
{
NazaraAssert(!NzNumberEquals(fov, 0.f), "FOV must be different from zero");
m_fov = fov;
InvalidateProjectionMatrix();
}
inline void CameraComponent::SetProjectionType(nzProjectionType projectionType)
{
m_projectionType = projectionType;
InvalidateProjectionMatrix();
}
@ -149,6 +163,7 @@ namespace Ndk
inline void CameraComponent::SetTargetRegion(const NzRectf& region)
{
m_targetRegion = region;
InvalidateViewport();
}
@ -166,14 +181,15 @@ namespace Ndk
inline void CameraComponent::SetZFar(float zFar)
{
m_zFar = zFar;
InvalidateProjectionMatrix();
}
inline void CameraComponent::SetZNear(float zNear)
{
NazaraAssert(!NzNumberEquals(zNear, 0.f), "zNear cannot be zero");
m_zNear = zNear;
InvalidateProjectionMatrix();
}

View File

@ -15,6 +15,8 @@ namespace Ndk
{
class NDK_API GraphicsComponent : public Component<GraphicsComponent>
{
friend class RenderSystem;
public:
GraphicsComponent() = default;
inline GraphicsComponent(const GraphicsComponent& graphicsComponent);
@ -30,6 +32,7 @@ namespace Ndk
private:
void InvalidateRenderableData(const NzInstancedRenderable* renderable, nzUInt32 flags, unsigned int index);
inline void InvalidateRenderables();
inline void InvalidateTransformMatrix();
void OnAttached() override;

View File

@ -46,11 +46,16 @@ namespace Ndk
UpdateTransformMatrix();
}
inline void GraphicsComponent::InvalidateTransformMatrix()
inline void GraphicsComponent::InvalidateRenderables()
{
for (Renderable& r : m_renderables)
r.dataUpdated = false;
}
inline void GraphicsComponent::InvalidateTransformMatrix()
{
m_transformMatrixUpdated = false;
InvalidateRenderables();
}
}

View File

@ -33,6 +33,8 @@ namespace Ndk
EntityHandle& Swap(EntityHandle& handle);
NzString ToString() const;
operator bool() const;
operator Entity*() const;
Entity* operator->() const;

View File

@ -2,6 +2,7 @@
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <Nazara/Core/StringStream.hpp>
#include <functional>
#include <limits>
@ -89,6 +90,20 @@ namespace Ndk
return *this;
}
inline NzString EntityHandle::ToString() const
{
NzStringStream ss;
ss << "EntityHandle(";
if (IsValid())
ss << "Entity(" << m_entity->GetId() << ')';
else
ss << "Null entity";
ss << ')';
return ss;
}
inline EntityHandle::operator bool() const
{
return IsValid();
@ -143,7 +158,7 @@ namespace Ndk
{
out << "EntityHandle(";
if (handle.IsValid())
out << "Entity(" << handle->GetId() << ")";
out << "Entity(" << handle->GetId() << ')';
else
out << "Null entity";

View File

@ -28,12 +28,21 @@ namespace Ndk
~RenderSystem() = default;
inline const NzBackgroundRef& GetDefaultBackground() const;
inline const NzMatrix4f& GetCoordinateSystemMatrix() const;
inline NzVector3f GetGlobalForward() const;
inline NzVector3f GetGlobalRight() const;
inline NzVector3f GetGlobalUp() const;
inline void SetDefaultBackground(NzBackgroundRef background);
inline void SetGlobalForward(const NzVector3f& direction);
inline void SetGlobalRight(const NzVector3f& direction);
inline void SetGlobalUp(const NzVector3f& 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;
@ -48,7 +57,9 @@ namespace Ndk
NzBackgroundRef m_background;
NzDepthRenderTechnique m_shadowTechnique;
NzForwardRenderTechnique m_renderTechnique;
NzMatrix4f m_coordinateSystemMatrix;
NzRenderTexture m_shadowRT;
bool m_coordinateSystemInvalidated;
};
}

View File

@ -14,8 +14,60 @@ namespace Ndk
return m_background;
}
inline const NzMatrix4f& RenderSystem::GetCoordinateSystemMatrix() const
{
return m_coordinateSystemMatrix;
}
inline NzVector3f RenderSystem::GetGlobalForward() const
{
return NzVector3f(-m_coordinateSystemMatrix.m13, -m_coordinateSystemMatrix.m23, -m_coordinateSystemMatrix.m33);
}
inline NzVector3f RenderSystem::GetGlobalRight() const
{
return NzVector3f(m_coordinateSystemMatrix.m11, m_coordinateSystemMatrix.m21, m_coordinateSystemMatrix.m31);
}
inline NzVector3f RenderSystem::GetGlobalUp() const
{
return NzVector3f(m_coordinateSystemMatrix.m12, m_coordinateSystemMatrix.m22, m_coordinateSystemMatrix.m32);
}
inline void RenderSystem::SetDefaultBackground(NzBackgroundRef background)
{
m_background = std::move(background);
}
inline void RenderSystem::SetGlobalForward(const NzVector3f& direction)
{
m_coordinateSystemMatrix.m13 = -direction.x;
m_coordinateSystemMatrix.m23 = -direction.y;
m_coordinateSystemMatrix.m33 = -direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::SetGlobalRight(const NzVector3f& direction)
{
m_coordinateSystemMatrix.m11 = direction.x;
m_coordinateSystemMatrix.m21 = direction.y;
m_coordinateSystemMatrix.m31 = direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::SetGlobalUp(const NzVector3f& direction)
{
m_coordinateSystemMatrix.m12 = direction.x;
m_coordinateSystemMatrix.m22 = direction.y;
m_coordinateSystemMatrix.m32 = direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::InvalidateCoordinateSystem()
{
m_coordinateSystemInvalidated = true;
}
}

View File

@ -116,9 +116,21 @@ namespace Ndk
void CameraComponent::UpdateProjectionMatrix() const
{
EnsureViewportUpdate(); // Can affect aspect ratio
switch (m_projectionType)
{
case nzProjectionType_Orthogonal:
EnsureViewportUpdate();
m_projectionMatrix.MakeOrtho(0.f, static_cast<float>(m_viewport.width), 0.f, static_cast<float>(m_viewport.height), m_zNear, m_zFar);
break;
case nzProjectionType_Perspective:
EnsureViewportUpdate(); // Can affect aspect ratio
m_projectionMatrix.MakePerspective(m_fov, m_aspectRatio, m_zNear, m_zFar);
break;
}
m_projectionMatrix.MakePerspective(m_fov, m_aspectRatio, m_zNear, m_zFar);
m_projectionMatrixUpdated = true;
}
@ -153,7 +165,8 @@ namespace Ndk
{
m_aspectRatio = aspectRatio;
InvalidateProjectionMatrix();
if (m_projectionType == nzProjectionType_Perspective)
InvalidateProjectionMatrix();
}
// Convert it back to int

View File

@ -3,15 +3,16 @@
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/Components/GraphicsComponent.hpp>
#include <NDK/World.hpp>
#include <NDK/Systems/RenderSystem.hpp>
#include <NDK/Components/NodeComponent.hpp>
namespace Ndk
{
void GraphicsComponent::InvalidateRenderableData(const NzInstancedRenderable* renderable, nzUInt32 flags, unsigned int index)
{
NazaraUnused(renderable);
NazaraAssert(index < m_renderables.size(), "Invalid renderable index");
NazaraUnused(renderable);
Renderable& r = m_renderables[index];
r.dataUpdated = false;
@ -66,7 +67,9 @@ namespace Ndk
{
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "GraphicsComponent requires NodeComponent");
m_transformMatrix = m_entity->GetComponent<NodeComponent>().GetTransformMatrix();
Ndk::RenderSystem& renderSystem = m_entity->GetWorld()->GetSystem<Ndk::RenderSystem>();
m_transformMatrix = renderSystem.GetCoordinateSystemMatrix() * m_entity->GetComponent<NodeComponent>().GetTransformMatrix();
m_transformMatrixUpdated = true;
}

View File

@ -12,7 +12,9 @@
namespace Ndk
{
RenderSystem::RenderSystem()
RenderSystem::RenderSystem() :
m_coordinateSystemMatrix(NzMatrix4f::Identity()),
m_coordinateSystemInvalidated(true)
{
SetDefaultBackground(NzColorBackground::New());
SetUpdateRate(0.f);
@ -73,6 +75,18 @@ namespace Ndk
{
NazaraUnused(elapsedTime);
// Invalidate every renderable if the coordinate system changed
if (m_coordinateSystemInvalidated)
{
for (const Ndk::EntityHandle& drawable : m_drawables)
{
GraphicsComponent& graphicsComponent = drawable->GetComponent<GraphicsComponent>();
graphicsComponent.InvalidateTransformMatrix();
}
m_coordinateSystemInvalidated = false;
}
UpdatePointSpotShadowMaps();
for (const Ndk::EntityHandle& camera : m_cameras)
@ -84,6 +98,7 @@ namespace Ndk
NzAbstractRenderQueue* renderQueue = m_renderTechnique.GetRenderQueue();
renderQueue->Clear();
//TODO: Culling
for (const Ndk::EntityHandle& drawable : m_drawables)
{
GraphicsComponent& graphicsComponent = drawable->GetComponent<GraphicsComponent>();
@ -97,7 +112,8 @@ namespace Ndk
LightComponent& lightComponent = light->GetComponent<LightComponent>();
NodeComponent& lightNode = light->GetComponent<NodeComponent>();
lightComponent.AddToRenderQueue(renderQueue, lightNode.GetTransformMatrix());
///TODO: Cache somehow?
lightComponent.AddToRenderQueue(renderQueue, m_coordinateSystemMatrix * drawableNode.GetTransformMatrix());
}
camComponent.ApplyView();

View File

@ -134,7 +134,8 @@ function NazaraBuild:Execute()
buildoptions("-fvisibility=hidden")
configuration("vs*")
buildoptions("/MP")
buildoptions("/MP") -- Multiprocessus build
flags("NoMinimalRebuild")
defines("_CRT_SECURE_NO_WARNINGS")
defines("_SCL_SECURE_NO_WARNINGS")
@ -246,7 +247,7 @@ function NazaraBuild:Execute()
kind("ConsoleApp")
elseif (toolTable.Kind == "windowapp") then
debugdir(toolTable.Directory)
kind("Window")
kind("WindowedApp")
else
assert(false, "wut")
end
@ -269,47 +270,61 @@ function NazaraBuild:Execute()
configuration({"codeblocks or codelite or gmake", "x32"})
libdirs("../extlibs/lib/mingw/x86")
libdirs("../lib/mingw/x86")
targetdir("../lib/mingw/x86")
if (toolTable.Kind == "library") then
targetdir("../lib/mingw/x86")
end
configuration({"codeblocks or codelite or gmake", "x64"})
libdirs("../extlibs/lib/mingw/x64")
libdirs("../lib/mingw/x64")
targetdir("../lib/mingw/x64")
if (toolTable.Kind == "library") then
targetdir("../lib/mingw/x64")
end
configuration({"vs*", "x32"})
libdirs("../extlibs/lib/msvc/x86")
libdirs("../lib/msvc/x86")
targetdir("../lib/msvc/x86")
if (toolTable.Kind == "library") then
targetdir("../lib/msvc/x86")
end
configuration({"vs*", "x64"})
libdirs("../extlibs/lib/msvc/x64")
libdirs("../lib/msvc/x64")
targetdir("../lib/msvc/x64")
if (toolTable.Kind == "library") then
targetdir("../lib/msvc/x64")
end
configuration({"xcode3 or xcode4", "x32"})
libdirs("../extlibs/lib/xcode/x86")
libdirs("../lib/xcode/x86")
targetdir("../lib/xcode/x86")
if (toolTable.Kind == "library") then
targetdir("../lib/xcode/x86")
end
configuration({"xcode3 or xcode4", "x64"})
libdirs("../extlibs/lib/xcode/x64")
libdirs("../lib/xcode/x64")
targetdir("../lib/xcode/x64")
if (toolTable.Kind == "library") then
targetdir("../lib/xcode/x64")
end
configuration("*Static")
kind("StaticLib")
if (toolTable.Kind == "library") then
configuration("*Static")
kind("StaticLib")
configuration("*Dynamic")
kind("SharedLib")
configuration("*Dynamic")
kind("SharedLib")
configuration("DebugStatic")
targetsuffix("-s-d")
configuration("DebugStatic")
targetsuffix("-s-d")
configuration("ReleaseStatic")
targetsuffix("-s")
configuration("ReleaseStatic")
targetsuffix("-s")
configuration("DebugDynamic")
targetsuffix("-d")
configuration("DebugDynamic")
targetsuffix("-d")
end
configuration({})

View File

@ -0,0 +1,27 @@
TOOL.Name = "UnitTests"
TOOL.Directory = "../tests"
TOOL.Kind = "ConsoleApp"
TOOL.Defines = {
}
TOOL.Includes = {
"../include"
}
TOOL.Files = {
"../tests/main.cpp",
"../tests/Engine/**.cpp"
}
TOOL.Libraries = {
"NazaraCore",
"NazaraAudio",
"NazaraLua",
"NazaraNoise",
"NazaraPhysics",
"NazaraUtility",
"NazaraRenderer",
"NazaraGraphics"
}

View File

@ -70,8 +70,8 @@ class NAZARA_AUDIO_API NzSoundBuffer : public NzRefCounted, public NzResource, N
template<typename... Args> static NzSoundBufferRef New(Args&&... args);
// Signals:
NazaraSignal(OnSoundBufferDestroy, const NzSoundBuffer*); //< Args: me
NazaraSignal(OnSoundBufferRelease, const NzSoundBuffer*); //< Args: me
NazaraSignal(OnSoundBufferDestroy, const NzSoundBuffer* /*soundBuffer*/);
NazaraSignal(OnSoundBufferRelease, const NzSoundBuffer* /*soundBuffer*/);
private:
unsigned int GetOpenALBuffer() const;

View File

@ -245,7 +245,7 @@ template<typename Block, class Allocator>
void NzBitset<Block, Allocator>::Resize(unsigned int bitCount, bool defaultVal)
{
// On commence par changer la taille du conteneur, avec la valeur correcte d'initialisation
unsigned int lastBlockIndex = m_blocks.size()-1;
unsigned int lastBlockIndex = m_blocks.size() - 1;
m_blocks.resize(ComputeBlockCount(bitCount), (defaultVal) ? fullBitMask : 0U);
unsigned int remainingBits = GetBitIndex(m_bitCount);
@ -304,7 +304,7 @@ template<typename Block, class Allocator>
void NzBitset<Block, Allocator>::Swap(NzBitset& bitset)
{
std::swap(m_bitCount, bitset.m_bitCount);
std::swap(m_blocks, bitset.m_blocks);
std::swap(m_blocks, bitset.m_blocks);
}
template<typename Block, class Allocator>
@ -358,7 +358,7 @@ T NzBitset<Block, Allocator>::To() const
{
static_assert(std::is_integral<T>() && std::is_unsigned<T>(), "T must be a unsigned integral type");
NazaraAssert(m_bitCount <= std::numeric_limits<T>::digits, "Bit count cannot be greater than UInt32 bit count");
NazaraAssert(m_bitCount <= std::numeric_limits<T>::digits, "Bit count cannot be greater than T bit count");
T value = 0;
for (unsigned int i = 0; i < m_blocks.size(); ++i)

View File

@ -65,6 +65,16 @@ inline NzByteArray::iterator NzByteArray::Erase(const_iterator first, const_iter
return m_array.erase(first, last);
}
inline NzByteArray::reference NzByteArray::Front()
{
return m_array.front();
}
inline NzByteArray::const_reference NzByteArray::Front() const
{
return m_array.front();
}
inline NzByteArray::allocator_type NzByteArray::GetAllocator() const
{
return m_array.get_allocator();

View File

@ -307,7 +307,7 @@ class NAZARA_CORE_API NzString : public NzHashable
bool FillHash(NzAbstractHash* hash) const;
inline void ReleaseString();
static std::shared_ptr<SharedString> GetEmptyString();
static const std::shared_ptr<SharedString>& GetEmptyString();
std::shared_ptr<SharedString> m_sharedString;

View File

@ -17,6 +17,14 @@ enum nzBackgroundType
nzBackgroundType_Max = nzBackgroundType_User
};
enum nzProjectionType
{
nzProjectionType_Orthogonal,
nzProjectionType_Perspective,
nzProjectionType_Max = nzProjectionType_Perspective
};
enum nzLightType
{
nzLightType_Directional,

View File

@ -46,8 +46,8 @@ class NAZARA_GRAPHICS_API NzInstancedRenderable : public NzRefCounted
inline NzInstancedRenderable& operator=(const NzInstancedRenderable& renderable);
// Signals:
NazaraSignal(OnInstancedRenderableInvalidateData, const NzInstancedRenderable*, nzUInt32); //< Args: me, flags
NazaraSignal(OnInstancedRenderableRelease, const NzInstancedRenderable*); //< Args: me
NazaraSignal(OnInstancedRenderableInvalidateData, const NzInstancedRenderable* /*instancedRenderable*/, nzUInt32 /*flags*/);
NazaraSignal(OnInstancedRenderableRelease, const NzInstancedRenderable* /*instancedRenderable*/);
struct InstanceData
{

View File

@ -148,9 +148,9 @@ class NAZARA_GRAPHICS_API NzMaterial : public NzRefCounted, public NzResource
static NzMaterialRef GetDefault();
template<typename... Args> static NzMaterialRef New(Args&&... args);
// Signals
NazaraSignal(OnMaterialRelease, const NzMaterial*); //< Args: me
NazaraSignal(OnMaterialReset, const NzMaterial*); //< Args: me
// Signals:
NazaraSignal(OnMaterialRelease, const NzMaterial* /*material*/);
NazaraSignal(OnMaterialReset, const NzMaterial* /*material*/);
private:
struct ShaderInstance

View File

@ -35,7 +35,7 @@ class NAZARA_GRAPHICS_API NzParticleController : public NzRefCounted
virtual void Apply(NzParticleSystem& system, NzParticleMapper& mapper, unsigned int startId, unsigned int endId, float elapsedTime) = 0;
// Signals:
NazaraSignal(OnParticleControllerRelease, const NzParticleController*); //< Args: me
NazaraSignal(OnParticleControllerRelease, const NzParticleController* /*particleController*/);
private:
static bool Initialize();

View File

@ -45,8 +45,8 @@ class NAZARA_GRAPHICS_API NzParticleDeclaration : public NzRefCounted
static NzParticleDeclaration* Get(nzParticleLayout layout);
static bool IsTypeSupported(nzComponentType type);
// Signals
NazaraSignal(OnParticleDeclarationRelease, const NzParticleDeclaration*); //< Args: me
// Signals:
NazaraSignal(OnParticleDeclarationRelease, const NzParticleDeclaration* /*particleDeclaration*/);
private:
static bool Initialize();

View File

@ -35,7 +35,7 @@ class NAZARA_GRAPHICS_API NzParticleGenerator : public NzRefCounted
virtual void Generate(NzParticleSystem& system, NzParticleMapper& mapper, unsigned int startId, unsigned int endId) = 0;
// Signals:
NazaraSignal(OnParticleGeneratorRelease, const NzParticleGenerator*); //< Args: me
NazaraSignal(OnParticleGeneratorRelease, const NzParticleGenerator* /*particleGenerator*/);
private:
static bool Initialize();

View File

@ -36,7 +36,7 @@ class NAZARA_GRAPHICS_API NzParticleRenderer : public NzRefCounted
virtual void Render(const NzParticleSystem& system, const NzParticleMapper& mapper, unsigned int startId, unsigned int endId, NzAbstractRenderQueue* renderQueue) = 0;
// Signals:
NazaraSignal(OnParticleRendererRelease, const NzParticleRenderer*); //< Args: me
NazaraSignal(OnParticleRendererRelease, const NzParticleRenderer* /*particleRenderer*/);
private:
static bool Initialize();

View File

@ -51,7 +51,8 @@ class NAZARA_PHYSICS_API NzPhysGeom : public NzRefCounted, NzNonCopyable
static NzPhysGeomRef Build(const NzPrimitiveList& list);
NazaraSignal(OnPhysGeomRelease, const NzPhysGeom*); //< Args: me
// Signals:
NazaraSignal(OnPhysGeomRelease, const NzPhysGeom* /*physGeom*/);
protected:
virtual NewtonCollision* CreateHandle(NzPhysWorld* world) const = 0;
@ -217,6 +218,8 @@ class NAZARA_PHYSICS_API NzNullGeom : public NzPhysGeom
public:
NzNullGeom();
void ComputeInertialMatrix(NzVector3f* inertia, NzVector3f* center) const;
nzGeomType GetType() const override;
template<typename... Args> static NzNullGeomRef New(Args&&... args);

View File

@ -47,9 +47,9 @@ class NAZARA_RENDERER_API NzContext : public NzRefCounted
static const NzContext* GetReference();
static const NzContext* GetThreadContext();
// Signals
NazaraSignal(OnContextDestroy, const NzContext*); //< Args: me
NazaraSignal(OnContextRelease, const NzContext*); //< Args: me
// Signals:
NazaraSignal(OnContextDestroy, const NzContext* /*context*/);
NazaraSignal(OnContextRelease, const NzContext* /*context*/);
private:
static bool Initialize();

View File

@ -46,9 +46,9 @@ class NAZARA_RENDERER_API NzRenderBuffer : public NzRefCounted, NzNonCopyable
static bool IsSupported();
template<typename... Args> static NzRenderBufferRef New(Args&&... args);
// Signals
NazaraSignal(OnRenderBufferDestroy, const NzRenderBuffer*); //< Args: me
NazaraSignal(OnRenderBufferRelease, const NzRenderBuffer*); //< Args: me
// Signals:
NazaraSignal(OnRenderBufferDestroy, const NzRenderBuffer* /*renderBuffer*/);
NazaraSignal(OnRenderBufferRelease, const NzRenderBuffer* /*renderBuffer*/);
private:
static bool Initialize();

View File

@ -35,10 +35,10 @@ class NAZARA_RENDERER_API NzRenderTarget
// Fonctions OpenGL
virtual bool HasContext() const = 0;
// Signals
NazaraSignal(OnRenderTargetParametersChange, const NzRenderTarget*); //< Args: me
NazaraSignal(OnRenderTargetRelease, const NzRenderTarget*); //< Args: me
NazaraSignal(OnRenderTargetSizeChange, const NzRenderTarget*); //< Args: me
// Signals:
NazaraSignal(OnRenderTargetParametersChange, const NzRenderTarget* /*renderTarget*/);
NazaraSignal(OnRenderTargetRelease, const NzRenderTarget* /*renderTarget*/);
NazaraSignal(OnRenderTargetSizeChange, const NzRenderTarget* /*renderTarget*/);
protected:
virtual bool Activate() const = 0;

View File

@ -103,10 +103,10 @@ class NAZARA_RENDERER_API NzShader : public NzRefCounted, NzNonCopyable
static bool IsStageSupported(nzShaderStage stage);
template<typename... Args> static NzShaderRef New(Args&&... args);
// Signals
NazaraSignal(OnShaderDestroy, const NzShader*); //< Args: me
NazaraSignal(OnShaderRelease, const NzShader*); //< Args: me
NazaraSignal(OnShaderUniformInvalidated, const NzShader*); //< Args: me
// Signals:
NazaraSignal(OnShaderDestroy, const NzShader* /*shader*/);
NazaraSignal(OnShaderRelease, const NzShader* /*shader*/);
NazaraSignal(OnShaderUniformInvalidated, const NzShader* /*shader*/);
private:
bool PostLinkage();

View File

@ -108,9 +108,9 @@ class NAZARA_RENDERER_API NzTexture : public NzAbstractImage, public NzRefCounte
static bool IsTypeSupported(nzImageType type);
template<typename... Args> static NzTextureRef New(Args&&... args);
// Signals
NazaraSignal(OnTextureDestroy, const NzTexture*); //< Args: me
NazaraSignal(OnTextureRelease, const NzTexture*); //< Args: me
// Signals:
NazaraSignal(OnTextureDestroy, const NzTexture* /*texture*/);
NazaraSignal(OnTextureRelease, const NzTexture* /*texture*/);
private:
bool CreateTexture(bool proxy);

View File

@ -32,7 +32,8 @@ class NAZARA_RENDERER_API NzUberShader : public NzRefCounted
virtual NzUberShaderInstance* Get(const NzParameterList& parameters) const = 0;
NazaraSignal(OnUberShaderRelease, const NzUberShader*); //< Args: me
// Signals:
NazaraSignal(OnUberShaderRelease, const NzUberShader* /*uberShader*/);
private:
static bool Initialize();

View File

@ -36,7 +36,7 @@ class NAZARA_RENDERER_API NzUberShaderPreprocessor : public NzUberShader
template<typename... Args> static NzUberShaderPreprocessorRef New(Args&&... args);
// Signals:
NazaraSignal(OnUberShaderPreprocessorRelease, const NzUberShaderPreprocessor*); //< Args: me
NazaraSignal(OnUberShaderPreprocessorRelease, const NzUberShaderPreprocessor* /*uberShaderPreprocessor*/);
private:
struct Shader

View File

@ -31,9 +31,10 @@ class NAZARA_UTILITY_API NzAbstractAtlas
virtual nzUInt32 GetStorage() const = 0;
virtual bool Insert(const NzImage& image, NzRectui* rect, bool* flipped, unsigned int* layerIndex) = 0;
NazaraSignal(OnAtlasCleared, const NzAbstractAtlas*); //< Args: me
NazaraSignal(OnAtlasLayerChange, const NzAbstractAtlas*, NzAbstractImage*, NzAbstractImage*); //< Args: me, oldLayer, newLayer
NazaraSignal(OnAtlasRelease, const NzAbstractAtlas*); //< Args: me
// Signals:
NazaraSignal(OnAtlasCleared, const NzAbstractAtlas* /*atlas*/);
NazaraSignal(OnAtlasLayerChange, const NzAbstractAtlas* /*atlas*/, NzAbstractImage* /*oldLayer*/, NzAbstractImage* /*newLayer*/);
NazaraSignal(OnAtlasRelease, const NzAbstractAtlas* /*atlas*/);
};
#endif // NAZARA_ABSTRACTATLAS_HPP

View File

@ -88,9 +88,9 @@ class NAZARA_UTILITY_API NzAnimation : public NzRefCounted, public NzResource
template<typename... Args> static NzAnimationRef New(Args&&... args);
// Signals
NazaraSignal(OnAnimationDestroy, const NzAnimation*); //< Args: me
NazaraSignal(OnAnimationRelease, const NzAnimation*); //< Args: me
// Signals:
NazaraSignal(OnAnimationDestroy, const NzAnimation* /*animation*/);
NazaraSignal(OnAnimationRelease, const NzAnimation* /*animation*/);
private:
static bool Initialize();

View File

@ -61,8 +61,8 @@ class NAZARA_UTILITY_API NzBuffer : public NzRefCounted, NzNonCopyable
static void SetBufferFactory(nzUInt32 storage, BufferFactory func);
// Signals:
NazaraSignal(OnBufferDestroy, const NzBuffer*); //< Args: me
NazaraSignal(OnBufferRelease, const NzBuffer*); //< Args: me
NazaraSignal(OnBufferDestroy, const NzBuffer* /*buffer*/);
NazaraSignal(OnBufferRelease, const NzBuffer* /*buffer*/);
private:
static bool Initialize();

View File

@ -112,13 +112,14 @@ class NAZARA_UTILITY_API NzFont : public NzRefCounted, public NzResource, NzNonC
float underlineThickness;
};
NazaraSignal(OnFontAtlasChanged, const NzFont*); //< Args: me
NazaraSignal(OnFontAtlasLayerChanged, const NzFont*, NzAbstractImage*, NzAbstractImage*); //< Args: me, old layer, new layer
NazaraSignal(OnFontDestroy, const NzFont*); //< Args: me
NazaraSignal(OnFontGlyphCacheCleared, const NzFont*); //< Args: me
NazaraSignal(OnFontKerningCacheCleared, const NzFont*); //< Args: me
NazaraSignal(OnFontRelease, const NzFont*); //< Args: me
NazaraSignal(OnFontSizeInfoCacheCleared, const NzFont*); //< Args: me
// Signals:
NazaraSignal(OnFontAtlasChanged, const NzFont* /*font*/);
NazaraSignal(OnFontAtlasLayerChanged, const NzFont* /*font*/, NzAbstractImage* /*oldLayer*/, NzAbstractImage* /*newLayer*/);
NazaraSignal(OnFontDestroy, const NzFont* /*font*/);
NazaraSignal(OnFontGlyphCacheCleared, const NzFont* /*font*/);
NazaraSignal(OnFontKerningCacheCleared, const NzFont* /*font*/);
NazaraSignal(OnFontRelease, const NzFont* /*font*/);
NazaraSignal(OnFontSizeInfoCacheCleared, const NzFont* /*font*/);
private:
using GlyphMap = std::unordered_map<char32_t, Glyph>;

View File

@ -147,8 +147,8 @@ class NAZARA_UTILITY_API NzImage : public NzAbstractImage, public NzRefCounted,
static SharedImage emptyImage;
// Signals:
NazaraSignal(OnImageDestroy, const NzImage*); //< Args: me
NazaraSignal(OnImageRelease, const NzImage*); //< Args: me
NazaraSignal(OnImageDestroy, const NzImage* /*image*/);
NazaraSignal(OnImageRelease, const NzImage* /*image*/);
private:
void EnsureOwnership();

View File

@ -64,8 +64,8 @@ class NAZARA_UTILITY_API NzIndexBuffer : public NzRefCounted
template<typename... Args> static NzIndexBufferRef New(Args&&... args);
// Signals
NazaraSignal(OnIndexBufferRelease, const NzIndexBuffer*); //< Args: me
// Signals:
NazaraSignal(OnIndexBufferRelease, const NzIndexBuffer* /*indexBuffer*/);
private:
NzBufferRef m_buffer;

View File

@ -129,8 +129,8 @@ class NAZARA_UTILITY_API NzMesh : public NzRefCounted, public NzResource
template<typename... Args> static NzMeshRef New(Args&&... args);
// Signals:
NazaraSignal(OnMeshDestroy, const NzMesh*); //< Args: me
NazaraSignal(OnMeshRelease, const NzMesh*); //< Args: me
NazaraSignal(OnMeshDestroy, const NzMesh* /*mesh*/);
NazaraSignal(OnMeshRelease, const NzMesh* /*mesh*/);
private:
NzMeshImpl* m_impl = nullptr;

View File

@ -92,9 +92,9 @@ class NAZARA_UTILITY_API NzNode
NzNode& operator=(const NzNode& node);
// Signals:
NazaraSignal(OnNodeInvalidation, const NzNode*); //< Args: me
NazaraSignal(OnNodeNewParent, const NzNode*, const NzNode*); //< Args: me, new parent
NazaraSignal(OnNodeRelease, const NzNode*); //< Args: me
NazaraSignal(OnNodeInvalidation, const NzNode* /*node*/);
NazaraSignal(OnNodeNewParent, const NzNode* /*node*/, const NzNode* /*parent*/);
NazaraSignal(OnNodeRelease, const NzNode* /*node*/);
protected:
void AddChild(NzNode* node) const;

View File

@ -42,8 +42,8 @@ class NAZARA_UTILITY_API NzSkeletalMesh final : public NzSubMesh
template<typename... Args> static NzSkeletalMeshRef New(Args&&... args);
// Signals:
NazaraSignal(OnSkeletalMeshDestroy, const NzSkeletalMesh*); //< Args: me
NazaraSignal(OnSkeletalMeshRelease, const NzSkeletalMesh*); //< Args: me
NazaraSignal(OnSkeletalMeshDestroy, const NzSkeletalMesh* /*skeletalMesh*/);
NazaraSignal(OnSkeletalMeshRelease, const NzSkeletalMesh* /*skeletalMesh*/);
private:
NzBoxf m_aabb;

View File

@ -58,9 +58,9 @@ class NAZARA_UTILITY_API NzSkeleton : public NzRefCounted
template<typename... Args> static NzSkeletonRef New(Args&&... args);
// Signals:
NazaraSignal(OnSkeletonDestroy, const NzSkeleton*); //< Args: me
NazaraSignal(OnSkeletonJointsInvalidated, const NzSkeleton*); //< Args: me
NazaraSignal(OnSkeletonRelease, const NzSkeleton*); //< Args: me
NazaraSignal(OnSkeletonDestroy, const NzSkeleton* /*skeleton*/);
NazaraSignal(OnSkeletonJointsInvalidated, const NzSkeleton* /*skeleton*/);
NazaraSignal(OnSkeletonRelease, const NzSkeleton* /*skeleton*/);
private:
void InvalidateJoints();

View File

@ -45,8 +45,8 @@ class NAZARA_UTILITY_API NzStaticMesh final : public NzSubMesh
template<typename... Args> static NzStaticMeshRef New(Args&&... args);
// Signals:
NazaraSignal(OnStaticMeshDestroy, const NzStaticMesh*); //< Args: me
NazaraSignal(OnStaticMeshRelease, const NzStaticMesh*); //< Args: me
NazaraSignal(OnStaticMeshDestroy, const NzStaticMesh* /*staticMesh*/);
NazaraSignal(OnStaticMeshRelease, const NzStaticMesh* /*staticMesh*/);
private:
NzBoxf m_aabb;

View File

@ -49,7 +49,7 @@ class NAZARA_UTILITY_API NzSubMesh : public NzRefCounted
void SetPrimitiveMode(nzPrimitiveMode mode);
// Signals:
NazaraSignal(OnSubMeshRelease, const NzSubMesh*); //< Args: me
NazaraSignal(OnSubMeshRelease, const NzSubMesh* /*subMesh*/);
protected:
nzPrimitiveMode m_primitiveMode;

View File

@ -62,8 +62,8 @@ class NAZARA_UTILITY_API NzVertexBuffer : public NzRefCounted
template<typename... Args> static NzVertexBufferRef New(Args&&... args);
// Signals
NazaraSignal(OnVertexBufferRelease, const NzVertexBuffer*); //< Args: me
// Signals:
NazaraSignal(OnVertexBufferRelease, const NzVertexBuffer* /*vertexBuffer*/);
private:
NzBufferRef m_buffer;

View File

@ -45,8 +45,8 @@ class NAZARA_UTILITY_API NzVertexDeclaration : public NzRefCounted
static bool IsTypeSupported(nzComponentType type);
template<typename... Args> static NzVertexDeclarationRef New(Args&&... args);
// Signals
NazaraSignal(OnVertexDeclarationRelease, const NzVertexDeclaration*); //< Args: me
// Signals:
NazaraSignal(OnVertexDeclarationRelease, const NzVertexDeclaration* /*vertexDeclaration*/);
private:
static bool Initialize();

View File

@ -1934,7 +1934,7 @@ bool NzString::IsEmpty() const
bool NzString::IsNull() const
{
return !m_sharedString.get();
return m_sharedString.get() == GetEmptyString().get();
}
bool NzString::IsNumber(nzUInt8 base, nzUInt32 flags) const
@ -4198,7 +4198,7 @@ bool NzString::FillHash(NzAbstractHash* hash) const
return true;
}
std::shared_ptr<NzString::SharedString> NzString::GetEmptyString()
const std::shared_ptr<NzString::SharedString>& NzString::GetEmptyString()
{
static auto emptyString = std::make_shared<SharedString>();

View File

@ -379,6 +379,15 @@ nzGeomType NzNullGeom::GetType() const
return nzGeomType_Null;
}
void NzNullGeom::ComputeInertialMatrix(NzVector3f* inertia, NzVector3f* center) const
{
if (inertia)
inertia->MakeUnit();
if (center)
center->MakeZero();
}
NewtonCollision* NzNullGeom::CreateHandle(NzPhysWorld* world) const
{
return NewtonCreateNull(world->GetHandle());

View File

@ -1,5 +1,5 @@
#include <Nazara/Core/ByteArray.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
#include <string>

View File

@ -1,7 +1,6 @@
#include <Nazara/Core/Clock.hpp>
#include <catch.hpp>
#include <thread>
#include <Nazara/Core/Thread.hpp>
#include <Catch/catch.hpp>
SCENARIO("Clock", "[CORE][CLOCK]")
{
@ -22,7 +21,7 @@ SCENARIO("Clock", "[CORE][CLOCK]")
clock.Unpause();
THEN("Time must not be the initialTime")
{
std::this_thread::sleep_for(std::chrono::microseconds(10));
NzThread::Sleep(1);
REQUIRE(clock.GetMicroseconds() != initialTime);
}
}

View File

@ -1,5 +1,5 @@
#include <Nazara/Core/Color.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Color", "[CORE][COLOR]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Core/Directory.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Directory", "[CORE][DIRECTORY]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Core/Error.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Error", "[CORE][ERROR]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Core/File.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("File", "[CORE][FILE]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Core/String.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("String", "[CORE][STRING]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Core/StringStream.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("StringStream", "[CORE][STRINGSTREAM]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Algorithm.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
TEST_CASE("Approach", "[MATH][ALGORITHM]" )
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/BoundingVolume.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("BoundingVolume", "[MATH][BOUNDINGVOLUME]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Box.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Box", "[MATH][BOX]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/EulerAngles.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("EulerAngles", "[MATH][EULERANGLES]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Frustum.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Frustum", "[MATH][FRUSTUM]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Matrix4.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Matrix4", "[MATH][MATRIX4]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/OrientedBox.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("OrientedBox", "[MATH][ORIENTEDBOX]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Plane.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Plane", "[MATH][PLANE]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Quaternion.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Quaternion", "[MATH][QUATERNION]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Ray.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Ray", "[RAY]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Rect.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Rect", "[MATH][RECT]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Sphere.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
SCENARIO("Sphere", "[MATH][SPHERE]")
{

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Vector2.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
#include <Nazara/Math/Vector4.hpp>

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Vector3.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
#include <Nazara/Math/Vector4.hpp>

View File

@ -1,5 +1,5 @@
#include <Nazara/Math/Vector4.hpp>
#include <catch.hpp>
#include <Catch/catch.hpp>
#include <Nazara/Math/Vector3.hpp>

View File

@ -1,2 +1,2 @@
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include <Catch/catch.hpp>