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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,12 +28,21 @@ namespace Ndk
~RenderSystem() = default; ~RenderSystem() = default;
inline const NzBackgroundRef& GetDefaultBackground() const; 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 SetDefaultBackground(NzBackgroundRef background);
inline void SetGlobalForward(const NzVector3f& direction);
inline void SetGlobalRight(const NzVector3f& direction);
inline void SetGlobalUp(const NzVector3f& direction);
static SystemIndex systemIndex; static SystemIndex systemIndex;
private: private:
inline void InvalidateCoordinateSystem();
void OnEntityRemoved(Entity* entity) override; void OnEntityRemoved(Entity* entity) override;
void OnEntityValidation(Entity* entity, bool justAdded) override; void OnEntityValidation(Entity* entity, bool justAdded) override;
void OnUpdate(float elapsedTime) override; void OnUpdate(float elapsedTime) override;
@ -48,7 +57,9 @@ namespace Ndk
NzBackgroundRef m_background; NzBackgroundRef m_background;
NzDepthRenderTechnique m_shadowTechnique; NzDepthRenderTechnique m_shadowTechnique;
NzForwardRenderTechnique m_renderTechnique; NzForwardRenderTechnique m_renderTechnique;
NzMatrix4f m_coordinateSystemMatrix;
NzRenderTexture m_shadowRT; NzRenderTexture m_shadowRT;
bool m_coordinateSystemInvalidated;
}; };
} }

View File

@ -14,8 +14,60 @@ namespace Ndk
return m_background; 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) inline void RenderSystem::SetDefaultBackground(NzBackgroundRef background)
{ {
m_background = std::move(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 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; m_projectionMatrixUpdated = true;
} }
@ -153,7 +165,8 @@ namespace Ndk
{ {
m_aspectRatio = aspectRatio; m_aspectRatio = aspectRatio;
InvalidateProjectionMatrix(); if (m_projectionType == nzProjectionType_Perspective)
InvalidateProjectionMatrix();
} }
// Convert it back to int // Convert it back to int

View File

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

View File

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

View File

@ -134,7 +134,8 @@ function NazaraBuild:Execute()
buildoptions("-fvisibility=hidden") buildoptions("-fvisibility=hidden")
configuration("vs*") configuration("vs*")
buildoptions("/MP") buildoptions("/MP") -- Multiprocessus build
flags("NoMinimalRebuild")
defines("_CRT_SECURE_NO_WARNINGS") defines("_CRT_SECURE_NO_WARNINGS")
defines("_SCL_SECURE_NO_WARNINGS") defines("_SCL_SECURE_NO_WARNINGS")
@ -246,7 +247,7 @@ function NazaraBuild:Execute()
kind("ConsoleApp") kind("ConsoleApp")
elseif (toolTable.Kind == "windowapp") then elseif (toolTable.Kind == "windowapp") then
debugdir(toolTable.Directory) debugdir(toolTable.Directory)
kind("Window") kind("WindowedApp")
else else
assert(false, "wut") assert(false, "wut")
end end
@ -269,47 +270,61 @@ function NazaraBuild:Execute()
configuration({"codeblocks or codelite or gmake", "x32"}) configuration({"codeblocks or codelite or gmake", "x32"})
libdirs("../extlibs/lib/mingw/x86") libdirs("../extlibs/lib/mingw/x86")
libdirs("../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"}) configuration({"codeblocks or codelite or gmake", "x64"})
libdirs("../extlibs/lib/mingw/x64") libdirs("../extlibs/lib/mingw/x64")
libdirs("../lib/mingw/x64") libdirs("../lib/mingw/x64")
targetdir("../lib/mingw/x64") if (toolTable.Kind == "library") then
targetdir("../lib/mingw/x64")
end
configuration({"vs*", "x32"}) configuration({"vs*", "x32"})
libdirs("../extlibs/lib/msvc/x86") libdirs("../extlibs/lib/msvc/x86")
libdirs("../lib/msvc/x86") libdirs("../lib/msvc/x86")
targetdir("../lib/msvc/x86") if (toolTable.Kind == "library") then
targetdir("../lib/msvc/x86")
end
configuration({"vs*", "x64"}) configuration({"vs*", "x64"})
libdirs("../extlibs/lib/msvc/x64") libdirs("../extlibs/lib/msvc/x64")
libdirs("../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"}) configuration({"xcode3 or xcode4", "x32"})
libdirs("../extlibs/lib/xcode/x86") libdirs("../extlibs/lib/xcode/x86")
libdirs("../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"}) configuration({"xcode3 or xcode4", "x64"})
libdirs("../extlibs/lib/xcode/x64") libdirs("../extlibs/lib/xcode/x64")
libdirs("../lib/xcode/x64") libdirs("../lib/xcode/x64")
targetdir("../lib/xcode/x64") if (toolTable.Kind == "library") then
targetdir("../lib/xcode/x64")
end
configuration("*Static") if (toolTable.Kind == "library") then
kind("StaticLib") configuration("*Static")
kind("StaticLib")
configuration("*Dynamic") configuration("*Dynamic")
kind("SharedLib") kind("SharedLib")
configuration("DebugStatic")
targetsuffix("-s-d")
configuration("DebugStatic") configuration("ReleaseStatic")
targetsuffix("-s-d") targetsuffix("-s")
configuration("ReleaseStatic") configuration("DebugDynamic")
targetsuffix("-s") targetsuffix("-d")
end
configuration("DebugDynamic")
targetsuffix("-d")
configuration({}) 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); template<typename... Args> static NzSoundBufferRef New(Args&&... args);
// Signals: // Signals:
NazaraSignal(OnSoundBufferDestroy, const NzSoundBuffer*); //< Args: me NazaraSignal(OnSoundBufferDestroy, const NzSoundBuffer* /*soundBuffer*/);
NazaraSignal(OnSoundBufferRelease, const NzSoundBuffer*); //< Args: me NazaraSignal(OnSoundBufferRelease, const NzSoundBuffer* /*soundBuffer*/);
private: private:
unsigned int GetOpenALBuffer() const; 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) void NzBitset<Block, Allocator>::Resize(unsigned int bitCount, bool defaultVal)
{ {
// On commence par changer la taille du conteneur, avec la valeur correcte d'initialisation // 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); m_blocks.resize(ComputeBlockCount(bitCount), (defaultVal) ? fullBitMask : 0U);
unsigned int remainingBits = GetBitIndex(m_bitCount); unsigned int remainingBits = GetBitIndex(m_bitCount);
@ -304,7 +304,7 @@ template<typename Block, class Allocator>
void NzBitset<Block, Allocator>::Swap(NzBitset& bitset) void NzBitset<Block, Allocator>::Swap(NzBitset& bitset)
{ {
std::swap(m_bitCount, bitset.m_bitCount); 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> 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"); 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; T value = 0;
for (unsigned int i = 0; i < m_blocks.size(); ++i) 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); 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 inline NzByteArray::allocator_type NzByteArray::GetAllocator() const
{ {
return m_array.get_allocator(); return m_array.get_allocator();

View File

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

View File

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

View File

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

View File

@ -148,9 +148,9 @@ class NAZARA_GRAPHICS_API NzMaterial : public NzRefCounted, public NzResource
static NzMaterialRef GetDefault(); static NzMaterialRef GetDefault();
template<typename... Args> static NzMaterialRef New(Args&&... args); template<typename... Args> static NzMaterialRef New(Args&&... args);
// Signals // Signals:
NazaraSignal(OnMaterialRelease, const NzMaterial*); //< Args: me NazaraSignal(OnMaterialRelease, const NzMaterial* /*material*/);
NazaraSignal(OnMaterialReset, const NzMaterial*); //< Args: me NazaraSignal(OnMaterialReset, const NzMaterial* /*material*/);
private: private:
struct ShaderInstance 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; virtual void Apply(NzParticleSystem& system, NzParticleMapper& mapper, unsigned int startId, unsigned int endId, float elapsedTime) = 0;
// Signals: // Signals:
NazaraSignal(OnParticleControllerRelease, const NzParticleController*); //< Args: me NazaraSignal(OnParticleControllerRelease, const NzParticleController* /*particleController*/);
private: private:
static bool Initialize(); static bool Initialize();

View File

@ -45,8 +45,8 @@ class NAZARA_GRAPHICS_API NzParticleDeclaration : public NzRefCounted
static NzParticleDeclaration* Get(nzParticleLayout layout); static NzParticleDeclaration* Get(nzParticleLayout layout);
static bool IsTypeSupported(nzComponentType type); static bool IsTypeSupported(nzComponentType type);
// Signals // Signals:
NazaraSignal(OnParticleDeclarationRelease, const NzParticleDeclaration*); //< Args: me NazaraSignal(OnParticleDeclarationRelease, const NzParticleDeclaration* /*particleDeclaration*/);
private: private:
static bool Initialize(); 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; virtual void Generate(NzParticleSystem& system, NzParticleMapper& mapper, unsigned int startId, unsigned int endId) = 0;
// Signals: // Signals:
NazaraSignal(OnParticleGeneratorRelease, const NzParticleGenerator*); //< Args: me NazaraSignal(OnParticleGeneratorRelease, const NzParticleGenerator* /*particleGenerator*/);
private: private:
static bool Initialize(); 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; virtual void Render(const NzParticleSystem& system, const NzParticleMapper& mapper, unsigned int startId, unsigned int endId, NzAbstractRenderQueue* renderQueue) = 0;
// Signals: // Signals:
NazaraSignal(OnParticleRendererRelease, const NzParticleRenderer*); //< Args: me NazaraSignal(OnParticleRendererRelease, const NzParticleRenderer* /*particleRenderer*/);
private: private:
static bool Initialize(); static bool Initialize();

View File

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

View File

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

View File

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

View File

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

View File

@ -108,9 +108,9 @@ class NAZARA_RENDERER_API NzTexture : public NzAbstractImage, public NzRefCounte
static bool IsTypeSupported(nzImageType type); static bool IsTypeSupported(nzImageType type);
template<typename... Args> static NzTextureRef New(Args&&... args); template<typename... Args> static NzTextureRef New(Args&&... args);
// Signals // Signals:
NazaraSignal(OnTextureDestroy, const NzTexture*); //< Args: me NazaraSignal(OnTextureDestroy, const NzTexture* /*texture*/);
NazaraSignal(OnTextureRelease, const NzTexture*); //< Args: me NazaraSignal(OnTextureRelease, const NzTexture* /*texture*/);
private: private:
bool CreateTexture(bool proxy); 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; virtual NzUberShaderInstance* Get(const NzParameterList& parameters) const = 0;
NazaraSignal(OnUberShaderRelease, const NzUberShader*); //< Args: me // Signals:
NazaraSignal(OnUberShaderRelease, const NzUberShader* /*uberShader*/);
private: private:
static bool Initialize(); static bool Initialize();

View File

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

View File

@ -31,9 +31,10 @@ class NAZARA_UTILITY_API NzAbstractAtlas
virtual nzUInt32 GetStorage() const = 0; virtual nzUInt32 GetStorage() const = 0;
virtual bool Insert(const NzImage& image, NzRectui* rect, bool* flipped, unsigned int* layerIndex) = 0; virtual bool Insert(const NzImage& image, NzRectui* rect, bool* flipped, unsigned int* layerIndex) = 0;
NazaraSignal(OnAtlasCleared, const NzAbstractAtlas*); //< Args: me // Signals:
NazaraSignal(OnAtlasLayerChange, const NzAbstractAtlas*, NzAbstractImage*, NzAbstractImage*); //< Args: me, oldLayer, newLayer NazaraSignal(OnAtlasCleared, const NzAbstractAtlas* /*atlas*/);
NazaraSignal(OnAtlasRelease, const NzAbstractAtlas*); //< Args: me NazaraSignal(OnAtlasLayerChange, const NzAbstractAtlas* /*atlas*/, NzAbstractImage* /*oldLayer*/, NzAbstractImage* /*newLayer*/);
NazaraSignal(OnAtlasRelease, const NzAbstractAtlas* /*atlas*/);
}; };
#endif // NAZARA_ABSTRACTATLAS_HPP #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); template<typename... Args> static NzAnimationRef New(Args&&... args);
// Signals // Signals:
NazaraSignal(OnAnimationDestroy, const NzAnimation*); //< Args: me NazaraSignal(OnAnimationDestroy, const NzAnimation* /*animation*/);
NazaraSignal(OnAnimationRelease, const NzAnimation*); //< Args: me NazaraSignal(OnAnimationRelease, const NzAnimation* /*animation*/);
private: private:
static bool Initialize(); static bool Initialize();

View File

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

View File

@ -112,13 +112,14 @@ class NAZARA_UTILITY_API NzFont : public NzRefCounted, public NzResource, NzNonC
float underlineThickness; float underlineThickness;
}; };
NazaraSignal(OnFontAtlasChanged, const NzFont*); //< Args: me // Signals:
NazaraSignal(OnFontAtlasLayerChanged, const NzFont*, NzAbstractImage*, NzAbstractImage*); //< Args: me, old layer, new layer NazaraSignal(OnFontAtlasChanged, const NzFont* /*font*/);
NazaraSignal(OnFontDestroy, const NzFont*); //< Args: me NazaraSignal(OnFontAtlasLayerChanged, const NzFont* /*font*/, NzAbstractImage* /*oldLayer*/, NzAbstractImage* /*newLayer*/);
NazaraSignal(OnFontGlyphCacheCleared, const NzFont*); //< Args: me NazaraSignal(OnFontDestroy, const NzFont* /*font*/);
NazaraSignal(OnFontKerningCacheCleared, const NzFont*); //< Args: me NazaraSignal(OnFontGlyphCacheCleared, const NzFont* /*font*/);
NazaraSignal(OnFontRelease, const NzFont*); //< Args: me NazaraSignal(OnFontKerningCacheCleared, const NzFont* /*font*/);
NazaraSignal(OnFontSizeInfoCacheCleared, const NzFont*); //< Args: me NazaraSignal(OnFontRelease, const NzFont* /*font*/);
NazaraSignal(OnFontSizeInfoCacheCleared, const NzFont* /*font*/);
private: private:
using GlyphMap = std::unordered_map<char32_t, Glyph>; 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; static SharedImage emptyImage;
// Signals: // Signals:
NazaraSignal(OnImageDestroy, const NzImage*); //< Args: me NazaraSignal(OnImageDestroy, const NzImage* /*image*/);
NazaraSignal(OnImageRelease, const NzImage*); //< Args: me NazaraSignal(OnImageRelease, const NzImage* /*image*/);
private: private:
void EnsureOwnership(); void EnsureOwnership();

View File

@ -64,8 +64,8 @@ class NAZARA_UTILITY_API NzIndexBuffer : public NzRefCounted
template<typename... Args> static NzIndexBufferRef New(Args&&... args); template<typename... Args> static NzIndexBufferRef New(Args&&... args);
// Signals // Signals:
NazaraSignal(OnIndexBufferRelease, const NzIndexBuffer*); //< Args: me NazaraSignal(OnIndexBufferRelease, const NzIndexBuffer* /*indexBuffer*/);
private: private:
NzBufferRef m_buffer; 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); template<typename... Args> static NzMeshRef New(Args&&... args);
// Signals: // Signals:
NazaraSignal(OnMeshDestroy, const NzMesh*); //< Args: me NazaraSignal(OnMeshDestroy, const NzMesh* /*mesh*/);
NazaraSignal(OnMeshRelease, const NzMesh*); //< Args: me NazaraSignal(OnMeshRelease, const NzMesh* /*mesh*/);
private: private:
NzMeshImpl* m_impl = nullptr; NzMeshImpl* m_impl = nullptr;

View File

@ -92,9 +92,9 @@ class NAZARA_UTILITY_API NzNode
NzNode& operator=(const NzNode& node); NzNode& operator=(const NzNode& node);
// Signals: // Signals:
NazaraSignal(OnNodeInvalidation, const NzNode*); //< Args: me NazaraSignal(OnNodeInvalidation, const NzNode* /*node*/);
NazaraSignal(OnNodeNewParent, const NzNode*, const NzNode*); //< Args: me, new parent NazaraSignal(OnNodeNewParent, const NzNode* /*node*/, const NzNode* /*parent*/);
NazaraSignal(OnNodeRelease, const NzNode*); //< Args: me NazaraSignal(OnNodeRelease, const NzNode* /*node*/);
protected: protected:
void AddChild(NzNode* node) const; 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); template<typename... Args> static NzSkeletalMeshRef New(Args&&... args);
// Signals: // Signals:
NazaraSignal(OnSkeletalMeshDestroy, const NzSkeletalMesh*); //< Args: me NazaraSignal(OnSkeletalMeshDestroy, const NzSkeletalMesh* /*skeletalMesh*/);
NazaraSignal(OnSkeletalMeshRelease, const NzSkeletalMesh*); //< Args: me NazaraSignal(OnSkeletalMeshRelease, const NzSkeletalMesh* /*skeletalMesh*/);
private: private:
NzBoxf m_aabb; NzBoxf m_aabb;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1934,7 +1934,7 @@ bool NzString::IsEmpty() const
bool NzString::IsNull() const bool NzString::IsNull() const
{ {
return !m_sharedString.get(); return m_sharedString.get() == GetEmptyString().get();
} }
bool NzString::IsNumber(nzUInt8 base, nzUInt32 flags) const bool NzString::IsNumber(nzUInt8 base, nzUInt32 flags) const
@ -2609,7 +2609,7 @@ NzString& NzString::Set(unsigned int rep, const char* string, unsigned int lengt
if (totalSize > 0) if (totalSize > 0)
{ {
if (m_sharedString->capacity >= totalSize) if (m_sharedString->capacity >= totalSize)
{ {
EnsureOwnership(true); EnsureOwnership(true);
m_sharedString->size = totalSize; m_sharedString->size = totalSize;
@ -2642,7 +2642,7 @@ NzString& NzString::Set(const char* string, unsigned int length)
if (length > 0) if (length > 0)
{ {
if (m_sharedString->capacity >= length) if (m_sharedString->capacity >= length)
{ {
EnsureOwnership(true); EnsureOwnership(true);
m_sharedString->size = length; m_sharedString->size = length;
@ -4198,7 +4198,7 @@ bool NzString::FillHash(NzAbstractHash* hash) const
return true; return true;
} }
std::shared_ptr<NzString::SharedString> NzString::GetEmptyString() const std::shared_ptr<NzString::SharedString>& NzString::GetEmptyString()
{ {
static auto emptyString = std::make_shared<SharedString>(); static auto emptyString = std::make_shared<SharedString>();

View File

@ -379,6 +379,15 @@ nzGeomType NzNullGeom::GetType() const
return nzGeomType_Null; 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 NewtonCollision* NzNullGeom::CreateHandle(NzPhysWorld* world) const
{ {
return NewtonCreateNull(world->GetHandle()); return NewtonCreateNull(world->GetHandle());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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