From 251e21f00616d08d3c3fc79ff715403fd6854480 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sat, 13 Jun 2015 19:42:07 +0200 Subject: [PATCH] More VS fixes Former-commit-id: 356effb816b9527ff9e89ee3b99074c468455b08 --- .gitignore | 2 ++ build/scripts/common.lua | 1 + include/Nazara/Core/Color.hpp | 20 ++++++------- include/Nazara/Core/SparsePtr.inl | 14 ++++++++++ .../Nazara/Graphics/DeferredGeometryPass.hpp | 1 + .../Graphics/ForwardRenderTechnique.hpp | 2 +- include/Nazara/Graphics/Sprite.hpp | 3 +- include/Nazara/Lua/LuaInstance.hpp | 2 +- include/Nazara/Renderer/RenderTexture.hpp | 4 +-- include/Nazara/Utility/IndexIterator.inl | 14 ++++++++++ src/Nazara/Core/Win32/DynLibImpl.hpp | 1 + src/Nazara/Core/Win32/MutexImpl.hpp | 1 + src/Nazara/Core/Win32/Time.hpp | 1 + src/Nazara/Graphics/Camera.cpp | 4 +-- src/Nazara/Graphics/DeferredGeometryPass.cpp | 4 +-- src/Nazara/Graphics/DeferredRenderQueue.cpp | 6 ++-- .../Graphics/DeferredRenderTechnique.cpp | 16 +++++------ src/Nazara/Graphics/Formats/OBJLoader.cpp | 6 ++-- src/Nazara/Graphics/ForwardRenderQueue.cpp | 28 +++++++++---------- .../Graphics/ForwardRenderTechnique.cpp | 6 ++-- src/Nazara/Graphics/Light.cpp | 2 +- src/Nazara/Graphics/Sprite.cpp | 2 +- src/Nazara/Graphics/TextSprite.cpp | 18 ++++++------ src/Nazara/Graphics/View.cpp | 4 +-- src/Nazara/Lua/LuaInstance.cpp | 2 +- src/Nazara/Renderer/RenderTexture.cpp | 10 +++---- src/Nazara/Renderer/Renderer.cpp | 2 +- src/Nazara/Renderer/Win32/ContextImpl.hpp | 1 + src/Nazara/Utility/Font.cpp | 6 ++-- src/Nazara/Utility/Formats/FreeTypeLoader.cpp | 2 +- src/Nazara/Utility/Image.cpp | 4 +-- src/Nazara/Utility/SimpleTextDrawer.cpp | 8 +++--- src/Nazara/Utility/Win32/CursorImpl.hpp | 1 + src/Nazara/Utility/Win32/IconImpl.hpp | 1 + src/Nazara/Utility/Win32/WindowImpl.hpp | 1 + 35 files changed, 121 insertions(+), 79 deletions(-) diff --git a/.gitignore b/.gitignore index 3de654ef6..dadf0a7f7 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,8 @@ build/scripts/features/index.html *.sln *.vcxprojResolveAssemblyReference.cache *.exp +*.nativecodeanalysis.all.xml +*.nativecodeanalysis.xml # Compiled Object files *.slo diff --git a/build/scripts/common.lua b/build/scripts/common.lua index c0541e848..3a052ac76 100644 --- a/build/scripts/common.lua +++ b/build/scripts/common.lua @@ -67,3 +67,4 @@ configuration { "linux or bsd or macosx", "gmake" } configuration "vs*" defines "_CRT_SECURE_NO_WARNINGS" + defines "_SCL_SECURE_NO_WARNINGS" diff --git a/include/Nazara/Core/Color.hpp b/include/Nazara/Core/Color.hpp index 611fa8e59..7ef42bf7b 100644 --- a/include/Nazara/Core/Color.hpp +++ b/include/Nazara/Core/Color.hpp @@ -11,7 +11,7 @@ #include #include -class NzColor +class NAZARA_API NzColor { public: NzColor(); @@ -47,15 +47,15 @@ class NzColor nzUInt8 r, g, b, a; - static NAZARA_API const NzColor Black; - static NAZARA_API const NzColor Blue; - static NAZARA_API const NzColor Cyan; - static NAZARA_API const NzColor Green; - static NAZARA_API const NzColor Magenta; - static NAZARA_API const NzColor Orange; - static NAZARA_API const NzColor Red; - static NAZARA_API const NzColor Yellow; - static NAZARA_API const NzColor White; + static const NzColor Black; + static const NzColor Blue; + static const NzColor Cyan; + static const NzColor Green; + static const NzColor Magenta; + static const NzColor Orange; + static const NzColor Red; + static const NzColor Yellow; + static const NzColor White; private: static float Hue2RGB(float v1, float v2, float vH); diff --git a/include/Nazara/Core/SparsePtr.inl b/include/Nazara/Core/SparsePtr.inl index 8eece2b69..2ad111798 100644 --- a/include/Nazara/Core/SparsePtr.inl +++ b/include/Nazara/Core/SparsePtr.inl @@ -2,6 +2,7 @@ // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp +#include #include template @@ -244,4 +245,17 @@ bool NzSparsePtr::operator>=(const NzSparsePtr& ptr) const return m_ptr >= ptr.m_ptr; } +namespace std +{ + template + struct iterator_traits> + { + using difference_type = ptrdiff_t; + using iterator_category = random_access_iterator_tag; + using reference = const T&; + using pointer = const T*; + using value_type = T; + }; +} + #include diff --git a/include/Nazara/Graphics/DeferredGeometryPass.hpp b/include/Nazara/Graphics/DeferredGeometryPass.hpp index b8ef4bd55..edb5c5c69 100644 --- a/include/Nazara/Graphics/DeferredGeometryPass.hpp +++ b/include/Nazara/Graphics/DeferredGeometryPass.hpp @@ -11,6 +11,7 @@ #include #include #include +#include class NAZARA_API NzDeferredGeometryPass : public NzDeferredRenderPass { diff --git a/include/Nazara/Graphics/ForwardRenderTechnique.hpp b/include/Nazara/Graphics/ForwardRenderTechnique.hpp index 9726090f9..c22b7acef 100644 --- a/include/Nazara/Graphics/ForwardRenderTechnique.hpp +++ b/include/Nazara/Graphics/ForwardRenderTechnique.hpp @@ -35,7 +35,7 @@ class NAZARA_API NzForwardRenderTechnique : public NzAbstractRenderTechnique private: struct ShaderUniforms; - bool ChooseLights(const NzSpheref& object, bool includeDirectionalLights = true) const; + void ChooseLights(const NzSpheref& object, bool includeDirectionalLights = true) const; void DrawBasicSprites(const NzSceneData& sceneData) const; void DrawBillboards(const NzSceneData& sceneData) const; void DrawOpaqueModels(const NzSceneData& sceneData) const; diff --git a/include/Nazara/Graphics/Sprite.hpp b/include/Nazara/Graphics/Sprite.hpp index ec8945c54..4e5a192ba 100644 --- a/include/Nazara/Graphics/Sprite.hpp +++ b/include/Nazara/Graphics/Sprite.hpp @@ -11,6 +11,7 @@ #include #include #include +#include class NAZARA_API NzSprite : public NzSceneNode { @@ -55,7 +56,7 @@ class NAZARA_API NzSprite : public NzSceneNode NzMaterialRef m_material; NzRectf m_textureCoords; NzVector2f m_size; - mutable NzVertexStruct_XYZ_Color_UV m_vertices[4]; + mutable std::array m_vertices; mutable bool m_verticesUpdated; }; diff --git a/include/Nazara/Lua/LuaInstance.hpp b/include/Nazara/Lua/LuaInstance.hpp index 45bad2276..042d218f7 100644 --- a/include/Nazara/Lua/LuaInstance.hpp +++ b/include/Nazara/Lua/LuaInstance.hpp @@ -96,7 +96,7 @@ class NAZARA_API NzLuaInstance : NzNonCopyable bool IsOfType(int index, const NzString& tname) const; bool IsValid(int index) const; - unsigned int Length(int index) const; + long long Length(int index) const; void MoveTo(NzLuaInstance* instance, int n); diff --git a/include/Nazara/Renderer/RenderTexture.hpp b/include/Nazara/Renderer/RenderTexture.hpp index 9414e6331..194ae4cc1 100644 --- a/include/Nazara/Renderer/RenderTexture.hpp +++ b/include/Nazara/Renderer/RenderTexture.hpp @@ -70,8 +70,8 @@ class NAZARA_API NzRenderTexture : public NzRenderTarget, NzNonCopyable private: void OnContextDestroy(const NzContext* context); - void OnRenderBufferDestroy(const NzRenderBuffer* renderBuffer, int attachmentIndex); - void OnTextureDestroy(const NzTexture* texture, int attachmentIndex); + void OnRenderBufferDestroy(const NzRenderBuffer* renderBuffer, unsigned int attachmentIndex); + void OnTextureDestroy(const NzTexture* texture, unsigned int attachmentIndex); void UpdateDrawBuffers() const; void UpdateSize() const; void UpdateTargets() const; diff --git a/include/Nazara/Utility/IndexIterator.inl b/include/Nazara/Utility/IndexIterator.inl index 38ac4e6f5..7ed06f723 100644 --- a/include/Nazara/Utility/IndexIterator.inl +++ b/include/Nazara/Utility/IndexIterator.inl @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in Config.hpp #include +#include #include inline NzIndexIterator::NzIndexIterator() : @@ -155,4 +156,17 @@ inline NzIndexIterator::Reference::operator nzUInt32() const return m_mapper->Get(m_index); } +namespace std +{ + template<> + struct iterator_traits + { + using difference_type = ptrdiff_t; + using iterator_category = random_access_iterator_tag; + using reference = const NzIndexIterator::Reference&; + using pointer = const NzIndexIterator::Reference*; + using value_type = NzIndexIterator::Reference; + }; +} + #include diff --git a/src/Nazara/Core/Win32/DynLibImpl.hpp b/src/Nazara/Core/Win32/DynLibImpl.hpp index 662524370..cb3f504c5 100644 --- a/src/Nazara/Core/Win32/DynLibImpl.hpp +++ b/src/Nazara/Core/Win32/DynLibImpl.hpp @@ -7,6 +7,7 @@ #ifndef NAZARA_DYNLIBIMPL_HPP #define NAZARA_DYNLIBIMPL_HPP +#include #include #include #include diff --git a/src/Nazara/Core/Win32/MutexImpl.hpp b/src/Nazara/Core/Win32/MutexImpl.hpp index a45b49b0d..7d87edb1b 100644 --- a/src/Nazara/Core/Win32/MutexImpl.hpp +++ b/src/Nazara/Core/Win32/MutexImpl.hpp @@ -7,6 +7,7 @@ #ifndef NAZARA_MUTEXIMPL_HPP #define NAZARA_MUTEXIMPL_HPP +#include #include class NzMutexImpl diff --git a/src/Nazara/Core/Win32/Time.hpp b/src/Nazara/Core/Win32/Time.hpp index e28fe7654..4c374ae76 100644 --- a/src/Nazara/Core/Win32/Time.hpp +++ b/src/Nazara/Core/Win32/Time.hpp @@ -7,6 +7,7 @@ #ifndef NAZARA_WINDOWS_TIME_HPP #define NAZARA_WINDOWS_TIME_HPP +#include #include #include diff --git a/src/Nazara/Graphics/Camera.cpp b/src/Nazara/Graphics/Camera.cpp index 5d985fe41..7fc915e3f 100644 --- a/src/Nazara/Graphics/Camera.cpp +++ b/src/Nazara/Graphics/Camera.cpp @@ -163,8 +163,8 @@ void NzCamera::SetTarget(const NzRenderTarget* renderTarget) if (m_target) { - m_targetReleaseSlot.Connect(m_target->OnRenderTargetRelease, this, OnRenderTargetRelease); - m_targetResizeSlot.Connect(m_target->OnRenderTargetSizeChange, this, OnRenderTargetSizeChange); + m_targetReleaseSlot.Connect(m_target->OnRenderTargetRelease, this, &NzCamera::OnRenderTargetRelease); + m_targetResizeSlot.Connect(m_target->OnRenderTargetSizeChange, this, &NzCamera::OnRenderTargetSizeChange); } else { diff --git a/src/Nazara/Graphics/DeferredGeometryPass.cpp b/src/Nazara/Graphics/DeferredGeometryPass.cpp index 9e4ebb9ba..10fd2a43e 100644 --- a/src/Nazara/Graphics/DeferredGeometryPass.cpp +++ b/src/Nazara/Graphics/DeferredGeometryPass.cpp @@ -241,8 +241,8 @@ const NzDeferredGeometryPass::ShaderUniforms* NzDeferredGeometryPass::GetShaderU if (it == m_shaderUniforms.end()) { ShaderUniforms uniforms; - uniforms.shaderReleaseSlot.Connect(shader->OnShaderRelease, this, OnShaderInvalidated); - uniforms.shaderUniformInvalidatedSlot.Connect(shader->OnShaderUniformInvalidated, this, OnShaderInvalidated); + uniforms.shaderReleaseSlot.Connect(shader->OnShaderRelease, this, &NzDeferredGeometryPass::OnShaderInvalidated); + uniforms.shaderUniformInvalidatedSlot.Connect(shader->OnShaderUniformInvalidated, this, &NzDeferredGeometryPass::OnShaderInvalidated); uniforms.eyePosition = shader->GetUniformLocation("EyePosition"); uniforms.sceneAmbient = shader->GetUniformLocation("SceneAmbient"); diff --git a/src/Nazara/Graphics/DeferredRenderQueue.cpp b/src/Nazara/Graphics/DeferredRenderQueue.cpp index 319b66aad..9b2035911 100644 --- a/src/Nazara/Graphics/DeferredRenderQueue.cpp +++ b/src/Nazara/Graphics/DeferredRenderQueue.cpp @@ -76,7 +76,7 @@ void NzDeferredRenderQueue::AddMesh(const NzMaterial* material, const NzMeshData if (it == opaqueModels.end()) { BatchedModelEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzDeferredRenderQueue::OnMaterialInvalidation); it = opaqueModels.insert(std::make_pair(material, std::move(entry))).first; } @@ -91,9 +91,9 @@ void NzDeferredRenderQueue::AddMesh(const NzMaterial* material, const NzMeshData { MeshInstanceEntry instanceEntry; if (meshData.indexBuffer) - instanceEntry.indexBufferReleaseSlot.Connect(meshData.indexBuffer->OnIndexBufferRelease, this, OnIndexBufferInvalidation); + instanceEntry.indexBufferReleaseSlot.Connect(meshData.indexBuffer->OnIndexBufferRelease, this, &NzDeferredRenderQueue::OnIndexBufferInvalidation); - instanceEntry.vertexBufferReleaseSlot.Connect(meshData.vertexBuffer->OnVertexBufferRelease, this, OnVertexBufferInvalidation); + instanceEntry.vertexBufferReleaseSlot.Connect(meshData.vertexBuffer->OnVertexBufferRelease, this, &NzDeferredRenderQueue::OnVertexBufferInvalidation); it2 = meshMap.insert(std::make_pair(meshData, std::move(instanceEntry))).first; } diff --git a/src/Nazara/Graphics/DeferredRenderTechnique.cpp b/src/Nazara/Graphics/DeferredRenderTechnique.cpp index 72ce11fef..a4fce6799 100644 --- a/src/Nazara/Graphics/DeferredRenderTechnique.cpp +++ b/src/Nazara/Graphics/DeferredRenderTechnique.cpp @@ -132,7 +132,7 @@ m_GBufferSize(0U) { NzErrorFlags errFlags(nzErrorFlag_ThrowExceptionDisabled); - NazaraError("Failed to add geometry and/or phong lighting pass"); + NazaraError("Failed to add geometry and/or phong lighting pass: " + NzString(e.what())); throw; } @@ -143,7 +143,7 @@ m_GBufferSize(0U) } catch (const std::exception& e) { - NazaraWarning("Failed to add FXAA pass"); + NazaraWarning("Failed to add FXAA pass: " + NzString(e.what())); } try @@ -153,7 +153,7 @@ m_GBufferSize(0U) } catch (const std::exception& e) { - NazaraWarning("Failed to add bloom pass"); + NazaraWarning("Failed to add bloom pass: " + NzString(e.what())); } try @@ -165,7 +165,7 @@ m_GBufferSize(0U) } catch (const std::exception& e) { - NazaraWarning("Failed to add DOF pass"); + NazaraWarning("Failed to add DOF pass: " + NzString(e.what())); } try @@ -177,7 +177,7 @@ m_GBufferSize(0U) } catch (const std::exception& e) { - NazaraWarning("Failed to add fog pass"); + NazaraWarning("Failed to add fog pass: " + NzString(e.what())); } try @@ -187,7 +187,7 @@ m_GBufferSize(0U) } catch (const std::exception& e) { - NazaraWarning("Failed to add forward pass"); + NazaraWarning("Failed to add forward pass: " + NzString(e.what())); } try @@ -197,7 +197,7 @@ m_GBufferSize(0U) } catch (const std::exception& e) { - NazaraWarning("Failed to add SSAO pass"); + NazaraWarning("Failed to add SSAO pass: " + NzString(e.what())); } } @@ -420,7 +420,7 @@ bool NzDeferredRenderTechnique::Resize(const NzVector2ui& dimensions) const } catch (const std::exception& e) { - NazaraError("Failed to create work RTT/G-Buffer"); + NazaraError("Failed to create work RTT/G-Buffer: " + NzString(e.what())); return false; } } diff --git a/src/Nazara/Graphics/Formats/OBJLoader.cpp b/src/Nazara/Graphics/Formats/OBJLoader.cpp index 0b500a4b0..80abb7715 100644 --- a/src/Nazara/Graphics/Formats/OBJLoader.cpp +++ b/src/Nazara/Graphics/Formats/OBJLoader.cpp @@ -7,12 +7,12 @@ #include #include #include -#include -#include #include #include #include #include +#include +#include #include #include #include @@ -121,6 +121,8 @@ namespace model->SetMaterial(meshes[i].material, it->second); } + + return true; } bool Load(NzModel* model, NzInputStream& stream, const NzModelParameters& parameters) diff --git a/src/Nazara/Graphics/ForwardRenderQueue.cpp b/src/Nazara/Graphics/ForwardRenderQueue.cpp index b2a229d3e..c7db7e0e8 100644 --- a/src/Nazara/Graphics/ForwardRenderQueue.cpp +++ b/src/Nazara/Graphics/ForwardRenderQueue.cpp @@ -17,7 +17,7 @@ void NzForwardRenderQueue::AddBillboard(const NzMaterial* material, const NzVect if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -45,7 +45,7 @@ void NzForwardRenderQueue::AddBillboards(const NzMaterial* material, unsigned in if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -86,7 +86,7 @@ void NzForwardRenderQueue::AddBillboards(const NzMaterial* material, unsigned in if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -125,7 +125,7 @@ void NzForwardRenderQueue::AddBillboards(const NzMaterial* material, unsigned in if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -170,7 +170,7 @@ void NzForwardRenderQueue::AddBillboards(const NzMaterial* material, unsigned in if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -213,7 +213,7 @@ void NzForwardRenderQueue::AddBillboards(const NzMaterial* material, unsigned in if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -254,7 +254,7 @@ void NzForwardRenderQueue::AddBillboards(const NzMaterial* material, unsigned in if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -293,7 +293,7 @@ void NzForwardRenderQueue::AddBillboards(const NzMaterial* material, unsigned in if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -338,7 +338,7 @@ void NzForwardRenderQueue::AddBillboards(const NzMaterial* material, unsigned in if (it == billboards.end()) { BatchedBillboardEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = billboards.insert(std::make_pair(material, std::move(entry))).first; } @@ -399,7 +399,7 @@ void NzForwardRenderQueue::AddMesh(const NzMaterial* material, const NzMeshData& if (it == opaqueModels.end()) { BatchedModelEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); it = opaqueModels.insert(std::make_pair(material, std::move(entry))).first; } @@ -416,9 +416,9 @@ void NzForwardRenderQueue::AddMesh(const NzMaterial* material, const NzMeshData& instanceEntry.squaredBoundingSphere = meshAABB.GetSquaredBoundingSphere(); if (meshData.indexBuffer) - instanceEntry.indexBufferReleaseSlot.Connect(meshData.indexBuffer->OnIndexBufferRelease, this, OnIndexBufferInvalidation); + instanceEntry.indexBufferReleaseSlot.Connect(meshData.indexBuffer->OnIndexBufferRelease, this, &NzForwardRenderQueue::OnIndexBufferInvalidation); - instanceEntry.vertexBufferReleaseSlot.Connect(meshData.vertexBuffer->OnVertexBufferRelease, this, OnVertexBufferInvalidation); + instanceEntry.vertexBufferReleaseSlot.Connect(meshData.vertexBuffer->OnVertexBufferRelease, this, &NzForwardRenderQueue::OnVertexBufferInvalidation); it2 = meshMap.insert(std::make_pair(meshData, std::move(instanceEntry))).first; } @@ -438,7 +438,7 @@ void NzForwardRenderQueue::AddSprites(const NzMaterial* material, const NzVertex if (matIt == basicSprites.end()) { BatchedBasicSpriteEntry entry; - entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, OnMaterialInvalidation); + entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &NzForwardRenderQueue::OnMaterialInvalidation); matIt = basicSprites.insert(std::make_pair(material, std::move(entry))).first; } @@ -453,7 +453,7 @@ void NzForwardRenderQueue::AddSprites(const NzMaterial* material, const NzVertex { BatchedSpriteEntry overlayEntry; if (overlay) - overlayEntry.textureReleaseSlot.Connect(overlay->OnTextureRelease, this, OnTextureInvalidation); + overlayEntry.textureReleaseSlot.Connect(overlay->OnTextureRelease, this, &NzForwardRenderQueue::OnTextureInvalidation); overlayIt = overlayMap.insert(std::make_pair(overlay, std::move(overlayEntry))).first; } diff --git a/src/Nazara/Graphics/ForwardRenderTechnique.cpp b/src/Nazara/Graphics/ForwardRenderTechnique.cpp index f0c85e607..ed36853d0 100644 --- a/src/Nazara/Graphics/ForwardRenderTechnique.cpp +++ b/src/Nazara/Graphics/ForwardRenderTechnique.cpp @@ -163,7 +163,7 @@ void NzForwardRenderTechnique::Uninitialize() s_quadVertexBuffer.Reset(); } -bool NzForwardRenderTechnique::ChooseLights(const NzSpheref& object, bool includeDirectionalLights) const +void NzForwardRenderTechnique::ChooseLights(const NzSpheref& object, bool includeDirectionalLights) const { m_lights.clear(); @@ -740,8 +740,8 @@ const NzForwardRenderTechnique::ShaderUniforms* NzForwardRenderTechnique::GetSha if (it == m_shaderUniforms.end()) { ShaderUniforms uniforms; - uniforms.shaderReleaseSlot.Connect(shader->OnShaderRelease, this, OnShaderInvalidated); - uniforms.shaderUniformInvalidatedSlot.Connect(shader->OnShaderUniformInvalidated, this, OnShaderInvalidated); + uniforms.shaderReleaseSlot.Connect(shader->OnShaderRelease, this, &NzForwardRenderTechnique::OnShaderInvalidated); + uniforms.shaderUniformInvalidatedSlot.Connect(shader->OnShaderUniformInvalidated, this, &NzForwardRenderTechnique::OnShaderInvalidated); uniforms.eyePosition = shader->GetUniformLocation("EyePosition"); uniforms.sceneAmbient = shader->GetUniformLocation("SceneAmbient"); diff --git a/src/Nazara/Graphics/Light.cpp b/src/Nazara/Graphics/Light.cpp index 06a28dfb6..454b27977 100644 --- a/src/Nazara/Graphics/Light.cpp +++ b/src/Nazara/Graphics/Light.cpp @@ -145,7 +145,7 @@ void NzLight::MakeBoundingVolume() const case nzLightType_Point: { - NzVector3f radius(m_radius * M_SQRT3); + NzVector3f radius(m_radius * float(M_SQRT3)); m_boundingVolume.Set(-radius, radius); break; } diff --git a/src/Nazara/Graphics/Sprite.cpp b/src/Nazara/Graphics/Sprite.cpp index 3e3bdfb00..a4cf6eed3 100644 --- a/src/Nazara/Graphics/Sprite.cpp +++ b/src/Nazara/Graphics/Sprite.cpp @@ -45,7 +45,7 @@ void NzSprite::AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const if (!m_verticesUpdated) UpdateVertices(); - renderQueue->AddSprites(m_material, m_vertices, 1); + renderQueue->AddSprites(m_material, m_vertices.data(), 1); } NzSprite* NzSprite::Clone() const diff --git a/src/Nazara/Graphics/TextSprite.cpp b/src/Nazara/Graphics/TextSprite.cpp index 944a983d1..7373d6a8c 100644 --- a/src/Nazara/Graphics/TextSprite.cpp +++ b/src/Nazara/Graphics/TextSprite.cpp @@ -32,9 +32,9 @@ m_scale(sprite.m_scale) const NzAbstractAtlas* atlas = it->first; AtlasSlots& slots = m_atlases[atlas]; - slots.clearSlot.Connect(atlas->OnAtlasCleared, this, OnAtlasInvalidated); - slots.layerChangeSlot.Connect(atlas->OnAtlasLayerChange, this, OnAtlasLayerChange); - slots.releaseSlot.Connect(atlas->OnAtlasRelease, this, OnAtlasInvalidated); + slots.clearSlot.Connect(atlas->OnAtlasCleared, this, &NzTextSprite::OnAtlasInvalidated); + slots.layerChangeSlot.Connect(atlas->OnAtlasLayerChange, this, &NzTextSprite::OnAtlasLayerChange); + slots.releaseSlot.Connect(atlas->OnAtlasRelease, this, &NzTextSprite::OnAtlasInvalidated); } } @@ -156,9 +156,9 @@ void NzTextSprite::Update(const NzAbstractTextDrawer& drawer) { AtlasSlots& slots = m_atlases[atlas]; - slots.clearSlot.Connect(atlas->OnAtlasCleared, this, OnAtlasInvalidated); - slots.layerChangeSlot.Connect(atlas->OnAtlasLayerChange, this, OnAtlasLayerChange); - slots.releaseSlot.Connect(atlas->OnAtlasRelease, this, OnAtlasInvalidated); + slots.clearSlot.Connect(atlas->OnAtlasCleared, this, &NzTextSprite::OnAtlasInvalidated); + slots.layerChangeSlot.Connect(atlas->OnAtlasLayerChange, this, &NzTextSprite::OnAtlasLayerChange); + slots.releaseSlot.Connect(atlas->OnAtlasRelease, this, &NzTextSprite::OnAtlasInvalidated); } } @@ -262,9 +262,9 @@ NzTextSprite& NzTextSprite::operator=(const NzTextSprite& text) const NzAbstractAtlas* atlas = it->first; AtlasSlots& slots = m_atlases[atlas]; - slots.clearSlot.Connect(atlas->OnAtlasCleared, this, OnAtlasInvalidated); - slots.layerChangeSlot.Connect(atlas->OnAtlasLayerChange, this, OnAtlasLayerChange); - slots.releaseSlot.Connect(atlas->OnAtlasRelease, this, OnAtlasInvalidated); + slots.clearSlot.Connect(atlas->OnAtlasCleared, this, &NzTextSprite::OnAtlasInvalidated); + slots.layerChangeSlot.Connect(atlas->OnAtlasLayerChange, this, &NzTextSprite::OnAtlasLayerChange); + slots.releaseSlot.Connect(atlas->OnAtlasRelease, this, &NzTextSprite::OnAtlasInvalidated); } InvalidateBoundingVolume(); diff --git a/src/Nazara/Graphics/View.cpp b/src/Nazara/Graphics/View.cpp index fbd141967..b05f2ec3a 100644 --- a/src/Nazara/Graphics/View.cpp +++ b/src/Nazara/Graphics/View.cpp @@ -218,8 +218,8 @@ void NzView::SetTarget(const NzRenderTarget* renderTarget) m_target = renderTarget; if (m_target) { - m_targetReleaseSlot.Connect(m_target->OnRenderTargetRelease, this, OnRenderTargetRelease); - m_targetResizeSlot.Connect(m_target->OnRenderTargetSizeChange, this, OnRenderTargetSizeChange); + m_targetReleaseSlot.Connect(m_target->OnRenderTargetRelease, this, &NzView::OnRenderTargetRelease); + m_targetResizeSlot.Connect(m_target->OnRenderTargetSizeChange, this, &NzView::OnRenderTargetSizeChange); } else { diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index 3aa8f9a23..b556253f1 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -589,7 +589,7 @@ bool NzLuaInstance::IsValid(int index) const return lua_isnoneornil(m_state, index) == 0; } -unsigned int NzLuaInstance::Length(int index) const +long long NzLuaInstance::Length(int index) const { return luaL_len(m_state, index); } diff --git a/src/Nazara/Renderer/RenderTexture.cpp b/src/Nazara/Renderer/RenderTexture.cpp index 5279904bb..f2dc61bfc 100644 --- a/src/Nazara/Renderer/RenderTexture.cpp +++ b/src/Nazara/Renderer/RenderTexture.cpp @@ -151,7 +151,7 @@ bool NzRenderTexture::AttachBuffer(nzAttachmentPoint attachmentPoint, nzUInt8 in Attachment& attachment = m_impl->attachments[attachIndex]; attachment.attachmentPoint = attachmentPoint; attachment.buffer = buffer; - attachment.renderBufferDestroySlot.Connect(buffer->OnRenderBufferDestroy, std::bind(OnRenderBufferDestroy, this, std::placeholders::_1, attachIndex)); + attachment.renderBufferDestroySlot.Connect(buffer->OnRenderBufferDestroy, std::bind(&NzRenderTexture::OnRenderBufferDestroy, this, std::placeholders::_1, attachIndex)); attachment.isBuffer = true; attachment.isUsed = true; attachment.height = buffer->GetHeight(); @@ -292,7 +292,7 @@ bool NzRenderTexture::AttachTexture(nzAttachmentPoint attachmentPoint, nzUInt8 i attachment.isUsed = true; attachment.height = texture->GetHeight(); attachment.texture = texture; - attachment.textureDestroySlot.Connect(texture->OnTextureDestroy, std::bind(OnTextureDestroy, this, std::placeholders::_1, attachIndex)); + attachment.textureDestroySlot.Connect(texture->OnTextureDestroy, std::bind(&NzRenderTexture::OnTextureDestroy, this, std::placeholders::_1, attachIndex)); attachment.width = texture->GetWidth(); m_impl->checked = false; @@ -339,7 +339,7 @@ bool NzRenderTexture::Create(bool lock) m_impl = impl.release(); m_impl->context = NzContext::GetCurrent(); - m_impl->contextDestroySlot.Connect(m_impl->context->OnContextDestroy, this, OnContextDestroy); + m_impl->contextDestroySlot.Connect(m_impl->context->OnContextDestroy, this, &NzRenderTexture::OnContextDestroy); if (lock) { @@ -882,7 +882,7 @@ void NzRenderTexture::OnContextDestroy(const NzContext* context) Destroy(); } -void NzRenderTexture::OnRenderBufferDestroy(const NzRenderBuffer* renderBuffer, int attachmentIndex) +void NzRenderTexture::OnRenderBufferDestroy(const NzRenderBuffer* renderBuffer, unsigned int attachmentIndex) { NazaraAssert(m_impl, "Invalid internal state"); NazaraAssert(attachmentIndex < m_impl->attachments.size(), "Invalid attachment index"); @@ -898,7 +898,7 @@ void NzRenderTexture::OnRenderBufferDestroy(const NzRenderBuffer* renderBuffer, m_impl->targetsUpdated = false; } -void NzRenderTexture::OnTextureDestroy(const NzTexture* texture, int attachmentIndex) +void NzRenderTexture::OnTextureDestroy(const NzTexture* texture, unsigned int attachmentIndex) { NazaraAssert(m_impl, "Invalid internal state"); NazaraAssert(attachmentIndex < m_impl->attachments.size(), "Invalid attachment index"); diff --git a/src/Nazara/Renderer/Renderer.cpp b/src/Nazara/Renderer/Renderer.cpp index df9d6d177..ab252a1f1 100644 --- a/src/Nazara/Renderer/Renderer.cpp +++ b/src/Nazara/Renderer/Renderer.cpp @@ -1676,7 +1676,7 @@ bool NzRenderer::EnsureStateUpdate() if (update) { // Pour éviter la duplication de code, on va utiliser une astuce via une boucle for - for (unsigned int i = 0; i < (s_instancing ? 2 : 1); ++i) + for (unsigned int i = 0; i < (s_instancing ? 2U : 1U); ++i) { // Selon l'itération nous choisissons un buffer différent const NzVertexBuffer* vertexBuffer = (i == 0) ? s_vertexBuffer : &s_instanceBuffer; diff --git a/src/Nazara/Renderer/Win32/ContextImpl.hpp b/src/Nazara/Renderer/Win32/ContextImpl.hpp index 07d88d44a..468a7e7c8 100644 --- a/src/Nazara/Renderer/Win32/ContextImpl.hpp +++ b/src/Nazara/Renderer/Win32/ContextImpl.hpp @@ -7,6 +7,7 @@ #ifndef NAZARA_CONTEXTIMPL_HPP #define NAZARA_CONTEXTIMPL_HPP +#include #include #include diff --git a/src/Nazara/Utility/Font.cpp b/src/Nazara/Utility/Font.cpp index c1b69db2b..e723cf03c 100644 --- a/src/Nazara/Utility/Font.cpp +++ b/src/Nazara/Utility/Font.cpp @@ -302,9 +302,9 @@ void NzFont::SetAtlas(const std::shared_ptr& atlas) m_atlas = atlas; if (m_atlas) { - m_atlasClearedSlot.Connect(m_atlas->OnAtlasCleared, this, OnAtlasCleared); - m_atlasLayerChangeSlot.Connect(m_atlas->OnAtlasLayerChange, this, OnAtlasLayerChange); - m_atlasReleaseSlot.Connect(m_atlas->OnAtlasRelease, this, OnAtlasRelease); + m_atlasClearedSlot.Connect(m_atlas->OnAtlasCleared, this, &NzFont::OnAtlasCleared); + m_atlasLayerChangeSlot.Connect(m_atlas->OnAtlasLayerChange, this, &NzFont::OnAtlasLayerChange); + m_atlasReleaseSlot.Connect(m_atlas->OnAtlasRelease, this, &NzFont::OnAtlasRelease); } else { diff --git a/src/Nazara/Utility/Formats/FreeTypeLoader.cpp b/src/Nazara/Utility/Formats/FreeTypeLoader.cpp index bbdfa8597..60fb98f07 100644 --- a/src/Nazara/Utility/Formats/FreeTypeLoader.cpp +++ b/src/Nazara/Utility/Formats/FreeTypeLoader.cpp @@ -303,7 +303,7 @@ namespace m_stream.descriptor.pointer = &stream; m_stream.read = FT_StreamRead; m_stream.pos = 0; - m_stream.size = stream.GetSize(); + m_stream.size = unsigned long(stream.GetSize()); m_args.driver = 0; m_args.flags = FT_OPEN_STREAM; diff --git a/src/Nazara/Utility/Image.cpp b/src/Nazara/Utility/Image.cpp index 48f6eb9d1..e356b4fbb 100644 --- a/src/Nazara/Utility/Image.cpp +++ b/src/Nazara/Utility/Image.cpp @@ -644,7 +644,7 @@ unsigned int NzImage::GetHeight(nzUInt8 level) const nzUInt8 NzImage::GetLevelCount() const { - return m_sharedImage->levels.size(); + return nzUInt8(m_sharedImage->levels.size()); } nzUInt8 NzImage::GetMaxLevel() const @@ -1087,7 +1087,7 @@ void NzImage::SetLevelCount(nzUInt8 levelCount) EnsureOwnership(); - nzUInt8 oldLevelCount = m_sharedImage->levels.size(); + nzUInt8 oldLevelCount = nzUInt8(m_sharedImage->levels.size()); nzUInt8 maxLevelCount = std::max(levelCount, oldLevelCount); m_sharedImage->levels.resize(levelCount); diff --git a/src/Nazara/Utility/SimpleTextDrawer.cpp b/src/Nazara/Utility/SimpleTextDrawer.cpp index 1b38c42a8..2c0ceb889 100644 --- a/src/Nazara/Utility/SimpleTextDrawer.cpp +++ b/src/Nazara/Utility/SimpleTextDrawer.cpp @@ -114,10 +114,10 @@ void NzSimpleTextDrawer::SetFont(NzFont* font) m_font = font; if (m_font) { - m_atlasChangedSlot.Connect(m_font->OnFontAtlasChanged, this, OnFontInvalidated); - m_atlasLayerChangedSlot.Connect(m_font->OnFontAtlasLayerChanged, this, OnFontInvalidated); - m_fontReleaseSlot.Connect(m_font->OnFontRelease, this, OnFontRelease); - m_glyphCacheClearedSlot.Connect(m_font->OnFontAtlasChanged, this, OnFontInvalidated); + m_atlasChangedSlot.Connect(m_font->OnFontAtlasChanged, this, &NzSimpleTextDrawer::OnFontInvalidated); + m_atlasLayerChangedSlot.Connect(m_font->OnFontAtlasLayerChanged, this, &NzSimpleTextDrawer::OnFontInvalidated); + m_fontReleaseSlot.Connect(m_font->OnFontRelease, this, &NzSimpleTextDrawer::OnFontRelease); + m_glyphCacheClearedSlot.Connect(m_font->OnFontAtlasChanged, this, &NzSimpleTextDrawer::OnFontInvalidated); } else { diff --git a/src/Nazara/Utility/Win32/CursorImpl.hpp b/src/Nazara/Utility/Win32/CursorImpl.hpp index d539886c8..9c9b97841 100644 --- a/src/Nazara/Utility/Win32/CursorImpl.hpp +++ b/src/Nazara/Utility/Win32/CursorImpl.hpp @@ -7,6 +7,7 @@ #ifndef NAZARA_CURSORIMPL_HPP #define NAZARA_CURSORIMPL_HPP +#include #include class NzImage; diff --git a/src/Nazara/Utility/Win32/IconImpl.hpp b/src/Nazara/Utility/Win32/IconImpl.hpp index a384fc852..7a77a2662 100644 --- a/src/Nazara/Utility/Win32/IconImpl.hpp +++ b/src/Nazara/Utility/Win32/IconImpl.hpp @@ -7,6 +7,7 @@ #ifndef NAZARA_ICONIMPL_HPP #define NAZARA_ICONIMPL_HPP +#include #include class NzImage; diff --git a/src/Nazara/Utility/Win32/WindowImpl.hpp b/src/Nazara/Utility/Win32/WindowImpl.hpp index 472930b25..c393fcd59 100644 --- a/src/Nazara/Utility/Win32/WindowImpl.hpp +++ b/src/Nazara/Utility/Win32/WindowImpl.hpp @@ -9,6 +9,7 @@ #ifndef NAZARA_WINDOWIMPL_HPP #define NAZARA_WINDOWIMPL_HPP +#include #include #include #include