diff --git a/SDK/include/NDK/Algorithm.hpp b/SDK/include/NDK/Algorithm.hpp index ece1d5d37..61582012d 100644 --- a/SDK/include/NDK/Algorithm.hpp +++ b/SDK/include/NDK/Algorithm.hpp @@ -12,8 +12,8 @@ namespace Ndk { template ComponentId BuildComponentId(const char (&name)[N]); - template constexpr ComponentIndex GetComponentIndex(); - template constexpr SystemIndex GetSystemIndex(); + template ComponentIndex GetComponentIndex(); + template SystemIndex GetSystemIndex(); template ComponentIndex InitializeComponent(const char (&name)[N]); template SystemIndex InitializeSystem(); template bool IsComponent(C& component); diff --git a/SDK/include/NDK/Algorithm.inl b/SDK/include/NDK/Algorithm.inl index 77863e232..dd5f49cd4 100644 --- a/SDK/include/NDK/Algorithm.inl +++ b/SDK/include/NDK/Algorithm.inl @@ -20,13 +20,13 @@ namespace Ndk } template - constexpr ComponentIndex GetComponentIndex() + ComponentIndex GetComponentIndex() { return ComponentType::componentIndex; } template - constexpr SystemIndex GetSystemIndex() + SystemIndex GetSystemIndex() { return SystemType::systemIndex; } diff --git a/SDK/include/NDK/BaseSystem.inl b/SDK/include/NDK/BaseSystem.inl index fec06ef9a..2d43bc15c 100644 --- a/SDK/include/NDK/BaseSystem.inl +++ b/SDK/include/NDK/BaseSystem.inl @@ -45,7 +45,7 @@ namespace Ndk template void BaseSystem::Excludes() { - static_assert(std::is_base_of(), "ComponentType is not a component"); + static_assert(std::is_base_of::value , "ComponentType is not a component"); ExcludesComponent(GetComponentIndex()); } @@ -70,7 +70,7 @@ namespace Ndk template void BaseSystem::Requires() { - static_assert(std::is_base_of(), "ComponentType is not a component"); + static_assert(std::is_base_of::value, "ComponentType is not a component"); RequiresComponent(GetComponentIndex()); } @@ -90,7 +90,7 @@ namespace Ndk template void BaseSystem::RequiresAny() { - static_assert(std::is_base_of(), "ComponentType is not a component"); + static_assert(std::is_base_of::value, "ComponentType is not a component"); RequiresAnyComponent(GetComponentIndex()); } diff --git a/SDK/include/NDK/Components/CameraComponent.inl b/SDK/include/NDK/Components/CameraComponent.inl index 65732e285..37f13d9c4 100644 --- a/SDK/include/NDK/Components/CameraComponent.inl +++ b/SDK/include/NDK/Components/CameraComponent.inl @@ -140,7 +140,7 @@ namespace Ndk { m_target = renderTarget; if (m_target) - m_targetReleaseSlot.Connect(m_target->OnRenderTargetRelease, this, OnRenderTargetRelease); + m_targetReleaseSlot.Connect(m_target->OnRenderTargetRelease, this, &CameraComponent::OnRenderTargetRelease); else m_targetReleaseSlot.Disconnect(); } diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index 21e371e28..88b554855 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -37,7 +37,7 @@ namespace Ndk m_renderables.emplace_back(m_transformMatrix); Renderable& r = m_renderables.back(); r.renderable = std::move(renderable); - r.renderableInvalidationSlot.Connect(r.renderable->OnRenderableInvalidateInstanceData, std::bind(InvalidateRenderableData, this, std::placeholders::_1, std::placeholders::_2, m_renderables.size()-1)); + r.renderableInvalidationSlot.Connect(r.renderable->OnRenderableInvalidateInstanceData, std::bind(&GraphicsComponent::InvalidateRenderableData, this, std::placeholders::_1, std::placeholders::_2, m_renderables.size()-1)); } inline void GraphicsComponent::EnsureTransformMatrixUpdate() const diff --git a/SDK/include/NDK/Entity.inl b/SDK/include/NDK/Entity.inl index b909f3cc2..22353dac9 100644 --- a/SDK/include/NDK/Entity.inl +++ b/SDK/include/NDK/Entity.inl @@ -12,7 +12,7 @@ namespace Ndk template ComponentType& Entity::AddComponent(Args&&... args) { - static_assert(std::is_base_of(), "ComponentType is not a component"); + static_assert(std::is_base_of::value, "ComponentType is not a component"); // Allocation et affectation du component std::unique_ptr ptr(new ComponentType(std::forward(args)...)); @@ -34,7 +34,7 @@ namespace Ndk ComponentType& Entity::GetComponent() { ///DOC: Le component doit être présent - static_assert(std::is_base_of(), "ComponentType is not a component"); + static_assert(std::is_base_of::value, "ComponentType is not a component"); ComponentIndex index = GetComponentIndex(); return static_cast(GetComponent(index)); @@ -68,7 +68,7 @@ namespace Ndk template bool Entity::HasComponent() const { - static_assert(std::is_base_of(), "ComponentType is not a component"); + static_assert(std::is_base_of::value, "ComponentType is not a component"); ComponentIndex index = GetComponentIndex(); return HasComponent(index); diff --git a/SDK/include/NDK/World.inl b/SDK/include/NDK/World.inl index 0b0b30b63..6c275a8b6 100644 --- a/SDK/include/NDK/World.inl +++ b/SDK/include/NDK/World.inl @@ -35,7 +35,7 @@ namespace Ndk template SystemType& World::AddSystem(Args&&... args) { - static_assert(std::is_base_of(), "SystemType is not a component"); + static_assert(std::is_base_of::value, "SystemType is not a component"); // Allocation et affectation du component std::unique_ptr ptr(new SystemType(std::forward(args)...)); @@ -73,7 +73,7 @@ namespace Ndk SystemType& World::GetSystem() { ///DOC: Le système doit être présent - static_assert(std::is_base_of(), "SystemType is not a system"); + static_assert(std::is_base_of::value, "SystemType is not a system"); SystemIndex index = GetSystemIndex(); return static_cast(GetSystem(index)); diff --git a/SDK/src/NDK/Components/CameraComponent.cpp b/SDK/src/NDK/Components/CameraComponent.cpp index d46ff1d9a..a976262c4 100644 --- a/SDK/src/NDK/Components/CameraComponent.cpp +++ b/SDK/src/NDK/Components/CameraComponent.cpp @@ -47,7 +47,7 @@ namespace Ndk void CameraComponent::OnAttached() { if (m_entity->HasComponent()) - m_nodeInvalidationSlot.Connect(m_entity->GetComponent().OnNodeInvalidation, this, OnNodeInvalidated); + m_nodeInvalidationSlot.Connect(m_entity->GetComponent().OnNodeInvalidation, this, &CameraComponent::OnNodeInvalidated); InvalidateViewMatrix(); } @@ -57,7 +57,7 @@ namespace Ndk if (IsComponent(component)) { NodeComponent& nodeComponent = static_cast(component); - m_nodeInvalidationSlot.Connect(nodeComponent.OnNodeInvalidation, this, OnNodeInvalidated); + m_nodeInvalidationSlot.Connect(nodeComponent.OnNodeInvalidation, this, &CameraComponent::OnNodeInvalidated); InvalidateViewMatrix(); } diff --git a/SDK/src/NDK/Components/GraphicsComponent.cpp b/SDK/src/NDK/Components/GraphicsComponent.cpp index 228bff7d8..83132b1dc 100644 --- a/SDK/src/NDK/Components/GraphicsComponent.cpp +++ b/SDK/src/NDK/Components/GraphicsComponent.cpp @@ -21,7 +21,7 @@ namespace Ndk void GraphicsComponent::OnAttached() { if (m_entity->HasComponent()) - m_nodeInvalidationSlot.Connect(m_entity->GetComponent().OnNodeInvalidation, this, OnNodeInvalidated); + m_nodeInvalidationSlot.Connect(m_entity->GetComponent().OnNodeInvalidation, this, &GraphicsComponent::OnNodeInvalidated); InvalidateTransformMatrix(); } @@ -31,7 +31,7 @@ namespace Ndk if (IsComponent(component)) { NodeComponent& nodeComponent = static_cast(component); - m_nodeInvalidationSlot.Connect(nodeComponent.OnNodeInvalidation, this, OnNodeInvalidated); + m_nodeInvalidationSlot.Connect(nodeComponent.OnNodeInvalidation, this, &GraphicsComponent::OnNodeInvalidated); InvalidateTransformMatrix(); } diff --git a/examples/DopplerEffect/main.cpp b/examples/DopplerEffect/main.cpp index bf9056399..fd22a2b28 100644 --- a/examples/DopplerEffect/main.cpp +++ b/examples/DopplerEffect/main.cpp @@ -57,7 +57,7 @@ int main() while (sound.GetStatus() == nzSoundStatus_Playing) { // Comme le son se joue dans un thread séparé, on peut mettre en pause le principal régulièrement - int sleepTime = 1000/60 - clock.GetMilliseconds(); // 60 FPS + int sleepTime = int(1000/60 - clock.GetMilliseconds()); // 60 FPS if (sleepTime > 0) NzThread::Sleep(sleepTime); diff --git a/examples/MeshInfos/main.cpp b/examples/MeshInfos/main.cpp index 059b66da2..35d816b44 100644 --- a/examples/MeshInfos/main.cpp +++ b/examples/MeshInfos/main.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/include/Nazara/Core/Bitset.hpp b/include/Nazara/Core/Bitset.hpp index 389455ba0..4fbf582d5 100644 --- a/include/Nazara/Core/Bitset.hpp +++ b/include/Nazara/Core/Bitset.hpp @@ -17,7 +17,7 @@ class NzAbstractHash; template> class NzBitset { - static_assert(std::is_integral() && std::is_unsigned(), "Block must be a unsigned integral type"); + static_assert(std::is_integral::value && std::is_unsigned::value, "Block must be a unsigned integral type"); public: class Bit; diff --git a/include/Nazara/Core/Bitset.inl b/include/Nazara/Core/Bitset.inl index c0d365eea..c8467c27e 100644 --- a/include/Nazara/Core/Bitset.inl +++ b/include/Nazara/Core/Bitset.inl @@ -8,6 +8,12 @@ #include #include +#ifdef NAZARA_COMPILER_MSVC + // Bits tricks require us to disable some warnings under VS + #pragma warning(disable: 4146) + #pragma warning(disable: 4804) +#endif + template NzBitset::NzBitset() : m_bitCount(0) @@ -305,7 +311,7 @@ bool NzBitset::Test(unsigned int bit) const { NazaraAssert(bit < m_bitCount, "Bit index out of range"); - return m_blocks[GetBlockIndex(bit)] & (Block(1U) << GetBitIndex(bit)); + return (m_blocks[GetBlockIndex(bit)] & (Block(1U) << GetBitIndex(bit))) != 0; } template @@ -754,4 +760,10 @@ namespace std } } +#ifdef NAZARA_COMPILER_MSVC + // Reenable those warnings + #pragma warning(default: 4146) + #pragma warning(default: 4804) +#endif + #include diff --git a/include/Nazara/Graphics/AbstractRenderQueue.hpp b/include/Nazara/Graphics/AbstractRenderQueue.hpp index c4d4e070b..e641dcca0 100644 --- a/include/Nazara/Graphics/AbstractRenderQueue.hpp +++ b/include/Nazara/Graphics/AbstractRenderQueue.hpp @@ -23,7 +23,7 @@ class NzMaterial; class NzTexture; struct NzMeshData; -class NAZARA_GRAPHICS_API NzAbstractRenderQueue : NzNonCopyable +class NAZARA_GRAPHICS_API NzAbstractRenderQueue { public: struct DirectionalLight; @@ -31,6 +31,7 @@ class NAZARA_GRAPHICS_API NzAbstractRenderQueue : NzNonCopyable struct SpotLight; NzAbstractRenderQueue() = default; + NzAbstractRenderQueue(const NzAbstractRenderQueue&) = delete; virtual ~NzAbstractRenderQueue(); // Je ne suis vraiment pas fan du nombre de surcharges pour AddBillboards, @@ -53,6 +54,7 @@ class NAZARA_GRAPHICS_API NzAbstractRenderQueue : NzNonCopyable virtual void Clear(bool fully = false); + NzAbstractRenderQueue& operator=(const NzAbstractRenderQueue&) = delete; struct DirectionalLight { diff --git a/include/Nazara/Graphics/AbstractRenderTechnique.hpp b/include/Nazara/Graphics/AbstractRenderTechnique.hpp index b85b9bd35..e6e370307 100644 --- a/include/Nazara/Graphics/AbstractRenderTechnique.hpp +++ b/include/Nazara/Graphics/AbstractRenderTechnique.hpp @@ -19,10 +19,11 @@ class NzAbstractViewer; class NzBackground; struct SceneData; -class NAZARA_GRAPHICS_API NzAbstractRenderTechnique : NzNonCopyable +class NAZARA_GRAPHICS_API NzAbstractRenderTechnique { public: NzAbstractRenderTechnique(); + NzAbstractRenderTechnique(const NzAbstractRenderTechnique&) = delete; virtual ~NzAbstractRenderTechnique(); virtual bool Draw(const NzSceneData& sceneData) const = 0; @@ -35,6 +36,8 @@ class NAZARA_GRAPHICS_API NzAbstractRenderTechnique : NzNonCopyable virtual bool IsInstancingEnabled() const; + NzAbstractRenderTechnique& operator=(const NzAbstractRenderTechnique&) = delete; + protected: bool m_instancingEnabled; }; diff --git a/include/Nazara/Graphics/DeferredRenderQueue.hpp b/include/Nazara/Graphics/DeferredRenderQueue.hpp index e2f40112a..51343251d 100644 --- a/include/Nazara/Graphics/DeferredRenderQueue.hpp +++ b/include/Nazara/Graphics/DeferredRenderQueue.hpp @@ -44,7 +44,7 @@ class NAZARA_GRAPHICS_API NzDeferredRenderQueue : public NzAbstractRenderQueue struct MeshDataComparator { - bool operator()(const NzMeshData& data1, const NzMeshData& data2); + bool operator()(const NzMeshData& data1, const NzMeshData& data2) const; }; struct MeshInstanceEntry @@ -59,7 +59,7 @@ class NAZARA_GRAPHICS_API NzDeferredRenderQueue : public NzAbstractRenderQueue struct BatchedModelMaterialComparator { - bool operator()(const NzMaterial* mat1, const NzMaterial* mat2); + bool operator()(const NzMaterial* mat1, const NzMaterial* mat2) const; }; struct BatchedModelEntry diff --git a/include/Nazara/Graphics/DeferredRenderTechnique.hpp b/include/Nazara/Graphics/DeferredRenderTechnique.hpp index 691689df0..8d73110ba 100644 --- a/include/Nazara/Graphics/DeferredRenderTechnique.hpp +++ b/include/Nazara/Graphics/DeferredRenderTechnique.hpp @@ -60,7 +60,7 @@ class NAZARA_GRAPHICS_API NzDeferredRenderTechnique : public NzAbstractRenderTec struct RenderPassComparator { - bool operator()(nzRenderPassType pass1, nzRenderPassType pass2); + bool operator()(nzRenderPassType pass1, nzRenderPassType pass2) const; }; std::map>, RenderPassComparator> m_passes; diff --git a/include/Nazara/Graphics/ForwardRenderQueue.hpp b/include/Nazara/Graphics/ForwardRenderQueue.hpp index c4f7c7f60..ed799f11d 100644 --- a/include/Nazara/Graphics/ForwardRenderQueue.hpp +++ b/include/Nazara/Graphics/ForwardRenderQueue.hpp @@ -57,7 +57,7 @@ class NAZARA_GRAPHICS_API NzForwardRenderQueue : public NzAbstractRenderQueue struct BatchedBillboardComparator { - bool operator()(const NzMaterial* mat1, const NzMaterial* mat2); + bool operator()(const NzMaterial* mat1, const NzMaterial* mat2) const; }; struct BatchedBillboardEntry @@ -103,7 +103,7 @@ class NAZARA_GRAPHICS_API NzForwardRenderQueue : public NzAbstractRenderQueue /// Meshes struct MeshDataComparator { - bool operator()(const NzMeshData& data1, const NzMeshData& data2); + bool operator()(const NzMeshData& data1, const NzMeshData& data2) const; }; struct MeshInstanceEntry @@ -119,7 +119,7 @@ class NAZARA_GRAPHICS_API NzForwardRenderQueue : public NzAbstractRenderQueue struct BatchedModelMaterialComparator { - bool operator()(const NzMaterial* mat1, const NzMaterial* mat2); + bool operator()(const NzMaterial* mat1, const NzMaterial* mat2) const; }; struct BatchedModelEntry diff --git a/include/Nazara/Lua/LuaClass.inl b/include/Nazara/Lua/LuaClass.inl index 3f5e68c25..04c645018 100644 --- a/include/Nazara/Lua/LuaClass.inl +++ b/include/Nazara/Lua/LuaClass.inl @@ -278,7 +278,7 @@ int NzLuaClass::MethodProxy(lua_State* state) NzLuaInstance& lua = *NzLuaInstance::GetInstance(state); ClassInfo* info = *static_cast(lua.ToUserdata(lua.GetIndexOfUpValue(1))); - int index = lua.ToInteger(lua.GetIndexOfUpValue(2)); + unsigned int index = static_cast(lua.ToInteger(lua.GetIndexOfUpValue(2))); ClassFunc method = info->methods[index]; T& instance = *(*static_cast(lua.CheckUserdata(1, info->name))); @@ -334,7 +334,7 @@ int NzLuaClass::StaticMethodProxy(lua_State* state) NzLuaInstance& lua = *NzLuaInstance::GetInstance(state); ClassInfo* info = *static_cast(lua.ToUserdata(lua.GetIndexOfUpValue(1))); - int index = lua.ToInteger(lua.GetIndexOfUpValue(2)); + unsigned int index = static_cast(lua.ToInteger(lua.GetIndexOfUpValue(2))); StaticFunc method = info->staticMethods[index]; return method(lua); diff --git a/include/Nazara/Math/Algorithm.inl b/include/Nazara/Math/Algorithm.inl index 56869613c..4aa9c86b5 100644 --- a/include/Nazara/Math/Algorithm.inl +++ b/include/Nazara/Math/Algorithm.inl @@ -81,7 +81,7 @@ namespace { // Le masque 32 bits sur la partie du nombre qu'on traite actuellement T mask = T(std::numeric_limits::max()) << i*8; - T val = (number & mask) >> i*8; // Masquage et shifting des bits vers la droite (pour le ramener sur 32bits) + nzUInt32 val = nzUInt32((number & mask) >> i*8); // Masquage et shifting des bits vers la droite (pour le ramener sur 32bits) // Appel de la fonction avec le nombre 32bits, si le résultat est non-nul nous avons la réponse unsigned int log2 = NzImplIntegralLog2Pot(val); diff --git a/src/Nazara/Graphics/DeferredRenderQueue.cpp b/src/Nazara/Graphics/DeferredRenderQueue.cpp index 9b2035911..38941b85f 100644 --- a/src/Nazara/Graphics/DeferredRenderQueue.cpp +++ b/src/Nazara/Graphics/DeferredRenderQueue.cpp @@ -160,7 +160,7 @@ void NzDeferredRenderQueue::OnVertexBufferInvalidation(const NzVertexBuffer* ver } } -bool NzDeferredRenderQueue::BatchedModelMaterialComparator::operator()(const NzMaterial* mat1, const NzMaterial* mat2) +bool NzDeferredRenderQueue::BatchedModelMaterialComparator::operator()(const NzMaterial* mat1, const NzMaterial* mat2) const { const NzUberShader* uberShader1 = mat1->GetShader(); const NzUberShader* uberShader2 = mat2->GetShader(); @@ -180,7 +180,7 @@ bool NzDeferredRenderQueue::BatchedModelMaterialComparator::operator()(const NzM return mat1 < mat2; } -bool NzDeferredRenderQueue::MeshDataComparator::operator()(const NzMeshData& data1, const NzMeshData& data2) +bool NzDeferredRenderQueue::MeshDataComparator::operator()(const NzMeshData& data1, const NzMeshData& data2) const { const NzBuffer* buffer1; const NzBuffer* buffer2; diff --git a/src/Nazara/Graphics/DeferredRenderTechnique.cpp b/src/Nazara/Graphics/DeferredRenderTechnique.cpp index a4fce6799..541e78e55 100644 --- a/src/Nazara/Graphics/DeferredRenderTechnique.cpp +++ b/src/Nazara/Graphics/DeferredRenderTechnique.cpp @@ -569,7 +569,7 @@ void NzDeferredRenderTechnique::Uninitialize() NzShaderLibrary::Unregister("DeferredGaussianBlur"); } -bool NzDeferredRenderTechnique::RenderPassComparator::operator()(nzRenderPassType pass1, nzRenderPassType pass2) +bool NzDeferredRenderTechnique::RenderPassComparator::operator()(nzRenderPassType pass1, nzRenderPassType pass2) const { return RenderPassPriority[pass1] < RenderPassPriority[pass2]; } diff --git a/src/Nazara/Graphics/ForwardRenderQueue.cpp b/src/Nazara/Graphics/ForwardRenderQueue.cpp index c7db7e0e8..10469b1a5 100644 --- a/src/Nazara/Graphics/ForwardRenderQueue.cpp +++ b/src/Nazara/Graphics/ForwardRenderQueue.cpp @@ -560,7 +560,7 @@ void NzForwardRenderQueue::OnVertexBufferInvalidation(const NzVertexBuffer* vert } } -bool NzForwardRenderQueue::BatchedBillboardComparator::operator()(const NzMaterial* mat1, const NzMaterial* mat2) +bool NzForwardRenderQueue::BatchedBillboardComparator::operator()(const NzMaterial* mat1, const NzMaterial* mat2) const { const NzUberShader* uberShader1 = mat1->GetShader(); const NzUberShader* uberShader2 = mat2->GetShader(); @@ -580,7 +580,7 @@ bool NzForwardRenderQueue::BatchedBillboardComparator::operator()(const NzMateri return mat1 < mat2; } -bool NzForwardRenderQueue::BatchedModelMaterialComparator::operator()(const NzMaterial* mat1, const NzMaterial* mat2) +bool NzForwardRenderQueue::BatchedModelMaterialComparator::operator()(const NzMaterial* mat1, const NzMaterial* mat2) const { const NzUberShader* uberShader1 = mat1->GetShader(); const NzUberShader* uberShader2 = mat2->GetShader(); @@ -620,7 +620,7 @@ bool NzForwardRenderQueue::BatchedSpriteMaterialComparator::operator()(const NzM return mat1 < mat2; } -bool NzForwardRenderQueue::MeshDataComparator::operator()(const NzMeshData& data1, const NzMeshData& data2) +bool NzForwardRenderQueue::MeshDataComparator::operator()(const NzMeshData& data1, const NzMeshData& data2) const { const NzBuffer* buffer1; const NzBuffer* buffer2; diff --git a/src/Nazara/Graphics/GuillotineTextureAtlas.cpp b/src/Nazara/Graphics/GuillotineTextureAtlas.cpp index baa477498..16cadbf5a 100644 --- a/src/Nazara/Graphics/GuillotineTextureAtlas.cpp +++ b/src/Nazara/Graphics/GuillotineTextureAtlas.cpp @@ -15,7 +15,7 @@ nzUInt32 NzGuillotineTextureAtlas::GetStorage() const NzAbstractImage* NzGuillotineTextureAtlas::ResizeImage(NzAbstractImage* oldImage, const NzVector2ui& size) const { std::unique_ptr newTexture(new NzTexture); - if (newTexture->Create(nzImageType_2D, nzPixelFormat_A8, size.x, size.y, 1, 0xFF)) + if (newTexture->Create(nzImageType_2D, nzPixelFormat_A8, size.x, size.y, 1)) { if (oldImage) {