From 3438d0105a40807c357aafab4ef30f3f79c4fdcd Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 14:08:20 +0200 Subject: [PATCH 01/74] Graphics: Deferred Shading is back! Former-commit-id: 72a1a2d31d0d0b54b596e2ed0e007acc0e206a37 [formerly 87ebaf36f4df323e992833e94ec9628cd5ebc1ad] [formerly 6be175c77c11ffa090106fdc20cf0eaf6dd33159 [formerly d721d20ae53ba078e856c6b968205ebaf71e0151]] Former-commit-id: ab55c5ced8dec7cdc65da9a706bcae1c01a7d0d4 [formerly fd71d68a674972c542387d3342f4c3d61fc4e4da] Former-commit-id: dc7cfadb8b7df4c78919af939380289a6b167354 --- src/Nazara/Graphics/DeferredRenderQueue.cpp | 2 ++ src/Nazara/Renderer/RenderTexture.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Nazara/Graphics/DeferredRenderQueue.cpp b/src/Nazara/Graphics/DeferredRenderQueue.cpp index 8623904a6..7d214b217 100644 --- a/src/Nazara/Graphics/DeferredRenderQueue.cpp +++ b/src/Nazara/Graphics/DeferredRenderQueue.cpp @@ -239,6 +239,8 @@ namespace Nz std::vector& instances = it2->second.instances; instances.push_back(transformMatrix); + + materialEntry.maxInstanceCount = std::max(materialEntry.maxInstanceCount, instances.size()); } } diff --git a/src/Nazara/Renderer/RenderTexture.cpp b/src/Nazara/Renderer/RenderTexture.cpp index c6e78df86..647b8ff91 100644 --- a/src/Nazara/Renderer/RenderTexture.cpp +++ b/src/Nazara/Renderer/RenderTexture.cpp @@ -588,7 +588,7 @@ namespace Nz std::memcpy(&m_impl->colorTargets[0], targets, targetCount*sizeof(UInt8)); m_impl->userDefinedTargets = true; - InvalidateDrawBuffers(); + InvalidateTargets(); } void RenderTexture::SetColorTargets(const std::initializer_list& targets) const @@ -614,7 +614,7 @@ namespace Nz *ptr++ = index; m_impl->userDefinedTargets = true; - InvalidateDrawBuffers(); + InvalidateTargets(); } void RenderTexture::Unlock() const From 89a0911cd015ecd77c05ba15cd86e1f36aa16a99 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 14:09:48 +0200 Subject: [PATCH 02/74] Sdk/RenderSystem: Make ChangeRenderTechnique return a reference to the render technique Former-commit-id: b491fa7480d8eda1602f23b3bb0a08b6c09d28f8 [formerly 1ac08e917aaed955f46b16f5d29b6c2ef5797ea6] [formerly 0b3796950799529a3e617835549fddcae98e18c8 [formerly f75af99a07fadfe5f9d45f3937678d1d8bf355e1]] Former-commit-id: 49e03a24eae8c76cbf8c00309dccce87c8c70546 [formerly 977a6167a3dd4081e2820eb4b2de497775b63796] Former-commit-id: db6c41ed94022aeda37a44fd039b4c98613c2d8f --- SDK/include/NDK/Systems/RenderSystem.hpp | 4 ++-- SDK/include/NDK/Systems/RenderSystem.inl | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/SDK/include/NDK/Systems/RenderSystem.hpp b/SDK/include/NDK/Systems/RenderSystem.hpp index 82e558773..488d1a7d4 100644 --- a/SDK/include/NDK/Systems/RenderSystem.hpp +++ b/SDK/include/NDK/Systems/RenderSystem.hpp @@ -28,8 +28,8 @@ namespace Ndk inline RenderSystem(const RenderSystem& renderSystem); ~RenderSystem() = default; - template void ChangeRenderTechnique(); - inline void ChangeRenderTechnique(std::unique_ptr&& renderTechnique); + template T& ChangeRenderTechnique(); + inline Nz::AbstractRenderTechnique& ChangeRenderTechnique(std::unique_ptr&& renderTechnique); inline const Nz::BackgroundRef& GetDefaultBackground() const; inline const Nz::Matrix4f& GetCoordinateSystemMatrix() const; diff --git a/SDK/include/NDK/Systems/RenderSystem.inl b/SDK/include/NDK/Systems/RenderSystem.inl index b85ace59f..ada237615 100644 --- a/SDK/include/NDK/Systems/RenderSystem.inl +++ b/SDK/include/NDK/Systems/RenderSystem.inl @@ -10,14 +10,15 @@ namespace Ndk } template - inline void RenderSystem::ChangeRenderTechnique() + inline T& RenderSystem::ChangeRenderTechnique() { - ChangeRenderTechnique(std::make_unique()); + return *static_cast(ChangeRenderTechnique(std::make_unique())); } - inline void RenderSystem::ChangeRenderTechnique(std::unique_ptr&& renderTechnique) + inline Nz::AbstractRenderTechnique& RenderSystem::ChangeRenderTechnique(std::unique_ptr&& renderTechnique) { m_renderTechnique = std::move(renderTechnique); + return *m_renderTechnique.get(); } inline const Nz::BackgroundRef& RenderSystem::GetDefaultBackground() const From 61296895735cd72a4f82177d7f31189477f3373e Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 19:10:40 +0200 Subject: [PATCH 03/74] SDK/RenderSystem: Fix an oopsie Former-commit-id: 39097f37160d65977afeb1a77d0f97240d0de4bc [formerly d023ce4e3fc8c5bee4de41aad0ada0d097dcdce9] [formerly b56d291eb2f1fd7aafe41d4e06ef26f972749a2d [formerly 6cf79a55ce9f0bd38e71632d2bdbc6f184663644]] Former-commit-id: 182bb95387da9d7a458cc66c54fbbfb129e2981c [formerly e1a59dc5dd4c5613a65b3432dd87f6b0d45d93a2] Former-commit-id: a32ac33b30934f7ff6b483fe31d4a17608861e0d --- SDK/include/NDK/Systems/RenderSystem.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDK/include/NDK/Systems/RenderSystem.inl b/SDK/include/NDK/Systems/RenderSystem.inl index ada237615..4f7afe63d 100644 --- a/SDK/include/NDK/Systems/RenderSystem.inl +++ b/SDK/include/NDK/Systems/RenderSystem.inl @@ -12,7 +12,7 @@ namespace Ndk template inline T& RenderSystem::ChangeRenderTechnique() { - return *static_cast(ChangeRenderTechnique(std::make_unique())); + return static_cast(ChangeRenderTechnique(std::make_unique())); } inline Nz::AbstractRenderTechnique& RenderSystem::ChangeRenderTechnique(std::unique_ptr&& renderTechnique) From 5ebff77ef0ce3d5aee2a413f3193c8d086ae7088 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 22:17:55 +0200 Subject: [PATCH 04/74] Fix compilation with GCC/Clang Thanks to @Gawaboumga Former-commit-id: c2ecad3d8c0bad06cb47b906829585c8d0b910c0 [formerly 7790b792e730ed65c3e8b8dddbd91b1527631e2e] [formerly ae62fe532d14dd33bfc88cf7bca1d19e63487a3f [formerly 41b273ee595cc56c6145651fb4caa1ceca0b2bf6]] Former-commit-id: 7d4c3b3d0b48235a6c3534154c5787738440b2ae [formerly 96dcb709ba81c5696ba633b06e887007d5d9caf5] Former-commit-id: 2a2013af6d26bb64362d1edd2e6aacaac000708f --- SDK/include/NDK/Systems/ParticleSystem.hpp | 2 ++ build/scripts/tools/ndk_server.lua | 2 ++ include/Nazara/Core/Algorithm.inl | 2 +- include/Nazara/Graphics/MaterialPipeline.inl | 6 +++--- src/Nazara/Graphics/MaterialPipeline.cpp | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/SDK/include/NDK/Systems/ParticleSystem.hpp b/SDK/include/NDK/Systems/ParticleSystem.hpp index 3ae00a995..61149b206 100644 --- a/SDK/include/NDK/Systems/ParticleSystem.hpp +++ b/SDK/include/NDK/Systems/ParticleSystem.hpp @@ -4,6 +4,7 @@ #pragma once +#ifndef NDK_SERVER #ifndef NDK_SYSTEMS_PARTICLESYSTEM_HPP #define NDK_SYSTEMS_PARTICLESYSTEM_HPP @@ -27,3 +28,4 @@ namespace Ndk #include #endif // NDK_SYSTEMS_PARTICLESYSTEM_HPP +#endif // NDK_SERVER diff --git a/build/scripts/tools/ndk_server.lua b/build/scripts/tools/ndk_server.lua index e536f1036..aa8548b80 100644 --- a/build/scripts/tools/ndk_server.lua +++ b/build/scripts/tools/ndk_server.lua @@ -30,6 +30,8 @@ TOOL.FilesExcluded = { "../SDK/**/LightComponent.*", "../SDK/**/ListenerComponent.*", "../SDK/**/ListenerSystem.*", + "../SDK/**/Particle*Component.*", + "../SDK/**/ParticleSystem.*", "../SDK/**/RenderSystem.*", "../SDK/**/LuaBinding_Audio.*", "../SDK/**/LuaBinding_Graphics.*", diff --git a/include/Nazara/Core/Algorithm.inl b/include/Nazara/Core/Algorithm.inl index c77a5c3bb..0cadd1631 100644 --- a/include/Nazara/Core/Algorithm.inl +++ b/include/Nazara/Core/Algorithm.inl @@ -124,7 +124,7 @@ namespace Nz template constexpr std::size_t CountOf(T(&name)[N]) noexcept { - NazaraUnused(name); + // NazaraUnused(name); //< Because "body of function is not a return-statement" >.> return N; } diff --git a/include/Nazara/Graphics/MaterialPipeline.inl b/include/Nazara/Graphics/MaterialPipeline.inl index ebd94a9ee..ce937883d 100644 --- a/include/Nazara/Graphics/MaterialPipeline.inl +++ b/include/Nazara/Graphics/MaterialPipeline.inl @@ -61,7 +61,7 @@ namespace Nz if (!operator==(static_cast(lhs), static_cast(rhs))) return false; - #define NazaraPipelineMember(field) if (lhs.##field != rhs.##field) return false + #define NazaraPipelineMember(field) if (lhs.field != rhs.field) return false #define NazaraPipelineBoolMember NazaraPipelineMember NazaraPipelineBoolMember(alphaTest); @@ -115,8 +115,8 @@ namespace std Nz::UInt16 parameterHash = 0; Nz::UInt16 parameterIndex = 0; - #define NazaraPipelineMember(member) Nz::HashCombine(seed, pipelineInfo.##member) - #define NazaraPipelineBoolMember(member) parameterHash |= ((pipelineInfo.##member) ? 1U : 0U) << (parameterIndex++) + #define NazaraPipelineMember(member) Nz::HashCombine(seed, pipelineInfo.member) + #define NazaraPipelineBoolMember(member) parameterHash |= ((pipelineInfo.member) ? 1U : 0U) << (parameterIndex++) NazaraPipelineBoolMember(alphaTest); NazaraPipelineBoolMember(depthSorting); diff --git a/src/Nazara/Graphics/MaterialPipeline.cpp b/src/Nazara/Graphics/MaterialPipeline.cpp index 01e9ffe5d..4cbd56274 100644 --- a/src/Nazara/Graphics/MaterialPipeline.cpp +++ b/src/Nazara/Graphics/MaterialPipeline.cpp @@ -49,8 +49,8 @@ namespace Nz */ MaterialPipelineRef MaterialPipeline::GetPipeline(const MaterialPipelineInfo& pipelineInfo) { - auto it = s_pipelineCache.lower_bound(pipelineInfo); - if (it == s_pipelineCache.end() || it->first != pipelineInfo) + auto it = s_pipelineCache.find(pipelineInfo); + if (it == s_pipelineCache.end()) it = s_pipelineCache.insert(it, PipelineCache::value_type(pipelineInfo, New(pipelineInfo))); return it->second; From 0668988a0f44606e7eb7e2c75bd3da2361b3dd36 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 22:52:29 +0200 Subject: [PATCH 05/74] SDK/ParticleGroupComponent: Add [Add|Remove]Emitter methods taking an entity The entity must have a ParticleEmitterComponent Former-commit-id: 4b6398f047dfee8d04d94f15634b9038078a609f [formerly 36b19eaef4fea6c2d16268c03a369c4797328693] [formerly c8a88f2feb4f80f88899d0ec8c3c0ff1bfad7723 [formerly dd95678311adfaa838dec8a31582f034e6321912]] Former-commit-id: 11cd0fb53279a586f39bafcf205289a945e4c568 [formerly f698d4deae6a0a0a06759acef864af778b7967ca] Former-commit-id: 660b25d6021b2f770d8d2c94240dbdacfa41f48a --- .../NDK/Components/ParticleGroupComponent.hpp | 6 +++++ .../NDK/Components/ParticleGroupComponent.inl | 23 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.hpp b/SDK/include/NDK/Components/ParticleGroupComponent.hpp index 638f877d3..0dce5dd23 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.hpp +++ b/SDK/include/NDK/Components/ParticleGroupComponent.hpp @@ -25,6 +25,12 @@ namespace Ndk ParticleGroupComponent(const ParticleGroupComponent&) = default; ~ParticleGroupComponent() = default; + void AddEmitter(Entity* emitter); + using ParticleGroup::AddEmitter; + + void RemoveEmitter(Entity* emitter); + using ParticleGroup::RemoveEmitter; + static ComponentIndex componentIndex; }; } diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.inl b/SDK/include/NDK/Components/ParticleGroupComponent.inl index 7aefdad56..c6e0cba7b 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.inl +++ b/SDK/include/NDK/Components/ParticleGroupComponent.inl @@ -1,8 +1,11 @@ -#include "ParticleGroupComponent.hpp" // Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp +#include +#include +#include + namespace Ndk { inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) : @@ -14,4 +17,22 @@ namespace Ndk ParticleGroup(maxParticleCount, std::move(declaration)) { } + + inline void ParticleGroupComponent::AddEmitter(Entity* emitter) + { + NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); + NazaraAssert(emitter->HasComponent(), "Entity must have a NodeComponent"); + + auto& emitterComponent = emitter->GetComponent(); + ParticleGroup::AddEmitter(&emitterComponent); + } + + inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter) + { + NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); + NazaraAssert(emitter->HasComponent(), "Entity must have a NodeComponent"); + + auto& emitterComponent = emitter->GetComponent(); + ParticleGroup::RemoveEmitter(&emitterComponent); + } } From a87e5fb823918de7c446b1813eb2ecd653bd7e74 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 23:12:22 +0200 Subject: [PATCH 06/74] Renderer/RenderStates: Fix compilation with GCC/Clang Former-commit-id: 94415ad48c519f7e243932d63213bc2769126773 [formerly 226fbf0a755fe6897361b25816fb819d1f6e761a] [formerly df91cbb488e40b5edc59408e860ec325ec01e746 [formerly b6284bcf325ae1b2d64ee1f225c41993ec3b8cd3]] Former-commit-id: b938d3c4b782c95a9f024f23856e3207b1ae5813 [formerly 31544309ddd428a189898b6a72c169958519224a] Former-commit-id: 36ad48f83668aacdbd60a5c830aa7b82a216ce9d --- include/Nazara/Renderer/RenderStates.inl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/Nazara/Renderer/RenderStates.inl b/include/Nazara/Renderer/RenderStates.inl index d9b6bfc31..9b7c1be62 100644 --- a/include/Nazara/Renderer/RenderStates.inl +++ b/include/Nazara/Renderer/RenderStates.inl @@ -12,9 +12,9 @@ namespace Nz { bool operator==(const RenderStates& lhs, const RenderStates& rhs) { - #define NazaraRenderStateMember(field) if (lhs.##field != rhs.##field) return false + #define NazaraRenderStateMember(field) if (lhs.field != rhs.field) return false #define NazaraRenderStateBoolMember NazaraRenderStateMember - #define NazaraRenderStateFloatMember(field, maxDiff) if (!NumberEquals(lhs.##field, rhs.##field, maxDiff)) return false + #define NazaraRenderStateFloatMember(field, maxDiff) if (!NumberEquals(lhs.field, rhs.field, maxDiff)) return false NazaraRenderStateBoolMember(blending); NazaraRenderStateBoolMember(colorWrite); @@ -81,10 +81,10 @@ namespace std Nz::UInt8 parameterHash = 0; Nz::UInt8 parameterIndex = 0; - #define NazaraRenderStateMember(member) Nz::HashCombine(seed, pipelineInfo.##member) - #define NazaraRenderStateBoolMember(member) parameterHash |= ((pipelineInfo.##member) ? 1U : 0U) << (parameterIndex++) - #define NazaraRenderStateBoolMemberDep(dependency, member) parameterHash |= ((pipelineInfo.##dependency && pipelineInfo.##member) ? 1U : 0U) << (parameterIndex++) - #define NazaraRenderStateFloatMember(member, maxDiff) Nz::HashCombine(seed, std::floor(pipelineInfo.##member / maxDiff) * maxDiff) + #define NazaraRenderStateMember(member) Nz::HashCombine(seed, pipelineInfo.member) + #define NazaraRenderStateBoolMember(member) parameterHash |= ((pipelineInfo.member) ? 1U : 0U) << (parameterIndex++) + #define NazaraRenderStateBoolMemberDep(dependency, member) parameterHash |= ((pipelineInfo.dependency && pipelineInfo.member) ? 1U : 0U) << (parameterIndex++) + #define NazaraRenderStateFloatMember(member, maxDiff) Nz::HashCombine(seed, std::floor(pipelineInfo.member / maxDiff) * maxDiff) NazaraRenderStateBoolMember(blending); NazaraRenderStateBoolMember(colorWrite); From 0aa9658dd472c259a90f9f6dfbc461bef773923f Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 23:17:25 +0200 Subject: [PATCH 07/74] Ditto Former-commit-id: 5cb29c2fb4f8784b32ee827747d6a6c9817610cd [formerly b829d211af88b307682c2da13f1c90c809b3f7cb] [formerly f06859f02d279137edb3372b2b31932b702e380d [formerly 5395decad1eb27038bbecbd31569e91625f09123]] Former-commit-id: 6c3355cf30e066eb3a76b9faf418f3f97efbaada [formerly 54aee068e98e897122f2b23a5bff7f4bb879db93] Former-commit-id: 17b48986c81e954b632650594cfadbde5d64d23e --- include/Nazara/Renderer/RenderStates.inl | 72 ++++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/include/Nazara/Renderer/RenderStates.inl b/include/Nazara/Renderer/RenderStates.inl index 9b7c1be62..525491162 100644 --- a/include/Nazara/Renderer/RenderStates.inl +++ b/include/Nazara/Renderer/RenderStates.inl @@ -81,59 +81,59 @@ namespace std Nz::UInt8 parameterHash = 0; Nz::UInt8 parameterIndex = 0; - #define NazaraRenderStateMember(member) Nz::HashCombine(seed, pipelineInfo.member) - #define NazaraRenderStateBoolMember(member) parameterHash |= ((pipelineInfo.member) ? 1U : 0U) << (parameterIndex++) - #define NazaraRenderStateBoolMemberDep(dependency, member) parameterHash |= ((pipelineInfo.dependency && pipelineInfo.member) ? 1U : 0U) << (parameterIndex++) - #define NazaraRenderStateFloatMember(member, maxDiff) Nz::HashCombine(seed, std::floor(pipelineInfo.member / maxDiff) * maxDiff) + #define NazaraRenderStateBool(member) parameterHash |= ((pipelineInfo.member) ? 1U : 0U) << (parameterIndex++) + #define NazaraRenderStateBoolDep(dependency, member) parameterHash |= ((pipelineInfo.dependency && pipelineInfo.member) ? 1U : 0U) << (parameterIndex++) + #define NazaraRenderStateEnum(member) Nz::HashCombine(seed, static_cast(pipelineInfo.member)) + #define NazaraRenderStateFloat(member, maxDiff) Nz::HashCombine(seed, std::floor(pipelineInfo.member / maxDiff) * maxDiff) - NazaraRenderStateBoolMember(blending); - NazaraRenderStateBoolMember(colorWrite); - NazaraRenderStateBoolMember(depthBuffer); - NazaraRenderStateBoolMember(faceCulling); - NazaraRenderStateBoolMember(scissorTest); - NazaraRenderStateBoolMember(stencilTest); + NazaraRenderStateBool(blending); + NazaraRenderStateBool(colorWrite); + NazaraRenderStateBool(depthBuffer); + NazaraRenderStateBool(faceCulling); + NazaraRenderStateBool(scissorTest); + NazaraRenderStateBool(stencilTest); - NazaraRenderStateBoolMemberDep(depthBuffer, depthWrite); + NazaraRenderStateBoolDep(depthBuffer, depthWrite); - NazaraRenderStateMember(faceFilling); + NazaraRenderStateEnum(faceFilling); if (pipelineInfo.blending) //< Remember, at this time we know lhs.blending == rhs.blending { - NazaraRenderStateMember(dstBlend); - NazaraRenderStateMember(srcBlend); + NazaraRenderStateEnum(dstBlend); + NazaraRenderStateEnum(srcBlend); } if (pipelineInfo.depthBuffer) - NazaraRenderStateMember(depthFunc); + NazaraRenderStateEnum(depthFunc); if (pipelineInfo.faceCulling) - NazaraRenderStateMember(cullingSide); + NazaraRenderStateEnum(cullingSide); if (pipelineInfo.stencilTest) { - NazaraRenderStateMember(stencilCompare.back); - NazaraRenderStateMember(stencilCompare.front); - NazaraRenderStateMember(stencilCompareMask.back); - NazaraRenderStateMember(stencilCompareMask.front); - NazaraRenderStateMember(stencilDepthFail.back); - NazaraRenderStateMember(stencilDepthFail.front); - NazaraRenderStateMember(stencilFail.back); - NazaraRenderStateMember(stencilFail.front); - NazaraRenderStateMember(stencilPass.back); - NazaraRenderStateMember(stencilPass.front); - NazaraRenderStateMember(stencilReference.back); - NazaraRenderStateMember(stencilReference.front); - NazaraRenderStateMember(stencilWriteMask.back); - NazaraRenderStateMember(stencilWriteMask.front); + NazaraRenderStateEnum(stencilCompare.back); + NazaraRenderStateEnum(stencilCompare.front); + NazaraRenderStateEnum(stencilCompareMask.back); + NazaraRenderStateEnum(stencilCompareMask.front); + NazaraRenderStateEnum(stencilDepthFail.back); + NazaraRenderStateEnum(stencilDepthFail.front); + NazaraRenderStateEnum(stencilFail.back); + NazaraRenderStateEnum(stencilFail.front); + NazaraRenderStateEnum(stencilPass.back); + NazaraRenderStateEnum(stencilPass.front); + NazaraRenderStateEnum(stencilReference.back); + NazaraRenderStateEnum(stencilReference.front); + NazaraRenderStateEnum(stencilWriteMask.back); + NazaraRenderStateEnum(stencilWriteMask.front); } - NazaraRenderStateFloatMember(lineWidth, 0.001f); - NazaraRenderStateFloatMember(pointSize, 0.001f); + NazaraRenderStateFloat(lineWidth, 0.001f); + NazaraRenderStateFloat(pointSize, 0.001f); - #undef NazaraRenderStateMember - #undef NazaraRenderStateBoolMember - #undef NazaraRenderStateBoolMemberDep - #undef NazaraRenderStateFloatMember + #undef NazaraRenderStateBool + #undef NazaraRenderStateBoolDep + #undef NazaraRenderStateEnum + #undef NazaraRenderStateFloat Nz::HashCombine(seed, parameterHash); From 11d483f115568c03c1f3f350b1ce926e50f1463c Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 23:18:49 +0200 Subject: [PATCH 08/74] Graphics/ParticleGroup: Fix include name Former-commit-id: 6910ca1bf41e8455aaeb47d3f1cb290d2b479773 [formerly 3ed3685948c3951fd3f5a5df849b589a7e694d9a] [formerly c19e4f0a5c132cb9166699ecb8567b3033ee5f3c [formerly cd43d0051605d1f9fadedce942fa0d003aa8bf19]] Former-commit-id: a80b02ea1a4dfb50fdc0c9e96cff3f2f83fd7792 [formerly 6d9a8f7d96e315d1bc00e2d9c511748f5d91a8dd] Former-commit-id: 48107f17ea36a31f7f39b8d563e3eab0a49ffa36 --- include/Nazara/Graphics/ParticleGroup.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Nazara/Graphics/ParticleGroup.hpp b/include/Nazara/Graphics/ParticleGroup.hpp index 9e48d5797..409090284 100644 --- a/include/Nazara/Graphics/ParticleGroup.hpp +++ b/include/Nazara/Graphics/ParticleGroup.hpp @@ -8,7 +8,7 @@ #define NAZARA_PARTICLEGROUP_HPP #include -#include +#include #include #include #include From 54c9097cd150255803c3d6da4a30808cdaab0af8 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 23:50:51 +0200 Subject: [PATCH 09/74] Core/Log: Fix errors not being written in NazaraLog.log >.> Former-commit-id: adce8a3bc0bb64259737b27298df4551cf6cad7d [formerly f9acff41d4178b0156115c0346342d9ed0121874] [formerly 0e35f200661e175a12426683abad5ae474297872 [formerly e56e7a3d51be5c79e8f975639c7eac0be7910d8f]] Former-commit-id: f38cd83510fd55b1d5b4a6d9635963974367431a [formerly 463d76ed049ddc1bfd8e38f29b9f06dc2dd6f008] Former-commit-id: c053b343069348176fa824df9e2fd84e89a602bf --- include/Nazara/Core/Signal.hpp | 2 +- include/Nazara/Core/Signal.inl | 7 +++++++ src/Nazara/Core/AbstractLogger.cpp | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/Nazara/Core/Signal.hpp b/include/Nazara/Core/Signal.hpp index 613502f80..b7aebe591 100644 --- a/include/Nazara/Core/Signal.hpp +++ b/include/Nazara/Core/Signal.hpp @@ -34,7 +34,7 @@ namespace Nz Signal(); Signal(const Signal&) = delete; Signal(Signal&& signal); - ~Signal() = default; + ~Signal(); void Clear(); diff --git a/include/Nazara/Core/Signal.inl b/include/Nazara/Core/Signal.inl index 466d87537..d8ea871c6 100644 --- a/include/Nazara/Core/Signal.inl +++ b/include/Nazara/Core/Signal.inl @@ -36,6 +36,12 @@ namespace Nz operator=(std::move(signal)); } + template + Signal::~Signal() + { + NazaraWarning("~Signal(" + String::Pointer(this) + ')'); + } + /*! * \brief Clears the list of actions attached to the signal */ @@ -429,3 +435,4 @@ namespace Nz } #include +#include "Signal.hpp" diff --git a/src/Nazara/Core/AbstractLogger.cpp b/src/Nazara/Core/AbstractLogger.cpp index ceac9eff8..a1bf859a7 100644 --- a/src/Nazara/Core/AbstractLogger.cpp +++ b/src/Nazara/Core/AbstractLogger.cpp @@ -47,5 +47,7 @@ namespace Nz if (line != 0 && file && function) stream << " (" << file << ':' << line << ": " << function << ')'; + + Write(stream); } } From 3f899d24aaa49b9c9bbce2ad310c2b4d15ed889c Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 11 Aug 2016 00:04:10 +0200 Subject: [PATCH 10/74] Graphics: Allow OpenGL 3.3 to use the engine (with shadow disabled) I still have a figure a better solution Former-commit-id: b183688bb05e98ba75f046b21aa10de3e7d8c329 [formerly 455fea0feb41b47325d0ca67b37edc4bbdf72251] [formerly 51570bc5776af09f35ffeec175361d5a68c6b3f6 [formerly 0361f22475e3064ed871cc13058b15098f45570d]] Former-commit-id: 28efac6ddbe03f3d53e48072f20ea2353b45035f [formerly d68e985e7016c3e307cf55e882ff70507363985f] Former-commit-id: ac4958f4df3df5f9c3847b14524cc275027c1ace --- .../Graphics/Resources/Shaders/PhongLighting/core.frag | 7 +++++++ .../Graphics/Resources/Shaders/PhongLighting/core.frag.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag b/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag index a3391be91..d5eef7a3c 100644 --- a/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag +++ b/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag @@ -2,6 +2,13 @@ layout(early_fragment_tests) in; #endif +// HACK UNTIL PROPER FIX +#if GLSL_VERSION < 400 + #undef SHADOW_MAPPING + #define SHADOW_MAPPING 0 +#endif +// HACK + #define LIGHT_DIRECTIONAL 0 #define LIGHT_POINT 1 #define LIGHT_SPOT 2 diff --git a/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag.h b/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag.h index c77a33db2..650b62ccd 100644 --- a/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag.h +++ b/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag.h @@ -1 +1 @@ -35,105,102,32,69,65,82,76,89,95,70,82,65,71,77,69,78,84,95,84,69,83,84,83,32,38,38,32,33,65,76,80,72,65,95,84,69,83,84,10,108,97,121,111,117,116,40,101,97,114,108,121,95,102,114,97,103,109,101,110,116,95,116,101,115,116,115,41,32,105,110,59,10,35,101,110,100,105,102,10,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,32,48,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,80,79,73,78,84,32,49,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,83,80,79,84,32,50,10,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,69,110,116,114,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,10,105,110,32,118,101,99,52,32,118,67,111,108,111,114,59,10,105,110,32,118,101,99,52,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,51,93,59,10,105,110,32,109,97,116,51,32,118,76,105,103,104,116,84,111,87,111,114,108,100,59,10,105,110,32,118,101,99,51,32,118,78,111,114,109,97,108,59,10,105,110,32,118,101,99,50,32,118,84,101,120,67,111,111,114,100,59,10,105,110,32,118,101,99,51,32,118,86,105,101,119,68,105,114,59,10,105,110,32,118,101,99,51,32,118,87,111,114,108,100,80,111,115,59,10,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,83,111,114,116,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,49,59,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,50,59,10,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,85,110,105,102,111,114,109,101,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,10,115,116,114,117,99,116,32,76,105,103,104,116,10,123,10,9,105,110,116,32,116,121,112,101,59,10,9,118,101,99,52,32,99,111,108,111,114,59,10,9,118,101,99,50,32,102,97,99,116,111,114,115,59,10,10,9,118,101,99,52,32,112,97,114,97,109,101,116,101,114,115,49,59,10,9,118,101,99,52,32,112,97,114,97,109,101,116,101,114,115,50,59,10,9,118,101,99,50,32,112,97,114,97,109,101,116,101,114,115,51,59,10,9,98,111,111,108,32,115,104,97,100,111,119,77,97,112,112,105,110,103,59,10,125,59,10,10,47,47,32,76,117,109,105,195,168,114,101,115,10,117,110,105,102,111,114,109,32,76,105,103,104,116,32,76,105,103,104,116,115,91,51,93,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,67,117,98,101,32,80,111,105,110,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,51,93,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,51,93,59,10,10,47,47,32,77,97,116,195,169,114,105,97,117,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,59,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,59,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,69,109,105,115,115,105,118,101,77,97,112,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,72,101,105,103,104,116,77,97,112,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,59,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,59,10,10,47,47,32,65,117,116,114,101,115,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,80,97,114,97,108,108,97,120,66,105,97,115,32,61,32,45,48,46,48,51,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,80,97,114,97,108,108,97,120,83,99,97,108,101,32,61,32,48,46,48,50,59,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,117,110,105,102,111,114,109,32,118,101,99,51,32,69,121,101,80,111,115,105,116,105,111,110,59,10,117,110,105,102,111,114,109,32,118,101,99,52,32,83,99,101,110,101,65,109,98,105,101,110,116,59,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,84,101,120,116,117,114,101,79,118,101,114,108,97,121,59,10,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,70,111,110,99,116,105,111,110,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,10,118,101,99,51,32,70,108,111,97,116,84,111,67,111,108,111,114,40,102,108,111,97,116,32,102,41,10,123,10,9,118,101,99,51,32,99,111,108,111,114,59,10,10,9,102,32,42,61,32,50,53,54,46,48,59,10,9,99,111,108,111,114,46,120,32,61,32,102,108,111,111,114,40,102,41,59,10,10,9,102,32,61,32,40,102,32,45,32,99,111,108,111,114,46,120,41,32,42,32,50,53,54,46,48,59,10,9,99,111,108,111,114,46,121,32,61,32,102,108,111,111,114,40,102,41,59,10,10,9,99,111,108,111,114,46,122,32,61,32,102,32,45,32,99,111,108,111,114,46,121,59,10,9,99,111,108,111,114,46,120,121,32,42,61,32,48,46,48,48,51,57,48,54,50,53,59,32,47,47,32,42,61,32,49,46,48,47,50,53,54,10,10,9,114,101,116,117,114,110,32,99,111,108,111,114,59,10,125,10,10,35,100,101,102,105,110,101,32,107,80,73,32,51,46,49,52,49,53,57,50,54,53,51,54,10,10,118,101,99,52,32,69,110,99,111,100,101,78,111,114,109,97,108,40,105,110,32,118,101,99,51,32,110,111,114,109,97,108,41,10,123,10,9,47,47,114,101,116,117,114,110,32,118,101,99,52,40,110,111,114,109,97,108,42,48,46,53,32,43,32,48,46,53,44,32,48,46,48,41,59,10,9,114,101,116,117,114,110,32,118,101,99,52,40,118,101,99,50,40,97,116,97,110,40,110,111,114,109,97,108,46,121,44,32,110,111,114,109,97,108,46,120,41,47,107,80,73,44,32,110,111,114,109,97,108,46,122,41,44,32,48,46,48,44,32,48,46,48,41,59,10,125,10,10,102,108,111,97,116,32,86,101,99,116,111,114,84,111,68,101,112,116,104,86,97,108,117,101,40,118,101,99,51,32,118,101,99,44,32,102,108,111,97,116,32,122,78,101,97,114,44,32,102,108,111,97,116,32,122,70,97,114,41,10,123,10,9,118,101,99,51,32,97,98,115,86,101,99,32,61,32,97,98,115,40,118,101,99,41,59,10,9,102,108,111,97,116,32,108,111,99,97,108,90,32,61,32,109,97,120,40,97,98,115,86,101,99,46,120,44,32,109,97,120,40,97,98,115,86,101,99,46,121,44,32,97,98,115,86,101,99,46,122,41,41,59,10,10,9,102,108,111,97,116,32,110,111,114,109,90,32,61,32,40,40,122,70,97,114,32,43,32,122,78,101,97,114,41,32,42,32,108,111,99,97,108,90,32,45,32,40,50,46,48,42,122,70,97,114,42,122,78,101,97,114,41,41,32,47,32,40,40,122,70,97,114,32,45,32,122,78,101,97,114,41,42,108,111,99,97,108,90,41,59,10,9,114,101,116,117,114,110,32,40,110,111,114,109,90,32,43,32,49,46,48,41,32,42,32,48,46,53,59,10,125,10,10,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,41,10,123,10,9,118,101,99,52,32,108,105,103,104,116,83,112,97,99,101,80,111,115,32,61,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,108,105,103,104,116,73,110,100,101,120,93,59,10,9,114,101,116,117,114,110,32,40,116,101,120,116,117,114,101,40,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,120,121,41,46,120,32,62,61,32,40,108,105,103,104,116,83,112,97,99,101,80,111,115,46,122,32,45,32,48,46,48,48,48,53,41,41,32,63,32,49,46,48,32,58,32,48,46,48,59,10,125,10,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,44,32,118,101,99,51,32,108,105,103,104,116,84,111,87,111,114,108,100,44,32,102,108,111,97,116,32,122,78,101,97,114,44,32,102,108,111,97,116,32,122,70,97,114,41,10,123,10,9,114,101,116,117,114,110,32,40,116,101,120,116,117,114,101,40,80,111,105,110,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,118,101,99,51,40,108,105,103,104,116,84,111,87,111,114,108,100,46,120,44,32,45,108,105,103,104,116,84,111,87,111,114,108,100,46,121,44,32,45,108,105,103,104,116,84,111,87,111,114,108,100,46,122,41,41,46,120,32,62,61,32,86,101,99,116,111,114,84,111,68,101,112,116,104,86,97,108,117,101,40,108,105,103,104,116,84,111,87,111,114,108,100,44,32,122,78,101,97,114,44,32,122,70,97,114,41,41,32,63,32,49,46,48,32,58,32,48,46,48,59,10,125,10,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,41,10,123,10,9,118,101,99,52,32,108,105,103,104,116,83,112,97,99,101,80,111,115,32,61,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,108,105,103,104,116,73,110,100,101,120,93,59,10,10,9,102,108,111,97,116,32,118,105,115,105,98,105,108,105,116,121,32,61,32,49,46,48,59,10,9,102,108,111,97,116,32,120,44,121,59,10,9,102,111,114,32,40,121,32,61,32,45,51,46,53,59,32,121,32,60,61,32,51,46,53,59,32,121,43,61,32,49,46,48,41,10,9,9,102,111,114,32,40,120,32,61,32,45,51,46,53,59,32,120,32,60,61,32,51,46,53,59,32,120,43,61,32,49,46,48,41,10,9,9,9,118,105,115,105,98,105,108,105,116,121,32,43,61,32,40,116,101,120,116,117,114,101,80,114,111,106,40,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,120,121,119,32,43,32,118,101,99,51,40,120,47,49,48,50,52,46,48,32,42,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,44,32,121,47,49,48,50,52,46,48,32,42,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,44,32,48,46,48,41,41,46,120,32,62,61,32,40,108,105,103,104,116,83,112,97,99,101,80,111,115,46,122,32,45,32,48,46,48,48,48,53,41,47,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,41,32,63,32,49,46,48,32,58,32,48,46,48,59,10,10,9,118,105,115,105,98,105,108,105,116,121,32,47,61,32,54,52,46,48,59,10,9,10,9,114,101,116,117,114,110,32,118,105,115,105,98,105,108,105,116,121,59,10,125,10,35,101,110,100,105,102,10,10,118,111,105,100,32,109,97,105,110,40,41,10,123,10,9,118,101,99,52,32,100,105,102,102,117,115,101,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,32,42,32,118,67,111,108,111,114,59,10,10,35,105,102,32,65,85,84,79,95,84,69,88,67,79,79,82,68,83,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,35,101,108,115,101,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,118,84,101,120,67,111,111,114,100,59,10,35,101,110,100,105,102,10,10,35,105,102,32,80,65,82,65,76,76,65,88,95,77,65,80,80,73,78,71,10,9,102,108,111,97,116,32,104,101,105,103,104,116,32,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,72,101,105,103,104,116,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,10,9,102,108,111,97,116,32,118,32,61,32,104,101,105,103,104,116,42,80,97,114,97,108,108,97,120,83,99,97,108,101,32,43,32,80,97,114,97,108,108,97,120,66,105,97,115,59,10,10,9,118,101,99,51,32,118,105,101,119,68,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,86,105,101,119,68,105,114,41,59,10,9,116,101,120,67,111,111,114,100,32,43,61,32,118,32,42,32,118,105,101,119,68,105,114,46,120,121,59,10,35,101,110,100,105,102,10,10,35,105,102,32,68,73,70,70,85,83,69,95,77,65,80,80,73,78,71,10,9,100,105,102,102,117,115,101,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,59,10,35,101,110,100,105,102,10,10,35,105,102,32,70,76,65,71,95,84,69,88,84,85,82,69,79,86,69,82,76,65,89,10,9,100,105,102,102,117,115,101,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,84,101,120,116,117,114,101,79,118,101,114,108,97,121,44,32,116,101,120,67,111,111,114,100,41,59,10,35,101,110,100,105,102,10,10,35,105,102,32,70,76,65,71,95,68,69,70,69,82,82,69,68,10,9,35,105,102,32,65,76,80,72,65,95,84,69,83,84,10,9,9,47,47,32,73,110,117,116,105,108,101,32,100,101,32,102,97,105,114,101,32,100,101,32,108,39,97,108,112,104,97,45,109,97,112,112,105,110,103,32,115,97,110,115,32,97,108,112,104,97,45,116,101,115,116,32,101,110,32,68,101,102,101,114,114,101,100,32,40,108,39,97,108,112,104,97,32,110,39,101,115,116,32,112,97,115,32,115,97,117,118,101,103,97,114,100,195,169,32,100,97,110,115,32,108,101,32,71,45,66,117,102,102,101,114,41,10,9,9,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,10,9,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,10,9,9,35,101,110,100,105,102,10,9,9,10,9,105,102,32,40,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,10,9,9,100,105,115,99,97,114,100,59,10,9,35,101,110,100,105,102,32,47,47,32,65,76,80,72,65,95,84,69,83,84,10,10,9,35,105,102,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,76,105,103,104,116,84,111,87,111,114,108,100,32,42,32,40,50,46,48,32,42,32,118,101,99,51,40,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,44,32,116,101,120,67,111,111,114,100,41,41,32,45,32,49,46,48,41,41,59,10,9,35,101,108,115,101,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,78,111,114,109,97,108,41,59,10,9,35,101,110,100,105,102,32,47,47,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,10,10,9,118,101,99,51,32,115,112,101,99,117,108,97,114,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,46,114,103,98,59,10,9,35,105,102,32,83,80,69,67,85,76,65,82,95,77,65,80,80,73,78,71,10,9,115,112,101,99,117,108,97,114,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,10,9,35,101,110,100,105,102,10,10,9,47,42,10,9,84,101,120,116,117,114,101,48,58,32,68,105,102,102,117,115,101,32,67,111,108,111,114,32,43,32,83,112,101,99,117,108,97,114,10,9,84,101,120,116,117,114,101,49,58,32,78,111,114,109,97,108,32,43,32,83,112,101,99,117,108,97,114,10,9,84,101,120,116,117,114,101,50,58,32,69,110,99,111,100,101,100,32,100,101,112,116,104,32,43,32,83,104,105,110,105,110,101,115,115,10,9,42,47,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,100,105,102,102,117,115,101,67,111,108,111,114,46,114,103,98,44,32,100,111,116,40,115,112,101,99,117,108,97,114,67,111,108,111,114,44,32,118,101,99,51,40,48,46,51,44,32,48,46,53,57,44,32,48,46,49,49,41,41,41,59,10,9,82,101,110,100,101,114,84,97,114,103,101,116,49,32,61,32,118,101,99,52,40,69,110,99,111,100,101,78,111,114,109,97,108,40,110,111,114,109,97,108,41,41,59,10,9,82,101,110,100,101,114,84,97,114,103,101,116,50,32,61,32,118,101,99,52,40,70,108,111,97,116,84,111,67,111,108,111,114,40,103,108,95,70,114,97,103,67,111,111,114,100,46,122,41,44,32,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,32,61,61,32,48,46,48,41,32,63,32,48,46,48,32,58,32,109,97,120,40,108,111,103,50,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,44,32,48,46,49,41,47,49,48,46,53,41,59,32,47,47,32,104,116,116,112,58,47,47,119,119,119,46,103,117,101,114,114,105,108,108,97,45,103,97,109,101,115,46,99,111,109,47,112,117,98,108,105,99,97,116,105,111,110,115,47,100,114,95,107,122,50,95,114,115,120,95,100,101,118,48,55,46,112,100,102,10,35,101,108,115,101,32,47,47,32,70,76,65,71,95,68,69,70,69,82,82,69,68,10,9,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,10,9,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,10,9,35,101,110,100,105,102,10,10,9,35,105,102,32,65,76,80,72,65,95,84,69,83,84,10,9,105,102,32,40,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,10,9,9,100,105,115,99,97,114,100,59,10,9,35,101,110,100,105,102,10,10,9,118,101,99,51,32,108,105,103,104,116,65,109,98,105,101,110,116,32,61,32,118,101,99,51,40,48,46,48,41,59,10,9,118,101,99,51,32,108,105,103,104,116,68,105,102,102,117,115,101,32,61,32,118,101,99,51,40,48,46,48,41,59,10,9,118,101,99,51,32,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,118,101,99,51,40,48,46,48,41,59,10,10,9,35,105,102,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,76,105,103,104,116,84,111,87,111,114,108,100,32,42,32,40,50,46,48,32,42,32,118,101,99,51,40,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,44,32,116,101,120,67,111,111,114,100,41,41,32,45,32,49,46,48,41,41,59,10,9,35,101,108,115,101,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,78,111,114,109,97,108,41,59,10,9,35,101,110,100,105,102,10,10,9,105,102,32,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,32,62,32,48,46,48,41,10,9,123,10,9,9,118,101,99,51,32,101,121,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,69,121,101,80,111,115,105,116,105,111,110,32,45,32,118,87,111,114,108,100,80,111,115,41,59,10,10,9,9,102,111,114,32,40,105,110,116,32,105,32,61,32,48,59,32,105,32,60,32,51,59,32,43,43,105,41,10,9,9,123,10,9,9,9,118,101,99,52,32,108,105,103,104,116,67,111,108,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,99,111,108,111,114,59,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,120,59,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,121,59,10,10,9,9,9,115,119,105,116,99,104,32,40,76,105,103,104,116,115,91,105,93,46,116,121,112,101,41,10,9,9,9,123,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,58,10,9,9,9,9,123,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,10,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,10,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,49,46,48,59,10,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,10,9,9,9,9,9,123,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,10,9,9,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,9,9,9,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,10,9,9,9,9,9,125,10,9,9,9,9,9,35,101,110,100,105,102,10,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,10,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,10,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,10,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,125,10,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,80,79,73,78,84,58,10,9,9,9,9,123,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,10,9,9,9,9,9,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,119,111,114,108,100,84,111,76,105,103,104,116,32,47,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,10,9,9,9,9,9,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,10,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,10,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,10,9,9,9,9,9,123,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,44,32,118,87,111,114,108,100,80,111,115,32,45,32,108,105,103,104,116,80,111,115,44,32,48,46,49,44,32,53,48,46,48,41,59,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,10,9,9,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,9,9,9,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,10,9,9,9,9,9,125,10,9,9,9,9,9,35,101,110,100,105,102,10,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,10,9,9,9,9,9,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,10,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,10,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,125,10,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,83,80,79,84,58,10,9,9,9,9,123,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,120,121,122,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,120,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,121,59,10,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,115,116,97,110,99,101,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,10,9,9,9,9,9,119,111,114,108,100,84,111,76,105,103,104,116,32,47,61,32,108,105,103,104,116,68,105,115,116,97,110,99,101,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,10,9,9,9,9,9,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,115,116,97,110,99,101,44,32,48,46,48,41,59,10,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,10,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,10,9,9,9,9,9,123,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,10,9,9,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,9,9,9,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,10,9,9,9,9,9,125,10,9,9,9,9,9,35,101,110,100,105,102,10,10,9,9,9,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,10,9,9,9,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,108,105,103,104,116,68,105,114,44,32,45,119,111,114,108,100,84,111,76,105,103,104,116,41,59,10,9,9,9,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,59,10,9,9,9,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,10,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,119,111,114,108,100,84,111,76,105,103,104,116,41,44,32,48,46,48,41,59,10,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,10,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,119,111,114,108,100,84,111,76,105,103,104,116,44,32,110,111,114,109,97,108,41,59,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,10,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,125,10,9,9,9,9,10,9,9,9,9,100,101,102,97,117,108,116,58,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,125,10,9,9,125,10,9,125,10,9,101,108,115,101,10,9,123,10,9,9,102,111,114,32,40,105,110,116,32,105,32,61,32,48,59,32,105,32,60,32,51,59,32,43,43,105,41,10,9,9,123,10,9,9,9,118,101,99,52,32,108,105,103,104,116,67,111,108,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,99,111,108,111,114,59,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,120,59,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,121,59,10,10,9,9,9,115,119,105,116,99,104,32,40,76,105,103,104,116,115,91,105,93,46,116,121,112,101,41,10,9,9,9,123,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,58,10,9,9,9,9,123,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,10,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,10,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,49,46,48,59,10,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,10,9,9,9,9,9,123,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,10,9,9,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,9,9,9,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,10,9,9,9,9,9,125,10,9,9,9,9,9,35,101,110,100,105,102,10,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,10,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,125,10,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,80,79,73,78,84,58,10,9,9,9,9,123,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,10,9,9,9,9,9,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,119,111,114,108,100,84,111,76,105,103,104,116,32,47,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,10,9,9,9,9,9,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,10,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,10,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,10,9,9,9,9,9,123,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,44,32,118,87,111,114,108,100,80,111,115,32,45,32,108,105,103,104,116,80,111,115,44,32,48,46,49,44,32,53,48,46,48,41,59,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,10,9,9,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,9,9,9,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,10,9,9,9,9,9,125,10,9,9,9,9,9,35,101,110,100,105,102,10,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,10,9,9,9,9,9,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,125,10,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,83,80,79,84,58,10,9,9,9,9,123,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,120,121,122,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,120,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,121,59,10,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,115,116,97,110,99,101,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,10,9,9,9,9,9,119,111,114,108,100,84,111,76,105,103,104,116,32,47,61,32,108,105,103,104,116,68,105,115,116,97,110,99,101,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,10,9,9,9,9,9,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,115,116,97,110,99,101,44,32,48,46,48,41,59,10,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,10,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,10,9,9,9,9,9,123,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,10,9,9,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,9,9,9,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,10,9,9,9,9,9,125,10,9,9,9,9,9,35,101,110,100,105,102,10,10,9,9,9,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,10,9,9,9,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,108,105,103,104,116,68,105,114,44,32,45,119,111,114,108,100,84,111,76,105,103,104,116,41,59,10,9,9,9,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,59,10,9,9,9,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,10,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,119,111,114,108,100,84,111,76,105,103,104,116,41,44,32,48,46,48,41,59,10,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,10,9,9,9,9,125,10,9,9,9,9,10,9,9,9,9,100,101,102,97,117,108,116,58,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,125,10,9,9,125,10,9,125,10,9,10,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,42,61,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,46,114,103,98,59,10,9,35,105,102,32,83,80,69,67,85,76,65,82,95,77,65,80,80,73,78,71,10,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,32,47,47,32,85,116,105,108,105,115,101,114,32,108,39,97,108,112,104,97,32,100,101,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,32,110,39,97,117,114,97,105,116,32,97,117,99,117,110,32,115,101,110,115,10,9,35,101,110,100,105,102,10,9,9,10,9,118,101,99,51,32,108,105,103,104,116,67,111,108,111,114,32,61,32,40,108,105,103,104,116,65,109,98,105,101,110,116,32,43,32,108,105,103,104,116,68,105,102,102,117,115,101,32,43,32,108,105,103,104,116,83,112,101,99,117,108,97,114,41,59,10,9,118,101,99,52,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,118,101,99,52,40,108,105,103,104,116,67,111,108,111,114,44,32,49,46,48,41,32,42,32,100,105,102,102,117,115,101,67,111,108,111,114,59,10,10,9,35,105,102,32,69,77,73,83,83,73,86,69,95,77,65,80,80,73,78,71,10,9,102,108,111,97,116,32,108,105,103,104,116,73,110,116,101,110,115,105,116,121,32,61,32,100,111,116,40,108,105,103,104,116,67,111,108,111,114,44,32,118,101,99,51,40,48,46,51,44,32,48,46,53,57,44,32,48,46,49,49,41,41,59,10,10,9,118,101,99,51,32,101,109,105,115,115,105,111,110,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,46,114,103,98,32,42,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,69,109,105,115,115,105,118,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,109,105,120,40,102,114,97,103,109,101,110,116,67,111,108,111,114,46,114,103,98,44,32,101,109,105,115,115,105,111,110,67,111,108,111,114,44,32,99,108,97,109,112,40,49,46,48,32,45,32,51,46,48,42,108,105,103,104,116,73,110,116,101,110,115,105,116,121,44,32,48,46,48,44,32,49,46,48,41,41,44,32,102,114,97,103,109,101,110,116,67,111,108,111,114,46,97,41,59,10,9,35,101,108,115,101,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,102,114,97,103,109,101,110,116,67,111,108,111,114,59,10,9,35,101,110,100,105,102,32,47,47,32,69,77,73,83,83,73,86,69,95,77,65,80,80,73,78,71,10,35,101,110,100,105,102,32,47,47,32,70,76,65,71,95,68,69,70,69,82,82,69,68,10,125,10,10, \ No newline at end of file +35,105,102,32,69,65,82,76,89,95,70,82,65,71,77,69,78,84,95,84,69,83,84,83,32,38,38,32,33,65,76,80,72,65,95,84,69,83,84,13,10,108,97,121,111,117,116,40,101,97,114,108,121,95,102,114,97,103,109,101,110,116,95,116,101,115,116,115,41,32,105,110,59,13,10,35,101,110,100,105,102,13,10,13,10,47,47,32,72,65,67,75,32,85,78,84,73,76,32,80,82,79,80,69,82,32,70,73,88,13,10,35,105,102,32,71,76,83,76,95,86,69,82,83,73,79,78,32,60,32,52,48,48,13,10,9,35,117,110,100,101,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,35,100,101,102,105,110,101,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,32,48,13,10,35,101,110,100,105,102,13,10,47,47,32,72,65,67,75,13,10,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,32,48,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,80,79,73,78,84,32,49,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,83,80,79,84,32,50,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,69,110,116,114,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,105,110,32,118,101,99,52,32,118,67,111,108,111,114,59,13,10,105,110,32,118,101,99,52,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,51,93,59,13,10,105,110,32,109,97,116,51,32,118,76,105,103,104,116,84,111,87,111,114,108,100,59,13,10,105,110,32,118,101,99,51,32,118,78,111,114,109,97,108,59,13,10,105,110,32,118,101,99,50,32,118,84,101,120,67,111,111,114,100,59,13,10,105,110,32,118,101,99,51,32,118,86,105,101,119,68,105,114,59,13,10,105,110,32,118,101,99,51,32,118,87,111,114,108,100,80,111,115,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,83,111,114,116,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,49,59,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,50,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,85,110,105,102,111,114,109,101,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,115,116,114,117,99,116,32,76,105,103,104,116,13,10,123,13,10,9,105,110,116,32,116,121,112,101,59,13,10,9,118,101,99,52,32,99,111,108,111,114,59,13,10,9,118,101,99,50,32,102,97,99,116,111,114,115,59,13,10,13,10,9,118,101,99,52,32,112,97,114,97,109,101,116,101,114,115,49,59,13,10,9,118,101,99,52,32,112,97,114,97,109,101,116,101,114,115,50,59,13,10,9,118,101,99,50,32,112,97,114,97,109,101,116,101,114,115,51,59,13,10,9,98,111,111,108,32,115,104,97,100,111,119,77,97,112,112,105,110,103,59,13,10,125,59,13,10,13,10,47,47,32,76,117,109,105,195,168,114,101,115,13,10,117,110,105,102,111,114,109,32,76,105,103,104,116,32,76,105,103,104,116,115,91,51,93,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,67,117,98,101,32,80,111,105,110,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,51,93,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,51,93,59,13,10,13,10,47,47,32,77,97,116,195,169,114,105,97,117,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,69,109,105,115,115,105,118,101,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,72,101,105,103,104,116,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,59,13,10,13,10,47,47,32,65,117,116,114,101,115,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,80,97,114,97,108,108,97,120,66,105,97,115,32,61,32,45,48,46,48,51,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,80,97,114,97,108,108,97,120,83,99,97,108,101,32,61,32,48,46,48,50,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,51,32,69,121,101,80,111,115,105,116,105,111,110,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,83,99,101,110,101,65,109,98,105,101,110,116,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,84,101,120,116,117,114,101,79,118,101,114,108,97,121,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,70,111,110,99,116,105,111,110,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,118,101,99,51,32,70,108,111,97,116,84,111,67,111,108,111,114,40,102,108,111,97,116,32,102,41,13,10,123,13,10,9,118,101,99,51,32,99,111,108,111,114,59,13,10,13,10,9,102,32,42,61,32,50,53,54,46,48,59,13,10,9,99,111,108,111,114,46,120,32,61,32,102,108,111,111,114,40,102,41,59,13,10,13,10,9,102,32,61,32,40,102,32,45,32,99,111,108,111,114,46,120,41,32,42,32,50,53,54,46,48,59,13,10,9,99,111,108,111,114,46,121,32,61,32,102,108,111,111,114,40,102,41,59,13,10,13,10,9,99,111,108,111,114,46,122,32,61,32,102,32,45,32,99,111,108,111,114,46,121,59,13,10,9,99,111,108,111,114,46,120,121,32,42,61,32,48,46,48,48,51,57,48,54,50,53,59,32,47,47,32,42,61,32,49,46,48,47,50,53,54,13,10,13,10,9,114,101,116,117,114,110,32,99,111,108,111,114,59,13,10,125,13,10,13,10,35,100,101,102,105,110,101,32,107,80,73,32,51,46,49,52,49,53,57,50,54,53,51,54,13,10,13,10,118,101,99,52,32,69,110,99,111,100,101,78,111,114,109,97,108,40,105,110,32,118,101,99,51,32,110,111,114,109,97,108,41,13,10,123,13,10,9,47,47,114,101,116,117,114,110,32,118,101,99,52,40,110,111,114,109,97,108,42,48,46,53,32,43,32,48,46,53,44,32,48,46,48,41,59,13,10,9,114,101,116,117,114,110,32,118,101,99,52,40,118,101,99,50,40,97,116,97,110,40,110,111,114,109,97,108,46,121,44,32,110,111,114,109,97,108,46,120,41,47,107,80,73,44,32,110,111,114,109,97,108,46,122,41,44,32,48,46,48,44,32,48,46,48,41,59,13,10,125,13,10,13,10,102,108,111,97,116,32,86,101,99,116,111,114,84,111,68,101,112,116,104,86,97,108,117,101,40,118,101,99,51,32,118,101,99,44,32,102,108,111,97,116,32,122,78,101,97,114,44,32,102,108,111,97,116,32,122,70,97,114,41,13,10,123,13,10,9,118,101,99,51,32,97,98,115,86,101,99,32,61,32,97,98,115,40,118,101,99,41,59,13,10,9,102,108,111,97,116,32,108,111,99,97,108,90,32,61,32,109,97,120,40,97,98,115,86,101,99,46,120,44,32,109,97,120,40,97,98,115,86,101,99,46,121,44,32,97,98,115,86,101,99,46,122,41,41,59,13,10,13,10,9,102,108,111,97,116,32,110,111,114,109,90,32,61,32,40,40,122,70,97,114,32,43,32,122,78,101,97,114,41,32,42,32,108,111,99,97,108,90,32,45,32,40,50,46,48,42,122,70,97,114,42,122,78,101,97,114,41,41,32,47,32,40,40,122,70,97,114,32,45,32,122,78,101,97,114,41,42,108,111,99,97,108,90,41,59,13,10,9,114,101,116,117,114,110,32,40,110,111,114,109,90,32,43,32,49,46,48,41,32,42,32,48,46,53,59,13,10,125,13,10,13,10,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,41,13,10,123,13,10,9,118,101,99,52,32,108,105,103,104,116,83,112,97,99,101,80,111,115,32,61,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,108,105,103,104,116,73,110,100,101,120,93,59,13,10,9,114,101,116,117,114,110,32,40,116,101,120,116,117,114,101,40,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,120,121,41,46,120,32,62,61,32,40,108,105,103,104,116,83,112,97,99,101,80,111,115,46,122,32,45,32,48,46,48,48,48,53,41,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,125,13,10,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,44,32,118,101,99,51,32,108,105,103,104,116,84,111,87,111,114,108,100,44,32,102,108,111,97,116,32,122,78,101,97,114,44,32,102,108,111,97,116,32,122,70,97,114,41,13,10,123,13,10,9,114,101,116,117,114,110,32,40,116,101,120,116,117,114,101,40,80,111,105,110,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,118,101,99,51,40,108,105,103,104,116,84,111,87,111,114,108,100,46,120,44,32,45,108,105,103,104,116,84,111,87,111,114,108,100,46,121,44,32,45,108,105,103,104,116,84,111,87,111,114,108,100,46,122,41,41,46,120,32,62,61,32,86,101,99,116,111,114,84,111,68,101,112,116,104,86,97,108,117,101,40,108,105,103,104,116,84,111,87,111,114,108,100,44,32,122,78,101,97,114,44,32,122,70,97,114,41,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,125,13,10,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,41,13,10,123,13,10,9,118,101,99,52,32,108,105,103,104,116,83,112,97,99,101,80,111,115,32,61,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,108,105,103,104,116,73,110,100,101,120,93,59,13,10,13,10,9,102,108,111,97,116,32,118,105,115,105,98,105,108,105,116,121,32,61,32,49,46,48,59,13,10,9,102,108,111,97,116,32,120,44,121,59,13,10,9,102,111,114,32,40,121,32,61,32,45,51,46,53,59,32,121,32,60,61,32,51,46,53,59,32,121,43,61,32,49,46,48,41,13,10,9,9,102,111,114,32,40,120,32,61,32,45,51,46,53,59,32,120,32,60,61,32,51,46,53,59,32,120,43,61,32,49,46,48,41,13,10,9,9,9,118,105,115,105,98,105,108,105,116,121,32,43,61,32,40,116,101,120,116,117,114,101,80,114,111,106,40,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,120,121,119,32,43,32,118,101,99,51,40,120,47,49,48,50,52,46,48,32,42,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,44,32,121,47,49,48,50,52,46,48,32,42,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,44,32,48,46,48,41,41,46,120,32,62,61,32,40,108,105,103,104,116,83,112,97,99,101,80,111,115,46,122,32,45,32,48,46,48,48,48,53,41,47,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,13,10,9,118,105,115,105,98,105,108,105,116,121,32,47,61,32,54,52,46,48,59,13,10,9,13,10,9,114,101,116,117,114,110,32,118,105,115,105,98,105,108,105,116,121,59,13,10,125,13,10,35,101,110,100,105,102,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,52,32,100,105,102,102,117,115,101,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,32,42,32,118,67,111,108,111,114,59,13,10,13,10,35,105,102,32,65,85,84,79,95,84,69,88,67,79,79,82,68,83,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,35,101,108,115,101,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,118,84,101,120,67,111,111,114,100,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,80,65,82,65,76,76,65,88,95,77,65,80,80,73,78,71,13,10,9,102,108,111,97,116,32,104,101,105,103,104,116,32,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,72,101,105,103,104,116,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,102,108,111,97,116,32,118,32,61,32,104,101,105,103,104,116,42,80,97,114,97,108,108,97,120,83,99,97,108,101,32,43,32,80,97,114,97,108,108,97,120,66,105,97,115,59,13,10,13,10,9,118,101,99,51,32,118,105,101,119,68,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,86,105,101,119,68,105,114,41,59,13,10,9,116,101,120,67,111,111,114,100,32,43,61,32,118,32,42,32,118,105,101,119,68,105,114,46,120,121,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,68,73,70,70,85,83,69,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,70,76,65,71,95,84,69,88,84,85,82,69,79,86,69,82,76,65,89,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,84,101,120,116,117,114,101,79,118,101,114,108,97,121,44,32,116,101,120,67,111,111,114,100,41,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,9,35,105,102,32,65,76,80,72,65,95,84,69,83,84,13,10,9,9,47,47,32,73,110,117,116,105,108,101,32,100,101,32,102,97,105,114,101,32,100,101,32,108,39,97,108,112,104,97,45,109,97,112,112,105,110,103,32,115,97,110,115,32,97,108,112,104,97,45,116,101,115,116,32,101,110,32,68,101,102,101,114,114,101,100,32,40,108,39,97,108,112,104,97,32,110,39,101,115,116,32,112,97,115,32,115,97,117,118,101,103,97,114,100,195,169,32,100,97,110,115,32,108,101,32,71,45,66,117,102,102,101,114,41,13,10,9,9,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,9,35,101,110,100,105,102,13,10,9,9,13,10,9,105,102,32,40,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,13,10,9,9,100,105,115,99,97,114,100,59,13,10,9,35,101,110,100,105,102,32,47,47,32,65,76,80,72,65,95,84,69,83,84,13,10,13,10,9,35,105,102,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,76,105,103,104,116,84,111,87,111,114,108,100,32,42,32,40,50,46,48,32,42,32,118,101,99,51,40,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,44,32,116,101,120,67,111,111,114,100,41,41,32,45,32,49,46,48,41,41,59,13,10,9,35,101,108,115,101,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,78,111,114,109,97,108,41,59,13,10,9,35,101,110,100,105,102,32,47,47,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,13,10,9,118,101,99,51,32,115,112,101,99,117,108,97,114,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,46,114,103,98,59,13,10,9,35,105,102,32,83,80,69,67,85,76,65,82,95,77,65,80,80,73,78,71,13,10,9,115,112,101,99,117,108,97,114,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,47,42,13,10,9,84,101,120,116,117,114,101,48,58,32,68,105,102,102,117,115,101,32,67,111,108,111,114,32,43,32,83,112,101,99,117,108,97,114,13,10,9,84,101,120,116,117,114,101,49,58,32,78,111,114,109,97,108,32,43,32,83,112,101,99,117,108,97,114,13,10,9,84,101,120,116,117,114,101,50,58,32,69,110,99,111,100,101,100,32,100,101,112,116,104,32,43,32,83,104,105,110,105,110,101,115,115,13,10,9,42,47,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,100,105,102,102,117,115,101,67,111,108,111,114,46,114,103,98,44,32,100,111,116,40,115,112,101,99,117,108,97,114,67,111,108,111,114,44,32,118,101,99,51,40,48,46,51,44,32,48,46,53,57,44,32,48,46,49,49,41,41,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,49,32,61,32,118,101,99,52,40,69,110,99,111,100,101,78,111,114,109,97,108,40,110,111,114,109,97,108,41,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,50,32,61,32,118,101,99,52,40,70,108,111,97,116,84,111,67,111,108,111,114,40,103,108,95,70,114,97,103,67,111,111,114,100,46,122,41,44,32,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,32,61,61,32,48,46,48,41,32,63,32,48,46,48,32,58,32,109,97,120,40,108,111,103,50,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,44,32,48,46,49,41,47,49,48,46,53,41,59,32,47,47,32,104,116,116,112,58,47,47,119,119,119,46,103,117,101,114,114,105,108,108,97,45,103,97,109,101,115,46,99,111,109,47,112,117,98,108,105,99,97,116,105,111,110,115,47,100,114,95,107,122,50,95,114,115,120,95,100,101,118,48,55,46,112,100,102,13,10,35,101,108,115,101,32,47,47,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,9,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,35,105,102,32,65,76,80,72,65,95,84,69,83,84,13,10,9,105,102,32,40,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,13,10,9,9,100,105,115,99,97,114,100,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,65,109,98,105,101,110,116,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,102,102,117,115,101,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,9,118,101,99,51,32,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,13,10,9,35,105,102,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,76,105,103,104,116,84,111,87,111,114,108,100,32,42,32,40,50,46,48,32,42,32,118,101,99,51,40,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,44,32,116,101,120,67,111,111,114,100,41,41,32,45,32,49,46,48,41,41,59,13,10,9,35,101,108,115,101,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,78,111,114,109,97,108,41,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,105,102,32,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,32,62,32,48,46,48,41,13,10,9,123,13,10,9,9,118,101,99,51,32,101,121,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,69,121,101,80,111,115,105,116,105,111,110,32,45,32,118,87,111,114,108,100,80,111,115,41,59,13,10,13,10,9,9,102,111,114,32,40,105,110,116,32,105,32,61,32,48,59,32,105,32,60,32,51,59,32,43,43,105,41,13,10,9,9,123,13,10,9,9,9,118,101,99,52,32,108,105,103,104,116,67,111,108,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,99,111,108,111,114,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,120,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,121,59,13,10,13,10,9,9,9,115,119,105,116,99,104,32,40,76,105,103,104,116,115,91,105,93,46,116,121,112,101,41,13,10,9,9,9,123,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,49,46,48,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,80,79,73,78,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,119,111,114,108,100,84,111,76,105,103,104,116,32,47,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,44,32,118,87,111,114,108,100,80,111,115,32,45,32,108,105,103,104,116,80,111,115,44,32,48,46,49,44,32,53,48,46,48,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,83,80,79,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,120,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,121,59,13,10,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,115,116,97,110,99,101,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,119,111,114,108,100,84,111,76,105,103,104,116,32,47,61,32,108,105,103,104,116,68,105,115,116,97,110,99,101,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,115,116,97,110,99,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,13,10,9,9,9,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,108,105,103,104,116,68,105,114,44,32,45,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,59,13,10,9,9,9,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,119,111,114,108,100,84,111,76,105,103,104,116,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,119,111,114,108,100,84,111,76,105,103,104,116,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,9,9,9,9,13,10,9,9,9,9,100,101,102,97,117,108,116,58,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,125,13,10,9,9,125,13,10,9,125,13,10,9,101,108,115,101,13,10,9,123,13,10,9,9,102,111,114,32,40,105,110,116,32,105,32,61,32,48,59,32,105,32,60,32,51,59,32,43,43,105,41,13,10,9,9,123,13,10,9,9,9,118,101,99,52,32,108,105,103,104,116,67,111,108,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,99,111,108,111,114,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,120,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,121,59,13,10,13,10,9,9,9,115,119,105,116,99,104,32,40,76,105,103,104,116,115,91,105,93,46,116,121,112,101,41,13,10,9,9,9,123,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,49,46,48,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,80,79,73,78,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,119,111,114,108,100,84,111,76,105,103,104,116,32,47,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,44,32,118,87,111,114,108,100,80,111,115,32,45,32,108,105,103,104,116,80,111,115,44,32,48,46,49,44,32,53,48,46,48,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,83,80,79,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,120,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,121,59,13,10,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,115,116,97,110,99,101,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,119,111,114,108,100,84,111,76,105,103,104,116,32,47,61,32,108,105,103,104,116,68,105,115,116,97,110,99,101,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,115,116,97,110,99,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,13,10,9,9,9,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,108,105,103,104,116,68,105,114,44,32,45,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,59,13,10,9,9,9,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,119,111,114,108,100,84,111,76,105,103,104,116,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,125,13,10,9,9,9,9,13,10,9,9,9,9,100,101,102,97,117,108,116,58,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,125,13,10,9,9,125,13,10,9,125,13,10,9,13,10,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,42,61,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,46,114,103,98,59,13,10,9,35,105,102,32,83,80,69,67,85,76,65,82,95,77,65,80,80,73,78,71,13,10,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,32,47,47,32,85,116,105,108,105,115,101,114,32,108,39,97,108,112,104,97,32,100,101,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,32,110,39,97,117,114,97,105,116,32,97,117,99,117,110,32,115,101,110,115,13,10,9,35,101,110,100,105,102,13,10,9,9,13,10,9,118,101,99,51,32,108,105,103,104,116,67,111,108,111,114,32,61,32,40,108,105,103,104,116,65,109,98,105,101,110,116,32,43,32,108,105,103,104,116,68,105,102,102,117,115,101,32,43,32,108,105,103,104,116,83,112,101,99,117,108,97,114,41,59,13,10,9,118,101,99,52,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,118,101,99,52,40,108,105,103,104,116,67,111,108,111,114,44,32,49,46,48,41,32,42,32,100,105,102,102,117,115,101,67,111,108,111,114,59,13,10,13,10,9,35,105,102,32,69,77,73,83,83,73,86,69,95,77,65,80,80,73,78,71,13,10,9,102,108,111,97,116,32,108,105,103,104,116,73,110,116,101,110,115,105,116,121,32,61,32,100,111,116,40,108,105,103,104,116,67,111,108,111,114,44,32,118,101,99,51,40,48,46,51,44,32,48,46,53,57,44,32,48,46,49,49,41,41,59,13,10,13,10,9,118,101,99,51,32,101,109,105,115,115,105,111,110,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,46,114,103,98,32,42,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,69,109,105,115,115,105,118,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,109,105,120,40,102,114,97,103,109,101,110,116,67,111,108,111,114,46,114,103,98,44,32,101,109,105,115,115,105,111,110,67,111,108,111,114,44,32,99,108,97,109,112,40,49,46,48,32,45,32,51,46,48,42,108,105,103,104,116,73,110,116,101,110,115,105,116,121,44,32,48,46,48,44,32,49,46,48,41,41,44,32,102,114,97,103,109,101,110,116,67,111,108,111,114,46,97,41,59,13,10,9,35,101,108,115,101,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,102,114,97,103,109,101,110,116,67,111,108,111,114,59,13,10,9,35,101,110,100,105,102,32,47,47,32,69,77,73,83,83,73,86,69,95,77,65,80,80,73,78,71,13,10,35,101,110,100,105,102,32,47,47,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,125,13,10,13,10, \ No newline at end of file From f22633adb556fc1264ba68699f729c22ce53347d Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 11 Aug 2016 01:02:40 +0200 Subject: [PATCH 11/74] SDK/Entity: Delay component removal until world update Allows system to freely remove components while updating Former-commit-id: 24dabc3423951621e8be7889fc27eaad4e8566b7 [formerly ed68ae6028a369be7a639dc8269848cd3b7af25f] [formerly 7404bc26b369203316834a15eda120e2a7ce94ee [formerly b3b81c6068bf35a7b838edefa9275de94f9231f7]] Former-commit-id: bc3f57813ed8b3146c0db385ff5df490b39ec3fa [formerly bc31fad8f0ce68ac2b94f4eca1c96664b4b68c93] Former-commit-id: 22c300e946a3f921ea49de7451567bc6202bb9a0 --- SDK/include/NDK/Entity.hpp | 9 ++++-- SDK/include/NDK/Entity.inl | 19 +++++++++++++ SDK/src/NDK/Entity.cpp | 56 +++++++++++++++----------------------- SDK/src/NDK/World.cpp | 5 ++++ 4 files changed, 53 insertions(+), 36 deletions(-) diff --git a/SDK/include/NDK/Entity.hpp b/SDK/include/NDK/Entity.hpp index 6069a13c0..ae6b1acf5 100644 --- a/SDK/include/NDK/Entity.hpp +++ b/SDK/include/NDK/Entity.hpp @@ -52,8 +52,8 @@ namespace Ndk inline bool IsEnabled() const; inline bool IsValid() const; - void RemoveAllComponents(); - void RemoveComponent(ComponentIndex index); + inline void RemoveAllComponents(); + inline void RemoveComponent(ComponentIndex index); template void RemoveComponent(); inline Nz::String ToString() const; @@ -67,6 +67,10 @@ namespace Ndk void Create(); void Destroy(); + void DestroyComponent(ComponentIndex index); + + inline Nz::Bitset<>& GetRemovedComponentBits(); + inline void RegisterSystem(SystemIndex index); inline void SetWorld(World* world) noexcept; @@ -75,6 +79,7 @@ namespace Ndk std::vector> m_components; Nz::Bitset<> m_componentBits; + Nz::Bitset<> m_removedComponentBits; Nz::Bitset<> m_systemBits; EntityId m_id; World* m_world; diff --git a/SDK/include/NDK/Entity.inl b/SDK/include/NDK/Entity.inl index 799ffd97e..c7937b786 100644 --- a/SDK/include/NDK/Entity.inl +++ b/SDK/include/NDK/Entity.inl @@ -103,12 +103,31 @@ namespace Ndk RemoveComponent(index); } + inline void Entity::RemoveAllComponents() + { + m_removedComponentBits = m_componentBits; + + Invalidate(); + } + + inline void Entity::RemoveComponent(ComponentIndex index) + { + m_removedComponentBits.UnboundedSet(index); + + Invalidate(); + } + inline Nz::String Entity::ToString() const { Nz::StringStream ss; return ss << "Entity(" << GetId() << ')'; } + inline Nz::Bitset<>& Entity::GetRemovedComponentBits() + { + return m_removedComponentBits; + } + inline void Entity::RegisterSystem(SystemIndex index) { m_systemBits.UnboundedSet(index); diff --git a/SDK/src/NDK/Entity.cpp b/SDK/src/NDK/Entity.cpp index f037e5f9a..680ff56d9 100644 --- a/SDK/src/NDK/Entity.cpp +++ b/SDK/src/NDK/Entity.cpp @@ -44,6 +44,7 @@ namespace Ndk // Affectation et retour du component m_components[index] = std::move(componentPtr); m_componentBits.UnboundedSet(index); + m_removedComponentBits.UnboundedReset(index); Invalidate(); @@ -71,40 +72,6 @@ namespace Ndk m_world->Invalidate(m_id); } - void Entity::RemoveAllComponents() - { - for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i)) - RemoveComponent(static_cast(i)); - - NazaraAssert(m_componentBits.TestNone(), "All components should be gone"); - - m_components.clear(); - - Invalidate(); - } - - void Entity::RemoveComponent(ComponentIndex index) - { - ///DOC: N'a aucun effet si le component n'est pas présent - if (HasComponent(index)) - { - // On récupère le component et on informe les composants du détachement - BaseComponent& component = *m_components[index].get(); - for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i)) - { - if (i != index) - m_components[i]->OnComponentDetached(component); - } - - component.SetEntity(nullptr); - - m_components[index].reset(); - m_componentBits.Reset(index); - - Invalidate(); - } - } - void Entity::Create() { m_enabled = true; @@ -128,4 +95,25 @@ namespace Ndk m_valid = false; } + + void Entity::DestroyComponent(ComponentIndex index) + { + ///DOC: N'a aucun effet si le component n'est pas présent + if (HasComponent(index)) + { + // On récupère le component et on informe les composants du détachement + BaseComponent& component = *m_components[index].get(); + for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i)) + { + if (i != index) + m_components[i]->OnComponentDetached(component); + } + + component.SetEntity(nullptr); + + m_components[index].reset(); + m_componentBits.Reset(index); + } + } + } diff --git a/SDK/src/NDK/World.cpp b/SDK/src/NDK/World.cpp index 5d0e4900b..e5b2d874a 100644 --- a/SDK/src/NDK/World.cpp +++ b/SDK/src/NDK/World.cpp @@ -139,6 +139,11 @@ namespace Ndk if (!entity->IsValid()) continue; + Nz::Bitset<>& removedComponents = entity->GetRemovedComponentBits(); + for (std::size_t j = removedComponents.FindFirst(); j != m_dirtyEntities.npos; j = removedComponents.FindNext(j)) + entity->DestroyComponent(j); + removedComponents.Reset(); + for (auto& system : m_systems) { // Ignore non-existent systems From b3b0d9a2707bbf78a60815def967359c606aa807 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 11 Aug 2016 01:03:53 +0200 Subject: [PATCH 12/74] SDK/GraphicsComponent: Fix invalidation slot disconnection in case Detach has been called Former-commit-id: 8962d36d0fa699c6f96e67802fddd0880aab3594 [formerly 3f3f176ef41832cbb474cb9bbd4c96619ad7af1d] [formerly 504be94e13a864f006eb3089970b7eb43abf2b4f [formerly f60ab676eb22a0e31aacbe668e4a9d41312d800e]] Former-commit-id: 7b1f734f447e6797f4f87372c8319f904aa40e1a [formerly cb9ec84e912f0886bc94f4bdd26b25c757d1563c] Former-commit-id: cece1ffceb6a37dc86b61cfa218c0ef9907050a2 --- SDK/include/NDK/Components/GraphicsComponent.hpp | 6 ++++-- SDK/include/NDK/Components/GraphicsComponent.inl | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SDK/include/NDK/Components/GraphicsComponent.hpp b/SDK/include/NDK/Components/GraphicsComponent.hpp index 92aeeed2f..6e0e78604 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.hpp +++ b/SDK/include/NDK/Components/GraphicsComponent.hpp @@ -35,7 +35,7 @@ namespace Ndk inline void Clear(); - inline void Detach(const Nz::InstancedRenderableRef& renderable); + inline void Detach(const Nz::InstancedRenderable* renderable); inline void EnsureBoundingVolumeUpdate() const; inline void EnsureTransformMatrixUpdate() const; @@ -75,7 +75,8 @@ namespace Ndk Renderable(Renderable&& renderable) noexcept : data(std::move(renderable.data)), renderable(std::move(renderable.renderable)), - dataUpdated(renderable.dataUpdated) + dataUpdated(renderable.dataUpdated), + renderableInvalidationSlot(std::move(renderable.renderableInvalidationSlot)), { } @@ -84,6 +85,7 @@ namespace Ndk data = std::move(r.data); dataUpdated = r.dataUpdated; renderable = std::move(r.renderable); + renderableInvalidationSlot = std::move(r.renderableInvalidationSlot); return *this; } diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index b38ce6dd6..a835c845d 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -54,7 +54,7 @@ namespace Ndk InvalidateBoundingVolume(); } - inline void GraphicsComponent::Detach(const Nz::InstancedRenderableRef& renderable) + inline void GraphicsComponent::Detach(const Nz::InstancedRenderable* renderable) { for (auto it = m_renderables.begin(); it != m_renderables.end(); ++it) { From a0547ae5763b199e84f908b1c41745d191682ba6 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 11 Aug 2016 01:06:21 +0200 Subject: [PATCH 13/74] Core/Signal: Remove debug log that got accidentaly commited Former-commit-id: 00e2d8f110409986b8a5fe0e0ae58a2aa5189e20 [formerly a9e1a317e7255a7980a26d42457b4e3e383bab35] [formerly ac72eb216ffe4edc66f382d9e3c1928b2ea8b5fa [formerly b788b785f11797bd6c13ac7836a76b3055f26f5b]] Former-commit-id: 18be9d7ef0f40a722c261626d5c882e4093d173b [formerly 58746ee0d1a9091aaae34b09f4b4a674c69e0176] Former-commit-id: b2a6448db8fbfb092cc5ebd59a3fc1a58f16305a --- include/Nazara/Core/Signal.hpp | 2 +- include/Nazara/Core/Signal.inl | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/Nazara/Core/Signal.hpp b/include/Nazara/Core/Signal.hpp index b7aebe591..613502f80 100644 --- a/include/Nazara/Core/Signal.hpp +++ b/include/Nazara/Core/Signal.hpp @@ -34,7 +34,7 @@ namespace Nz Signal(); Signal(const Signal&) = delete; Signal(Signal&& signal); - ~Signal(); + ~Signal() = default; void Clear(); diff --git a/include/Nazara/Core/Signal.inl b/include/Nazara/Core/Signal.inl index d8ea871c6..93e0166c0 100644 --- a/include/Nazara/Core/Signal.inl +++ b/include/Nazara/Core/Signal.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 #include #include @@ -36,12 +37,6 @@ namespace Nz operator=(std::move(signal)); } - template - Signal::~Signal() - { - NazaraWarning("~Signal(" + String::Pointer(this) + ')'); - } - /*! * \brief Clears the list of actions attached to the signal */ @@ -435,4 +430,3 @@ namespace Nz } #include -#include "Signal.hpp" From 039447c1279550889e2b8fd6c381eb052cd19f95 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 11 Aug 2016 01:07:46 +0200 Subject: [PATCH 14/74] SDK/GraphicsComponent: Makes component watch over renderable destruction Allows to use persistent (not using the internal counter) InstancedRenderable Former-commit-id: c0963eb7902dedad3c5eb139ac23a25a57a15487 [formerly 0ec3ca3b783c1c9fac45ff0c015bbc254ce4b375] [formerly f86b41d43bf8f77c2b0e8a91b0e4cd0cdc1a9a54 [formerly 2d454f93ced586e04f7d040bda2986fe631d64e4]] Former-commit-id: 58c52cff93c0461f31b65346a4af90b135a7fed3 [formerly 5e20488509bc66e245fa85c478b32e6251bf3a0f] Former-commit-id: 84fe715cc064885caa8a1c885bc2ef458bc08337 --- SDK/include/NDK/Components/GraphicsComponent.hpp | 9 +++++++++ SDK/include/NDK/Components/GraphicsComponent.inl | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SDK/include/NDK/Components/GraphicsComponent.hpp b/SDK/include/NDK/Components/GraphicsComponent.hpp index 6e0e78604..ec16ba593 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.hpp +++ b/SDK/include/NDK/Components/GraphicsComponent.hpp @@ -77,20 +77,29 @@ namespace Ndk renderable(std::move(renderable.renderable)), dataUpdated(renderable.dataUpdated), renderableInvalidationSlot(std::move(renderable.renderableInvalidationSlot)), + renderableReleaseSlot(std::move(renderable.renderableReleaseSlot)) { } + ~Renderable() + { + // Disconnect release slot before releasing instanced renderable reference + renderableReleaseSlot.Disconnect(); + } + Renderable& operator=(Renderable&& r) noexcept { data = std::move(r.data); dataUpdated = r.dataUpdated; renderable = std::move(r.renderable); renderableInvalidationSlot = std::move(r.renderableInvalidationSlot); + renderableReleaseSlot = std::move(r.renderableReleaseSlot); return *this; } NazaraSlot(Nz::InstancedRenderable, OnInstancedRenderableInvalidateData, renderableInvalidationSlot); + NazaraSlot(Nz::InstancedRenderable, OnInstancedRenderableRelease, renderableReleaseSlot); mutable Nz::InstancedRenderable::InstanceData data; Nz::InstancedRenderableRef renderable; diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index a835c845d..0d9cb7af4 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -42,7 +42,8 @@ namespace Ndk Renderable& r = m_renderables.back(); r.data.renderOrder = renderOrder; r.renderable = std::move(renderable); - r.renderableInvalidationSlot.Connect(r.renderable->OnInstancedRenderableInvalidateData, std::bind(&GraphicsComponent::InvalidateRenderableData, this, std::placeholders::_1, std::placeholders::_2, m_renderables.size()-1)); + r.renderableInvalidationSlot.Connect(r.renderable->OnInstancedRenderableInvalidateData, std::bind(&GraphicsComponent::InvalidateRenderableData, this, std::placeholders::_1, std::placeholders::_2, m_renderables.size() - 1)); + r.renderableReleaseSlot.Connect(r.renderable->OnInstancedRenderableRelease, this, &GraphicsComponent::Detach); InvalidateBoundingVolume(); } From 762e33aab431eef632b733a10ebc5d5ff565b09d Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 11 Aug 2016 22:00:05 +0200 Subject: [PATCH 15/74] SDK/Entity: Add entity cloning Former-commit-id: 6ba33c15d30cb9e385eaa2dd115e680962aad364 [formerly e5bf85dfef3def45ea47b9a8e46f2b5c61a6ca4f] [formerly aa4cd7ce6637f9559ede8530119d2d96b30a4b47 [formerly aa7c268cc1ed04a8e484b5a6317d967121939067]] Former-commit-id: 24cf44420c029ec2ccc02f8b88873555af0aa88f [formerly efb642be02646b410003e5972c8494af773ef097] Former-commit-id: 4d30a3ad59e3a30b0ff48eb984c20e3c098fbee1 --- SDK/include/NDK/Entity.hpp | 2 ++ SDK/include/NDK/World.hpp | 2 ++ SDK/src/NDK/Entity.cpp | 8 ++++++++ SDK/src/NDK/World.cpp | 22 ++++++++++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/SDK/include/NDK/Entity.hpp b/SDK/include/NDK/Entity.hpp index ae6b1acf5..33661eb50 100644 --- a/SDK/include/NDK/Entity.hpp +++ b/SDK/include/NDK/Entity.hpp @@ -34,6 +34,8 @@ namespace Ndk BaseComponent& AddComponent(std::unique_ptr&& component); template ComponentType& AddComponent(Args&&... args); + const EntityHandle& Clone() const; + inline void Enable(bool enable); inline BaseComponent& GetComponent(ComponentIndex index); diff --git a/SDK/include/NDK/World.hpp b/SDK/include/NDK/World.hpp index 40508e8e4..2e20d03a9 100644 --- a/SDK/include/NDK/World.hpp +++ b/SDK/include/NDK/World.hpp @@ -44,6 +44,8 @@ namespace Ndk void Clear() noexcept; + const EntityHandle& CloneEntity(EntityId id); + const EntityHandle& GetEntity(EntityId id); inline const EntityList& GetEntities(); inline BaseSystem& GetSystem(SystemIndex index); diff --git a/SDK/src/NDK/Entity.cpp b/SDK/src/NDK/Entity.cpp index 680ff56d9..ecd74ebc0 100644 --- a/SDK/src/NDK/Entity.cpp +++ b/SDK/src/NDK/Entity.cpp @@ -61,6 +61,14 @@ namespace Ndk return component; } + const EntityHandle& Entity::Clone() const + { + ///DOC: The clone is enabled by default, even if the original entity is disabled + NazaraAssert(IsValid(), "Invalid entity"); + + return m_world->CloneEntity(m_id); + } + void Entity::Kill() { m_world->KillEntity(this); diff --git a/SDK/src/NDK/World.cpp b/SDK/src/NDK/World.cpp index e5b2d874a..8e5ff99f0 100644 --- a/SDK/src/NDK/World.cpp +++ b/SDK/src/NDK/World.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -74,6 +75,27 @@ namespace Ndk m_killedEntities.Clear(); } + const EntityHandle& World::CloneEntity(EntityId id) + { + EntityHandle original = GetEntity(id); + if (!original) + { + NazaraError("Invalid entity ID"); + return EntityHandle::InvalidHandle; + } + + EntityHandle clone = CreateEntity(); + + const Nz::Bitset<>& componentBits = original->GetComponentBits(); + for (std::size_t i = componentBits.FindFirst(); i != componentBits.npos; i = componentBits.FindNext(i)) + { + std::unique_ptr component(original->GetComponent(ComponentIndex(i)).Clone()); + clone->AddComponent(std::move(component)); + } + + return GetEntity(clone->GetId()); + } + void World::KillEntity(Entity* entity) { ///DOC: Ignoré si l'entité est invalide From 31c1ecf2d96c0226a26189127fc592c5068f30b4 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sat, 13 Aug 2016 01:23:30 +0200 Subject: [PATCH 16/74] Utility/OBJParser: Fix a missing word.. hue Former-commit-id: 357348b74fb8f1e239d5a67b8d4f9b0fd34a8fbc [formerly 2bfafc91c414605a7342292d97799d6504d5f35e] [formerly 4865ea51c0edb3a906cdfb123703247b32c37e87 [formerly b249d3c2f772478305fd8d0835973afeca98fe06]] Former-commit-id: 571f6e4e4ca8978ca99b0ef23ebfaf7f61fef1aa [formerly 619108f298636726524e879cfc64606fe90b2737] Former-commit-id: 3cf2524d1b2ed8bedadb910c6f49af71ae2452f3 --- src/Nazara/Utility/Formats/OBJParser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Nazara/Utility/Formats/OBJParser.cpp b/src/Nazara/Utility/Formats/OBJParser.cpp index 403950a97..e2b63b467 100644 --- a/src/Nazara/Utility/Formats/OBJParser.cpp +++ b/src/Nazara/Utility/Formats/OBJParser.cpp @@ -300,7 +300,7 @@ namespace Nz m_positions.push_back(vertex); #if NAZARA_UTILITY_STRICT_RESOURCE_PARSING else if (!UnrecognizedLine()) - false; + return false; #endif } else if (word == "vn") @@ -311,7 +311,7 @@ namespace Nz m_normals.push_back(normal); #if NAZARA_UTILITY_STRICT_RESOURCE_PARSING else if (!UnrecognizedLine()) - false; + return false; #endif } else if (word == "vt") @@ -322,12 +322,12 @@ namespace Nz m_texCoords.push_back(uvw); #if NAZARA_UTILITY_STRICT_RESOURCE_PARSING else if (!UnrecognizedLine()) - false; + return false; #endif } #if NAZARA_UTILITY_STRICT_RESOURCE_PARSING else if (!UnrecognizedLine()) - false; + return false; #endif break; From 262f4c2a871e611143b09b9e3becb1da511e6514 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 17:54:37 +0200 Subject: [PATCH 17/74] Graphics/Particles: Add wrappers on functions controller/generator/renderer Former-commit-id: 8a0eab88a918f901e918a81cc8a81906167eccb8 [formerly 1fea24282314656473187fd5320f36eb6d06c004] [formerly ec24ee686b68f7e684853d49772105bc5a92b5a0 [formerly e9d6783dd6dff1de2468bd0fd979b28037b1cb44]] Former-commit-id: fc6ad0e1dbf563f3b3b485fe9c7f93b35c0712bc [formerly 9cfcb29a154a3461183695df3daccbb8965eaee9] Former-commit-id: b91d72a005fdb104711fb8892b14a5f98fc29ab3 --- .../Graphics/ParticleFunctionController.hpp | 45 ++++++++++++++++++ .../Graphics/ParticleFunctionController.inl | 46 +++++++++++++++++++ .../Graphics/ParticleFunctionGenerator.hpp | 45 ++++++++++++++++++ .../Graphics/ParticleFunctionGenerator.inl | 46 +++++++++++++++++++ .../Graphics/ParticleFunctionRenderer.hpp | 45 ++++++++++++++++++ .../Graphics/ParticleFunctionRenderer.inl | 46 +++++++++++++++++++ .../Graphics/ParticleFunctionController.cpp | 29 ++++++++++++ .../Graphics/ParticleFunctionGenerator.cpp | 28 +++++++++++ .../Graphics/ParticleFunctionRenderer.cpp | 29 ++++++++++++ 9 files changed, 359 insertions(+) create mode 100644 include/Nazara/Graphics/ParticleFunctionController.hpp create mode 100644 include/Nazara/Graphics/ParticleFunctionController.inl create mode 100644 include/Nazara/Graphics/ParticleFunctionGenerator.hpp create mode 100644 include/Nazara/Graphics/ParticleFunctionGenerator.inl create mode 100644 include/Nazara/Graphics/ParticleFunctionRenderer.hpp create mode 100644 include/Nazara/Graphics/ParticleFunctionRenderer.inl create mode 100644 src/Nazara/Graphics/ParticleFunctionController.cpp create mode 100644 src/Nazara/Graphics/ParticleFunctionGenerator.cpp create mode 100644 src/Nazara/Graphics/ParticleFunctionRenderer.cpp diff --git a/include/Nazara/Graphics/ParticleFunctionController.hpp b/include/Nazara/Graphics/ParticleFunctionController.hpp new file mode 100644 index 000000000..6b3c4a974 --- /dev/null +++ b/include/Nazara/Graphics/ParticleFunctionController.hpp @@ -0,0 +1,45 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#pragma once + +#ifndef NAZARA_PARTICLEFUNCTIONCONTROLLER_HPP +#define NAZARA_PARTICLEFUNCTIONCONTROLLER_HPP + +#include +#include +#include + +namespace Nz +{ + class ParticleFunctionController; + + using ParticleFunctionControllerConstRef = ObjectRef; + using ParticleFunctionControllerRef = ObjectRef; + + class NAZARA_GRAPHICS_API ParticleFunctionController : public ParticleController + { + public: + using Controller = std::function; + + inline ParticleFunctionController(Controller controller); + ParticleFunctionController(const ParticleFunctionController&) = default; + ~ParticleFunctionController() = default; + + void Apply(ParticleGroup& group, ParticleMapper& mapper, unsigned int startId, unsigned int endId, float elapsedTime) override final; + + inline const Controller& GetController() const; + + inline void SetController(Controller controller); + + template static ParticleFunctionControllerRef New(Args&&... args); + + private: + Controller m_controller; + }; +} + +#include + +#endif // NAZARA_PARTICLEFUNCTIONCONTROLLER_HPP diff --git a/include/Nazara/Graphics/ParticleFunctionController.inl b/include/Nazara/Graphics/ParticleFunctionController.inl new file mode 100644 index 000000000..eb4365fda --- /dev/null +++ b/include/Nazara/Graphics/ParticleFunctionController.inl @@ -0,0 +1,46 @@ +// Copyright (C) 2016 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#include +#include +#include + +namespace Nz +{ + inline ParticleFunctionController::ParticleFunctionController(Controller controller) : + m_controller(std::move(controller)) + { + } + + /*! + * \brief Gets the controller function + * + * \return Controller function responsible for particle update + */ + inline const ParticleFunctionController::Controller& ParticleFunctionController::GetController() const + { + return m_controller; + } + + /*! + * \brief Sets the controller function + * + * \remark The controller function must be valid + */ + inline void ParticleFunctionController::SetController(Controller controller) + { + m_controller = std::move(controller); + } + + template + ParticleFunctionControllerRef ParticleFunctionController::New(Args&&... args) + { + std::unique_ptr object(new ParticleFunctionController(std::forward(args)...)); + object->SetPersistent(false); + + return object.release(); + } +} + +#include diff --git a/include/Nazara/Graphics/ParticleFunctionGenerator.hpp b/include/Nazara/Graphics/ParticleFunctionGenerator.hpp new file mode 100644 index 000000000..7aa5bb9f3 --- /dev/null +++ b/include/Nazara/Graphics/ParticleFunctionGenerator.hpp @@ -0,0 +1,45 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#pragma once + +#ifndef NAZARA_PARTICLEFUNCTIONGENERATOR_HPP +#define NAZARA_PARTICLEFUNCTIONGENERATOR_HPP + +#include +#include +#include + +namespace Nz +{ + class ParticleFunctionGenerator; + + using ParticleFunctionGeneratorConstRef = ObjectRef; + using ParticleFunctionGeneratorRef = ObjectRef; + + class NAZARA_GRAPHICS_API ParticleFunctionGenerator : public ParticleGenerator + { + public: + using Generator = std::function; + + inline ParticleFunctionGenerator(Generator controller); + ParticleFunctionGenerator(const ParticleFunctionGenerator&) = default; + ~ParticleFunctionGenerator() = default; + + void Generate(ParticleGroup& group, ParticleMapper& mapper, unsigned int startId, unsigned int endId) override final; + + inline const Generator& GetGenerator() const; + + inline void SetGenerator(Generator generator); + + template static ParticleFunctionGeneratorRef New(Args&&... args); + + private: + Generator m_generator; + }; +} + +#include + +#endif // NAZARA_PARTICLEFUNCTIONGENERATOR_HPP diff --git a/include/Nazara/Graphics/ParticleFunctionGenerator.inl b/include/Nazara/Graphics/ParticleFunctionGenerator.inl new file mode 100644 index 000000000..9cb11683c --- /dev/null +++ b/include/Nazara/Graphics/ParticleFunctionGenerator.inl @@ -0,0 +1,46 @@ +// Copyright (C) 2016 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#include +#include +#include + +namespace Nz +{ + inline ParticleFunctionGenerator::ParticleFunctionGenerator(Generator generator) : + m_generator(std::move(generator)) + { + } + + /*! + * \brief Gets the generator function + * + * \return Generator function responsible for particle creation + */ + inline const ParticleFunctionGenerator::Generator& ParticleFunctionGenerator::GetGenerator() const + { + return m_generator; + } + + /*! + * \brief Sets the generator function + * + * \remark The generator function must be valid + */ + inline void ParticleFunctionGenerator::SetGenerator(Generator generator) + { + m_generator = std::move(generator); + } + + template + ParticleFunctionGeneratorRef ParticleFunctionGenerator::New(Args&&... args) + { + std::unique_ptr object(new ParticleFunctionGenerator(std::forward(args)...)); + object->SetPersistent(false); + + return object.release(); + } +} + +#include diff --git a/include/Nazara/Graphics/ParticleFunctionRenderer.hpp b/include/Nazara/Graphics/ParticleFunctionRenderer.hpp new file mode 100644 index 000000000..810027ae9 --- /dev/null +++ b/include/Nazara/Graphics/ParticleFunctionRenderer.hpp @@ -0,0 +1,45 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#pragma once + +#ifndef NAZARA_PARTICLEFUNCTIONRENDERER_HPP +#define NAZARA_PARTICLEFUNCTIONRENDERER_HPP + +#include +#include +#include + +namespace Nz +{ + class ParticleFunctionRenderer; + + using ParticleFunctionRendererConstRef = ObjectRef; + using ParticleFunctionRendererRef = ObjectRef; + + class NAZARA_GRAPHICS_API ParticleFunctionRenderer : public ParticleRenderer + { + public: + using Renderer = std::function; + + inline ParticleFunctionRenderer(Renderer renderer); + ParticleFunctionRenderer(const ParticleFunctionRenderer&) = default; + ~ParticleFunctionRenderer() = default; + + void Render(const ParticleGroup& group, const ParticleMapper& mapper, unsigned int startId, unsigned int endId, AbstractRenderQueue* renderQueue) override final; + + inline const Renderer& GetRenderer() const; + + inline void SetRenderer(Renderer renderer); + + template static ParticleFunctionRendererRef New(Args&&... args); + + private: + Renderer m_renderer; + }; +} + +#include + +#endif // NAZARA_PARTICLEFUNCTIONRENDERER_HPP diff --git a/include/Nazara/Graphics/ParticleFunctionRenderer.inl b/include/Nazara/Graphics/ParticleFunctionRenderer.inl new file mode 100644 index 000000000..cf859fbfe --- /dev/null +++ b/include/Nazara/Graphics/ParticleFunctionRenderer.inl @@ -0,0 +1,46 @@ +// Copyright (C) 2016 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#include +#include +#include + +namespace Nz +{ + inline ParticleFunctionRenderer::ParticleFunctionRenderer(Renderer renderer) : + m_renderer(std::move(renderer)) + { + } + + /*! + * \brief Gets the renderer function + * + * \return Renderer function responsible for particle rendering + */ + inline const ParticleFunctionRenderer::Renderer& ParticleFunctionRenderer::GetRenderer() const + { + return m_renderer; + } + + /*! + * \brief Sets the renderer function + * + * \remark The renderer function must be valid + */ + inline void ParticleFunctionRenderer::SetRenderer(Renderer renderer) + { + m_renderer = std::move(renderer); + } + + template + ParticleFunctionRendererRef ParticleFunctionRenderer::New(Args&&... args) + { + std::unique_ptr object(new ParticleFunctionRenderer(std::forward(args)...)); + object->SetPersistent(false); + + return object.release(); + } +} + +#include diff --git a/src/Nazara/Graphics/ParticleFunctionController.cpp b/src/Nazara/Graphics/ParticleFunctionController.cpp new file mode 100644 index 000000000..9b300f450 --- /dev/null +++ b/src/Nazara/Graphics/ParticleFunctionController.cpp @@ -0,0 +1,29 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#include +#include + +namespace Nz +{ + /*! + * \ingroup graphics + * \class Nz::ParticleFunctionController + * \brief Helper class used to provide a function as a particle controller without going in the process of making a new class + */ + + /*! + * \brief Calls the controller function + * + * \param group Particle group responsible of the particles + * \param mapper Particle mapper, allowing access to the particle data + * \param startId The first ID of the particle to update (inclusive) + * \param endId The last ID of the particle to update (inclusive) + * \param elapsedTime Elapsed time in seconds since the last update + */ + void ParticleFunctionController::Apply(ParticleGroup& group, ParticleMapper& mapper, unsigned int startId, unsigned int endId, float elapsedTime) + { + m_controller(group, mapper, startId, endId, elapsedTime); + } +} diff --git a/src/Nazara/Graphics/ParticleFunctionGenerator.cpp b/src/Nazara/Graphics/ParticleFunctionGenerator.cpp new file mode 100644 index 000000000..67d43770d --- /dev/null +++ b/src/Nazara/Graphics/ParticleFunctionGenerator.cpp @@ -0,0 +1,28 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#include +#include + +namespace Nz +{ + /*! + * \ingroup graphics + * \class Nz::ParticleFunctionGenerator + * \brief Helper class used to provide a function as a particle generator without going in the process of making a new class + */ + + /*! + * \brief Calls the generator function + * + * \param group Particle group responsible of the particles + * \param mapper Particle mapper, allowing access to the particle data + * \param startId The first ID of the particle to update (inclusive) + * \param endId The last ID of the particle to update (inclusive) + */ + void ParticleFunctionGenerator::Generate(ParticleGroup& group, ParticleMapper& mapper, unsigned int startId, unsigned int endId) + { + m_generator(group, mapper, startId, endId); + } +} diff --git a/src/Nazara/Graphics/ParticleFunctionRenderer.cpp b/src/Nazara/Graphics/ParticleFunctionRenderer.cpp new file mode 100644 index 000000000..36dfea3df --- /dev/null +++ b/src/Nazara/Graphics/ParticleFunctionRenderer.cpp @@ -0,0 +1,29 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Engine - Graphics module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#include +#include + +namespace Nz +{ + /*! + * \ingroup graphics + * \class Nz::ParticleFunctionRenderer + * \brief Helper class used to provide a function as a particle renderer without going in the process of making a new class + */ + + /*! + * \brief Calls the renderer function + * + * \param group Particle group responsible of the particles + * \param mapper Particle mapper, allowing constant access to the particle data + * \param startId The first ID of the particle to update (inclusive) + * \param endId The last ID of the particle to update (inclusive) + * \param renderQueue The concerned render queue that will receive drawable informations + */ + void ParticleFunctionRenderer::Render(const ParticleGroup& group, const ParticleMapper& mapper, unsigned int startId, unsigned int endId, AbstractRenderQueue* renderQueue) + { + m_renderer(group, mapper, startId, endId, renderQueue); + } +} From b0c277c7c128075ebb7ac6962c3529f90d313f85 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 17:56:01 +0200 Subject: [PATCH 18/74] SDK/System: Add possibility to disable systems without destroying them Former-commit-id: 1493cf5e743cf96084588a751ff92bfc35732a6d [formerly bc8fceb313fe789262c13eb9714cdc4b5e43bb8b] [formerly 25a7db8fa5e658180231fc8ad7f1b9e15c560771 [formerly d43ffc393e253069feafa3c82d2d12db6c7c48fc]] Former-commit-id: 7368a2e39183cd6611442f786b9c1f124f803e6b [formerly 421f1b00641d63f9c5a069c90b34c377a5a78f46] Former-commit-id: 9aa635cdb8cc8ebafb78c558d263c63fb3f73670 --- SDK/include/NDK/BaseSystem.hpp | 5 +++++ SDK/include/NDK/BaseSystem.inl | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/SDK/include/NDK/BaseSystem.hpp b/SDK/include/NDK/BaseSystem.hpp index 8e828149d..969f2b773 100644 --- a/SDK/include/NDK/BaseSystem.hpp +++ b/SDK/include/NDK/BaseSystem.hpp @@ -27,6 +27,8 @@ namespace Ndk BaseSystem(BaseSystem&&) noexcept = default; virtual ~BaseSystem(); + inline void Enable(bool enable = true); + virtual BaseSystem* Clone() const = 0; bool Filters(const Entity* entity) const; @@ -36,6 +38,8 @@ namespace Ndk inline float GetUpdateRate() const; inline World& GetWorld() const; + inline bool IsEnabled() const; + inline bool HasEntity(const Entity* entity) const; inline void SetUpdateRate(float updatePerSecond); @@ -86,6 +90,7 @@ namespace Ndk Nz::Bitset<> m_requiredComponents; SystemIndex m_systemIndex; World* m_world; + bool m_updateEnabled; float m_updateCounter; float m_updateRate; diff --git a/SDK/include/NDK/BaseSystem.inl b/SDK/include/NDK/BaseSystem.inl index 0c2811ac0..490b32e76 100644 --- a/SDK/include/NDK/BaseSystem.inl +++ b/SDK/include/NDK/BaseSystem.inl @@ -2,12 +2,14 @@ // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp +#include #include #include namespace Ndk { inline BaseSystem::BaseSystem(SystemIndex systemId) : + m_updateEnabled(true), m_systemIndex(systemId) { SetUpdateRate(30); @@ -17,11 +19,17 @@ namespace Ndk m_excludedComponents(system.m_excludedComponents), m_requiredComponents(system.m_requiredComponents), m_systemIndex(system.m_systemIndex), + m_updateEnabled(system.m_updateEnabled), m_updateCounter(0.f), m_updateRate(system.m_updateRate) { } + inline void BaseSystem::Enable(bool enable) + { + m_updateEnabled = enable; + } + inline const std::vector& BaseSystem::GetEntities() const { return m_entities; @@ -42,6 +50,11 @@ namespace Ndk return *m_world; } + inline bool BaseSystem::IsEnabled() const + { + return m_updateEnabled; + } + inline bool BaseSystem::HasEntity(const Entity* entity) const { if (!entity) @@ -58,6 +71,9 @@ namespace Ndk inline void BaseSystem::Update(float elapsedTime) { + if (!IsEnabled()) + return; + if (m_updateRate > 0.f) { m_updateCounter += elapsedTime; From 06dd70d0395b3ff50bf93667427fd5c07ee6ecbf Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 17:56:36 +0200 Subject: [PATCH 19/74] SDK/ParticleGroupComponent: Fix ParticleGroupComponent not being a handled object Former-commit-id: 7dbe5f2288359a3cb9c90f1ffd3e010267cff137 [formerly 4279de72db6b2bf3df4465a193b8117291b1cec9] [formerly d1273d67b4befe12a886274b582689c59df1034b [formerly 1cbab93dc9494d2e9bb81637238cd3ee0683f294]] Former-commit-id: 62415a394f4337dc0fcf01fa180aff8beff0bbe9 [formerly 8b4ae9d8ba4392ec4e6f14e471080fa1021b552d] Former-commit-id: 278a94e669730dd8344d294de3039ecd870a0d18 --- SDK/include/NDK/Components/ParticleGroupComponent.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.hpp b/SDK/include/NDK/Components/ParticleGroupComponent.hpp index 0dce5dd23..549a6df5c 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.hpp +++ b/SDK/include/NDK/Components/ParticleGroupComponent.hpp @@ -17,7 +17,7 @@ namespace Ndk using ParticleGroupComponentHandle = Nz::ObjectHandle; - class NDK_API ParticleGroupComponent : public Component, public Nz::ParticleGroup + class NDK_API ParticleGroupComponent : public Component, public Nz::ParticleGroup, public Nz::HandledObject { public: inline ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout); From 56e320baa3a6e77dfe8f27ceb3d4e184dd6c4f39 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 17:57:53 +0200 Subject: [PATCH 20/74] Graphics/ParticleDeclaration: Fix particle declarations leak Former-commit-id: f3bfd3eae0d9f355fb6305eae32ea89893e62e5e [formerly 8118af1525528ad5c7a215b97b0ac50c48f2e864] [formerly b217c105316722dd8c94d7be40fbb03d45758bda [formerly f337a26f1ff53bfe3b9afa48a492b01fa2292d74]] Former-commit-id: b5fc8da0e8c13a15e6647202bdaa95d02a2fe971 [formerly 10298d983fb9206a69ae8c6fa8d11f155e040a86] Former-commit-id: 3594d2e8b2846ab1cff07d27c26020ffb140780a --- include/Nazara/Graphics/ParticleDeclaration.inl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/Nazara/Graphics/ParticleDeclaration.inl b/include/Nazara/Graphics/ParticleDeclaration.inl index 27cd92a22..dafa2653a 100644 --- a/include/Nazara/Graphics/ParticleDeclaration.inl +++ b/include/Nazara/Graphics/ParticleDeclaration.inl @@ -11,6 +11,8 @@ namespace Nz ParticleDeclarationRef ParticleDeclaration::New(Args&&... args) { std::unique_ptr object(new ParticleDeclaration(std::forward(args)...)); + object->SetPersistent(false); + return object.release(); } } From 30380d2979537acf5f24000f08e9aaf967038df9 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 17:58:38 +0200 Subject: [PATCH 21/74] Graphics/MaterialPipeline: Fix default pipeline not having an ubershader Former-commit-id: 740af3fb62dff7b07f184e8d13d00937b5e36f7d [formerly aedb01d9208c9e6579cae5d03e5a0c90424383f7] [formerly eb67802a9d6a3d67590f5c61e4b75c518da792ef [formerly d83b7c4c0241d43fa7d85741f67866303c1e86b6]] Former-commit-id: c89e8612ad25f22a4bc471e916221c7338765b4d [formerly 1a72ceeeb9fa47b40fabfa2c6b98231e918bd18d] Former-commit-id: 105238d08f0f41832751e0768324066c853b84b8 --- src/Nazara/Graphics/MaterialPipeline.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Nazara/Graphics/MaterialPipeline.cpp b/src/Nazara/Graphics/MaterialPipeline.cpp index 4cbd56274..c3d35504f 100644 --- a/src/Nazara/Graphics/MaterialPipeline.cpp +++ b/src/Nazara/Graphics/MaterialPipeline.cpp @@ -58,6 +58,8 @@ namespace Nz void MaterialPipeline::GenerateRenderPipeline(UInt32 flags) const { + NazaraAssert(m_pipelineInfo.uberShader, "Material pipeline has no uber shader"); + ParameterList list; list.SetParameter("ALPHA_MAPPING", m_pipelineInfo.hasAlphaMap); list.SetParameter("ALPHA_TEST", m_pipelineInfo.alphaTest); @@ -136,6 +138,7 @@ namespace Nz // Once the base shaders are registered, we can now set some default materials MaterialPipelineInfo pipelineInfo; + pipelineInfo.uberShader = UberShaderLibrary::Get("Basic"); // Basic 2D - No depth write/face culling pipelineInfo.depthWrite = false; From 2f007efbfe63b3fda6505186915934cd68328735 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 17:58:54 +0200 Subject: [PATCH 22/74] Graphics/MaterialPipeline: Fix Translucent2D material not having blending enabled Former-commit-id: 98893c36d727a47c802c6aa190c9950e623325a7 [formerly 445ebf13e8ada3852afd0076508fc7fc9ef0cc2a] [formerly d050d8e58c2e4b7a25e450b7487d15986ec5f116 [formerly ca2c8cb540fe5dfc57ec766df017a1a6c03ebab9]] Former-commit-id: cea769b7017ab98074f009cdf49749132d606248 [formerly f7492974f1ad6c2698de4357cd1d6bac354888de] Former-commit-id: 22369659913859e780aa9db111bcc24823b68936 --- src/Nazara/Graphics/MaterialPipeline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Nazara/Graphics/MaterialPipeline.cpp b/src/Nazara/Graphics/MaterialPipeline.cpp index c3d35504f..2ca062ad6 100644 --- a/src/Nazara/Graphics/MaterialPipeline.cpp +++ b/src/Nazara/Graphics/MaterialPipeline.cpp @@ -147,7 +147,7 @@ namespace Nz MaterialPipelineLibrary::Register("Basic2D", GetPipeline(pipelineInfo)); // Translucent 2D - Alpha blending with no depth write/face culling - pipelineInfo.blending = false; + pipelineInfo.blending = true; pipelineInfo.depthWrite = false; pipelineInfo.faceCulling = false; pipelineInfo.dstBlend = BlendFunc_InvSrcAlpha; From 6749bde3fcebe749b127421ecfe10ebd234521e1 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 18:00:38 +0200 Subject: [PATCH 23/74] Graphics/MaterialPipeline: Add Translucent3D pipeline Former-commit-id: 022e9e4eb922cc4aa5c9b973614e37fba77379b1 [formerly 26fe778c20258a71515be156a6818b4e37b8cd2e] [formerly dd5cda750e0a5ecbec9bdd0079233c13d4537b95 [formerly 27617b283f8c0d809f59cc76c05b3df75cd4c268]] Former-commit-id: b50ce9e7fa9a7cdc13b372a1aebe257f3df80a65 [formerly c264fd6dab96b279e74d90b8884dc2ffd3c26f9a] Former-commit-id: 4f8a31cb583b21a12df57bd990170b384522e5ea --- src/Nazara/Graphics/MaterialPipeline.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Nazara/Graphics/MaterialPipeline.cpp b/src/Nazara/Graphics/MaterialPipeline.cpp index 2ca062ad6..07865c4cd 100644 --- a/src/Nazara/Graphics/MaterialPipeline.cpp +++ b/src/Nazara/Graphics/MaterialPipeline.cpp @@ -155,6 +155,16 @@ namespace Nz MaterialPipelineLibrary::Register("Translucent2D", GetPipeline(pipelineInfo)); + // Translucent 3D - Alpha blending with depth buffer and no depth write/face culling + pipelineInfo.blending = true; + pipelineInfo.depthBuffer = true; + pipelineInfo.depthWrite = false; + pipelineInfo.faceCulling = false; + pipelineInfo.dstBlend = BlendFunc_InvSrcAlpha; + pipelineInfo.srcBlend = BlendFunc_SrcAlpha; + + MaterialPipelineLibrary::Register("Translucent3D", GetPipeline(pipelineInfo)); + return true; } From bc565e0989f305f965d3129f29a8b814110fe12c Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 18:01:23 +0200 Subject: [PATCH 24/74] SDK/Entity: Add constant component getter Former-commit-id: 743d7014974b3d1aa9ea58e52ed89f9aca511768 [formerly 7038ae6b04a57ddd716c43c43ddb1d9b7d43734e] [formerly 3836f98661a50646c3044a7551cb733bf121c249 [formerly a47cdf1a9da62c3ca2ff2da60d015f98bed6f7cd]] Former-commit-id: 84faa425e9d8b4e6e022c598e076f59cd74b5322 [formerly 5dc0e4aaa6e24ceb84f60cf68ff45dc69cf3f437] Former-commit-id: 888def1e5d87e4ac42616f23ad16497b52df99e5 --- SDK/include/NDK/Entity.hpp | 2 ++ SDK/include/NDK/Entity.inl | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/SDK/include/NDK/Entity.hpp b/SDK/include/NDK/Entity.hpp index 33661eb50..5aeeb8226 100644 --- a/SDK/include/NDK/Entity.hpp +++ b/SDK/include/NDK/Entity.hpp @@ -40,6 +40,8 @@ namespace Ndk inline BaseComponent& GetComponent(ComponentIndex index); template ComponentType& GetComponent(); + inline const BaseComponent& GetComponent(ComponentIndex index) const; + template const ComponentType& GetComponent() const; inline const Nz::Bitset<>& GetComponentBits() const; inline EntityId GetId() const; inline const Nz::Bitset<>& GetSystemBits() const; diff --git a/SDK/include/NDK/Entity.inl b/SDK/include/NDK/Entity.inl index c7937b786..a03130b0d 100644 --- a/SDK/include/NDK/Entity.inl +++ b/SDK/include/NDK/Entity.inl @@ -2,6 +2,7 @@ // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp +#include #include #include #include @@ -50,6 +51,27 @@ namespace Ndk return static_cast(GetComponent(index)); } + inline const BaseComponent& Entity::GetComponent(ComponentIndex index) const + { + ///DOC: Le component doit être présent + NazaraAssert(HasComponent(index), "This component is not part of the entity"); + + BaseComponent* component = m_components[index].get(); + NazaraAssert(component, "Invalid component pointer"); + + return *component; + } + + template + const ComponentType& Entity::GetComponent() const + { + ///DOC: Le component doit être présent + static_assert(std::is_base_of::value, "ComponentType is not a component"); + + ComponentIndex index = GetComponentIndex(); + return static_cast(GetComponent(index)); + } + inline const Nz::Bitset<>& Entity::GetComponentBits() const { return m_componentBits; From c196037cb7ca985041d4be71e2ddf7da4558ea7a Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 14 Aug 2016 18:02:30 +0200 Subject: [PATCH 25/74] Graphics/DeferredBloomPass: *bloom intensifies* Former-commit-id: 7c373dfa8579858334fe08e6a4e4bcba51930019 [formerly 2fb489abdf59b7a424b1db83ecec95c6e5e2b1aa] [formerly 5140918ad3e3ae5a8d834fa33d8f703c85dd674d [formerly a1b3f613332071879be668c792cb8a8b327cc020]] Former-commit-id: ff5f59007fe79f4b15b013ffa39648a9cc0935e2 [formerly 9246b1e9ae1f1e1b94f96ecb9870ab1002f81453] Former-commit-id: dcf3afeac9e3ee890d1107bf6de9a4238a62b4bc --- src/Nazara/Graphics/DeferredBloomPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Nazara/Graphics/DeferredBloomPass.cpp b/src/Nazara/Graphics/DeferredBloomPass.cpp index 9cf39831a..643024ead 100644 --- a/src/Nazara/Graphics/DeferredBloomPass.cpp +++ b/src/Nazara/Graphics/DeferredBloomPass.cpp @@ -23,7 +23,7 @@ namespace Nz m_uniformUpdated(false), m_brightLuminance(0.8f), m_brightMiddleGrey(0.5f), - m_brightThreshold(0.8f), + m_brightThreshold(0.4f), m_blurPassCount(5) { m_bilinearSampler.SetAnisotropyLevel(1); From f3c57a541766857d02af912b7661eda8d1b9a5c8 Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 15 Aug 2016 01:27:33 +0200 Subject: [PATCH 26/74] Graphics/DeferredRenderTechnique: Optimize Deferred Shading No longer copies depth twice Former-commit-id: aa2096ade409861b773bc7302ced27ae84fab858 [formerly 80fd00bd4a75506b128b70a545eb43ff6a3a7071] [formerly d8576a8858caca9314ea67661af0ce7d9077ba9d [formerly e626f2fd62d19ca5f952485478bfe46f4a803227]] Former-commit-id: 363c93e397887e66b25446927bc5ef89e761c488 [formerly a8bee284456d7f46d182ae7df2d565fa29e55b61] Former-commit-id: 168792d853247ada5add8f97057c213af7c801b3 --- include/Nazara/Graphics/DeferredRenderPass.hpp | 2 +- .../Nazara/Graphics/DeferredRenderTechnique.hpp | 6 +++--- src/Nazara/Graphics/DeferredGeometryPass.cpp | 6 +++--- .../Graphics/DeferredPhongLightingPass.cpp | 3 +++ src/Nazara/Graphics/DeferredRenderPass.cpp | 2 +- src/Nazara/Graphics/DeferredRenderTechnique.cpp | 8 +++++--- .../Shaders/DirectionalLight.frag | 9 ++------- .../Shaders/DirectionalLight.frag.h | 2 +- .../DeferredShading/Shaders/PointSpotLight.frag | 3 ++- .../Shaders/PointSpotLight.frag.h | 2 +- .../Resources/Shaders/PhongLighting/core.frag | 17 +---------------- .../Resources/Shaders/PhongLighting/core.frag.h | 2 +- 12 files changed, 24 insertions(+), 38 deletions(-) diff --git a/include/Nazara/Graphics/DeferredRenderPass.hpp b/include/Nazara/Graphics/DeferredRenderPass.hpp index 34a4020a6..7053bbaa5 100644 --- a/include/Nazara/Graphics/DeferredRenderPass.hpp +++ b/include/Nazara/Graphics/DeferredRenderPass.hpp @@ -47,9 +47,9 @@ namespace Nz Vector2ui m_dimensions; DeferredRenderTechnique* m_deferredTechnique; DeferredRenderQueue* m_renderQueue; - RenderBuffer* m_depthStencilBuffer; RenderTexture* m_GBufferRTT; RenderTexture* m_workRTT; + Texture* m_depthStencilTexture; Texture* m_GBuffer[4]; Texture* m_workTextures[2]; diff --git a/include/Nazara/Graphics/DeferredRenderTechnique.hpp b/include/Nazara/Graphics/DeferredRenderTechnique.hpp index e9e357184..36ac47c8b 100644 --- a/include/Nazara/Graphics/DeferredRenderTechnique.hpp +++ b/include/Nazara/Graphics/DeferredRenderTechnique.hpp @@ -37,7 +37,7 @@ namespace Nz void EnablePass(RenderPassType renderPass, int position, bool enable); - RenderBuffer* GetDepthStencilBuffer() const; + Texture* GetDepthStencilTexture() const; Texture* GetGBuffer(unsigned int i) const; RenderTexture* GetGBufferRTT() const; const ForwardRenderTechnique* GetForwardTechnique() const; @@ -69,14 +69,14 @@ namespace Nz std::map>, RenderPassComparator> m_passes; ForwardRenderTechnique m_forwardTechnique; // Must be initialized before the RenderQueue DeferredRenderQueue m_renderQueue; - mutable RenderBufferRef m_depthStencilBuffer; + mutable TextureRef m_depthStencilTexture; mutable RenderTexture m_GBufferRTT; mutable RenderTexture m_workRTT; mutable TextureRef m_GBuffer[4]; mutable TextureRef m_workTextures[2]; mutable Vector2ui m_GBufferSize; const RenderTarget* m_viewerTarget; -}; + }; } #endif // NAZARA_FORWARDRENDERTECHNIQUE_HPP diff --git a/src/Nazara/Graphics/DeferredGeometryPass.cpp b/src/Nazara/Graphics/DeferredGeometryPass.cpp index 3cdcb99fe..1c4f8b8bb 100644 --- a/src/Nazara/Graphics/DeferredGeometryPass.cpp +++ b/src/Nazara/Graphics/DeferredGeometryPass.cpp @@ -232,7 +232,7 @@ namespace Nz unsigned int width = dimensions.x; unsigned int height = dimensions.y; - m_depthStencilBuffer->Create(PixelFormatType_Depth24Stencil8, width, height); + m_depthStencilTexture->Create(ImageType_2D, PixelFormatType_Depth24Stencil8, width, height); m_GBuffer[0]->Create(ImageType_2D, PixelFormatType_RGBA8, width, height); // Texture 0 : Diffuse Color + Specular m_GBuffer[1]->Create(ImageType_2D, PixelFormatType_RG16F, width, height); // Texture 1 : Encoded normal @@ -246,7 +246,7 @@ namespace Nz // Texture 3 : Emission map ? - m_GBufferRTT->AttachBuffer(AttachmentPoint_DepthStencil, 0, m_depthStencilBuffer); + m_GBufferRTT->AttachTexture(AttachmentPoint_DepthStencil, 0, m_depthStencilTexture); m_GBufferRTT->Unlock(); @@ -258,7 +258,7 @@ namespace Nz m_workRTT->AttachTexture(AttachmentPoint_Color, i, m_workTextures[i]); } - m_workRTT->AttachBuffer(AttachmentPoint_DepthStencil, 0, m_depthStencilBuffer); + m_workRTT->AttachTexture(AttachmentPoint_DepthStencil, 0, m_depthStencilTexture); m_workRTT->Unlock(); diff --git a/src/Nazara/Graphics/DeferredPhongLightingPass.cpp b/src/Nazara/Graphics/DeferredPhongLightingPass.cpp index afe17ed13..8f83f9a6b 100644 --- a/src/Nazara/Graphics/DeferredPhongLightingPass.cpp +++ b/src/Nazara/Graphics/DeferredPhongLightingPass.cpp @@ -114,6 +114,9 @@ namespace Nz Renderer::SetTexture(2, m_GBuffer[2]); Renderer::SetTextureSampler(2, m_pointSampler); + Renderer::SetTexture(3, m_depthStencilTexture); + Renderer::SetTextureSampler(3, m_pointSampler); + Renderer::SetClearColor(Color::Black); Renderer::Clear(RendererBuffer_Color); diff --git a/src/Nazara/Graphics/DeferredRenderPass.cpp b/src/Nazara/Graphics/DeferredRenderPass.cpp index da40c01da..280f6658c 100644 --- a/src/Nazara/Graphics/DeferredRenderPass.cpp +++ b/src/Nazara/Graphics/DeferredRenderPass.cpp @@ -48,7 +48,7 @@ namespace Nz m_deferredTechnique = technique; m_renderQueue = static_cast(technique->GetRenderQueue()); - m_depthStencilBuffer = technique->GetDepthStencilBuffer(); + m_depthStencilTexture = technique->GetDepthStencilTexture(); m_GBufferRTT = technique->GetGBufferRTT(); for (unsigned int i = 0; i < 3; ++i) diff --git a/src/Nazara/Graphics/DeferredRenderTechnique.cpp b/src/Nazara/Graphics/DeferredRenderTechnique.cpp index 585091406..45c8bf7c3 100644 --- a/src/Nazara/Graphics/DeferredRenderTechnique.cpp +++ b/src/Nazara/Graphics/DeferredRenderTechnique.cpp @@ -136,7 +136,7 @@ namespace Nz m_renderQueue(static_cast(m_forwardTechnique.GetRenderQueue())), m_GBufferSize(0U) { - m_depthStencilBuffer = RenderBuffer::New(); + m_depthStencilTexture = Texture::New(); for (unsigned int i = 0; i < 2; ++i) m_workTextures[i] = Texture::New(); @@ -305,9 +305,9 @@ namespace Nz * \return Pointer to the rendering buffer */ - RenderBuffer* DeferredRenderTechnique::GetDepthStencilBuffer() const + Texture* DeferredRenderTechnique::GetDepthStencilTexture() const { - return m_depthStencilBuffer; + return m_depthStencilTexture; } /*! @@ -652,6 +652,7 @@ namespace Nz shader->SendInteger(shader->GetUniformLocation("GBuffer0"), 0); shader->SendInteger(shader->GetUniformLocation("GBuffer1"), 1); shader->SendInteger(shader->GetUniformLocation("GBuffer2"), 2); + shader->SendInteger(shader->GetUniformLocation("DepthBuffer"), 3); shader = RegisterDeferredShader("DeferredPointSpotLight", r_fragmentSource_PointSpotLight, sizeof(r_fragmentSource_PointSpotLight), basicVertexStage, &error); @@ -664,6 +665,7 @@ namespace Nz shader->SendInteger(shader->GetUniformLocation("GBuffer0"), 0); shader->SendInteger(shader->GetUniformLocation("GBuffer1"), 1); shader->SendInteger(shader->GetUniformLocation("GBuffer2"), 2); + shader->SendInteger(shader->GetUniformLocation("DepthBuffer"), 3); // Shaders optionnels (S'ils ne sont pas présents, le rendu minimal sera quand même assuré) diff --git a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/DirectionalLight.frag b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/DirectionalLight.frag index dfadac50e..fabb0e6f5 100644 --- a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/DirectionalLight.frag +++ b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/DirectionalLight.frag @@ -11,17 +11,12 @@ uniform vec4 LightDirection; uniform sampler2D GBuffer0; uniform sampler2D GBuffer1; uniform sampler2D GBuffer2; +uniform sampler2D DepthBuffer; uniform mat4 InvViewProjMatrix; uniform vec2 InvTargetSize; uniform vec4 SceneAmbient; -float ColorToFloat(vec3 color) -{ - const vec3 byte_to_float = vec3(1.0, 1.0/256, 1.0/(256*256)); - return dot(color, byte_to_float); -} - #define kPI 3.1415926536 vec3 DecodeNormal(in vec4 encodedNormal) @@ -44,7 +39,7 @@ void main() vec3 diffuseColor = gVec0.xyz; vec3 normal = DecodeNormal(gVec1); float specularMultiplier = gVec0.w; - float depth = ColorToFloat(gVec2.xyz); + float depth = textureLod(DepthBuffer, texCoord, 0.0).r; float shininess = (gVec2.w == 0.0) ? 0.0 : exp2(gVec2.w*10.5); vec3 lightDir = -LightDirection.xyz; diff --git a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/DirectionalLight.frag.h b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/DirectionalLight.frag.h index ef67feeb4..b8ba80ab6 100644 --- a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/DirectionalLight.frag.h +++ b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/DirectionalLight.frag.h @@ -1 +1 @@ -35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,118,101,99,51,32,69,121,101,80,111,115,105,116,105,111,110,59,13,10,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,67,111,108,111,114,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,76,105,103,104,116,70,97,99,116,111,114,115,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,68,105,114,101,99,116,105,111,110,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,48,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,49,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,50,59,13,10,13,10,117,110,105,102,111,114,109,32,109,97,116,52,32,73,110,118,86,105,101,119,80,114,111,106,77,97,116,114,105,120,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,83,99,101,110,101,65,109,98,105,101,110,116,59,13,10,13,10,102,108,111,97,116,32,67,111,108,111,114,84,111,70,108,111,97,116,40,118,101,99,51,32,99,111,108,111,114,41,13,10,123,32,9,13,10,9,99,111,110,115,116,32,118,101,99,51,32,98,121,116,101,95,116,111,95,102,108,111,97,116,32,61,32,118,101,99,51,40,49,46,48,44,32,49,46,48,47,50,53,54,44,32,49,46,48,47,40,50,53,54,42,50,53,54,41,41,59,13,10,9,114,101,116,117,114,110,32,100,111,116,40,99,111,108,111,114,44,32,98,121,116,101,95,116,111,95,102,108,111,97,116,41,59,13,10,125,13,10,13,10,35,100,101,102,105,110,101,32,107,80,73,32,51,46,49,52,49,53,57,50,54,53,51,54,13,10,13,10,118,101,99,51,32,68,101,99,111,100,101,78,111,114,109,97,108,40,105,110,32,118,101,99,52,32,101,110,99,111,100,101,100,78,111,114,109,97,108,41,13,10,123,13,10,9,47,47,114,101,116,117,114,110,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,120,121,122,42,50,46,48,32,45,32,49,46,48,59,9,13,10,9,102,108,111,97,116,32,97,32,61,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,120,32,42,32,107,80,73,59,13,10,32,32,32,32,118,101,99,50,32,115,99,116,104,32,61,32,118,101,99,50,40,115,105,110,40,97,41,44,32,99,111,115,40,97,41,41,59,13,10,13,10,32,32,32,32,118,101,99,50,32,115,99,112,104,105,32,61,32,118,101,99,50,40,115,113,114,116,40,49,46,48,32,45,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,42,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,41,44,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,41,59,13,10,32,32,32,32,114,101,116,117,114,110,32,118,101,99,51,40,115,99,116,104,46,121,42,115,99,112,104,105,46,120,44,32,115,99,116,104,46,120,42,115,99,112,104,105,46,120,44,32,115,99,112,104,105,46,121,41,59,13,10,125,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,9,118,101,99,52,32,103,86,101,99,48,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,48,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,9,118,101,99,52,32,103,86,101,99,49,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,49,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,9,118,101,99,52,32,103,86,101,99,50,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,50,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,100,105,102,102,117,115,101,67,111,108,111,114,32,61,32,103,86,101,99,48,46,120,121,122,59,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,68,101,99,111,100,101,78,111,114,109,97,108,40,103,86,101,99,49,41,59,13,10,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,77,117,108,116,105,112,108,105,101,114,32,61,32,103,86,101,99,48,46,119,59,13,10,9,102,108,111,97,116,32,100,101,112,116,104,32,61,32,67,111,108,111,114,84,111,70,108,111,97,116,40,103,86,101,99,50,46,120,121,122,41,59,13,10,9,102,108,111,97,116,32,115,104,105,110,105,110,101,115,115,32,61,32,40,103,86,101,99,50,46,119,32,61,61,32,48,46,48,41,32,63,32,48,46,48,32,58,32,101,120,112,50,40,103,86,101,99,50,46,119,42,49,48,46,53,41,59,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,68,105,114,101,99,116,105,111,110,46,120,121,122,59,13,10,13,10,9,47,47,32,65,109,98,105,101,110,116,13,10,9,118,101,99,51,32,108,105,103,104,116,65,109,98,105,101,110,116,32,61,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,76,105,103,104,116,70,97,99,116,111,114,115,46,120,32,42,32,40,118,101,99,51,40,49,46,48,41,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,47,47,32,68,105,102,102,117,115,101,13,10,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,102,102,117,115,101,32,61,32,108,97,109,98,101,114,116,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,76,105,103,104,116,70,97,99,116,111,114,115,46,121,59,13,10,13,10,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,118,101,99,51,32,108,105,103,104,116,83,112,101,99,117,108,97,114,59,13,10,9,105,102,32,40,115,104,105,110,105,110,101,115,115,32,62,32,48,46,48,41,13,10,9,123,13,10,9,9,118,101,99,51,32,118,105,101,119,83,112,97,99,101,32,61,32,118,101,99,51,40,116,101,120,67,111,111,114,100,42,50,46,48,32,45,32,49,46,48,44,32,100,101,112,116,104,42,50,46,48,32,45,32,49,46,48,41,59,13,10,13,10,9,9,118,101,99,52,32,119,111,114,108,100,80,111,115,32,61,32,73,110,118,86,105,101,119,80,114,111,106,77,97,116,114,105,120,32,42,32,118,101,99,52,40,118,105,101,119,83,112,97,99,101,44,32,49,46,48,41,59,13,10,9,9,119,111,114,108,100,80,111,115,46,120,121,122,32,47,61,32,119,111,114,108,100,80,111,115,46,119,59,13,10,13,10,9,9,118,101,99,51,32,101,121,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,69,121,101,80,111,115,105,116,105,111,110,32,45,32,119,111,114,108,100,80,111,115,46,120,121,122,41,59,13,10,13,10,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,115,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,115,112,101,99,117,108,97,114,77,117,108,116,105,112,108,105,101,114,59,13,10,9,125,13,10,9,101,108,115,101,13,10,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,100,105,102,102,117,115,101,67,111,108,111,114,32,42,32,40,108,105,103,104,116,65,109,98,105,101,110,116,32,43,32,108,105,103,104,116,68,105,102,102,117,115,101,32,43,32,108,105,103,104,116,83,112,101,99,117,108,97,114,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,102,114,97,103,109,101,110,116,67,111,108,111,114,44,32,49,46,48,41,59,13,10,125, \ No newline at end of file +35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,118,101,99,51,32,69,121,101,80,111,115,105,116,105,111,110,59,13,10,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,67,111,108,111,114,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,76,105,103,104,116,70,97,99,116,111,114,115,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,68,105,114,101,99,116,105,111,110,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,48,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,49,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,50,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,68,101,112,116,104,66,117,102,102,101,114,59,13,10,13,10,117,110,105,102,111,114,109,32,109,97,116,52,32,73,110,118,86,105,101,119,80,114,111,106,77,97,116,114,105,120,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,83,99,101,110,101,65,109,98,105,101,110,116,59,13,10,13,10,35,100,101,102,105,110,101,32,107,80,73,32,51,46,49,52,49,53,57,50,54,53,51,54,13,10,13,10,118,101,99,51,32,68,101,99,111,100,101,78,111,114,109,97,108,40,105,110,32,118,101,99,52,32,101,110,99,111,100,101,100,78,111,114,109,97,108,41,13,10,123,13,10,9,47,47,114,101,116,117,114,110,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,120,121,122,42,50,46,48,32,45,32,49,46,48,59,9,13,10,9,102,108,111,97,116,32,97,32,61,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,120,32,42,32,107,80,73,59,13,10,32,32,32,32,118,101,99,50,32,115,99,116,104,32,61,32,118,101,99,50,40,115,105,110,40,97,41,44,32,99,111,115,40,97,41,41,59,13,10,13,10,32,32,32,32,118,101,99,50,32,115,99,112,104,105,32,61,32,118,101,99,50,40,115,113,114,116,40,49,46,48,32,45,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,42,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,41,44,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,41,59,13,10,32,32,32,32,114,101,116,117,114,110,32,118,101,99,51,40,115,99,116,104,46,121,42,115,99,112,104,105,46,120,44,32,115,99,116,104,46,120,42,115,99,112,104,105,46,120,44,32,115,99,112,104,105,46,121,41,59,13,10,125,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,9,118,101,99,52,32,103,86,101,99,48,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,48,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,9,118,101,99,52,32,103,86,101,99,49,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,49,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,9,118,101,99,52,32,103,86,101,99,50,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,50,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,100,105,102,102,117,115,101,67,111,108,111,114,32,61,32,103,86,101,99,48,46,120,121,122,59,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,68,101,99,111,100,101,78,111,114,109,97,108,40,103,86,101,99,49,41,59,13,10,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,77,117,108,116,105,112,108,105,101,114,32,61,32,103,86,101,99,48,46,119,59,13,10,9,102,108,111,97,116,32,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,76,111,100,40,68,101,112,116,104,66,117,102,102,101,114,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,59,13,10,9,102,108,111,97,116,32,115,104,105,110,105,110,101,115,115,32,61,32,40,103,86,101,99,50,46,119,32,61,61,32,48,46,48,41,32,63,32,48,46,48,32,58,32,101,120,112,50,40,103,86,101,99,50,46,119,42,49,48,46,53,41,59,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,68,105,114,101,99,116,105,111,110,46,120,121,122,59,13,10,13,10,9,47,47,32,65,109,98,105,101,110,116,13,10,9,118,101,99,51,32,108,105,103,104,116,65,109,98,105,101,110,116,32,61,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,76,105,103,104,116,70,97,99,116,111,114,115,46,120,32,42,32,40,118,101,99,51,40,49,46,48,41,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,47,47,32,68,105,102,102,117,115,101,13,10,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,102,102,117,115,101,32,61,32,108,97,109,98,101,114,116,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,76,105,103,104,116,70,97,99,116,111,114,115,46,121,59,13,10,13,10,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,118,101,99,51,32,108,105,103,104,116,83,112,101,99,117,108,97,114,59,13,10,9,105,102,32,40,115,104,105,110,105,110,101,115,115,32,62,32,48,46,48,41,13,10,9,123,13,10,9,9,118,101,99,51,32,118,105,101,119,83,112,97,99,101,32,61,32,118,101,99,51,40,116,101,120,67,111,111,114,100,42,50,46,48,32,45,32,49,46,48,44,32,100,101,112,116,104,42,50,46,48,32,45,32,49,46,48,41,59,13,10,13,10,9,9,118,101,99,52,32,119,111,114,108,100,80,111,115,32,61,32,73,110,118,86,105,101,119,80,114,111,106,77,97,116,114,105,120,32,42,32,118,101,99,52,40,118,105,101,119,83,112,97,99,101,44,32,49,46,48,41,59,13,10,9,9,119,111,114,108,100,80,111,115,46,120,121,122,32,47,61,32,119,111,114,108,100,80,111,115,46,119,59,13,10,13,10,9,9,118,101,99,51,32,101,121,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,69,121,101,80,111,115,105,116,105,111,110,32,45,32,119,111,114,108,100,80,111,115,46,120,121,122,41,59,13,10,13,10,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,115,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,115,112,101,99,117,108,97,114,77,117,108,116,105,112,108,105,101,114,59,13,10,9,125,13,10,9,101,108,115,101,13,10,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,100,105,102,102,117,115,101,67,111,108,111,114,32,42,32,40,108,105,103,104,116,65,109,98,105,101,110,116,32,43,32,108,105,103,104,116,68,105,102,102,117,115,101,32,43,32,108,105,103,104,116,83,112,101,99,117,108,97,114,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,102,114,97,103,109,101,110,116,67,111,108,111,114,44,32,49,46,48,41,59,13,10,125, \ No newline at end of file diff --git a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/PointSpotLight.frag b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/PointSpotLight.frag index bb85cbbe6..37b3f5e1a 100644 --- a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/PointSpotLight.frag +++ b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/PointSpotLight.frag @@ -19,6 +19,7 @@ uniform vec2 LightParameters3; uniform sampler2D GBuffer0; uniform sampler2D GBuffer1; uniform sampler2D GBuffer2; +uniform sampler2D DepthBuffer; uniform mat4 InvViewProjMatrix; uniform vec2 InvTargetSize; @@ -57,7 +58,7 @@ void main() vec3 diffuseColor = gVec0.xyz; vec3 normal = DecodeNormal(gVec1); float specularMultiplier = gVec0.w; - float depth = ColorToFloat(gVec2.xyz); + float depth = textureLod(DepthBuffer, texCoord, 0.0).r; float shininess = (gVec2.w == 0.0) ? 0.0 : exp2(gVec2.w*10.5); vec3 viewSpace = vec3(texCoord*2.0 - 1.0, depth*2.0 - 1.0); diff --git a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/PointSpotLight.frag.h b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/PointSpotLight.frag.h index 14376fb95..7f0de77ea 100644 --- a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/PointSpotLight.frag.h +++ b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/PointSpotLight.frag.h @@ -1 +1 @@ -35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,32,48,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,80,79,73,78,84,32,49,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,83,80,79,84,32,50,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,118,101,99,51,32,69,121,101,80,111,115,105,116,105,111,110,59,13,10,13,10,117,110,105,102,111,114,109,32,105,110,116,32,76,105,103,104,116,84,121,112,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,67,111,108,111,114,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,76,105,103,104,116,70,97,99,116,111,114,115,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,68,105,114,101,99,116,105,111,110,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,49,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,50,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,51,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,48,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,49,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,50,59,13,10,13,10,117,110,105,102,111,114,109,32,109,97,116,52,32,73,110,118,86,105,101,119,80,114,111,106,77,97,116,114,105,120,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,83,99,101,110,101,65,109,98,105,101,110,116,59,13,10,13,10,117,110,105,102,111,114,109,32,98,111,111,108,32,68,105,115,99,97,114,100,32,61,32,102,97,108,115,101,59,13,10,13,10,102,108,111,97,116,32,67,111,108,111,114,84,111,70,108,111,97,116,40,118,101,99,51,32,99,111,108,111,114,41,13,10,123,32,9,13,10,9,99,111,110,115,116,32,118,101,99,51,32,98,121,116,101,95,116,111,95,102,108,111,97,116,32,61,32,118,101,99,51,40,49,46,48,44,32,49,46,48,47,50,53,54,44,32,49,46,48,47,40,50,53,54,42,50,53,54,41,41,59,13,10,9,114,101,116,117,114,110,32,100,111,116,40,99,111,108,111,114,44,32,98,121,116,101,95,116,111,95,102,108,111,97,116,41,59,13,10,125,13,10,13,10,35,100,101,102,105,110,101,32,107,80,73,32,51,46,49,52,49,53,57,50,54,53,51,54,13,10,13,10,118,101,99,51,32,68,101,99,111,100,101,78,111,114,109,97,108,40,105,110,32,118,101,99,52,32,101,110,99,111,100,101,100,78,111,114,109,97,108,41,13,10,123,13,10,9,47,47,114,101,116,117,114,110,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,120,121,122,42,50,46,48,32,45,32,49,46,48,59,13,10,9,102,108,111,97,116,32,97,32,61,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,120,32,42,32,107,80,73,59,13,10,9,118,101,99,50,32,115,99,116,104,32,61,32,118,101,99,50,40,115,105,110,40,97,41,44,32,99,111,115,40,97,41,41,59,13,10,13,10,9,118,101,99,50,32,115,99,112,104,105,32,61,32,118,101,99,50,40,115,113,114,116,40,49,46,48,32,45,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,42,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,41,44,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,41,59,13,10,9,114,101,116,117,114,110,32,118,101,99,51,40,115,99,116,104,46,121,42,115,99,112,104,105,46,120,44,32,115,99,116,104,46,120,42,115,99,112,104,105,46,120,44,32,115,99,112,104,105,46,121,41,59,13,10,125,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,105,102,32,40,68,105,115,99,97,114,100,41,13,10,9,9,114,101,116,117,114,110,59,13,10,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,9,118,101,99,52,32,103,86,101,99,48,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,48,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,9,118,101,99,52,32,103,86,101,99,49,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,49,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,9,118,101,99,52,32,103,86,101,99,50,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,50,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,100,105,102,102,117,115,101,67,111,108,111,114,32,61,32,103,86,101,99,48,46,120,121,122,59,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,68,101,99,111,100,101,78,111,114,109,97,108,40,103,86,101,99,49,41,59,13,10,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,77,117,108,116,105,112,108,105,101,114,32,61,32,103,86,101,99,48,46,119,59,13,10,9,102,108,111,97,116,32,100,101,112,116,104,32,61,32,67,111,108,111,114,84,111,70,108,111,97,116,40,103,86,101,99,50,46,120,121,122,41,59,13,10,9,102,108,111,97,116,32,115,104,105,110,105,110,101,115,115,32,61,32,40,103,86,101,99,50,46,119,32,61,61,32,48,46,48,41,32,63,32,48,46,48,32,58,32,101,120,112,50,40,103,86,101,99,50,46,119,42,49,48,46,53,41,59,13,10,13,10,9,118,101,99,51,32,118,105,101,119,83,112,97,99,101,32,61,32,118,101,99,51,40,116,101,120,67,111,111,114,100,42,50,46,48,32,45,32,49,46,48,44,32,100,101,112,116,104,42,50,46,48,32,45,32,49,46,48,41,59,13,10,13,10,9,118,101,99,52,32,119,111,114,108,100,80,111,115,32,61,32,73,110,118,86,105,101,119,80,114,111,106,77,97,116,114,105,120,32,42,32,118,101,99,52,40,118,105,101,119,83,112,97,99,101,44,32,49,46,48,41,59,13,10,9,119,111,114,108,100,80,111,115,46,120,121,122,32,47,61,32,119,111,114,108,100,80,111,115,46,119,59,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,49,46,120,121,122,32,45,32,119,111,114,108,100,80,111,115,46,120,121,122,59,13,10,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,108,105,103,104,116,68,105,114,41,59,13,10,9,108,105,103,104,116,68,105,114,32,47,61,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,13,10,13,10,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,49,46,119,32,45,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,50,46,119,42,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,13,10,13,10,9,47,47,32,65,109,98,105,101,110,116,13,10,9,118,101,99,51,32,108,105,103,104,116,65,109,98,105,101,110,116,32,61,32,97,116,116,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,76,105,103,104,116,70,97,99,116,111,114,115,46,120,32,42,32,40,118,101,99,51,40,49,46,48,41,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,105,102,32,40,76,105,103,104,116,84,121,112,101,32,61,61,32,76,73,71,72,84,95,83,80,79,84,41,13,10,9,123,13,10,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,13,10,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,50,46,120,121,122,44,32,45,108,105,103,104,116,68,105,114,41,59,13,10,9,9,102,108,111,97,116,32,111,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,51,46,121,59,13,10,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,51,46,120,32,45,32,111,117,116,101,114,65,110,103,108,101,59,13,10,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,111,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,13,10,9,125,13,10,9,13,10,9,47,47,32,68,105,102,102,117,115,101,13,10,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,102,102,117,115,101,32,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,76,105,103,104,116,70,97,99,116,111,114,115,46,121,59,13,10,13,10,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,118,101,99,51,32,108,105,103,104,116,83,112,101,99,117,108,97,114,59,13,10,9,105,102,32,40,115,104,105,110,105,110,101,115,115,32,62,32,48,46,48,41,13,10,9,123,13,10,9,9,118,101,99,51,32,101,121,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,69,121,101,80,111,115,105,116,105,111,110,32,45,32,119,111,114,108,100,80,111,115,46,120,121,122,41,59,13,10,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,115,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,115,112,101,99,117,108,97,114,77,117,108,116,105,112,108,105,101,114,59,13,10,9,125,13,10,9,101,108,115,101,13,10,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,100,105,102,102,117,115,101,67,111,108,111,114,32,42,32,40,108,105,103,104,116,65,109,98,105,101,110,116,32,43,32,108,105,103,104,116,68,105,102,102,117,115,101,32,43,32,108,105,103,104,116,83,112,101,99,117,108,97,114,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,102,114,97,103,109,101,110,116,67,111,108,111,114,44,32,49,46,48,41,59,13,10,125, \ No newline at end of file +35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,32,48,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,80,79,73,78,84,32,49,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,83,80,79,84,32,50,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,118,101,99,51,32,69,121,101,80,111,115,105,116,105,111,110,59,13,10,13,10,117,110,105,102,111,114,109,32,105,110,116,32,76,105,103,104,116,84,121,112,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,67,111,108,111,114,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,76,105,103,104,116,70,97,99,116,111,114,115,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,68,105,114,101,99,116,105,111,110,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,49,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,50,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,51,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,48,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,49,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,71,66,117,102,102,101,114,50,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,68,101,112,116,104,66,117,102,102,101,114,59,13,10,13,10,117,110,105,102,111,114,109,32,109,97,116,52,32,73,110,118,86,105,101,119,80,114,111,106,77,97,116,114,105,120,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,83,99,101,110,101,65,109,98,105,101,110,116,59,13,10,13,10,117,110,105,102,111,114,109,32,98,111,111,108,32,68,105,115,99,97,114,100,32,61,32,102,97,108,115,101,59,13,10,13,10,102,108,111,97,116,32,67,111,108,111,114,84,111,70,108,111,97,116,40,118,101,99,51,32,99,111,108,111,114,41,13,10,123,32,9,13,10,9,99,111,110,115,116,32,118,101,99,51,32,98,121,116,101,95,116,111,95,102,108,111,97,116,32,61,32,118,101,99,51,40,49,46,48,44,32,49,46,48,47,50,53,54,44,32,49,46,48,47,40,50,53,54,42,50,53,54,41,41,59,13,10,9,114,101,116,117,114,110,32,100,111,116,40,99,111,108,111,114,44,32,98,121,116,101,95,116,111,95,102,108,111,97,116,41,59,13,10,125,13,10,13,10,35,100,101,102,105,110,101,32,107,80,73,32,51,46,49,52,49,53,57,50,54,53,51,54,13,10,13,10,118,101,99,51,32,68,101,99,111,100,101,78,111,114,109,97,108,40,105,110,32,118,101,99,52,32,101,110,99,111,100,101,100,78,111,114,109,97,108,41,13,10,123,13,10,9,47,47,114,101,116,117,114,110,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,120,121,122,42,50,46,48,32,45,32,49,46,48,59,13,10,9,102,108,111,97,116,32,97,32,61,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,120,32,42,32,107,80,73,59,13,10,9,118,101,99,50,32,115,99,116,104,32,61,32,118,101,99,50,40,115,105,110,40,97,41,44,32,99,111,115,40,97,41,41,59,13,10,13,10,9,118,101,99,50,32,115,99,112,104,105,32,61,32,118,101,99,50,40,115,113,114,116,40,49,46,48,32,45,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,42,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,41,44,32,101,110,99,111,100,101,100,78,111,114,109,97,108,46,121,41,59,13,10,9,114,101,116,117,114,110,32,118,101,99,51,40,115,99,116,104,46,121,42,115,99,112,104,105,46,120,44,32,115,99,116,104,46,120,42,115,99,112,104,105,46,120,44,32,115,99,112,104,105,46,121,41,59,13,10,125,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,105,102,32,40,68,105,115,99,97,114,100,41,13,10,9,9,114,101,116,117,114,110,59,13,10,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,9,118,101,99,52,32,103,86,101,99,48,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,48,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,9,118,101,99,52,32,103,86,101,99,49,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,49,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,9,118,101,99,52,32,103,86,101,99,50,32,61,32,116,101,120,116,117,114,101,76,111,100,40,71,66,117,102,102,101,114,50,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,100,105,102,102,117,115,101,67,111,108,111,114,32,61,32,103,86,101,99,48,46,120,121,122,59,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,68,101,99,111,100,101,78,111,114,109,97,108,40,103,86,101,99,49,41,59,13,10,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,77,117,108,116,105,112,108,105,101,114,32,61,32,103,86,101,99,48,46,119,59,13,10,9,102,108,111,97,116,32,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,76,111,100,40,68,101,112,116,104,66,117,102,102,101,114,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,59,13,10,9,102,108,111,97,116,32,115,104,105,110,105,110,101,115,115,32,61,32,40,103,86,101,99,50,46,119,32,61,61,32,48,46,48,41,32,63,32,48,46,48,32,58,32,101,120,112,50,40,103,86,101,99,50,46,119,42,49,48,46,53,41,59,13,10,13,10,9,118,101,99,51,32,118,105,101,119,83,112,97,99,101,32,61,32,118,101,99,51,40,116,101,120,67,111,111,114,100,42,50,46,48,32,45,32,49,46,48,44,32,100,101,112,116,104,42,50,46,48,32,45,32,49,46,48,41,59,13,10,13,10,9,118,101,99,52,32,119,111,114,108,100,80,111,115,32,61,32,73,110,118,86,105,101,119,80,114,111,106,77,97,116,114,105,120,32,42,32,118,101,99,52,40,118,105,101,119,83,112,97,99,101,44,32,49,46,48,41,59,13,10,9,119,111,114,108,100,80,111,115,46,120,121,122,32,47,61,32,119,111,114,108,100,80,111,115,46,119,59,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,49,46,120,121,122,32,45,32,119,111,114,108,100,80,111,115,46,120,121,122,59,13,10,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,108,105,103,104,116,68,105,114,41,59,13,10,9,108,105,103,104,116,68,105,114,32,47,61,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,13,10,13,10,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,49,46,119,32,45,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,50,46,119,42,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,13,10,13,10,9,47,47,32,65,109,98,105,101,110,116,13,10,9,118,101,99,51,32,108,105,103,104,116,65,109,98,105,101,110,116,32,61,32,97,116,116,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,76,105,103,104,116,70,97,99,116,111,114,115,46,120,32,42,32,40,118,101,99,51,40,49,46,48,41,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,105,102,32,40,76,105,103,104,116,84,121,112,101,32,61,61,32,76,73,71,72,84,95,83,80,79,84,41,13,10,9,123,13,10,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,13,10,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,50,46,120,121,122,44,32,45,108,105,103,104,116,68,105,114,41,59,13,10,9,9,102,108,111,97,116,32,111,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,51,46,121,59,13,10,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,80,97,114,97,109,101,116,101,114,115,51,46,120,32,45,32,111,117,116,101,114,65,110,103,108,101,59,13,10,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,111,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,13,10,9,125,13,10,9,13,10,9,47,47,32,68,105,102,102,117,115,101,13,10,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,102,102,117,115,101,32,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,76,105,103,104,116,70,97,99,116,111,114,115,46,121,59,13,10,13,10,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,118,101,99,51,32,108,105,103,104,116,83,112,101,99,117,108,97,114,59,13,10,9,105,102,32,40,115,104,105,110,105,110,101,115,115,32,62,32,48,46,48,41,13,10,9,123,13,10,9,9,118,101,99,51,32,101,121,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,69,121,101,80,111,115,105,116,105,111,110,32,45,32,119,111,114,108,100,80,111,115,46,120,121,122,41,59,13,10,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,115,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,76,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,115,112,101,99,117,108,97,114,77,117,108,116,105,112,108,105,101,114,59,13,10,9,125,13,10,9,101,108,115,101,13,10,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,13,10,9,118,101,99,51,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,100,105,102,102,117,115,101,67,111,108,111,114,32,42,32,40,108,105,103,104,116,65,109,98,105,101,110,116,32,43,32,108,105,103,104,116,68,105,102,102,117,115,101,32,43,32,108,105,103,104,116,83,112,101,99,117,108,97,114,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,102,114,97,103,109,101,110,116,67,111,108,111,114,44,32,49,46,48,41,59,13,10,125, \ No newline at end of file diff --git a/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag b/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag index d5eef7a3c..e37df3fa3 100644 --- a/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag +++ b/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag @@ -68,21 +68,6 @@ uniform vec4 SceneAmbient; uniform sampler2D TextureOverlay; /********************Fonctions********************/ -vec3 FloatToColor(float f) -{ - vec3 color; - - f *= 256.0; - color.x = floor(f); - - f = (f - color.x) * 256.0; - color.y = floor(f); - - color.z = f - color.y; - color.xy *= 0.00390625; // *= 1.0/256 - - return color; -} #define kPI 3.1415926536 @@ -184,7 +169,7 @@ void main() */ RenderTarget0 = vec4(diffuseColor.rgb, dot(specularColor, vec3(0.3, 0.59, 0.11))); RenderTarget1 = vec4(EncodeNormal(normal)); - RenderTarget2 = vec4(FloatToColor(gl_FragCoord.z), (MaterialShininess == 0.0) ? 0.0 : max(log2(MaterialShininess), 0.1)/10.5); // http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf + RenderTarget2 = vec4(0.0, 0.0, 0.0, (MaterialShininess == 0.0) ? 0.0 : max(log2(MaterialShininess), 0.1)/10.5); // http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf #else // FLAG_DEFERRED #if ALPHA_MAPPING diffuseColor.a *= texture(MaterialAlphaMap, texCoord).r; diff --git a/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag.h b/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag.h index 650b62ccd..b9e39fa11 100644 --- a/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag.h +++ b/src/Nazara/Graphics/Resources/Shaders/PhongLighting/core.frag.h @@ -1 +1 @@ -35,105,102,32,69,65,82,76,89,95,70,82,65,71,77,69,78,84,95,84,69,83,84,83,32,38,38,32,33,65,76,80,72,65,95,84,69,83,84,13,10,108,97,121,111,117,116,40,101,97,114,108,121,95,102,114,97,103,109,101,110,116,95,116,101,115,116,115,41,32,105,110,59,13,10,35,101,110,100,105,102,13,10,13,10,47,47,32,72,65,67,75,32,85,78,84,73,76,32,80,82,79,80,69,82,32,70,73,88,13,10,35,105,102,32,71,76,83,76,95,86,69,82,83,73,79,78,32,60,32,52,48,48,13,10,9,35,117,110,100,101,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,35,100,101,102,105,110,101,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,32,48,13,10,35,101,110,100,105,102,13,10,47,47,32,72,65,67,75,13,10,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,32,48,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,80,79,73,78,84,32,49,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,83,80,79,84,32,50,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,69,110,116,114,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,105,110,32,118,101,99,52,32,118,67,111,108,111,114,59,13,10,105,110,32,118,101,99,52,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,51,93,59,13,10,105,110,32,109,97,116,51,32,118,76,105,103,104,116,84,111,87,111,114,108,100,59,13,10,105,110,32,118,101,99,51,32,118,78,111,114,109,97,108,59,13,10,105,110,32,118,101,99,50,32,118,84,101,120,67,111,111,114,100,59,13,10,105,110,32,118,101,99,51,32,118,86,105,101,119,68,105,114,59,13,10,105,110,32,118,101,99,51,32,118,87,111,114,108,100,80,111,115,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,83,111,114,116,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,49,59,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,50,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,85,110,105,102,111,114,109,101,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,115,116,114,117,99,116,32,76,105,103,104,116,13,10,123,13,10,9,105,110,116,32,116,121,112,101,59,13,10,9,118,101,99,52,32,99,111,108,111,114,59,13,10,9,118,101,99,50,32,102,97,99,116,111,114,115,59,13,10,13,10,9,118,101,99,52,32,112,97,114,97,109,101,116,101,114,115,49,59,13,10,9,118,101,99,52,32,112,97,114,97,109,101,116,101,114,115,50,59,13,10,9,118,101,99,50,32,112,97,114,97,109,101,116,101,114,115,51,59,13,10,9,98,111,111,108,32,115,104,97,100,111,119,77,97,112,112,105,110,103,59,13,10,125,59,13,10,13,10,47,47,32,76,117,109,105,195,168,114,101,115,13,10,117,110,105,102,111,114,109,32,76,105,103,104,116,32,76,105,103,104,116,115,91,51,93,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,67,117,98,101,32,80,111,105,110,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,51,93,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,51,93,59,13,10,13,10,47,47,32,77,97,116,195,169,114,105,97,117,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,69,109,105,115,115,105,118,101,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,72,101,105,103,104,116,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,59,13,10,13,10,47,47,32,65,117,116,114,101,115,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,80,97,114,97,108,108,97,120,66,105,97,115,32,61,32,45,48,46,48,51,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,80,97,114,97,108,108,97,120,83,99,97,108,101,32,61,32,48,46,48,50,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,51,32,69,121,101,80,111,115,105,116,105,111,110,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,83,99,101,110,101,65,109,98,105,101,110,116,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,84,101,120,116,117,114,101,79,118,101,114,108,97,121,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,70,111,110,99,116,105,111,110,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,118,101,99,51,32,70,108,111,97,116,84,111,67,111,108,111,114,40,102,108,111,97,116,32,102,41,13,10,123,13,10,9,118,101,99,51,32,99,111,108,111,114,59,13,10,13,10,9,102,32,42,61,32,50,53,54,46,48,59,13,10,9,99,111,108,111,114,46,120,32,61,32,102,108,111,111,114,40,102,41,59,13,10,13,10,9,102,32,61,32,40,102,32,45,32,99,111,108,111,114,46,120,41,32,42,32,50,53,54,46,48,59,13,10,9,99,111,108,111,114,46,121,32,61,32,102,108,111,111,114,40,102,41,59,13,10,13,10,9,99,111,108,111,114,46,122,32,61,32,102,32,45,32,99,111,108,111,114,46,121,59,13,10,9,99,111,108,111,114,46,120,121,32,42,61,32,48,46,48,48,51,57,48,54,50,53,59,32,47,47,32,42,61,32,49,46,48,47,50,53,54,13,10,13,10,9,114,101,116,117,114,110,32,99,111,108,111,114,59,13,10,125,13,10,13,10,35,100,101,102,105,110,101,32,107,80,73,32,51,46,49,52,49,53,57,50,54,53,51,54,13,10,13,10,118,101,99,52,32,69,110,99,111,100,101,78,111,114,109,97,108,40,105,110,32,118,101,99,51,32,110,111,114,109,97,108,41,13,10,123,13,10,9,47,47,114,101,116,117,114,110,32,118,101,99,52,40,110,111,114,109,97,108,42,48,46,53,32,43,32,48,46,53,44,32,48,46,48,41,59,13,10,9,114,101,116,117,114,110,32,118,101,99,52,40,118,101,99,50,40,97,116,97,110,40,110,111,114,109,97,108,46,121,44,32,110,111,114,109,97,108,46,120,41,47,107,80,73,44,32,110,111,114,109,97,108,46,122,41,44,32,48,46,48,44,32,48,46,48,41,59,13,10,125,13,10,13,10,102,108,111,97,116,32,86,101,99,116,111,114,84,111,68,101,112,116,104,86,97,108,117,101,40,118,101,99,51,32,118,101,99,44,32,102,108,111,97,116,32,122,78,101,97,114,44,32,102,108,111,97,116,32,122,70,97,114,41,13,10,123,13,10,9,118,101,99,51,32,97,98,115,86,101,99,32,61,32,97,98,115,40,118,101,99,41,59,13,10,9,102,108,111,97,116,32,108,111,99,97,108,90,32,61,32,109,97,120,40,97,98,115,86,101,99,46,120,44,32,109,97,120,40,97,98,115,86,101,99,46,121,44,32,97,98,115,86,101,99,46,122,41,41,59,13,10,13,10,9,102,108,111,97,116,32,110,111,114,109,90,32,61,32,40,40,122,70,97,114,32,43,32,122,78,101,97,114,41,32,42,32,108,111,99,97,108,90,32,45,32,40,50,46,48,42,122,70,97,114,42,122,78,101,97,114,41,41,32,47,32,40,40,122,70,97,114,32,45,32,122,78,101,97,114,41,42,108,111,99,97,108,90,41,59,13,10,9,114,101,116,117,114,110,32,40,110,111,114,109,90,32,43,32,49,46,48,41,32,42,32,48,46,53,59,13,10,125,13,10,13,10,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,41,13,10,123,13,10,9,118,101,99,52,32,108,105,103,104,116,83,112,97,99,101,80,111,115,32,61,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,108,105,103,104,116,73,110,100,101,120,93,59,13,10,9,114,101,116,117,114,110,32,40,116,101,120,116,117,114,101,40,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,120,121,41,46,120,32,62,61,32,40,108,105,103,104,116,83,112,97,99,101,80,111,115,46,122,32,45,32,48,46,48,48,48,53,41,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,125,13,10,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,44,32,118,101,99,51,32,108,105,103,104,116,84,111,87,111,114,108,100,44,32,102,108,111,97,116,32,122,78,101,97,114,44,32,102,108,111,97,116,32,122,70,97,114,41,13,10,123,13,10,9,114,101,116,117,114,110,32,40,116,101,120,116,117,114,101,40,80,111,105,110,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,118,101,99,51,40,108,105,103,104,116,84,111,87,111,114,108,100,46,120,44,32,45,108,105,103,104,116,84,111,87,111,114,108,100,46,121,44,32,45,108,105,103,104,116,84,111,87,111,114,108,100,46,122,41,41,46,120,32,62,61,32,86,101,99,116,111,114,84,111,68,101,112,116,104,86,97,108,117,101,40,108,105,103,104,116,84,111,87,111,114,108,100,44,32,122,78,101,97,114,44,32,122,70,97,114,41,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,125,13,10,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,41,13,10,123,13,10,9,118,101,99,52,32,108,105,103,104,116,83,112,97,99,101,80,111,115,32,61,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,108,105,103,104,116,73,110,100,101,120,93,59,13,10,13,10,9,102,108,111,97,116,32,118,105,115,105,98,105,108,105,116,121,32,61,32,49,46,48,59,13,10,9,102,108,111,97,116,32,120,44,121,59,13,10,9,102,111,114,32,40,121,32,61,32,45,51,46,53,59,32,121,32,60,61,32,51,46,53,59,32,121,43,61,32,49,46,48,41,13,10,9,9,102,111,114,32,40,120,32,61,32,45,51,46,53,59,32,120,32,60,61,32,51,46,53,59,32,120,43,61,32,49,46,48,41,13,10,9,9,9,118,105,115,105,98,105,108,105,116,121,32,43,61,32,40,116,101,120,116,117,114,101,80,114,111,106,40,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,120,121,119,32,43,32,118,101,99,51,40,120,47,49,48,50,52,46,48,32,42,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,44,32,121,47,49,48,50,52,46,48,32,42,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,44,32,48,46,48,41,41,46,120,32,62,61,32,40,108,105,103,104,116,83,112,97,99,101,80,111,115,46,122,32,45,32,48,46,48,48,48,53,41,47,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,13,10,9,118,105,115,105,98,105,108,105,116,121,32,47,61,32,54,52,46,48,59,13,10,9,13,10,9,114,101,116,117,114,110,32,118,105,115,105,98,105,108,105,116,121,59,13,10,125,13,10,35,101,110,100,105,102,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,52,32,100,105,102,102,117,115,101,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,32,42,32,118,67,111,108,111,114,59,13,10,13,10,35,105,102,32,65,85,84,79,95,84,69,88,67,79,79,82,68,83,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,35,101,108,115,101,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,118,84,101,120,67,111,111,114,100,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,80,65,82,65,76,76,65,88,95,77,65,80,80,73,78,71,13,10,9,102,108,111,97,116,32,104,101,105,103,104,116,32,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,72,101,105,103,104,116,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,102,108,111,97,116,32,118,32,61,32,104,101,105,103,104,116,42,80,97,114,97,108,108,97,120,83,99,97,108,101,32,43,32,80,97,114,97,108,108,97,120,66,105,97,115,59,13,10,13,10,9,118,101,99,51,32,118,105,101,119,68,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,86,105,101,119,68,105,114,41,59,13,10,9,116,101,120,67,111,111,114,100,32,43,61,32,118,32,42,32,118,105,101,119,68,105,114,46,120,121,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,68,73,70,70,85,83,69,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,70,76,65,71,95,84,69,88,84,85,82,69,79,86,69,82,76,65,89,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,84,101,120,116,117,114,101,79,118,101,114,108,97,121,44,32,116,101,120,67,111,111,114,100,41,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,9,35,105,102,32,65,76,80,72,65,95,84,69,83,84,13,10,9,9,47,47,32,73,110,117,116,105,108,101,32,100,101,32,102,97,105,114,101,32,100,101,32,108,39,97,108,112,104,97,45,109,97,112,112,105,110,103,32,115,97,110,115,32,97,108,112,104,97,45,116,101,115,116,32,101,110,32,68,101,102,101,114,114,101,100,32,40,108,39,97,108,112,104,97,32,110,39,101,115,116,32,112,97,115,32,115,97,117,118,101,103,97,114,100,195,169,32,100,97,110,115,32,108,101,32,71,45,66,117,102,102,101,114,41,13,10,9,9,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,9,35,101,110,100,105,102,13,10,9,9,13,10,9,105,102,32,40,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,13,10,9,9,100,105,115,99,97,114,100,59,13,10,9,35,101,110,100,105,102,32,47,47,32,65,76,80,72,65,95,84,69,83,84,13,10,13,10,9,35,105,102,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,76,105,103,104,116,84,111,87,111,114,108,100,32,42,32,40,50,46,48,32,42,32,118,101,99,51,40,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,44,32,116,101,120,67,111,111,114,100,41,41,32,45,32,49,46,48,41,41,59,13,10,9,35,101,108,115,101,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,78,111,114,109,97,108,41,59,13,10,9,35,101,110,100,105,102,32,47,47,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,13,10,9,118,101,99,51,32,115,112,101,99,117,108,97,114,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,46,114,103,98,59,13,10,9,35,105,102,32,83,80,69,67,85,76,65,82,95,77,65,80,80,73,78,71,13,10,9,115,112,101,99,117,108,97,114,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,47,42,13,10,9,84,101,120,116,117,114,101,48,58,32,68,105,102,102,117,115,101,32,67,111,108,111,114,32,43,32,83,112,101,99,117,108,97,114,13,10,9,84,101,120,116,117,114,101,49,58,32,78,111,114,109,97,108,32,43,32,83,112,101,99,117,108,97,114,13,10,9,84,101,120,116,117,114,101,50,58,32,69,110,99,111,100,101,100,32,100,101,112,116,104,32,43,32,83,104,105,110,105,110,101,115,115,13,10,9,42,47,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,100,105,102,102,117,115,101,67,111,108,111,114,46,114,103,98,44,32,100,111,116,40,115,112,101,99,117,108,97,114,67,111,108,111,114,44,32,118,101,99,51,40,48,46,51,44,32,48,46,53,57,44,32,48,46,49,49,41,41,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,49,32,61,32,118,101,99,52,40,69,110,99,111,100,101,78,111,114,109,97,108,40,110,111,114,109,97,108,41,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,50,32,61,32,118,101,99,52,40,70,108,111,97,116,84,111,67,111,108,111,114,40,103,108,95,70,114,97,103,67,111,111,114,100,46,122,41,44,32,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,32,61,61,32,48,46,48,41,32,63,32,48,46,48,32,58,32,109,97,120,40,108,111,103,50,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,44,32,48,46,49,41,47,49,48,46,53,41,59,32,47,47,32,104,116,116,112,58,47,47,119,119,119,46,103,117,101,114,114,105,108,108,97,45,103,97,109,101,115,46,99,111,109,47,112,117,98,108,105,99,97,116,105,111,110,115,47,100,114,95,107,122,50,95,114,115,120,95,100,101,118,48,55,46,112,100,102,13,10,35,101,108,115,101,32,47,47,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,9,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,35,105,102,32,65,76,80,72,65,95,84,69,83,84,13,10,9,105,102,32,40,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,13,10,9,9,100,105,115,99,97,114,100,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,65,109,98,105,101,110,116,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,102,102,117,115,101,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,9,118,101,99,51,32,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,13,10,9,35,105,102,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,76,105,103,104,116,84,111,87,111,114,108,100,32,42,32,40,50,46,48,32,42,32,118,101,99,51,40,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,44,32,116,101,120,67,111,111,114,100,41,41,32,45,32,49,46,48,41,41,59,13,10,9,35,101,108,115,101,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,78,111,114,109,97,108,41,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,105,102,32,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,32,62,32,48,46,48,41,13,10,9,123,13,10,9,9,118,101,99,51,32,101,121,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,69,121,101,80,111,115,105,116,105,111,110,32,45,32,118,87,111,114,108,100,80,111,115,41,59,13,10,13,10,9,9,102,111,114,32,40,105,110,116,32,105,32,61,32,48,59,32,105,32,60,32,51,59,32,43,43,105,41,13,10,9,9,123,13,10,9,9,9,118,101,99,52,32,108,105,103,104,116,67,111,108,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,99,111,108,111,114,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,120,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,121,59,13,10,13,10,9,9,9,115,119,105,116,99,104,32,40,76,105,103,104,116,115,91,105,93,46,116,121,112,101,41,13,10,9,9,9,123,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,49,46,48,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,80,79,73,78,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,119,111,114,108,100,84,111,76,105,103,104,116,32,47,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,44,32,118,87,111,114,108,100,80,111,115,32,45,32,108,105,103,104,116,80,111,115,44,32,48,46,49,44,32,53,48,46,48,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,83,80,79,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,120,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,121,59,13,10,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,115,116,97,110,99,101,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,119,111,114,108,100,84,111,76,105,103,104,116,32,47,61,32,108,105,103,104,116,68,105,115,116,97,110,99,101,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,115,116,97,110,99,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,13,10,9,9,9,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,108,105,103,104,116,68,105,114,44,32,45,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,59,13,10,9,9,9,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,119,111,114,108,100,84,111,76,105,103,104,116,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,119,111,114,108,100,84,111,76,105,103,104,116,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,9,9,9,9,13,10,9,9,9,9,100,101,102,97,117,108,116,58,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,125,13,10,9,9,125,13,10,9,125,13,10,9,101,108,115,101,13,10,9,123,13,10,9,9,102,111,114,32,40,105,110,116,32,105,32,61,32,48,59,32,105,32,60,32,51,59,32,43,43,105,41,13,10,9,9,123,13,10,9,9,9,118,101,99,52,32,108,105,103,104,116,67,111,108,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,99,111,108,111,114,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,120,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,121,59,13,10,13,10,9,9,9,115,119,105,116,99,104,32,40,76,105,103,104,116,115,91,105,93,46,116,121,112,101,41,13,10,9,9,9,123,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,49,46,48,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,80,79,73,78,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,119,111,114,108,100,84,111,76,105,103,104,116,32,47,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,44,32,118,87,111,114,108,100,80,111,115,32,45,32,108,105,103,104,116,80,111,115,44,32,48,46,49,44,32,53,48,46,48,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,83,80,79,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,120,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,121,59,13,10,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,115,116,97,110,99,101,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,119,111,114,108,100,84,111,76,105,103,104,116,32,47,61,32,108,105,103,104,116,68,105,115,116,97,110,99,101,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,115,116,97,110,99,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,13,10,9,9,9,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,108,105,103,104,116,68,105,114,44,32,45,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,59,13,10,9,9,9,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,119,111,114,108,100,84,111,76,105,103,104,116,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,125,13,10,9,9,9,9,13,10,9,9,9,9,100,101,102,97,117,108,116,58,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,125,13,10,9,9,125,13,10,9,125,13,10,9,13,10,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,42,61,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,46,114,103,98,59,13,10,9,35,105,102,32,83,80,69,67,85,76,65,82,95,77,65,80,80,73,78,71,13,10,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,32,47,47,32,85,116,105,108,105,115,101,114,32,108,39,97,108,112,104,97,32,100,101,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,32,110,39,97,117,114,97,105,116,32,97,117,99,117,110,32,115,101,110,115,13,10,9,35,101,110,100,105,102,13,10,9,9,13,10,9,118,101,99,51,32,108,105,103,104,116,67,111,108,111,114,32,61,32,40,108,105,103,104,116,65,109,98,105,101,110,116,32,43,32,108,105,103,104,116,68,105,102,102,117,115,101,32,43,32,108,105,103,104,116,83,112,101,99,117,108,97,114,41,59,13,10,9,118,101,99,52,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,118,101,99,52,40,108,105,103,104,116,67,111,108,111,114,44,32,49,46,48,41,32,42,32,100,105,102,102,117,115,101,67,111,108,111,114,59,13,10,13,10,9,35,105,102,32,69,77,73,83,83,73,86,69,95,77,65,80,80,73,78,71,13,10,9,102,108,111,97,116,32,108,105,103,104,116,73,110,116,101,110,115,105,116,121,32,61,32,100,111,116,40,108,105,103,104,116,67,111,108,111,114,44,32,118,101,99,51,40,48,46,51,44,32,48,46,53,57,44,32,48,46,49,49,41,41,59,13,10,13,10,9,118,101,99,51,32,101,109,105,115,115,105,111,110,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,46,114,103,98,32,42,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,69,109,105,115,115,105,118,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,109,105,120,40,102,114,97,103,109,101,110,116,67,111,108,111,114,46,114,103,98,44,32,101,109,105,115,115,105,111,110,67,111,108,111,114,44,32,99,108,97,109,112,40,49,46,48,32,45,32,51,46,48,42,108,105,103,104,116,73,110,116,101,110,115,105,116,121,44,32,48,46,48,44,32,49,46,48,41,41,44,32,102,114,97,103,109,101,110,116,67,111,108,111,114,46,97,41,59,13,10,9,35,101,108,115,101,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,102,114,97,103,109,101,110,116,67,111,108,111,114,59,13,10,9,35,101,110,100,105,102,32,47,47,32,69,77,73,83,83,73,86,69,95,77,65,80,80,73,78,71,13,10,35,101,110,100,105,102,32,47,47,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,125,13,10,13,10, \ No newline at end of file +35,105,102,32,69,65,82,76,89,95,70,82,65,71,77,69,78,84,95,84,69,83,84,83,32,38,38,32,33,65,76,80,72,65,95,84,69,83,84,13,10,108,97,121,111,117,116,40,101,97,114,108,121,95,102,114,97,103,109,101,110,116,95,116,101,115,116,115,41,32,105,110,59,13,10,35,101,110,100,105,102,13,10,13,10,47,47,32,72,65,67,75,32,85,78,84,73,76,32,80,82,79,80,69,82,32,70,73,88,13,10,35,105,102,32,71,76,83,76,95,86,69,82,83,73,79,78,32,60,32,52,48,48,13,10,9,35,117,110,100,101,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,35,100,101,102,105,110,101,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,32,48,13,10,35,101,110,100,105,102,13,10,47,47,32,72,65,67,75,13,10,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,32,48,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,80,79,73,78,84,32,49,13,10,35,100,101,102,105,110,101,32,76,73,71,72,84,95,83,80,79,84,32,50,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,69,110,116,114,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,105,110,32,118,101,99,52,32,118,67,111,108,111,114,59,13,10,105,110,32,118,101,99,52,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,51,93,59,13,10,105,110,32,109,97,116,51,32,118,76,105,103,104,116,84,111,87,111,114,108,100,59,13,10,105,110,32,118,101,99,51,32,118,78,111,114,109,97,108,59,13,10,105,110,32,118,101,99,50,32,118,84,101,120,67,111,111,114,100,59,13,10,105,110,32,118,101,99,51,32,118,86,105,101,119,68,105,114,59,13,10,105,110,32,118,101,99,51,32,118,87,111,114,108,100,80,111,115,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,83,111,114,116,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,49,59,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,50,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,85,110,105,102,111,114,109,101,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,115,116,114,117,99,116,32,76,105,103,104,116,13,10,123,13,10,9,105,110,116,32,116,121,112,101,59,13,10,9,118,101,99,52,32,99,111,108,111,114,59,13,10,9,118,101,99,50,32,102,97,99,116,111,114,115,59,13,10,13,10,9,118,101,99,52,32,112,97,114,97,109,101,116,101,114,115,49,59,13,10,9,118,101,99,52,32,112,97,114,97,109,101,116,101,114,115,50,59,13,10,9,118,101,99,50,32,112,97,114,97,109,101,116,101,114,115,51,59,13,10,9,98,111,111,108,32,115,104,97,100,111,119,77,97,112,112,105,110,103,59,13,10,125,59,13,10,13,10,47,47,32,76,117,109,105,195,168,114,101,115,13,10,117,110,105,102,111,114,109,32,76,105,103,104,116,32,76,105,103,104,116,115,91,51,93,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,67,117,98,101,32,80,111,105,110,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,51,93,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,51,93,59,13,10,13,10,47,47,32,77,97,116,195,169,114,105,97,117,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,69,109,105,115,115,105,118,101,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,72,101,105,103,104,116,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,59,13,10,13,10,47,47,32,65,117,116,114,101,115,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,80,97,114,97,108,108,97,120,66,105,97,115,32,61,32,45,48,46,48,51,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,80,97,114,97,108,108,97,120,83,99,97,108,101,32,61,32,48,46,48,50,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,51,32,69,121,101,80,111,115,105,116,105,111,110,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,83,99,101,110,101,65,109,98,105,101,110,116,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,84,101,120,116,117,114,101,79,118,101,114,108,97,121,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,70,111,110,99,116,105,111,110,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,13,10,35,100,101,102,105,110,101,32,107,80,73,32,51,46,49,52,49,53,57,50,54,53,51,54,13,10,13,10,118,101,99,52,32,69,110,99,111,100,101,78,111,114,109,97,108,40,105,110,32,118,101,99,51,32,110,111,114,109,97,108,41,13,10,123,13,10,9,47,47,114,101,116,117,114,110,32,118,101,99,52,40,110,111,114,109,97,108,42,48,46,53,32,43,32,48,46,53,44,32,48,46,48,41,59,13,10,9,114,101,116,117,114,110,32,118,101,99,52,40,118,101,99,50,40,97,116,97,110,40,110,111,114,109,97,108,46,121,44,32,110,111,114,109,97,108,46,120,41,47,107,80,73,44,32,110,111,114,109,97,108,46,122,41,44,32,48,46,48,44,32,48,46,48,41,59,13,10,125,13,10,13,10,102,108,111,97,116,32,86,101,99,116,111,114,84,111,68,101,112,116,104,86,97,108,117,101,40,118,101,99,51,32,118,101,99,44,32,102,108,111,97,116,32,122,78,101,97,114,44,32,102,108,111,97,116,32,122,70,97,114,41,13,10,123,13,10,9,118,101,99,51,32,97,98,115,86,101,99,32,61,32,97,98,115,40,118,101,99,41,59,13,10,9,102,108,111,97,116,32,108,111,99,97,108,90,32,61,32,109,97,120,40,97,98,115,86,101,99,46,120,44,32,109,97,120,40,97,98,115,86,101,99,46,121,44,32,97,98,115,86,101,99,46,122,41,41,59,13,10,13,10,9,102,108,111,97,116,32,110,111,114,109,90,32,61,32,40,40,122,70,97,114,32,43,32,122,78,101,97,114,41,32,42,32,108,111,99,97,108,90,32,45,32,40,50,46,48,42,122,70,97,114,42,122,78,101,97,114,41,41,32,47,32,40,40,122,70,97,114,32,45,32,122,78,101,97,114,41,42,108,111,99,97,108,90,41,59,13,10,9,114,101,116,117,114,110,32,40,110,111,114,109,90,32,43,32,49,46,48,41,32,42,32,48,46,53,59,13,10,125,13,10,13,10,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,41,13,10,123,13,10,9,118,101,99,52,32,108,105,103,104,116,83,112,97,99,101,80,111,115,32,61,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,108,105,103,104,116,73,110,100,101,120,93,59,13,10,9,114,101,116,117,114,110,32,40,116,101,120,116,117,114,101,40,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,120,121,41,46,120,32,62,61,32,40,108,105,103,104,116,83,112,97,99,101,80,111,115,46,122,32,45,32,48,46,48,48,48,53,41,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,125,13,10,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,44,32,118,101,99,51,32,108,105,103,104,116,84,111,87,111,114,108,100,44,32,102,108,111,97,116,32,122,78,101,97,114,44,32,102,108,111,97,116,32,122,70,97,114,41,13,10,123,13,10,9,114,101,116,117,114,110,32,40,116,101,120,116,117,114,101,40,80,111,105,110,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,118,101,99,51,40,108,105,103,104,116,84,111,87,111,114,108,100,46,120,44,32,45,108,105,103,104,116,84,111,87,111,114,108,100,46,121,44,32,45,108,105,103,104,116,84,111,87,111,114,108,100,46,122,41,41,46,120,32,62,61,32,86,101,99,116,111,114,84,111,68,101,112,116,104,86,97,108,117,101,40,108,105,103,104,116,84,111,87,111,114,108,100,44,32,122,78,101,97,114,44,32,122,70,97,114,41,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,125,13,10,13,10,102,108,111,97,116,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,110,116,32,108,105,103,104,116,73,110,100,101,120,41,13,10,123,13,10,9,118,101,99,52,32,108,105,103,104,116,83,112,97,99,101,80,111,115,32,61,32,118,76,105,103,104,116,83,112,97,99,101,80,111,115,91,108,105,103,104,116,73,110,100,101,120,93,59,13,10,13,10,9,102,108,111,97,116,32,118,105,115,105,98,105,108,105,116,121,32,61,32,49,46,48,59,13,10,9,102,108,111,97,116,32,120,44,121,59,13,10,9,102,111,114,32,40,121,32,61,32,45,51,46,53,59,32,121,32,60,61,32,51,46,53,59,32,121,43,61,32,49,46,48,41,13,10,9,9,102,111,114,32,40,120,32,61,32,45,51,46,53,59,32,120,32,60,61,32,51,46,53,59,32,120,43,61,32,49,46,48,41,13,10,9,9,9,118,105,115,105,98,105,108,105,116,121,32,43,61,32,40,116,101,120,116,117,114,101,80,114,111,106,40,68,105,114,101,99,116,105,111,110,97,108,83,112,111,116,76,105,103,104,116,83,104,97,100,111,119,77,97,112,91,108,105,103,104,116,73,110,100,101,120,93,44,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,120,121,119,32,43,32,118,101,99,51,40,120,47,49,48,50,52,46,48,32,42,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,44,32,121,47,49,48,50,52,46,48,32,42,32,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,44,32,48,46,48,41,41,46,120,32,62,61,32,40,108,105,103,104,116,83,112,97,99,101,80,111,115,46,122,32,45,32,48,46,48,48,48,53,41,47,108,105,103,104,116,83,112,97,99,101,80,111,115,46,119,41,32,63,32,49,46,48,32,58,32,48,46,48,59,13,10,13,10,9,118,105,115,105,98,105,108,105,116,121,32,47,61,32,54,52,46,48,59,13,10,9,13,10,9,114,101,116,117,114,110,32,118,105,115,105,98,105,108,105,116,121,59,13,10,125,13,10,35,101,110,100,105,102,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,52,32,100,105,102,102,117,115,101,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,32,42,32,118,67,111,108,111,114,59,13,10,13,10,35,105,102,32,65,85,84,79,95,84,69,88,67,79,79,82,68,83,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,35,101,108,115,101,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,118,84,101,120,67,111,111,114,100,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,80,65,82,65,76,76,65,88,95,77,65,80,80,73,78,71,13,10,9,102,108,111,97,116,32,104,101,105,103,104,116,32,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,72,101,105,103,104,116,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,102,108,111,97,116,32,118,32,61,32,104,101,105,103,104,116,42,80,97,114,97,108,108,97,120,83,99,97,108,101,32,43,32,80,97,114,97,108,108,97,120,66,105,97,115,59,13,10,13,10,9,118,101,99,51,32,118,105,101,119,68,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,86,105,101,119,68,105,114,41,59,13,10,9,116,101,120,67,111,111,114,100,32,43,61,32,118,32,42,32,118,105,101,119,68,105,114,46,120,121,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,68,73,70,70,85,83,69,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,70,76,65,71,95,84,69,88,84,85,82,69,79,86,69,82,76,65,89,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,84,101,120,116,117,114,101,79,118,101,114,108,97,121,44,32,116,101,120,67,111,111,114,100,41,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,9,35,105,102,32,65,76,80,72,65,95,84,69,83,84,13,10,9,9,47,47,32,73,110,117,116,105,108,101,32,100,101,32,102,97,105,114,101,32,100,101,32,108,39,97,108,112,104,97,45,109,97,112,112,105,110,103,32,115,97,110,115,32,97,108,112,104,97,45,116,101,115,116,32,101,110,32,68,101,102,101,114,114,101,100,32,40,108,39,97,108,112,104,97,32,110,39,101,115,116,32,112,97,115,32,115,97,117,118,101,103,97,114,100,195,169,32,100,97,110,115,32,108,101,32,71,45,66,117,102,102,101,114,41,13,10,9,9,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,9,35,101,110,100,105,102,13,10,9,9,13,10,9,105,102,32,40,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,13,10,9,9,100,105,115,99,97,114,100,59,13,10,9,35,101,110,100,105,102,32,47,47,32,65,76,80,72,65,95,84,69,83,84,13,10,13,10,9,35,105,102,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,76,105,103,104,116,84,111,87,111,114,108,100,32,42,32,40,50,46,48,32,42,32,118,101,99,51,40,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,44,32,116,101,120,67,111,111,114,100,41,41,32,45,32,49,46,48,41,41,59,13,10,9,35,101,108,115,101,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,78,111,114,109,97,108,41,59,13,10,9,35,101,110,100,105,102,32,47,47,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,13,10,9,118,101,99,51,32,115,112,101,99,117,108,97,114,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,46,114,103,98,59,13,10,9,35,105,102,32,83,80,69,67,85,76,65,82,95,77,65,80,80,73,78,71,13,10,9,115,112,101,99,117,108,97,114,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,47,42,13,10,9,84,101,120,116,117,114,101,48,58,32,68,105,102,102,117,115,101,32,67,111,108,111,114,32,43,32,83,112,101,99,117,108,97,114,13,10,9,84,101,120,116,117,114,101,49,58,32,78,111,114,109,97,108,32,43,32,83,112,101,99,117,108,97,114,13,10,9,84,101,120,116,117,114,101,50,58,32,69,110,99,111,100,101,100,32,100,101,112,116,104,32,43,32,83,104,105,110,105,110,101,115,115,13,10,9,42,47,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,100,105,102,102,117,115,101,67,111,108,111,114,46,114,103,98,44,32,100,111,116,40,115,112,101,99,117,108,97,114,67,111,108,111,114,44,32,118,101,99,51,40,48,46,51,44,32,48,46,53,57,44,32,48,46,49,49,41,41,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,49,32,61,32,118,101,99,52,40,69,110,99,111,100,101,78,111,114,109,97,108,40,110,111,114,109,97,108,41,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,50,32,61,32,118,101,99,52,40,48,46,48,44,32,48,46,48,44,32,48,46,48,44,32,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,32,61,61,32,48,46,48,41,32,63,32,48,46,48,32,58,32,109,97,120,40,108,111,103,50,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,44,32,48,46,49,41,47,49,48,46,53,41,59,32,47,47,32,104,116,116,112,58,47,47,119,119,119,46,103,117,101,114,114,105,108,108,97,45,103,97,109,101,115,46,99,111,109,47,112,117,98,108,105,99,97,116,105,111,110,115,47,100,114,95,107,122,50,95,114,115,120,95,100,101,118,48,55,46,112,100,102,13,10,35,101,108,115,101,32,47,47,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,9,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,13,10,9,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,35,105,102,32,65,76,80,72,65,95,84,69,83,84,13,10,9,105,102,32,40,100,105,102,102,117,115,101,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,13,10,9,9,100,105,115,99,97,114,100,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,118,101,99,51,32,108,105,103,104,116,65,109,98,105,101,110,116,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,9,118,101,99,51,32,108,105,103,104,116,68,105,102,102,117,115,101,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,9,118,101,99,51,32,108,105,103,104,116,83,112,101,99,117,108,97,114,32,61,32,118,101,99,51,40,48,46,48,41,59,13,10,13,10,9,35,105,102,32,78,79,82,77,65,76,95,77,65,80,80,73,78,71,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,76,105,103,104,116,84,111,87,111,114,108,100,32,42,32,40,50,46,48,32,42,32,118,101,99,51,40,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,78,111,114,109,97,108,77,97,112,44,32,116,101,120,67,111,111,114,100,41,41,32,45,32,49,46,48,41,41,59,13,10,9,35,101,108,115,101,13,10,9,118,101,99,51,32,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,105,122,101,40,118,78,111,114,109,97,108,41,59,13,10,9,35,101,110,100,105,102,13,10,13,10,9,105,102,32,40,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,32,62,32,48,46,48,41,13,10,9,123,13,10,9,9,118,101,99,51,32,101,121,101,86,101,99,32,61,32,110,111,114,109,97,108,105,122,101,40,69,121,101,80,111,115,105,116,105,111,110,32,45,32,118,87,111,114,108,100,80,111,115,41,59,13,10,13,10,9,9,102,111,114,32,40,105,110,116,32,105,32,61,32,48,59,32,105,32,60,32,51,59,32,43,43,105,41,13,10,9,9,123,13,10,9,9,9,118,101,99,52,32,108,105,103,104,116,67,111,108,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,99,111,108,111,114,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,120,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,121,59,13,10,13,10,9,9,9,115,119,105,116,99,104,32,40,76,105,103,104,116,115,91,105,93,46,116,121,112,101,41,13,10,9,9,9,123,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,49,46,48,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,80,79,73,78,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,119,111,114,108,100,84,111,76,105,103,104,116,32,47,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,44,32,118,87,111,114,108,100,80,111,115,32,45,32,108,105,103,104,116,80,111,115,44,32,48,46,49,44,32,53,48,46,48,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,108,105,103,104,116,68,105,114,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,83,80,79,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,120,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,121,59,13,10,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,115,116,97,110,99,101,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,119,111,114,108,100,84,111,76,105,103,104,116,32,47,61,32,108,105,103,104,116,68,105,115,116,97,110,99,101,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,115,116,97,110,99,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,13,10,9,9,9,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,108,105,103,104,116,68,105,114,44,32,45,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,59,13,10,9,9,9,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,119,111,114,108,100,84,111,76,105,103,104,116,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,13,10,9,9,9,9,9,47,47,32,83,112,101,99,117,108,97,114,13,10,9,9,9,9,9,118,101,99,51,32,114,101,102,108,101,99,116,105,111,110,32,61,32,114,101,102,108,101,99,116,40,45,119,111,114,108,100,84,111,76,105,103,104,116,44,32,110,111,114,109,97,108,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,109,97,120,40,100,111,116,40,114,101,102,108,101,99,116,105,111,110,44,32,101,121,101,86,101,99,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,61,32,112,111,119,40,115,112,101,99,117,108,97,114,70,97,99,116,111,114,44,32,77,97,116,101,114,105,97,108,83,104,105,110,105,110,101,115,115,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,43,61,32,97,116,116,32,42,32,115,112,101,99,117,108,97,114,70,97,99,116,111,114,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,9,9,9,9,13,10,9,9,9,9,100,101,102,97,117,108,116,58,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,125,13,10,9,9,125,13,10,9,125,13,10,9,101,108,115,101,13,10,9,123,13,10,9,9,102,111,114,32,40,105,110,116,32,105,32,61,32,48,59,32,105,32,60,32,51,59,32,43,43,105,41,13,10,9,9,123,13,10,9,9,9,118,101,99,52,32,108,105,103,104,116,67,111,108,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,99,111,108,111,114,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,120,59,13,10,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,32,61,32,76,105,103,104,116,115,91,105,93,46,102,97,99,116,111,114,115,46,121,59,13,10,13,10,9,9,9,115,119,105,116,99,104,32,40,76,105,103,104,116,115,91,105,93,46,116,121,112,101,41,13,10,9,9,9,123,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,68,73,82,69,67,84,73,79,78,65,76,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,45,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,49,46,48,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,68,105,114,101,99,116,105,111,110,97,108,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,80,79,73,78,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,119,111,114,108,100,84,111,76,105,103,104,116,32,47,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,114,76,101,110,103,116,104,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,80,111,105,110,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,44,32,118,87,111,114,108,100,80,111,115,32,45,32,108,105,103,104,116,80,111,115,44,32,48,46,49,44,32,53,48,46,48,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,108,105,103,104,116,68,105,114,41,44,32,48,46,48,41,59,13,10,9,9,9,9,9,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,125,13,10,13,10,9,9,9,9,99,97,115,101,32,76,73,71,72,84,95,83,80,79,84,58,13,10,9,9,9,9,123,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,80,111,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,120,121,122,59,13,10,9,9,9,9,9,118,101,99,51,32,108,105,103,104,116,68,105,114,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,120,121,122,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,49,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,50,46,119,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,120,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,32,61,32,76,105,103,104,116,115,91,105,93,46,112,97,114,97,109,101,116,101,114,115,51,46,121,59,13,10,13,10,9,9,9,9,9,118,101,99,51,32,119,111,114,108,100,84,111,76,105,103,104,116,32,61,32,108,105,103,104,116,80,111,115,32,45,32,118,87,111,114,108,100,80,111,115,59,13,10,9,9,9,9,9,102,108,111,97,116,32,108,105,103,104,116,68,105,115,116,97,110,99,101,32,61,32,108,101,110,103,116,104,40,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,119,111,114,108,100,84,111,76,105,103,104,116,32,47,61,32,108,105,103,104,116,68,105,115,116,97,110,99,101,59,32,47,47,32,78,111,114,109,97,108,105,115,97,116,105,111,110,13,10,9,9,9,9,9,13,10,9,9,9,9,9,102,108,111,97,116,32,97,116,116,32,61,32,109,97,120,40,108,105,103,104,116,65,116,116,101,110,117,97,116,105,111,110,32,45,32,108,105,103,104,116,73,110,118,82,97,100,105,117,115,32,42,32,108,105,103,104,116,68,105,115,116,97,110,99,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,65,109,98,105,101,110,116,13,10,9,9,9,9,9,108,105,103,104,116,65,109,98,105,101,110,116,32,43,61,32,97,116,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,65,109,98,105,101,110,116,70,97,99,116,111,114,32,42,32,40,77,97,116,101,114,105,97,108,65,109,98,105,101,110,116,46,114,103,98,32,43,32,83,99,101,110,101,65,109,98,105,101,110,116,46,114,103,98,41,59,13,10,13,10,9,9,9,9,9,35,105,102,32,83,72,65,68,79,87,95,77,65,80,80,73,78,71,13,10,9,9,9,9,9,105,102,32,40,76,105,103,104,116,115,91,105,93,46,115,104,97,100,111,119,77,97,112,112,105,110,103,41,13,10,9,9,9,9,9,123,13,10,9,9,9,9,9,9,102,108,111,97,116,32,115,104,97,100,111,119,70,97,99,116,111,114,32,61,32,67,97,108,99,117,108,97,116,101,83,112,111,116,83,104,97,100,111,119,70,97,99,116,111,114,40,105,41,59,13,10,9,9,9,9,9,9,105,102,32,40,115,104,97,100,111,119,70,97,99,116,111,114,32,61,61,32,48,46,48,41,13,10,9,9,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,9,9,9,9,13,10,9,9,9,9,9,9,97,116,116,32,42,61,32,115,104,97,100,111,119,70,97,99,116,111,114,59,13,10,9,9,9,9,9,125,13,10,9,9,9,9,9,35,101,110,100,105,102,13,10,13,10,9,9,9,9,9,47,47,32,77,111,100,105,102,105,99,97,116,105,111,110,32,100,101,32,108,39,97,116,116,195,169,110,117,97,116,105,111,110,32,112,111,117,114,32,103,195,169,114,101,114,32,108,101,32,115,112,111,116,13,10,9,9,9,9,9,102,108,111,97,116,32,99,117,114,65,110,103,108,101,32,61,32,100,111,116,40,108,105,103,104,116,68,105,114,44,32,45,119,111,114,108,100,84,111,76,105,103,104,116,41,59,13,10,9,9,9,9,9,102,108,111,97,116,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,32,61,32,108,105,103,104,116,73,110,110,101,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,59,13,10,9,9,9,9,9,97,116,116,32,42,61,32,109,97,120,40,40,99,117,114,65,110,103,108,101,32,45,32,108,105,103,104,116,79,117,116,101,114,65,110,103,108,101,41,32,47,32,105,110,110,101,114,77,105,110,117,115,79,117,116,101,114,65,110,103,108,101,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,47,47,32,68,105,102,102,117,115,101,13,10,9,9,9,9,9,102,108,111,97,116,32,108,97,109,98,101,114,116,32,61,32,109,97,120,40,100,111,116,40,110,111,114,109,97,108,44,32,119,111,114,108,100,84,111,76,105,103,104,116,41,44,32,48,46,48,41,59,13,10,13,10,9,9,9,9,9,108,105,103,104,116,68,105,102,102,117,115,101,32,43,61,32,97,116,116,32,42,32,108,97,109,98,101,114,116,32,42,32,108,105,103,104,116,67,111,108,111,114,46,114,103,98,32,42,32,108,105,103,104,116,68,105,102,102,117,115,101,70,97,99,116,111,114,59,13,10,9,9,9,9,125,13,10,9,9,9,9,13,10,9,9,9,9,100,101,102,97,117,108,116,58,13,10,9,9,9,9,9,98,114,101,97,107,59,13,10,9,9,9,125,13,10,9,9,125,13,10,9,125,13,10,9,13,10,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,42,61,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,46,114,103,98,59,13,10,9,35,105,102,32,83,80,69,67,85,76,65,82,95,77,65,80,80,73,78,71,13,10,9,108,105,103,104,116,83,112,101,99,117,108,97,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,32,47,47,32,85,116,105,108,105,115,101,114,32,108,39,97,108,112,104,97,32,100,101,32,77,97,116,101,114,105,97,108,83,112,101,99,117,108,97,114,32,110,39,97,117,114,97,105,116,32,97,117,99,117,110,32,115,101,110,115,13,10,9,35,101,110,100,105,102,13,10,9,9,13,10,9,118,101,99,51,32,108,105,103,104,116,67,111,108,111,114,32,61,32,40,108,105,103,104,116,65,109,98,105,101,110,116,32,43,32,108,105,103,104,116,68,105,102,102,117,115,101,32,43,32,108,105,103,104,116,83,112,101,99,117,108,97,114,41,59,13,10,9,118,101,99,52,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,118,101,99,52,40,108,105,103,104,116,67,111,108,111,114,44,32,49,46,48,41,32,42,32,100,105,102,102,117,115,101,67,111,108,111,114,59,13,10,13,10,9,35,105,102,32,69,77,73,83,83,73,86,69,95,77,65,80,80,73,78,71,13,10,9,102,108,111,97,116,32,108,105,103,104,116,73,110,116,101,110,115,105,116,121,32,61,32,100,111,116,40,108,105,103,104,116,67,111,108,111,114,44,32,118,101,99,51,40,48,46,51,44,32,48,46,53,57,44,32,48,46,49,49,41,41,59,13,10,13,10,9,118,101,99,51,32,101,109,105,115,115,105,111,110,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,46,114,103,98,32,42,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,69,109,105,115,115,105,118,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,103,98,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,109,105,120,40,102,114,97,103,109,101,110,116,67,111,108,111,114,46,114,103,98,44,32,101,109,105,115,115,105,111,110,67,111,108,111,114,44,32,99,108,97,109,112,40,49,46,48,32,45,32,51,46,48,42,108,105,103,104,116,73,110,116,101,110,115,105,116,121,44,32,48,46,48,44,32,49,46,48,41,41,44,32,102,114,97,103,109,101,110,116,67,111,108,111,114,46,97,41,59,13,10,9,35,101,108,115,101,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,102,114,97,103,109,101,110,116,67,111,108,111,114,59,13,10,9,35,101,110,100,105,102,32,47,47,32,69,77,73,83,83,73,86,69,95,77,65,80,80,73,78,71,13,10,35,101,110,100,105,102,32,47,47,32,70,76,65,71,95,68,69,70,69,82,82,69,68,13,10,125,13,10,13,10, \ No newline at end of file From d14367a5a6f770499b6c179a61e180c39282fceb Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 17 Aug 2016 12:20:58 +0200 Subject: [PATCH 27/74] Build: Remove Vulkan from modules list Since Vulkan support is not yet finished and pushing it to master was a mistake, I see no reason everyone should link against this module when using the engine. Former-commit-id: 3677345c89ed98648bec5d5fc17a5bb49fdab639 [formerly 7361217fde5359d88e4d5965d0375e5a452c84b5] [formerly 6d7d9a618df41f44363349523bb7abcd94be43b4 [formerly aea0ceefe1d8b588a611d117092726a55b8ff172]] Former-commit-id: 3984dcee08dc6ce208f8c71218674ff0d46c8772 [formerly 755848f28a4097a05809515c26f0ff35b344cc31] Former-commit-id: 9bc57ddd341ef468ea78c8781402329b498c0502 --- build/scripts/modules/vulkan.lua | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 build/scripts/modules/vulkan.lua diff --git a/build/scripts/modules/vulkan.lua b/build/scripts/modules/vulkan.lua deleted file mode 100644 index 62a00a745..000000000 --- a/build/scripts/modules/vulkan.lua +++ /dev/null @@ -1,31 +0,0 @@ -MODULE.Name = "Vulkan" - -MODULE.ClientOnly = true - -MODULE.Defines = { - "VK_NO_PROTOTYPES" -} - -MODULE.Libraries = { - "NazaraCore", - "NazaraUtility" -} - -MODULE.OsDefines.Linux = { --- "VK_USE_PLATFORM_MIR_KHR", - "VK_USE_PLATFORM_XCB_KHR" --- "VK_USE_PLATFORM_XLIB_KHR", --- "VK_USE_PLATFORM_WAYLAND_KHR" -} - -MODULE.OsDefines.BSD = MODULE.OsDefines.Linux -MODULE.OsDefines.Solaris = MODULE.OsDefines.Linux - -MODULE.OsDefines.Windows = { - "VK_USE_PLATFORM_WIN32_KHR" -} - -MODULE.OsFiles.Windows = { - "../src/Nazara/Vulkan/Win32/**.hpp", - "../src/Nazara/Vulkan/Win32/**.cpp" -} From 5ad6132998c95266dbfea995fe8cb49731974101 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 17 Aug 2016 12:59:12 +0200 Subject: [PATCH 28/74] Build: Fix TargetDirectory not being taken into account Former-commit-id: a022d3dc07743529a3c9523149f264add20ebe44 [formerly 81e2340920ab4565129751cfd9ad74d7c1f71c18] [formerly 1bcaa5dcf97ff705b2e26bf78cbc76830eb3fae0 [formerly cab3c7a3e8af6b72e720a7dfa858d6a03e8bd7cf]] Former-commit-id: cee0ce949787d64407b7b982b2d7287ef0c96481 [formerly eea525a514121da003f8b88c225192b361c65568] Former-commit-id: df9ea49de0575753e5e8c800e306701a6ca9f899 --- build/scripts/common.lua | 18 +++++++++--------- build/scripts/tools/assimp.lua | 1 - build/scripts/tools/ndk.lua | 2 +- build/scripts/tools/ndk_server.lua | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/build/scripts/common.lua b/build/scripts/common.lua index b467eb9c5..498b64ee0 100644 --- a/build/scripts/common.lua +++ b/build/scripts/common.lua @@ -270,7 +270,6 @@ function NazaraBuild:Execute() project(prefix .. toolTable.Name) location(_ACTION .. "/tools") - targetdir(toolTable.TargetDirectory) if (toolTable.Kind == "plugin" or toolTable.Kind == "library") then kind("SharedLib") @@ -296,6 +295,8 @@ function NazaraBuild:Execute() libdirs("../lib") libdirs("../extlibs/lib/common") + targetdir(toolTable.TargetDirectory) + configuration("x32") libdirs(toolTable.LibraryPaths.x86) @@ -305,18 +306,17 @@ function NazaraBuild:Execute() configuration({"codeblocks or codelite or gmake", "x32"}) libdirs("../extlibs/lib/" .. makeLibDir .. "/x86") - libdirs("../lib/" .. makeLibDir .. "/x86") + libdirs(toolTable.TargetDirectory .. "/" .. makeLibDir .. "/x86") if (toolTable.Kind == "library") then - targetdir("../lib/" .. makeLibDir .. "/x86") + targetdir(toolTable.TargetDirectory .. "/" .. makeLibDir .. "/x86") elseif (toolTable.Kind == "plugin") then targetdir("../plugins/" .. toolTable.Name .. "/lib/" .. makeLibDir .. "/x86") end configuration({"codeblocks or codelite or gmake", "x64"}) libdirs("../extlibs/lib/" .. makeLibDir .. "/x64") - libdirs("../lib/" .. makeLibDir .. "/x64") if (toolTable.Kind == "library") then - targetdir("../lib/" .. makeLibDir .. "/x64") + targetdir(toolTable.TargetDirectory .. "/" .. makeLibDir .. "/x64") elseif (toolTable.Kind == "plugin") then targetdir("../plugins/" .. toolTable.Name .. "/lib/" .. makeLibDir .. "/x64") end @@ -325,7 +325,7 @@ function NazaraBuild:Execute() libdirs("../extlibs/lib/msvc/x86") libdirs("../lib/msvc/x86") if (toolTable.Kind == "library") then - targetdir("../lib/msvc/x86") + targetdir(toolTable.TargetDirectory .. "/msvc/x86") elseif (toolTable.Kind == "plugin") then targetdir("../plugins/" .. toolTable.Name .. "/lib/msvc/x86") end @@ -334,7 +334,7 @@ function NazaraBuild:Execute() libdirs("../extlibs/lib/msvc/x64") libdirs("../lib/msvc/x64") if (toolTable.Kind == "library") then - targetdir("../lib/msvc/x64") + targetdir(toolTable.TargetDirectory .. "/msvc/x64") elseif (toolTable.Kind == "plugin") then targetdir("../plugins/" .. toolTable.Name .. "/lib/msvc/x64") end @@ -343,7 +343,7 @@ function NazaraBuild:Execute() libdirs("../extlibs/lib/xcode/x86") libdirs("../lib/xcode/x86") if (toolTable.Kind == "library") then - targetdir("../lib/xcode/x86") + targetdir(toolTable.TargetDirectory .. "/xcode/x86") elseif (toolTable.Kind == "plugin") then targetdir("../plugins/" .. toolTable.Name .. "/lib/xcode/x86") end @@ -352,7 +352,7 @@ function NazaraBuild:Execute() libdirs("../extlibs/lib/xcode/x64") libdirs("../lib/xcode/x64") if (toolTable.Kind == "library") then - targetdir("../lib/xcode/x64") + targetdir(toolTable.TargetDirectory .. "/xcode/x64") elseif (toolTable.Kind == "plugin") then targetdir("../plugins/" .. toolTable.Name .. "/lib/xcode/x64") end diff --git a/build/scripts/tools/assimp.lua b/build/scripts/tools/assimp.lua index c810d6c0a..f834d6d11 100644 --- a/build/scripts/tools/assimp.lua +++ b/build/scripts/tools/assimp.lua @@ -2,7 +2,6 @@ TOOL.Name = "Assimp" TOOL.Directory = "../plugins/Assimp" TOOL.Kind = "Plugin" -TOOL.TargetDirectory = "../SDK/lib" TOOL.Includes = { "../extlibs/include", diff --git a/build/scripts/tools/ndk.lua b/build/scripts/tools/ndk.lua index 8a40ea170..66dcf9a17 100644 --- a/build/scripts/tools/ndk.lua +++ b/build/scripts/tools/ndk.lua @@ -2,7 +2,7 @@ TOOL.Name = "SDK" TOOL.Directory = "../SDK" TOOL.Kind = "Library" -TOOL.TargetDirectory = "../SDK/lib" +TOOL.TargetDirectory = "../lib" TOOL.Defines = { "NDK_BUILD" diff --git a/build/scripts/tools/ndk_server.lua b/build/scripts/tools/ndk_server.lua index aa8548b80..cebd158c6 100644 --- a/build/scripts/tools/ndk_server.lua +++ b/build/scripts/tools/ndk_server.lua @@ -2,7 +2,7 @@ TOOL.Name = "SDKServer" TOOL.Directory = "../SDK" TOOL.Kind = "Library" -TOOL.TargetDirectory = "../SDK/lib" +TOOL.TargetDirectory = "../lib" TOOL.Defines = { "NDK_BUILD", From 318e6368a2604632ae3ebfa0f5e7bf7d839b352f Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 17 Aug 2016 13:00:03 +0200 Subject: [PATCH 29/74] Remove Vulkan from master branch Former-commit-id: 4bc44622fc88c08e4718484ee74128a4a8a326e0 [formerly 6ecba7b84dc522ace503113d60a54d3e30edb058] [formerly d80ca9f0e519522d7e0dc9ccb0e4b0a4aa1a13ab [formerly abef6064b63ddae172eb7e9c09bab1b7faf5c399]] Former-commit-id: f94d82bcc372d4f19f51280c25d2e98f99bfdbcf [formerly f1953666e292997824ce70da96758e3b67d4ac37] Former-commit-id: 1148ef1a828bb3599f41a432de67148fd4ef98f8 --- include/Nazara/Vulkan/Config.hpp | 53 ---- include/Nazara/Vulkan/ConfigCheck.hpp | 22 -- include/Nazara/Vulkan/Debug.hpp | 8 - include/Nazara/Vulkan/DebugOff.hpp | 9 - include/Nazara/Vulkan/VkCommandBuffer.hpp | 58 ---- include/Nazara/Vulkan/VkCommandBuffer.inl | 150 ----------- include/Nazara/Vulkan/VkCommandPool.hpp | 53 ---- include/Nazara/Vulkan/VkCommandPool.inl | 53 ---- include/Nazara/Vulkan/VkDevice.hpp | 202 -------------- include/Nazara/Vulkan/VkDevice.inl | 96 ------- include/Nazara/Vulkan/VkDeviceObject.hpp | 50 ---- include/Nazara/Vulkan/VkDeviceObject.inl | 89 ------- include/Nazara/Vulkan/VkInstance.hpp | 141 ---------- include/Nazara/Vulkan/VkInstance.inl | 128 --------- include/Nazara/Vulkan/VkLoader.hpp | 52 ---- include/Nazara/Vulkan/VkLoader.inl | 19 -- include/Nazara/Vulkan/VkQueue.hpp | 52 ---- include/Nazara/Vulkan/VkQueue.inl | 102 ------- include/Nazara/Vulkan/VkSemaphore.hpp | 42 --- include/Nazara/Vulkan/VkSemaphore.inl | 41 --- include/Nazara/Vulkan/VkSurface.hpp | 94 ------- include/Nazara/Vulkan/VkSurface.inl | 311 ---------------------- include/Nazara/Vulkan/VkSwapchain.hpp | 51 ---- include/Nazara/Vulkan/VkSwapchain.inl | 90 ------- include/Nazara/Vulkan/Vulkan.hpp | 33 --- src/Nazara/Vulkan/Debug/NewOverload.cpp | 31 --- src/Nazara/Vulkan/VkCommandPool.cpp | 53 ---- src/Nazara/Vulkan/VkDevice.cpp | 178 ------------- src/Nazara/Vulkan/VkInstance.cpp | 193 -------------- src/Nazara/Vulkan/VkLoader.cpp | 117 -------- src/Nazara/Vulkan/Vulkan.cpp | 70 ----- 31 files changed, 2641 deletions(-) delete mode 100644 include/Nazara/Vulkan/Config.hpp delete mode 100644 include/Nazara/Vulkan/ConfigCheck.hpp delete mode 100644 include/Nazara/Vulkan/Debug.hpp delete mode 100644 include/Nazara/Vulkan/DebugOff.hpp delete mode 100644 include/Nazara/Vulkan/VkCommandBuffer.hpp delete mode 100644 include/Nazara/Vulkan/VkCommandBuffer.inl delete mode 100644 include/Nazara/Vulkan/VkCommandPool.hpp delete mode 100644 include/Nazara/Vulkan/VkCommandPool.inl delete mode 100644 include/Nazara/Vulkan/VkDevice.hpp delete mode 100644 include/Nazara/Vulkan/VkDevice.inl delete mode 100644 include/Nazara/Vulkan/VkDeviceObject.hpp delete mode 100644 include/Nazara/Vulkan/VkDeviceObject.inl delete mode 100644 include/Nazara/Vulkan/VkInstance.hpp delete mode 100644 include/Nazara/Vulkan/VkInstance.inl delete mode 100644 include/Nazara/Vulkan/VkLoader.hpp delete mode 100644 include/Nazara/Vulkan/VkLoader.inl delete mode 100644 include/Nazara/Vulkan/VkQueue.hpp delete mode 100644 include/Nazara/Vulkan/VkQueue.inl delete mode 100644 include/Nazara/Vulkan/VkSemaphore.hpp delete mode 100644 include/Nazara/Vulkan/VkSemaphore.inl delete mode 100644 include/Nazara/Vulkan/VkSurface.hpp delete mode 100644 include/Nazara/Vulkan/VkSurface.inl delete mode 100644 include/Nazara/Vulkan/VkSwapchain.hpp delete mode 100644 include/Nazara/Vulkan/VkSwapchain.inl delete mode 100644 include/Nazara/Vulkan/Vulkan.hpp delete mode 100644 src/Nazara/Vulkan/Debug/NewOverload.cpp delete mode 100644 src/Nazara/Vulkan/VkCommandPool.cpp delete mode 100644 src/Nazara/Vulkan/VkDevice.cpp delete mode 100644 src/Nazara/Vulkan/VkInstance.cpp delete mode 100644 src/Nazara/Vulkan/VkLoader.cpp delete mode 100644 src/Nazara/Vulkan/Vulkan.cpp diff --git a/include/Nazara/Vulkan/Config.hpp b/include/Nazara/Vulkan/Config.hpp deleted file mode 100644 index d5f616214..000000000 --- a/include/Nazara/Vulkan/Config.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - Nazara Engine - Vulkan - - Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -#ifndef NAZARA_CONFIG_VULKAN_HPP -#define NAZARA_CONFIG_VULKAN_HPP - -/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci - -// Utilise le MemoryManager pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes) -#define NAZARA_VULKAN_MANAGE_MEMORY 0 - -// Active les tests de sécurité basés sur le code (Conseillé pour le développement) -#define NAZARA_VULKAN_SAFE 1 - -/// Chaque modification d'un paramètre ci-dessous implique une modification (souvent mineure) du code - -/// Vérification des valeurs et types de certaines constantes -#include - -#if !defined(NAZARA_STATIC) - #ifdef NAZARA_VULKAN_BUILD - #define NAZARA_VULKAN_API NAZARA_EXPORT - #else - #define NAZARA_VULKAN_API NAZARA_IMPORT - #endif -#else - #define NAZARA_VULKAN_API -#endif - -#endif // NAZARA_CONFIG_MODULENAME_HPP diff --git a/include/Nazara/Vulkan/ConfigCheck.hpp b/include/Nazara/Vulkan/ConfigCheck.hpp deleted file mode 100644 index 22f334c6f..000000000 --- a/include/Nazara/Vulkan/ConfigCheck.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_CONFIG_CHECK_VULKANE_HPP -#define NAZARA_CONFIG_CHECK_VULKANE_HPP - -/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp - -#include -#define CheckType(name, type, err) static_assert(std::is_ ##type ::value, #type err) -#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type ::value && name op val, #type err) - -// On force la valeur de MANAGE_MEMORY en mode debug -#if defined(NAZARA_DEBUG) && !NAZARA_VULKAN_MANAGE_MEMORY - #undef NAZARA_MODULENAME_MANAGE_MEMORY - #define NAZARA_MODULENAME_MANAGE_MEMORY 0 -#endif - -#endif // NAZARA_CONFIG_CHECK_VULKAN_HPP diff --git a/include/Nazara/Vulkan/Debug.hpp b/include/Nazara/Vulkan/Debug.hpp deleted file mode 100644 index b5e44efae..000000000 --- a/include/Nazara/Vulkan/Debug.hpp +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_MODULENAME_MANAGE_MEMORY - #include -#endif diff --git a/include/Nazara/Vulkan/DebugOff.hpp b/include/Nazara/Vulkan/DebugOff.hpp deleted file mode 100644 index e57a2b946..000000000 --- a/include/Nazara/Vulkan/DebugOff.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp -#if NAZARA_MODULENAME_MANAGE_MEMORY - #undef delete - #undef new -#endif diff --git a/include/Nazara/Vulkan/VkCommandBuffer.hpp b/include/Nazara/Vulkan/VkCommandBuffer.hpp deleted file mode 100644 index 2dea341dd..000000000 --- a/include/Nazara/Vulkan/VkCommandBuffer.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKCOMMANDBUFFER_HPP -#define NAZARA_VULKAN_VKCOMMANDBUFFER_HPP - -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - class NAZARA_VULKAN_API CommandBuffer - { - friend CommandPool; - - public: - CommandBuffer(const CommandBuffer&) = delete; - CommandBuffer(CommandBuffer&& commandBuffer); - inline ~CommandBuffer(); - - inline bool Begin(const VkCommandBufferBeginInfo& info); - inline bool Begin(VkCommandBufferUsageFlags flags); - inline bool Begin(VkCommandBufferUsageFlags flags, const VkCommandBufferInheritanceInfo& inheritanceInfo); - inline bool Begin(VkCommandBufferUsageFlags flags, VkRenderPass renderPass, UInt32 subpass, VkFramebuffer framebuffer, bool occlusionQueryEnable, VkQueryControlFlags queryFlags, VkQueryPipelineStatisticFlags pipelineStatistics); - inline bool Begin(VkCommandBufferUsageFlags flags, bool occlusionQueryEnable, VkQueryControlFlags queryFlags, VkQueryPipelineStatisticFlags pipelineStatistics); - - inline bool End(); - - inline void Free(); - - inline VkResult GetLastErrorCode() const; - - CommandBuffer& operator=(const CommandBuffer&) = delete; - CommandBuffer& operator=(CommandBuffer&&) = delete; - - inline operator VkCommandBuffer(); - - private: - inline CommandBuffer(CommandPool& pool, VkCommandBuffer handle); - - CommandPoolHandle m_pool; - VkAllocationCallbacks m_allocator; - VkCommandBuffer m_handle; - VkResult m_lastErrorCode; - - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKCOMMANDBUFFER_HPP diff --git a/include/Nazara/Vulkan/VkCommandBuffer.inl b/include/Nazara/Vulkan/VkCommandBuffer.inl deleted file mode 100644 index d2d6f50d7..000000000 --- a/include/Nazara/Vulkan/VkCommandBuffer.inl +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - inline CommandBuffer::CommandBuffer(CommandPool& pool, VkCommandBuffer handle) : - m_pool(&pool), - m_handle(handle) - { - } - - inline CommandBuffer::CommandBuffer(CommandBuffer&& commandBuffer) : - m_pool(std::move(commandBuffer.m_pool)), - m_allocator(commandBuffer.m_allocator), - m_handle(commandBuffer.m_handle), - m_lastErrorCode(commandBuffer.m_lastErrorCode) - { - commandBuffer.m_handle = VK_NULL_HANDLE; - } - - inline CommandBuffer::~CommandBuffer() - { - Free(); - } - - inline bool CommandBuffer::Begin(const VkCommandBufferBeginInfo& info) - { - m_lastErrorCode = m_pool->GetDevice().vkBeginCommandBuffer(m_handle, &info); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to begin command buffer"); - return false; - } - - return true; - } - - inline bool CommandBuffer::Begin(VkCommandBufferUsageFlags flags) - { - VkCommandBufferBeginInfo beginInfo = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - nullptr, - flags, - nullptr - }; - - return Begin(beginInfo); - } - - inline bool CommandBuffer::Begin(VkCommandBufferUsageFlags flags, const VkCommandBufferInheritanceInfo& inheritanceInfo) - { - VkCommandBufferBeginInfo beginInfo = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - nullptr, - flags, - &inheritanceInfo - }; - - return Begin(beginInfo); - } - - inline bool CommandBuffer::Begin(VkCommandBufferUsageFlags flags, VkRenderPass renderPass, UInt32 subpass, VkFramebuffer framebuffer, bool occlusionQueryEnable, VkQueryControlFlags queryFlags, VkQueryPipelineStatisticFlags pipelineStatistics) - { - NazaraAssert(flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT, "Continue bit is required to ignore renderPass, subpass and framebuffer"); - - VkCommandBufferInheritanceInfo inheritanceInfo = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, - nullptr, - renderPass, - subpass, - framebuffer, - VkBool32((occlusionQueryEnable) ? VK_TRUE : VK_FALSE), - queryFlags, - pipelineStatistics - }; - - VkCommandBufferBeginInfo beginInfo = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - nullptr, - flags, - &inheritanceInfo - }; - - return Begin(beginInfo); - } - - inline bool CommandBuffer::Begin(VkCommandBufferUsageFlags flags, bool occlusionQueryEnable, VkQueryControlFlags queryFlags, VkQueryPipelineStatisticFlags pipelineStatistics) - { - NazaraAssert(flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT, "Continue bit is required to ignore renderPass, subpass and framebuffer"); - - VkCommandBufferInheritanceInfo inheritanceInfo = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, - nullptr, - VK_NULL_HANDLE, - 0, - VK_NULL_HANDLE, - VkBool32((occlusionQueryEnable) ? VK_TRUE : VK_FALSE), - queryFlags, - pipelineStatistics - }; - - VkCommandBufferBeginInfo beginInfo = { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - nullptr, - flags, - &inheritanceInfo - }; - - return Begin(beginInfo); - } - - inline bool CommandBuffer::End() - { - m_lastErrorCode = m_pool->GetDevice().vkEndCommandBuffer(m_handle); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to end command buffer"); - return false; - } - - return true; - } - - inline void CommandBuffer::Free() - { - if (m_handle) - m_pool->GetDevice().vkFreeCommandBuffers(m_pool->GetDevice(), *m_pool, 1, &m_handle); - } - - inline VkResult CommandBuffer::GetLastErrorCode() const - { - return m_lastErrorCode; - } - - inline CommandBuffer::operator VkCommandBuffer() - { - return m_handle; - } - } -} - -#include diff --git a/include/Nazara/Vulkan/VkCommandPool.hpp b/include/Nazara/Vulkan/VkCommandPool.hpp deleted file mode 100644 index b51061bb2..000000000 --- a/include/Nazara/Vulkan/VkCommandPool.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKCOMMANDPOOL_HPP -#define NAZARA_VULKAN_VKCOMMANDPOOL_HPP - -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - class CommandBuffer; - class CommandPool; - - using CommandPoolHandle = ObjectHandle; - - class NAZARA_VULKAN_API CommandPool : public DeviceObject, public HandledObject - { - friend DeviceObject; - - public: - inline CommandPool(Device& instance); - CommandPool(const CommandPool&) = delete; - CommandPool(CommandPool&&) = default; - ~CommandPool() = default; - - CommandBuffer AllocateCommandBuffer(VkCommandBufferLevel level); - std::vector AllocateCommandBuffers(UInt32 commandBufferCount, VkCommandBufferLevel level); - - using DeviceObject::Create; - inline bool Create(UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr); - - inline bool Reset(VkCommandPoolResetFlags flags); - - CommandPool& operator=(const CommandPool&) = delete; - CommandPool& operator=(CommandPool&&) = delete; - - private: - static inline VkResult CreateHelper(Device& device, const VkCommandPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkCommandPool* handle); - static inline void DestroyHelper(Device& device, VkCommandPool handle, const VkAllocationCallbacks* allocator); - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKCOMMANDPOOL_HPP diff --git a/include/Nazara/Vulkan/VkCommandPool.inl b/include/Nazara/Vulkan/VkCommandPool.inl deleted file mode 100644 index 61cfeaa43..000000000 --- a/include/Nazara/Vulkan/VkCommandPool.inl +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - inline CommandPool::CommandPool(Device& device) : - DeviceObject(device) - { - } - - inline bool CommandPool::Create(UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags, const VkAllocationCallbacks* allocator) - { - VkCommandPoolCreateInfo createInfo = - { - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, - nullptr, - flags, - queueFamilyIndex - }; - - return Create(createInfo, allocator); - } - - inline bool CommandPool::Reset(VkCommandPoolResetFlags flags) - { - m_lastErrorCode = m_device.vkResetCommandPool(m_device, m_handle, flags); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - return false; - - return true; - } - - inline VkResult CommandPool::CreateHelper(Device& device, const VkCommandPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkCommandPool* handle) - { - return device.vkCreateCommandPool(device, createInfo, allocator, handle); - } - - inline void CommandPool::DestroyHelper(Device& device, VkCommandPool handle, const VkAllocationCallbacks* allocator) - { - return device.vkDestroyCommandPool(device, handle, allocator); - } - } -} - -#include diff --git a/include/Nazara/Vulkan/VkDevice.hpp b/include/Nazara/Vulkan/VkDevice.hpp deleted file mode 100644 index 1b9d3a470..000000000 --- a/include/Nazara/Vulkan/VkDevice.hpp +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKDEVICE_HPP -#define NAZARA_VULKAN_VKDEVICE_HPP - -#include -#include -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - class Device; - class Queue; - class Instance; - - using DeviceHandle = ObjectHandle; - - class NAZARA_VULKAN_API Device : public HandledObject - { - public: - inline Device(Instance& instance); - Device(const Device&) = delete; - Device(Device&&) = delete; - inline ~Device(); - - bool Create(VkPhysicalDevice device, const VkDeviceCreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline void Destroy(); - - inline Queue GetQueue(UInt32 queueFamilyIndex, UInt32 queueIndex); - inline Instance& GetInstance(); - inline const Instance& GetInstance() const; - inline VkResult GetLastErrorCode() const; - - inline bool IsExtensionLoaded(const String& extensionName); - inline bool IsLayerLoaded(const String& layerName); - - inline bool WaitForIdle(); - - Device& operator=(const Device&) = delete; - Device& operator=(Device&&) = delete; - - inline operator VkDevice(); - - // Vulkan functions - #define NAZARA_VULKAN_DEVICE_FUNCTION(func) PFN_##func func - - // Vulkan core - NAZARA_VULKAN_DEVICE_FUNCTION(vkAllocateCommandBuffers); - NAZARA_VULKAN_DEVICE_FUNCTION(vkAllocateMemory); - NAZARA_VULKAN_DEVICE_FUNCTION(vkBeginCommandBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkBindBufferMemory); - NAZARA_VULKAN_DEVICE_FUNCTION(vkBindImageMemory); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdBeginQuery); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdBeginRenderPass); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdBindDescriptorSets); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdBindIndexBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdBindPipeline); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdBindVertexBuffers); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdBlitImage); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdClearAttachments); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdClearColorImage); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdClearDepthStencilImage); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdCopyBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdCopyBufferToImage); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdCopyImage); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdCopyImageToBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdCopyQueryPoolResults); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdDispatch); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdDispatchIndirect); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdDraw); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdDrawIndexed); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdDrawIndexedIndirect); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdDrawIndirect); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdEndQuery); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdEndRenderPass); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdExecuteCommands); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdFillBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdNextSubpass); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdPipelineBarrier); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdPushConstants); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdResetEvent); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdResetQueryPool); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdResolveImage); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetBlendConstants); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetDepthBias); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetDepthBounds); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetEvent); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetLineWidth); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetScissor); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetStencilCompareMask); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetStencilReference); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetStencilWriteMask); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdSetViewport); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdUpdateBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdWaitEvents); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCmdWriteTimestamp); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateBufferView); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateCommandPool); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateComputePipelines); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateDescriptorPool); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateDescriptorSetLayout); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateEvent); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateFramebuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateGraphicsPipelines); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateImage); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateImageView); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreatePipelineLayout); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateRenderPass); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateSampler); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateSemaphore); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateShaderModule); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyBufferView); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyCommandPool); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyDescriptorPool); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyDescriptorSetLayout); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyDevice); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyEvent); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyFramebuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyImage); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyImageView); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyPipeline); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyPipelineLayout); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyRenderPass); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroySampler); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroySemaphore); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroyShaderModule); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDeviceWaitIdle); - NAZARA_VULKAN_DEVICE_FUNCTION(vkEndCommandBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkFreeCommandBuffers); - NAZARA_VULKAN_DEVICE_FUNCTION(vkFreeDescriptorSets); - NAZARA_VULKAN_DEVICE_FUNCTION(vkFreeMemory); - NAZARA_VULKAN_DEVICE_FUNCTION(vkFlushMappedMemoryRanges); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetBufferMemoryRequirements); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetDeviceMemoryCommitment); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetDeviceQueue); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetEventStatus); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetFenceStatus); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetImageMemoryRequirements); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetImageSparseMemoryRequirements); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetImageSubresourceLayout); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetRenderAreaGranularity); - NAZARA_VULKAN_DEVICE_FUNCTION(vkInvalidateMappedMemoryRanges); - NAZARA_VULKAN_DEVICE_FUNCTION(vkMapMemory); - NAZARA_VULKAN_DEVICE_FUNCTION(vkMergePipelineCaches); - NAZARA_VULKAN_DEVICE_FUNCTION(vkQueueSubmit); - NAZARA_VULKAN_DEVICE_FUNCTION(vkQueueWaitIdle); - NAZARA_VULKAN_DEVICE_FUNCTION(vkResetCommandBuffer); - NAZARA_VULKAN_DEVICE_FUNCTION(vkResetCommandPool); - NAZARA_VULKAN_DEVICE_FUNCTION(vkResetDescriptorPool); - NAZARA_VULKAN_DEVICE_FUNCTION(vkResetFences); - NAZARA_VULKAN_DEVICE_FUNCTION(vkResetEvent); - NAZARA_VULKAN_DEVICE_FUNCTION(vkSetEvent); - NAZARA_VULKAN_DEVICE_FUNCTION(vkUnmapMemory); - NAZARA_VULKAN_DEVICE_FUNCTION(vkUpdateDescriptorSets); - NAZARA_VULKAN_DEVICE_FUNCTION(vkWaitForFences); - - // VK_KHR_display_swapchain - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateSharedSwapchainsKHR); - - // VK_KHR_surface - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroySurfaceKHR); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetPhysicalDeviceSurfaceCapabilitiesKHR); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR); - - // VK_KHR_swapchain - NAZARA_VULKAN_DEVICE_FUNCTION(vkAcquireNextImageKHR); - NAZARA_VULKAN_DEVICE_FUNCTION(vkCreateSwapchainKHR); - NAZARA_VULKAN_DEVICE_FUNCTION(vkDestroySwapchainKHR); - NAZARA_VULKAN_DEVICE_FUNCTION(vkGetSwapchainImagesKHR); - NAZARA_VULKAN_DEVICE_FUNCTION(vkQueuePresentKHR); - - #undef NAZARA_VULKAN_DEVICE_FUNCTION - - private: - inline PFN_vkVoidFunction GetProcAddr(const char* name); - - Instance& m_instance; - VkAllocationCallbacks m_allocator; - VkDevice m_device; - VkResult m_lastErrorCode; - std::unordered_set m_loadedExtensions; - std::unordered_set m_loadedLayers; - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKDEVICE_HPP diff --git a/include/Nazara/Vulkan/VkDevice.inl b/include/Nazara/Vulkan/VkDevice.inl deleted file mode 100644 index 77dc1e254..000000000 --- a/include/Nazara/Vulkan/VkDevice.inl +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - inline Device::Device(Instance& instance) : - m_instance(instance), - m_device(nullptr) - { - } - - inline Device::~Device() - { - Destroy(); - } - - inline void Device::Destroy() - { - if (m_device) - { - vkDeviceWaitIdle(m_device); - vkDestroyDevice(m_device, (m_allocator.pfnAllocation) ? &m_allocator : nullptr); - } - } - - inline Queue Device::GetQueue(UInt32 queueFamilyIndex, UInt32 queueIndex) - { - VkQueue queue; - vkGetDeviceQueue(m_device, queueFamilyIndex, queueIndex, &queue); - - return Queue(*this, queue); - } - - inline Instance& Device::GetInstance() - { - return m_instance; - } - - inline const Instance& Device::GetInstance() const - { - return m_instance; - } - - inline VkResult Device::GetLastErrorCode() const - { - return m_lastErrorCode; - } - - inline bool Device::IsExtensionLoaded(const String& extensionName) - { - return m_loadedExtensions.count(extensionName) > 0; - } - - inline bool Device::IsLayerLoaded(const String& layerName) - { - return m_loadedLayers.count(layerName) > 0; - } - - inline bool Device::WaitForIdle() - { - m_lastErrorCode = vkDeviceWaitIdle(m_device); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to wait for device idle"); - return false; - } - - return true; - } - - inline Device::operator VkDevice() - { - return m_device; - } - - inline PFN_vkVoidFunction Device::GetProcAddr(const char* name) - { - PFN_vkVoidFunction func = m_instance.GetDeviceProcAddr(m_device, name); - if (!func) - NazaraError("Failed to get " + String(name) + " address"); - - return func; - } - } -} - -#include diff --git a/include/Nazara/Vulkan/VkDeviceObject.hpp b/include/Nazara/Vulkan/VkDeviceObject.hpp deleted file mode 100644 index dd9da38c9..000000000 --- a/include/Nazara/Vulkan/VkDeviceObject.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKDEVICEOBJECT_HPP -#define NAZARA_VULKAN_VKDEVICEOBJECT_HPP - -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - template - class DeviceObject - { - public: - inline DeviceObject(Device& instance); - DeviceObject(const DeviceObject&) = delete; - DeviceObject(DeviceObject&&); - inline ~DeviceObject(); - - inline bool Create(const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline void Destroy(); - - inline Device& GetDevice(); - inline const Device& GetDevice() const; - inline VkResult GetLastErrorCode() const; - - DeviceObject& operator=(const DeviceObject&) = delete; - DeviceObject& operator=(DeviceObject&&) = delete; - - inline operator VkType(); - - protected: - Device& m_device; - VkAllocationCallbacks m_allocator; - VkType m_handle; - VkResult m_lastErrorCode; - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKDEVICEOBJECT_HPP diff --git a/include/Nazara/Vulkan/VkDeviceObject.inl b/include/Nazara/Vulkan/VkDeviceObject.inl deleted file mode 100644 index a3136156c..000000000 --- a/include/Nazara/Vulkan/VkDeviceObject.inl +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - template - inline DeviceObject::DeviceObject(Device& device) : - m_device(device), - m_handle(VK_NULL_HANDLE) - { - } - - template - inline DeviceObject::DeviceObject(DeviceObject&& object) : - m_device(object.m_device), - m_allocator(object.m_allocator), - m_handle(object.m_handle), - m_lastErrorCode(object.m_lastErrorCode) - { - object.m_handle = VK_NULL_HANDLE; - } - - template - inline DeviceObject::~DeviceObject() - { - Destroy(); - } - - template - inline bool DeviceObject::Create(const CreateInfo& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = C::CreateHelper(m_device, &createInfo, allocator, &m_handle); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to create Vulkan object"); - return false; - } - - // Store the allocator to access them when needed - if (allocator) - m_allocator = *allocator; - else - m_allocator.pfnAllocation = nullptr; - - return true; - } - - template - inline void DeviceObject::Destroy() - { - if (m_handle != VK_NULL_HANDLE) - C::DestroyHelper(m_device, m_handle, (m_allocator.pfnAllocation) ? &m_allocator : nullptr); - } - - template - inline Device& DeviceObject::GetDevice() - { - return m_device; - } - - template - inline const Device& DeviceObject::GetDevice() const - { - return m_device; - } - - template - inline VkResult DeviceObject::GetLastErrorCode() const - { - return m_lastErrorCode; - } - - template - inline DeviceObject::operator VkType() - { - return m_handle; - } - } -} - -#include diff --git a/include/Nazara/Vulkan/VkInstance.hpp b/include/Nazara/Vulkan/VkInstance.hpp deleted file mode 100644 index ded2b0ef7..000000000 --- a/include/Nazara/Vulkan/VkInstance.hpp +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKINSTANCE_HPP -#define NAZARA_VULKAN_VKINSTANCE_HPP - -#include -#include -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - class NAZARA_VULKAN_API Instance - { - public: - inline Instance(); - Instance(const Instance&) = delete; - Instance(Instance&&) = delete; - inline ~Instance(); - - bool Create(const VkInstanceCreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline bool Create(const String& appName, UInt32 appVersion, const String& engineName, UInt32 engineVersion, const std::vector& layers, const std::vector& extensions, const VkAllocationCallbacks* allocator = nullptr); - inline void Destroy(); - - bool EnumeratePhysicalDevices(std::vector* physicalDevices); - - inline PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* name); - - inline void GetPhysicalDeviceFeatures(VkPhysicalDevice device, VkPhysicalDeviceFeatures* features); - inline void GetPhysicalDeviceFormatProperties(VkPhysicalDevice device, VkFormat format, VkFormatProperties* formatProperties); - inline bool GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* imageFormatProperties); - inline void GetPhysicalDeviceMemoryProperties(VkPhysicalDevice device, VkPhysicalDeviceMemoryProperties* properties); - inline void GetPhysicalDeviceProperties(VkPhysicalDevice device, VkPhysicalDeviceProperties* properties); - bool GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice device, std::vector* queueFamilyProperties); - - inline VkResult GetLastErrorCode() const; - - inline bool IsExtensionLoaded(const String& extensionName); - inline bool IsLayerLoaded(const String& layerName); - - Instance& operator=(const Instance&) = delete; - Instance& operator=(Instance&&) = delete; - - inline operator VkInstance(); - - // Vulkan functions - #define NAZARA_VULKAN_INSTANCE_FUNCTION(func) PFN_##func func - - // Vulkan core - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateDevice); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkDestroyInstance); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkEnumeratePhysicalDevices); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetDeviceProcAddr); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceFeatures); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceFormatProperties); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceImageFormatProperties); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceMemoryProperties); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceProperties); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceQueueFamilyProperties); - - // VK_KHR_display - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateDisplayModeKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateDisplayPlaneSurfaceKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetDisplayModePropertiesKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetDisplayPlaneCapabilitiesKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetDisplayPlaneSupportedDisplaysKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceDisplayPlanePropertiesKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceDisplayPropertiesKHR); - - // VK_KHR_surface - NAZARA_VULKAN_INSTANCE_FUNCTION(vkDestroySurfaceKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceCapabilitiesKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR); - - // VK_EXT_debug_report - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateDebugReportCallbackEXT); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkDestroyDebugReportCallbackEXT); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkDebugReportMessageEXT); - - #ifdef VK_USE_PLATFORM_ANDROID_KHR - // VK_KHR_android_surface - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateAndroidSurfaceKHR); - #endif - - #ifdef VK_USE_PLATFORM_MIR_KHR - // VK_KHR_mir_surface - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateMirSurfaceKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceMirPresentationSupportKHR); - #endif - - #ifdef VK_USE_PLATFORM_XCB_KHR - // VK_KHR_xcb_surface - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateXcbSurfaceKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceXcbPresentationSupportKHR); - #endif - - #ifdef VK_USE_PLATFORM_XLIB_KHR - // VK_KHR_xlib_surface - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateXlibSurfaceKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceXlibPresentationSupportKHR); - #endif - - #ifdef VK_USE_PLATFORM_WAYLAND_KHR - // VK_KHR_wayland_surface - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateWaylandSurfaceKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceWaylandPresentationSupportKHR); - #endif - - #ifdef VK_USE_PLATFORM_WIN32_KHR - // VK_KHR_win32_surface - NAZARA_VULKAN_INSTANCE_FUNCTION(vkCreateWin32SurfaceKHR); - NAZARA_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceWin32PresentationSupportKHR); - #endif - - #undef NAZARA_VULKAN_INSTANCE_FUNCTION - - private: - inline PFN_vkVoidFunction GetProcAddr(const char* name); - - VkAllocationCallbacks m_allocator; - VkInstance m_instance; - VkResult m_lastErrorCode; - std::unordered_set m_loadedExtensions; - std::unordered_set m_loadedLayers; - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKINSTANCE_HPP diff --git a/include/Nazara/Vulkan/VkInstance.inl b/include/Nazara/Vulkan/VkInstance.inl deleted file mode 100644 index 801691855..000000000 --- a/include/Nazara/Vulkan/VkInstance.inl +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - inline Instance::Instance() : - m_instance(nullptr) - { - } - - inline Instance::~Instance() - { - Destroy(); - } - - inline bool Instance::Create(const String& appName, UInt32 appVersion, const String& engineName, UInt32 engineVersion, const std::vector& layers, const std::vector& extensions, const VkAllocationCallbacks* allocator) - { - VkApplicationInfo appInfo = - { - VK_STRUCTURE_TYPE_APPLICATION_INFO, - nullptr, - appName.GetConstBuffer(), - appVersion, - engineName.GetConstBuffer(), - engineVersion - }; - - VkInstanceCreateInfo instanceInfo = - { - VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, - nullptr, - 0, - &appInfo, - static_cast(layers.size()), - (!layers.empty()) ? layers.data() : nullptr, - static_cast(extensions.size()), - (!extensions.empty()) ? extensions.data() : nullptr - }; - - return Create(instanceInfo, allocator); - } - - inline void Instance::Destroy() - { - if (m_instance) - vkDestroyInstance(m_instance, (m_allocator.pfnAllocation) ? &m_allocator : nullptr); - } - - inline PFN_vkVoidFunction Instance::GetDeviceProcAddr(VkDevice device, const char* name) - { - PFN_vkVoidFunction func = vkGetDeviceProcAddr(device, name); - if (!func) - NazaraError("Failed to get " + String(name) + " address"); - - return func; - } - - inline VkResult Instance::GetLastErrorCode() const - { - return m_lastErrorCode; - } - - inline bool Instance::IsExtensionLoaded(const String& extensionName) - { - return m_loadedExtensions.count(extensionName) > 0; - } - - inline bool Instance::IsLayerLoaded(const String& layerName) - { - return m_loadedLayers.count(layerName) > 0; - } - - inline Instance::operator VkInstance() - { - return m_instance; - } - - inline void Instance::GetPhysicalDeviceFeatures(VkPhysicalDevice device, VkPhysicalDeviceFeatures* features) - { - return vkGetPhysicalDeviceFeatures(device, features); - } - - inline void Instance::GetPhysicalDeviceFormatProperties(VkPhysicalDevice device, VkFormat format, VkFormatProperties* formatProperties) - { - return vkGetPhysicalDeviceFormatProperties(device, format, formatProperties); - } - - inline bool Instance::GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* imageFormatProperties) - { - m_lastErrorCode = vkGetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, imageFormatProperties); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to get physical device image format properties"); - return false; - } - - return true; - } - - inline void Instance::GetPhysicalDeviceMemoryProperties(VkPhysicalDevice device, VkPhysicalDeviceMemoryProperties* memoryProperties) - { - return vkGetPhysicalDeviceMemoryProperties(device, memoryProperties); - } - - inline void Instance::GetPhysicalDeviceProperties(VkPhysicalDevice device, VkPhysicalDeviceProperties* properties) - { - return vkGetPhysicalDeviceProperties(device, properties); - } - - inline PFN_vkVoidFunction Instance::GetProcAddr(const char* name) - { - PFN_vkVoidFunction func = Loader::GetInstanceProcAddr(m_instance, name); - if (!func) - NazaraError("Failed to get " + String(name) + " address"); - - return func; - } - } -} - -#include diff --git a/include/Nazara/Vulkan/VkLoader.hpp b/include/Nazara/Vulkan/VkLoader.hpp deleted file mode 100644 index f12429b28..000000000 --- a/include/Nazara/Vulkan/VkLoader.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKLOADER_HPP -#define NAZARA_VULKAN_VKLOADER_HPP - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - class NAZARA_VULKAN_API Loader - { - public: - Loader() = delete; - ~Loader() = delete; - - static bool EnumerateInstanceExtensionProperties(std::vector* properties, const char* layerName = nullptr); - static bool EnumerateInstanceLayerProperties(std::vector* properties); - - static inline PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name); - - static bool Initialize(); - static void Uninitialize(); - - // Vulkan functions - #define NAZARA_VULKAN_GLOBAL_FUNCTION(func) static PFN_##func func - - NAZARA_VULKAN_GLOBAL_FUNCTION(vkCreateInstance); - NAZARA_VULKAN_GLOBAL_FUNCTION(vkEnumerateInstanceExtensionProperties); - NAZARA_VULKAN_GLOBAL_FUNCTION(vkEnumerateInstanceLayerProperties); - NAZARA_VULKAN_GLOBAL_FUNCTION(vkGetInstanceProcAddr); - - #undef NAZARA_VULKAN_GLOBAL_FUNCTION - - private: - static DynLib s_vulkanLib; - static VkResult s_lastErrorCode; - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKLOADER_HPP diff --git a/include/Nazara/Vulkan/VkLoader.inl b/include/Nazara/Vulkan/VkLoader.inl deleted file mode 100644 index 49467366d..000000000 --- a/include/Nazara/Vulkan/VkLoader.inl +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include - -namespace Nz -{ - namespace Vk - { - inline PFN_vkVoidFunction Loader::GetInstanceProcAddr(VkInstance instance, const char* name) - { - return vkGetInstanceProcAddr(instance, name); - } - } -} - -#include diff --git a/include/Nazara/Vulkan/VkQueue.hpp b/include/Nazara/Vulkan/VkQueue.hpp deleted file mode 100644 index 35c8d16e0..000000000 --- a/include/Nazara/Vulkan/VkQueue.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKQUEUE_HPP -#define NAZARA_VULKAN_VKQUEUE_HPP - -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - class Queue - { - public: - inline Queue(Device& device, VkQueue queue); - inline Queue(const Queue& queue); - inline Queue(Queue&& queue); - inline ~Queue() = default; - - inline Device& GetDevice(); - inline VkResult GetLastErrorCode() const; - - inline bool Present(const VkPresentInfoKHR& presentInfo); - inline bool Present(VkSwapchainKHR swapchain, UInt32 imageIndex, VkSemaphore waitSemaphore = VK_NULL_HANDLE); - - inline bool Submit(const VkSubmitInfo& submit, VkFence fence = VK_NULL_HANDLE); - inline bool Submit(UInt32 submitCount, const VkSubmitInfo* submits, VkFence fence = VK_NULL_HANDLE); - - inline bool WaitIdle(); - - Queue& operator=(const Queue& queue) = delete; - Queue& operator=(Queue&&) = delete; - - inline operator VkQueue(); - - protected: - Device& m_device; - VkQueue m_handle; - VkResult m_lastErrorCode; - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKQUEUE_HPP diff --git a/include/Nazara/Vulkan/VkQueue.inl b/include/Nazara/Vulkan/VkQueue.inl deleted file mode 100644 index a47918da3..000000000 --- a/include/Nazara/Vulkan/VkQueue.inl +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - inline Queue::Queue(Device& device, VkQueue queue) : - m_device(device), - m_handle(queue), - m_lastErrorCode(VkResult::VK_SUCCESS) - { - } - - inline Queue::Queue(const Queue& queue) : - m_device(queue.m_device), - m_handle(queue.m_handle), - m_lastErrorCode(queue.m_lastErrorCode) - { - } - - inline Queue::Queue(Queue&& queue) : - m_device(queue.m_device), - m_handle(queue.m_handle), - m_lastErrorCode(queue.m_lastErrorCode) - { - } - - inline Device& Queue::GetDevice() - { - return m_device; - } - - inline VkResult Queue::GetLastErrorCode() const - { - return m_lastErrorCode; - } - - inline bool Queue::Present(const VkPresentInfoKHR& presentInfo) - { - m_lastErrorCode = m_device.vkQueuePresentKHR(m_handle, &presentInfo); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - return false; - - return true; - } - - inline bool Queue::Present(VkSwapchainKHR swapchain, UInt32 imageIndex, VkSemaphore waitSemaphore) - { - VkPresentInfoKHR presentInfo = - { - VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, - nullptr, - (waitSemaphore) ? 1U : 0U, - &waitSemaphore, - 1U, - &swapchain, - &imageIndex, - nullptr - }; - - return Present(presentInfo); - } - - inline bool Queue::Submit(const VkSubmitInfo& submit, VkFence fence) - { - return Submit(1, &submit, fence); - } - - inline bool Queue::Submit(UInt32 submitCount, const VkSubmitInfo* submits, VkFence fence) - { - m_lastErrorCode = m_device.vkQueueSubmit(m_handle, submitCount, submits, fence); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - return false; - - return true; - } - - inline bool Queue::WaitIdle() - { - m_lastErrorCode = m_device.vkQueueWaitIdle(m_handle); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - return false; - - return true; - } - - inline Queue::operator VkQueue() - { - return m_handle; - } - - } -} - -#include diff --git a/include/Nazara/Vulkan/VkSemaphore.hpp b/include/Nazara/Vulkan/VkSemaphore.hpp deleted file mode 100644 index 138d726be..000000000 --- a/include/Nazara/Vulkan/VkSemaphore.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKSEMAPHORE_HPP -#define NAZARA_VULKAN_VKSEMAPHORE_HPP - -#include -#include - -namespace Nz -{ - namespace Vk - { - class Semaphore : public DeviceObject - { - friend DeviceObject; - - public: - inline Semaphore(Device& instance); - Semaphore(const Semaphore&) = delete; - Semaphore(Semaphore&&) = default; - ~Semaphore() = default; - - using DeviceObject::Create; - inline bool Create(VkSemaphoreCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr); - - Semaphore& operator=(const Semaphore&) = delete; - Semaphore& operator=(Semaphore&&) = delete; - - private: - static VkResult CreateHelper(Device& device, const VkSemaphoreCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkSemaphore* handle); - static void DestroyHelper(Device& device, VkSemaphore handle, const VkAllocationCallbacks* allocator); - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKSEMAPHORE_HPP diff --git a/include/Nazara/Vulkan/VkSemaphore.inl b/include/Nazara/Vulkan/VkSemaphore.inl deleted file mode 100644 index fd2bf3427..000000000 --- a/include/Nazara/Vulkan/VkSemaphore.inl +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include - -namespace Nz -{ - namespace Vk - { - inline Semaphore::Semaphore(Device& device) : - DeviceObject(device) - { - } - - inline bool Semaphore::Create(VkSemaphoreCreateFlags flags, const VkAllocationCallbacks* allocator) - { - VkSemaphoreCreateInfo createInfo = - { - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, - nullptr, - flags - }; - - return Create(createInfo, allocator); - } - - VkResult Semaphore::CreateHelper(Device& device, const VkSemaphoreCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkSemaphore* handle) - { - return device.vkCreateSemaphore(device, createInfo, allocator, handle); - } - - void Semaphore::DestroyHelper(Device& device, VkSemaphore handle, const VkAllocationCallbacks* allocator) - { - return device.vkDestroySemaphore(device, handle, allocator); - } - } -} - -#include diff --git a/include/Nazara/Vulkan/VkSurface.hpp b/include/Nazara/Vulkan/VkSurface.hpp deleted file mode 100644 index 03a57d2fe..000000000 --- a/include/Nazara/Vulkan/VkSurface.hpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKSURFACE_HPP -#define NAZARA_VULKAN_VKSURFACE_HPP - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - class Instance; - - class Surface - { - public: - inline Surface(Instance& instance); - Surface(const Surface&) = delete; - Surface(Surface&& surface); - inline ~Surface(); - - #ifdef VK_USE_PLATFORM_ANDROID_KHR - // VK_KHR_android_surface - inline bool Create(const VkAndroidSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline bool Create(ANativeWindow* window, VkAndroidSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr); - #endif - - #ifdef VK_USE_PLATFORM_MIR_KHR - // VK_KHR_mir_surface - inline bool Create(const VkMirSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline bool Create(MirConnection* connection, MirSurface* surface, VkMirSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr); - #endif - - #ifdef VK_USE_PLATFORM_XCB_KHR - // VK_KHR_xcb_surface - inline bool Create(const VkXcbSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline bool Create(xcb_connection_t* connection, xcb_window_t window, VkXcbSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr); - #endif - - #ifdef VK_USE_PLATFORM_XLIB_KHR - // VK_KHR_xlib_surface - inline bool Create(const VkXlibSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline bool Create(Display* display, Window window, VkXlibSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr); - #endif - - #ifdef VK_USE_PLATFORM_WAYLAND_KHR - // VK_KHR_wayland_surface - inline bool Create(const VkWaylandSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline bool Create(wl_display* display, wl_surface* surface, VkWaylandSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr); - #endif - - #ifdef VK_USE_PLATFORM_WIN32_KHR - // VK_KHR_win32_surface - inline bool Create(const VkWin32SurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); - inline bool Create(HINSTANCE instance, HWND handle, VkWin32SurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr); - #endif - - inline void Destroy(); - - bool GetCapabilities(VkPhysicalDevice physicalDevice, VkSurfaceCapabilitiesKHR* surfaceCapabilities); - bool GetFormats(VkPhysicalDevice physicalDevice, std::vector* surfaceFormats); - bool GetPresentModes(VkPhysicalDevice physicalDevice, std::vector* presentModes); - bool GetSupportPresentation(VkPhysicalDevice physicalDevice, UInt32 queueFamilyIndex, bool* supported); - - inline bool IsSupported() const; - - inline VkResult GetLastErrorCode() const; - - Surface& operator=(const Surface&) = delete; - Surface& operator=(Surface&&) = delete; - - inline operator VkSurfaceKHR(); - - private: - inline bool Create(const VkAllocationCallbacks* allocator); - - Instance& m_instance; - VkAllocationCallbacks m_allocator; - VkSurfaceKHR m_surface; - VkResult m_lastErrorCode; - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKSURFACE_HPP diff --git a/include/Nazara/Vulkan/VkSurface.inl b/include/Nazara/Vulkan/VkSurface.inl deleted file mode 100644 index f64c24af0..000000000 --- a/include/Nazara/Vulkan/VkSurface.inl +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - inline Surface::Surface(Instance& instance) : - m_instance(instance), - m_surface(VK_NULL_HANDLE) - { - } - - inline Surface::Surface(Surface&& surface) : - m_instance(surface.m_instance), - m_allocator(surface.m_allocator), - m_surface(surface.m_surface), - m_lastErrorCode(surface.m_lastErrorCode) - { - surface.m_surface = VK_NULL_HANDLE; - } - - inline Surface::~Surface() - { - Destroy(); - } - - #ifdef VK_USE_PLATFORM_ANDROID_KHR - inline bool Surface::Create(const VkAndroidSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = m_instance.vkCreateAndroidSurfaceKHR(m_instance, &createInfo, allocator, &m_surface); - return Create(allocator); - } - - inline bool Surface::Create(ANativeWindow* window, VkAndroidSurfaceCreateFlagsKHR flags, const VkAllocationCallbacks* allocator) - { - VkAndroidSurfaceCreateInfoKHR createInfo = - { - VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR, - nullptr, - flags, - window - }; - - return Create(createInfo, allocator); - } - #endif - - #ifdef VK_USE_PLATFORM_MIR_KHR - inline bool Surface::Create(const VkMirSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = m_instance.vkCreateMirSurfaceKHR(m_instance, &createInfo, allocator, &m_surface); - return Create(allocator); - } - - inline bool Surface::Create(MirConnection* connection, MirSurface* surface, VkMirSurfaceCreateFlagsKHR flags, const VkAllocationCallbacks* allocator) - { - VkMirSurfaceCreateInfoKHR createInfo = - { - VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR, - nullptr, - flags, - connection, - surface - }; - - return Create(createInfo, allocator); - } - #endif - - #ifdef VK_USE_PLATFORM_XCB_KHR - inline bool Surface::Create(const VkXcbSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = m_instance.vkCreateXcbSurfaceKHR(m_instance, &createInfo, allocator, &m_surface); - return Create(allocator); - } - - inline bool Surface::Create(xcb_connection_t* connection, xcb_window_t window, VkXcbSurfaceCreateFlagsKHR flags, const VkAllocationCallbacks* allocator) - { - VkXcbSurfaceCreateInfoKHR createInfo = - { - VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR, - nullptr, - flags, - connection, - window - }; - - return Create(createInfo, allocator); - } - #endif - - #ifdef VK_USE_PLATFORM_XLIB_KHR - inline bool Surface::Create(const VkXlibSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = m_instance.vkCreateXlibSurfaceKHR(m_instance, &createInfo, allocator, &m_surface); - return Create(allocator); - } - - inline bool Surface::Create(Display* display, Window window, VkXlibSurfaceCreateFlagsKHR flags, const VkAllocationCallbacks* allocator) - { - VkXlibSurfaceCreateInfoKHR createInfo = - { - VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR, - nullptr, - flags, - display, - window - }; - - return Create(createInfo, allocator); - } - #endif - - #ifdef VK_USE_PLATFORM_WAYLAND_KHR - inline bool Surface::Create(const VkWaylandSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = m_instance.vkCreateWaylandSurfaceKHR(m_instance, &createInfo, allocator, &m_surface); - return Create(allocator); - } - - inline bool Surface::Create(wl_display* display, wl_surface* surface, VkWaylandSurfaceCreateFlagsKHR flags, const VkAllocationCallbacks* allocator) - { - VkWaylandSurfaceCreateInfoKHR createInfo = - { - VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR, - nullptr, - flags, - display, - surface - }; - - return Create(createInfo, allocator); - } - #endif - - #ifdef VK_USE_PLATFORM_WIN32_KHR - inline bool Surface::Create(const VkWin32SurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = m_instance.vkCreateWin32SurfaceKHR(m_instance, &createInfo, allocator, &m_surface); - return Create(allocator); - } - - inline bool Surface::Create(HINSTANCE instance, HWND handle, VkWin32SurfaceCreateFlagsKHR flags, const VkAllocationCallbacks* allocator) - { - VkWin32SurfaceCreateInfoKHR createInfo = - { - VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR, - nullptr, - flags, - instance, - handle - }; - - return Create(createInfo, allocator); - } - #endif - - inline void Surface::Destroy() - { - if (m_surface != VK_NULL_HANDLE) - m_instance.vkDestroySurfaceKHR(m_instance, m_surface, (m_allocator.pfnAllocation) ? &m_allocator : nullptr); - } - - inline VkResult Surface::GetLastErrorCode() const - { - return m_lastErrorCode; - } - - inline bool Surface::GetCapabilities(VkPhysicalDevice physicalDevice, VkSurfaceCapabilitiesKHR* surfaceCapabilities) - { - m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, m_surface, surfaceCapabilities); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to query surface capabilities"); - return false; - } - - return true; - } - - inline bool Surface::GetFormats(VkPhysicalDevice physicalDevice, std::vector* surfaceFormats) - { - // First, query format count - UInt32 surfaceCount = 0; // Remember, Nz::UInt32 is a typedef on uint32_t - m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &surfaceCount, nullptr); - if (m_lastErrorCode != VkResult::VK_SUCCESS || surfaceCount == 0) - { - NazaraError("Failed to query format count"); - return false; - } - - // Now we can get the list of the available physical device - surfaceFormats->resize(surfaceCount); - m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &surfaceCount, surfaceFormats->data()); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to query formats"); - return false; - } - - return true; - } - - inline bool Surface::GetPresentModes(VkPhysicalDevice physicalDevice, std::vector* presentModes) - { - // First, query present modes count - UInt32 presentModeCount = 0; // Remember, Nz::UInt32 is a typedef on uint32_t - m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, m_surface, &presentModeCount, nullptr); - if (m_lastErrorCode != VkResult::VK_SUCCESS || presentModeCount == 0) - { - NazaraError("Failed to query present mode count"); - return false; - } - - // Now we can get the list of the available physical device - presentModes->resize(presentModeCount); - m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, m_surface, &presentModeCount, presentModes->data()); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to query present modes"); - return false; - } - - return true; - } - - inline bool Surface::GetSupportPresentation(VkPhysicalDevice physicalDevice, UInt32 queueFamilyIndex, bool* supported) - { - VkBool32 presentationSupported = VK_FALSE; - m_lastErrorCode = m_instance.vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, m_surface, &presentationSupported); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to query surface capabilities"); - return false; - } - - *supported = (presentationSupported == VK_TRUE); - - return true; - } - - inline bool Surface::IsSupported() const - { - if (!m_instance.IsExtensionLoaded("VK_KHR_surface")) - return false; - - #ifdef VK_USE_PLATFORM_ANDROID_KHR - if (m_instance.IsExtensionLoaded("VK_KHR_android_surface")) - return true; - #endif - - #ifdef VK_USE_PLATFORM_MIR_KHR - if (m_instance.IsExtensionLoaded("VK_KHR_mir_surface")) - return true; - #endif - - #ifdef VK_USE_PLATFORM_XCB_KHR - if (m_instance.IsExtensionLoaded("VK_KHR_xcb_surface")) - return true; - #endif - - #ifdef VK_USE_PLATFORM_XLIB_KHR - if (m_instance.IsExtensionLoaded("VK_KHR_xlib_surface")) - return true; - #endif - - #ifdef VK_USE_PLATFORM_WAYLAND_KHR - if (m_instance.IsExtensionLoaded("VK_KHR_wayland_surface")) - return true; - #endif - - #ifdef VK_USE_PLATFORM_WIN32_KHR - if (m_instance.IsExtensionLoaded("VK_KHR_win32_surface")) - return true; - #endif - - return false; - } - - inline Surface::operator VkSurfaceKHR() - { - return m_surface; - } - - inline bool Surface::Create(const VkAllocationCallbacks* allocator) - { - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to create Vulkan surface"); - return false; - } - - // Store the allocator to access them when needed - if (allocator) - m_allocator = *allocator; - else - m_allocator.pfnAllocation = nullptr; - - return true; - } - } -} - -#include diff --git a/include/Nazara/Vulkan/VkSwapchain.hpp b/include/Nazara/Vulkan/VkSwapchain.hpp deleted file mode 100644 index 374ad88e6..000000000 --- a/include/Nazara/Vulkan/VkSwapchain.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_VKSWAPCHAIN_HPP -#define NAZARA_VULKAN_VKSWAPCHAIN_HPP - -#include -#include - -namespace Nz -{ - namespace Vk - { - class Swapchain : public DeviceObject - { - friend DeviceObject; - - public: - inline Swapchain(Device& instance); - Swapchain(const Swapchain&) = delete; - Swapchain(Swapchain&&) = default; - ~Swapchain() = default; - - inline bool AcquireNextImage(Nz::UInt64 timeout, VkSemaphore semaphore, VkFence fence, UInt32* imageIndex); - - inline bool Create(const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); - - inline VkImage GetImage(UInt32 index) const; - inline const std::vector& GetImages() const; - inline UInt32 GetImageCount() const; - - inline bool IsSupported() const; - - Swapchain& operator=(const Swapchain&) = delete; - Swapchain& operator=(Swapchain&&) = delete; - - private: - static VkResult CreateHelper(Device& device, const VkSwapchainCreateInfoKHR* createInfo, const VkAllocationCallbacks* allocator, VkSwapchainKHR* handle); - static void DestroyHelper(Device& device, VkSwapchainKHR handle, const VkAllocationCallbacks* allocator); - - std::vector m_images; - }; - } -} - -#include - -#endif // NAZARA_VULKAN_VKSWAPCHAIN_HPP diff --git a/include/Nazara/Vulkan/VkSwapchain.inl b/include/Nazara/Vulkan/VkSwapchain.inl deleted file mode 100644 index 8865012e4..000000000 --- a/include/Nazara/Vulkan/VkSwapchain.inl +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - inline Swapchain::Swapchain(Device& device) : - DeviceObject(device) - { - } - - inline bool Swapchain::AcquireNextImage(Nz::UInt64 timeout, VkSemaphore semaphore, VkFence fence, UInt32* imageIndex) - { - m_lastErrorCode = m_device.vkAcquireNextImageKHR(m_device, m_handle, timeout, semaphore, fence, imageIndex); - switch (m_lastErrorCode) - { - case VkResult::VK_SUBOPTIMAL_KHR: - case VkResult::VK_SUCCESS: - return true; - - default: - return false; - } - } - - inline bool Swapchain::Create(const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) - { - if (!DeviceObject::Create(createInfo, allocator)) - return false; - - UInt32 imageCount = 0; - m_lastErrorCode = m_device.vkGetSwapchainImagesKHR(m_device, m_handle, &imageCount, nullptr); - if (m_lastErrorCode != VkResult::VK_SUCCESS || imageCount == 0) - { - NazaraError("Failed to query swapchain image count"); - return false; - } - - m_images.resize(imageCount); - m_lastErrorCode = m_device.vkGetSwapchainImagesKHR(m_device, m_handle, &imageCount, m_images.data()); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to query swapchain images"); - return false; - } - - return true; - } - - inline VkImage Swapchain::GetImage(UInt32 index) const - { - return m_images[index]; - } - - inline const std::vector& Swapchain::GetImages() const - { - return m_images; - } - - inline UInt32 Swapchain::GetImageCount() const - { - return m_images.size(); - } - - inline bool Swapchain::IsSupported() const - { - if (!m_device.IsExtensionLoaded("VK_KHR_swapchain")) - return false; - } - - VkResult Swapchain::CreateHelper(Device& device, const VkSwapchainCreateInfoKHR* createInfo, const VkAllocationCallbacks* allocator, VkSwapchainKHR* handle) - { - return device.vkCreateSwapchainKHR(device, createInfo, allocator, handle); - } - - void Swapchain::DestroyHelper(Device& device, VkSwapchainKHR handle, const VkAllocationCallbacks* allocator) - { - return device.vkDestroySwapchainKHR(device, handle, allocator); - } - } -} - -#include diff --git a/include/Nazara/Vulkan/Vulkan.hpp b/include/Nazara/Vulkan/Vulkan.hpp deleted file mode 100644 index 9d90202c2..000000000 --- a/include/Nazara/Vulkan/Vulkan.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#pragma once - -#ifndef NAZARA_VULKAN_HPP -#define NAZARA_VULKAN_HPP - -#include -#include -#include - -namespace Nz -{ - class NAZARA_VULKAN_API Vulkan - { - public: - Vulkan() = delete; - ~Vulkan() = delete; - - static bool Initialize(); - - static bool IsInitialized(); - - static void Uninitialize(); - - private: - static unsigned int s_moduleReferenceCounter; - }; -} - -#endif // NAZARA_VULKAN_HPP diff --git a/src/Nazara/Vulkan/Debug/NewOverload.cpp b/src/Nazara/Vulkan/Debug/NewOverload.cpp deleted file mode 100644 index 410a53c76..000000000 --- a/src/Nazara/Vulkan/Debug/NewOverload.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2014 AUTHORS -// This file is part of the "Nazara Engine - Module name" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#if NAZARA_VULKAN_MANAGE_MEMORY - -#include -#include // Nécessaire ? - -void* operator new(std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, false); -} - -void* operator new[](std::size_t size) -{ - return Nz::MemoryManager::Allocate(size, true); -} - -void operator delete(void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, false); -} - -void operator delete[](void* pointer) noexcept -{ - Nz::MemoryManager::Free(pointer, true); -} - -#endif // NAZARA_VULKAN_MANAGE_MEMORY diff --git a/src/Nazara/Vulkan/VkCommandPool.cpp b/src/Nazara/Vulkan/VkCommandPool.cpp deleted file mode 100644 index 3ee53ab6f..000000000 --- a/src/Nazara/Vulkan/VkCommandPool.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - CommandBuffer CommandPool::AllocateCommandBuffer(VkCommandBufferLevel level) - { - VkCommandBufferAllocateInfo createInfo = - { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, - nullptr, - m_handle, - level, - 1U - }; - - VkCommandBuffer handle = VK_NULL_HANDLE; - m_lastErrorCode = m_device.vkAllocateCommandBuffers(m_device, &createInfo, &handle); - - return CommandBuffer(*this, handle); - } - - std::vector CommandPool::AllocateCommandBuffers(UInt32 commandBufferCount, VkCommandBufferLevel level) - { - VkCommandBufferAllocateInfo createInfo = - { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, - nullptr, - m_handle, - level, - 1U - }; - - std::vector handles(commandBufferCount, VK_NULL_HANDLE); - m_lastErrorCode = m_device.vkAllocateCommandBuffers(m_device, &createInfo, handles.data()); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - return std::vector(); - - std::vector commandBuffers; - for (UInt32 i = 0; i < commandBufferCount; ++i) - commandBuffers.emplace_back(CommandBuffer(*this, handles[i])); - - return commandBuffers; - } - } -} diff --git a/src/Nazara/Vulkan/VkDevice.cpp b/src/Nazara/Vulkan/VkDevice.cpp deleted file mode 100644 index c2f39da76..000000000 --- a/src/Nazara/Vulkan/VkDevice.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - bool Device::Create(VkPhysicalDevice device, const VkDeviceCreateInfo& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = m_instance.vkCreateDevice(device, &createInfo, allocator, &m_device); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to create Vulkan device"); - return false; - } - - // Store the allocator to access them when needed - if (allocator) - m_allocator = *allocator; - else - m_allocator.pfnAllocation = nullptr; - - // Parse extensions and layers - for (UInt32 i = 0; i < createInfo.enabledExtensionCount; ++i) - m_loadedExtensions.insert(createInfo.ppEnabledExtensionNames[i]); - - for (UInt32 i = 0; i < createInfo.enabledLayerCount; ++i) - m_loadedLayers.insert(createInfo.ppEnabledLayerNames[i]); - - #define NAZARA_VULKAN_LOAD_DEVICE(func) func = reinterpret_cast(GetProcAddr(#func)) - - try - { - ErrorFlags flags(ErrorFlag_ThrowException, true); - - NAZARA_VULKAN_LOAD_DEVICE(vkAllocateCommandBuffers); - NAZARA_VULKAN_LOAD_DEVICE(vkAllocateMemory); - NAZARA_VULKAN_LOAD_DEVICE(vkBeginCommandBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkBindBufferMemory); - NAZARA_VULKAN_LOAD_DEVICE(vkBindImageMemory); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdBeginQuery); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdBeginRenderPass); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdBindDescriptorSets); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdBindIndexBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdBindPipeline); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdBindVertexBuffers); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdBlitImage); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdClearAttachments); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdClearColorImage); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdClearDepthStencilImage); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdCopyBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdCopyBufferToImage); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdCopyImage); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdCopyImageToBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdCopyQueryPoolResults); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdDispatch); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdDispatchIndirect); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdDraw); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdDrawIndexed); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdDrawIndexedIndirect); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdDrawIndirect); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdEndQuery); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdEndRenderPass); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdExecuteCommands); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdFillBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdNextSubpass); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdPipelineBarrier); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdPushConstants); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdResetEvent); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdResetQueryPool); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdResolveImage); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetBlendConstants); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetDepthBias); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetDepthBounds); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetEvent); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetLineWidth); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetScissor); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetStencilCompareMask); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetStencilReference); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetStencilWriteMask); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdSetViewport); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdUpdateBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdWaitEvents); - NAZARA_VULKAN_LOAD_DEVICE(vkCmdWriteTimestamp); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateBufferView); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateCommandPool); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateComputePipelines); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateDescriptorPool); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateDescriptorSetLayout); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateEvent); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateFramebuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateGraphicsPipelines); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateImage); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateImageView); - NAZARA_VULKAN_LOAD_DEVICE(vkCreatePipelineLayout); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateRenderPass); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateSampler); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateSemaphore); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateShaderModule); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyBufferView); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyCommandPool); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyDescriptorPool); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyDescriptorSetLayout); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyDevice); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyEvent); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyFramebuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyImage); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyImageView); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyPipeline); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyPipelineLayout); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyRenderPass); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroySampler); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroySemaphore); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroyShaderModule); - NAZARA_VULKAN_LOAD_DEVICE(vkDeviceWaitIdle); - NAZARA_VULKAN_LOAD_DEVICE(vkEndCommandBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkFreeCommandBuffers); - NAZARA_VULKAN_LOAD_DEVICE(vkFreeDescriptorSets); - NAZARA_VULKAN_LOAD_DEVICE(vkFreeMemory); - NAZARA_VULKAN_LOAD_DEVICE(vkFlushMappedMemoryRanges); - NAZARA_VULKAN_LOAD_DEVICE(vkGetBufferMemoryRequirements); - NAZARA_VULKAN_LOAD_DEVICE(vkGetDeviceMemoryCommitment); - NAZARA_VULKAN_LOAD_DEVICE(vkGetDeviceQueue); - NAZARA_VULKAN_LOAD_DEVICE(vkGetEventStatus); - NAZARA_VULKAN_LOAD_DEVICE(vkGetFenceStatus); - NAZARA_VULKAN_LOAD_DEVICE(vkGetImageMemoryRequirements); - NAZARA_VULKAN_LOAD_DEVICE(vkGetImageSparseMemoryRequirements); - NAZARA_VULKAN_LOAD_DEVICE(vkGetImageSubresourceLayout); - NAZARA_VULKAN_LOAD_DEVICE(vkGetRenderAreaGranularity); - NAZARA_VULKAN_LOAD_DEVICE(vkInvalidateMappedMemoryRanges); - NAZARA_VULKAN_LOAD_DEVICE(vkMapMemory); - NAZARA_VULKAN_LOAD_DEVICE(vkMergePipelineCaches); - NAZARA_VULKAN_LOAD_DEVICE(vkQueueSubmit); - NAZARA_VULKAN_LOAD_DEVICE(vkQueueWaitIdle); - NAZARA_VULKAN_LOAD_DEVICE(vkResetCommandBuffer); - NAZARA_VULKAN_LOAD_DEVICE(vkResetCommandPool); - NAZARA_VULKAN_LOAD_DEVICE(vkResetDescriptorPool); - NAZARA_VULKAN_LOAD_DEVICE(vkResetFences); - NAZARA_VULKAN_LOAD_DEVICE(vkResetEvent); - NAZARA_VULKAN_LOAD_DEVICE(vkSetEvent); - NAZARA_VULKAN_LOAD_DEVICE(vkUnmapMemory); - NAZARA_VULKAN_LOAD_DEVICE(vkUpdateDescriptorSets); - NAZARA_VULKAN_LOAD_DEVICE(vkWaitForFences); - - // VK_KHR_display_swapchain - if (IsExtensionLoaded("VK_KHR_display_swapchain")) - NAZARA_VULKAN_LOAD_DEVICE(vkCreateSharedSwapchainsKHR); - - // VK_KHR_swapchain - if (IsExtensionLoaded("VK_KHR_swapchain")) - { - NAZARA_VULKAN_LOAD_DEVICE(vkAcquireNextImageKHR); - NAZARA_VULKAN_LOAD_DEVICE(vkCreateSwapchainKHR); - NAZARA_VULKAN_LOAD_DEVICE(vkDestroySwapchainKHR); - NAZARA_VULKAN_LOAD_DEVICE(vkGetSwapchainImagesKHR); - NAZARA_VULKAN_LOAD_DEVICE(vkQueuePresentKHR); - } - } - catch (const std::exception& e) - { - NazaraError(String("Failed to query device function: ") + e.what()); - return false; - } - - #undef NAZARA_VULKAN_LOAD_DEVICE - - return true; - } - } -} diff --git a/src/Nazara/Vulkan/VkInstance.cpp b/src/Nazara/Vulkan/VkInstance.cpp deleted file mode 100644 index 35378a699..000000000 --- a/src/Nazara/Vulkan/VkInstance.cpp +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include - -namespace Nz -{ - namespace Vk - { - bool Instance::Create(const VkInstanceCreateInfo& createInfo, const VkAllocationCallbacks* allocator) - { - m_lastErrorCode = Loader::vkCreateInstance(&createInfo, allocator, &m_instance); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to create Vulkan instance"); - return false; - } - - // Store the allocator to access them when needed - if (allocator) - m_allocator = *allocator; - else - m_allocator.pfnAllocation = nullptr; - - // Parse extensions and layers - for (UInt32 i = 0; i < createInfo.enabledExtensionCount; ++i) - m_loadedExtensions.insert(createInfo.ppEnabledExtensionNames[i]); - - for (UInt32 i = 0; i < createInfo.enabledLayerCount; ++i) - m_loadedLayers.insert(createInfo.ppEnabledLayerNames[i]); - - // And now load everything - #define NAZARA_VULKAN_LOAD_INSTANCE(func) func = reinterpret_cast(GetProcAddr(#func)) - - try - { - ErrorFlags flags(ErrorFlag_ThrowException, true); - - // Vulkan core - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateDevice); - NAZARA_VULKAN_LOAD_INSTANCE(vkDestroyInstance); - NAZARA_VULKAN_LOAD_INSTANCE(vkEnumeratePhysicalDevices); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetDeviceProcAddr); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceFeatures); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceFormatProperties); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceImageFormatProperties); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceMemoryProperties); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceProperties); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceQueueFamilyProperties); - - // VK_KHR_display - if (IsExtensionLoaded("VK_KHR_display")) - { - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateDisplayModeKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateDisplayPlaneSurfaceKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetDisplayModePropertiesKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetDisplayPlaneCapabilitiesKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetDisplayPlaneSupportedDisplaysKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceDisplayPlanePropertiesKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceDisplayPropertiesKHR); - } - - // VK_KHR_surface - if (IsExtensionLoaded("VK_KHR_surface")) - { - NAZARA_VULKAN_LOAD_INSTANCE(vkDestroySurfaceKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceSurfaceCapabilitiesKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceSurfaceFormatsKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceSurfacePresentModesKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceSurfaceSupportKHR); - } - - // VK_EXT_debug_report - if (IsExtensionLoaded("VK_EXT_debug_report")) - { - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateDebugReportCallbackEXT); - NAZARA_VULKAN_LOAD_INSTANCE(vkDestroyDebugReportCallbackEXT); - NAZARA_VULKAN_LOAD_INSTANCE(vkDebugReportMessageEXT); - } - - #ifdef VK_USE_PLATFORM_ANDROID_KHR - // VK_KHR_android_surface - if (IsExtensionLoaded("VK_KHR_android_surface")) - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateAndroidSurfaceKHR); - #endif - - #ifdef VK_USE_PLATFORM_MIR_KHR - // VK_KHR_mir_surface - if (IsExtensionLoaded("VK_KHR_mir_surface")) - { - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateMirSurfaceKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceMirPresentationSupportKHR); - } - #endif - - #ifdef VK_USE_PLATFORM_XCB_KHR - // VK_KHR_xcb_surface - if (IsExtensionLoaded("VK_KHR_xcb_surface")) - { - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateXcbSurfaceKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceXcbPresentationSupportKHR); - } - #endif - - #ifdef VK_USE_PLATFORM_XLIB_KHR - // VK_KHR_xlib_surface - if (IsExtensionLoaded("VK_KHR_xlib_surface")) - { - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateXlibSurfaceKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceXlibPresentationSupportKHR); - } - #endif - - #ifdef VK_USE_PLATFORM_WAYLAND_KHR - // VK_KHR_wayland_surface - if (IsExtensionLoaded("VK_KHR_wayland_surface")) - { - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateWaylandSurfaceKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceWaylandPresentationSupportKHR); - } - #endif - - #ifdef VK_USE_PLATFORM_WIN32_KHR - // VK_KHR_win32_surface - if (IsExtensionLoaded("VK_KHR_win32_surface")) - { - NAZARA_VULKAN_LOAD_INSTANCE(vkCreateWin32SurfaceKHR); - NAZARA_VULKAN_LOAD_INSTANCE(vkGetPhysicalDeviceWin32PresentationSupportKHR); - } - #endif - } - catch (const std::exception& e) - { - NazaraError(String("Failed to query instance function: ") + e.what()); - return false; - } - - #undef NAZARA_VULKAN_LOAD_INSTANCE - - return true; - } - - bool Instance::EnumeratePhysicalDevices(std::vector* devices) - { - NazaraAssert(devices, "Invalid device vector"); - - // First, query physical device count - UInt32 deviceCount = 0; // Remember, Nz::UInt32 is a typedef on uint32_t - m_lastErrorCode = vkEnumeratePhysicalDevices(m_instance, &deviceCount, nullptr); - if (m_lastErrorCode != VkResult::VK_SUCCESS || deviceCount == 0) - { - NazaraError("Failed to query physical device count"); - return false; - } - - // Now we can get the list of the available physical device - devices->resize(deviceCount); - m_lastErrorCode = vkEnumeratePhysicalDevices(m_instance, &deviceCount, devices->data()); - if (m_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to query physical devices"); - return false; - } - - return true; - } - - bool Instance::GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice device, std::vector* queueFamilyProperties) - { - NazaraAssert(queueFamilyProperties, "Invalid device vector"); - - // First, query physical device count - UInt32 queueFamiliesCount = 0; // Remember, Nz::UInt32 is a typedef on uint32_t - vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamiliesCount, nullptr); - if (queueFamiliesCount == 0) - { - NazaraError("Failed to query physical device count"); - return false; - } - - // Now we can get the list of the available physical device - queueFamilyProperties->resize(queueFamiliesCount); - vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamiliesCount, queueFamilyProperties->data()); - - return true; - } - - } -} diff --git a/src/Nazara/Vulkan/VkLoader.cpp b/src/Nazara/Vulkan/VkLoader.cpp deleted file mode 100644 index c9d2a360d..000000000 --- a/src/Nazara/Vulkan/VkLoader.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include - -namespace Nz -{ - namespace Vk - { - bool Loader::EnumerateInstanceExtensionProperties(std::vector* properties, const char* layerName) - { - NazaraAssert(properties, "Invalid device vector"); - - // First, query physical device count - UInt32 propertyCount = 0; // Remember, Nz::UInt32 is a typedef on uint32_t - s_lastErrorCode = vkEnumerateInstanceExtensionProperties(layerName, &propertyCount, properties->data()); - if (s_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to get instance extension properties count"); - return false; - } - - // Now we can get the list of the available physical device - properties->resize(propertyCount); - s_lastErrorCode = vkEnumerateInstanceExtensionProperties(layerName, &propertyCount, properties->data()); - if (s_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to enumerate instance extension properties"); - return false; - } - - return true; - } - - bool Loader::EnumerateInstanceLayerProperties(std::vector* properties) - { - NazaraAssert(properties, "Invalid device vector"); - - // First, query physical device count - UInt32 propertyCount = 0; // Remember, Nz::UInt32 is a typedef on uint32_t - s_lastErrorCode = vkEnumerateInstanceLayerProperties(&propertyCount, properties->data()); - if (s_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to get instance layer properties count"); - return false; - } - - // Now we can get the list of the available physical device - properties->resize(propertyCount); - s_lastErrorCode = vkEnumerateInstanceLayerProperties(&propertyCount, properties->data()); - if (s_lastErrorCode != VkResult::VK_SUCCESS) - { - NazaraError("Failed to enumerate instance layer properties"); - return false; - } - - return true; - } - - bool Loader::Initialize() - { - #ifdef NAZARA_PLATFORM_WINDOWS - s_vulkanLib.Load("vulkan-1.dll"); - #elif defined(NAZARA_PLATFORM_LINUX) - s_vulkanLib.Load("libvulkan.so"); - #else - #error Unhandled platform - #endif - - if (!s_vulkanLib.IsLoaded()) - { - NazaraError("Failed to open vulkan library: " + s_vulkanLib.GetLastError()); - return false; - } - - // vkGetInstanceProcAddr is the only function that's garantee to be exported - vkGetInstanceProcAddr = reinterpret_cast(s_vulkanLib.GetSymbol("vkGetInstanceProcAddr")); - if (!vkGetInstanceProcAddr) - { - NazaraError("Failed to get symbol \"vkGetInstanceProcAddr\": " + s_vulkanLib.GetLastError()); - return false; - } - - // all other functions should be loaded using vkGetInstanceProcAddr - #define NAZARA_VULKAN_LOAD_GLOBAL(func) func = reinterpret_cast(vkGetInstanceProcAddr(nullptr, #func)) - - NAZARA_VULKAN_LOAD_GLOBAL(vkCreateInstance); - NAZARA_VULKAN_LOAD_GLOBAL(vkEnumerateInstanceExtensionProperties); - NAZARA_VULKAN_LOAD_GLOBAL(vkEnumerateInstanceLayerProperties); - - #undef NAZARA_VULKAN_LOAD_GLOBAL - - s_lastErrorCode = VkResult::VK_SUCCESS; - - return true; - } - - #define NAZARA_VULKAN_GLOBAL_FUNCTION_IMPL(func) PFN_##func Loader::func = nullptr - - NAZARA_VULKAN_GLOBAL_FUNCTION_IMPL(vkCreateInstance); - NAZARA_VULKAN_GLOBAL_FUNCTION_IMPL(vkEnumerateInstanceExtensionProperties); - NAZARA_VULKAN_GLOBAL_FUNCTION_IMPL(vkEnumerateInstanceLayerProperties); - NAZARA_VULKAN_GLOBAL_FUNCTION_IMPL(vkGetInstanceProcAddr); - - #undef NAZARA_VULKAN_GLOBAL_FUNCTION_IMPL - - DynLib Loader::s_vulkanLib; - VkResult Loader::s_lastErrorCode; - - void Loader::Uninitialize() - { - s_vulkanLib.Unload(); - } - } -} diff --git a/src/Nazara/Vulkan/Vulkan.cpp b/src/Nazara/Vulkan/Vulkan.cpp deleted file mode 100644 index 00bb55337..000000000 --- a/src/Nazara/Vulkan/Vulkan.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2016 Jérôme Leclercq -// This file is part of the "Nazara Engine - Vulkan" -// For conditions of distribution and use, see copyright notice in Config.hpp - -#include -#include -#include -#include -#include -#include -#include - -namespace Nz -{ - bool Vulkan::Initialize() - { - if (s_moduleReferenceCounter > 0) - { - s_moduleReferenceCounter++; - return true; // Already initialized - } - - // Initialize module dependencies - if (!Utility::Initialize()) - { - NazaraError("Failed to initialize utility module"); - return false; - } - - s_moduleReferenceCounter++; - - CallOnExit onExit(Vulkan::Uninitialize); - - // Initialize module here - - onExit.Reset(); - - NazaraNotice("Initialized: Vulkan module"); - return true; - } - - bool Vulkan::IsInitialized() - { - return s_moduleReferenceCounter != 0; - } - - void Vulkan::Uninitialize() - { - if (s_moduleReferenceCounter != 1) - { - // Either the module is not initialized, either it was initialized multiple times - if (s_moduleReferenceCounter > 1) - s_moduleReferenceCounter--; - - return; - } - - s_moduleReferenceCounter = 0; - - // Uninitialize module here - - NazaraNotice("Uninitialized: Vulkan module"); - - // Free module dependencies - Utility::Uninitialize(); - } - - unsigned int Vulkan::s_moduleReferenceCounter = 0; -} - From e46267d8aea955e86c24aa73888de1ace4099d45 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 17 Aug 2016 13:05:41 +0200 Subject: [PATCH 30/74] Build/Assimp: Fix assimp rejection Former-commit-id: 46fc5f3b3fd749e86afe6298cb5337ae90f02784 [formerly c271946a1cbb2924f8d79a9d7c3691c7b23c69e8] [formerly 356ec1662b9e3186da7ac6720b7affec617357e4 [formerly 159894148bb93cadef56126939147c24ff340152]] Former-commit-id: d2e03b0875bb5a7a57817d68fe8b559fd5ba1ad5 [formerly 6ff57bf039f291f64a35cd2c0987b989adea851f] Former-commit-id: 6673c2d846855701a289a74e01bb2b2fc61bfb25 --- build/scripts/common.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/scripts/common.lua b/build/scripts/common.lua index 498b64ee0..b8ca27e70 100644 --- a/build/scripts/common.lua +++ b/build/scripts/common.lua @@ -576,10 +576,10 @@ function NazaraBuild:Initialize() local succeed, err = self:RegisterTool(TOOL) if (not succeed) then - print("Unable to register tool: " .. err) + print("Unable to register tool " .. tostring(TOOL.Name) .. ": " .. err) end else - print("Unable to load tool file: " .. err) + print("Unable to load tool file " .. v .. ": " .. err) end end TOOL = nil @@ -990,10 +990,6 @@ function NazaraBuild:RegisterTool(toolTable) return false, "This tool name is already in use" end - if (toolTable.TargetDirectory == nil or type(toolTable.TargetDirectory) ~= "string" or string.len(toolTable.TargetDirectory) == 0) then - return false, "Invalid tool directory" - end - if (toolTable.Kind == nil or type(toolTable.Kind) ~= "string" or string.len(toolTable.Kind) == 0) then return false, "Invalid tool type" end @@ -1005,6 +1001,10 @@ function NazaraBuild:RegisterTool(toolTable) return false, "Invalid tool type" end + if (lowerCaseKind ~= "plugin" and (toolTable.TargetDirectory == nil or type(toolTable.TargetDirectory) ~= "string" or string.len(toolTable.TargetDirectory) == 0)) then + return false, "Invalid tool directory" + end + toolTable.Type = "Tool" self.Tools[lowerCaseName] = toolTable return true From db21a3204ab5c244acf2fd267c2d72ad1b026a96 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 17 Aug 2016 13:11:52 +0200 Subject: [PATCH 31/74] Build: Fix an oopsie Former-commit-id: f04f167cb8d4b6596a0eb7f4fcfd14dbd2718f34 [formerly 57cc1fe61467e48037e9c2209669ec1694d2c2f9] [formerly 26ef47fa7468348453d13d94cb2f2d060e8ecd66 [formerly d5105954a02632b79fc84f1380a9199bd9b1a2e3]] Former-commit-id: 02d8f0217a15a1d47157b752300a5446b12162e1 [formerly 4f595e0b7a16ec460f1f72013a6976d1aadd74f9] Former-commit-id: f9e5c292baa89929463ca23699d5fa73aa814a34 --- build/scripts/common.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/scripts/common.lua b/build/scripts/common.lua index b8ca27e70..b20d213fa 100644 --- a/build/scripts/common.lua +++ b/build/scripts/common.lua @@ -278,6 +278,7 @@ function NazaraBuild:Execute() self:MakeInstallCommands(toolTable) elseif (toolTable.Kind == "application") then debugdir(toolTable.TargetDirectory) + targetdir(toolTable.TargetDirectory) if (toolTable.EnableConsole) then kind("ConsoleApp") else @@ -295,8 +296,6 @@ function NazaraBuild:Execute() libdirs("../lib") libdirs("../extlibs/lib/common") - targetdir(toolTable.TargetDirectory) - configuration("x32") libdirs(toolTable.LibraryPaths.x86) @@ -306,7 +305,7 @@ function NazaraBuild:Execute() configuration({"codeblocks or codelite or gmake", "x32"}) libdirs("../extlibs/lib/" .. makeLibDir .. "/x86") - libdirs(toolTable.TargetDirectory .. "/" .. makeLibDir .. "/x86") + libdirs("../lib/" .. makeLibDir .. "/x86") if (toolTable.Kind == "library") then targetdir(toolTable.TargetDirectory .. "/" .. makeLibDir .. "/x86") elseif (toolTable.Kind == "plugin") then @@ -315,6 +314,7 @@ function NazaraBuild:Execute() configuration({"codeblocks or codelite or gmake", "x64"}) libdirs("../extlibs/lib/" .. makeLibDir .. "/x64") + libdirs("../lib/" .. makeLibDir .. "/x86") if (toolTable.Kind == "library") then targetdir(toolTable.TargetDirectory .. "/" .. makeLibDir .. "/x64") elseif (toolTable.Kind == "plugin") then From f93eb6f5d1386ed1c4cecf76bf0c7a40f8fe4430 Mon Sep 17 00:00:00 2001 From: Lynix Date: Fri, 19 Aug 2016 01:49:36 +0200 Subject: [PATCH 32/74] Fixed linking of tools on GCC 64bits Former-commit-id: 3e11e8f2d7ac0c6856a618b30778432b2abb845c [formerly 84b2e7fdea81101189a15488adf8a299f2c94146] [formerly 25857bd3c5ee2df838145658a59396659269069f [formerly 4398fdf08d380ab6d2973323b14347e4ef88bdba]] Former-commit-id: 89f4498e34648bf5637b0a3a6556256c328ca0fd [formerly 92e91db53ccf7e0f1bdac31540772140f18adb4b] Former-commit-id: fe2780f5d39f288d778b59b315afbf1f3b629cd3 --- build/scripts/common.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/scripts/common.lua b/build/scripts/common.lua index b20d213fa..cf6fa6560 100644 --- a/build/scripts/common.lua +++ b/build/scripts/common.lua @@ -314,7 +314,7 @@ function NazaraBuild:Execute() configuration({"codeblocks or codelite or gmake", "x64"}) libdirs("../extlibs/lib/" .. makeLibDir .. "/x64") - libdirs("../lib/" .. makeLibDir .. "/x86") + libdirs("../lib/" .. makeLibDir .. "/x64") if (toolTable.Kind == "library") then targetdir(toolTable.TargetDirectory .. "/" .. makeLibDir .. "/x64") elseif (toolTable.Kind == "plugin") then @@ -1084,4 +1084,4 @@ function NazaraBuild:SetupModuleTable(infoTable) table.insert(infoTable.LibraryPaths.x64, "../extlibs/lib/common/x64") end -NazaraBuild.SetupToolTable = NazaraBuild.SetupInfoTable \ No newline at end of file +NazaraBuild.SetupToolTable = NazaraBuild.SetupInfoTable From 1018daa1e5ae5b12c295fb6ca82334888232660d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Sat, 20 Aug 2016 17:12:20 +0200 Subject: [PATCH 33/74] Example/HardwareInfo: Fix generated file Former-commit-id: 630e7c09a608ae3442d7f75ca7957938db505cb5 [formerly 886fb7052439151c752641117daa78a8d2f8d2ef] [formerly 2ad36b2270b027ecb31330a021229d60aad6e94e [formerly c641ef9008276b7891b2509cc78281c52f22a1e3]] Former-commit-id: 7f3ec7800d291c3ac45ed2ed69b51b96564ada4f [formerly 3df9d6ce614593a2b3dfaa28dc88ef50a432def5] Former-commit-id: e4fff6791544525cbeb0e9b2de43c8845475fad6 --- .gitignore | 3 +++ examples/HardwareInfo/main.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 463291bc4..6266c2b6b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ tests/*.dll tests/*.so lib/* +# Example generated files +examples/bin/HardwareInfo.txt + # Feature page build/scripts/features/index.html diff --git a/examples/HardwareInfo/main.cpp b/examples/HardwareInfo/main.cpp index 401224315..820f42a62 100644 --- a/examples/HardwareInfo/main.cpp +++ b/examples/HardwareInfo/main.cpp @@ -94,7 +94,7 @@ int main() std::cout << oss.str() << std::endl; - Nz::File reportFile("RapportNz::HardwareInfo.txt"); + Nz::File reportFile("HardwareInfo.txt"); if (reportFile.Open(Nz::OpenMode_Text | Nz::OpenMode_Truncate | Nz::OpenMode_WriteOnly)) { reportFile.Write(oss.str()); // Conversion implicite en Nz::String From 1e5071767fc4ee20c995a68df5c9e539b45443e4 Mon Sep 17 00:00:00 2001 From: Gawaboumga Date: Sun, 21 Aug 2016 13:47:43 +0200 Subject: [PATCH 34/74] Fix memory leak Former-commit-id: 3d67e7af059379e90dc668a4c3a0cb8874d78e2b [formerly 984bb7e66db42e532388baa17ad52d76bd5d0eb0] [formerly 39d68118d7a374f0e340d1418b0ac0658812dac5 [formerly 9fbc9f8e87056cb54fdf156ce803bacbd35e61a7]] Former-commit-id: bcd15b913e75bbfb848a275f1e9b876086984588 [formerly c2c2a81447c7988c5c4bb47889843fbcfae79de3] Former-commit-id: 5c1519b2f7bc347f9935f8329c60b311f9020f7e --- include/Nazara/Graphics/MaterialPipeline.inl | 1 + 1 file changed, 1 insertion(+) diff --git a/include/Nazara/Graphics/MaterialPipeline.inl b/include/Nazara/Graphics/MaterialPipeline.inl index ce937883d..0cbea4e61 100644 --- a/include/Nazara/Graphics/MaterialPipeline.inl +++ b/include/Nazara/Graphics/MaterialPipeline.inl @@ -97,6 +97,7 @@ namespace Nz MaterialPipelineRef MaterialPipeline::New(Args&&... args) { std::unique_ptr object(new MaterialPipeline(std::forward(args)...)); + object->SetPersistent(false); return object.release(); } } From 95689f46fbf7c2b7ed1db8ef51d4f3b5076284be Mon Sep 17 00:00:00 2001 From: Gawaboumga Date: Sun, 21 Aug 2016 13:48:52 +0200 Subject: [PATCH 36/74] Documentation for module 'NDK' Former-commit-id: a6c2075cfbfd0eccf2b77def71c0d42684bed590 [formerly 36ece2bc6a148bde6cacf45084821d20edcd115e] [formerly 4a6988792ec026e65be6850c46dfe8ddda92a885 [formerly fd3f4f975de5c427f3adc98b220446fd255be396]] Former-commit-id: c87fdc9483202842267c60eff3d619f0df2963bf [formerly ee35202f1b2df7ca20da5b6d8b13147f2b92c933] Former-commit-id: dad5de1b00bb4413f7aa191ca06b7d43b659f32a --- SDK/include/NDK/Algorithm.inl | 50 +- SDK/include/NDK/Application.inl | 48 +- SDK/include/NDK/BaseComponent.hpp | 2 +- SDK/include/NDK/BaseComponent.inl | 47 +- SDK/include/NDK/BaseSystem.hpp | 2 +- SDK/include/NDK/BaseSystem.inl | 153 +++++- SDK/include/NDK/Component.hpp | 2 +- SDK/include/NDK/Component.inl | 35 +- .../NDK/Components/CameraComponent.inl | 174 ++++++- .../NDK/Components/CollisionComponent.inl | 29 ++ .../NDK/Components/GraphicsComponent.inl | 67 +++ SDK/include/NDK/Components/LightComponent.inl | 4 + .../NDK/Components/ListenerComponent.inl | 15 + SDK/include/NDK/Components/NodeComponent.inl | 9 + .../Components/ParticleEmitterComponent.inl | 21 + .../NDK/Components/ParticleGroupComponent.inl | 39 ++ .../NDK/Components/PhysicsComponent.inl | 187 +++++++- .../NDK/Components/VelocityComponent.inl | 19 + SDK/include/NDK/Console.inl | 40 ++ SDK/include/NDK/Entity.inl | 173 ++++++- SDK/include/NDK/EntityList.inl | 42 +- SDK/include/NDK/EntityOwner.inl | 36 ++ SDK/include/NDK/LuaAPI.inl | 443 +++++++++++++++++- SDK/include/NDK/LuaBinding.inl | 28 ++ SDK/include/NDK/Prerequesites.hpp | 6 +- SDK/include/NDK/Sdk.inl | 5 + SDK/include/NDK/StateMachine.inl | 38 ++ SDK/include/NDK/System.hpp | 4 +- SDK/include/NDK/System.inl | 29 +- SDK/include/NDK/Systems/PhysicsSystem.inl | 10 + SDK/include/NDK/Systems/RenderSystem.inl | 77 +++ SDK/include/NDK/World.hpp | 1 - SDK/include/NDK/World.inl | 136 +++++- SDK/src/NDK/Application.cpp | 10 + SDK/src/NDK/BaseComponent.cpp | 28 ++ SDK/src/NDK/BaseSystem.cpp | 44 +- SDK/src/NDK/Components/CameraComponent.cpp | 88 ++++ SDK/src/NDK/Components/CollisionComponent.cpp | 43 +- SDK/src/NDK/Components/GraphicsComponent.cpp | 54 ++- .../Components/ParticleEmitterComponent.cpp | 13 + SDK/src/NDK/Components/PhysicsComponent.cpp | 32 ++ SDK/src/NDK/Console.cpp | 88 ++++ SDK/src/NDK/Entity.cpp | 80 +++- SDK/src/NDK/LuaAPI.cpp | 21 + SDK/src/NDK/LuaBinding.cpp | 16 + SDK/src/NDK/LuaBinding_Audio.cpp | 10 + SDK/src/NDK/LuaBinding_Core.cpp | 10 + SDK/src/NDK/LuaBinding_Graphics.cpp | 10 + SDK/src/NDK/LuaBinding_Math.cpp | 10 + SDK/src/NDK/LuaBinding_Network.cpp | 10 + SDK/src/NDK/LuaBinding_Renderer.cpp | 10 + SDK/src/NDK/LuaBinding_SDK.cpp | 18 + SDK/src/NDK/LuaBinding_Utility.cpp | 10 + SDK/src/NDK/Sdk.cpp | 19 + SDK/src/NDK/State.cpp | 6 + SDK/src/NDK/Systems/ListenerSystem.cpp | 26 +- SDK/src/NDK/Systems/ParticleSystem.cpp | 18 + SDK/src/NDK/Systems/PhysicsSystem.cpp | 40 +- SDK/src/NDK/Systems/RenderSystem.cpp | 44 ++ SDK/src/NDK/Systems/VelocitySystem.cpp | 19 + SDK/src/NDK/World.cpp | 95 +++- build/scripts/tools/unittests.lua | 13 +- tests/SDK/NDK/Application.cpp | 22 + tests/SDK/NDK/BaseSystem.cpp | 64 +++ tests/SDK/NDK/Component.cpp | 31 ++ tests/SDK/NDK/Entity.cpp | 101 ++++ tests/SDK/NDK/EntityList.cpp | 41 ++ tests/SDK/NDK/EntityOwner.cpp | 29 ++ tests/SDK/NDK/StateMachine.cpp | 48 ++ tests/SDK/NDK/System.cpp | 42 ++ tests/SDK/NDK/Systems/ListenerSystem.cpp | 43 ++ tests/SDK/NDK/Systems/PhysicsSystem.cpp | 34 ++ tests/SDK/NDK/Systems/RenderSystem.cpp | 44 ++ tests/SDK/NDK/Systems/VelocitySystem.cpp | 28 ++ tests/SDK/NDK/World.cpp | 103 ++++ 75 files changed, 3374 insertions(+), 112 deletions(-) create mode 100644 tests/SDK/NDK/Application.cpp create mode 100644 tests/SDK/NDK/BaseSystem.cpp create mode 100644 tests/SDK/NDK/Component.cpp create mode 100644 tests/SDK/NDK/Entity.cpp create mode 100644 tests/SDK/NDK/EntityList.cpp create mode 100644 tests/SDK/NDK/EntityOwner.cpp create mode 100644 tests/SDK/NDK/StateMachine.cpp create mode 100644 tests/SDK/NDK/System.cpp create mode 100644 tests/SDK/NDK/Systems/ListenerSystem.cpp create mode 100644 tests/SDK/NDK/Systems/PhysicsSystem.cpp create mode 100644 tests/SDK/NDK/Systems/RenderSystem.cpp create mode 100644 tests/SDK/NDK/Systems/VelocitySystem.cpp create mode 100644 tests/SDK/NDK/World.cpp diff --git a/SDK/include/NDK/Algorithm.inl b/SDK/include/NDK/Algorithm.inl index dd5f49cd4..fbdad365b 100644 --- a/SDK/include/NDK/Algorithm.inl +++ b/SDK/include/NDK/Algorithm.inl @@ -6,7 +6,15 @@ namespace Ndk { - ///TODO: constexpr avec le C++14 + /*! + * \ingroup NDK + * \brief Builds a component id based on a name + * \return Identifier for the component + * + * \param name Name to generate id from + */ + + ///TODO: constexpr with the C++14 template ComponentId BuildComponentId(const char (&name)[N]) { @@ -19,18 +27,38 @@ namespace Ndk return componentId; } + /*! + * \ingroup NDK + * \brief Gets the component id of a component + * \return Identifier for the component + */ + template ComponentIndex GetComponentIndex() { return ComponentType::componentIndex; } + /*! + * \ingroup NDK + * \brief Gets the system id of a system + * \return Identifier for the system + */ + template SystemIndex GetSystemIndex() { return SystemType::systemIndex; } + /*! + * \ingroup NDK + * \brief Initializes the a component + * \return Identifier for the component + * + * \param name Name to generate id from + */ + template ComponentIndex InitializeComponent(const char (&name)[N]) { @@ -38,6 +66,12 @@ namespace Ndk return ComponentType::componentIndex; } + /*! + * \ingroup NDK + * \brief Initializes the a system + * \return Identifier for the system + */ + template SystemIndex InitializeSystem() { @@ -45,12 +79,26 @@ namespace Ndk return SystemType::systemIndex; } + /*! + * \brief Checks whether the parameter is a component + * \return true If it is the case + * + * \param component Component to check + */ + template bool IsComponent(C& component) { return component.GetIndex() == GetComponentIndex(); } + /*! + * \brief Checks whether the parameter is a system + * \return true If it is the case + * + * \param system System to check + */ + template bool IsSystem(S& system) { diff --git a/SDK/include/NDK/Application.inl b/SDK/include/NDK/Application.inl index 96e8768ce..0d21d1b94 100644 --- a/SDK/include/NDK/Application.inl +++ b/SDK/include/NDK/Application.inl @@ -8,6 +8,12 @@ namespace Ndk { + /*! + * \brief Constructs an Application object by default + * + * \remark Produces a NazaraAssert if there's more than one application instance currently running + */ + inline Application::Application() : #ifndef NDK_SERVER m_exitOnClosedWindows(true), @@ -24,6 +30,10 @@ namespace Ndk Sdk::Initialize(); } + /*! + * \brief Destructs the object + */ + inline Application::~Application() { m_worlds.clear(); @@ -31,13 +41,20 @@ namespace Ndk m_windows.clear(); #endif - // Libération du SDK + // Free of SDK Sdk::Uninitialize(); - // Libération automatique des modules + // Automatic free of modules s_application = nullptr; } + /*! + * \brief Adds a window to the application + * \return A reference to the newly created windows + * + * \param args Arguments used to create the window + */ + #ifndef NDK_SERVER template T& Application::AddWindow(Args&&... args) @@ -49,6 +66,13 @@ namespace Ndk } #endif + /*! + * \brief Adds a world to the application + * \return A reference to the newly created world + * + * \param args Arguments used to create the world + */ + template World& Application::AddWorld(Args&&... args) { @@ -56,11 +80,22 @@ namespace Ndk return m_worlds.back(); } + /*! + * \brief Gets the update time of the application + * \return Update rate + */ + inline float Application::GetUpdateTime() const { return m_updateTime; } + /*! + * \brief Makes the application exit when there's no more open window + * + * \param exitOnClosedWindows Should exit be called when no more window is open + */ + #ifndef NDK_SERVER inline void Application::MakeExitOnLastWindowClosed(bool exitOnClosedWindows) { @@ -68,11 +103,20 @@ namespace Ndk } #endif + /*! + * \brief Quits the application + */ + inline void Application::Quit() { m_shouldQuit = true; } + /*! + * \brief Gets the singleton instance of the application + * \return Singleton application + */ + inline Application* Application::Instance() { return s_application; diff --git a/SDK/include/NDK/BaseComponent.hpp b/SDK/include/NDK/BaseComponent.hpp index f045ae2a6..0a48c394d 100644 --- a/SDK/include/NDK/BaseComponent.hpp +++ b/SDK/include/NDK/BaseComponent.hpp @@ -27,7 +27,7 @@ namespace Ndk BaseComponent(BaseComponent&&) = default; virtual ~BaseComponent(); - virtual BaseComponent* Clone() const = 0; + virtual std::unique_ptr Clone() const = 0; ComponentIndex GetIndex() const; diff --git a/SDK/include/NDK/BaseComponent.inl b/SDK/include/NDK/BaseComponent.inl index 341ddb651..0e8af931f 100644 --- a/SDK/include/NDK/BaseComponent.inl +++ b/SDK/include/NDK/BaseComponent.inl @@ -7,34 +7,60 @@ namespace Ndk { + /*! + * \brief Constructs a BaseComponent object with an index + * + * \param index Index of the component + */ + inline BaseComponent::BaseComponent(ComponentIndex index) : m_componentIndex(index), m_entity(nullptr) { } + /*! + * \brief Gets the index of the component + * \return Index of the component + */ + inline ComponentIndex BaseComponent::GetIndex() const { return m_componentIndex; } + /*! + * \brief Gets the maximal index of the components + * \return Index of the maximal component + */ + inline ComponentIndex BaseComponent::GetMaxComponentIndex() { return static_cast(s_entries.size()); } + /*! + * \brief Registers a component + * \return Index of the registered component + * + * \param id Index of the component + * \param factory Factory to create the component + * + * \remark Produces a NazaraAssert if the identifier is already in use + */ + inline ComponentIndex BaseComponent::RegisterComponent(ComponentId id, Factory factoryFunc) { - // Nous allons rajouter notre composant à la fin + // We add our component to the end ComponentIndex index = static_cast(s_entries.size()); s_entries.resize(index + 1); - // On récupère et on affecte + // We retrieve it and affect it ComponentEntry& entry = s_entries.back(); entry.factory = factoryFunc; entry.id = id; - // Une petite assertion pour s'assurer que l'identifiant n'est pas déjà utilisé + // We ensure that id is not already in use NazaraAssert(s_idToIndex.find(id) == s_idToIndex.end(), "This id is already in use"); s_idToIndex[id] = index; @@ -42,6 +68,10 @@ namespace Ndk return index; } + /*! + * \brief Sets the entity on which the component operates + */ + inline void BaseComponent::SetEntity(Entity* entity) { if (m_entity != entity) @@ -55,12 +85,21 @@ namespace Ndk } } + /*! + * \brief Initializes the BaseComponent + * \return true + */ + inline bool BaseComponent::Initialize() { - // Rien à faire + // Nothing to do return true; } + /*! + * \brief Uninitializes the BaseComponent + */ + inline void BaseComponent::Uninitialize() { s_entries.clear(); diff --git a/SDK/include/NDK/BaseSystem.hpp b/SDK/include/NDK/BaseSystem.hpp index 969f2b773..a4ff0bf41 100644 --- a/SDK/include/NDK/BaseSystem.hpp +++ b/SDK/include/NDK/BaseSystem.hpp @@ -29,7 +29,7 @@ namespace Ndk inline void Enable(bool enable = true); - virtual BaseSystem* Clone() const = 0; + virtual std::unique_ptr Clone() const = 0; bool Filters(const Entity* entity) const; diff --git a/SDK/include/NDK/BaseSystem.inl b/SDK/include/NDK/BaseSystem.inl index 490b32e76..1afc242c0 100644 --- a/SDK/include/NDK/BaseSystem.inl +++ b/SDK/include/NDK/BaseSystem.inl @@ -8,6 +8,12 @@ namespace Ndk { + /*! + * \brief Constructs a BaseSystem object with an index + * + * \param systemId Index of the system + */ + inline BaseSystem::BaseSystem(SystemIndex systemId) : m_updateEnabled(true), m_systemIndex(systemId) @@ -15,6 +21,12 @@ namespace Ndk SetUpdateRate(30); } + /*! + * \brief Constructs a BaseSystem object by copy semantic + * + * \param system System to copy + */ + inline BaseSystem::BaseSystem(const BaseSystem& system) : m_excludedComponents(system.m_excludedComponents), m_requiredComponents(system.m_requiredComponents), @@ -25,36 +37,74 @@ namespace Ndk { } + /*! + * \brief Enables the system + * + * \param enable Should the system be enabled + */ + inline void BaseSystem::Enable(bool enable) { m_updateEnabled = enable; } + /*! + * \brief Gets every entities that system handle + * \return A constant reference to the list of entities + */ + inline const std::vector& BaseSystem::GetEntities() const { return m_entities; } + /*! + * \brief Gets the index of the system + * \return Index of the system + */ + inline SystemIndex BaseSystem::GetIndex() const { return m_systemIndex; } + /*! + * \brief Gets the rate of update for the system + * \return Update rate + */ + inline float BaseSystem::GetUpdateRate() const { return (m_updateRate > 0.f) ? 1.f / m_updateRate : 0.f; } + /*! + * \brief Gets the world on which the system operate + * \return World in which the system is + */ + inline World& BaseSystem::GetWorld() const { return *m_world; } + /*! + * \brief Checks whether or not the system is enabled + * \return true If it is the case + */ + inline bool BaseSystem::IsEnabled() const { return m_updateEnabled; } + /*! + * \brief Checks whether or not the system has the entity + * \return true If it is the case + * + * \param entity Pointer to the entity + */ + inline bool BaseSystem::HasEntity(const Entity* entity) const { if (!entity) @@ -63,12 +113,24 @@ namespace Ndk return m_entityBits.UnboundedTest(entity->GetId()); } + /*! + * \brief Sets the rate of update for the system + * + * \param updatePerSecond Update rate, 0 means as much as possible + */ + inline void BaseSystem::SetUpdateRate(float updatePerSecond) { m_updateCounter = 0.f; m_updateRate = (updatePerSecond > 0.f) ? 1.f / updatePerSecond : 0.f; // 0.f means no limit } + /*! + * \brief Updates the system + * + * \param elapsedTime Delta time used for the update + */ + inline void BaseSystem::Update(float elapsedTime) { if (!IsEnabled()) @@ -88,6 +150,10 @@ namespace Ndk OnUpdate(elapsedTime); } + /*! + * \brief Excludes some component from the system + */ + template void BaseSystem::Excludes() { @@ -96,6 +162,10 @@ namespace Ndk ExcludesComponent(GetComponentIndex()); } + /*! + * \brief Excludes some components from the system + */ + template void BaseSystem::Excludes() { @@ -103,16 +173,31 @@ namespace Ndk Excludes(); } + /*! + * \brief Excludes some component from the system by index + * + * \param index Index of the component + */ + inline void BaseSystem::ExcludesComponent(ComponentIndex index) { m_excludedComponents.UnboundedSet(index); } + /*! + * \brief Gets the next index for the system + * \return Next unique index for the system + */ + inline SystemIndex BaseSystem::GetNextIndex() { return s_nextIndex++; } + /*! + * \brief Requires some component from the system + */ + template void BaseSystem::Requires() { @@ -121,6 +206,10 @@ namespace Ndk RequiresComponent(GetComponentIndex()); } + /*! + * \brief Requires some components from the system + */ + template void BaseSystem::Requires() { @@ -128,11 +217,21 @@ namespace Ndk Requires(); } + /*! + * \brief Requires some component for the system by index + * + * \param index Index of the component + */ + inline void BaseSystem::RequiresComponent(ComponentIndex index) { m_requiredComponents.UnboundedSet(index); } + /*! + * \brief Requires any component from the system + */ + template void BaseSystem::RequiresAny() { @@ -141,6 +240,10 @@ namespace Ndk RequiresAnyComponent(GetComponentIndex()); } + /*! + * \brief Requires any components from the system + */ + template void BaseSystem::RequiresAny() { @@ -148,11 +251,25 @@ namespace Ndk RequiresAny(); } + /*! + * \brief Requires any component for the system by index + * + * \param index Index of the component + */ + inline void BaseSystem::RequiresAnyComponent(ComponentIndex index) { m_requiredAnyComponents.UnboundedSet(index); } + /*! + * \brief Adds an entity to a system + * + * \param entity Pointer to the entity + * + * \remark Produces a NazaraAssert if entity is invalid + */ + inline void BaseSystem::AddEntity(Entity* entity) { NazaraAssert(entity, "Invalid entity"); @@ -165,6 +282,14 @@ namespace Ndk OnEntityAdded(entity); } + /*! + * \brief Removes an entity to a system + * + * \param entity Pointer to the entity + * + * \remark Produces a NazaraAssert if entity is invalid + */ + inline void BaseSystem::RemoveEntity(Entity* entity) { NazaraAssert(entity, "Invalid entity"); @@ -172,16 +297,25 @@ namespace Ndk auto it = std::find(m_entities.begin(), m_entities.end(), *entity); NazaraAssert(it != m_entities.end(), "Entity is not part of this system"); - // Pour éviter de déplacer beaucoup de handles, on swap le dernier avec celui à supprimer + // To avoid moving a lot of handles, we swap and pop std::swap(*it, m_entities.back()); - m_entities.pop_back(); // On le sort du vector + m_entities.pop_back(); // We get it out of the vector m_entityBits.Reset(entity->GetId()); entity->UnregisterSystem(m_systemIndex); - OnEntityRemoved(entity); // Et on appelle le callback + OnEntityRemoved(entity); // And we alert our callback } + /*! + * \brief Validates an entity to a system + * + * \param entity Pointer to the entity + * \param justAdded Is the entity newly added + * + * \remark Produces a NazaraAssert if entity is invalid or if system does not hold this entity + */ + inline void BaseSystem::ValidateEntity(Entity* entity, bool justAdded) { NazaraAssert(entity, "Invalid entity"); @@ -190,11 +324,20 @@ namespace Ndk OnEntityValidation(entity, justAdded); } + /*! + * \brief Sets the world on which the system operates + */ + inline void BaseSystem::SetWorld(World* world) noexcept { m_world = world; } + /*! + * \brief Initializes the BaseSystem + * \return true + */ + inline bool BaseSystem::Initialize() { s_nextIndex = 0; @@ -202,6 +345,10 @@ namespace Ndk return true; } + /*! + * \brief Uninitializes the BaseSystem + */ + inline void BaseSystem::Uninitialize() { // Nothing to do diff --git a/SDK/include/NDK/Component.hpp b/SDK/include/NDK/Component.hpp index e3026dbad..b0f61fd92 100644 --- a/SDK/include/NDK/Component.hpp +++ b/SDK/include/NDK/Component.hpp @@ -18,7 +18,7 @@ namespace Ndk Component(); virtual ~Component(); - BaseComponent* Clone() const override; + std::unique_ptr Clone() const override; static ComponentIndex RegisterComponent(ComponentId id); diff --git a/SDK/include/NDK/Component.inl b/SDK/include/NDK/Component.inl index 833395957..6ca3f1944 100644 --- a/SDK/include/NDK/Component.inl +++ b/SDK/include/NDK/Component.inl @@ -7,6 +7,18 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::Component + * \brief NDK class that represents a component for an entity which interacts with a system + * + * \remark This class is meant to be derived as CRTP: "Component" + */ + + /*! + * \brief Constructs a Component object by default + */ + template Component::Component() : BaseComponent(GetComponentIndex()) @@ -16,19 +28,30 @@ namespace Ndk template Component::~Component() = default; + /*! + * \brief Clones the component + * \return The clone newly created + * + * \remark The component to clone should be trivially copy constructible + */ + template - BaseComponent* Component::Clone() const + std::unique_ptr Component::Clone() const { ///FIXME: Pas encore supporté par GCC (4.9.2) //static_assert(std::is_trivially_copy_constructible::value, "ComponentType must be copy-constructible"); - return new ComponentType(static_cast(*this)); + return std::make_unique(static_cast(*this)); } + /*! + * \brief Registers the component by assigning it an index + */ + template ComponentIndex Component::RegisterComponent(ComponentId id) { - // On utilise les lambda pour créer une fonction factory + //We use the lambda to create a factory function auto factory = []() -> BaseComponent* { return nullptr; //< Temporary workaround to allow non-default-constructed components, will be updated for serialization @@ -38,11 +61,15 @@ namespace Ndk return BaseComponent::RegisterComponent(id, factory); } + /*! + * \brief Registers the component by assigning it an index based on the name + */ + template template ComponentIndex Component::RegisterComponent(const char (&name)[N]) { - // On récupère la chaîne de caractère sous la forme d'un nombre qui servira d'identifiant unique + // We convert the string to a number which will be used as unique identifier ComponentId id = BuildComponentId(name); return RegisterComponent(id); } diff --git a/SDK/include/NDK/Components/CameraComponent.inl b/SDK/include/NDK/Components/CameraComponent.inl index d91c357eb..d42d0e152 100644 --- a/SDK/include/NDK/Components/CameraComponent.inl +++ b/SDK/include/NDK/Components/CameraComponent.inl @@ -8,6 +8,10 @@ namespace Ndk { + /*! + * \brief Constructs an CameraComponent object by default + */ + inline CameraComponent::CameraComponent() : m_projectionType(Nz::ProjectionType_Perspective), m_targetRegion(0.f, 0.f, 1.f, 1.f), @@ -25,6 +29,12 @@ namespace Ndk { } + /*! + * \brief Constructs a CameraComponent object by copy semantic + * + * \param camera CameraComponent to copy + */ + inline CameraComponent::CameraComponent(const CameraComponent& camera) : Component(camera), AbstractViewer(camera), @@ -45,30 +55,51 @@ namespace Ndk SetTarget(camera.m_target); } + /*! + * \brief Ensures the frustum is up to date + */ + inline void CameraComponent::EnsureFrustumUpdate() const { if (!m_frustumUpdated) UpdateFrustum(); } + /*! + * \brief Ensures the projection matrix is up to date + */ + inline void CameraComponent::EnsureProjectionMatrixUpdate() const { if (!m_projectionMatrixUpdated) UpdateProjectionMatrix(); } + /*! + * \brief Ensures the view matrix is up to date + */ + inline void CameraComponent::EnsureViewMatrixUpdate() const { if (!m_viewMatrixUpdated) UpdateViewMatrix(); } + /*! + * \brief Ensures the view port is up to date + */ + inline void CameraComponent::EnsureViewportUpdate() const { if (!m_viewportUpdated) UpdateViewport(); } + /*! + * \brief Gets the aspect ratio of the camera + * \return Aspect ratio of the camera + */ + inline float CameraComponent::GetAspectRatio() const { EnsureViewportUpdate(); @@ -76,11 +107,21 @@ namespace Ndk return m_aspectRatio; } + /*! + * \brief Gets the field of view of the camera + * \return Field of view of the camera + */ + inline float CameraComponent::GetFOV() const { return m_fov; } + /*! + * \brief Gets the frutum of the camera + * \return A constant reference to the frustum of the camera + */ + inline const Nz::Frustumf& CameraComponent::GetFrustum() const { EnsureFrustumUpdate(); @@ -88,11 +129,21 @@ namespace Ndk return m_frustum; } + /*! + * \brief Gets the layer of the camera + * \return Layer of the camera + */ + inline unsigned int CameraComponent::GetLayer() const { return m_layer; } + /*! + * \brief Gets the projection matrix of the camera + * \return A constant reference to the projection matrix of the camera + */ + inline const Nz::Matrix4f& CameraComponent::GetProjectionMatrix() const { EnsureProjectionMatrixUpdate(); @@ -100,26 +151,51 @@ namespace Ndk return m_projectionMatrix; } + /*! + * \brief Gets the projection type of the camera + * \return Projection type of the camera + */ + inline Nz::ProjectionType CameraComponent::GetProjectionType() const { return m_projectionType; } + /*! + * \brief Gets the size of the camera + * \return Size of the camera + */ + inline const Nz::Vector2f & CameraComponent::GetSize() const { return m_size; } + /*! + * \brief Gets the target of the camera + * \return A constant reference to the render target of the camera + */ + inline const Nz::RenderTarget* CameraComponent::GetTarget() const { return m_target; } + /*! + * \brief Gets the target region of the camera + * \return A constant reference to the target region of the camera + */ + inline const Nz::Rectf& CameraComponent::GetTargetRegion() const { return m_targetRegion; } + /*! + * \brief Gets the view matrix of the camera + * \return A constant reference to the view matrix of the camera + */ + inline const Nz::Matrix4f& CameraComponent::GetViewMatrix() const { EnsureViewMatrixUpdate(); @@ -127,6 +203,11 @@ namespace Ndk return m_viewMatrix; } + /*! + * \brief Gets the view port of the camera + * \return A constant reference to the view port of the camera + */ + inline const Nz::Recti& CameraComponent::GetViewport() const { EnsureViewportUpdate(); @@ -134,16 +215,34 @@ namespace Ndk return m_viewport; } + /*! + * \brief Gets the Z far distance of the camera + * \return Z far distance of the camera + */ + inline float CameraComponent::GetZFar() const { return m_zFar; } + /*! + * \brief Gets the Z near distance of the camera + * \return Z near distance of the camera + */ + inline float CameraComponent::GetZNear() const { return m_zNear; } + /*! + * \brief Sets the field of view of the camera + * + * \param fov Field of view of the camera + * + * \remark Produces a NazaraAssert if angle is zero + */ + inline void CameraComponent::SetFOV(float fov) { NazaraAssert(!Nz::NumberEquals(fov, 0.f), "FOV must be different from zero"); @@ -152,6 +251,12 @@ namespace Ndk InvalidateProjectionMatrix(); } + /*! + * \brief Sets the projection type of the camera + * + * \param projectionType Projection type of the camera + */ + inline void CameraComponent::SetProjectionType(Nz::ProjectionType projectionType) { m_projectionType = projectionType; @@ -159,6 +264,12 @@ namespace Ndk InvalidateProjectionMatrix(); } + /*! + * \brief Sets the size of the camera + * + * \param size Size of the camera + */ + inline void CameraComponent::SetSize(const Nz::Vector2f& size) { m_size = size; @@ -166,11 +277,24 @@ namespace Ndk InvalidateProjectionMatrix(); } + /*! + * \brief Sets the size of the camera + * + * \param width Size in X of the camera + * \param height Size in Y of the camera + */ + inline void CameraComponent::SetSize(float width, float height) { SetSize({width, height}); } + /*! + * \brief Sets the target of the camera + * + * \param renderTarget A constant reference to the render target of the camera + */ + inline void CameraComponent::SetTarget(const Nz::RenderTarget* renderTarget) { m_target = renderTarget; @@ -186,6 +310,12 @@ namespace Ndk } } + /*! + * \brief Sets the target region of the camera + * + * \param region A constant reference to the target region of the camera + */ + inline void CameraComponent::SetTargetRegion(const Nz::Rectf& region) { m_targetRegion = region; @@ -193,17 +323,31 @@ namespace Ndk InvalidateViewport(); } + /*! + * \brief Sets the view port of the camera + * + * \param viewport A constant reference to the view port of the camera + * + * \remark Produces a NazaraAssert if the camera has no target + */ + inline void CameraComponent::SetViewport(const Nz::Recti& viewport) { NazaraAssert(m_target, "Component has no render target"); - // On calcule la région nécessaire pour produire ce viewport avec la taille actuelle de la cible - float invWidth = 1.f/m_target->GetWidth(); - float invHeight = 1.f/m_target->GetHeight(); + // We compute the region necessary to make this view port with the actual size of the target + float invWidth = 1.f / m_target->GetWidth(); + float invHeight = 1.f / m_target->GetHeight(); SetTargetRegion(Nz::Rectf(invWidth * viewport.x, invHeight * viewport.y, invWidth * viewport.width, invHeight * viewport.height)); } + /*! + * \brief Sets the Z far distance of the camera + * + * \param zFar Z far distance of the camera + */ + inline void CameraComponent::SetZFar(float zFar) { m_zFar = zFar; @@ -211,6 +355,14 @@ namespace Ndk InvalidateProjectionMatrix(); } + /*! + * \brief Sets the Z near distance of the camera + * + * \param zNear Z near distance of the camera + * + * \remark Produces a NazaraAssert if zNear is zero + */ + inline void CameraComponent::SetZNear(float zNear) { NazaraAssert(!Nz::NumberEquals(zNear, 0.f), "zNear cannot be zero"); @@ -219,23 +371,39 @@ namespace Ndk InvalidateProjectionMatrix(); } + /*! + * \brief Invalidates the frustum + */ + inline void CameraComponent::InvalidateFrustum() const { m_frustumUpdated = false; } + /*! + * \brief Invalidates the projection matrix + */ + inline void CameraComponent::InvalidateProjectionMatrix() const { m_frustumUpdated = false; m_projectionMatrixUpdated = false; } + /*! + * \brief Invalidates the view matrix + */ + inline void CameraComponent::InvalidateViewMatrix() const { m_frustumUpdated = false; m_viewMatrixUpdated = false; } + /*! + * \brief Invalidates the view port + */ + inline void CameraComponent::InvalidateViewport() const { m_frustumUpdated = false; diff --git a/SDK/include/NDK/Components/CollisionComponent.inl b/SDK/include/NDK/Components/CollisionComponent.inl index 58356ac9e..b08e7054e 100644 --- a/SDK/include/NDK/Components/CollisionComponent.inl +++ b/SDK/include/NDK/Components/CollisionComponent.inl @@ -9,23 +9,47 @@ namespace Ndk { + /*! + * \brief Constructs a CollisionComponent object with a geometry + * + * \param geom Reference to a geometry symbolizing the entity + */ + inline CollisionComponent::CollisionComponent(Nz::PhysGeomRef geom) : m_geom(std::move(geom)), m_bodyUpdated(false) { } + /*! + * \brief Constructs a CollisionComponent object by copy semantic + * + * \param collision CollisionComponent to copy + */ + inline CollisionComponent::CollisionComponent(const CollisionComponent& collision) : m_geom(collision.m_geom), m_bodyUpdated(false) { } + /*! + * \brief Gets the geometry representing the entity + * \return A constant reference to the physics geometry + */ + inline const Nz::PhysGeomRef& CollisionComponent::GetGeom() const { return m_geom; } + /*! + * \brief Assigns the geometry to this component + * \return A reference to this + * + * \param geom Reference to a geometry symbolizing the entity + */ + inline CollisionComponent& CollisionComponent::operator=(Nz::PhysGeomRef geom) { SetGeom(geom); @@ -33,6 +57,11 @@ namespace Ndk return *this; } + /*! + * \brief Gets the static body used by the entity + * \return A pointer to the entity + */ + inline Nz::PhysObject* CollisionComponent::GetStaticBody() { return m_staticBody.get(); diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index 0d9cb7af4..01cd7a2e3 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -7,6 +7,12 @@ namespace Ndk { + /*! + * \brief Constructs a GraphicsComponent object by copy semantic + * + * \param graphicsComponent GraphicsComponent to copy + */ + inline GraphicsComponent::GraphicsComponent(const GraphicsComponent& graphicsComponent) : Component(graphicsComponent), HandledObject(graphicsComponent), @@ -20,6 +26,12 @@ namespace Ndk Attach(r.renderable, r.data.renderOrder); } + /*! + * \brief Adds the renderable elements to the render queue + * + * \param renderQueue Queue to be added + */ + inline void GraphicsComponent::AddToRenderQueue(Nz::AbstractRenderQueue* renderQueue) const { EnsureTransformMatrixUpdate(); @@ -36,6 +48,13 @@ namespace Ndk } } + /*! + * \brief Attaches a renderable to the entity + * + * \param renderable Reference to a renderable element + * \param renderOrder Render order of the element + */ + inline void GraphicsComponent::Attach(Nz::InstancedRenderableRef renderable, int renderOrder) { m_renderables.emplace_back(m_transformMatrix); @@ -48,6 +67,10 @@ namespace Ndk InvalidateBoundingVolume(); } + /*! + * \brief Clears every renderable elements + */ + inline void GraphicsComponent::Clear() { m_renderables.clear(); @@ -55,6 +78,12 @@ namespace Ndk InvalidateBoundingVolume(); } + /*! + * \brief Detaches a renderable to the entity + * + * \param renderable Reference to a renderable element + */ + inline void GraphicsComponent::Detach(const Nz::InstancedRenderable* renderable) { for (auto it = m_renderables.begin(); it != m_renderables.end(); ++it) @@ -68,18 +97,34 @@ namespace Ndk } } + /*! + * \brief Ensures the bounding volume is up to date + */ + inline void GraphicsComponent::EnsureBoundingVolumeUpdate() const { if (!m_boundingVolumeUpdated) UpdateBoundingVolume(); } + /*! + * \brief Ensures the transformation matrix is up to date + */ + inline void GraphicsComponent::EnsureTransformMatrixUpdate() const { if (!m_transformMatrixUpdated) UpdateTransformMatrix(); } + /*! + * \brief Gets the set of renderable elements + * + * \param renderables Pointer to the list of renderables + * + * \remark Produces a NazaraAssert if renderables is invalid + */ + inline void GraphicsComponent::GetAttachedRenderables(RenderableList* renderables) const { NazaraAssert(renderables, "Invalid renderable list"); @@ -89,11 +134,21 @@ namespace Ndk renderables->push_back(r.renderable); } + /*! + * \brief Gets the number of renderable elements attached to the entity + * \return Number of renderable elements + */ + inline std::size_t GraphicsComponent::GetAttachedRenderableCount() const { return m_renderables.size(); } + /*! + * \brief Gets the bouding volume of the entity + * \return A constant reference to the bounding volume + */ + inline const Nz::BoundingVolumef& GraphicsComponent::GetBoundingVolume() const { EnsureBoundingVolumeUpdate(); @@ -101,17 +156,29 @@ namespace Ndk return m_boundingVolume; } + /*! + * \brief Invalidates the bounding volume + */ + inline void GraphicsComponent::InvalidateBoundingVolume() { m_boundingVolumeUpdated = false; } + /*! + * \brief Invalidates every renderable elements + */ + inline void GraphicsComponent::InvalidateRenderables() { for (Renderable& r : m_renderables) r.dataUpdated = false; } + /*! + * \brief Invalidates the transformation matrix + */ + inline void GraphicsComponent::InvalidateTransformMatrix() { m_boundingVolumeUpdated = false; diff --git a/SDK/include/NDK/Components/LightComponent.inl b/SDK/include/NDK/Components/LightComponent.inl index f06fcb24c..ba11703c5 100644 --- a/SDK/include/NDK/Components/LightComponent.inl +++ b/SDK/include/NDK/Components/LightComponent.inl @@ -4,6 +4,10 @@ namespace Ndk { + /*! + * \brief Constructs an LightComponent object with a light type + */ + inline LightComponent::LightComponent(Nz::LightType lightType) : Nz::Light(lightType) { diff --git a/SDK/include/NDK/Components/ListenerComponent.inl b/SDK/include/NDK/Components/ListenerComponent.inl index 7dc7b0391..f2276e439 100644 --- a/SDK/include/NDK/Components/ListenerComponent.inl +++ b/SDK/include/NDK/Components/ListenerComponent.inl @@ -4,16 +4,31 @@ namespace Ndk { + /*! + * \brief Constructs an ListenerComponent object by default + */ + inline ListenerComponent::ListenerComponent() : m_isActive(true) { } + /*! + * \brief Checks whether the listener is activated + * \param true If it is the case + */ + inline bool ListenerComponent::IsActive() const { return m_isActive; } + /*! + * \brief Enables the listener + * + * \param active Should the listener be active + */ + inline void ListenerComponent::SetActive(bool active) { m_isActive = active; diff --git a/SDK/include/NDK/Components/NodeComponent.inl b/SDK/include/NDK/Components/NodeComponent.inl index e6d49c9a9..0150cbbfa 100644 --- a/SDK/include/NDK/Components/NodeComponent.inl +++ b/SDK/include/NDK/Components/NodeComponent.inl @@ -7,6 +7,15 @@ namespace Ndk { + /*! + * \brief Sets the parent node of the entity + * + * \param entity Pointer to the entity considered as parent + * \param keepDerived Should this component considered as a derived + * + * \remark Produces a NazaraAssert if entity has no component NodeComponent + */ + inline void NodeComponent::SetParent(Entity* entity, bool keepDerived) { if (entity) diff --git a/SDK/include/NDK/Components/ParticleEmitterComponent.inl b/SDK/include/NDK/Components/ParticleEmitterComponent.inl index 342b5e56f..7f8e62cd8 100644 --- a/SDK/include/NDK/Components/ParticleEmitterComponent.inl +++ b/SDK/include/NDK/Components/ParticleEmitterComponent.inl @@ -6,21 +6,42 @@ namespace Ndk { + /*! + * \brief Constructs an ParticleEmitterComponent object by default + */ + inline ParticleEmitterComponent::ParticleEmitterComponent() : m_isActive(true) { } + /*! + * \brief Enables the emission of particles + * + * \param active Should the emitter be active + */ + inline void Ndk::ParticleEmitterComponent::Enable(bool active) { m_isActive = active; } + /*! + * \brief Checks whether the emission of particles is activated + * \param true If it is the case + */ + inline bool ParticleEmitterComponent::IsActive() const { return m_isActive; } + /*! + * \brief Sets the function use for setting up particles + * + * \param func Function to set up particles + */ + inline void Ndk::ParticleEmitterComponent::SetSetupFunc(SetupFunc func) { m_setupFunc = std::move(func); diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.inl b/SDK/include/NDK/Components/ParticleGroupComponent.inl index c6e0cba7b..591e78605 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.inl +++ b/SDK/include/NDK/Components/ParticleGroupComponent.inl @@ -8,16 +8,45 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::ParticleGroupComponent + * \brief NDK class that represents the component for a group of particles + */ + + /*! + * \brief Constructs a ParticleGroupComponent object with a maximal number of particles and a layout + * + * \param maxParticleCount Maximum number of particles to generate + * \param layout Enumeration for the layout of data information for the particles + */ + inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) : ParticleGroup(maxParticleCount, layout) { } + /*! + * \brief Constructs a ParticleGroupComponent object with a maximal number of particles and a particle declaration + * + * \param maxParticleCount Maximum number of particles to generate + * \param declaration Data information for the particles + */ + inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleDeclarationConstRef declaration) : ParticleGroup(maxParticleCount, std::move(declaration)) { } + /*! + * \brief Adds an emitter to the particles + * + * \param emitter Emitter for the particles + * + * \remark Produces a NazaraAssert if emitter is invalid + * \remark Produces a NazaraAssert if entity has no component of type ParticleEmitterComponent + */ + inline void ParticleGroupComponent::AddEmitter(Entity* emitter) { NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); @@ -27,6 +56,16 @@ namespace Ndk ParticleGroup::AddEmitter(&emitterComponent); } + + /*! + * \brief Removes an emitter to the particles + * + * \param emitter Emitter for the particles to remove + * + * \remark Produces a NazaraAssert if emitter is invalid + * \remark Produces a NazaraAssert if entity has no component of type ParticleEmitterComponent + */ + inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter) { NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); diff --git a/SDK/include/NDK/Components/PhysicsComponent.inl b/SDK/include/NDK/Components/PhysicsComponent.inl index f0847842d..5682603e0 100644 --- a/SDK/include/NDK/Components/PhysicsComponent.inl +++ b/SDK/include/NDK/Components/PhysicsComponent.inl @@ -6,12 +6,27 @@ namespace Ndk { + /*! + * \brief Constructs a PhysicsComponent object by copy semantic + * + * \param physics PhysicsComponent to copy + */ + inline PhysicsComponent::PhysicsComponent(const PhysicsComponent& physics) { - // Pas de copie de l'objet physique (étant donné que nous n'allons le créer qu'une fois attaché à une entité) + // No copy of physical object (because we only create it when attached to an entity) NazaraUnused(physics); } + /*! + * \brief Applies a force to the entity + * + * \param force Force to apply on the entity + * \param coordSys System coordinates to consider + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::AddForce(const Nz::Vector3f& force, Nz::CoordSys coordSys) { NazaraAssert(m_object, "Invalid physics object"); @@ -19,6 +34,16 @@ namespace Ndk m_object->AddForce(force, coordSys); } + /*! + * \brief Applies a force to the entity + * + * \param force Force to apply on the entity + * \param point Point where to apply the force + * \param coordSys System coordinates to consider + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::AddForce(const Nz::Vector3f& force, const Nz::Vector3f& point, Nz::CoordSys coordSys) { NazaraAssert(m_object, "Invalid physics object"); @@ -26,13 +51,30 @@ namespace Ndk m_object->AddForce(force, point, coordSys); } + /*! + * \brief Applies a torque to the entity + * + * \param torque Torque to apply on the entity + * \param coordSys System coordinates to consider + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::AddTorque(const Nz::Vector3f& torque, Nz::CoordSys coordSys) { NazaraAssert(m_object, "Invalid physics object"); - m_object->AddForce(torque, coordSys); + m_object->AddTorque(torque, coordSys); } + /*! + * \brief Enables auto sleep of physics object + * + * \param autoSleep Should the physics of the object be disabled when too far from others + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::EnableAutoSleep(bool autoSleep) { NazaraAssert(m_object, "Invalid physics object"); @@ -40,6 +82,13 @@ namespace Ndk m_object->EnableAutoSleep(autoSleep); } + /*! + * \brief Gets the AABB of the physics object + * \return AABB of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline Nz::Boxf PhysicsComponent::GetAABB() const { NazaraAssert(m_object, "Invalid physics object"); @@ -47,6 +96,13 @@ namespace Ndk return m_object->GetAABB(); } + /*! + * \brief Gets the angular velocity of the physics object + * \return Angular velocity of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline Nz::Vector3f PhysicsComponent::GetAngularVelocity() const { NazaraAssert(m_object, "Invalid physics object"); @@ -54,6 +110,13 @@ namespace Ndk return m_object->GetAngularVelocity(); } + /*! + * \brief Gets the gravity factor of the physics object + * \return Gravity factor of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline float PhysicsComponent::GetGravityFactor() const { NazaraAssert(m_object, "Invalid physics object"); @@ -61,6 +124,13 @@ namespace Ndk return m_object->GetGravityFactor(); } + /*! + * \brief Gets the mass of the physics object + * \return Mass of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline float PhysicsComponent::GetMass() const { NazaraAssert(m_object, "Invalid physics object"); @@ -68,6 +138,15 @@ namespace Ndk return m_object->GetMass(); } + /*! + * \brief Gets the gravity center of the physics object + * \return Gravity center of the object + * + * \param coordSys System coordinates to consider + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline Nz::Vector3f PhysicsComponent::GetMassCenter(Nz::CoordSys coordSys) const { NazaraAssert(m_object, "Invalid physics object"); @@ -75,6 +154,13 @@ namespace Ndk return m_object->GetMassCenter(coordSys); } + /*! + * \brief Gets the matrix of the physics object + * \return Matrix of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline const Nz::Matrix4f& PhysicsComponent::GetMatrix() const { NazaraAssert(m_object, "Invalid physics object"); @@ -82,6 +168,13 @@ namespace Ndk return m_object->GetMatrix(); } + /*! + * \brief Gets the position of the physics object + * \return Position of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline Nz::Vector3f PhysicsComponent::GetPosition() const { NazaraAssert(m_object, "Invalid physics object"); @@ -89,6 +182,13 @@ namespace Ndk return m_object->GetPosition(); } + /*! + * \brief Gets the rotation of the physics object + * \return Rotation of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline Nz::Quaternionf PhysicsComponent::GetRotation() const { NazaraAssert(m_object, "Invalid physics object"); @@ -96,6 +196,13 @@ namespace Ndk return m_object->GetRotation(); } + /*! + * \brief Gets the velocity of the physics object + * \return Velocity of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline Nz::Vector3f PhysicsComponent::GetVelocity() const { NazaraAssert(m_object, "Invalid physics object"); @@ -103,6 +210,13 @@ namespace Ndk return m_object->GetVelocity(); } + /*! + * \brief Checks whether the auto sleep is enabled + * \return true If it is the case + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline bool PhysicsComponent::IsAutoSleepEnabled() const { NazaraAssert(m_object, "Invalid physics object"); @@ -110,6 +224,13 @@ namespace Ndk return m_object->IsAutoSleepEnabled(); } + /*! + * \brief Checks whether the entity is currently sleeping + * \return true If it is the case + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline bool PhysicsComponent::IsSleeping() const { NazaraAssert(m_object, "Invalid physics object"); @@ -117,6 +238,14 @@ namespace Ndk return m_object->IsSleeping(); } + /*! + * \brief Sets the angular velocity of the physics object + * + * \param angularVelocity Angular velocity of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::SetAngularVelocity(const Nz::Vector3f& angularVelocity) { NazaraAssert(m_object, "Invalid physics object"); @@ -124,6 +253,14 @@ namespace Ndk m_object->SetAngularVelocity(angularVelocity); } + /*! + * \brief Sets the gravity factor of the physics object + * + * \param gravityFactor Gravity factor of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::SetGravityFactor(float gravityFactor) { NazaraAssert(m_object, "Invalid physics object"); @@ -131,6 +268,15 @@ namespace Ndk m_object->SetGravityFactor(gravityFactor); } + /*! + * \brief Sets the mass of the physics object + * + * \param mass Mass of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + * \remark Produces a NazaraAssert if the mass is negative + */ + inline void PhysicsComponent::SetMass(float mass) { NazaraAssert(m_object, "Invalid physics object"); @@ -139,6 +285,14 @@ namespace Ndk m_object->SetMass(mass); } + /*! + * \brief Sets the gravity center of the physics object + * + * \param center Gravity center of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::SetMassCenter(const Nz::Vector3f& center) { NazaraAssert(m_object, "Invalid physics object"); @@ -146,6 +300,14 @@ namespace Ndk m_object->SetMassCenter(center); } + /*! + * \brief Sets the position of the physics object + * + * \param position Position of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::SetPosition(const Nz::Vector3f& position) { NazaraAssert(m_object, "Invalid physics object"); @@ -153,6 +315,14 @@ namespace Ndk m_object->SetPosition(position); } + /*! + * \brief Sets the rotation of the physics object + * + * \param rotation Rotation of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::SetRotation(const Nz::Quaternionf& rotation) { NazaraAssert(m_object, "Invalid physics object"); @@ -160,6 +330,14 @@ namespace Ndk m_object->SetRotation(rotation); } + /*! + * \brief Sets the velocity of the physics object + * + * \param velocity Velocity of the object + * + * \remark Produces a NazaraAssert if the physics object is invalid + */ + inline void PhysicsComponent::SetVelocity(const Nz::Vector3f& velocity) { NazaraAssert(m_object, "Invalid physics object"); @@ -167,6 +345,11 @@ namespace Ndk m_object->SetVelocity(velocity); } + /*! + * \brief Gets the underlying physics object + * \return A reference to the physics object + */ + inline Nz::PhysObject& PhysicsComponent::GetPhysObject() { return *m_object.get(); diff --git a/SDK/include/NDK/Components/VelocityComponent.inl b/SDK/include/NDK/Components/VelocityComponent.inl index 1c2f0ed87..e72eca8b7 100644 --- a/SDK/include/NDK/Components/VelocityComponent.inl +++ b/SDK/include/NDK/Components/VelocityComponent.inl @@ -7,11 +7,30 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::VelocityComponent + * \brief NDK class that represents the component for velocity + */ + + /*! + * \brief Constructs a VelocityComponent object with a velocity + * + * \param velocity Linear velocity + */ + inline VelocityComponent::VelocityComponent(const Nz::Vector3f& velocity) : linearVelocity(velocity) { } + /*! + * \brief Assigns the velocity to this component + * \return A reference to this + * + * \param vel Linear velocity + */ + inline VelocityComponent& VelocityComponent::operator=(const Nz::Vector3f& vel) { linearVelocity = vel; diff --git a/SDK/include/NDK/Console.inl b/SDK/include/NDK/Console.inl index 5fb16bb1b..94a6daf91 100644 --- a/SDK/include/NDK/Console.inl +++ b/SDK/include/NDK/Console.inl @@ -7,41 +7,81 @@ namespace Ndk { + /*! + * \brief Gets the character size + * \return Height of the character + */ + inline unsigned int Console::GetCharacterSize() const { return m_characterSize; } + /*! + * \brief Gets the entity representing the history of the console + * \return History of the console + */ + inline const EntityHandle& Console::GetHistory() const { return m_history; } + /*! + * \brief Gets the entity representing the background of the console's history + * \return Background history of the console + */ + inline const EntityHandle& Console::GetHistoryBackground() const { return m_historyBackground; } + /*! + * \brief Gets the entity representing the input of the console + * \return Input of the console + */ + inline const EntityHandle& Console::GetInput() const { return m_input; } + /*! + * \brief Gets the entity representing the background of the console's input + * \return Background input of the console + */ + inline const EntityHandle& Console::GetInputBackground() const { return m_inputBackground; } + /*! + * \brief Gets the size of the console + * \return Size (Width, Height) of the console + */ + inline const Nz::Vector2f& Console::GetSize() const { return m_size; } + /*! + * \brief Gets the font used by the console + * \return A reference to the font currenty used + */ + inline const Nz::FontRef& Console::GetTextFont() const { return m_defaultFont; } + /*! + * \brief Checks whether the console is visible + * \return true If it is the case + */ + inline bool Console::IsVisible() const { return m_opened; diff --git a/SDK/include/NDK/Entity.inl b/SDK/include/NDK/Entity.inl index a03130b0d..535f2c1f4 100644 --- a/SDK/include/NDK/Entity.inl +++ b/SDK/include/NDK/Entity.inl @@ -11,16 +11,29 @@ namespace Ndk { + /*! + * \brief Adds a component to the entity + * \return A reference to the newly added component + * + * \param args Arguments to create in place the component to add to the entity + */ + template ComponentType& Entity::AddComponent(Args&&... args) { static_assert(std::is_base_of::value, "ComponentType is not a component"); - // Allocation et affectation du component + // Affectation and return of the component std::unique_ptr ptr(new ComponentType(std::forward(args)...)); return static_cast(AddComponent(std::move(ptr))); } + /*! + * \brief Enables the entity + * + * \param enable Should the entity be enabled + */ + inline void Entity::Enable(bool enable) { if (m_enabled != enable) @@ -30,9 +43,17 @@ namespace Ndk } } + /*! + * \brief Gets a component in the entity by index + * \return A reference to the component + * + * \param index Index of the component + * + * \remark Produces a NazaraAssert if component is not available in this entity or is invalid + */ + inline BaseComponent& Entity::GetComponent(ComponentIndex index) { - ///DOC: Le component doit être présent NazaraAssert(HasComponent(index), "This component is not part of the entity"); BaseComponent* component = m_components[index].get(); @@ -41,19 +62,33 @@ namespace Ndk return *component; } + /*! + * \brief Gets a component in the entity by type + * \return A reference to the component + * + * \remark Produces a NazaraAssert if component is not available in this entity + */ + template ComponentType& Entity::GetComponent() { - ///DOC: Le component doit être présent static_assert(std::is_base_of::value, "ComponentType is not a component"); ComponentIndex index = GetComponentIndex(); return static_cast(GetComponent(index)); } + /*! + * \brief Gets a component in the entity by index + * \return A constant reference to the component + * + * \param index Index of the component + * + * \remark Produces a NazaraAssert if component is not available in this entity or is invalid + */ + inline const BaseComponent& Entity::GetComponent(ComponentIndex index) const { - ///DOC: Le component doit être présent NazaraAssert(HasComponent(index), "This component is not part of the entity"); BaseComponent* component = m_components[index].get(); @@ -62,41 +97,79 @@ namespace Ndk return *component; } + /*! + * \brief Gets a component in the entity by type + * \return A constant reference to the component + * + * \remark Produces a NazaraAssert if component is not available in this entity + */ + template const ComponentType& Entity::GetComponent() const { - ///DOC: Le component doit être présent static_assert(std::is_base_of::value, "ComponentType is not a component"); ComponentIndex index = GetComponentIndex(); return static_cast(GetComponent(index)); } + /*! + * \brief Gets the bits representing the components in the entiy + * \return A constant reference to the set of component's bits + */ + inline const Nz::Bitset<>& Entity::GetComponentBits() const { return m_componentBits; } + /*! + * \brief Gets the identifier of the entity + * \return Identifier of the entity + */ + inline EntityId Entity::GetId() const { return m_id; } + /*! + * \brief Gets the bits representing the systems in the entiy + * \return A constant reference to the set of system's bits + */ + inline const Nz::Bitset<>& Entity::GetSystemBits() const { return m_systemBits; } + /*! + * \brief Gets the world in which the entity is + * \return Pointer to the world + */ + inline World* Entity::GetWorld() const { return m_world; } + /*! + * \brief Checks whether or not a component is present in the entity by index + * \return true If it is the case + * + * \param index Index of the component + */ + inline bool Entity::HasComponent(ComponentIndex index) const { return m_componentBits.UnboundedTest(index); } + /*! + * \brief Checks whether or not a component is present in the entity by type + * \return true If it is the case + */ + template bool Entity::HasComponent() const { @@ -106,16 +179,54 @@ namespace Ndk return HasComponent(index); } + /*! + * \brief Checks whether or not the entity is enabled + * \return true If it is the case + */ + inline bool Entity::IsEnabled() const { return m_enabled; } + /*! + * \brief Checks whether or not the entity is valid + * \return true If it is the case + */ + inline bool Entity::IsValid() const { return m_valid; } + /*! + * \brief Removes every components + */ + + inline void Entity::RemoveAllComponents() + { + m_removedComponentBits = m_componentBits; + + Invalidate(); + } + + /*! + * \brief Removes a component in the entity by index + * + * \param index Index of the component + */ + + inline void Entity::RemoveComponent(ComponentIndex index) + { + m_removedComponentBits.UnboundedSet(index); + + Invalidate(); + } + + /*! + * \brief Removes a component in the entity by type + */ + template void Entity::RemoveComponent() { @@ -125,19 +236,10 @@ namespace Ndk RemoveComponent(index); } - inline void Entity::RemoveAllComponents() - { - m_removedComponentBits = m_componentBits; - - Invalidate(); - } - - inline void Entity::RemoveComponent(ComponentIndex index) - { - m_removedComponentBits.UnboundedSet(index); - - Invalidate(); - } + /*! + * \brief Gives a string representation + * \return A string representation of the object: "Entity(GetId())" + */ inline Nz::String Entity::ToString() const { @@ -145,16 +247,35 @@ namespace Ndk return ss << "Entity(" << GetId() << ')'; } + /*! + * \brief Gets the bits representing the removed components in the entiy + * \return A constant reference to the set of remove component's bits + */ + inline Nz::Bitset<>& Entity::GetRemovedComponentBits() { return m_removedComponentBits; } + /*! + * \brief Registers a system for the entity + * + * \param index Index of the system + */ + inline void Entity::RegisterSystem(SystemIndex index) { m_systemBits.UnboundedSet(index); } + /*! + * \brief Sets the world of the entity + * + * \param world World in which the entity will be + * + * \remark Produces a NazaraAssert if world is invalid + */ + inline void Entity::SetWorld(World* world) noexcept { NazaraAssert(world, "An entity must be attached to a world at any time"); @@ -162,6 +283,12 @@ namespace Ndk m_world = world; } + /*! + * \brief Unregisters a system for the entity + * + * \param index Index of the system + */ + inline void Entity::UnregisterSystem(SystemIndex index) { m_systemBits.UnboundedReset(index); @@ -173,10 +300,16 @@ namespace std template<> struct hash { + /*! + * \brief Specialisation of std to hash + * \return Result of the hash + * + * \param handle Entity to hash + */ size_t operator()(const Ndk::EntityHandle& handle) const { - // Hasher le pointeur fonctionnerait jusqu'à ce que l'entité soit mise à jour et déplacée - // pour cette raison, nous devons hasher l'ID de l'entité (qui reste constante) + // Hash the pointer will work until the entity is updated and moved + // so, we have to hash the ID of the entity (which is constant) Ndk::EntityId id = (handle.IsValid()) ? handle->GetId() : std::numeric_limits::max(); return hash()(id); diff --git a/SDK/include/NDK/EntityList.inl b/SDK/include/NDK/EntityList.inl index 94fa3472f..224fdd1dc 100644 --- a/SDK/include/NDK/EntityList.inl +++ b/SDK/include/NDK/EntityList.inl @@ -7,22 +7,54 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::EntityList + * \brief NDK class that represents a set of entities to help performing batch operations + */ + + /*! + * \brief Clears the set from every entities + */ + inline void EntityList::Clear() { m_entities.clear(); m_entityBits.Clear(); } + /*! + * \brief Checks whether or not the set contains the entity + * \return true If it is the case + * + * \param entity Pointer to the entity + */ + inline bool EntityList::Has(const Entity* entity) { return entity && entity->IsValid() && Has(entity->GetId()); } + /*! + * \brief Checks whether or not the set contains the entity by id + * \return true If it is the case + * + * \param id Identifier of the entity + */ + inline bool EntityList::Has(EntityId entity) { return m_entityBits.UnboundedTest(entity); } + /*! + * \brief Inserts the entity into the set + * + * \param entity Pointer to the entity + * + * \remark If entity is already contained, no action is performed + */ + inline void EntityList::Insert(Entity* entity) { if (!Has(entity)) @@ -32,6 +64,14 @@ namespace Ndk } } + /*! + * \brief Removes the entity from the set + * + * \param entity Pointer to the entity + * + * \remark If entity is not contained, no action is performed + */ + inline void EntityList::Remove(Entity* entity) { if (Has(entity)) @@ -40,7 +80,7 @@ namespace Ndk NazaraAssert(it != m_entities.end(), "Entity should be part of the vector"); std::swap(*it, m_entities.back()); - m_entities.pop_back(); // On le sort du vector + m_entities.pop_back(); // We get it out of the vector m_entityBits.UnboundedSet(entity->GetId(), false); } } diff --git a/SDK/include/NDK/EntityOwner.inl b/SDK/include/NDK/EntityOwner.inl index 6efc2b30e..2cb64f1e8 100644 --- a/SDK/include/NDK/EntityOwner.inl +++ b/SDK/include/NDK/EntityOwner.inl @@ -8,17 +8,41 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::EntityOwner + * \brief NDK class that represents the owner of the entity and so its lifetime + */ + + /*! + * \brief Constructs a EntityOwner object + * + * \param entity Entity to own + */ + inline EntityOwner::EntityOwner(Entity* entity) : EntityOwner() { Reset(entity); } + /*! + * \brief Destructs the object and calls Reset + * + * \see Reset + */ + inline EntityOwner::~EntityOwner() { Reset(nullptr); } + /*! + * \brief Resets the ownership of the entity, previous is killed + * + * \param entity Entity to own + */ + inline void EntityOwner::Reset(Entity* entity) { if (m_object) @@ -27,12 +51,24 @@ namespace Ndk EntityHandle::Reset(entity); } + /*! + * \brief Resets the ownership of the entity by move semantic + * + * \param handle EntityOwner to move into this + */ + inline void EntityOwner::Reset(EntityOwner&& handle) { Reset(handle.GetObject()); handle.m_object = nullptr; } + /*! + * \brief Resets the ownership of the entity to the affected one + * + * \param entity Entity to own + */ + inline EntityOwner& EntityOwner::operator=(Entity* entity) { Reset(entity); diff --git a/SDK/include/NDK/LuaAPI.inl b/SDK/include/NDK/LuaAPI.inl index a09d6c459..6f1b73234 100644 --- a/SDK/include/NDK/LuaAPI.inl +++ b/SDK/include/NDK/LuaAPI.inl @@ -26,6 +26,11 @@ namespace Ndk { + /*! + * \brief Gets the internal binding for Lua + * \return A pointer to the binding + */ + inline LuaBinding* LuaAPI::GetBinding() { return s_binding; @@ -34,6 +39,15 @@ namespace Ndk namespace Nz { + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param color Resulting color + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Color* color, TypeTag) { instance.CheckType(index, Nz::LuaType_Table); @@ -46,6 +60,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param angles Resulting euler angles + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, EulerAnglesd* angles, TypeTag) { switch (instance.GetType(index)) @@ -66,6 +89,15 @@ namespace Nz } } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param angles Resulting euler angles + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, EulerAnglesf* angles, TypeTag) { EulerAnglesd anglesDouble; @@ -75,6 +107,15 @@ namespace Nz return ret; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param fontRef Resulting reference to a font + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, FontRef* fontRef, TypeTag) { *fontRef = *static_cast(instance.CheckUserdata(index, "Font")); @@ -82,6 +123,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param params Resulting parameters for a font + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, FontParams* params, TypeTag) { NazaraUnused(params); @@ -93,6 +143,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param params Resulting parameters for a mesh + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, MeshParams* params, TypeTag) { instance.CheckType(index, Nz::LuaType_Table); @@ -106,6 +165,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param rect Resulting rectangle + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Rectd* rect, TypeTag) { instance.CheckType(index, LuaType_Table); @@ -118,6 +186,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param rect Resulting rectangle + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Rectf* rect, TypeTag) { Rectd rectDouble; @@ -127,6 +204,15 @@ namespace Nz return ret; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param rect Resulting rectangle + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Rectui* rect, TypeTag) { Rectd rectDouble; @@ -136,6 +222,15 @@ namespace Nz return ret; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param quat Resulting quaternion + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Quaterniond* quat, TypeTag) { switch (instance.GetType(index)) @@ -156,6 +251,15 @@ namespace Nz } } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param quat Resulting quaternion + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Quaternionf* quat, TypeTag) { Quaterniond quatDouble; @@ -165,6 +269,15 @@ namespace Nz return ret; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param address Resulting IP address + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, IpAddress* address, TypeTag) { switch (instance.GetType(index)) @@ -179,6 +292,15 @@ namespace Nz } } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param vec Resulting vector2D + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector2d* vec, TypeTag) { switch (instance.GetType(index)) @@ -200,6 +322,15 @@ namespace Nz } } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param vec Resulting vector2D + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector2f* vec, TypeTag) { Vector2d vecDouble; @@ -209,6 +340,15 @@ namespace Nz return ret; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param vec Resulting vector2D + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector2ui* vec, TypeTag) { Vector2d vecDouble; @@ -218,6 +358,15 @@ namespace Nz return ret; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param vec Resulting vector3D + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector3d* vec, TypeTag) { switch (instance.GetType(index)) @@ -239,6 +388,15 @@ namespace Nz } } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param vec Resulting vector3D + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector3f* vec, TypeTag) { Vector3d vecDouble; @@ -248,6 +406,15 @@ namespace Nz return ret; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param vec Resulting vector3D + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector3ui* vec, TypeTag) { Vector3d vecDouble; @@ -257,6 +424,15 @@ namespace Nz return ret; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param handle Resulting entity + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Ndk::EntityHandle* handle, TypeTag) { *handle = *static_cast(instance.CheckUserdata(index, "Entity")); @@ -264,6 +440,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param handle Resulting world + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Ndk::WorldHandle* handle, TypeTag) { *handle = *static_cast(instance.CheckUserdata(index, "World")); @@ -272,6 +457,16 @@ namespace Nz } #ifndef NDK_SERVER + + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param renderable Resulting reference to a instanced renderable + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, InstancedRenderableRef* renderable, TypeTag) { if (instance.IsOfType(index, "InstancedRenderable")) @@ -281,6 +476,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param params Resulting parameters for a material + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, MaterialParams* params, TypeTag) { instance.CheckType(index, Nz::LuaType_Table); @@ -295,6 +499,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param params Resulting parameters for a model + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, ModelParameters* params, TypeTag) { instance.CheckType(index, Nz::LuaType_Table); @@ -307,6 +520,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param params Resulting parameters for a music + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, MusicParams* params, TypeTag) { instance.CheckType(index, Nz::LuaType_Table); @@ -316,6 +538,15 @@ namespace Nz return 1; } + /*! + * \brief Queries arguments for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param index Index type + * \param params Resulting parameters for a sound buffer + */ + inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, SoundBufferParams* params, TypeTag) { instance.CheckType(index, Nz::LuaType_Table); @@ -324,9 +555,16 @@ namespace Nz return 1; } + #endif - + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting euler angles + */ inline int LuaImplReplyVal(const LuaInstance& instance, EulerAnglesd&& val, TypeTag) { @@ -334,18 +572,42 @@ namespace Nz return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting euler angles + */ + inline int LuaImplReplyVal(const LuaInstance& instance, EulerAnglesf&& val, TypeTag) { instance.PushInstance("EulerAngles", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting reference to a font + */ + inline int LuaImplReplyVal(const LuaInstance& instance, FontRef&& val, TypeTag) { instance.PushInstance("Font", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting size information for a font + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Font::SizeInfo&& val, TypeTag) { instance.PushTable(); @@ -357,114 +619,266 @@ namespace Nz return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting quaternion + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Quaterniond&& val, TypeTag) { instance.PushInstance("Quaternion", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting quaternion + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Quaternionf&& val, TypeTag) { instance.PushInstance("Quaternion", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting IP address + */ + inline int LuaImplReplyVal(const LuaInstance& instance, IpAddress&& val, TypeTag) { instance.PushInstance("IpAddress", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting rectangle + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Rectd&& val, TypeTag) { instance.PushInstance("Rect", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting rectangle + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Rectf&& val, TypeTag) { instance.PushInstance("Rect", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting rectangle + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Rectui&& val, TypeTag) { instance.PushInstance("Rect", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting vector2D + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Vector2d&& val, TypeTag) { instance.PushInstance("Vector2", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting vector2D + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Vector2f&& val, TypeTag) { instance.PushInstance("Vector2", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting vector2D + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Vector2ui&& val, TypeTag) { instance.PushInstance("Vector2", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting vector3D + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Vector3d&& val, TypeTag) { instance.PushInstance("Vector3", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting vector3D + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Vector3f&& val, TypeTag) { instance.PushInstance("Vector3", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting vector3D + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Vector3ui&& val, TypeTag) { instance.PushInstance("Vector3", val); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param ptr Resulting entity + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::Entity* ptr, TypeTag) { instance.PushInstance("Entity", ptr); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param ptr Resulting application + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::Application* ptr, TypeTag) { instance.PushInstance("Application", ptr); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param handle Resulting entity + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::EntityHandle&& handle, TypeTag) { instance.PushInstance("Entity", handle); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param handle Resulting node component + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::NodeComponentHandle&& handle, TypeTag) { instance.PushInstance("NodeComponent", handle); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param handle Resulting velocity component + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::VelocityComponentHandle&& handle, TypeTag) { instance.PushInstance("VelocityComponent", handle); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param ptr Resulting world + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::World* ptr, TypeTag) { instance.PushInstance("World", ptr); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param ptr Resulting world + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::WorldHandle&& handle, TypeTag) { instance.PushInstance("World", handle); @@ -472,22 +886,49 @@ namespace Nz } #ifndef NDK_SERVER + + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param handle Resulting console + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::ConsoleHandle&& handle, TypeTag) { instance.PushInstance("Console", handle); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param handle Resulting graphics component + */ + inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::GraphicsComponentHandle&& handle, TypeTag) { instance.PushInstance("GraphicsComponent", handle); return 1; } + /*! + * \brief Replies by value for Lua + * \return 1 in case of success + * + * \param instance Lua instance to interact with + * \param val Resulting sound buffer + */ + inline int LuaImplReplyVal(const LuaInstance& instance, const SoundBuffer* val, TypeTag) { instance.PushInstance("SoundBuffer", val); return 1; } + #endif + } diff --git a/SDK/include/NDK/LuaBinding.inl b/SDK/include/NDK/LuaBinding.inl index 64e3eb453..e4ae72254 100644 --- a/SDK/include/NDK/LuaBinding.inl +++ b/SDK/include/NDK/LuaBinding.inl @@ -6,6 +6,14 @@ namespace Ndk { + /*! + * \brief Binds a component to a name + * + * \param name Name used to retrieve the component + * + * \remark Produces a NazaraAssert if name is empty + */ + template void LuaBinding::BindComponent(const Nz::String& name) { @@ -24,6 +32,16 @@ namespace Ndk m_componentBindingByName[name] = T::componentIndex; } + /*! + * \brief Adds a component to an entity + * \return 1 in case of success + * + * \param instance Lua instance that will interact with the component + * \param handle Entity which component will be added to + * + * \remark T must be a subtype of BaseComponent + */ + template int AddComponentOfType(Nz::LuaInstance& lua, EntityHandle& handle) { @@ -34,6 +52,16 @@ namespace Ndk return 1; } + /*! + * \brief Pushes a component + * \return 1 in case of success + * + * \param instance Lua instance that will interact with the component + * \param component Component that will be pushed + * + * \remark T must be a subtype of BaseComponent + */ + template int PushComponentOfType(Nz::LuaInstance& lua, BaseComponent& component) { diff --git a/SDK/include/NDK/Prerequesites.hpp b/SDK/include/NDK/Prerequesites.hpp index d75ed0eb0..f3532c70d 100644 --- a/SDK/include/NDK/Prerequesites.hpp +++ b/SDK/include/NDK/Prerequesites.hpp @@ -27,11 +27,11 @@ #include -// Version du SDK +// Version of SDK #define NDK_VERSION_MAJOR 0 #define NDK_VERSION_MINOR 1 -// Importation/Exportation de l'API +// Importation/Exportation of the API #if defined(NAZARA_PLATFORM_WINDOWS) #if !defined(NDK_STATIC) #ifdef NDK_BUILD @@ -49,7 +49,7 @@ #define NDK_API #endif #else - // À commenter pour tenter quand même une compilation + // To comment to force a compilation #error This operating system is not fully supported by the Nazara Development Kit #define NDK_API diff --git a/SDK/include/NDK/Sdk.inl b/SDK/include/NDK/Sdk.inl index 0bdc1e2cd..3cbafab66 100644 --- a/SDK/include/NDK/Sdk.inl +++ b/SDK/include/NDK/Sdk.inl @@ -4,6 +4,11 @@ namespace Ndk { + /*! + * \brief Checks whether the module is initialized + * \return true if module is initialized + */ + inline bool Sdk::IsInitialized() { return s_referenceCounter != 0; diff --git a/SDK/include/NDK/StateMachine.inl b/SDK/include/NDK/StateMachine.inl index 7b5109ab5..c522f5431 100644 --- a/SDK/include/NDK/StateMachine.inl +++ b/SDK/include/NDK/StateMachine.inl @@ -8,6 +8,21 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::StateMachine + * \brief NDK class that represents a state machine, to represent the multiple states of your program + */ + + /*! + * \brief Constructs a StateMachine object with an original state + * + * \param originalState State which is the entry point of the application + * + * \remark Calls "Enter" on the state + * \remark Produces a NazaraAssert if nullptr is given + */ + inline StateMachine::StateMachine(std::shared_ptr originalState) : m_currentState(std::move(originalState)) { @@ -15,22 +30,45 @@ namespace Ndk m_currentState->Enter(*this); } + /*! + * \brief Destructs the object + * + * \remark Calls "Leave" on the state + */ + inline StateMachine::~StateMachine() { m_currentState->Leave(*this); } + /*! + * \brief Changes the current state of the machine + * + * \param state Next state to represent + */ inline void StateMachine::ChangeState(std::shared_ptr state) { m_nextState = std::move(state); } + /*! + * \brief Gets the current state of the machine + * \return A constant reference to the state + */ + inline const std::shared_ptr& StateMachine::GetCurrentState() const { return m_currentState; } + /*! + * \brief Updates the state + * \return True if update is successful + * + * \param elapsedTime Delta time used for the update + */ + inline bool StateMachine::Update(float elapsedTime) { if (m_nextState) diff --git a/SDK/include/NDK/System.hpp b/SDK/include/NDK/System.hpp index 6d1d423dc..b5a50f76f 100644 --- a/SDK/include/NDK/System.hpp +++ b/SDK/include/NDK/System.hpp @@ -11,7 +11,7 @@ namespace Ndk { - template + template class System : public BaseSystem { public: @@ -20,7 +20,7 @@ namespace Ndk System(System&&) = default; virtual ~System(); - BaseSystem* Clone() const override; + std::unique_ptr Clone() const override; System& operator=(const System&) = delete; System& operator=(System&&) = default; diff --git a/SDK/include/NDK/System.inl b/SDK/include/NDK/System.inl index 9b382d924..d0359cc63 100644 --- a/SDK/include/NDK/System.inl +++ b/SDK/include/NDK/System.inl @@ -7,6 +7,18 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::System + * \brief NDK class that represents a system which interacts on a world + * + * \remark This class is meant to be derived as CRTP: "System" + */ + + /*! + * \brief Constructs a System object by default + */ + template System::System() : BaseSystem(GetSystemIndex()) @@ -16,15 +28,26 @@ namespace Ndk template System::~System() = default; + /*! + * \brief Clones the system + * \return The clone newly created + * + * \remark The system to clone should be trivially copy constructible + */ + template - BaseSystem* System::Clone() const + std::unique_ptr System::Clone() const { - ///FIXME: Pas encore supporté par GCC (4.9.2) + ///FIXME: Not fully supported in GCC (4.9.2) //static_assert(std::is_trivially_copy_constructible::value, "SystemType should be copy-constructible"); - return new SystemType(static_cast(*this)); + return std::make_unique(static_cast(*this)); } + /*! + * \brief Registers the system by assigning it an index + */ + template SystemIndex System::RegisterSystem() { diff --git a/SDK/include/NDK/Systems/PhysicsSystem.inl b/SDK/include/NDK/Systems/PhysicsSystem.inl index e9fb52c49..bfe886cb1 100644 --- a/SDK/include/NDK/Systems/PhysicsSystem.inl +++ b/SDK/include/NDK/Systems/PhysicsSystem.inl @@ -4,11 +4,21 @@ namespace Ndk { + /*! + * \brief Gets the physical world + * \return A reference to the physical world + */ + inline Nz::PhysWorld& PhysicsSystem::GetWorld() { return m_world; } + /*! + * \brief Gets the physical world + * \return A constant reference to the physical world + */ + inline const Nz::PhysWorld& PhysicsSystem::GetWorld() const { return m_world; diff --git a/SDK/include/NDK/Systems/RenderSystem.inl b/SDK/include/NDK/Systems/RenderSystem.inl index 4f7afe63d..4b758aa92 100644 --- a/SDK/include/NDK/Systems/RenderSystem.inl +++ b/SDK/include/NDK/Systems/RenderSystem.inl @@ -4,58 +4,119 @@ namespace Ndk { + /*! + * \brief Constructs a RenderSystem object by copy semantic + * + * \param renderSystem RenderSystem to copy + */ + inline RenderSystem::RenderSystem(const RenderSystem& renderSystem) : System(renderSystem) { } + /*! + * \brief Changes the render technique used for the system + * \return A reference to the render technique type + */ + template inline T& RenderSystem::ChangeRenderTechnique() { + static_assert(std::is_base_of::value, "RenderTechnique is not a subtype of AbstractRenderTechnique"); return static_cast(ChangeRenderTechnique(std::make_unique())); } + /*! + * \brief Changes the render technique used for the system + * \return A reference to the abstract render technique + * + * \param renderTechnique Render technique to use + */ + inline Nz::AbstractRenderTechnique& RenderSystem::ChangeRenderTechnique(std::unique_ptr&& renderTechnique) { m_renderTechnique = std::move(renderTechnique); return *m_renderTechnique.get(); } + /*! + * \brief Gets the background used for rendering + * \return A reference to the background + */ + inline const Nz::BackgroundRef& RenderSystem::GetDefaultBackground() const { return m_background; } + /*! + * \brief Gets the coordinates matrix used for rendering + * \return A constant reference to the matrix of coordinates + */ + inline const Nz::Matrix4f& RenderSystem::GetCoordinateSystemMatrix() const { return m_coordinateSystemMatrix; } + /*! + * \brief Gets the "forward" global direction + * \return The forward direction, by default, it's -UnitZ() (Right hand coordinates) + */ + inline Nz::Vector3f RenderSystem::GetGlobalForward() const { return Nz::Vector3f(-m_coordinateSystemMatrix.m13, -m_coordinateSystemMatrix.m23, -m_coordinateSystemMatrix.m33); } + /*! + * \brief Gets the "right" global direction + * \return The right direction, by default, it's UnitX() (Right hand coordinates) + */ + inline Nz::Vector3f RenderSystem::GetGlobalRight() const { return Nz::Vector3f(m_coordinateSystemMatrix.m11, m_coordinateSystemMatrix.m21, m_coordinateSystemMatrix.m31); } + /*! + * \brief Gets the "up" global direction + * \return The up direction, by default, it's UnitY() (Right hand coordinates) + */ + inline Nz::Vector3f RenderSystem::GetGlobalUp() const { return Nz::Vector3f(m_coordinateSystemMatrix.m12, m_coordinateSystemMatrix.m22, m_coordinateSystemMatrix.m32); } + /*! + * \brief Gets the render technique used for rendering + * \return A reference to the abstract render technique being used + */ + inline Nz::AbstractRenderTechnique& RenderSystem::GetRenderTechnique() const { return *m_renderTechnique.get(); } + /*! + * \brief Sets the background used for rendering + * + * \param background A reference to the background + */ + inline void RenderSystem::SetDefaultBackground(Nz::BackgroundRef background) { m_background = std::move(background); } + /*! + * \brief Sets the "forward" global direction + * + * \param direction The new forward direction + */ + inline void RenderSystem::SetGlobalForward(const Nz::Vector3f& direction) { m_coordinateSystemMatrix.m13 = -direction.x; @@ -65,6 +126,12 @@ namespace Ndk InvalidateCoordinateSystem(); } + /*! + * \brief Sets the "right" global direction + * + * \param direction The new right direction + */ + inline void RenderSystem::SetGlobalRight(const Nz::Vector3f& direction) { m_coordinateSystemMatrix.m11 = direction.x; @@ -74,6 +141,12 @@ namespace Ndk InvalidateCoordinateSystem(); } + /*! + * \brief Sets the "up" global direction + * + * \param direction The new up direction + */ + inline void RenderSystem::SetGlobalUp(const Nz::Vector3f& direction) { m_coordinateSystemMatrix.m12 = direction.x; @@ -83,6 +156,10 @@ namespace Ndk InvalidateCoordinateSystem(); } + /*! + * \brief Invalidates the matrix of coordinates for the system + */ + inline void RenderSystem::InvalidateCoordinateSystem() { m_coordinateSystemInvalidated = true; diff --git a/SDK/include/NDK/World.hpp b/SDK/include/NDK/World.hpp index 2e20d03a9..5d1dabb77 100644 --- a/SDK/include/NDK/World.hpp +++ b/SDK/include/NDK/World.hpp @@ -43,7 +43,6 @@ namespace Ndk inline EntityList CreateEntities(unsigned int count); void Clear() noexcept; - const EntityHandle& CloneEntity(EntityId id); const EntityHandle& GetEntity(EntityId id); diff --git a/SDK/include/NDK/World.inl b/SDK/include/NDK/World.inl index ba2b33bd4..9960aef05 100644 --- a/SDK/include/NDK/World.inl +++ b/SDK/include/NDK/World.inl @@ -7,47 +7,80 @@ namespace Ndk { + /*! + * \brief Constructs a World object + * + * \param addDefaultSystems Should default provided systems be used + */ + inline World::World(bool addDefaultSystems) { if (addDefaultSystems) AddDefaultSystems(); } + /*! + * \brief Constructs a World object by move semantic + * + * \param world World to move into this + */ + inline World::World(World&& world) noexcept : HandledObject(std::move(world)) { operator=(std::move(world)); } + /*! + * \brief Adds a system to the world + * \return A reference to the newly created system + * + * \param system System to add to the world + */ + inline BaseSystem& World::AddSystem(std::unique_ptr&& system) { NazaraAssert(system, "System must be valid"); SystemIndex index = system->GetIndex(); - // Nous nous assurons que le vecteur de component est suffisamment grand pour contenir le nouveau component + // We must ensure that the vector is big enough to hold the new system if (index >= m_systems.size()) m_systems.resize(index + 1); - // Affectation et retour du système + // Affectation and return of system m_systems[index] = std::move(system); m_systems[index]->SetWorld(this); - Invalidate(); // On force une mise à jour de toutes les entités + Invalidate(); // We force an update for every entities return *m_systems[index].get(); } + /*! + * \brief Adds a system to the world + * \return A reference to the newly created system + * + * \param args Arguments used to create the system + */ + template SystemType& World::AddSystem(Args&&... args) { static_assert(std::is_base_of::value, "SystemType is not a component"); - // Allocation et affectation du component + // Allocation and affectation of the system std::unique_ptr ptr(new SystemType(std::forward(args)...)); return static_cast(AddSystem(std::move(ptr))); } + /*! + * \brief Creates multiple entities in the world + * \return The set of entities created + * + * \param count Number of entities to create + */ + inline World::EntityList World::CreateEntities(unsigned int count) { EntityList list; @@ -59,14 +92,27 @@ namespace Ndk return list; } + /*! + * \brief Gets every entities in the world + * \return A constant reference to the entities + */ + inline const World::EntityList& World::GetEntities() { return m_aliveEntities; } + /*! + * \brief Gets a system in the world by index + * \return A reference to the system + * + * \param index Index of the system + * + * \remark Produces a NazaraAssert if system is not available in this world + */ + inline BaseSystem& World::GetSystem(SystemIndex index) { - ///DOC: Le système doit être présent NazaraAssert(HasSystem(index), "This system is not part of the world"); BaseSystem* system = m_systems[index].get(); @@ -75,21 +121,39 @@ namespace Ndk return *system; } + /*! + * \brief Gets a system in the world by type + * \return A reference to the system + * + * \remark Produces a NazaraAssert if system is not available in this world + */ + template SystemType& World::GetSystem() { - ///DOC: Le système doit être présent static_assert(std::is_base_of::value, "SystemType is not a system"); SystemIndex index = GetSystemIndex(); return static_cast(GetSystem(index)); } + /*! + * \brief Checks whether or not a system is present in the world by index + * \return true If it is the case + * + * \param index Index of the system + */ + inline bool World::HasSystem(SystemIndex index) const { return index < m_systems.size() && m_systems[index]; } + /*! + * \brief Checks whether or not a system is present in the world by type + * \return true If it is the case + */ + template bool World::HasSystem() const { @@ -99,34 +163,69 @@ namespace Ndk return HasSystem(index); } + /*! + * \brief Kills a set of entities + * + * \param list Set of entities to kill + */ + inline void World::KillEntities(const EntityList& list) { for (const EntityHandle& entity : list) KillEntity(entity); } + /*! + * \brief Checks whether or not an entity is valid + * \return true If it is the case + * + * \param entity Pointer to the entity + */ + inline bool World::IsEntityValid(const Entity* entity) const { return entity && entity->GetWorld() == this && IsEntityIdValid(entity->GetId()); } + /*! + * \brief Checks whether or not an entity is valid + * \return true If it is the case + * + * \param id Identifier of the entity + */ + inline bool World::IsEntityIdValid(EntityId id) const { return id < m_entities.size() && m_entities[id].entity.IsValid(); } + /*! + * \brief Removes each system from the world + */ + inline void World::RemoveAllSystems() { m_systems.clear(); } + /*! + * \brief Removes a system from the world by index + * + * \param index Index of the system + * + * \remark No change is done if system is not present + */ + inline void World::RemoveSystem(SystemIndex index) { - ///DOC: N'a aucun effet si le système n'est pas présent if (HasSystem(index)) m_systems[index].reset(); } + /*! + * \brief Removes a system from the world by type + */ + template void World::RemoveSystem() { @@ -136,6 +235,12 @@ namespace Ndk RemoveSystem(index); } + /*! + * \brief Updates the world + * + * \param elapsedTime Delta time used for the update + */ + inline void World::Update(float elapsedTime) { Update(); //< Update entities @@ -148,17 +253,32 @@ namespace Ndk } } + /*! + * \brief Invalidates each entity in the world + */ + inline void World::Invalidate() { m_dirtyEntities.Resize(m_entities.size(), false); - m_dirtyEntities.Set(true); // Activation de tous les bits + m_dirtyEntities.Set(true); // Activation of all bits } + /*! + * \brief Invalidates an entity in the world + * + * \param id Identifier of the entity + */ + inline void World::Invalidate(EntityId id) { m_dirtyEntities.UnboundedSet(id, true); } + /*! + * \brief Moves a world into another world object + * \return A reference to the object + */ + inline World& World::operator=(World&& world) noexcept { m_aliveEntities = std::move(world.m_aliveEntities); diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index df2dfa12c..5e3331d73 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -6,6 +6,16 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::Application + * \brief NDK class that represents the application, it offers a set of tools to ease the development + */ + + /*! + * \brief Runs the application by updating worlds, taking care about windows, ... + */ + bool Application::Run() { #ifndef NDK_SERVER diff --git a/SDK/src/NDK/BaseComponent.cpp b/SDK/src/NDK/BaseComponent.cpp index 1a0b85168..39d67d211 100644 --- a/SDK/src/NDK/BaseComponent.cpp +++ b/SDK/src/NDK/BaseComponent.cpp @@ -6,22 +6,50 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::BaseComponent + * \brief NDK class that represents the common base of all components + * + * \remark This class is meant to be purely abstract, for type erasure + */ + BaseComponent::~BaseComponent() = default; + /*! + * \brief Operation to perform when component is attached to an entity + */ + void BaseComponent::OnAttached() { } + /*! + * \brief Operation to perform when component is attached to this component + * + * \param component Component being attached + */ + void BaseComponent::OnComponentAttached(BaseComponent& component) { NazaraUnused(component); } + /*! + * \brief Operation to perform when component is detached from this component + * + * \param component Component being detached + */ + void BaseComponent::OnComponentDetached(BaseComponent& component) { NazaraUnused(component); } + /*! + * \brief Operation to perform when component is detached from an entity + */ + void BaseComponent::OnDetached() { } diff --git a/SDK/src/NDK/BaseSystem.cpp b/SDK/src/NDK/BaseSystem.cpp index a69f13550..8a2a9dce5 100644 --- a/SDK/src/NDK/BaseSystem.cpp +++ b/SDK/src/NDK/BaseSystem.cpp @@ -6,12 +6,31 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::BaseSystem + * \brief NDK class that represents the common base of all systems + * + * \remark This class is meant to be purely abstract, for type erasure + */ + + /*! + * \brief Destructs the object and unregisters it-self on every entities + */ + BaseSystem::~BaseSystem() { for (const EntityHandle& entity : m_entities) entity->UnregisterSystem(m_systemIndex); } + /*! + * \brief Checks whether the key of the entity matches the lock of the system + * \return true If it is the case + * + * \param Pointer to the entity + */ + bool BaseSystem::Filters(const Entity* entity) const { if (!entity) @@ -21,13 +40,13 @@ namespace Ndk m_filterResult.PerformsAND(m_requiredComponents, components); if (m_filterResult != m_requiredComponents) - return false; // Au moins un component requis n'est pas présent + return false; // At least one required component is not available m_filterResult.PerformsAND(m_excludedComponents, components); if (m_filterResult.TestAny()) - return false; // Au moins un component exclu est présent + return false; // At least one excluded component is available - // Si nous avons une liste de composants nécessaires + // If we have a list of needed components if (m_requiredAnyComponents.TestAny()) { if (!m_requiredAnyComponents.Intersects(components)) @@ -37,16 +56,35 @@ namespace Ndk return true; } + /*! + * \brief Operation to perform when entity is added to the system + * + * \param Pointer to the entity + */ + void BaseSystem::OnEntityAdded(Entity* entity) { NazaraUnused(entity); } + /*! + * \brief Operation to perform when entity is removed to the system + * + * \param Pointer to the entity + */ + void BaseSystem::OnEntityRemoved(Entity* entity) { NazaraUnused(entity); } + /*! + * \brief Operation to perform when entity is validated for the system + * + * \param entity Pointer to the entity + * \param justAdded Is the entity newly added + */ + void BaseSystem::OnEntityValidation(Entity* entity, bool justAdded) { NazaraUnused(entity); diff --git a/SDK/src/NDK/Components/CameraComponent.cpp b/SDK/src/NDK/Components/CameraComponent.cpp index 1b7a3e06d..71c653823 100644 --- a/SDK/src/NDK/Components/CameraComponent.cpp +++ b/SDK/src/NDK/Components/CameraComponent.cpp @@ -9,6 +9,18 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::CameraComponent + * \brief NDK class that represents the component for camera + */ + + /*! + * \brief Applys the view of the camera + * + * \remark Produces a NazaraAssert if the camera has no target + */ + void CameraComponent::ApplyView() const { NazaraAssert(m_target, "CameraComponent has no target"); @@ -23,6 +35,12 @@ namespace Ndk Nz::Renderer::SetViewport(m_viewport); } + /*! + * \brief Gets the eye position of the camera + * + * \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent + */ + Nz::Vector3f CameraComponent::GetEyePosition() const { NazaraAssert(m_entity && m_entity->HasComponent(), "CameraComponent requires NodeComponent"); @@ -30,6 +48,12 @@ namespace Ndk return m_entity->GetComponent().GetPosition(); } + /*! + * \brief Gets the forward direction of the camera + * + * \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent + */ + Nz::Vector3f CameraComponent::GetForward() const { NazaraAssert(m_entity && m_entity->HasComponent(), "CameraComponent requires NodeComponent"); @@ -37,6 +61,12 @@ namespace Ndk return m_entity->GetComponent().GetForward(); } + /*! + * \brief Sets the layer of the camera in case of multiples fields + * + * \param layer Layer of the camera + */ + void CameraComponent::SetLayer(unsigned int layer) { m_layer = layer; @@ -44,6 +74,10 @@ namespace Ndk m_entity->Invalidate(); // Invalidate the entity to make it passes through RenderSystem validation } + /*! + * \brief Operation to perform when component is attached to an entity + */ + void CameraComponent::OnAttached() { if (m_entity->HasComponent()) @@ -52,6 +86,12 @@ namespace Ndk InvalidateViewMatrix(); } + /*! + * \brief Operation to perform when component is attached to this component + * + * \param component Component being attached + */ + void CameraComponent::OnComponentAttached(BaseComponent& component) { if (IsComponent(component)) @@ -63,6 +103,12 @@ namespace Ndk } } + /*! + * \brief Operation to perform when component is detached from this component + * + * \param component Component being detached + */ + void CameraComponent::OnComponentDetached(BaseComponent& component) { if (IsComponent(component)) @@ -73,6 +119,10 @@ namespace Ndk } } + /*! + * \brief Operation to perform when component is detached from an entity + */ + void CameraComponent::OnDetached() { m_nodeInvalidationSlot.Disconnect(); @@ -80,6 +130,12 @@ namespace Ndk InvalidateViewMatrix(); } + /*! + * \brief Operation to perform when the node is invalidated + * + * \param node Pointer to the node + */ + void CameraComponent::OnNodeInvalidated(const Nz::Node* node) { NazaraUnused(node); @@ -88,6 +144,12 @@ namespace Ndk InvalidateViewMatrix(); } + /*! + * \brief Operation to perform when the render target is released + * + * \param renderTarget Pointer to the RenderTarget + */ + void CameraComponent::OnRenderTargetRelease(const Nz::RenderTarget* renderTarget) { if (renderTarget == m_target) @@ -96,6 +158,12 @@ namespace Ndk NazaraInternalError("Not listening to " + Nz::String::Pointer(renderTarget)); } + /*! + * \brief Operation to perform when the render target has its size changed + * + * \param renderTarget Pointer to the RenderTarget + */ + void CameraComponent::OnRenderTargetSizeChange(const Nz::RenderTarget* renderTarget) { if (renderTarget == m_target) @@ -104,6 +172,10 @@ namespace Ndk NazaraInternalError("Not listening to " + Nz::String::Pointer(renderTarget)); } + /*! + * \brief Updates the frustum of the camera + */ + void CameraComponent::UpdateFrustum() const { EnsureProjectionMatrixUpdate(); @@ -114,6 +186,10 @@ namespace Ndk m_frustumUpdated = true; } + /*! + * \brief Updates the project matrix of the camera + */ + void CameraComponent::UpdateProjectionMatrix() const { switch (m_projectionType) @@ -139,6 +215,12 @@ namespace Ndk m_projectionMatrixUpdated = true; } + /*! + * \brief Updates the view matrix of the camera + * + * \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent + */ + void CameraComponent::UpdateViewMatrix() const { NazaraAssert(m_entity && m_entity->HasComponent(), "CameraComponent requires NodeComponent"); @@ -150,6 +232,12 @@ namespace Ndk m_viewMatrixUpdated = true; } + /*! + * \brief Updates the view port of the camera + * + * \remark Produces a NazaraAssert if entity has no target + */ + void CameraComponent::UpdateViewport() const { NazaraAssert(m_target, "CameraComponent has no target"); diff --git a/SDK/src/NDK/Components/CollisionComponent.cpp b/SDK/src/NDK/Components/CollisionComponent.cpp index 49e8d8328..0f812e73b 100644 --- a/SDK/src/NDK/Components/CollisionComponent.cpp +++ b/SDK/src/NDK/Components/CollisionComponent.cpp @@ -11,13 +11,27 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::CollisionComponent + * \brief NDK class that represents the component for collision (meant for static objects) + */ + + /*! + * \brief Sets geometry for the entity + * + * \param geom Geometry used for collisions + * + * \remark Produces a NazaraAssert if the entity has no physics component and has no static body + */ + void CollisionComponent::SetGeom(Nz::PhysGeomRef geom) { m_geom = std::move(geom); if (m_entity->HasComponent()) { - // On met à jour la géométrie du PhysObject associé au PhysicsComponent + // We update the geometry of the PhysiscsObject linked to the PhysicsComponent PhysicsComponent& physComponent = m_entity->GetComponent(); physComponent.GetPhysObject().SetGeom(m_geom); } @@ -28,6 +42,13 @@ namespace Ndk } } + /*! + * \brief Initializes the static body + * + * \remark Produces a NazaraAssert if entity is invalid + * \remark Produces a NazaraAssert if entity is not linked to a world, or the world has no physics system + */ + void CollisionComponent::InitializeStaticBody() { NazaraAssert(m_entity, "Invalid entity"); @@ -41,24 +62,44 @@ namespace Ndk m_staticBody->EnableAutoSleep(false); } + /*! + * \brief Operation to perform when component is attached to an entity + */ + void CollisionComponent::OnAttached() { if (!m_entity->HasComponent()) InitializeStaticBody(); } + /*! + * \brief Operation to perform when component is attached to this component + * + * \param component Component being attached + */ + void CollisionComponent::OnComponentAttached(BaseComponent& component) { if (IsComponent(component)) m_staticBody.reset(); } + /*! + * \brief Operation to perform when component is detached from this component + * + * \param component Component being detached + */ + void CollisionComponent::OnComponentDetached(BaseComponent& component) { if (IsComponent(component)) InitializeStaticBody(); } + /*! + * \brief Operation to perform when component is detached from an entity + */ + void CollisionComponent::OnDetached() { m_staticBody.reset(); diff --git a/SDK/src/NDK/Components/GraphicsComponent.cpp b/SDK/src/NDK/Components/GraphicsComponent.cpp index 88ccd4ca1..759d3f24b 100644 --- a/SDK/src/NDK/Components/GraphicsComponent.cpp +++ b/SDK/src/NDK/Components/GraphicsComponent.cpp @@ -9,7 +9,23 @@ namespace Ndk { - void GraphicsComponent::InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, std::size_t index) + /*! + * \ingroup NDK + * \class Ndk::GraphicsComponent + * \brief NDK class that represents the component for graphics + */ + + /*! + * \brief Invalidates the data for renderable + * + * \param renderable Renderable to invalidate + * \param flags Flags for the instance + * \param index Index of the renderable to invalidate + * + * \remark Produces a NazaraAssert if index is out of bound + */ + + void GraphicsComponent::InvalidateRenderableData(const Nz::InstancedRenderable* renderable , Nz::UInt32 flags, std::size_t index) { NazaraAssert(index < m_renderables.size(), "Invalid renderable index"); NazaraUnused(renderable); @@ -19,6 +35,10 @@ namespace Ndk r.renderable->InvalidateData(&r.data, flags); } + /*! + * \brief Operation to perform when component is attached to an entity + */ + void GraphicsComponent::OnAttached() { if (m_entity->HasComponent()) @@ -27,6 +47,12 @@ namespace Ndk InvalidateTransformMatrix(); } + /*! + * \brief Operation to perform when component is attached to this component + * + * \param component Component being attached + */ + void GraphicsComponent::OnComponentAttached(BaseComponent& component) { if (IsComponent(component)) @@ -38,6 +64,12 @@ namespace Ndk } } + /*! + * \brief Operation to perform when component is detached from this component + * + * \param component Component being detached + */ + void GraphicsComponent::OnComponentDetached(BaseComponent& component) { if (IsComponent(component)) @@ -48,6 +80,10 @@ namespace Ndk } } + /*! + * \brief Operation to perform when component is detached from an entity + */ + void GraphicsComponent::OnDetached() { m_nodeInvalidationSlot.Disconnect(); @@ -55,6 +91,12 @@ namespace Ndk InvalidateTransformMatrix(); } + /*! + * \brief Operation to perform when the node is invalidated + * + * \param node Pointer to the node + */ + void GraphicsComponent::OnNodeInvalidated(const Nz::Node* node) { NazaraUnused(node); @@ -63,6 +105,10 @@ namespace Ndk InvalidateTransformMatrix(); } + /*! + * \brief Updates the bounding volume + */ + void GraphicsComponent::UpdateBoundingVolume() const { EnsureTransformMatrixUpdate(); @@ -75,6 +121,12 @@ namespace Ndk m_boundingVolumeUpdated = true; } + /*! + * \brief Updates the transform matrix of the renderable + * + * \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent + */ + void GraphicsComponent::UpdateTransformMatrix() const { NazaraAssert(m_entity && m_entity->HasComponent(), "GraphicsComponent requires NodeComponent"); diff --git a/SDK/src/NDK/Components/ParticleEmitterComponent.cpp b/SDK/src/NDK/Components/ParticleEmitterComponent.cpp index 2ae4365e6..e700b6497 100644 --- a/SDK/src/NDK/Components/ParticleEmitterComponent.cpp +++ b/SDK/src/NDK/Components/ParticleEmitterComponent.cpp @@ -7,6 +7,19 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::ParticleEmitterComponent + * \brief NDK class that represents the component emitter of particles + */ + + /*! + * \brief Sets up the particles + * + * \param mapper Mapper containing layout information of each particle + * \param count Number of particles + */ + void ParticleEmitterComponent::SetupParticles(Nz::ParticleMapper& mapper, unsigned int count) const { if (m_isActive && m_setupFunc) diff --git a/SDK/src/NDK/Components/PhysicsComponent.cpp b/SDK/src/NDK/Components/PhysicsComponent.cpp index cc23c0954..6cfd1077d 100644 --- a/SDK/src/NDK/Components/PhysicsComponent.cpp +++ b/SDK/src/NDK/Components/PhysicsComponent.cpp @@ -12,6 +12,18 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::PhysicsComponent + * \brief NDK class that represents the component for physics (meant for dynamic objects) + */ + + /*! + * \brief Operation to perform when component is attached to an entity + * + * \remark Produces a NazaraAssert if the world does not have a physics system + */ + void PhysicsComponent::OnAttached() { World* entityWorld = m_entity->GetWorld(); @@ -33,6 +45,14 @@ namespace Ndk m_object->SetMass(1.f); } + /*! + * \brief Operation to perform when component is attached to this component + * + * \param component Component being attached + * + * \remark Produces a NazaraAssert if physical object is invalid + */ + void PhysicsComponent::OnComponentAttached(BaseComponent& component) { if (IsComponent(component)) @@ -42,6 +62,14 @@ namespace Ndk } } + /*! + * \brief Operation to perform when component is detached from this component + * + * \param component Component being detached + * + * \remark Produces a NazaraAssert if physical object is invalid + */ + void PhysicsComponent::OnComponentDetached(BaseComponent& component) { if (IsComponent(component)) @@ -51,6 +79,10 @@ namespace Ndk } } + /*! + * \brief Operation to perform when component is detached from an entity + */ + void PhysicsComponent::OnDetached() { m_object.reset(); diff --git a/SDK/src/NDK/Console.cpp b/SDK/src/NDK/Console.cpp index d157d7dbe..dd379cd4a 100644 --- a/SDK/src/NDK/Console.cpp +++ b/SDK/src/NDK/Console.cpp @@ -19,6 +19,20 @@ namespace Ndk constexpr std::size_t s_inputPrefixSize = Nz::CountOf(s_inputPrefix) - 1; } + /*! + * \ingroup NDK + * \class Ndk::Console + * \brief NDK class that represents a console to help development with Lua scripting + */ + + /*! + * \brief Constructs a Console object with a world to interact with + * + * \param world World to interact with + * \param size (Width, Height) of the console + * \param instance Lua instance that will interact with the world + */ + Console::Console(World& world, const Nz::Vector2f& size, Nz::LuaInstance& instance) : m_historyPosition(0), m_defaultFont(Nz::Font::GetDefault()), @@ -86,18 +100,35 @@ namespace Ndk Layout(); } + /*! + * \brief Adds a line to the console + * + * \param text New line of text + * \param color Color for the text + */ + void Console::AddLine(const Nz::String& text, const Nz::Color& color) { AddLineInternal(text, color); RefreshHistory(); } + /*! + * \brief Clears the console + */ + void Console::Clear() { m_historyLines.clear(); RefreshHistory(); } + /*! + * \brief Sends a character to the console + * + * \param character Character that will be added to the console + */ + void Console::SendCharacter(char32_t character) { switch (character) @@ -131,6 +162,12 @@ namespace Ndk m_inputTextSprite->Update(m_inputDrawer); } + /*! + * \brief Sends an event to the console + * + * \param event Event to be takin into consideration by the console + */ + void Console::SendEvent(Nz::WindowEvent event) { switch (event.type) @@ -170,6 +207,12 @@ namespace Ndk } } + /*! + * \brief Sets the character size + * + * \param size Size of the font + */ + void Console::SetCharacterSize(unsigned int size) { m_characterSize = size; @@ -182,6 +225,12 @@ namespace Ndk Layout(); } + /*! + * \brief Sets the console size + * + * \param size (Width, Height) of the console + */ + void Console::SetSize(const Nz::Vector2f& size) { m_size = size; @@ -189,6 +238,14 @@ namespace Ndk Layout(); } + /*! + * \brief Sets the text font + * + * \param font Reference to a valid font + * + * \remark Produces a NazaraAssert if font is invalid or null + */ + void Console::SetTextFont(Nz::FontRef font) { NazaraAssert(font && font->IsValid(), "Invalid font"); @@ -200,6 +257,12 @@ namespace Ndk Layout(); } + /*! + * \brief Shows the console + * + * \param show Should the console be showed + */ + void Console::Show(bool show) { if (m_opened != show) @@ -213,11 +276,22 @@ namespace Ndk } } + /*! + * \brief Adds a line to the history of the console + * + * \param text New line of text + * \param color Color for the text + */ + void Console::AddLineInternal(const Nz::String& text, const Nz::Color& color) { m_historyLines.emplace_back(Line{color, text}); } + /*! + * \brief Performs this action when an input is added to the console + */ + void Console::ExecuteInput() { Nz::String input = m_inputDrawer.GetText(); @@ -237,12 +311,18 @@ namespace Ndk RefreshHistory(); } + /*! + * \brief Places the console according to its layout + */ + void Console::Layout() { unsigned int lineHeight = m_defaultFont->GetSizeInfo(m_characterSize).lineHeight; Ndk::NodeComponent& inputNode = m_input->GetComponent(); + NazaraError(inputNode.GetPosition().ToString()); inputNode.SetPosition(0.f, m_size.y - lineHeight - 5.f); + NazaraError(inputNode.GetPosition().ToString()); float historyHeight = m_size.y - lineHeight - 5.f - 2.f; m_historyBackgroundSprite->SetSize(m_size.x, historyHeight); @@ -250,14 +330,22 @@ namespace Ndk m_maxHistoryLines = static_cast(std::ceil(historyHeight / lineHeight)); Ndk::NodeComponent& historyNode = m_history->GetComponent(); + NazaraError(historyNode.GetPosition().ToString()); historyNode.SetPosition(0.f, historyHeight - m_maxHistoryLines * lineHeight); + NazaraError(historyNode.GetPosition().ToString()); Ndk::NodeComponent& inputBackgroundNode = m_inputBackground->GetComponent(); + NazaraError(inputBackgroundNode.GetPosition().ToString()); inputBackgroundNode.SetPosition(0.f, historyHeight + 2.f); + NazaraError(inputBackgroundNode.GetPosition().ToString()); m_inputBackgroundSprite->SetSize(m_size.x, m_size.y - historyHeight); } + /*! + * \brief Refreshes the history of the console + */ + void Console::RefreshHistory() { m_historyDrawer.Clear(); diff --git a/SDK/src/NDK/Entity.cpp b/SDK/src/NDK/Entity.cpp index ecd74ebc0..815d0dc1b 100644 --- a/SDK/src/NDK/Entity.cpp +++ b/SDK/src/NDK/Entity.cpp @@ -8,6 +8,18 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::Entity + * \brief NDK class that represents an entity in a world + */ + + /*! + * \brief Constructs a Entity object by move semantic + * + * \param entity Entity to move into this + */ + Entity::Entity(Entity&& entity) : HandledObject(std::move(entity)), m_components(std::move(entity.m_components)), @@ -20,35 +32,57 @@ namespace Ndk { } + /*! + * \brief Constructs a Entity object linked to a world and with an id + * + * \param world World in which the entity interact + * \param id Identifier of the entity + */ + Entity::Entity(World* world, EntityId id) : m_id(id), m_world(world) { } + /*! + * \brief Destructs the object and calls Destroy + * + * \see Destroy + */ + Entity::~Entity() { Destroy(); } + /*! + * \brief Adds a component to the entity + * \return A reference to the newly added component + * + * \param componentPtr Component to add to the entity + * + * \remark Produces a NazaraAssert if component is nullptr + */ + BaseComponent& Entity::AddComponent(std::unique_ptr&& componentPtr) { NazaraAssert(componentPtr, "Component must be valid"); ComponentIndex index = componentPtr->GetIndex(); - // Nous nous assurons que le vecteur de component est suffisamment grand pour contenir le nouveau component + // We ensure that the vector has enough space if (index >= m_components.size()) m_components.resize(index + 1); - // Affectation et retour du component + // Affectation and return of the component m_components[index] = std::move(componentPtr); m_componentBits.UnboundedSet(index); m_removedComponentBits.UnboundedReset(index); Invalidate(); - // On récupère le component et on informe les composants existants du nouvel arrivant + // We get the new component and we alert other existing components of the new one BaseComponent& component = *m_components[index].get(); component.SetEntity(this); @@ -61,34 +95,57 @@ namespace Ndk return component; } + /*! + * \brief Clones the entity + * \return The clone newly created + * + * \remark The close is enable by default, even if the original is disabled + * \remark Produces a NazaraAssert if the entity is not valid + */ + const EntityHandle& Entity::Clone() const { - ///DOC: The clone is enabled by default, even if the original entity is disabled NazaraAssert(IsValid(), "Invalid entity"); return m_world->CloneEntity(m_id); } + /*! + * \brief Kills the entity + */ + void Entity::Kill() { m_world->KillEntity(this); } + /*! + * \brief Invalidates the entity + */ + void Entity::Invalidate() { - // On informe le monde que nous avons besoin d'une mise à jour + // We alert everyone that we have been updated m_world->Invalidate(m_id); } + /*! + * \brief Creates the entity + */ + void Entity::Create() { m_enabled = true; m_valid = true; } + /*! + * \brief Destroys the entity + */ + void Entity::Destroy() { - // On informe chaque système + // We alert each system for (std::size_t index = m_systemBits.FindFirst(); index != m_systemBits.npos; index = m_systemBits.FindNext(index)) { if (m_world->HasSystem(index)) @@ -104,12 +161,19 @@ namespace Ndk m_valid = false; } + /*! + * \brief Destroys a component by index + * + * \param index Index of the component + * + * \remark If component is not available, no action is performed + */ + void Entity::DestroyComponent(ComponentIndex index) { - ///DOC: N'a aucun effet si le component n'est pas présent if (HasComponent(index)) { - // On récupère le component et on informe les composants du détachement + // We get the component and we alert existing components of the deleted one BaseComponent& component = *m_components[index].get(); for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i)) { diff --git a/SDK/src/NDK/LuaAPI.cpp b/SDK/src/NDK/LuaAPI.cpp index a1b84bf5d..1bf4eec35 100644 --- a/SDK/src/NDK/LuaAPI.cpp +++ b/SDK/src/NDK/LuaAPI.cpp @@ -5,12 +5,29 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::LuaAPI + * \brief NDK class that represents the api used for Lua + */ + + /*! + * \brief Initializes the LuaAPI module + * \return true if initialization is successful + */ + bool LuaAPI::Initialize() { s_binding = new LuaBinding; return true; } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the engine & SDK + */ + void LuaAPI::RegisterClasses(Nz::LuaInstance& instance) { if (!s_binding && !Initialize()) @@ -22,6 +39,10 @@ namespace Ndk s_binding->RegisterClasses(instance); } + /*! + * \brief Uninitializes the LuaAPI module + */ + void LuaAPI::Uninitialize() { delete s_binding; diff --git a/SDK/src/NDK/LuaBinding.cpp b/SDK/src/NDK/LuaBinding.cpp index 6acc05a46..822654a39 100644 --- a/SDK/src/NDK/LuaBinding.cpp +++ b/SDK/src/NDK/LuaBinding.cpp @@ -4,6 +4,16 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::LuaBinding + * \brief NDK class that represents the binding between the engine & the SDK with the Lua scripting + */ + + /*! + * \brief Binds modules to Lua + */ + LuaBinding::LuaBinding() : // Core clockClass("Clock"), @@ -65,6 +75,12 @@ namespace Ndk #endif } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the engine & SDK + */ + void LuaBinding::RegisterClasses(Nz::LuaInstance& instance) { RegisterCore(instance); diff --git a/SDK/src/NDK/LuaBinding_Audio.cpp b/SDK/src/NDK/LuaBinding_Audio.cpp index 89452d720..b825b1876 100644 --- a/SDK/src/NDK/LuaBinding_Audio.cpp +++ b/SDK/src/NDK/LuaBinding_Audio.cpp @@ -6,6 +6,10 @@ namespace Ndk { + /*! + * \brief Binds Audio module to Lua + */ + void LuaBinding::BindAudio() { /*********************************** Nz::Music **********************************/ @@ -164,6 +168,12 @@ namespace Ndk soundEmitter.BindMethod("Stop", &Nz::SoundEmitter::Stop); } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the Audio classes + */ + void LuaBinding::RegisterAudio(Nz::LuaInstance& instance) { musicClass.Register(instance); diff --git a/SDK/src/NDK/LuaBinding_Core.cpp b/SDK/src/NDK/LuaBinding_Core.cpp index 09cbda604..78c73eea1 100644 --- a/SDK/src/NDK/LuaBinding_Core.cpp +++ b/SDK/src/NDK/LuaBinding_Core.cpp @@ -6,6 +6,10 @@ namespace Ndk { + /*! + * \brief Binds Core module to Lua + */ + void LuaBinding::BindCore() { /*********************************** Nz::Clock **********************************/ @@ -254,6 +258,12 @@ namespace Ndk }); } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the Core classes + */ + void LuaBinding::RegisterCore(Nz::LuaInstance& instance) { // Classes diff --git a/SDK/src/NDK/LuaBinding_Graphics.cpp b/SDK/src/NDK/LuaBinding_Graphics.cpp index 289002746..4c9288428 100644 --- a/SDK/src/NDK/LuaBinding_Graphics.cpp +++ b/SDK/src/NDK/LuaBinding_Graphics.cpp @@ -6,6 +6,10 @@ namespace Ndk { + /*! + * \brief Binds Graphics module to Lua + */ + void LuaBinding::BindGraphics() { /*********************************** Nz::InstancedRenderable ***********************************/ @@ -40,6 +44,12 @@ namespace Ndk modelClass.BindMethod("SetSkinCount", &Nz::Model::SetSkinCount); } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the Graphics classes + */ + void LuaBinding::RegisterGraphics(Nz::LuaInstance& instance) { instancedRenderable.Register(instance); diff --git a/SDK/src/NDK/LuaBinding_Math.cpp b/SDK/src/NDK/LuaBinding_Math.cpp index c1d7b487e..1c53caa69 100644 --- a/SDK/src/NDK/LuaBinding_Math.cpp +++ b/SDK/src/NDK/LuaBinding_Math.cpp @@ -7,6 +7,10 @@ namespace Ndk { + /*! + * \brief Binds Math module to Lua + */ + void LuaBinding::BindMath() { /*********************************** Nz::EulerAngles **********************************/ @@ -673,6 +677,12 @@ namespace Ndk }); } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the Math classes + */ + void LuaBinding::RegisterMath(Nz::LuaInstance& instance) { eulerAnglesClass.Register(instance); diff --git a/SDK/src/NDK/LuaBinding_Network.cpp b/SDK/src/NDK/LuaBinding_Network.cpp index dc17c5d00..67f40cb4d 100644 --- a/SDK/src/NDK/LuaBinding_Network.cpp +++ b/SDK/src/NDK/LuaBinding_Network.cpp @@ -5,6 +5,10 @@ namespace Ndk { + /*! + * \brief Binds Network module to Lua + */ + void LuaBinding::BindNetwork() { /*********************************** Nz::AbstractSocket **********************************/ @@ -132,6 +136,12 @@ namespace Ndk }); } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the Network classes + */ + void LuaBinding::RegisterNetwork(Nz::LuaInstance& instance) { // Classes diff --git a/SDK/src/NDK/LuaBinding_Renderer.cpp b/SDK/src/NDK/LuaBinding_Renderer.cpp index 78b9fe561..79f1780a3 100644 --- a/SDK/src/NDK/LuaBinding_Renderer.cpp +++ b/SDK/src/NDK/LuaBinding_Renderer.cpp @@ -7,10 +7,20 @@ namespace Ndk { + /*! + * \brief Binds Renderer module to Lua + */ + void LuaBinding::BindRenderer() { } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the Renderer classes + */ + void LuaBinding::RegisterRenderer(Nz::LuaInstance& instance) { } diff --git a/SDK/src/NDK/LuaBinding_SDK.cpp b/SDK/src/NDK/LuaBinding_SDK.cpp index b371e76e3..5b6ad7dc9 100644 --- a/SDK/src/NDK/LuaBinding_SDK.cpp +++ b/SDK/src/NDK/LuaBinding_SDK.cpp @@ -7,6 +7,10 @@ namespace Ndk { + /*! + * \brief Binds SDK module to Lua + */ + void LuaBinding::BindSDK() { /*********************************** Ndk::Application **********************************/ @@ -143,6 +147,12 @@ namespace Ndk #endif } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the SDK classes + */ + void LuaBinding::RegisterSDK(Nz::LuaInstance& instance) { // Classes @@ -173,6 +183,14 @@ namespace Ndk instance.SetGlobal("ComponentType"); } + /*! + * \brief Gets the index of the component + * \return A pointer to the binding linked to a component + * + * \param instance Lua instance that will interact with the component + * \param argIndex Index of the component + */ + LuaBinding::ComponentBinding* LuaBinding::QueryComponentIndex(Nz::LuaInstance& instance, int argIndex) { switch (instance.GetType(argIndex)) diff --git a/SDK/src/NDK/LuaBinding_Utility.cpp b/SDK/src/NDK/LuaBinding_Utility.cpp index 4ccb18fa6..416662b23 100644 --- a/SDK/src/NDK/LuaBinding_Utility.cpp +++ b/SDK/src/NDK/LuaBinding_Utility.cpp @@ -6,6 +6,10 @@ namespace Ndk { + /*! + * \brief Binds Utility module to Lua + */ + void LuaBinding::BindUtility() { /*********************************** Nz::AbstractImage **********************************/ @@ -308,6 +312,12 @@ namespace Ndk }); } + /*! + * \brief Registers the classes that will be used by the Lua instance + * + * \param instance Lua instance that will interact with the Utility classes + */ + void LuaBinding::RegisterUtility(Nz::LuaInstance& instance) { abstractImage.Register(instance); diff --git a/SDK/src/NDK/Sdk.cpp b/SDK/src/NDK/Sdk.cpp index 964913bf8..bd3bf33e4 100644 --- a/SDK/src/NDK/Sdk.cpp +++ b/SDK/src/NDK/Sdk.cpp @@ -34,6 +34,19 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::Sdk + * \brief NDK class that represents the software development kit, a set of tools made to ease the conception of application + */ + + /*! + * \brief Initializes the Sdk module + * \return true if initialization is successful + * + * \remark Produces a NazaraNotice + */ + bool Sdk::Initialize() { if (s_referenceCounter++ > 0) @@ -104,6 +117,12 @@ namespace Ndk } } + /*! + * \brief Uninitializes the Sdk module + * + * \remark Produces a NazaraNotice + */ + void Sdk::Uninitialize() { if (s_referenceCounter != 1) diff --git a/SDK/src/NDK/State.cpp b/SDK/src/NDK/State.cpp index e256a7f1c..701b98565 100644 --- a/SDK/src/NDK/State.cpp +++ b/SDK/src/NDK/State.cpp @@ -6,5 +6,11 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::State + * \brief NDK class that represents a state of your application + */ + State::~State() = default; } diff --git a/SDK/src/NDK/Systems/ListenerSystem.cpp b/SDK/src/NDK/Systems/ListenerSystem.cpp index 28fce2e0a..9c7333d34 100644 --- a/SDK/src/NDK/Systems/ListenerSystem.cpp +++ b/SDK/src/NDK/Systems/ListenerSystem.cpp @@ -10,11 +10,29 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::ListenerSystem + * \brief NDK class that represents the audio system + * + * \remark This system is enabled if the entity owns the trait: ListenerComponent and NodeComponent + */ + + /*! + * \brief Constructs an ListenerSystem object by default + */ + ListenerSystem::ListenerSystem() { Requires(); } + /*! + * \brief Operation to perform when system is updated + * + * \param elapsedTime Delta time used for the update + */ + void ListenerSystem::OnUpdate(float elapsedTime) { NazaraUnused(elapsedTime); @@ -23,18 +41,18 @@ namespace Ndk for (const Ndk::EntityHandle& entity : GetEntities()) { - // Le listener est-il actif ? + // Is the listener actif ? const ListenerComponent& listener = entity->GetComponent(); if (!listener.IsActive()) continue; - // On récupère la position et la rotation pour les affecter au listener + // We get the position and the rotation to affect these to the listener const NodeComponent& node = entity->GetComponent(); Nz::Audio::SetListenerPosition(node.GetPosition(Nz::CoordSys_Global)); Nz::Audio::SetListenerRotation(node.GetRotation(Nz::CoordSys_Global)); - // On vérifie la présence d'une donnée de vitesse, et on l'affecte - // (La vitesse du listener Audio ne le fait pas se déplacer, mais affecte par exemple l'effet Doppler) + // We verify the presence of a component of velocity + // (The listener'speed does not move it, but disturbs the sound like Doppler effect) if (entity->HasComponent()) { const VelocityComponent& velocity = entity->GetComponent(); diff --git a/SDK/src/NDK/Systems/ParticleSystem.cpp b/SDK/src/NDK/Systems/ParticleSystem.cpp index a9f63cb6c..9321c0ec2 100644 --- a/SDK/src/NDK/Systems/ParticleSystem.cpp +++ b/SDK/src/NDK/Systems/ParticleSystem.cpp @@ -7,11 +7,29 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::ParticleSystem + * \brief NDK class that represents the particle system + * + * \remark This system is enabled if the entity has the trait: NodeComponent and any of these two: ParticleGroupComponent + */ + + /*! + * \brief Constructs an ParticleSystem object by default + */ + ParticleSystem::ParticleSystem() { Requires(); } + /*! + * \brief Operation to perform when system is updated + * + * \param elapsedTime Delta time used for the update + */ + void ParticleSystem::OnUpdate(float elapsedTime) { for (const Ndk::EntityHandle& entity : GetEntities()) diff --git a/SDK/src/NDK/Systems/PhysicsSystem.cpp b/SDK/src/NDK/Systems/PhysicsSystem.cpp index 3d429a686..442784c22 100644 --- a/SDK/src/NDK/Systems/PhysicsSystem.cpp +++ b/SDK/src/NDK/Systems/PhysicsSystem.cpp @@ -10,24 +10,50 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::PhysicsSystem + * \brief NDK class that represents the physics system + * + * \remark This system is enabled if the entity has the trait: NodeComponent and any of these two: CollisionComponent or PhysicsComponent + * \remark Static objects do not have a velocity specified by the physical engine + */ + + /*! + * \brief Constructs an PhysicsSystem object by default + */ + PhysicsSystem::PhysicsSystem() { Requires(); RequiresAny(); } + /*! + * \brief Constructs a PhysicsSystem object by copy semantic + * + * \param system PhysicsSystem to copy + */ + PhysicsSystem::PhysicsSystem(const PhysicsSystem& system) : System(system), m_world() { } + /*! + * \brief Operation to perform when entity is validated for the system + * + * \param entity Pointer to the entity + * \param justAdded Is the entity newly added + */ + void PhysicsSystem::OnEntityValidation(Entity* entity, bool justAdded) { - // Si l'entité ne vient pas d'être ajoutée au système, il est possible qu'elle fasse partie du mauvais tableau + // If entity has not been just added to the system, it is possible that it does not own to the right array if (!justAdded) { - // On prend le tableau inverse de celui dont l'entité devrait faire partie + // We take the inverted array from which the entity should belong to auto& entities = (entity->HasComponent()) ? m_staticObjects : m_dynamicObjects; entities.Remove(entity); } @@ -36,6 +62,12 @@ namespace Ndk entities.Insert(entity); } + /*! + * \brief Operation to perform when system is updated + * + * \param elapsedTime Delta time used for the update + */ + void PhysicsSystem::OnUpdate(float elapsedTime) { m_world.Step(elapsedTime); @@ -63,8 +95,8 @@ namespace Ndk Nz::Quaternionf newRotation = node.GetRotation(Nz::CoordSys_Global); Nz::Vector3f newPosition = node.GetPosition(Nz::CoordSys_Global); - // Pour déplacer des objets statiques et assurer les collisions, il faut leur définir une vitesse - // (note importante: le moteur physique n'applique pas la vitesse sur les objets statiques) + // To move static objects and ensure their collisions, we have to specify them a velocity + // (/!\: the physical motor does not apply the speed on static objects) if (newPosition != oldPosition) { physObj->SetPosition(newPosition); diff --git a/SDK/src/NDK/Systems/RenderSystem.cpp b/SDK/src/NDK/Systems/RenderSystem.cpp index fcfd5c6a5..107676206 100644 --- a/SDK/src/NDK/Systems/RenderSystem.cpp +++ b/SDK/src/NDK/Systems/RenderSystem.cpp @@ -14,6 +14,21 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::RenderSystem + * \brief NDK class that represents the rendering system + * + * \remark This system is enabled if the entity is a 'camera' with the trait: CameraComponent and NodeComponent + * or a drawable element with trait: GraphicsComponent and NodeComponent + * or a light element with trait: LightComponent and NodeComponent + * or a set of particles with trait: ParticleGroupComponent + */ + + /*! + * \brief Constructs an RenderSystem object by default + */ + RenderSystem::RenderSystem() : m_coordinateSystemMatrix(Nz::Matrix4f::Identity()), m_coordinateSystemInvalidated(true) @@ -23,6 +38,12 @@ namespace Ndk SetUpdateRate(0.f); } + /*! + * \brief Operation to perform when an entity is removed + * + * \param entity Pointer to the entity + */ + void RenderSystem::OnEntityRemoved(Entity* entity) { m_cameras.Remove(entity); @@ -33,6 +54,13 @@ namespace Ndk m_pointSpotLights.Remove(entity); } + /*! + * \brief Operation to perform when entity is validated for the system + * + * \param entity Pointer to the entity + * \param justAdded Is the entity newly added + */ + void RenderSystem::OnEntityValidation(Entity* entity, bool justAdded) { NazaraUnused(justAdded); @@ -82,6 +110,12 @@ namespace Ndk m_particleGroups.Remove(entity); } + /*! + * \brief Operation to perform when system is updated + * + * \param elapsedTime Delta time used for the update + */ + void RenderSystem::OnUpdate(float elapsedTime) { NazaraUnused(elapsedTime); @@ -146,6 +180,12 @@ namespace Ndk } } + /*! + * \brief Updates the directional shadow maps according to the position of the viewer + * + * \param viewer Viewer of the scene + */ + void RenderSystem::UpdateDirectionalShadowMaps(const Nz::AbstractViewer& viewer) { if (!m_shadowRT.IsValid()) @@ -191,6 +231,10 @@ namespace Ndk } } + /*! + * \brief Updates the point spot shadow maps + */ + void RenderSystem::UpdatePointSpotShadowMaps() { if (!m_shadowRT.IsValid()) diff --git a/SDK/src/NDK/Systems/VelocitySystem.cpp b/SDK/src/NDK/Systems/VelocitySystem.cpp index 2d3264039..e8cfe2f23 100644 --- a/SDK/src/NDK/Systems/VelocitySystem.cpp +++ b/SDK/src/NDK/Systems/VelocitySystem.cpp @@ -9,12 +9,31 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::VelocitySystem + * \brief NDK class that represents the velocity system + * + * \remark This system is enabled if the entity owns the trait: NodeComponent and VelocityComponent + * but it's disabled with the trait: PhysicsComponent + */ + + /*! + * \brief Constructs an VelocitySystem object by default + */ + VelocitySystem::VelocitySystem() { Requires(); Excludes(); } + /*! + * \brief Operation to perform when system is updated + * + * \param elapsedTime Delta time used for the update + */ + void VelocitySystem::OnUpdate(float elapsedTime) { for (const Ndk::EntityHandle& entity : GetEntities()) diff --git a/SDK/src/NDK/World.cpp b/SDK/src/NDK/World.cpp index 8e5ff99f0..938722feb 100644 --- a/SDK/src/NDK/World.cpp +++ b/SDK/src/NDK/World.cpp @@ -16,12 +16,28 @@ namespace Ndk { + /*! + * \ingroup NDK + * \class Ndk::World + * \brief NDK class that represents a world + */ + + /*! + * \brief Destructs the object and calls Clear + * + * \see Clear + */ + World::~World() noexcept { - // La destruction doit se faire dans un ordre précis + // The destruct must be done in an ordered way Clear(); } + /*! + * \brief Adds default systems to the world + */ + void World::AddDefaultSystems() { AddSystem(); @@ -34,40 +50,49 @@ namespace Ndk #endif } + /*! + * \brief Creates an entity in the world + * \return The entity created + */ + const EntityHandle& World::CreateEntity() { EntityId id; if (!m_freeIdList.empty()) { - // On récupère un identifiant + // We get an identifier id = m_freeIdList.back(); m_freeIdList.pop_back(); } else { - // On alloue une nouvelle entité + // We allocate a new entity id = m_entities.size(); - // Impossible d'utiliser emplace_back à cause de la portée + // We can't use emplace_back due to the scope m_entities.push_back(Entity(this, id)); } - // On initialise l'entité et on l'ajoute à la liste des entités vivantes + // We initialise the entity and we add it to the list of alive entities Entity& entity = m_entities[id].entity; entity.Create(); m_aliveEntities.emplace_back(&entity); - m_entities[id].aliveIndex = m_aliveEntities.size()-1; + m_entities[id].aliveIndex = m_aliveEntities.size() - 1; return m_aliveEntities.back(); } + /*! + * \brief Clears the world from every entities + * + * \remark Every handles are correctly invalidated, entities are immediately invalidated + */ + void World::Clear() noexcept { - ///DOC: Tous les handles sont correctement invalidés, les entités sont immédiatement invalidées - - // Destruction des entités d'abord, et des handles ensuite - // ceci pour éviter que les handles n'informent les entités inutilement lors de leur destruction + // First, destruction of entities, then handles + // This is made to avoid that handle warn uselessly entities before their destruction m_entities.clear(); m_aliveEntities.clear(); @@ -75,6 +100,15 @@ namespace Ndk m_killedEntities.Clear(); } + /*! + * \brief Clones the entity + * \return The clone newly created + * + * \param id Identifier of the entity + * + * \remark Produces a NazaraError if the entity to clone does not exist + */ + const EntityHandle& World::CloneEntity(EntityId id) { EntityHandle original = GetEntity(id); @@ -96,14 +130,29 @@ namespace Ndk return GetEntity(clone->GetId()); } + /*! + * \brief Kills an entity + * + * \param Pointer to the entity + * + * \remark No change is done if entity is invalid + */ + void World::KillEntity(Entity* entity) { - ///DOC: Ignoré si l'entité est invalide - if (IsEntityValid(entity)) m_killedEntities.UnboundedSet(entity->GetId(), true); } + /*! + * \brief Gets an entity + * \return A constant reference to the modified entity + * + * \param id Identifier of the entity + * + * \remark Produces a NazaraError if entity identifier is not valid + */ + const EntityHandle& World::GetEntity(EntityId id) { if (IsEntityIdValid(id)) @@ -115,9 +164,15 @@ namespace Ndk } } + /*! + * \brief Updates the world + * + * \remark Produces a NazaraAssert if an entity is invalid + */ + void World::Update() { - // Gestion des entités tuées depuis le dernier appel + // Handle killed entities before last call for (std::size_t i = m_killedEntities.FindFirst(); i != m_killedEntities.npos; i = m_killedEntities.FindNext(i)) { EntityBlock& block = m_entities[i]; @@ -125,32 +180,32 @@ namespace Ndk NazaraAssert(entity.IsValid(), "Entity must be valid"); - // Remise en file d'attente de l'identifiant d'entité + // Send back the identifier of the entity to the free queue m_freeIdList.push_back(entity.GetId()); - // Destruction de l'entité (invalidation du handle par la même occasion) + // Destruction of the entity (invalidation of handle by the same way) entity.Destroy(); - // Nous allons sortir le handle de la liste des entités vivantes - // en swappant le handle avec le dernier handle, avant de pop + // We take out the handle from the list of alive entities + // With the idiom swap and pop NazaraAssert(block.aliveIndex < m_aliveEntities.size(), "Alive index out of range"); - if (block.aliveIndex < m_aliveEntities.size()-1) // S'il ne s'agit pas du dernier handle + if (block.aliveIndex < m_aliveEntities.size() - 1) // If it's not the last handle { EntityHandle& lastHandle = m_aliveEntities.back(); EntityHandle& myHandle = m_aliveEntities[block.aliveIndex]; myHandle = std::move(lastHandle); - // On n'oublie pas de corriger l'indice associé à l'entité + // We don't forget to update the index associated to the entity m_entities[myHandle->GetId()].aliveIndex = block.aliveIndex; } m_aliveEntities.pop_back(); } m_killedEntities.Reset(); - // Gestion des entités nécessitant une mise à jour de leurs systèmes + // Handle of entities which need an update from the systems for (std::size_t i = m_dirtyEntities.FindFirst(); i != m_dirtyEntities.npos; i = m_dirtyEntities.FindNext(i)) { NazaraAssert(i < m_entities.size(), "Entity index out of range"); diff --git a/build/scripts/tools/unittests.lua b/build/scripts/tools/unittests.lua index 0d3dcc7d2..b423b390f 100644 --- a/build/scripts/tools/unittests.lua +++ b/build/scripts/tools/unittests.lua @@ -14,17 +14,10 @@ TOOL.Includes = { TOOL.Files = { "../tests/main.cpp", - "../tests/Engine/**.cpp" + "../tests/Engine/**.cpp", + "../tests/SDK/**.cpp" } TOOL.Libraries = { - "NazaraCore", - "NazaraAudio", - "NazaraLua", - "NazaraGraphics", - "NazaraRenderer", - "NazaraNetwork", - "NazaraNoise", - "NazaraPhysics", - "NazaraUtility" + "NazaraSDK" } diff --git a/tests/SDK/NDK/Application.cpp b/tests/SDK/NDK/Application.cpp new file mode 100644 index 000000000..994bd022b --- /dev/null +++ b/tests/SDK/NDK/Application.cpp @@ -0,0 +1,22 @@ +#include +#include + +SCENARIO("Application", "[NDK][APPLICATION]") +{ + GIVEN("An application") + { + Ndk::Application application; + application.AddWorld(); + Nz::Window& window = application.AddWindow(); + + WHEN("We close the open window") + { + window.Close(); + + THEN("Application should close") + { + REQUIRE(!application.Run()); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/BaseSystem.cpp b/tests/SDK/NDK/BaseSystem.cpp new file mode 100644 index 000000000..e4ca2e1c9 --- /dev/null +++ b/tests/SDK/NDK/BaseSystem.cpp @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include + +namespace +{ + class TestSystem : public Ndk::System + { + public: + TestSystem() + { + Requires(); + Excludes(); + } + + ~TestSystem() = default; + + static Ndk::SystemIndex systemIndex; + + private: + void OnUpdate(float elapsedTime) override + { + } + }; + + Ndk::SystemIndex TestSystem::systemIndex; +} + +SCENARIO("BaseSystem", "[NDK][BASESYSTEM]") +{ + GIVEN("Our TestSystem") + { + Ndk::World world; + Ndk::BaseSystem& system = world.AddSystem(); + REQUIRE(&system.GetWorld() == &world); + + WHEN("We add an entity") + { + const Ndk::EntityHandle& entity = world.CreateEntity(); + entity->AddComponent(); + + THEN("System should have it") + { + world.Update(1.f); + REQUIRE(system.HasEntity(entity)); + } + } + + WHEN("We add an entity with excluded component") + { + const Ndk::EntityHandle& entity = world.CreateEntity(); + entity->AddComponent(); + entity->AddComponent(); + + THEN("System should not have it") + { + world.Update(1.f); + REQUIRE(!system.HasEntity(entity)); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/Component.cpp b/tests/SDK/NDK/Component.cpp new file mode 100644 index 000000000..f00bb9006 --- /dev/null +++ b/tests/SDK/NDK/Component.cpp @@ -0,0 +1,31 @@ +#include +#include + +namespace +{ + class TestComponent : public Ndk::Component + { + public: + static Ndk::ComponentIndex componentIndex; + }; + + Ndk::ComponentIndex TestComponent::componentIndex; +} + +SCENARIO("Component", "[NDK][COMPONENT]") +{ + GIVEN("Our TestComponent") + { + TestComponent testComponent; + + WHEN("We clone it") + { + std::unique_ptr clone = testComponent.Clone(); + + THEN("We should get a copy") + { + REQUIRE(dynamic_cast(clone.get()) != nullptr); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/Entity.cpp b/tests/SDK/NDK/Entity.cpp new file mode 100644 index 000000000..d784e28ad --- /dev/null +++ b/tests/SDK/NDK/Entity.cpp @@ -0,0 +1,101 @@ +#include +#include +#include + +namespace +{ + class UpdatableComponent : public Ndk::Component + { + public: + bool IsUpdated() + { + return m_updated; + } + + void SetUpdated() + { + m_updated = true; + } + + static Ndk::ComponentIndex componentIndex; + + private: + bool m_updated = false; + }; + + Ndk::ComponentIndex UpdatableComponent::componentIndex; + + class UpdateSystem : public Ndk::System + { + public: + UpdateSystem() + { + Requires(); + } + + ~UpdateSystem() = default; + + static Ndk::SystemIndex systemIndex; + + private: + void OnUpdate(float elapsedTime) override + { + for (const Ndk::EntityHandle& entity : GetEntities()) + { + UpdatableComponent& updatable = entity->GetComponent(); + updatable.SetUpdated(); + } + } + }; + + Ndk::SystemIndex UpdateSystem::systemIndex; +} + +SCENARIO("Entity", "[NDK][ENTITY]") +{ + GIVEN("A world & an entity") + { + Ndk::World world; + Ndk::BaseSystem& system = world.AddSystem(); + const Ndk::EntityHandle& entity = world.CreateEntity(); + + WHEN("We add our UpdateComponent") + { + UpdatableComponent& updatableComponent = entity->AddComponent(); + REQUIRE(!updatableComponent.IsUpdated()); + + THEN("Update the world should update the entity's component") + { + world.Update(1.f); + UpdatableComponent& updatableComponentGet = entity->GetComponent(); + REQUIRE(updatableComponentGet.IsUpdated()); + } + + THEN("Update the world should not update the entity's component if it's disabled") + { + entity->Enable(false); + world.Update(1.f); + UpdatableComponent& updatableComponentGet = entity->GetComponent(); + REQUIRE(!updatableComponentGet.IsUpdated()); + } + + THEN("We can remove its component") + { + entity->RemoveComponent(Ndk::GetComponentIndex()); + world.Update(1.f); + REQUIRE(!entity->HasComponent()); + } + } + + WHEN("We kill our entity") + { + entity->Kill(); + world.Update(1.f); + + THEN("It's no more valid") + { + REQUIRE(!world.IsEntityValid(entity)); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/EntityList.cpp b/tests/SDK/NDK/EntityList.cpp new file mode 100644 index 000000000..4b76766d5 --- /dev/null +++ b/tests/SDK/NDK/EntityList.cpp @@ -0,0 +1,41 @@ +#include +#include +#include + +SCENARIO("EntityList", "[NDK][ENTITYLIST]") +{ + GIVEN("A world & a set of entities") + { + Ndk::World world; + const Ndk::EntityHandle& entity = world.CreateEntity(); + Ndk::EntityList entityList; + entityList.Insert(entity); + + WHEN("We ask if entity is in there") + { + THEN("These results are expected") + { + REQUIRE(entityList.Has(entity->GetId())); + const Ndk::EntityHandle& entity = world.CreateEntity(); + REQUIRE(!entityList.Has(entity->GetId())); + } + } + + WHEN("We remove then insert") + { + entityList.Remove(*entityList.begin()); + + THEN("Set should be empty") + { + REQUIRE(entityList.empty()); + } + + entityList.Insert(entity); + + THEN("With one element") + { + REQUIRE(!entityList.empty()); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/EntityOwner.cpp b/tests/SDK/NDK/EntityOwner.cpp new file mode 100644 index 000000000..eb9a29edf --- /dev/null +++ b/tests/SDK/NDK/EntityOwner.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]") +{ + GIVEN("A world & an entity") + { + Ndk::World world; + const Ndk::EntityHandle& entity = world.CreateEntity(); + + WHEN("We set the ownership of the entity to our owner") + { + Ndk::EntityOwner entityOwner(entity); + + THEN("Entity is still valid") + { + REQUIRE(entity.IsValid()); + } + + THEN("Resetting or getting out of scope is no more valid") + { + entityOwner.Reset(); + world.Update(1.f); + REQUIRE(!entity.IsValid()); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/StateMachine.cpp b/tests/SDK/NDK/StateMachine.cpp new file mode 100644 index 000000000..604aa6f9f --- /dev/null +++ b/tests/SDK/NDK/StateMachine.cpp @@ -0,0 +1,48 @@ +#include +#include + +class TestState : public Ndk::State +{ + public: + void Enter(Ndk::StateMachine& fsm) override + { + m_isUpdated = false; + } + + bool IsUpdated() const + { + return m_isUpdated; + } + + void Leave(Ndk::StateMachine& fsm) override + { + } + + bool Update(Ndk::StateMachine& fsm, float elapsedTime) override + { + m_isUpdated = true; + } + + private: + bool m_isUpdated; +}; + +SCENARIO("State & StateMachine", "[NDK][STATE]") +{ + GIVEN("A statemachine with our TestState") + { + std::shared_ptr testState = std::make_shared(); + Ndk::StateMachine stateMachine(testState); + REQUIRE(!testState->IsUpdated()); + + WHEN("We update our machine") + { + stateMachine.Update(1.f); + + THEN("Our state has been updated") + { + REQUIRE(testState->IsUpdated()); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/System.cpp b/tests/SDK/NDK/System.cpp new file mode 100644 index 000000000..ca1917124 --- /dev/null +++ b/tests/SDK/NDK/System.cpp @@ -0,0 +1,42 @@ +#include +#include + +namespace +{ + class TestSystem : public Ndk::System + { + public: + TestSystem() + { + } + + ~TestSystem() = default; + + static Ndk::SystemIndex systemIndex; + + private: + void OnUpdate(float elapsedTime) override + { + } + }; + + Ndk::SystemIndex TestSystem::systemIndex; +} + +SCENARIO("System", "[NDK][SYSTEM]") +{ + GIVEN("Our TestSystem") + { + TestSystem testSystem; + + WHEN("We clone it") + { + std::unique_ptr clone = testSystem.Clone(); + + THEN("We should get a copy") + { + REQUIRE(dynamic_cast(clone.get()) != nullptr); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/Systems/ListenerSystem.cpp b/tests/SDK/NDK/Systems/ListenerSystem.cpp new file mode 100644 index 000000000..2792dbc25 --- /dev/null +++ b/tests/SDK/NDK/Systems/ListenerSystem.cpp @@ -0,0 +1,43 @@ +#include +#include +#include +#include +#include +#include +#include + +SCENARIO("ListenerSystem", "[NDK][LISTENERSYSTEM]") +{ + GIVEN("A world and an entity with listener & node components") + { + Ndk::World world; + const Ndk::EntityHandle& entity = world.CreateEntity(); + Ndk::ListenerComponent& listenerComponent = entity->AddComponent(); + Ndk::NodeComponent& nodeComponent = entity->AddComponent(); + + WHEN("We move our entity") + { + Nz::Vector3f position = Nz::Vector3f::Unit() * 3.f; + nodeComponent.SetPosition(position); + Nz::Quaternionf rotation = Nz::Quaternionf::RotationBetween(Nz::Vector3f::Forward(), Nz::Vector3f::Up()); + nodeComponent.SetRotation(rotation); + world.Update(1.f); + + THEN("Our listener should have moved") + { + REQUIRE(Nz::Audio::GetListenerPosition() == position); + REQUIRE(Nz::Audio::GetListenerRotation() == rotation); + } + + THEN("With a component of velocity") + { + Ndk::VelocityComponent& velocityComponent = entity->AddComponent(); + Nz::Vector3f velocity = Nz::Vector3f::Unit() * 2.f; + velocityComponent.linearVelocity = velocity; + + world.Update(1.f); + REQUIRE(Nz::Audio::GetListenerVelocity() == velocity); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/Systems/PhysicsSystem.cpp b/tests/SDK/NDK/Systems/PhysicsSystem.cpp new file mode 100644 index 000000000..2aa3c313e --- /dev/null +++ b/tests/SDK/NDK/Systems/PhysicsSystem.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include +#include + +SCENARIO("PhysicsSystem", "[NDK][PHYSICSSYSTEM]") +{ + GIVEN("A world and a static entity & a dynamic entity") + { + Ndk::World world; + const Ndk::EntityHandle& staticEntity = world.CreateEntity(); + Ndk::CollisionComponent& collisionComponentStatic = staticEntity->AddComponent(); + Ndk::NodeComponent& nodeComponentStatic = staticEntity->AddComponent(); + + const Ndk::EntityHandle& dynamicEntity = world.CreateEntity(); + Ndk::NodeComponent& nodeComponentDynamic = dynamicEntity->AddComponent(); + Ndk::PhysicsComponent& physicsComponentDynamic = dynamicEntity->AddComponent(); + + WHEN("We make collide these two entities") + { + nodeComponentDynamic.SetPosition(-Nz::Vector3f::UnitZ()); + physicsComponentDynamic.AddForce(Nz::Vector3f::UnitZ()); + + THEN("The dynamic entity should have hit the static one") + { + world.Update(1.f); // On origin + world.Update(1.f); // On origin due to collision + REQUIRE(nodeComponentStatic.GetPosition().SquaredDistance(nodeComponentDynamic.GetPosition()) < 0.2f); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/Systems/RenderSystem.cpp b/tests/SDK/NDK/Systems/RenderSystem.cpp new file mode 100644 index 000000000..f106b3aae --- /dev/null +++ b/tests/SDK/NDK/Systems/RenderSystem.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +SCENARIO("RenderSystem", "[NDK][RenderSystem]") +{ + GIVEN("A world with a camera, a drawable, a light and some particles") + { + Ndk::World world; + const Ndk::EntityHandle& cameraEntity = world.CreateEntity(); + Ndk::CameraComponent& cameraComponentCamera = cameraEntity->AddComponent(); + Ndk::NodeComponent& nodeComponentCamera = cameraEntity->AddComponent(); + + const Ndk::EntityHandle& drawableEntity = world.CreateEntity(); + Ndk::GraphicsComponent& graphicsComponentDrawable = drawableEntity->AddComponent(); + Nz::SpriteRef sprite = Nz::Sprite::New(); + graphicsComponentDrawable.Attach(sprite); + Ndk::NodeComponent& nodeComponentDrawable = drawableEntity->AddComponent(); + + const Ndk::EntityHandle& lightEntity = world.CreateEntity(); + Ndk::LightComponent& lightComponentLight = lightEntity->AddComponent(); + Ndk::NodeComponent& nodeComponentLight = lightEntity->AddComponent(); + + const Ndk::EntityHandle& particlesEntity = world.CreateEntity(); + Ndk::ParticleGroupComponent& particleGroupComponentParticles = particlesEntity->AddComponent(1, Nz::ParticleLayout_Sprite); + + WHEN("We change the render technique to ForwardRenderTechnique") + { + Ndk::RenderSystem& renderSystem = world.GetSystem(); + renderSystem.ChangeRenderTechnique(); + + THEN("The render system should be ForwardRenderTechnique") + { + REQUIRE(renderSystem.GetRenderTechnique().GetType() == Nz::RenderTechniqueType_BasicForward); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/Systems/VelocitySystem.cpp b/tests/SDK/NDK/Systems/VelocitySystem.cpp new file mode 100644 index 000000000..bfde34896 --- /dev/null +++ b/tests/SDK/NDK/Systems/VelocitySystem.cpp @@ -0,0 +1,28 @@ +#include +#include +#include +#include +#include + +SCENARIO("VelocitySystem", "[NDK][VELOCITYSYSTEM]") +{ + GIVEN("A world and an entity with velocity & node components") + { + Ndk::World world; + const Ndk::EntityHandle& entity = world.CreateEntity(); + Ndk::VelocityComponent& velocityComponent = entity->AddComponent(); + Ndk::NodeComponent& nodeComponent = entity->AddComponent(); + + WHEN("We give a speed to our entity") + { + Nz::Vector3f velocity = Nz::Vector3f::Unit() * 2.f; + velocityComponent.linearVelocity = velocity; + world.Update(1.f); + + THEN("Our entity should have moved") + { + REQUIRE(nodeComponent.GetPosition().SquaredDistance(velocity) < 0.2f); + } + } + } +} \ No newline at end of file diff --git a/tests/SDK/NDK/World.cpp b/tests/SDK/NDK/World.cpp new file mode 100644 index 000000000..431490490 --- /dev/null +++ b/tests/SDK/NDK/World.cpp @@ -0,0 +1,103 @@ +#include +#include +#include + +namespace +{ + class UpdatableComponent : public Ndk::Component + { + public: + bool IsUpdated() + { + return m_updated; + } + + void SetUpdated() + { + m_updated = true; + } + + static Ndk::ComponentIndex componentIndex; + + private: + bool m_updated = false; + }; + + Ndk::ComponentIndex UpdatableComponent::componentIndex; + + class UpdateSystem : public Ndk::System + { + public: + UpdateSystem() + { + Requires(); + } + + ~UpdateSystem() = default; + + static Ndk::SystemIndex systemIndex; + + private: + void OnUpdate(float elapsedTime) override + { + for (const Ndk::EntityHandle& entity : GetEntities()) + { + UpdatableComponent& updatable = entity->GetComponent(); + updatable.SetUpdated(); + } + } + }; + + Ndk::SystemIndex UpdateSystem::systemIndex; +} + +SCENARIO("World", "[NDK][WORLD]") +{ + GIVEN("A brave new world and the update system") + { + Ndk::World world; + Ndk::BaseSystem& system = world.AddSystem(); + + WHEN("We had a new entity with an updatable component and a system") + { + const Ndk::EntityHandle& entity = world.CreateEntity(); + UpdatableComponent& component = entity->AddComponent(); + + THEN("We can get our entity and our system") + { + const Ndk::EntityHandle& fetchedEntity = world.GetEntity(entity->GetId()); + REQUIRE(fetchedEntity->GetWorld() == &world); + } + + THEN("We can clone it") + { + const Ndk::EntityHandle& clone = world.CloneEntity(entity->GetId()); + REQUIRE(world.IsEntityValid(clone)); + } + } + + AND_WHEN("We update our world with our entity") + { + REQUIRE(&world.GetSystem(UpdateSystem::systemIndex) == &world.GetSystem()); + const Ndk::EntityHandle& entity = world.CreateEntity(); + UpdatableComponent& component = entity->AddComponent(); + + THEN("Our entity component must be updated") + { + world.Update(1.f); + + REQUIRE(component.IsUpdated()); + } + + THEN("We kill our entity") + { + REQUIRE(entity->IsValid()); + + world.KillEntity(entity); + world.Update(1.f); + + REQUIRE(!world.IsEntityValid(entity)); + } + } + } +} \ No newline at end of file From 27d1fb048f69960251b8dff6460f2d3c3a7bf97d Mon Sep 17 00:00:00 2001 From: Gawaboumga Date: Sun, 21 Aug 2016 13:49:24 +0200 Subject: [PATCH 37/74] Fix documentation Former-commit-id: d43e254a2b72c53f09058ececd3bb449a9db9b37 [formerly 6351dd5b08b135d781a4ef646801ecf264cd3158] [formerly d43cdee4a57da3c91eb04f07e8b6cd8ab6311bb1 [formerly d22dfb0c17d68a4b4d4f21cd4c302b01d2340c92]] Former-commit-id: 09aca89659ff3eaf9a62d81458e055af07db19f7 [formerly d76a23b823cd559549b3e71a67b5fe18f9130869] Former-commit-id: a4180f4dabc413916bef4c102d414a03aa9c3d97 --- include/Nazara/Math/Algorithm.inl | 83 ++++++++++++++++--------------- src/Nazara/Graphics/Sprite.cpp | 4 +- src/Nazara/Graphics/TileMap.cpp | 11 ++++ src/Nazara/Network/Network.cpp | 2 +- 4 files changed, 56 insertions(+), 44 deletions(-) diff --git a/include/Nazara/Math/Algorithm.inl b/include/Nazara/Math/Algorithm.inl index 2c865ad1b..b61d82916 100644 --- a/include/Nazara/Math/Algorithm.inl +++ b/include/Nazara/Math/Algorithm.inl @@ -45,20 +45,21 @@ namespace Nz } template - // Les parenthèses autour de la condition sont nécesaires pour que GCC compile ça + // The parentheses are needed for GCC typename std::enable_if<(sizeof(T) > sizeof(UInt32)), unsigned int>::type IntegralLog2(T number) { static_assert(sizeof(T) % sizeof(UInt32) == 0, "Assertion failed"); - // L'algorithme pour le logarithme base 2 (au dessus) ne fonctionne qu'avec des nombres au plus 32bits - // ce code décompose les nombres plus grands en nombres 32 bits par masquage et bit shifting + // Masking and shifting bits to the right (to bring it back to 32 bits) + + // Call of the function with 32 bits number, if the result is non-null we have our answer for (int i = sizeof(T)-sizeof(UInt32); i >= 0; i -= sizeof(UInt32)) { - // Le masque 32 bits sur la partie du nombre qu'on traite actuellement + // The 32 bits mask on the part we are treating 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) + T val = (number & mask) >> i*8; // Masking and shifting bits to the right (to bring it back to 32 bits) - // Appel de la fonction avec le nombre 32bits, si le résultat est non-nul nous avons la réponse + // Call of the function with 32 bits number, if the result is non-null we have our answer unsigned int log2 = IntegralLog2(val); if (log2) return log2 + i*8; @@ -75,20 +76,20 @@ namespace Nz } template - // Les parenthèses autour de la condition sont nécesaires pour que GCC compile ça + // The parentheses are needed for GCC typename std::enable_if<(sizeof(T) > sizeof(UInt32)), unsigned int>::type IntegralLog2Pot(T number) { static_assert(sizeof(T) % sizeof(UInt32) == 0, "Assertion failed"); - // L'algorithme pour le logarithme base 2 (au dessus) ne fonctionne qu'avec des nombres au plus 32bits - // ce code décompose les nombres plus grands en nombres 32 bits par masquage et bit shifting + // The algorithm for logarithm in base 2 only works with numbers greather than 32 bits + // This code subdivides the biggest number into 32 bits ones for (int i = sizeof(T)-sizeof(UInt32); i >= 0; i -= sizeof(UInt32)) { - // Le masque 32 bits sur la partie du nombre qu'on traite actuellement + // The 32 bits mask on the part we are treating T mask = T(std::numeric_limits::max()) << i*8; - UInt32 val = UInt32((number & mask) >> i*8); // Masquage et shifting des bits vers la droite (pour le ramener sur 32bits) + UInt32 val = UInt32((number & mask) >> i*8); // Masking and shifting bits to the right (to bring it back to 32 bits) - // Appel de la fonction avec le nombre 32bits, si le résultat est non-nul nous avons la réponse + // Call of the function with 32 bits number, if the result is non-null we have our answer unsigned int log2 = IntegralLog2Pot(val); if (log2 || val == 1) return log2 + i*8; @@ -99,7 +100,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Approaches the objective, beginning with value and with increment * \return The nearest value of the objective you can get with the value and the increment for one step * @@ -121,7 +122,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Clamps value between min and max and returns the expected value * \return If value is not in the interval of min..max, value obtained is the nearest limit of this interval * @@ -137,7 +138,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets number of bits set in the number * \return The number of bits set to 1 * @@ -160,7 +161,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Converts degree to radian * \return The representation in radian of the angle in degree (0..2*pi) * @@ -174,7 +175,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the unit from degree and convert it according to NAZARA_MATH_ANGLE_RADIAN * \return Express the degrees * @@ -192,7 +193,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the unit from radian and convert it according to NAZARA_MATH_ANGLE_RADIAN * \return Express the radians * @@ -210,7 +211,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the nearest power of two for the number * \return First power of two containing the number * @@ -229,7 +230,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits * @@ -257,7 +258,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits * @@ -279,7 +280,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits * @@ -295,7 +296,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits * @@ -312,7 +313,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits * @@ -328,7 +329,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits * @@ -345,7 +346,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits + 1 for the dot * @@ -360,7 +361,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits + 1 for the dot * @@ -375,7 +376,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the number of digits to represent the number in base 10 * \return Number of digits + 1 for the dot * @@ -390,7 +391,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the log in base 2 of integral number * \return Log of the number (floor) * @@ -408,7 +409,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the log in base 2 of integral number, only works for power of two ! * \return Log of the number * @@ -426,7 +427,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the power of integrals * \return base^exponent for integral * @@ -445,7 +446,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Interpolates the value to other one with a factor of interpolation * \return A new value which is the interpolation of two values * @@ -466,7 +467,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Multiplies X and Y, then add Z * \return The result of X * Y + Z * @@ -508,7 +509,7 @@ namespace Nz #endif /*! - * \ingroup math + * \ingroup math * \brief Normalizes the angle * \return Normalized value between 0..2*(pi if radian or 180 if degrees) * @@ -534,7 +535,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Checks whether two numbers are equal * \return true if they are equal within a certain epsilon * @@ -550,7 +551,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Checks whether two numbers are equal * \return true if they are equal within the max difference * @@ -571,7 +572,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Converts the number to String * \return String representation of the number * @@ -623,7 +624,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Converts radian to degree * \return The representation in degree of the angle in radian (0..360) * @@ -637,7 +638,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Converts the string to number * \return Number which is represented by the string * @@ -699,7 +700,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the degree from unit and convert it according to NAZARA_MATH_ANGLE_RADIAN * \return Express in degrees * @@ -717,7 +718,7 @@ namespace Nz } /*! - * \ingroup math + * \ingroup math * \brief Gets the radian from unit and convert it according to NAZARA_MATH_ANGLE_RADIAN * \return Express in radians * diff --git a/src/Nazara/Graphics/Sprite.cpp b/src/Nazara/Graphics/Sprite.cpp index 4bf076183..5ef82cddf 100644 --- a/src/Nazara/Graphics/Sprite.cpp +++ b/src/Nazara/Graphics/Sprite.cpp @@ -75,7 +75,7 @@ namespace Nz } /*! - * \brief Initializes the sprite librairies + * \brief Initializes the sprite library * \return true If successful * * \remark Produces a NazaraError if the sprite library failed to be initialized @@ -93,7 +93,7 @@ namespace Nz } /*! - * \brief Uninitializes the sprite librairies + * \brief Uninitializes the sprite library */ void Sprite::Uninitialize() diff --git a/src/Nazara/Graphics/TileMap.cpp b/src/Nazara/Graphics/TileMap.cpp index 9d835cb24..2c6e26aa4 100644 --- a/src/Nazara/Graphics/TileMap.cpp +++ b/src/Nazara/Graphics/TileMap.cpp @@ -90,6 +90,13 @@ namespace Nz } } + /*! + * \brief Initializes the tilemap library + * \return true If successful + * + * \remark Produces a NazaraError if the tilemap library failed to be initialized + */ + bool TileMap::Initialize() { if (!TileMapLibrary::Initialize()) @@ -101,6 +108,10 @@ namespace Nz return true; } + /*! + * \brief Uninitializes the tilemap library + */ + void TileMap::Uninitialize() { TileMapLibrary::Uninitialize(); diff --git a/src/Nazara/Network/Network.cpp b/src/Nazara/Network/Network.cpp index fa3813dd4..3e798e681 100644 --- a/src/Nazara/Network/Network.cpp +++ b/src/Nazara/Network/Network.cpp @@ -93,7 +93,7 @@ namespace Nz } /*! - * \brief Uninitializes the Core module + * \brief Uninitializes the Network module * * \remark Produces a NazaraNotice */ From 0db53f8aafcaa9dfcd55921e5f75574d0b6b0394 Mon Sep 17 00:00:00 2001 From: S6066 Date: Tue, 23 Aug 2016 16:49:47 +0200 Subject: [PATCH 38/74] Update Entity.hpp Former-commit-id: 1b7e8af53d5df90da6ecad26408e0296f4383290 [formerly b4d6cbc46d87a84927f0a832f3ded26453c53ada] [formerly 79671fe49616035368284c6690d0585d9c22d144 [formerly 45e76a15885bab06c77b58cc5910ff32e5b47f16]] Former-commit-id: 66753e226681587402b8c9b13b4bd76a3aa16a1f [formerly 4c779422137a298036a73f0f1a94fc7a12505bc0] Former-commit-id: be21ca9b5c2c4cb40998c939f348eb1e00488b9d --- SDK/include/NDK/Entity.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDK/include/NDK/Entity.hpp b/SDK/include/NDK/Entity.hpp index 5aeeb8226..dbe77815c 100644 --- a/SDK/include/NDK/Entity.hpp +++ b/SDK/include/NDK/Entity.hpp @@ -36,7 +36,7 @@ namespace Ndk const EntityHandle& Clone() const; - inline void Enable(bool enable); + inline void Enable(bool enable = true); inline BaseComponent& GetComponent(ComponentIndex index); template ComponentType& GetComponent(); From 62b53933c14aca313273fe42db7de2c4d0c0f19c Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 23 Aug 2016 18:22:09 +0200 Subject: [PATCH 39/74] Sdk/Binding: Fix Entity::Enable default argument Former-commit-id: ca596b8effcdd6028aa665b55d4f6df79978ae2c [formerly 74e04834586b29d9b1e5b6a5d35c189a0e52744e] [formerly ef7ba96ec9a4d2bd399f5a17286f2e0984f3e328 [formerly e54635c17ef79cf72e9d9ba61ee47bfb4e3d1641]] Former-commit-id: 305e7ab658b9ff15aa036354b35d761a2481c02f [formerly a5d1243b7c37850bfcbd32deed477b172ab42342] Former-commit-id: 8bd8da5e957777f2e3828f4b871636b7d57b3f10 --- SDK/src/NDK/LuaBinding_SDK.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDK/src/NDK/LuaBinding_SDK.cpp b/SDK/src/NDK/LuaBinding_SDK.cpp index 5b6ad7dc9..bf66cbf00 100644 --- a/SDK/src/NDK/LuaBinding_SDK.cpp +++ b/SDK/src/NDK/LuaBinding_SDK.cpp @@ -57,7 +57,7 @@ namespace Ndk #endif /*********************************** Ndk::Entity **********************************/ - entityClass.BindMethod("Enable", &Entity::Enable); + entityClass.BindMethod("Enable", &Entity::Enable, true); entityClass.BindMethod("GetId", &Entity::GetId); entityClass.BindMethod("GetWorld", &Entity::GetWorld); entityClass.BindMethod("Kill", &Entity::Kill); From 6a9b220f9c6474c67bd3ff6ea7edbae1b5c5a6ba Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 23 Aug 2016 18:25:10 +0200 Subject: [PATCH 40/74] Sdk/Console: Remove debug error Former-commit-id: e61d02701914ef72992f4215101932034c9e1955 [formerly 574b436182acaea0150fae9354eda683806448e0] [formerly 58cb547714a8ab0c091b54d44f83213b20d66368 [formerly 87cdc49740f693b1b66c1944080da56b055c6824]] Former-commit-id: bf8fd50e5d191795955b4b837120858abaeedacb [formerly 6c9e6c8c650bf2c2495d7f35d51f5c1252fd4113] Former-commit-id: d6291244b05c46535c79b42a41dc22031824876f --- SDK/src/NDK/Console.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/SDK/src/NDK/Console.cpp b/SDK/src/NDK/Console.cpp index dd379cd4a..94a80b749 100644 --- a/SDK/src/NDK/Console.cpp +++ b/SDK/src/NDK/Console.cpp @@ -320,9 +320,7 @@ namespace Ndk unsigned int lineHeight = m_defaultFont->GetSizeInfo(m_characterSize).lineHeight; Ndk::NodeComponent& inputNode = m_input->GetComponent(); - NazaraError(inputNode.GetPosition().ToString()); inputNode.SetPosition(0.f, m_size.y - lineHeight - 5.f); - NazaraError(inputNode.GetPosition().ToString()); float historyHeight = m_size.y - lineHeight - 5.f - 2.f; m_historyBackgroundSprite->SetSize(m_size.x, historyHeight); @@ -330,14 +328,10 @@ namespace Ndk m_maxHistoryLines = static_cast(std::ceil(historyHeight / lineHeight)); Ndk::NodeComponent& historyNode = m_history->GetComponent(); - NazaraError(historyNode.GetPosition().ToString()); historyNode.SetPosition(0.f, historyHeight - m_maxHistoryLines * lineHeight); - NazaraError(historyNode.GetPosition().ToString()); Ndk::NodeComponent& inputBackgroundNode = m_inputBackground->GetComponent(); - NazaraError(inputBackgroundNode.GetPosition().ToString()); inputBackgroundNode.SetPosition(0.f, historyHeight + 2.f); - NazaraError(inputBackgroundNode.GetPosition().ToString()); m_inputBackgroundSprite->SetSize(m_size.x, m_size.y - historyHeight); } From c5c1c454f84e131ce1b57cb00e04e206d73cf495 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 25 Aug 2016 13:07:19 +0200 Subject: [PATCH 41/74] Doc: Parse SDK files Former-commit-id: 94d9118cec01ee4d12a54a67d55a0371bc9ba468 [formerly 8c2a965cd764520350610b9850e8197d839cdc3d] [formerly ce2a5f4595aa3ed4a29a3515af6bba3636475b83 [formerly 859959e9a29925ce0890646a1642f94d86c85e23]] Former-commit-id: 40a94eec9460cc432128b67f3812e62a3a2c2690 [formerly 52ee3533c6dfd71eeaaa1ecf1d0399e0db5435e0] Former-commit-id: 9b12d3abb8b596f975ac4bed4717abaeb628c5e9 --- Doxyfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doxyfile b/Doxyfile index 7ac8e5f8c..47af03df4 100644 --- a/Doxyfile +++ b/Doxyfile @@ -776,7 +776,9 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = include \ - src + src \ + SDK/include \ + SDK/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses From 5528b26a2525301e8d46e0d6a667d1bbe478cd26 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 25 Aug 2016 16:28:25 +0200 Subject: [PATCH 42/74] Test/StateMachine: Fix compilation Former-commit-id: 8295c8c806237bd8e19b1552a49261a4ffe88f25 [formerly 787c63351091093758db9e757f5fb25503fe1148] [formerly 2d6ee7f2e25afe0cbefb253cfd3ff14a98fd0d1c [formerly 478af98f46f86377def455f096426cfc8b54fb63]] Former-commit-id: 96b7dc76d50ed661f9a8a0d785d5fc0d00b3a009 [formerly 4f4129ba5e902fece9d58530c40c8d134a05cc27] Former-commit-id: bf52731510dbb1269be506e9ebea6f0733045b4a --- tests/SDK/NDK/StateMachine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/SDK/NDK/StateMachine.cpp b/tests/SDK/NDK/StateMachine.cpp index 604aa6f9f..44b0e0dfd 100644 --- a/tests/SDK/NDK/StateMachine.cpp +++ b/tests/SDK/NDK/StateMachine.cpp @@ -21,6 +21,7 @@ class TestState : public Ndk::State bool Update(Ndk::StateMachine& fsm, float elapsedTime) override { m_isUpdated = true; + return true; } private: @@ -45,4 +46,4 @@ SCENARIO("State & StateMachine", "[NDK][STATE]") } } } -} \ No newline at end of file +} From 9fa65db6b91070efd33229bb31551c155a4876a9 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 01:08:38 +0200 Subject: [PATCH 43/74] Utility/Window: Add new event system, based on signals Old pooling-based system remains for now but is now deprecated Former-commit-id: d72e76bab0887baa03286aed78f7ded0a2e31928 [formerly ec70c388b12fb2b91017e54f4a6d67bac1c62335] [formerly 1a6692f78aedb5328b223c04c566d32467db6c92 [formerly 64b8d386ff07df682760ec632d753545ecff7856]] Former-commit-id: aba6a64e2a31336ae1835bc9954d22488fda2000 [formerly a42eceabc84044a258926385db3944ada398f4fa] Former-commit-id: 07a208c5693749b325e8574b52e7affa298bb147 --- SDK/src/NDK/Application.cpp | 2 + examples/Tut01/main.cpp | 8 +-- include/Nazara/Utility/EventHandler.hpp | 47 ++++++++++++++ include/Nazara/Utility/EventHandler.inl | 82 +++++++++++++++++++++++++ include/Nazara/Utility/Window.hpp | 13 ++-- include/Nazara/Utility/Window.inl | 58 +++++++++-------- src/Nazara/Utility/Window.cpp | 9 +++ 7 files changed, 181 insertions(+), 38 deletions(-) create mode 100644 include/Nazara/Utility/EventHandler.hpp create mode 100644 include/Nazara/Utility/EventHandler.inl diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index 5e3331d73..63e834bd0 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -26,6 +26,8 @@ namespace Ndk { Nz::Window& window = **it; + window.ProcessEvents(); + if (!window.IsOpen(true)) { it = m_windows.erase(it); diff --git a/examples/Tut01/main.cpp b/examples/Tut01/main.cpp index d1ebcd5d4..f5fca94a0 100644 --- a/examples/Tut01/main.cpp +++ b/examples/Tut01/main.cpp @@ -16,6 +16,7 @@ int main() Nz::RenderWindow& mainWindow = application.AddWindow(); mainWindow.Create(Nz::VideoMode(800, 600, 32), "Test"); + Ndk::World& world = application.AddWorld(); world.GetSystem().SetGlobalUp(Nz::Vector3f::Down()); world.GetSystem().SetDefaultBackground(Nz::ColorBackground::New(Nz::Color(192, 100, 100))); @@ -43,13 +44,6 @@ int main() while (application.Run()) { - Nz::WindowEvent event; - while (mainWindow.PollEvent(&event)) - { - if (event.type == Nz::WindowEventType_Quit) - application.Quit(); - } - mainWindow.Display(); } diff --git a/include/Nazara/Utility/EventHandler.hpp b/include/Nazara/Utility/EventHandler.hpp new file mode 100644 index 000000000..b35ef96cf --- /dev/null +++ b/include/Nazara/Utility/EventHandler.hpp @@ -0,0 +1,47 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Engine - Utility module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#pragma once + +#ifndef NAZARA_EVENTHANDLER_HPP +#define NAZARA_EVENTHANDLER_HPP + +#include +#include +#include +#include + +namespace Nz +{ + class EventHandler + { + public: + EventHandler() = default; + EventHandler(const EventHandler&); + EventHandler(EventHandler&&) = default; + ~EventHandler() = default; + + inline void Dispatch(const WindowEvent& event); + + NazaraSignal(OnGainedFocus, const EventHandler* /*eventHandler*/); + NazaraSignal(OnLostFocus, const EventHandler* /*eventHandler*/); + NazaraSignal(OnKeyPressed, const EventHandler* /*eventHandler*/, const WindowEvent::KeyEvent& /*event*/); + NazaraSignal(OnKeyReleased, const EventHandler* /*eventHandler*/, const WindowEvent::KeyEvent& /*event*/); + NazaraSignal(OnMouseButtonDoubleClicked, const EventHandler* /*eventHandler*/, const WindowEvent::MouseButtonEvent& /*event*/); + NazaraSignal(OnMouseButtonPressed, const EventHandler* /*eventHandler*/, const WindowEvent::MouseButtonEvent& /*event*/); + NazaraSignal(OnMouseButtonReleased, const EventHandler* /*eventHandler*/, const WindowEvent::MouseButtonEvent& /*event*/); + NazaraSignal(OnMouseEntered, const EventHandler* /*eventHandler*/); + NazaraSignal(OnMouseLeft, const EventHandler* /*eventHandler*/); + NazaraSignal(OnMouseMoved, const EventHandler* /*eventHandler*/, const WindowEvent::MouseMoveEvent& /*event*/); + NazaraSignal(OnMouseWheelMoved, const EventHandler* /*eventHandler*/, const WindowEvent::MouseWheelEvent& /*event*/); + NazaraSignal(OnMoved, const EventHandler* /*eventHandler*/, const WindowEvent::PositionEvent& /*event*/); + NazaraSignal(OnQuit, const EventHandler* /*eventHandler*/); + NazaraSignal(OnResized, const EventHandler* /*eventHandler*/, const WindowEvent::SizeEvent& /*event*/); + NazaraSignal(OnTextEntered, const EventHandler* /*eventHandler*/, const WindowEvent::TextEvent& /*event*/); + }; +} + +#include + +#endif // NAZARA_EVENTHANDLER_HPP diff --git a/include/Nazara/Utility/EventHandler.inl b/include/Nazara/Utility/EventHandler.inl new file mode 100644 index 000000000..4fadf6b43 --- /dev/null +++ b/include/Nazara/Utility/EventHandler.inl @@ -0,0 +1,82 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Engine - Utility module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#include +#include +#include + +namespace Nz +{ + inline EventHandler::EventHandler(const EventHandler&) + { + } + + inline void EventHandler::Dispatch(const WindowEvent& event) + { + switch (event.type) + { + case WindowEventType_GainedFocus: + OnGainedFocus(this); + break; + + case WindowEventType_KeyPressed: + OnKeyPressed(this, event.key); + break; + + case WindowEventType_KeyReleased: + OnKeyReleased(this, event.key); + break; + + case WindowEventType_LostFocus: + OnLostFocus(this); + break; + + case WindowEventType_MouseButtonDoubleClicked: + OnMouseButtonDoubleClicked(this, event.mouseButton); + break; + + case WindowEventType_MouseButtonPressed: + OnMouseButtonPressed(this, event.mouseButton); + break; + + case WindowEventType_MouseButtonReleased: + OnMouseButtonPressed(this, event.mouseButton); + break; + + case WindowEventType_MouseEntered: + OnMouseEntered(this); + break; + + case WindowEventType_MouseLeft: + OnMouseLeft(this); + break; + + case WindowEventType_MouseMoved: + OnMouseMoved(this, event.mouseMove); + break; + + case WindowEventType_MouseWheelMoved: + OnMouseWheelMoved(this, event.mouseWheel); + break; + + case WindowEventType_Moved: + OnMoved(this, event.position); + break; + + case WindowEventType_Quit: + OnQuit(this); + break; + + case WindowEventType_Resized: + OnResized(this, event.size); + break; + + case WindowEventType_TextEntered: + OnTextEntered(this, event.text); + break; + } + } +} + +#include diff --git a/include/Nazara/Utility/Window.hpp b/include/Nazara/Utility/Window.hpp index af23be7f1..ba67c17cb 100644 --- a/include/Nazara/Utility/Window.hpp +++ b/include/Nazara/Utility/Window.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -52,9 +52,11 @@ namespace Nz void Destroy(); + NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") inline void EnableEventPolling(bool enable); void EnableKeyRepeat(bool enable); void EnableSmoothScrolling(bool enable); + EventHandler& GetEventHandler(); WindowHandle GetHandle() const; unsigned int GetHeight() const; Vector2i GetPosition() const; @@ -71,7 +73,9 @@ namespace Nz inline bool IsValid() const; bool IsVisible() const; - bool PollEvent(WindowEvent* event); + NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") bool PollEvent(WindowEvent* event); + + void ProcessEvents(bool block = false); void SetCursor(WindowCursor cursor); void SetCursor(const Cursor& cursor); @@ -90,7 +94,7 @@ namespace Nz void SetTitle(const String& title); void SetVisible(bool visible); - bool WaitEvent(WindowEvent* event); + NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system")bool WaitEvent(WindowEvent* event); Window& operator=(const Window&) = delete; inline Window& operator=(Window&& window); @@ -114,10 +118,11 @@ namespace Nz ConditionVariable m_eventCondition; Mutex m_eventMutex; Mutex m_eventConditionMutex; - bool m_eventListener; bool m_waitForEvent; #endif + EventHandler m_eventHandler; bool m_closed; + bool m_eventPolling; bool m_ownsWindow; }; } diff --git a/include/Nazara/Utility/Window.inl b/include/Nazara/Utility/Window.inl index ebf5dfbee..349328e55 100644 --- a/include/Nazara/Utility/Window.inl +++ b/include/Nazara/Utility/Window.inl @@ -11,39 +11,24 @@ namespace Nz /*! * \class Nz::Window */ - inline Window::Window() : - #if NAZARA_UTILITY_THREADED_WINDOW m_impl(nullptr), - m_eventListener(true), - m_waitForEvent(false) - #else - m_impl(nullptr) + #if NAZARA_UTILITY_THREADED_WINDOW + m_waitForEvent(false), #endif + m_eventPolling(false) { } inline Window::Window(VideoMode mode, const String& title, UInt32 style) : - #if NAZARA_UTILITY_THREADED_WINDOW - m_impl(nullptr), - m_eventListener(true), - m_waitForEvent(false) - #else - m_impl(nullptr) - #endif + Window() { ErrorFlags flags(ErrorFlag_ThrowException, true); Create(mode, title, style); } inline Window::Window(WindowHandle handle) : - #if NAZARA_UTILITY_THREADED_WINDOW - m_impl(nullptr), - m_eventListener(true), - m_waitForEvent(false) - #else - m_impl(nullptr) - #endif + Window() { ErrorFlags flags(ErrorFlag_ThrowException, true); Create(handle); @@ -59,7 +44,7 @@ namespace Nz m_eventCondition(std::move(window.m_eventCondition)), m_eventMutex(std::move(window.m_eventMutex)), m_eventConditionMutex(std::move(window.m_eventConditionMutex)), - m_eventListener(window.m_eventListener), + m_eventPolling(window.m_eventPolling), m_waitForEvent(window.m_waitForEvent), #endif m_closed(window.m_closed), @@ -78,6 +63,21 @@ namespace Nz m_closed = true; // The window will be closed at the next non-const IsOpen() call } + inline void Window::EnableEventPolling(bool enable) + { + m_eventPolling = enable; + if (!m_eventPolling) + { + while (!m_events.empty()) + m_events.pop(); + } + } + + inline EventHandler& Nz::Window::GetEventHandler() + { + return m_eventHandler; + } + inline bool Window::IsOpen(bool checkClosed) { if (!m_impl) @@ -108,7 +108,11 @@ namespace Nz m_eventMutex.Lock(); #endif - m_events.push(event); + if (m_eventPolling) + m_events.push(event); + + m_eventHandler.Dispatch(event); + if (event.type == WindowEventType_Resized) OnWindowResized(); @@ -132,10 +136,11 @@ namespace Nz { Destroy(); - m_closed = window.m_closed; - m_impl = window.m_impl; - m_events = std::move(window.m_events); - m_ownsWindow = window.m_ownsWindow; + m_closed = window.m_closed; + m_eventPolling = window.m_eventPolling; + m_impl = window.m_impl; + m_events = std::move(window.m_events); + m_ownsWindow = window.m_ownsWindow; window.m_impl = nullptr; @@ -143,7 +148,6 @@ namespace Nz m_eventCondition = std::move(window.m_eventCondition); m_eventMutex = std::move(window.m_eventMutex); m_eventConditionMutex = std::move(window.m_eventConditionMutex); - m_eventListener = window.m_eventListener; m_waitForEvent = window.m_waitForEvent; #endif diff --git a/src/Nazara/Utility/Window.cpp b/src/Nazara/Utility/Window.cpp index e246144d2..02ed0f40a 100644 --- a/src/Nazara/Utility/Window.cpp +++ b/src/Nazara/Utility/Window.cpp @@ -325,6 +325,15 @@ namespace Nz return false; } + void Window::ProcessEvents(bool block) + { + NazaraAssert(m_impl, "Window not created"); + + #if !NAZARA_UTILITY_THREADED_WINDOW + m_impl->ProcessEvents(block); + #endif + } + void Window::SetCursor(WindowCursor cursor) { #if NAZARA_UTILITY_SAFE From 414bc1f5b4f70577d624c7afc94a0c8a9cb9b5ee Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 01:09:15 +0200 Subject: [PATCH 44/74] Utility/Window: Window now automatically close on quit event Former-commit-id: da6eb0214de58af84c0cbedffc0916a1a5b335e8 [formerly ca81aa0c8f8da61e841a1ccb85295f99efe7e317] [formerly 30f112245ee8eee0ed5f4db88cc4a7c13b9d9a9c [formerly f404a5b5bef35d9c80232371a40bd04c5acc8cfc]] Former-commit-id: c1443eed4321f48aa42e93d2679f0eddaacbbb5d [formerly 386ba36f29ace0e098fd95e4f05fec6498b4183a] Former-commit-id: 1fb357a16a42eee7d0658d09716ef7cdcca584ab --- include/Nazara/Utility/Window.hpp | 2 ++ include/Nazara/Utility/Window.inl | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/Nazara/Utility/Window.hpp b/include/Nazara/Utility/Window.hpp index ba67c17cb..b46efd6b9 100644 --- a/include/Nazara/Utility/Window.hpp +++ b/include/Nazara/Utility/Window.hpp @@ -52,6 +52,7 @@ namespace Nz void Destroy(); + inline void EnableCloseOnQuit(bool closeOnQuit); NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") inline void EnableEventPolling(bool enable); void EnableKeyRepeat(bool enable); void EnableSmoothScrolling(bool enable); @@ -122,6 +123,7 @@ namespace Nz #endif EventHandler m_eventHandler; bool m_closed; + bool m_closeOnQuit; bool m_eventPolling; bool m_ownsWindow; }; diff --git a/include/Nazara/Utility/Window.inl b/include/Nazara/Utility/Window.inl index 349328e55..39c530e24 100644 --- a/include/Nazara/Utility/Window.inl +++ b/include/Nazara/Utility/Window.inl @@ -16,6 +16,7 @@ namespace Nz #if NAZARA_UTILITY_THREADED_WINDOW m_waitForEvent(false), #endif + m_closeOnQuit(true), m_eventPolling(false) { } @@ -44,10 +45,11 @@ namespace Nz m_eventCondition(std::move(window.m_eventCondition)), m_eventMutex(std::move(window.m_eventMutex)), m_eventConditionMutex(std::move(window.m_eventConditionMutex)), - m_eventPolling(window.m_eventPolling), m_waitForEvent(window.m_waitForEvent), #endif m_closed(window.m_closed), + m_closeOnQuit(window.m_closeOnQuit), + m_eventPolling(window.m_eventPolling), m_ownsWindow(window.m_ownsWindow) { window.m_impl = nullptr; @@ -63,6 +65,11 @@ namespace Nz m_closed = true; // The window will be closed at the next non-const IsOpen() call } + inline void Window::EnableCloseOnQuit(bool closeOnQuit) + { + m_closeOnQuit = closeOnQuit; + } + inline void Window::EnableEventPolling(bool enable) { m_eventPolling = enable; @@ -116,6 +123,9 @@ namespace Nz if (event.type == WindowEventType_Resized) OnWindowResized(); + if (event.type == WindowEventType_Quit && m_closeOnQuit) + Close(); + #if NAZARA_UTILITY_THREADED_WINDOW m_eventMutex.Unlock(); @@ -137,6 +147,7 @@ namespace Nz Destroy(); m_closed = window.m_closed; + m_closeOnQuit = window.m_closeOnQuit; m_eventPolling = window.m_eventPolling; m_impl = window.m_impl; m_events = std::move(window.m_events); From 527c8ea0cfb32e60cd810f11f3452bea2d4e2a5c Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 01:09:40 +0200 Subject: [PATCH 45/74] Network/SocketImpl: Fix compilation for recent MinGW versions Former-commit-id: 2ae224dcad69a0810766070d2b2da5b27e7baee4 [formerly 650e490cc39a9d9c418d2b1d51e99abffc1405b0] [formerly 01200d66fef998690c174eb8b9dfe5e99c2f9dc0 [formerly ab94280b73977d0fafcde35eb84cf70f48f34382]] Former-commit-id: 7dda3b7eb0c7343300c89be7a094068a54f49e6f [formerly 19c82582082ff5657ccb4a3259c94c57984cb9a7] Former-commit-id: 8e2bea477e1d83645530b00357315ae8160376c5 --- src/Nazara/Network/Win32/SocketImpl.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Nazara/Network/Win32/SocketImpl.cpp b/src/Nazara/Network/Win32/SocketImpl.cpp index ab7ba7fe3..f35a4a078 100644 --- a/src/Nazara/Network/Win32/SocketImpl.cpp +++ b/src/Nazara/Network/Win32/SocketImpl.cpp @@ -8,8 +8,9 @@ #include #include -#ifdef NAZARA_COMPILER_MINGW -// MinGW is lacking Mstcpip.h and that's too bad + +// Some compilers (olders versions of MinGW) are lacking Mstcpip.h which defines the following struct/#define +// Define them ourself for now struct tcp_keepalive { u_long onoff; @@ -18,9 +19,6 @@ struct tcp_keepalive }; #define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4) -#else - #include -#endif // NAZARA_COMPILER_MINGW #include From 52afd9fb3f35912410da7926b9f413e3be715eb8 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 01:20:31 +0200 Subject: [PATCH 46/74] Utility/Window: Improve visibility of deprecated methods Former-commit-id: 27a46b53eb4d239d9f48157aeb339562a3247d7c [formerly c53e2e7c4b38b94befb1ef968867b6e0436b3e89] [formerly 20a1935be4339f8766d419805843514c382f53b1 [formerly f152706c89a0be8e81c7e8ebfe2bc1c15073dc52]] Former-commit-id: 34f818c35fdc341952e5f4d0abcc52ea156ba4a6 [formerly 460e972df1e0f71da2d05ce4262b250532d13d0d] Former-commit-id: af5af59a338b0b9c2cb48a8e0b1fdc697c9952d5 --- include/Nazara/Utility/Window.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/Nazara/Utility/Window.hpp b/include/Nazara/Utility/Window.hpp index b46efd6b9..e544093c5 100644 --- a/include/Nazara/Utility/Window.hpp +++ b/include/Nazara/Utility/Window.hpp @@ -53,7 +53,10 @@ namespace Nz void Destroy(); inline void EnableCloseOnQuit(bool closeOnQuit); - NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") inline void EnableEventPolling(bool enable); + + NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") + inline void EnableEventPolling(bool enable); + void EnableKeyRepeat(bool enable); void EnableSmoothScrolling(bool enable); @@ -74,7 +77,8 @@ namespace Nz inline bool IsValid() const; bool IsVisible() const; - NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") bool PollEvent(WindowEvent* event); + NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") + bool PollEvent(WindowEvent* event); void ProcessEvents(bool block = false); @@ -95,7 +99,8 @@ namespace Nz void SetTitle(const String& title); void SetVisible(bool visible); - NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system")bool WaitEvent(WindowEvent* event); + NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") + bool WaitEvent(WindowEvent* event); Window& operator=(const Window&) = delete; inline Window& operator=(Window&& window); From 6c031d7bedec8ea39cad8bda3fb2033e30cd1f59 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 01:22:47 +0200 Subject: [PATCH 47/74] Example/FirstScene: Fix event handling Former-commit-id: 3df87a66a47ed6c920ada5e82382c08fc43f74ac [formerly ac9e4cec56ddf7d6ab52683b8bb46bf93693ebd2] [formerly 9929ba33dde25afe7d6610bf7194c6e4fcf65b08 [formerly 50ebcce013b250739688ead06e428e56a59d2fbd]] Former-commit-id: b30b4d96c2d4203705224511e99536cabd21bbb9 [formerly 48a867c50010f962f8a7609fab094290d274414c] Former-commit-id: aea00b4a975d02a16fe3c10e2a67a0bf8bbf2ac4 --- examples/FirstScene/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/FirstScene/main.cpp b/examples/FirstScene/main.cpp index 07e26cd1c..0a471acee 100644 --- a/examples/FirstScene/main.cpp +++ b/examples/FirstScene/main.cpp @@ -329,6 +329,8 @@ int main() lua.PushGlobal("Spaceship", spaceship->CreateHandle()); lua.PushGlobal("World", world->CreateHandle()); + window.EnableEventPolling(true); // Déprécié + // Début de la boucle de rendu du programme (s'occupant par exemple de mettre à jour le monde) while (application.Run()) { From 449bcfc4626dc47c2f807ae40493ad80eb1282fd Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 18:02:07 +0200 Subject: [PATCH 48/74] Utility/EventHandler: Add OnEvent signal Former-commit-id: c4f6d185d78db4d9fa0e0ca76cf7b42768cd2ed3 [formerly 62df0f1948485951d72c42a51b511ecc5b283278] [formerly 444726d074e7e939db81547bf2f3dbcdc9eb25f6 [formerly 38d61f87a4280a20ac94286481dd418d5d931989]] Former-commit-id: 5a075b3e46f01486271fe5157b7176e768d8f939 [formerly bde57734c06d9d0b8220b65348cf8a67f971e228] Former-commit-id: 5e0857da1061965a4f8d9cf1c181ed25bf511320 --- include/Nazara/Utility/EventHandler.hpp | 3 ++- include/Nazara/Utility/EventHandler.inl | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/Nazara/Utility/EventHandler.hpp b/include/Nazara/Utility/EventHandler.hpp index b35ef96cf..2464d5e72 100644 --- a/include/Nazara/Utility/EventHandler.hpp +++ b/include/Nazara/Utility/EventHandler.hpp @@ -18,12 +18,13 @@ namespace Nz { public: EventHandler() = default; - EventHandler(const EventHandler&); + explicit EventHandler(const EventHandler&); EventHandler(EventHandler&&) = default; ~EventHandler() = default; inline void Dispatch(const WindowEvent& event); + NazaraSignal(OnEvent, const EventHandler* /*eventHandler*/, const WindowEvent& /*event*/); NazaraSignal(OnGainedFocus, const EventHandler* /*eventHandler*/); NazaraSignal(OnLostFocus, const EventHandler* /*eventHandler*/); NazaraSignal(OnKeyPressed, const EventHandler* /*eventHandler*/, const WindowEvent::KeyEvent& /*event*/); diff --git a/include/Nazara/Utility/EventHandler.inl b/include/Nazara/Utility/EventHandler.inl index 4fadf6b43..c066b6810 100644 --- a/include/Nazara/Utility/EventHandler.inl +++ b/include/Nazara/Utility/EventHandler.inl @@ -14,6 +14,8 @@ namespace Nz inline void EventHandler::Dispatch(const WindowEvent& event) { + OnEvent(this, event); + switch (event.type) { case WindowEventType_GainedFocus: From 6872616ca49f8b27725943b686e745403d132e36 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 18:10:09 +0200 Subject: [PATCH 49/74] Sdk/Application: Add Console and FPSCounter overlays This allows any Nazara-powered application to enable a ready-to-use console or a working FPS counter Former-commit-id: 274b276313b530ff8c99f3e0fb43c8b78689d787 [formerly 36e3a7e9d0d050af4b217311bde4496597e37c37] [formerly 69146c2fc6887f86b9c39d0265a95a4ba003f41e [formerly 72a66d7a31ceb87197b800813c90d43f73fc26b4]] Former-commit-id: 3fda987313648101b8a423e5e3aa8b0cd67a1c72 [formerly 5f9d42cdc5ed5443846531bad26059f66670df63] Former-commit-id: 2ef1496fb4a379e14f9c11c788da306eff465719 --- SDK/include/NDK/Application.hpp | 76 +++++++++++- SDK/include/NDK/Application.inl | 199 ++++++++++++++++++++++++++++++-- SDK/src/NDK/Application.cpp | 132 ++++++++++++++++++++- SDK/src/NDK/LuaBinding_SDK.cpp | 7 ++ examples/FirstScene/main.cpp | 129 ++++----------------- 5 files changed, 423 insertions(+), 120 deletions(-) diff --git a/SDK/include/NDK/Application.hpp b/SDK/include/NDK/Application.hpp index 6a375776c..5eca90961 100644 --- a/SDK/include/NDK/Application.hpp +++ b/SDK/include/NDK/Application.hpp @@ -8,18 +8,34 @@ #define NDK_APPLICATION_HPP #include +#include #include #include -#include #include +#include #include +#ifndef NDK_SERVER +#include +#include +#include +#include +#include +#include +#endif + namespace Ndk { class NDK_API Application { public: + #ifndef NDK_SERVER + struct ConsoleOverlay; + struct FPSCounterOverlay; + #endif + inline Application(); + inline Application(int argc, const char* argv[]); Application(const Application&) = delete; Application(Application&&) = delete; inline ~Application(); @@ -29,8 +45,21 @@ namespace Ndk #endif template World& AddWorld(Args&&... args); + #ifndef NDK_SERVER + inline void EnableConsole(bool enable); + inline void EnableFPSCounter(bool enable); + + inline ConsoleOverlay& GetConsoleOverlay(std::size_t windowIndex = 0U); + inline FPSCounterOverlay& GetFPSCounterOverlay(std::size_t windowIndex = 0U); + #endif + inline float GetUpdateTime() const; + #ifndef NDK_SERVER + inline bool IsConsoleEnabled() const; + inline bool IsFPSCounterEnabled() const; + #endif + bool Run(); #ifndef NDK_SERVER @@ -44,13 +73,56 @@ namespace Ndk inline static Application* Instance(); + #ifndef NDK_SERVER + struct ConsoleOverlay + { + std::unique_ptr console; + Nz::LuaInstance lua; + + NazaraSlot(Nz::EventHandler, OnEvent, eventSlot); + NazaraSlot(Nz::EventHandler, OnKeyPressed, keyPressedSlot); + NazaraSlot(Nz::EventHandler, OnResized, resizedSlot); + NazaraSlot(Nz::Log, OnLogWrite, logSlot); + }; + + struct FPSCounterOverlay + { + Nz::TextSpriteRef sprite; + EntityOwner entity; + float elapsedTime = 0.f; + unsigned int frameCount = 0; + }; + #endif + private: #ifndef NDK_SERVER - std::vector> m_windows; + enum OverlayFlags + { + OverlayFlags_Console = 0x1, + OverlayFlags_FPSCounter = 0x2 + }; + + struct WindowInfo + { + inline WindowInfo(std::unique_ptr&& window); + + Nz::RenderTarget* renderTarget; + std::unique_ptr window; + std::unique_ptr console; + std::unique_ptr fpsCounter; + std::unique_ptr overlayWorld; + }; + + void SetupConsole(WindowInfo& info); + void SetupFPSCounter(WindowInfo& info); + void SetupOverlay(WindowInfo& info); + + std::vector m_windows; #endif std::list m_worlds; Nz::Clock m_updateClock; #ifndef NDK_SERVER + Nz::UInt32 m_overlayFlags; bool m_exitOnClosedWindows; #endif bool m_shouldQuit; diff --git a/SDK/include/NDK/Application.inl b/SDK/include/NDK/Application.inl index 0d21d1b94..19013c778 100644 --- a/SDK/include/NDK/Application.inl +++ b/SDK/include/NDK/Application.inl @@ -2,6 +2,7 @@ // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp +#include #include #include #include @@ -9,13 +10,15 @@ namespace Ndk { /*! - * \brief Constructs an Application object by default + * \brief Constructs an Application object without passing command-line arguments * - * \remark Produces a NazaraAssert if there's more than one application instance currently running + * This calls Sdk::Initialize() + * + * \remark Only one Application instance can exist at a time */ - inline Application::Application() : #ifndef NDK_SERVER + m_overlayFlags(0U), m_exitOnClosedWindows(true), #endif m_shouldQuit(false), @@ -31,9 +34,26 @@ namespace Ndk } /*! - * \brief Destructs the object + * \brief Constructs an Application object with command-line arguments + * + * Pass the argc and argv arguments from the main function. + * + * Command-line arguments can be retrieved by application methods + * + * This calls Sdk::Initialize() + * + * \remark Only one Application instance can exist at a time */ + inline Application::Application(int argc, const char* argv[]) : + Application() + { + } + /*! + * \brief Destructs the application object + * + * This destroy all worlds and windows and then calls Sdk::Uninitialize + */ inline Application::~Application() { m_worlds.clear(); @@ -61,8 +81,28 @@ namespace Ndk { static_assert(std::is_base_of::value, "Type must inherit Window"); - m_windows.emplace_back(new T(std::forward(args)...)); - return static_cast(*m_windows.back().get()); + m_windows.emplace_back(std::make_unique(std::forward(args)...)); + WindowInfo& info = m_windows.back(); + + T& window = static_cast(*info.window.get()); //< Warning: ugly + + if (std::is_base_of()) + { + info.renderTarget = &window; + + if (m_overlayFlags) + { + SetupOverlay(info); + + if (m_overlayFlags & OverlayFlags_Console) + SetupConsole(info); + + if (m_overlayFlags & OverlayFlags_FPSCounter) + SetupFPSCounter(info); + } + } + + return window; } #endif @@ -80,22 +120,159 @@ namespace Ndk return m_worlds.back(); } + /*! + * \brief Enable/disable debug console + * + * \param enable Should the console overlay be enabled + */ + inline void Application::EnableConsole(bool enable) + { + if (enable != ((m_overlayFlags & OverlayFlags_Console) != 0)) + { + if (enable) + { + if (m_overlayFlags == 0) + { + for (WindowInfo& info : m_windows) + SetupOverlay(info); + } + + for (WindowInfo& info : m_windows) + SetupConsole(info); + + m_overlayFlags |= OverlayFlags_Console; + + } + else + { + for (WindowInfo& info : m_windows) + info.console.reset(); + + m_overlayFlags &= ~OverlayFlags_Console; + if (m_overlayFlags == 0) + { + for (WindowInfo& info : m_windows) + info.overlayWorld.reset(); + } + } + } + } + + /*! + * \brief Enable/disable debug FPS counter + * + * \param enable Should the FPS counter be displayed + */ + inline void Application::EnableFPSCounter(bool enable) + { + if (enable != ((m_overlayFlags & OverlayFlags_FPSCounter) != 0)) + { + if (enable) + { + if (m_overlayFlags == 0) + { + for (WindowInfo& info : m_windows) + SetupOverlay(info); + } + + for (WindowInfo& info : m_windows) + SetupFPSCounter(info); + + m_overlayFlags |= OverlayFlags_FPSCounter; + + } + else + { + for (WindowInfo& info : m_windows) + info.fpsCounter.reset(); + + m_overlayFlags &= ~OverlayFlags_FPSCounter; + if (m_overlayFlags == 0) + { + for (WindowInfo& info : m_windows) + info.overlayWorld.reset(); + } + } + } + } + + /*! + * \brief Gets the console overlay for a specific window + * + * \param windowIndex Index of the window to get + * + * \remark The console overlay must be enabled + * + * \return A reference to the console overlay of the window + * + * \see IsConsoleOverlayEnabled + */ + inline Application::ConsoleOverlay& Application::GetConsoleOverlay(std::size_t windowIndex) + { + NazaraAssert(m_overlayFlags & OverlayFlags_Console, "Console overlay is not enabled"); + NazaraAssert(windowIndex <= m_windows.size(), "Window index is out of range"); + + return *m_windows[windowIndex].console; + } + + /*! + * \brief Gets the console overlay for a specific window + * + * \param windowIndex Index of the window to get + * + * \remark The console overlay must be enabled + * + * \return A reference to the console overlay of the window + * + * \see IsFPSCounterEnabled + */ + inline Application::FPSCounterOverlay& Application::GetFPSCounterOverlay(std::size_t windowIndex) + { + NazaraAssert(m_overlayFlags & OverlayFlags_FPSCounter, "FPS counter overlay is not enabled"); + NazaraAssert(windowIndex <= m_windows.size(), "Window index is out of range"); + + return *m_windows[windowIndex].fpsCounter; + } + /*! * \brief Gets the update time of the application * \return Update rate */ - inline float Application::GetUpdateTime() const { return m_updateTime; } + /*! + * \brief Checks if the console overlay is enabled + * + * \remark This has nothing to do with the visibility state of the console + * + * \return True if the console overlay is enabled + * + * \see GetConsoleOverlay + */ + inline bool Application::IsConsoleEnabled() const + { + return (m_overlayFlags & OverlayFlags_Console) != 0; + } + + /*! + * \brief Checks if the FPS counter overlay is enabled + * \return True if the FPS counter overlay is enabled + * + * \see GetFPSCounterOverlay + */ + inline bool Application::IsFPSCounterEnabled() const + { + return (m_overlayFlags & OverlayFlags_FPSCounter) != 0; + } + /*! * \brief Makes the application exit when there's no more open window * * \param exitOnClosedWindows Should exit be called when no more window is open */ - #ifndef NDK_SERVER inline void Application::MakeExitOnLastWindowClosed(bool exitOnClosedWindows) { @@ -121,4 +298,10 @@ namespace Ndk { return s_application; } + + inline Application::WindowInfo::WindowInfo(std::unique_ptr&& window) : + window(std::move(window)), + renderTarget(nullptr) + { + } } diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index 63e834bd0..c4492eb0f 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -4,6 +4,15 @@ #include +#ifndef NDK_SERVER +#include +#include +#include +#include +#include +#include +#endif + namespace Ndk { /*! @@ -15,7 +24,6 @@ namespace Ndk /*! * \brief Runs the application by updating worlds, taking care about windows, ... */ - bool Application::Run() { #ifndef NDK_SERVER @@ -24,7 +32,7 @@ namespace Ndk auto it = m_windows.begin(); while (it != m_windows.end()) { - Nz::Window& window = **it; + Nz::Window& window = *it->window; window.ProcessEvents(); @@ -54,8 +62,128 @@ namespace Ndk for (World& world : m_worlds) world.Update(m_updateTime); + #ifndef NDK_SERVER + for (WindowInfo& info : m_windows) + { + if (info.fpsCounter) + { + FPSCounterOverlay& fpsCounter = *info.fpsCounter; + + fpsCounter.frameCount++; + + fpsCounter.elapsedTime += m_updateTime; + if (fpsCounter.elapsedTime >= 1.f) + { + fpsCounter.sprite->Update(Nz::SimpleTextDrawer::Draw("FPS: " + Nz::String::Number(fpsCounter.frameCount), 36)); + fpsCounter.frameCount = 0; + fpsCounter.elapsedTime = 0.f; + } + } + + info.overlayWorld->Update(m_updateTime); + } + #endif + return true; } + void Application::SetupConsole(WindowInfo& info) + { + std::unique_ptr overlay = std::make_unique(); + + overlay->console = std::make_unique(*info.overlayWorld, Nz::Vector2f(Nz::Vector2ui(info.window->GetWidth(), info.window->GetHeight() / 4)), overlay->lua); + + Console& consoleRef = *overlay->console; + // Redirect logs toward the console + overlay->logSlot.Connect(Nz::Log::OnLogWrite, [&consoleRef] (const Nz::String& str) + { + consoleRef.AddLine(str); + }); + + LuaAPI::RegisterClasses(overlay->lua); + + // Override "print" function to add a line in the console + overlay->lua.PushFunction([&consoleRef] (Nz::LuaInstance& instance) + { + Nz::StringStream stream; + + unsigned int argCount = instance.GetStackTop(); + instance.GetGlobal("tostring"); + for (unsigned int i = 1; i <= argCount; ++i) + { + instance.PushValue(-1); // tostring function + instance.PushValue(i); // argument + instance.Call(1, 1); + + std::size_t length; + const char* str = instance.CheckString(-1, &length); + if (i > 1) + stream << '\t'; + + stream << Nz::String(str, length); + instance.Pop(1); + } + + consoleRef.AddLine(stream); + return 0; + }); + overlay->lua.SetGlobal("print"); + + // Define a few base variables to allow our interface to interact with the application + overlay->lua.PushGlobal("Application", Ndk::Application::Instance()); + overlay->lua.PushGlobal("Console", consoleRef.CreateHandle()); + + // Setup a few event callback to handle the console + Nz::EventHandler& eventHandler = info.window->GetEventHandler(); + + overlay->eventSlot.Connect(eventHandler.OnEvent, [&consoleRef] (const Nz::EventHandler*, const Nz::WindowEvent& event) + { + if (consoleRef.IsVisible()) + consoleRef.SendEvent(event); + }); + + overlay->keyPressedSlot.Connect(eventHandler.OnKeyPressed, [&consoleRef] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& event) + { + if (event.code == Nz::Keyboard::F9) + consoleRef.Show(!consoleRef.IsVisible()); + }); + + overlay->resizedSlot.Connect(eventHandler.OnResized, [&consoleRef] (const Nz::EventHandler*, const Nz::WindowEvent::SizeEvent& event) + { + consoleRef.SetSize({float(event.width), event.height / 4.f}); + }); + + info.console = std::move(overlay); + } + + void Application::SetupFPSCounter(WindowInfo& info) + { + std::unique_ptr fpsCounter = std::make_unique(); + fpsCounter->sprite = Nz::TextSprite::New(); + + fpsCounter->entity = info.overlayWorld->CreateEntity(); + fpsCounter->entity->AddComponent(); + fpsCounter->entity->AddComponent().Attach(fpsCounter->sprite); + + info.fpsCounter = std::move(fpsCounter); + } + + void Application::SetupOverlay(WindowInfo& info) + { + info.overlayWorld = std::make_unique(false); //< No default system + + RenderSystem& renderSystem = info.overlayWorld->AddSystem(); + renderSystem.ChangeRenderTechnique(); + renderSystem.SetDefaultBackground(nullptr); + renderSystem.SetGlobalUp(Nz::Vector3f::Down()); + + EntityHandle viewer = info.overlayWorld->CreateEntity(); + CameraComponent& camComponent = viewer->AddComponent(); + viewer->AddComponent(); + + camComponent.SetProjectionType(Nz::ProjectionType_Orthogonal); + camComponent.SetTarget(info.renderTarget); + } + Application* Application::s_application = nullptr; } \ No newline at end of file diff --git a/SDK/src/NDK/LuaBinding_SDK.cpp b/SDK/src/NDK/LuaBinding_SDK.cpp index bf66cbf00..35c59ae68 100644 --- a/SDK/src/NDK/LuaBinding_SDK.cpp +++ b/SDK/src/NDK/LuaBinding_SDK.cpp @@ -17,7 +17,14 @@ namespace Ndk #ifndef NDK_SERVER //application.SetMethod("AddWindow", &Application::AddWindow); + + application.BindMethod("EnableConsole", &Application::EnableConsole); + application.BindMethod("EnableFPSCounter", &Application::EnableFPSCounter); + + application.BindMethod("IsConsoleEnabled", &Application::IsConsoleEnabled); + application.BindMethod("IsFPSCounterEnabled", &Application::IsFPSCounterEnabled); #endif + application.BindMethod("AddWorld", [] (Nz::LuaInstance& instance, Application* application) -> int { instance.Push(application->AddWorld().CreateHandle()); diff --git a/examples/FirstScene/main.cpp b/examples/FirstScene/main.cpp index 0a471acee..b1e7e2a64 100644 --- a/examples/FirstScene/main.cpp +++ b/examples/FirstScene/main.cpp @@ -256,81 +256,19 @@ int main() // On lie la caméra à la fenêtre cameraComp.SetTarget(&window); - // Et on créé deux horloges pour gérer le temps - Nz::Clock secondClock, updateClock; + // Et on créé une horloge pour gérer le temps + Nz::Clock updateClock; Nz::UInt64 updateAccumulator = 0; - // Ainsi qu'un compteur de FPS improvisé - unsigned int fps = 0; - // Quelques variables de plus pour notre caméra bool smoothMovement = true; Nz::Vector3f targetPos = cameraNode.GetPosition(); - // Pour ajouter une console à notre application, nous avons besoin d'un monde 2D pour gérer ces rendus - Ndk::WorldHandle world2D = application.AddWorld().CreateHandle(); - world2D->GetSystem().SetDefaultBackground(nullptr); - world2D->GetSystem().SetGlobalUp(Nz::Vector3f::Down()); - - // Nous ajoutons une caméra comme précédement - Ndk::EntityHandle viewEntity = world2D->CreateEntity(); - viewEntity->AddComponent(); - - // À la différence que celui-ci effectuera une projection orthogonale - Ndk::CameraComponent& viewer = viewEntity->AddComponent(); - viewer.SetTarget(&window); - viewer.SetProjectionType(Nz::ProjectionType_Orthogonal); - - // Nous créons un environnement Lua pour gérer nos scripts - Nz::LuaInstance lua; - - // Faisons en sorte d'enregistrer les classes du moteur dans cet environnement - Ndk::LuaAPI::RegisterClasses(lua); - - // Ensuite nous créons la console en elle-même - Ndk::Console console(*world2D, Nz::Vector2f(window.GetWidth(), window.GetHeight() / 4), lua); - - // Nous redirigeons les logs vers cette console - Nz::Log::OnLogWriteType::ConnectionGuard logGuard = Nz::Log::OnLogWrite.Connect([&console] (const Nz::String& str) - { - console.AddLine(str); - }); - - // Nous réécrivons la fonction "print" du Lua pour la rediriger vers la console - lua.PushFunction([&console] (Nz::LuaInstance& instance) - { - Nz::StringStream stream; - - unsigned int argCount = instance.GetStackTop(); - instance.GetGlobal("tostring"); - for (unsigned int i = 1; i <= argCount; ++i) - { - instance.PushValue(-1); // ToString - instance.PushValue(i); // Arg - instance.Call(1, 1); - - std::size_t length; - const char* str = instance.CheckString(-1, &length); - if (i > 1) - stream << '\t'; - - stream << Nz::String(str, length); - instance.Pop(1); - } - - console.AddLine(stream); - return 0; - }); - lua.SetGlobal("print"); - - // Définissons quelques variables de base - lua.PushGlobal("Application", Ndk::Application::Instance()); - lua.PushGlobal("Console", console.CreateHandle()); - lua.PushGlobal("Spaceship", spaceship->CreateHandle()); - lua.PushGlobal("World", world->CreateHandle()); - window.EnableEventPolling(true); // Déprécié + application.EnableConsole(true); + application.EnableFPSCounter(true); + // Début de la boucle de rendu du programme (s'occupant par exemple de mettre à jour le monde) while (application.Run()) { @@ -342,8 +280,12 @@ int main() { case Nz::WindowEventType_MouseMoved: // La souris a bougé { - if (console.IsVisible()) - break; + if (application.IsConsoleEnabled()) + { + Ndk::Application::ConsoleOverlay& consoleOverlay = application.GetConsoleOverlay(); + if (consoleOverlay.console->IsVisible()) + break; + } // Gestion de la caméra free-fly (Rotation) float sensitivity = 0.3f; // Sensibilité de la souris @@ -368,9 +310,6 @@ int main() break; case Nz::WindowEventType_KeyPressed: // Une touche a été pressée ! - if (console.IsVisible()) - console.SendEvent(event); - if (event.key.code == Nz::Keyboard::Key::Escape) window.Close(); else if (event.key.code == Nz::Keyboard::F1) @@ -383,19 +322,6 @@ int main() else smoothMovement = true; } - else if (event.key.code == Nz::Keyboard::F9) - console.Show(!console.IsVisible()); - break; - - case Nz::WindowEventType_TextEntered: - { - if (console.IsVisible()) - console.SendCharacter(event.text.character); - break; - } - - case Nz::WindowEventType_Resized: - console.SetSize({float(event.size.width), event.size.height / 4.f}); break; default: @@ -419,7 +345,16 @@ int main() // Vitesse de déplacement de la caméra float cameraSpeed = 3.f * elapsedTime; // Trois mètres par seconde - if (!console.IsVisible()) + bool move = true; + + if (application.IsConsoleEnabled()) + { + Ndk::Application::ConsoleOverlay& consoleOverlay = application.GetConsoleOverlay(); + if (consoleOverlay.console->IsVisible()) + move = false; + } + + if (move) { // Si la touche espace est enfoncée, notre vitesse de déplacement est multipliée par deux if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Space)) @@ -460,28 +395,6 @@ int main() // Après avoir dessiné sur la fenêtre, il faut s'assurer qu'elle affiche cela // Cet appel ne fait rien d'autre qu'échanger les buffers de rendu (Double Buffering) window.Display(); - - // On incrémente le compteur de FPS improvisé - fps++; - - if (secondClock.GetMilliseconds() >= 1000) // Toutes les secondes - { - // Et on insère ces données dans le titre de la fenêtre - window.SetTitle(windowTitle + " - " + Nz::String::Number(fps) + " FPS"); - - /* - Note: En C++11 il est possible d'insérer de l'Unicode de façon standard, quel que soit l'encodage du fichier, - via quelque chose de similaire à u8"Cha\u00CEne de caract\u00E8res". - Cependant, si le code source est encodé en UTF-8 (Comme c'est le cas dans ce fichier), - cela fonctionnera aussi comme ceci : "Chaîne de caractères". - */ - - // Et on réinitialise le compteur de FPS - fps = 0; - - // Et on relance l'horloge pour refaire ça dans une seconde - secondClock.Restart(); - } } return EXIT_SUCCESS; From 22914f38e8a80128c3968c9db18acfb0b588e73d Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 18:16:35 +0200 Subject: [PATCH 50/74] SdkServer: Fix compilation Former-commit-id: ec1f6310e42086c20589190f5bce7760a3df38ce [formerly 72c0b397681e524e782cf3ab177a16b93d34dba3] [formerly 91f72f2b87fa8b03d9a86b0dcaef1705402b0004 [formerly cdc0851e924c2246c4ed62240b105571c8d9630a]] Former-commit-id: a31774c45bfad37c84bb9a15a974930d9687f310 [formerly dfcf84977f23cad5687abd42a6ca120353b0961f] Former-commit-id: 578ec85861ca025f70efa04187a24b6fb27cdfd4 --- SDK/include/NDK/Application.inl | 15 ++++++++++++++- SDK/src/NDK/Application.cpp | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/SDK/include/NDK/Application.inl b/SDK/include/NDK/Application.inl index 19013c778..d7e0325d9 100644 --- a/SDK/include/NDK/Application.inl +++ b/SDK/include/NDK/Application.inl @@ -74,7 +74,6 @@ namespace Ndk * * \param args Arguments used to create the window */ - #ifndef NDK_SERVER template T& Application::AddWindow(Args&&... args) @@ -125,6 +124,7 @@ namespace Ndk * * \param enable Should the console overlay be enabled */ + #ifndef NDK_SERVER inline void Application::EnableConsole(bool enable) { if (enable != ((m_overlayFlags & OverlayFlags_Console) != 0)) @@ -157,12 +157,14 @@ namespace Ndk } } } + #endif /*! * \brief Enable/disable debug FPS counter * * \param enable Should the FPS counter be displayed */ + #ifndef NDK_SERVER inline void Application::EnableFPSCounter(bool enable) { if (enable != ((m_overlayFlags & OverlayFlags_FPSCounter) != 0)) @@ -195,6 +197,7 @@ namespace Ndk } } } + #endif /*! * \brief Gets the console overlay for a specific window @@ -207,6 +210,7 @@ namespace Ndk * * \see IsConsoleOverlayEnabled */ + #ifndef NDK_SERVER inline Application::ConsoleOverlay& Application::GetConsoleOverlay(std::size_t windowIndex) { NazaraAssert(m_overlayFlags & OverlayFlags_Console, "Console overlay is not enabled"); @@ -214,6 +218,7 @@ namespace Ndk return *m_windows[windowIndex].console; } + #endif /*! * \brief Gets the console overlay for a specific window @@ -226,6 +231,7 @@ namespace Ndk * * \see IsFPSCounterEnabled */ + #ifndef NDK_SERVER inline Application::FPSCounterOverlay& Application::GetFPSCounterOverlay(std::size_t windowIndex) { NazaraAssert(m_overlayFlags & OverlayFlags_FPSCounter, "FPS counter overlay is not enabled"); @@ -233,6 +239,7 @@ namespace Ndk return *m_windows[windowIndex].fpsCounter; } + #endif /*! * \brief Gets the update time of the application @@ -252,10 +259,12 @@ namespace Ndk * * \see GetConsoleOverlay */ + #ifndef NDK_SERVER inline bool Application::IsConsoleEnabled() const { return (m_overlayFlags & OverlayFlags_Console) != 0; } + #endif /*! * \brief Checks if the FPS counter overlay is enabled @@ -263,10 +272,12 @@ namespace Ndk * * \see GetFPSCounterOverlay */ + #ifndef NDK_SERVER inline bool Application::IsFPSCounterEnabled() const { return (m_overlayFlags & OverlayFlags_FPSCounter) != 0; } + #endif /*! * \brief Makes the application exit when there's no more open window @@ -299,9 +310,11 @@ namespace Ndk return s_application; } + #ifndef NDK_SERVER inline Application::WindowInfo::WindowInfo(std::unique_ptr&& window) : window(std::move(window)), renderTarget(nullptr) { } + #endif } diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index c4492eb0f..bce62093a 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -87,6 +87,7 @@ namespace Ndk return true; } + #ifndef NDK_SERVER void Application::SetupConsole(WindowInfo& info) { std::unique_ptr overlay = std::make_unique(); @@ -184,6 +185,7 @@ namespace Ndk camComponent.SetProjectionType(Nz::ProjectionType_Orthogonal); camComponent.SetTarget(info.renderTarget); } + #endif Application* Application::s_application = nullptr; } \ No newline at end of file From 65740ac8ae78b03e848a2a0f746b9ed15a72f19f Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 18:26:35 +0200 Subject: [PATCH 51/74] Example/FirstScene: Setup Spaceship and World lua variables Former-commit-id: 7d37419cc0636bc1271660cf4518a0c08332f364 [formerly cd5984e732b464c9d31ed34ec072b9039b07163d] [formerly 43de557c346987fa965b60a88eb5a08c7a73e5e5 [formerly 671d1bde65cf2ee3dcb69711d59bd3c8ebde6a1a]] Former-commit-id: d52eed5ca2f7b4a12139b560278051349d4c5947 [formerly 322c6e78f8a487fb5dcef586d74d792d27065d6a] Former-commit-id: 3c7b7d706d45ea2731708b502364bb1dad7b3a56 --- examples/FirstScene/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/FirstScene/main.cpp b/examples/FirstScene/main.cpp index b1e7e2a64..e7c5b2c90 100644 --- a/examples/FirstScene/main.cpp +++ b/examples/FirstScene/main.cpp @@ -269,6 +269,10 @@ int main() application.EnableConsole(true); application.EnableFPSCounter(true); + Ndk::Application::ConsoleOverlay& consoleOverlay = application.GetConsoleOverlay(); + consoleOverlay.lua.PushGlobal("Spaceship", spaceship->CreateHandle()); + consoleOverlay.lua.PushGlobal("World", world->CreateHandle()); + // Début de la boucle de rendu du programme (s'occupant par exemple de mettre à jour le monde) while (application.Run()) { From 27ceb07e55a899fb1a0178ec4b7edaf0ed5d1dc4 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 19:03:43 +0200 Subject: [PATCH 52/74] Lua/LuaInstance: Add move constructor/operator Former-commit-id: 654b377ce33592ef46de7897c1e0bdf6c7f07c1f [formerly 9327749669eecb4a1d1d5cf56da5b0466a3b3886] [formerly 871d797c2fa0480b80d0436da16854eeeb5e8cd9 [formerly 2cd45f642aaaa3859f66967e0e9ef99a8a3e2a16]] Former-commit-id: 14fc3c4a28f3c596488c7d70ef4f4620678a472e [formerly 9e069af52441137bbccab5e70feb1310b5416754] Former-commit-id: 0a6cf051bb0eb5bf439e5eb1071b83e78feacd35 --- include/Nazara/Lua/LuaInstance.hpp | 4 ++-- include/Nazara/Lua/LuaInstance.inl | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/include/Nazara/Lua/LuaInstance.hpp b/include/Nazara/Lua/LuaInstance.hpp index 9affe6f87..e3bc517f8 100644 --- a/include/Nazara/Lua/LuaInstance.hpp +++ b/include/Nazara/Lua/LuaInstance.hpp @@ -31,7 +31,7 @@ namespace Nz public: LuaInstance(); LuaInstance(const LuaInstance&) = delete; - LuaInstance(LuaInstance&&) = delete; ///TODO + inline LuaInstance(LuaInstance&& instance) noexcept; ~LuaInstance(); void ArgCheck(bool condition, unsigned int argNum, const char* error); @@ -172,7 +172,7 @@ namespace Nz void* ToUserdata(int index, const String& tname) const; LuaInstance& operator=(const LuaInstance&) = delete; - LuaInstance& operator=(LuaInstance&&) = delete; ///TODO + inline LuaInstance& operator=(LuaInstance&& instance) noexcept; static int GetIndexOfUpValue(int upValue); static LuaInstance* GetInstance(lua_State* state); diff --git a/include/Nazara/Lua/LuaInstance.inl b/include/Nazara/Lua/LuaInstance.inl index 24d4fcf34..f9f5e662f 100644 --- a/include/Nazara/Lua/LuaInstance.inl +++ b/include/Nazara/Lua/LuaInstance.inl @@ -13,6 +13,33 @@ namespace Nz { + inline LuaInstance::LuaInstance(LuaInstance&& instance) noexcept : + m_memoryLimit(instance.m_memoryLimit), + m_memoryUsage(instance.m_memoryUsage), + m_timeLimit(m_timeLimit), + m_clock(std::move(m_clock)), + m_lastError(std::move(m_lastError)), + m_state(m_state), + m_level(m_level) + { + instance.m_state = nullptr; + } + + inline LuaInstance& LuaInstance::operator=(LuaInstance&& instance) noexcept + { + m_clock = std::move(m_clock); + m_lastError = std::move(m_lastError); + m_level = m_level; + m_memoryLimit = instance.m_memoryLimit; + m_memoryUsage = instance.m_memoryUsage; + m_state = m_state; + m_timeLimit = m_timeLimit; + + instance.m_state = nullptr; + + return *this; + } + // Functions args inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, bool* arg, TypeTag) { From cba0190f03e6a5f65c11897815a23e1f3a6212c6 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 19:53:38 +0200 Subject: [PATCH 53/74] Sdk/Application: Fix AddWindow Former-commit-id: fcd114b7edb92a74d0d646d0f758bde8f40a045d [formerly b6a240aac5a470cd151fcf6b30c65e117bdcc03a] [formerly c44cc9a535703ddb7c64e32fa7f7dedbf1c043c3 [formerly c0d51f049a1df8908dbbf4390d8ecc7d14ae0e79]] Former-commit-id: 951f1d7658aa40e12efa41056f087c1968e19bb5 [formerly 54703326cf2c80ab154610149a2d26fc8e484444] Former-commit-id: 72a5ac27a30818ab77281d3219d0e954958c294a --- SDK/include/NDK/Application.hpp | 3 +++ SDK/include/NDK/Application.inl | 48 +++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/SDK/include/NDK/Application.hpp b/SDK/include/NDK/Application.hpp index 5eca90961..7f4af6679 100644 --- a/SDK/include/NDK/Application.hpp +++ b/SDK/include/NDK/Application.hpp @@ -117,6 +117,9 @@ namespace Ndk void SetupFPSCounter(WindowInfo& info); void SetupOverlay(WindowInfo& info); + template void SetupWindow(WindowInfo& info, T* renderTarget, std::true_type /*isRenderTarget*/); + template void SetupWindow(WindowInfo& /*info*/, T* /*renderTarget*/, std::false_type /*isNotRenderTarget*/); + std::vector m_windows; #endif std::list m_worlds; diff --git a/SDK/include/NDK/Application.inl b/SDK/include/NDK/Application.inl index d7e0325d9..a36ee3a13 100644 --- a/SDK/include/NDK/Application.inl +++ b/SDK/include/NDK/Application.inl @@ -85,21 +85,7 @@ namespace Ndk T& window = static_cast(*info.window.get()); //< Warning: ugly - if (std::is_base_of()) - { - info.renderTarget = &window; - - if (m_overlayFlags) - { - SetupOverlay(info); - - if (m_overlayFlags & OverlayFlags_Console) - SetupConsole(info); - - if (m_overlayFlags & OverlayFlags_FPSCounter) - SetupFPSCounter(info); - } - } + SetupWindow(info, &window, std::is_base_of()); return window; } @@ -138,7 +124,10 @@ namespace Ndk } for (WindowInfo& info : m_windows) - SetupConsole(info); + { + if (info.renderTarget) + SetupConsole(info); + } m_overlayFlags |= OverlayFlags_Console; @@ -178,7 +167,10 @@ namespace Ndk } for (WindowInfo& info : m_windows) - SetupFPSCounter(info); + { + if (info.renderTarget) + SetupFPSCounter(info); + } m_overlayFlags |= OverlayFlags_FPSCounter; @@ -310,6 +302,28 @@ namespace Ndk return s_application; } + template + inline void Application::SetupWindow(WindowInfo& info, T* renderTarget, std::true_type) + { + info.renderTarget = renderTarget; + + if (m_overlayFlags) + { + SetupOverlay(info); + + if (m_overlayFlags & OverlayFlags_Console) + SetupConsole(info); + + if (m_overlayFlags & OverlayFlags_FPSCounter) + SetupFPSCounter(info); + } + } + + template + inline void Application::SetupWindow(WindowInfo&, T*, std::false_type) + { + } + #ifndef NDK_SERVER inline Application::WindowInfo::WindowInfo(std::unique_ptr&& window) : window(std::move(window)), From d9d23476886dfb7d388d31ac75687d806ab36af9 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 21:47:29 +0200 Subject: [PATCH 54/74] Sdk/Application: Add command-line arguments handling Former-commit-id: efe6c5a1d911bb78314f8819575699874f5101e8 [formerly a9b33eea0b4b261d3e3a63d8949512f737dbe1e1] [formerly bd00d4e8009ff0efa74e6a27d78960f6d3d72c17 [formerly 17b26899d0c158c77ea0ab4cfa243e92c2145b6b]] Former-commit-id: 4caea7e656e3718e1d462c5ed280aa6353368166 [formerly b82d884df55141a10251e84e54e0a40f84db2a5e] Former-commit-id: 3798d603338416b18a4d427cf8b3cb87bac12ff6 --- SDK/include/NDK/Application.hpp | 11 ++++- SDK/include/NDK/Application.inl | 80 ++++++++++++++++++++++++++------- SDK/src/NDK/Application.cpp | 49 ++++++++++++++++++++ examples/Tut00/main.cpp | 16 +++---- examples/Tut01/main.cpp | 4 +- 5 files changed, 132 insertions(+), 28 deletions(-) diff --git a/SDK/include/NDK/Application.hpp b/SDK/include/NDK/Application.hpp index 7f4af6679..84b331e95 100644 --- a/SDK/include/NDK/Application.hpp +++ b/SDK/include/NDK/Application.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,7 @@ namespace Ndk #endif inline Application(); - inline Application(int argc, const char* argv[]); + Application(int argc, char* argv[]); Application(const Application&) = delete; Application(Application&&) = delete; inline ~Application(); @@ -53,8 +54,14 @@ namespace Ndk inline FPSCounterOverlay& GetFPSCounterOverlay(std::size_t windowIndex = 0U); #endif + inline const std::set& GetOptions() const; + inline const std::map& GetParameters() const; + inline float GetUpdateTime() const; + inline bool HasOption(const Nz::String& option) const; + inline bool HasParameter(const Nz::String& key, Nz::String* value) const; + #ifndef NDK_SERVER inline bool IsConsoleEnabled() const; inline bool IsFPSCounterEnabled() const; @@ -120,6 +127,8 @@ namespace Ndk template void SetupWindow(WindowInfo& info, T* renderTarget, std::true_type /*isRenderTarget*/); template void SetupWindow(WindowInfo& /*info*/, T* /*renderTarget*/, std::false_type /*isNotRenderTarget*/); + std::map m_parameters; + std::set m_options; std::vector m_windows; #endif std::list m_worlds; diff --git a/SDK/include/NDK/Application.inl b/SDK/include/NDK/Application.inl index a36ee3a13..7701160c5 100644 --- a/SDK/include/NDK/Application.inl +++ b/SDK/include/NDK/Application.inl @@ -33,22 +33,6 @@ namespace Ndk Sdk::Initialize(); } - /*! - * \brief Constructs an Application object with command-line arguments - * - * Pass the argc and argv arguments from the main function. - * - * Command-line arguments can be retrieved by application methods - * - * This calls Sdk::Initialize() - * - * \remark Only one Application instance can exist at a time - */ - inline Application::Application(int argc, const char* argv[]) : - Application() - { - } - /*! * \brief Destructs the application object * @@ -233,6 +217,30 @@ namespace Ndk } #endif + /*! + * \brief Gets the options used to start the application + * + * Options are defined as "-optionName" in command-line and are always lower-case + * + * \return Command-line options + */ + inline const std::set& Application::GetOptions() const + { + return m_options; + } + + /*! + * \brief Gets the parameters used to start the application + * + * Parameters are defined as "-key=value" in command-line, their key is lower-case but value capitals are kept. + * + * \return Command-line parameters + */ + inline const std::map& Application::GetParameters() const + { + return m_parameters; + } + /*! * \brief Gets the update time of the application * \return Update rate @@ -242,6 +250,46 @@ namespace Ndk return m_updateTime; } + /*! + * \brief Query for a command-line option + * + * \param option Option name + * + * \remark option must be lower-case + * + * \return True if option is present + * + * \see GetOptions + */ + inline bool Application::HasOption(const Nz::String& option) const + { + return m_options.count(option) != 0; + } + + /*! + * \brief Query for a command-line option + * + * \param key Parameter name + * \param value Optional string to receive the parameter value + * + * \remark key must be lower-case + * + * \return True if parameter is present + * + * \see GetParameters + */ + inline bool Application::HasParameter(const Nz::String& key, Nz::String* value) const + { + auto it = m_parameters.find(key); + if (it == m_parameters.end()) + return false; + + if (value) + *value = it->second; + + return true; + } + /*! * \brief Checks if the console overlay is enabled * diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index bce62093a..71301a13b 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in Prerequesites.hpp #include +#include #ifndef NDK_SERVER #include @@ -21,6 +22,54 @@ namespace Ndk * \brief NDK class that represents the application, it offers a set of tools to ease the development */ + /*! + * \brief Constructs an Application object with command-line arguments + * + * Pass the argc and argv arguments from the main function. + * + * Command-line arguments can be retrieved by application methods + * + * This calls Sdk::Initialize() + * + * \remark Only one Application instance can exist at a time + */ + inline Application::Application(int argc, char* argv[]) : + Application() + { + std::regex optionRegex(R"(-(\w+))"); + std::regex valueRegex(R"(-(\w+)\s*=\s*(.+))"); + + std::smatch results; + + for (int i = 1; i < argc; ++i) + { + std::string argument(argv[i]); + if (std::regex_match(argument, results, valueRegex)) + { + Nz::String key(results[1].str()); + Nz::String value(results[2].str()); + + m_parameters[key.ToLower()] = value; + NazaraDebug("Registred parameter from command-line: " + key.ToLower() + "=" + value); + } + else if (std::regex_match(argument, results, optionRegex)) + { + Nz::String option(results[1].str()); + + m_options.insert(option); + NazaraDebug("Registred option from command-line: " + option); + } + else + NazaraWarning("Ignored command-line argument #" + Nz::String::Number(i) + " \"" + argument + '"'); + } + + if (HasOption("console")) + EnableConsole(true); + + if (HasOption("fpscounter")) + EnableFPSCounter(true); + } + /*! * \brief Runs the application by updating worlds, taking care about windows, ... */ diff --git a/examples/Tut00/main.cpp b/examples/Tut00/main.cpp index 472db3148..cfffa4c59 100644 --- a/examples/Tut00/main.cpp +++ b/examples/Tut00/main.cpp @@ -9,16 +9,14 @@ #include #include #include -#include -#include -int main() +int main(int argc, char* argv[]) { - // This "example" has only one purpose: Giving an empty project for you to test whatever you want - // If you wish to have multiple test projects, you only have to copy/paste this directory and change the name in the build.lua - Ndk::Application app; + // This "example" has only one purpose: Giving an empty project for you to test whatever you want + // If you wish to have multiple test projects, you only have to copy/paste this directory and change the name in the build.lua + Ndk::Application application(argc, argv); - // Do what you want here - - return EXIT_SUCCESS; + // Do what you want here + + return EXIT_SUCCESS; } \ No newline at end of file diff --git a/examples/Tut01/main.cpp b/examples/Tut01/main.cpp index f5fca94a0..9c33f6859 100644 --- a/examples/Tut01/main.cpp +++ b/examples/Tut01/main.cpp @@ -9,9 +9,9 @@ #include #include -int main() +int main(int argc, char* argv[]) { - Ndk::Application application; + Ndk::Application application(argc, argv); Nz::RenderWindow& mainWindow = application.AddWindow(); mainWindow.Create(Nz::VideoMode(800, 600, 32), "Test"); From dacbc4fd88c4f7d41d61209fe4f155ad272e7344 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 28 Aug 2016 21:47:46 +0200 Subject: [PATCH 55/74] Sdk/Application: Fix crash when debug overlay are not used Former-commit-id: 05318cab010125a0d3da08ab8124a36c8afaae62 [formerly a8a6a7118ea822c723f971b5cc825f8d8863b538] [formerly c7ac1c5a6e47ef0ef249500ca7797a80d888941d [formerly f9aea3407c7d994c18eba0755f8fbe161491d706]] Former-commit-id: 4bbb521262e33980d3e79c33d178c0a8d30289b5 [formerly 7050145d7b0e5bc578dc73ea7301463d5bc9fceb] Former-commit-id: 8cfd81fbd3db06a5bdc7e5d38355a9ca2378e8d6 --- SDK/src/NDK/Application.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index 71301a13b..8ecb5d454 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -114,6 +114,9 @@ namespace Ndk #ifndef NDK_SERVER for (WindowInfo& info : m_windows) { + if (!info.overlayWorld) + continue; + if (info.fpsCounter) { FPSCounterOverlay& fpsCounter = *info.fpsCounter; From 79db960a89d80f148b97f3dbccbf67f3d0f4e6fc Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 29 Aug 2016 02:33:57 +0200 Subject: [PATCH 56/74] SDK: Fix console layer having trouble with late constructed windows Former-commit-id: e5882089bc09649b545da8ea8a222b89417851a0 [formerly 1a114b80d1a97b96e764a2732ce8200244389283] [formerly f36d163b9d5a52c2958468dd26d9086b86c6710b [formerly 71b9edd9938eb30860da96234605a001173eaa23]] Former-commit-id: 8fd9120c8333c10f95d66d859eef2c64c58efc28 [formerly 423c0088ec020881cbf207470787d86929f34fd4] Former-commit-id: e283df698adfb17f2d40156ad411e9a6acac1f7a --- SDK/include/NDK/Application.hpp | 2 +- SDK/src/NDK/Application.cpp | 13 ++++++++++--- src/Nazara/Utility/Window.cpp | 18 ++++++++++-------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/SDK/include/NDK/Application.hpp b/SDK/include/NDK/Application.hpp index 84b331e95..8c0eb18a9 100644 --- a/SDK/include/NDK/Application.hpp +++ b/SDK/include/NDK/Application.hpp @@ -88,7 +88,7 @@ namespace Ndk NazaraSlot(Nz::EventHandler, OnEvent, eventSlot); NazaraSlot(Nz::EventHandler, OnKeyPressed, keyPressedSlot); - NazaraSlot(Nz::EventHandler, OnResized, resizedSlot); + NazaraSlot(Nz::RenderTarget, OnRenderTargetSizeChange, resizedSlot); NazaraSlot(Nz::Log, OnLogWrite, logSlot); }; diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index 8ecb5d454..68396f128 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -144,9 +144,16 @@ namespace Ndk { std::unique_ptr overlay = std::make_unique(); - overlay->console = std::make_unique(*info.overlayWorld, Nz::Vector2f(Nz::Vector2ui(info.window->GetWidth(), info.window->GetHeight() / 4)), overlay->lua); + Nz::Vector2ui windowDimensions; + if (info.window->IsValid()) + windowDimensions.Set(info.window->GetWidth(), info.window->GetHeight() / 4); + else + windowDimensions.MakeZero(); + + overlay->console = std::make_unique(*info.overlayWorld, Nz::Vector2f(windowDimensions), overlay->lua); Console& consoleRef = *overlay->console; + // Redirect logs toward the console overlay->logSlot.Connect(Nz::Log::OnLogWrite, [&consoleRef] (const Nz::String& str) { @@ -201,9 +208,9 @@ namespace Ndk consoleRef.Show(!consoleRef.IsVisible()); }); - overlay->resizedSlot.Connect(eventHandler.OnResized, [&consoleRef] (const Nz::EventHandler*, const Nz::WindowEvent::SizeEvent& event) + overlay->resizedSlot.Connect(info.renderTarget->OnRenderTargetSizeChange, [&consoleRef] (const Nz::RenderTarget* renderTarget) { - consoleRef.SetSize({float(event.width), event.height / 4.f}); + consoleRef.SetSize({float(renderTarget->GetWidth()), renderTarget->GetHeight() / 4.f}); }); info.console = std::move(overlay); diff --git a/src/Nazara/Utility/Window.cpp b/src/Nazara/Utility/Window.cpp index 02ed0f40a..7ba78dcb9 100644 --- a/src/Nazara/Utility/Window.cpp +++ b/src/Nazara/Utility/Window.cpp @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in Config.hpp #include +#include #include #include #include @@ -60,25 +61,22 @@ namespace Nz else if (style & WindowStyle_Closable || style & WindowStyle_Resizable) style |= WindowStyle_Titlebar; - m_impl = new WindowImpl(this); - if (!m_impl->Create(mode, title, style)) + std::unique_ptr impl = std::make_unique(this); + if (!impl->Create(mode, title, style)) { NazaraError("Failed to create window implementation"); - delete m_impl; - m_impl = nullptr; - return false; } + m_impl = impl.release(); + CallOnExit destroyOnFailure([this] () { Destroy(); }); + m_closed = false; m_ownsWindow = true; if (!OnWindowCreated()) { NazaraError("Failed to initialize window extension"); - delete m_impl; - m_impl = nullptr; - return false; } @@ -93,6 +91,10 @@ namespace Nz if (opened) m_impl->SetPosition(position.x, position.y); + OnWindowResized(); + + destroyOnFailure.Reset(); + return true; } From ae75cb5425fc4b08021272b820a2162ea78cd59e Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 29 Aug 2016 02:34:08 +0200 Subject: [PATCH 57/74] Lua/LuaInstance: Fix crash on moving Former-commit-id: ae3bfc2c85a58759a9325b082b0f2bb579820447 [formerly 44b5545430b92724a4e3d70d44ea1de682248730] [formerly bc217ffb3bbafd0e33bdfab55d1fdb01c86c9f9b [formerly b99cca5511d57b04c7854d657353f8a2566ef8d0]] Former-commit-id: d069d3beabd682e1338f6f7ee6914196d6ad46a7 [formerly 5a041ad68a8fe897f11b2c33c70b0c42cd189b18] Former-commit-id: 645b3afd1f895d550dd3bd2bbdb79b85f181fb18 --- src/Nazara/Lua/LuaInstance.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index 0ecf4c063..f31c6fe83 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -145,7 +145,8 @@ namespace Nz LuaInstance::~LuaInstance() { - lua_close(m_state); + if (m_state) + lua_close(m_state); } void LuaInstance::ArgCheck(bool condition, unsigned int argNum, const char* error) From b91eac993584360d22f18bd881d5c08412d22d6c Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 29 Aug 2016 13:32:16 +0200 Subject: [PATCH 58/74] Example/Tut01: Improve background color Former-commit-id: 68e17a9e3537eb9fdcbb2598a135f79d64d63358 [formerly 31e48638ffe15d3736b5f7031a1ee694943e9dda] [formerly b66e37c14d914da006d9430b2ac970c0bdb8b926 [formerly 18438817c43953af720614a1c5f719d77ae6db0c]] Former-commit-id: 55e1b25146184f89cba9b1ff1ee7519db6fbd9e6 [formerly a23adc4f2e2973e6623ffec4c08ab3039ae11e20] Former-commit-id: e0c98071bf64cd3ef4d9f6c335606368626ae74e --- examples/Tut01/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Tut01/main.cpp b/examples/Tut01/main.cpp index 9c33f6859..b5e07074d 100644 --- a/examples/Tut01/main.cpp +++ b/examples/Tut01/main.cpp @@ -19,7 +19,7 @@ int main(int argc, char* argv[]) Ndk::World& world = application.AddWorld(); world.GetSystem().SetGlobalUp(Nz::Vector3f::Down()); - world.GetSystem().SetDefaultBackground(Nz::ColorBackground::New(Nz::Color(192, 100, 100))); + world.GetSystem().SetDefaultBackground(Nz::ColorBackground::New(Nz::Color(117, 122, 214))); Ndk::EntityHandle viewEntity = world.CreateEntity(); From 1dec4ca86af15e6ab6999ee145e933211856d9b9 Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 29 Aug 2016 18:16:33 +0200 Subject: [PATCH 59/74] Sdk/Application: Fix compilation in server mode Former-commit-id: 67093963bcad8d36febd467c1aba51d497d8e5c5 [formerly 4bf223f6b8388f973e3be44178dc4762bd8bec24] [formerly f5ec0e444d9ad87dc39bf3d85f2679046bdc8385 [formerly 3c50590603c468b2e97417785db9f571b40bc790]] Former-commit-id: 0bcbfdb95712215eb44014102b7dc95272620d90 [formerly 0708473fe71ae8f8f477a1a3e9984fd06e0b3b1f] Former-commit-id: 9f9478b6dff900d10dfdaaedddfb206087d0c49b --- SDK/include/NDK/Application.hpp | 6 ++++-- SDK/include/NDK/Application.inl | 2 +- SDK/src/NDK/Application.cpp | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/SDK/include/NDK/Application.hpp b/SDK/include/NDK/Application.hpp index 8c0eb18a9..b3f803fe1 100644 --- a/SDK/include/NDK/Application.hpp +++ b/SDK/include/NDK/Application.hpp @@ -127,12 +127,14 @@ namespace Ndk template void SetupWindow(WindowInfo& info, T* renderTarget, std::true_type /*isRenderTarget*/); template void SetupWindow(WindowInfo& /*info*/, T* /*renderTarget*/, std::false_type /*isNotRenderTarget*/); - std::map m_parameters; - std::set m_options; std::vector m_windows; #endif + + std::map m_parameters; + std::set m_options; std::list m_worlds; Nz::Clock m_updateClock; + #ifndef NDK_SERVER Nz::UInt32 m_overlayFlags; bool m_exitOnClosedWindows; diff --git a/SDK/include/NDK/Application.inl b/SDK/include/NDK/Application.inl index 7701160c5..2c74acb19 100644 --- a/SDK/include/NDK/Application.inl +++ b/SDK/include/NDK/Application.inl @@ -350,6 +350,7 @@ namespace Ndk return s_application; } + #ifndef NDK_SERVER template inline void Application::SetupWindow(WindowInfo& info, T* renderTarget, std::true_type) { @@ -372,7 +373,6 @@ namespace Ndk { } - #ifndef NDK_SERVER inline Application::WindowInfo::WindowInfo(std::unique_ptr&& window) : window(std::move(window)), renderTarget(nullptr) diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index 68396f128..3cdff6978 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in Prerequesites.hpp #include +#include #include #ifndef NDK_SERVER @@ -63,11 +64,13 @@ namespace Ndk NazaraWarning("Ignored command-line argument #" + Nz::String::Number(i) + " \"" + argument + '"'); } + #ifndef NDK_SERVER if (HasOption("console")) EnableConsole(true); if (HasOption("fpscounter")) EnableFPSCounter(true); + #endif } /*! From 46375478341097229eb6cc0c9a2a3d2bbd33d472 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 31 Aug 2016 18:20:23 +0200 Subject: [PATCH 60/74] Core/HardwareInfo: Fix indentation (Windows) Former-commit-id: 8e81ffeabb15ea32897b9326c64f3eb0509f3a4d [formerly 5f825a1f5e572a323ccde72c02092eef3fe63288] [formerly ee52f05420bcce124f38df04a993981f55319da3 [formerly d158e494b1e518dc1f472439cd96a9005e959697]] Former-commit-id: 2bcd5f3ef3195e1ddb172010a3322551101490d3 [formerly c1ad1017301b3c17c8fab3981bb43fcbd3ca6dfc] Former-commit-id: 7782b8a6e2ef27e2ca97201d490c5782a9a83899 --- src/Nazara/Core/Win32/HardwareInfoImpl.cpp | 30 +++++++++---------- .../Shaders/LightScatteringFinal.frag | 18 +++++++++++ .../Shaders/LightScatteringFinal.frag.h | 1 + src/Nazara/Graphics/Sprite.cpp | 10 ++++--- 4 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag create mode 100644 src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag.h diff --git a/src/Nazara/Core/Win32/HardwareInfoImpl.cpp b/src/Nazara/Core/Win32/HardwareInfoImpl.cpp index 7ce5e10a1..62b86bf91 100644 --- a/src/Nazara/Core/Win32/HardwareInfoImpl.cpp +++ b/src/Nazara/Core/Win32/HardwareInfoImpl.cpp @@ -76,25 +76,25 @@ namespace Nz #elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL) int supported; asm volatile (" pushfl\n" - " pop %%eax\n" - " mov %%eax, %%ecx\n" - " xor $0x200000, %%eax\n" - " push %%eax\n" - " popfl\n" - " pushfl\n" - " pop %%eax\n" - " xor %%ecx, %%eax\n" - " mov %%eax, %0\n" - " push %%ecx\n" - " popfl" - : "=m" (supported) // output - : // input - : "eax", "ecx", "memory"); // clobbered register + " pop %%eax\n" + " mov %%eax, %%ecx\n" + " xor $0x200000, %%eax\n" + " push %%eax\n" + " popfl\n" + " pushfl\n" + " pop %%eax\n" + " xor %%ecx, %%eax\n" + " mov %%eax, %0\n" + " push %%ecx\n" + " popfl" + : "=m" (supported) // output + : // input + : "eax", "ecx", "memory"); // clobbered register return supported != 0; #else return false; #endif #endif -} + } } diff --git a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag new file mode 100644 index 000000000..82a05410b --- /dev/null +++ b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag @@ -0,0 +1,18 @@ +#version 140 + +out vec4 RenderTarget0; + +uniform float exposure = 0.92; +uniform sampler2D AccumulationTexture; +uniform sampler2D ColorTexture; +uniform vec2 InvTargetSize; + +void main() +{ + vec2 texCoord = gl_FragCoord.xy * InvTargetSize; + + vec4 color = texture(ColorTexture, texCoord); + vec4 lightScattering = texture(AccumulationTexture, texCoord); + + RenderTarget0 = vec4(lightScattering.rgb * exposure, 1.0) + color * 1.1; +} diff --git a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag.h b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag.h new file mode 100644 index 000000000..0b0b3fe9d --- /dev/null +++ b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag.h @@ -0,0 +1 @@ +35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,101,120,112,111,115,117,114,101,32,61,32,48,46,57,50,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,65,99,99,117,109,117,108,97,116,105,111,110,84,101,120,116,117,114,101,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,67,111,108,111,114,84,101,120,116,117,114,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,9,118,101,99,52,32,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,41,59,13,10,9,118,101,99,52,32,108,105,103,104,116,83,99,97,116,116,101,114,105,110,103,32,61,32,116,101,120,116,117,114,101,40,65,99,99,117,109,117,108,97,116,105,111,110,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,41,59,13,10,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,108,105,103,104,116,83,99,97,116,116,101,114,105,110,103,46,114,103,98,32,42,32,101,120,112,111,115,117,114,101,44,32,49,46,48,41,32,43,32,99,111,108,111,114,32,42,32,49,46,49,59,13,10,125,13,10, \ No newline at end of file diff --git a/src/Nazara/Graphics/Sprite.cpp b/src/Nazara/Graphics/Sprite.cpp index 5ef82cddf..23fd28181 100644 --- a/src/Nazara/Graphics/Sprite.cpp +++ b/src/Nazara/Graphics/Sprite.cpp @@ -57,20 +57,22 @@ namespace Nz SparsePtr posPtr(&vertices[0].position, sizeof(VertexStruct_XYZ_Color_UV)); SparsePtr texCoordPtr(&vertices[0].uv, sizeof(VertexStruct_XYZ_Color_UV)); + const Nz::Vector3f origin(m_size.x / 2.f, m_size.y / -2.f, 0.f); + *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(Vector3f(0.f)); + *posPtr++ = instanceData->transformMatrix->Transform(Vector3f(-origin)); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftTop); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right()); + *posPtr++ = instanceData->transformMatrix->Transform(-origin + m_size.x*Vector3f::Right()); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightTop); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.y*Vector3f::Down()); + *posPtr++ = instanceData->transformMatrix->Transform(-origin + m_size.y*Vector3f::Down()); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftBottom); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down()); + *posPtr++ = instanceData->transformMatrix->Transform(-origin + m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down()); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightBottom); } From 486d4fc015af41f58641584e7940e078ef9eeff3 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 31 Aug 2016 19:16:03 +0200 Subject: [PATCH 61/74] Revert "Core/HardwareInfo: Fix indentation (Windows)" This reverts commit a4019076ff9afd3cb7e2d98a54c9788fd2df1457 [formerly 3a39cd2e8a3aa8bb46f9f1465923f2abb8fc19a1] [formerly a23f6beee25e408579609874672806b124bf5fc0 [formerly be4cec088d5683bc18e54fd5daa2805134a88bb9]] [formerly dd94bfecaf16a96cdc39de9abd3c0749f17bf824 [formerly 539605da0eb694cbad2fb52fdb49b9a79c3a0d04] [formerly 00917e0bb4766a6f19f303040241c81a92778185 [formerly 48c4b5219e3d1f74f04099f164712c2baddf1d4b]]]. Former-commit-id: 8c12c9823e95088e92a5fbcb77b7b4feb175d3d9 [formerly 137a3a93c7be0cbcc8b82939c0ba5f3844fa1e24] [formerly a76f30044d61a5e815ed2b1d0ebbcd05feaad994 [formerly 71b63053a8db0e880844044f849f1029c70a6b25]] Former-commit-id: 596d78e1e8fd79e5dc8aa3fbb514c1d6444ce978 [formerly e5089919c76e32c64bda7a1186550a65a6b6d8b3] Former-commit-id: bca999978415a972625367d087320cc016f4774b --- src/Nazara/Core/Win32/HardwareInfoImpl.cpp | 30 +++++++++---------- .../Shaders/LightScatteringFinal.frag | 18 ----------- .../Shaders/LightScatteringFinal.frag.h | 1 - src/Nazara/Graphics/Sprite.cpp | 10 +++---- 4 files changed, 19 insertions(+), 40 deletions(-) delete mode 100644 src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag delete mode 100644 src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag.h diff --git a/src/Nazara/Core/Win32/HardwareInfoImpl.cpp b/src/Nazara/Core/Win32/HardwareInfoImpl.cpp index 62b86bf91..7ce5e10a1 100644 --- a/src/Nazara/Core/Win32/HardwareInfoImpl.cpp +++ b/src/Nazara/Core/Win32/HardwareInfoImpl.cpp @@ -76,25 +76,25 @@ namespace Nz #elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL) int supported; asm volatile (" pushfl\n" - " pop %%eax\n" - " mov %%eax, %%ecx\n" - " xor $0x200000, %%eax\n" - " push %%eax\n" - " popfl\n" - " pushfl\n" - " pop %%eax\n" - " xor %%ecx, %%eax\n" - " mov %%eax, %0\n" - " push %%ecx\n" - " popfl" - : "=m" (supported) // output - : // input - : "eax", "ecx", "memory"); // clobbered register + " pop %%eax\n" + " mov %%eax, %%ecx\n" + " xor $0x200000, %%eax\n" + " push %%eax\n" + " popfl\n" + " pushfl\n" + " pop %%eax\n" + " xor %%ecx, %%eax\n" + " mov %%eax, %0\n" + " push %%ecx\n" + " popfl" + : "=m" (supported) // output + : // input + : "eax", "ecx", "memory"); // clobbered register return supported != 0; #else return false; #endif #endif - } +} } diff --git a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag deleted file mode 100644 index 82a05410b..000000000 --- a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag +++ /dev/null @@ -1,18 +0,0 @@ -#version 140 - -out vec4 RenderTarget0; - -uniform float exposure = 0.92; -uniform sampler2D AccumulationTexture; -uniform sampler2D ColorTexture; -uniform vec2 InvTargetSize; - -void main() -{ - vec2 texCoord = gl_FragCoord.xy * InvTargetSize; - - vec4 color = texture(ColorTexture, texCoord); - vec4 lightScattering = texture(AccumulationTexture, texCoord); - - RenderTarget0 = vec4(lightScattering.rgb * exposure, 1.0) + color * 1.1; -} diff --git a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag.h b/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag.h deleted file mode 100644 index 0b0b3fe9d..000000000 --- a/src/Nazara/Graphics/Resources/DeferredShading/Shaders/LightScatteringFinal.frag.h +++ /dev/null @@ -1 +0,0 @@ -35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,101,120,112,111,115,117,114,101,32,61,32,48,46,57,50,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,65,99,99,117,109,117,108,97,116,105,111,110,84,101,120,116,117,114,101,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,67,111,108,111,114,84,101,120,116,117,114,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,9,118,101,99,52,32,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,41,59,13,10,9,118,101,99,52,32,108,105,103,104,116,83,99,97,116,116,101,114,105,110,103,32,61,32,116,101,120,116,117,114,101,40,65,99,99,117,109,117,108,97,116,105,111,110,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,41,59,13,10,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,108,105,103,104,116,83,99,97,116,116,101,114,105,110,103,46,114,103,98,32,42,32,101,120,112,111,115,117,114,101,44,32,49,46,48,41,32,43,32,99,111,108,111,114,32,42,32,49,46,49,59,13,10,125,13,10, \ No newline at end of file diff --git a/src/Nazara/Graphics/Sprite.cpp b/src/Nazara/Graphics/Sprite.cpp index 23fd28181..5ef82cddf 100644 --- a/src/Nazara/Graphics/Sprite.cpp +++ b/src/Nazara/Graphics/Sprite.cpp @@ -57,22 +57,20 @@ namespace Nz SparsePtr posPtr(&vertices[0].position, sizeof(VertexStruct_XYZ_Color_UV)); SparsePtr texCoordPtr(&vertices[0].uv, sizeof(VertexStruct_XYZ_Color_UV)); - const Nz::Vector3f origin(m_size.x / 2.f, m_size.y / -2.f, 0.f); - *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(Vector3f(-origin)); + *posPtr++ = instanceData->transformMatrix->Transform(Vector3f(0.f)); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftTop); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(-origin + m_size.x*Vector3f::Right()); + *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right()); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightTop); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(-origin + m_size.y*Vector3f::Down()); + *posPtr++ = instanceData->transformMatrix->Transform(m_size.y*Vector3f::Down()); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftBottom); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(-origin + m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down()); + *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down()); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightBottom); } From a55926a9d9ece1f1e1a86c6a655438b6f1cd0de7 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 31 Aug 2016 19:16:20 +0200 Subject: [PATCH 62/74] Core/HardwareInfo: Fix indentation (Windows) Former-commit-id: 957c2204469bfd54eb4ddacc9af2233368b03eb7 [formerly 14f9e6c9fd12d73552f88d0283a0daff026f8281] [formerly 01fba786c37ebea96a149e65885ed177041a0e12 [formerly f1b7486d7e842b784412db7f8927ce639e03f7d8]] Former-commit-id: 3324d3a7b9699b2569479fc7d68361a3e9c94801 [formerly ac58330399b99c0806e765aa7681e4ee775393de] Former-commit-id: 5216228cf367e02fb1d63ac7ee7eb219c09edbce --- src/Nazara/Core/Win32/HardwareInfoImpl.cpp | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Nazara/Core/Win32/HardwareInfoImpl.cpp b/src/Nazara/Core/Win32/HardwareInfoImpl.cpp index 7ce5e10a1..62b86bf91 100644 --- a/src/Nazara/Core/Win32/HardwareInfoImpl.cpp +++ b/src/Nazara/Core/Win32/HardwareInfoImpl.cpp @@ -76,25 +76,25 @@ namespace Nz #elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL) int supported; asm volatile (" pushfl\n" - " pop %%eax\n" - " mov %%eax, %%ecx\n" - " xor $0x200000, %%eax\n" - " push %%eax\n" - " popfl\n" - " pushfl\n" - " pop %%eax\n" - " xor %%ecx, %%eax\n" - " mov %%eax, %0\n" - " push %%ecx\n" - " popfl" - : "=m" (supported) // output - : // input - : "eax", "ecx", "memory"); // clobbered register + " pop %%eax\n" + " mov %%eax, %%ecx\n" + " xor $0x200000, %%eax\n" + " push %%eax\n" + " popfl\n" + " pushfl\n" + " pop %%eax\n" + " xor %%ecx, %%eax\n" + " mov %%eax, %0\n" + " push %%ecx\n" + " popfl" + : "=m" (supported) // output + : // input + : "eax", "ecx", "memory"); // clobbered register return supported != 0; #else return false; #endif #endif -} + } } From 5d13fa664b2bcb0f88022eed97177eac15bc3902 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 31 Aug 2016 20:53:27 +0200 Subject: [PATCH 63/74] Graphics/Sprite: Add Origin parameter Allows you to change center of translation/rotation/scale Former-commit-id: 6045c6f78ec81db54629883927a203e8c50bb561 [formerly 8ab1e1e5785a9be67b76364f62fe4b767dca341f] [formerly f17a5c8c4d5e5cef8dd4ee76734609a6651384e7 [formerly 4a932134b130d64deb88f018332f5414b1370435]] Former-commit-id: 8311f12a2e6a28bec5e22f5ca5ce7d3f551d52ba [formerly 412800a9b5afb15fb21f2428e2e9b3b9eb34c0ab] Former-commit-id: 80d03c5581adbe47ccbe33649787a5698774cdd3 --- include/Nazara/Graphics/Sprite.hpp | 3 +++ include/Nazara/Graphics/Sprite.inl | 33 +++++++++++++++++++++++++++++- src/Nazara/Graphics/Sprite.cpp | 14 ++++++++----- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/include/Nazara/Graphics/Sprite.hpp b/include/Nazara/Graphics/Sprite.hpp index 3660bf872..3aa261d89 100644 --- a/include/Nazara/Graphics/Sprite.hpp +++ b/include/Nazara/Graphics/Sprite.hpp @@ -38,12 +38,14 @@ namespace Nz inline const Color& GetColor() const; inline const MaterialRef& GetMaterial() const; + inline const Vector3f& GetOrigin() const; inline const Vector2f& GetSize() const; inline const Rectf& GetTextureCoords() const; inline void SetColor(const Color& color); inline void SetDefaultMaterial(); inline void SetMaterial(MaterialRef material, bool resizeSprite = true); + inline void SetOrigin(const Vector3f& origin); inline void SetSize(const Vector2f& size); inline void SetSize(float sizeX, float sizeY); inline void SetTexture(TextureRef texture, bool resizeSprite = true); @@ -67,6 +69,7 @@ namespace Nz MaterialRef m_material; Rectf m_textureCoords; Vector2f m_size; + Vector3f m_origin; static SpriteLibrary::LibraryMap s_library; }; diff --git a/include/Nazara/Graphics/Sprite.inl b/include/Nazara/Graphics/Sprite.inl index f0e05c5a2..2cfc014a2 100644 --- a/include/Nazara/Graphics/Sprite.inl +++ b/include/Nazara/Graphics/Sprite.inl @@ -14,6 +14,7 @@ namespace Nz inline Sprite::Sprite() : m_color(Color::White), + m_origin(Nz::Vector3f::Zero()), m_textureCoords(0.f, 0.f, 1.f, 1.f), m_size(64.f, 64.f) { @@ -77,12 +78,23 @@ namespace Nz * \brief Gets the material of the sprite * \return Current material */ - inline const MaterialRef& Sprite::GetMaterial() const { return m_material; } + /*! + * \brief Gets the origin of the sprite + * + * \return Current material + * + * \see SetOrigin + */ + inline const Vector3f & Sprite::GetOrigin() const + { + return m_origin; + } + /*! * \brief Gets the size of the sprite * \return Current size @@ -146,6 +158,24 @@ namespace Nz } } + /*! + * \brief Sets the origin of the sprite + * + * The origin is the center of translation/rotation/scaling of the sprite. + * + * \param origin New origin for the sprite + * + * \see GetOrigin + */ + inline void Sprite::SetOrigin(const Vector3f& origin) + { + m_origin = origin; + + // On invalide la bounding box + InvalidateBoundingVolume(); + InvalidateVertices(); + } + /*! * \brief Sets the size of the sprite * @@ -277,3 +307,4 @@ namespace Nz } #include +#include "Sprite.hpp" diff --git a/src/Nazara/Graphics/Sprite.cpp b/src/Nazara/Graphics/Sprite.cpp index 5ef82cddf..f4b2f0dab 100644 --- a/src/Nazara/Graphics/Sprite.cpp +++ b/src/Nazara/Graphics/Sprite.cpp @@ -39,7 +39,9 @@ namespace Nz void Sprite::MakeBoundingVolume() const { - m_boundingVolume.Set(Vector3f(0.f), m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down()); + Vector3f origin(m_origin.x, -m_origin.y, m_origin.z); + + m_boundingVolume.Set(-origin, m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down() - origin); } /*! @@ -57,20 +59,22 @@ namespace Nz SparsePtr posPtr(&vertices[0].position, sizeof(VertexStruct_XYZ_Color_UV)); SparsePtr texCoordPtr(&vertices[0].uv, sizeof(VertexStruct_XYZ_Color_UV)); + Vector3f origin(m_origin.x, -m_origin.y, m_origin.z); + *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(Vector3f(0.f)); + *posPtr++ = instanceData->transformMatrix->Transform(Vector3f(-origin)); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftTop); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right()); + *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right() - origin); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightTop); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.y*Vector3f::Down()); + *posPtr++ = instanceData->transformMatrix->Transform(m_size.y*Vector3f::Down() - origin); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftBottom); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down()); + *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down() - origin); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightBottom); } From 32aeb963784a484e01c87eababab2203f8217b0a Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 1 Sep 2016 13:02:46 +0200 Subject: [PATCH 64/74] Graphics: Clear instances in Clear method Former-commit-id: 8f116c954577de1e231efe5d0c6c34458e7c195c [formerly 0b07a41900b0cad6305956370a045dd1539e5634] [formerly 4eb1b81cf3b3e2badcf61032988f61ffe511a001 [formerly f016c785f246cead41c81130d04ffb2dfe61e42d]] Former-commit-id: 4f7fd53326b8b60c91d4e4edf53451561c7da7ad [formerly c80c94219ed09321ff35472cc9209e383f14cb59] Former-commit-id: 8e2ec06ccf7bee67a47ad73dce1132c33cc91a5e --- src/Nazara/Graphics/DeferredGeometryPass.cpp | 7 --- src/Nazara/Graphics/DeferredRenderQueue.cpp | 30 ++++++++++ src/Nazara/Graphics/ForwardRenderQueue.cpp | 56 +++++++++++++++++++ .../Graphics/ForwardRenderTechnique.cpp | 13 +---- 4 files changed, 88 insertions(+), 18 deletions(-) diff --git a/src/Nazara/Graphics/DeferredGeometryPass.cpp b/src/Nazara/Graphics/DeferredGeometryPass.cpp index 1c4f8b8bb..dbdb95f5a 100644 --- a/src/Nazara/Graphics/DeferredGeometryPass.cpp +++ b/src/Nazara/Graphics/DeferredGeometryPass.cpp @@ -187,18 +187,11 @@ namespace Nz drawFunc(meshData.primitiveMode, 0, indexCount); } } - - instances.clear(); } } } - - // And we set it back data to zero - matEntry.enabled = false; } } - - pipelineEntry.maxInstanceCount = 0; } } } diff --git a/src/Nazara/Graphics/DeferredRenderQueue.cpp b/src/Nazara/Graphics/DeferredRenderQueue.cpp index 7d214b217..41fb9d20b 100644 --- a/src/Nazara/Graphics/DeferredRenderQueue.cpp +++ b/src/Nazara/Graphics/DeferredRenderQueue.cpp @@ -278,6 +278,36 @@ namespace Nz Layer& layer = it->second; if (layer.clearCount++ >= 100) it = layers.erase(it); + else + { + for (auto& pipelinePair : layer.opaqueModels) + { + const MaterialPipeline* pipeline = pipelinePair.first; + auto& pipelineEntry = pipelinePair.second; + + if (pipelineEntry.maxInstanceCount > 0) + { + for (auto& materialPair : pipelineEntry.materialMap) + { + auto& matEntry = materialPair.second; + + if (matEntry.enabled) + { + MeshInstanceContainer& meshInstances = matEntry.meshMap; + + for (auto& meshIt : meshInstances) + { + auto& meshEntry = meshIt.second; + + meshEntry.instances.clear(); + } + matEntry.enabled = false; + } + } + pipelineEntry.maxInstanceCount = 0; + } + } + } } } diff --git a/src/Nazara/Graphics/ForwardRenderQueue.cpp b/src/Nazara/Graphics/ForwardRenderQueue.cpp index 882a6f61e..2de6b66e4 100644 --- a/src/Nazara/Graphics/ForwardRenderQueue.cpp +++ b/src/Nazara/Graphics/ForwardRenderQueue.cpp @@ -527,6 +527,62 @@ namespace Nz layers.erase(it++); else { + for (auto& pipelinePair : layer.basicSprites) + { + auto& pipelineEntry = pipelinePair.second; + + if (pipelineEntry.enabled) + { + for (auto& materialPair : pipelineEntry.materialMap) + { + auto& matEntry = materialPair.second; + + if (matEntry.enabled) + { + auto& overlayMap = matEntry.overlayMap; + for (auto& overlayIt : overlayMap) + { + const Texture* overlay = overlayIt.first; + auto& spriteChainVector = overlayIt.second.spriteChains; + + spriteChainVector.clear(); + } + + matEntry.enabled = false; + } + } + pipelineEntry.enabled = false; + } + } + + for (auto& pipelinePair : layer.opaqueModels) + { + auto& pipelineEntry = pipelinePair.second; + + if (pipelineEntry.maxInstanceCount > 0) + { + for (auto& materialPair : pipelineEntry.materialMap) + { + const Material* material = materialPair.first; + auto& matEntry = materialPair.second; + + if (matEntry.enabled) + { + MeshInstanceContainer& meshInstances = matEntry.meshMap; + + for (auto& meshIt : meshInstances) + { + auto& meshEntry = meshIt.second; + + meshEntry.instances.clear(); + } + matEntry.enabled = false; + } + } + pipelineEntry.maxInstanceCount = 0; + } + } + layer.otherDrawables.clear(); layer.transparentModels.clear(); layer.transparentModelData.clear(); diff --git a/src/Nazara/Graphics/ForwardRenderTechnique.cpp b/src/Nazara/Graphics/ForwardRenderTechnique.cpp index 91507ee68..959ef2f03 100644 --- a/src/Nazara/Graphics/ForwardRenderTechnique.cpp +++ b/src/Nazara/Graphics/ForwardRenderTechnique.cpp @@ -386,17 +386,12 @@ namespace Nz vertexMapper.Unmap(); Renderer::DrawIndexedPrimitives(PrimitiveMode_TriangleList, 0, spriteCount * 6); - } while (spriteChain < spriteChainCount); - - spriteChainVector.clear(); + } + while (spriteChain < spriteChainCount); } } - - // We set it back to zero - matEntry.enabled = false; } } - pipelineEntry.enabled = false; } } } @@ -781,12 +776,8 @@ namespace Nz instances.clear(); } } - - matEntry.enabled = false; } } - - pipelineEntry.maxInstanceCount = 0; } } } From 8a9ec2883a2ae85b621223a37badbdd8771cfa0b Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 1 Sep 2016 21:07:08 +0200 Subject: [PATCH 65/74] Graphics/Sprite: Fix origin not being initialized/copied Former-commit-id: bdb43791a34e6f696029a2f0fdcc7e0a80e37d1a [formerly 429e69fda21a4b7493f992f02bda057ae3f5255c] [formerly 7ecf3ada43b2574b2a70162f2bdc258430ce30f6 [formerly cfb4bb3d609add7a370ff5bd54239632e20c6e9c]] Former-commit-id: 1b46fd8b1dd2ee8a0dc2317ef7bd8750b28f63b8 [formerly b11b682a76bec2160531d460043cd01e725d7c39] Former-commit-id: 225928240477469cc45aec70ccb1f51ae25736a8 --- include/Nazara/Graphics/Sprite.inl | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/include/Nazara/Graphics/Sprite.inl b/include/Nazara/Graphics/Sprite.inl index 2cfc014a2..410b42478 100644 --- a/include/Nazara/Graphics/Sprite.inl +++ b/include/Nazara/Graphics/Sprite.inl @@ -14,9 +14,9 @@ namespace Nz inline Sprite::Sprite() : m_color(Color::White), - m_origin(Nz::Vector3f::Zero()), m_textureCoords(0.f, 0.f, 1.f, 1.f), - m_size(64.f, 64.f) + m_size(64.f, 64.f), + m_origin(Nz::Vector3f::Zero()) { SetDefaultMaterial(); } @@ -26,11 +26,8 @@ namespace Nz * * \param material Reference to a material */ - inline Sprite::Sprite(MaterialRef material) : - m_color(Color::White), - m_textureCoords(0.f, 0.f, 1.f, 1.f), - m_size(64.f, 64.f) + Sprite() { SetMaterial(std::move(material), true); } @@ -42,9 +39,7 @@ namespace Nz */ inline Sprite::Sprite(Texture* texture) : - m_color(Color::White), - m_textureCoords(0.f, 0.f, 1.f, 1.f), - m_size(64.f, 64.f) + Sprite() { SetTexture(texture, true); } @@ -60,7 +55,8 @@ namespace Nz m_color(sprite.m_color), m_material(sprite.m_material), m_textureCoords(sprite.m_textureCoords), - m_size(sprite.m_size) + m_size(sprite.m_size), + m_origin(sprite.m_origin) { } @@ -270,6 +266,7 @@ namespace Nz m_color = sprite.m_color; m_material = sprite.m_material; + m_origin = sprite.m_origin; m_textureCoords = sprite.m_textureCoords; m_size = sprite.m_size; From 88615eae8579becd37c501340053571b19bb92a7 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sat, 3 Sep 2016 21:13:00 +0200 Subject: [PATCH 66/74] Graphics/DeferredRenderQueue: Fix crash on layer removal Former-commit-id: 42859917e1603acb297e0dec88d91ea673698bc7 [formerly 416ca6e56e3d19c57bbd22df7c0ee760bdc85449] [formerly b405620cd6b4ebe4413d13abd1082d68eb9d7203 [formerly 38b249271c7366e767111de1bb98bb63e0b86e93]] Former-commit-id: fb61d2d9bb16752c0e2ea9fbba3d8e61a138039d [formerly 5ef5905f3c64859d87425b76342acd6cc562ce5d] Former-commit-id: 36ab2a4d8a66737af06634dc2f79da1f9d6b5662 --- src/Nazara/Graphics/DeferredRenderQueue.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Nazara/Graphics/DeferredRenderQueue.cpp b/src/Nazara/Graphics/DeferredRenderQueue.cpp index 41fb9d20b..b240edcd7 100644 --- a/src/Nazara/Graphics/DeferredRenderQueue.cpp +++ b/src/Nazara/Graphics/DeferredRenderQueue.cpp @@ -273,7 +273,7 @@ namespace Nz layers.clear(); else { - for (auto it = layers.begin(); it != layers.end(); ++it) + for (auto it = layers.begin(); it != layers.end();) { Layer& layer = it->second; if (layer.clearCount++ >= 100) @@ -307,6 +307,8 @@ namespace Nz pipelineEntry.maxInstanceCount = 0; } } + + ++it; } } } From bff78868ba7c5e345a13faa8c8b5dbddcb8018c6 Mon Sep 17 00:00:00 2001 From: Ardakaniz Date: Sun, 4 Sep 2016 14:50:38 +0200 Subject: [PATCH 67/74] Utility/EventHandler: Fix OnMouseButtonReleased event Former-commit-id: 813e5fed6c8b929ef54db8c1caac2ebc22584404 [formerly c972de08f65603b9d5d29a6926b206cecc274683] [formerly ae54b811c39ad784a31b2ad7b24b9f6dc1a9f364 [formerly f8c20591aea42393489846f97f2e690366605077]] Former-commit-id: 43bb11a52d9ab0cb187998f1b77aa9d6e4c4953f [formerly b83192de7f3d383904655d88552ca510d5e9090d] Former-commit-id: caa0cb2030e4d178b3f5c9a7ebdc33a804ea655a --- include/Nazara/Utility/EventHandler.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Nazara/Utility/EventHandler.inl b/include/Nazara/Utility/EventHandler.inl index c066b6810..719ffddcb 100644 --- a/include/Nazara/Utility/EventHandler.inl +++ b/include/Nazara/Utility/EventHandler.inl @@ -43,7 +43,7 @@ namespace Nz break; case WindowEventType_MouseButtonReleased: - OnMouseButtonPressed(this, event.mouseButton); + OnMouseButtonReleased(this, event.mouseButton); break; case WindowEventType_MouseEntered: From ffe938d422cae2fe5893c20e14a66d4d91add780 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 4 Sep 2016 19:56:11 +0200 Subject: [PATCH 68/74] Audio: Fix some type warning Former-commit-id: 37c2bdbdfc591ff3cc031ee1498ae1050183b4bd [formerly e96bf359c986942fc707834c9c5992eca9c57b22] [formerly a1c53ad3ae4218aea8163f5f33245e352b820a34 [formerly a3c51b11bd591e8accad191bfa5547323436e4cb]] Former-commit-id: 5d7faba8324c26970f0ca0681d695e6650cff32f [formerly c564a0adc734737472ea066e5d362637f9697138] Former-commit-id: 7979614ff5460597b01e042e7e520ad7d55c7493 --- include/Nazara/Audio/Algorithm.hpp | 2 +- include/Nazara/Audio/Algorithm.inl | 6 +- include/Nazara/Audio/Music.hpp | 2 +- include/Nazara/Audio/SoundBuffer.hpp | 6 +- include/Nazara/Audio/SoundStream.hpp | 6 +- src/Nazara/Audio/Formats/sndfileLoader.cpp | 18 +++--- src/Nazara/Audio/Music.cpp | 46 +++----------- src/Nazara/Audio/Sound.cpp | 34 +--------- src/Nazara/Audio/SoundBuffer.cpp | 74 +++++----------------- 9 files changed, 47 insertions(+), 147 deletions(-) diff --git a/include/Nazara/Audio/Algorithm.hpp b/include/Nazara/Audio/Algorithm.hpp index ddb72a6b0..ea5bd09b6 100644 --- a/include/Nazara/Audio/Algorithm.hpp +++ b/include/Nazara/Audio/Algorithm.hpp @@ -11,7 +11,7 @@ namespace Nz { - template void MixToMono(T* input, T* output, unsigned int channelCount, unsigned int frameCount); + template void MixToMono(T* input, T* output, UInt32 channelCount, UInt64 frameCount); } #include diff --git a/include/Nazara/Audio/Algorithm.inl b/include/Nazara/Audio/Algorithm.inl index 1075a8b57..ce3c87369 100644 --- a/include/Nazara/Audio/Algorithm.inl +++ b/include/Nazara/Audio/Algorithm.inl @@ -19,16 +19,16 @@ namespace Nz * \remark The input buffer may be the same as the output one */ template - void MixToMono(T* input, T* output, unsigned int channelCount, unsigned int frameCount) + void MixToMono(T* input, T* output, UInt32 channelCount, UInt64 frameCount) { // To avoid overflow, we use, as an accumulator, a type which is large enough: (u)int 64 bits for integers, double for floatings typedef typename std::conditional::value, UInt64, Int64>::type BiggestInt; typedef typename std::conditional::value, BiggestInt, double>::type Biggest; - for (unsigned int i = 0; i < frameCount; ++i) + for (UInt64 i = 0; i < frameCount; ++i) { Biggest acc = Biggest(0); - for (unsigned int j = 0; j < channelCount; ++j) + for (UInt32 j = 0; j < channelCount; ++j) acc += input[i * channelCount + j]; output[i] = static_cast(acc / channelCount); diff --git a/include/Nazara/Audio/Music.hpp b/include/Nazara/Audio/Music.hpp index d08732fa7..f31882890 100644 --- a/include/Nazara/Audio/Music.hpp +++ b/include/Nazara/Audio/Music.hpp @@ -48,7 +48,7 @@ namespace Nz UInt32 GetDuration() const; AudioFormat GetFormat() const; UInt32 GetPlayingOffset() const; - UInt32 GetSampleCount() const; + UInt64 GetSampleCount() const; UInt32 GetSampleRate() const; SoundStatus GetStatus() const; diff --git a/include/Nazara/Audio/SoundBuffer.hpp b/include/Nazara/Audio/SoundBuffer.hpp index 2b02847b4..6b8e5c385 100644 --- a/include/Nazara/Audio/SoundBuffer.hpp +++ b/include/Nazara/Audio/SoundBuffer.hpp @@ -50,18 +50,18 @@ namespace Nz public: SoundBuffer() = default; - SoundBuffer(AudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const Int16* samples); + SoundBuffer(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const Int16* samples); SoundBuffer(const SoundBuffer&) = delete; SoundBuffer(SoundBuffer&&) = delete; ~SoundBuffer(); - bool Create(AudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const Int16* samples); + bool Create(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const Int16* samples); void Destroy(); UInt32 GetDuration() const; AudioFormat GetFormat() const; const Int16* GetSamples() const; - UInt32 GetSampleCount() const; + UInt64 GetSampleCount() const; UInt32 GetSampleRate() const; bool IsValid() const; diff --git a/include/Nazara/Audio/SoundStream.hpp b/include/Nazara/Audio/SoundStream.hpp index 4edc7b412..8fd93f412 100644 --- a/include/Nazara/Audio/SoundStream.hpp +++ b/include/Nazara/Audio/SoundStream.hpp @@ -21,11 +21,11 @@ namespace Nz virtual UInt32 GetDuration() const = 0; virtual AudioFormat GetFormat() const = 0; - virtual UInt32 GetSampleCount() const = 0; + virtual UInt64 GetSampleCount() const = 0; virtual UInt32 GetSampleRate() const = 0; - virtual unsigned int Read(void* buffer, unsigned int sampleCount) = 0; - virtual void Seek(UInt32 offset) = 0; + virtual UInt64 Read(void* buffer, UInt64 sampleCount) = 0; + virtual void Seek(UInt64 offset) = 0; }; } diff --git a/src/Nazara/Audio/Formats/sndfileLoader.cpp b/src/Nazara/Audio/Formats/sndfileLoader.cpp index 2aca17976..055e3b6a6 100644 --- a/src/Nazara/Audio/Formats/sndfileLoader.cpp +++ b/src/Nazara/Audio/Formats/sndfileLoader.cpp @@ -97,7 +97,7 @@ namespace Nz return m_format; } - UInt32 GetSampleCount() const override + UInt64 GetSampleCount() const override { return m_sampleCount; } @@ -131,7 +131,7 @@ namespace Nz bool Open(Stream& stream, bool forceMono) { SF_INFO infos; - infos.format = 0; // Format inconnu + infos.format = 0; // Unknown format m_handle = sf_open_virtual(&callbacks, SFM_READ, &infos, &stream); if (!m_handle) @@ -154,7 +154,7 @@ namespace Nz return false; } - m_sampleCount = static_cast(infos.channels*infos.frames); + m_sampleCount = infos.channels*infos.frames; m_sampleRate = infos.samplerate; // Durée de la musique (s) = samples / channels*rate @@ -180,7 +180,7 @@ namespace Nz return true; } - unsigned int Read(void* buffer, unsigned int sampleCount) override + UInt64 Read(void* buffer, UInt64 sampleCount) override { // Si la musique a été demandée en mono, nous devons la convertir à la volée lors de la lecture if (m_mixToMono) @@ -190,13 +190,13 @@ namespace Nz sf_count_t readSampleCount = sf_read_short(m_handle, m_mixBuffer.data(), m_format * sampleCount); MixToMono(m_mixBuffer.data(), static_cast(buffer), m_format, sampleCount); - return static_cast(readSampleCount / m_format); + return readSampleCount / m_format; } else - return static_cast(sf_read_short(m_handle, static_cast(buffer), sampleCount)); + return sf_read_short(m_handle, static_cast(buffer), sampleCount); } - void Seek(UInt32 offset) override + void Seek(UInt64 offset) override { sf_seek(m_handle, offset*m_sampleRate / 1000, SEEK_SET); } @@ -208,8 +208,8 @@ namespace Nz SNDFILE* m_handle; bool m_mixToMono; UInt32 m_duration; - unsigned int m_sampleCount; - unsigned int m_sampleRate; + UInt32 m_sampleRate; + UInt64 m_sampleCount; }; bool IsSupported(const String& extension) diff --git a/src/Nazara/Audio/Music.cpp b/src/Nazara/Audio/Music.cpp index 9e38c7114..1f0df6ba5 100644 --- a/src/Nazara/Audio/Music.cpp +++ b/src/Nazara/Audio/Music.cpp @@ -166,17 +166,10 @@ namespace Nz * * \remark Produces a NazaraError if there is no music with NAZARA_AUDIO_SAFE defined */ - UInt32 Music::GetPlayingOffset() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Music not created"); - return 0; - } - #endif - + NazaraAssert(m_impl, "Music not created"); + // Prevent music thread from enqueing new buffers while we're getting the count Nz::LockGuard lock(m_impl->bufferLock); @@ -192,16 +185,9 @@ namespace Nz * * \remark Produces a NazaraError if there is no music with NAZARA_AUDIO_SAFE defined */ - - UInt32 Music::GetSampleCount() const + UInt64 Music::GetSampleCount() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Music not created"); - return 0; - } - #endif + NazaraAssert(m_impl, "Music not created"); return m_impl->stream->GetSampleCount(); } @@ -212,16 +198,9 @@ namespace Nz * * \remark Produces a NazaraError if there is no music with NAZARA_AUDIO_SAFE defined */ - UInt32 Music::GetSampleRate() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Music not created"); - return 0; - } - #endif + NazaraAssert(m_impl, "Music not created"); return m_impl->sampleRate; } @@ -233,16 +212,9 @@ namespace Nz * \remark If the music is not playing, Stopped is returned * \remark Produces a NazaraError if there is no music with NAZARA_AUDIO_SAFE defined */ - SoundStatus Music::GetStatus() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Music not created"); - return SoundStatus_Stopped; - } - #endif + NazaraAssert(m_impl, "Music not created"); SoundStatus status = GetInternalStatus(); @@ -425,8 +397,8 @@ namespace Nz bool Music::FillAndQueueBuffer(unsigned int buffer) { - unsigned int sampleCount = m_impl->chunkSamples.size(); - unsigned int sampleRead = 0; + std::size_t sampleCount = m_impl->chunkSamples.size(); + std::size_t sampleRead = 0; // Fill the buffer by reading from the stream for (;;) @@ -446,7 +418,7 @@ namespace Nz // Update the buffer (send it to OpenAL) and queue it if we got any data if (sampleRead > 0) { - alBufferData(buffer, m_impl->audioFormat, &m_impl->chunkSamples[0], sampleRead*sizeof(Int16), m_impl->sampleRate); + alBufferData(buffer, m_impl->audioFormat, &m_impl->chunkSamples[0], static_cast(sampleRead*sizeof(Int16)), static_cast(m_impl->sampleRate)); alSourceQueueBuffers(m_source, 1, &buffer); } diff --git a/src/Nazara/Audio/Sound.cpp b/src/Nazara/Audio/Sound.cpp index d2b71318b..3e2e27faa 100644 --- a/src/Nazara/Audio/Sound.cpp +++ b/src/Nazara/Audio/Sound.cpp @@ -27,7 +27,6 @@ namespace Nz * * \param soundBuffer Buffer to read sound from */ - Sound::Sound(const SoundBuffer* soundBuffer) { SetBuffer(soundBuffer); @@ -38,7 +37,6 @@ namespace Nz * * \param sound Sound to copy */ - Sound::Sound(const Sound& sound) : SoundEmitter(sound) { @@ -50,7 +48,6 @@ namespace Nz * * \see Stop */ - Sound::~Sound() { Stop(); @@ -61,7 +58,6 @@ namespace Nz * * \param loop Should sound loop */ - void Sound::EnableLooping(bool loop) { alSourcei(m_source, AL_LOOPING, loop); @@ -71,7 +67,6 @@ namespace Nz * \brief Gets the internal buffer * \return Internal buffer */ - const SoundBuffer* Sound::GetBuffer() const { return m_buffer; @@ -83,7 +78,6 @@ namespace Nz * * \remark Produces a NazaraError if there is no buffer */ - UInt32 Sound::GetDuration() const { NazaraAssert(m_buffer, "Invalid sound buffer"); @@ -95,7 +89,6 @@ namespace Nz * \brief Gets the current offset in the sound * \return Offset in milliseconds (works with entire seconds) */ - UInt32 Sound::GetPlayingOffset() const { ALint samples = 0; @@ -108,7 +101,6 @@ namespace Nz * \brief Gets the status of the music * \return Enumeration of type SoundStatus (Playing, Stopped, ...) */ - SoundStatus Sound::GetStatus() const { return GetInternalStatus(); @@ -118,7 +110,6 @@ namespace Nz * \brief Checks whether the sound is looping * \return true if it is the case */ - bool Sound::IsLooping() const { ALint loop; @@ -141,7 +132,6 @@ namespace Nz * \brief Checks whether the sound is playing * \return true if it is the case */ - bool Sound::IsPlaying() const { return GetStatus() == SoundStatus_Playing; @@ -156,7 +146,6 @@ namespace Nz * * \remark Produces a NazaraError if loading failed */ - bool Sound::LoadFromFile(const String& filePath, const SoundBufferParams& params) { SoundBufferRef buffer = SoundBuffer::New(); @@ -180,7 +169,6 @@ namespace Nz * * \remark Produces a NazaraError if loading failed */ - bool Sound::LoadFromMemory(const void* data, std::size_t size, const SoundBufferParams& params) { SoundBufferRef buffer = SoundBuffer::New(); @@ -203,7 +191,6 @@ namespace Nz * * \remark Produces a NazaraError if loading failed */ - bool Sound::LoadFromStream(Stream& stream, const SoundBufferParams& params) { SoundBufferRef buffer = SoundBuffer::New(); @@ -220,7 +207,6 @@ namespace Nz /*! * \brief Pauses the sound */ - void Sound::Pause() { alSourcePause(m_source); @@ -231,16 +217,9 @@ namespace Nz * * \remark Produces a NazaraError if the sound is not playable with NAZARA_AUDIO_SAFE defined */ - void Sound::Play() { - #if NAZARA_AUDIO_SAFE - if (!IsPlayable()) - { - NazaraError("Invalid sound buffer"); - return; - } - #endif + NazaraAssert(IsPlayable(), "Music is not playable"); alSourcePlay(m_source); } @@ -252,16 +231,9 @@ namespace Nz * * \remark Produces a NazaraError if buffer is invalid with NAZARA_AUDIO_SAFE defined */ - void Sound::SetBuffer(const SoundBuffer* buffer) { - #if NAZARA_AUDIO_SAFE - if (buffer && !buffer->IsValid()) - { - NazaraError("Invalid sound buffer"); - return; - } - #endif + NazaraAssert(!buffer || buffer->IsValid(), "Invalid sound buffer"); if (m_buffer == buffer) return; @@ -281,7 +253,6 @@ namespace Nz * * \param offset Offset in the sound in milliseconds */ - void Sound::SetPlayingOffset(UInt32 offset) { alSourcei(m_source, AL_SAMPLE_OFFSET, static_cast(offset/1000.f * m_buffer->GetSampleRate())); @@ -290,7 +261,6 @@ namespace Nz /*! * \brief Stops the sound */ - void Sound::Stop() { alSourceStop(m_source); diff --git a/src/Nazara/Audio/SoundBuffer.cpp b/src/Nazara/Audio/SoundBuffer.cpp index b59e74e23..4b2b0410e 100644 --- a/src/Nazara/Audio/SoundBuffer.cpp +++ b/src/Nazara/Audio/SoundBuffer.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -40,7 +41,7 @@ namespace Nz AudioFormat format; UInt32 duration; std::unique_ptr samples; - UInt32 sampleCount; + UInt64 sampleCount; UInt32 sampleRate; }; @@ -57,8 +58,7 @@ namespace Nz * * \see Create */ - - SoundBuffer::SoundBuffer(AudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const Int16* samples) + SoundBuffer::SoundBuffer(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const Int16* samples) { Create(format, sampleCount, sampleRate, samples); @@ -76,7 +76,6 @@ namespace Nz * * \see Destroy */ - SoundBuffer::~SoundBuffer() { OnSoundBufferRelease(this); @@ -96,8 +95,7 @@ namespace Nz * \remark Produces a NazaraError if creation went wrong with NAZARA_AUDIO_SAFE defined, * this could happen if parameters are invalid or creation of OpenAL buffers failed */ - - bool SoundBuffer::Create(AudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const Int16* samples) + bool SoundBuffer::Create(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const Int16* samples) { Destroy(); @@ -132,19 +130,18 @@ namespace Nz ALuint buffer; alGenBuffers(1, &buffer); - if (alGetError() != AL_NO_ERROR) { NazaraError("Failed to create OpenAL buffer"); return false; } - alBufferData(buffer, OpenAL::AudioFormat[format], samples, sampleCount*sizeof(Int16), sampleRate); + CallOnExit clearBufferOnExit([buffer] () { alDeleteBuffers(1, &buffer); }); + + alBufferData(buffer, OpenAL::AudioFormat[format], samples, static_cast(sampleCount*sizeof(Int16)), static_cast(sampleRate)); if (alGetError() != AL_NO_ERROR) { - alDeleteBuffers(1, &buffer); - NazaraError("Failed to set OpenAL buffer"); return false; } @@ -158,6 +155,8 @@ namespace Nz m_impl->samples.reset(new Int16[sampleCount]); std::memcpy(&m_impl->samples[0], samples, sampleCount*sizeof(Int16)); + clearBufferOnExit.Reset(); + return true; } @@ -182,16 +181,9 @@ namespace Nz * * \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined */ - UInt32 SoundBuffer::GetDuration() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Sound buffer not created"); - return 0; - } - #endif + NazaraAssert(m_impl, "Sound buffer not created"); return m_impl->duration; } @@ -205,13 +197,7 @@ namespace Nz AudioFormat SoundBuffer::GetFormat() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Sound buffer not created"); - return AudioFormat_Unknown; - } - #endif + NazaraAssert(m_impl, "Sound buffer not created"); return m_impl->format; } @@ -222,16 +208,9 @@ namespace Nz * * \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined */ - const Int16* SoundBuffer::GetSamples() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Sound buffer not created"); - return nullptr; - } - #endif + NazaraAssert(m_impl, "Sound buffer not created"); return m_impl->samples.get(); } @@ -242,16 +221,9 @@ namespace Nz * * \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined */ - - unsigned int SoundBuffer::GetSampleCount() const + UInt64 SoundBuffer::GetSampleCount() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Sound buffer not created"); - return 0; - } - #endif + NazaraAssert(m_impl, "Sound buffer not created"); return m_impl->sampleCount; } @@ -262,16 +234,9 @@ namespace Nz * * \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined */ - - unsigned int SoundBuffer::GetSampleRate() const + UInt32 SoundBuffer::GetSampleRate() const { - #if NAZARA_AUDIO_SAFE - if (!m_impl) - { - NazaraError("Sound buffer not created"); - return 0; - } - #endif + NazaraAssert(m_impl, "Sound buffer not created"); return m_impl->sampleRate; } @@ -293,7 +258,6 @@ namespace Nz * \param filePath Path to the file * \param params Parameters for the sound buffer */ - bool SoundBuffer::LoadFromFile(const String& filePath, const SoundBufferParams& params) { return SoundBufferLoader::LoadFromFile(this, filePath, params); @@ -307,7 +271,6 @@ namespace Nz * \param size Size of the memory * \param params Parameters for the sound buffer */ - bool SoundBuffer::LoadFromMemory(const void* data, std::size_t size, const SoundBufferParams& params) { return SoundBufferLoader::LoadFromMemory(this, data, size, params); @@ -320,7 +283,6 @@ namespace Nz * \param stream Stream to the sound buffer * \param params Parameters for the sound buffer */ - bool SoundBuffer::LoadFromStream(Stream& stream, const SoundBufferParams& params) { return SoundBufferLoader::LoadFromStream(this, stream, params); @@ -332,7 +294,6 @@ namespace Nz * * \param format Format to check */ - bool SoundBuffer::IsFormatSupported(AudioFormat format) { return Audio::IsFormatSupported(format); @@ -344,7 +305,6 @@ namespace Nz * * \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined */ - unsigned int SoundBuffer::GetOpenALBuffer() const { #ifdef NAZARA_DEBUG @@ -364,7 +324,6 @@ namespace Nz * * \remark Produces a NazaraError if sub-initialization failed */ - bool SoundBuffer::Initialize() { if (!SoundBufferLibrary::Initialize()) @@ -385,7 +344,6 @@ namespace Nz /*! * \brief Uninitializes the libraries and managers */ - void SoundBuffer::Uninitialize() { SoundBufferManager::Uninitialize(); From c5ece59597c1ac7c5d1424773b5daf4386036638 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 4 Sep 2016 19:58:22 +0200 Subject: [PATCH 69/74] Lua/LuaInstance: Improve code Former-commit-id: a93c9c2db6b0bca2fa236cc2d9c6be8b0ff15211 [formerly 986c24bc675da874d11ad85cd5026dfafd923dda] [formerly b071ccaef50f97de0fc29060b74e8fb55e4eb566 [formerly 82021bb41c9dd57c9244fd4fd8efea694d51f7d4]] Former-commit-id: 5acb7d0fe7365613dfb4edf02f955d5a829ec831 [formerly cd88f46679a1bec5682d6ae2c4aed5f504ec49e2] Former-commit-id: a6fac707a49d379a90327879cee0fc2beddd6efe --- include/Nazara/Lua/LuaInstance.hpp | 12 +++++------ include/Nazara/Lua/LuaInstance.inl | 25 +++++++++++++++++++++++ src/Nazara/Lua/LuaInstance.cpp | 32 ++++-------------------------- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/include/Nazara/Lua/LuaInstance.hpp b/include/Nazara/Lua/LuaInstance.hpp index e3bc517f8..c6d7c6385 100644 --- a/include/Nazara/Lua/LuaInstance.hpp +++ b/include/Nazara/Lua/LuaInstance.hpp @@ -92,16 +92,16 @@ namespace Nz LuaType GetField(const String& fieldName, int tableIndex = -1) const; LuaType GetGlobal(const char* name) const; LuaType GetGlobal(const String& name) const; - lua_State* GetInternalState() const; - String GetLastError() const; - UInt32 GetMemoryLimit() const; - UInt32 GetMemoryUsage() const; + inline lua_State* GetInternalState() const; + inline String GetLastError() const; + inline std::size_t GetMemoryLimit() const; + inline std::size_t GetMemoryUsage() const; LuaType GetMetatable(const char* tname) const; LuaType GetMetatable(const String& tname) const; bool GetMetatable(int index) const; unsigned int GetStackTop() const; LuaType GetTable(int index = -2) const; - UInt32 GetTimeLimit() const; + inline UInt32 GetTimeLimit() const; LuaType GetType(int index) const; const char* GetTypeName(LuaType type) const; @@ -144,7 +144,7 @@ namespace Nz void PushString(const char* str) const; void PushString(const char* str, std::size_t size) const; void PushString(const String& str) const; - void PushTable(unsigned int sequenceElementCount = 0, unsigned int arrayElementCount = 0) const; + void PushTable(std::size_t sequenceElementCount = 0, std::size_t arrayElementCount = 0) const; void* PushUserdata(std::size_t size) const; void PushValue(int index) const; diff --git a/include/Nazara/Lua/LuaInstance.inl b/include/Nazara/Lua/LuaInstance.inl index f9f5e662f..e6a4b5482 100644 --- a/include/Nazara/Lua/LuaInstance.inl +++ b/include/Nazara/Lua/LuaInstance.inl @@ -25,6 +25,31 @@ namespace Nz instance.m_state = nullptr; } + inline lua_State* LuaInstance::GetInternalState() const + { + return m_state; + } + + inline String LuaInstance::GetLastError() const + { + return m_lastError; + } + + inline std::size_t LuaInstance::GetMemoryLimit() const + { + return m_memoryLimit; + } + + inline std::size_t LuaInstance::GetMemoryUsage() const + { + return m_memoryUsage; + } + + inline UInt32 LuaInstance::GetTimeLimit() const + { + return m_timeLimit; + } + inline LuaInstance& LuaInstance::operator=(LuaInstance&& instance) noexcept { m_clock = std::move(m_clock); diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index f31c6fe83..f73c4a207 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -464,26 +464,6 @@ namespace Nz return FromLuaType(lua_getglobal(m_state, name.GetConstBuffer())); } - lua_State* LuaInstance::GetInternalState() const - { - return m_state; - } - - String LuaInstance::GetLastError() const - { - return m_lastError; - } - - UInt32 LuaInstance::GetMemoryLimit() const - { - return m_memoryLimit; - } - - UInt32 LuaInstance::GetMemoryUsage() const - { - return m_memoryUsage; - } - LuaType LuaInstance::GetMetatable(const char* tname) const { return FromLuaType(luaL_getmetatable(m_state, tname)); @@ -501,7 +481,7 @@ namespace Nz unsigned int LuaInstance::GetStackTop() const { - return lua_gettop(m_state); + return static_cast(lua_gettop(m_state)); } LuaType LuaInstance::GetTable(int index) const @@ -509,11 +489,6 @@ namespace Nz return FromLuaType(lua_gettable(m_state, index)); } - UInt32 LuaInstance::GetTimeLimit() const - { - return m_timeLimit; - } - LuaType LuaInstance::GetType(int index) const { return FromLuaType(lua_type(m_state, index)); @@ -690,9 +665,10 @@ namespace Nz lua_pushlstring(m_state, str.GetConstBuffer(), str.GetSize()); } - void LuaInstance::PushTable(unsigned int sequenceElementCount, unsigned int arrayElementCount) const + void LuaInstance::PushTable(std::size_t sequenceElementCount, std::size_t arrayElementCount) const { - lua_createtable(m_state, sequenceElementCount, arrayElementCount); + constexpr std::size_t maxInt = std::numeric_limits::max(); + lua_createtable(m_state, static_cast(std::min(sequenceElementCount, maxInt)), static_cast(std::min(arrayElementCount, maxInt))); } void* LuaInstance::PushUserdata(std::size_t size) const From f2aa4e0e193013f3501e0c39b31c4903ded29467 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 4 Sep 2016 20:02:23 +0200 Subject: [PATCH 70/74] Sdk/GraphicsComponent: Allows to setup an offset to renderables Former-commit-id: fd1f70010f950dd4a4194e049ddff317c0d8b4b9 [formerly 8fee96f11b7bef08351110bef74643fa0be8b17d] [formerly ec5d6ad819cf325dac0ae61d983003cf99c78aac [formerly 2610a17ba67d61080254ce4bc3e9176e315dfbe5]] Former-commit-id: 7683be7fa9a565dc3fb59be401ecff5580a6de15 [formerly 80ac7628f5119f58cf4518b5b1a44aff5b6d6b20] Former-commit-id: d1604af612715688e7b1fc451d8561f79e100541 --- SDK/include/NDK/Components/GraphicsComponent.hpp | 1 + SDK/include/NDK/Components/GraphicsComponent.inl | 13 ++++++++++++- SDK/src/NDK/Components/GraphicsComponent.cpp | 2 +- include/Nazara/Graphics/InstancedRenderable.hpp | 8 +++++--- include/Nazara/Graphics/Model.inl | 3 ++- src/Nazara/Graphics/Billboard.cpp | 2 +- src/Nazara/Graphics/InstancedRenderable.cpp | 2 +- src/Nazara/Graphics/Model.cpp | 2 +- src/Nazara/Graphics/SkeletalModel.cpp | 2 +- src/Nazara/Graphics/Sprite.cpp | 8 ++++---- src/Nazara/Graphics/TextSprite.cpp | 2 +- src/Nazara/Graphics/TileMap.cpp | 8 ++++---- 12 files changed, 34 insertions(+), 19 deletions(-) diff --git a/SDK/include/NDK/Components/GraphicsComponent.hpp b/SDK/include/NDK/Components/GraphicsComponent.hpp index ec16ba593..b792cfd69 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.hpp +++ b/SDK/include/NDK/Components/GraphicsComponent.hpp @@ -32,6 +32,7 @@ namespace Ndk inline void AddToRenderQueue(Nz::AbstractRenderQueue* renderQueue) const; inline void Attach(Nz::InstancedRenderableRef renderable, int renderOrder = 0); + inline void Attach(Nz::InstancedRenderableRef renderable, const Nz::Matrix4f& localMatrix, int renderOrder = 0); inline void Clear(); diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index 01cd7a2e3..bd3e6dbfb 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -2,8 +2,10 @@ // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp +#include +#include +#include #include -#include "GraphicsComponent.hpp" namespace Ndk { @@ -36,10 +38,13 @@ namespace Ndk { EnsureTransformMatrixUpdate(); + Ndk::RenderSystem& renderSystem = m_entity->GetWorld()->GetSystem(); + for (const Renderable& object : m_renderables) { if (!object.dataUpdated) { + object.data.transformMatrix = Nz::Matrix4f::ConcatenateAffine(renderSystem.GetCoordinateSystemMatrix(), Nz::Matrix4f::ConcatenateAffine(object.data.localMatrix, m_transformMatrix)); object.renderable->UpdateData(&object.data); object.dataUpdated = true; } @@ -56,9 +61,15 @@ namespace Ndk */ inline void GraphicsComponent::Attach(Nz::InstancedRenderableRef renderable, int renderOrder) + { + return Attach(renderable, Nz::Matrix4f::Identity(), renderOrder); + } + + inline void GraphicsComponent::Attach(Nz::InstancedRenderableRef renderable, const Nz::Matrix4f& localMatrix, int renderOrder) { m_renderables.emplace_back(m_transformMatrix); Renderable& r = m_renderables.back(); + r.data.localMatrix = localMatrix; r.data.renderOrder = renderOrder; r.renderable = std::move(renderable); r.renderableInvalidationSlot.Connect(r.renderable->OnInstancedRenderableInvalidateData, std::bind(&GraphicsComponent::InvalidateRenderableData, this, std::placeholders::_1, std::placeholders::_2, m_renderables.size() - 1)); diff --git a/SDK/src/NDK/Components/GraphicsComponent.cpp b/SDK/src/NDK/Components/GraphicsComponent.cpp index 759d3f24b..e06890c97 100644 --- a/SDK/src/NDK/Components/GraphicsComponent.cpp +++ b/SDK/src/NDK/Components/GraphicsComponent.cpp @@ -133,7 +133,7 @@ namespace Ndk Ndk::RenderSystem& renderSystem = m_entity->GetWorld()->GetSystem(); - m_transformMatrix = Nz::Matrix4f::ConcatenateAffine(renderSystem.GetCoordinateSystemMatrix(), m_entity->GetComponent().GetTransformMatrix()); + m_transformMatrix = m_entity->GetComponent().GetTransformMatrix(); m_transformMatrixUpdated = true; } diff --git a/include/Nazara/Graphics/InstancedRenderable.hpp b/include/Nazara/Graphics/InstancedRenderable.hpp index d854a41d6..8b44d7512 100644 --- a/include/Nazara/Graphics/InstancedRenderable.hpp +++ b/include/Nazara/Graphics/InstancedRenderable.hpp @@ -54,8 +54,8 @@ namespace Nz struct InstanceData { - InstanceData(const Matrix4f& referenceMatrix) : - transformMatrix(&referenceMatrix), + InstanceData(const Matrix4f& transformationMatrix) : + localMatrix(transformationMatrix), flags(0) { } @@ -67,6 +67,7 @@ namespace Nz data = std::move(instanceData.data); flags = instanceData.flags; renderOrder = instanceData.renderOrder; + localMatrix = instanceData.localMatrix; transformMatrix = instanceData.transformMatrix; volume = instanceData.volume; @@ -75,7 +76,8 @@ namespace Nz std::vector data; BoundingVolumef volume; - const Matrix4f* transformMatrix; + Matrix4f localMatrix; + mutable Matrix4f transformMatrix; UInt32 flags; int renderOrder; }; diff --git a/include/Nazara/Graphics/Model.inl b/include/Nazara/Graphics/Model.inl index 243611fb5..8e659e869 100644 --- a/include/Nazara/Graphics/Model.inl +++ b/include/Nazara/Graphics/Model.inl @@ -18,8 +18,9 @@ namespace Nz */ inline void Model::AddToRenderQueue(AbstractRenderQueue* renderQueue, const Matrix4f& transformMatrix, unsigned int renderOrder) { - InstanceData instanceData(transformMatrix); + InstanceData instanceData(Nz::Matrix4f::Identity()); instanceData.renderOrder = renderOrder; + instanceData.transformMatrix = transformMatrix; return AddToRenderQueue(renderQueue, instanceData); } diff --git a/src/Nazara/Graphics/Billboard.cpp b/src/Nazara/Graphics/Billboard.cpp index 17a2ad065..4aed923ae 100644 --- a/src/Nazara/Graphics/Billboard.cpp +++ b/src/Nazara/Graphics/Billboard.cpp @@ -30,7 +30,7 @@ namespace Nz if (!m_material) return; - Nz::Vector3f position = instanceData.transformMatrix->GetTranslation(); + Nz::Vector3f position = instanceData.transformMatrix.GetTranslation(); renderQueue->AddBillboards(instanceData.renderOrder, m_material, 1, &position, &m_size, &m_sinCos, &m_color); } diff --git a/src/Nazara/Graphics/InstancedRenderable.cpp b/src/Nazara/Graphics/InstancedRenderable.cpp index 03da17984..ef5f62b96 100644 --- a/src/Nazara/Graphics/InstancedRenderable.cpp +++ b/src/Nazara/Graphics/InstancedRenderable.cpp @@ -80,7 +80,7 @@ namespace Nz NazaraAssert(instanceData, "Invalid instance data"); NazaraUnused(instanceData); - instanceData->volume.Update(*instanceData->transformMatrix); + instanceData->volume.Update(instanceData->transformMatrix); } /*! diff --git a/src/Nazara/Graphics/Model.cpp b/src/Nazara/Graphics/Model.cpp index 2b9e03cc1..d382c77d9 100644 --- a/src/Nazara/Graphics/Model.cpp +++ b/src/Nazara/Graphics/Model.cpp @@ -82,7 +82,7 @@ namespace Nz meshData.primitiveMode = mesh->GetPrimitiveMode(); meshData.vertexBuffer = mesh->GetVertexBuffer(); - renderQueue->AddMesh(instanceData.renderOrder, material, meshData, mesh->GetAABB(), *instanceData.transformMatrix); + renderQueue->AddMesh(instanceData.renderOrder, material, meshData, mesh->GetAABB(), instanceData.transformMatrix); } } diff --git a/src/Nazara/Graphics/SkeletalModel.cpp b/src/Nazara/Graphics/SkeletalModel.cpp index 8621d1fce..b91ac0076 100644 --- a/src/Nazara/Graphics/SkeletalModel.cpp +++ b/src/Nazara/Graphics/SkeletalModel.cpp @@ -69,7 +69,7 @@ namespace Nz meshData.primitiveMode = mesh->GetPrimitiveMode(); meshData.vertexBuffer = SkinningManager::GetBuffer(mesh, &m_skeleton); - renderQueue->AddMesh(instanceData.renderOrder, material, meshData, m_skeleton.GetAABB(), *instanceData.transformMatrix); + renderQueue->AddMesh(instanceData.renderOrder, material, meshData, m_skeleton.GetAABB(), instanceData.transformMatrix); } } diff --git a/src/Nazara/Graphics/Sprite.cpp b/src/Nazara/Graphics/Sprite.cpp index f4b2f0dab..8b950bf2a 100644 --- a/src/Nazara/Graphics/Sprite.cpp +++ b/src/Nazara/Graphics/Sprite.cpp @@ -62,19 +62,19 @@ namespace Nz Vector3f origin(m_origin.x, -m_origin.y, m_origin.z); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(Vector3f(-origin)); + *posPtr++ = instanceData->transformMatrix.Transform(Vector3f(-origin)); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftTop); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right() - origin); + *posPtr++ = instanceData->transformMatrix.Transform(m_size.x*Vector3f::Right() - origin); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightTop); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.y*Vector3f::Down() - origin); + *posPtr++ = instanceData->transformMatrix.Transform(m_size.y*Vector3f::Down() - origin); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftBottom); *colorPtr++ = m_color; - *posPtr++ = instanceData->transformMatrix->Transform(m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down() - origin); + *posPtr++ = instanceData->transformMatrix.Transform(m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down() - origin); *texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightBottom); } diff --git a/src/Nazara/Graphics/TextSprite.cpp b/src/Nazara/Graphics/TextSprite.cpp index 2f1d733b4..42dba4aaf 100644 --- a/src/Nazara/Graphics/TextSprite.cpp +++ b/src/Nazara/Graphics/TextSprite.cpp @@ -310,7 +310,7 @@ namespace Nz Vector3f localPos = localVertex->position.x*Vector3f::Right() + localVertex->position.y*Vector3f::Down(); localPos *= m_scale; - *pos++ = instanceData->transformMatrix->Transform(localPos); + *pos++ = instanceData->transformMatrix.Transform(localPos); *color++ = m_color * localVertex->color; *uv++ = localVertex->uv; diff --git a/src/Nazara/Graphics/TileMap.cpp b/src/Nazara/Graphics/TileMap.cpp index 2c6e26aa4..255685f43 100644 --- a/src/Nazara/Graphics/TileMap.cpp +++ b/src/Nazara/Graphics/TileMap.cpp @@ -71,19 +71,19 @@ namespace Nz Vector3f tileLeftCorner(x * m_tileSize.x, y * -m_tileSize.y, 0.f); *colorPtr++ = tile.color; - *posPtr++ = instanceData->transformMatrix->Transform(tileLeftCorner); + *posPtr++ = instanceData->transformMatrix.Transform(tileLeftCorner); *texCoordPtr++ = tile.textureCoords.GetCorner(RectCorner_LeftTop); *colorPtr++ = tile.color; - *posPtr++ = instanceData->transformMatrix->Transform(tileLeftCorner + m_tileSize.x * Vector3f::Right()); + *posPtr++ = instanceData->transformMatrix.Transform(tileLeftCorner + m_tileSize.x * Vector3f::Right()); *texCoordPtr++ = tile.textureCoords.GetCorner(RectCorner_RightTop); *colorPtr++ = tile.color; - *posPtr++ = instanceData->transformMatrix->Transform(tileLeftCorner + m_tileSize.y * Vector3f::Down()); + *posPtr++ = instanceData->transformMatrix.Transform(tileLeftCorner + m_tileSize.y * Vector3f::Down()); *texCoordPtr++ = tile.textureCoords.GetCorner(RectCorner_LeftBottom); *colorPtr++ = tile.color; - *posPtr++ = instanceData->transformMatrix->Transform(tileLeftCorner + m_tileSize.x * Vector3f::Right() + m_tileSize.y * Vector3f::Down()); + *posPtr++ = instanceData->transformMatrix.Transform(tileLeftCorner + m_tileSize.x * Vector3f::Right() + m_tileSize.y * Vector3f::Down()); *texCoordPtr++ = tile.textureCoords.GetCorner(RectCorner_RightBottom); } spriteCount += layer.tiles.size(); From d28142166e236997fe2c0aa55b0141851f051a17 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 4 Sep 2016 20:39:34 +0200 Subject: [PATCH 71/74] Utility: First code cleaning pass Former-commit-id: 5e8a6fe1d39919f583d6ec52c3a6441ea16db0d1 [formerly 6013fccf81504ad739456c6bf2a0f32f51cd0976] [formerly 6eca34e7eb539427281a09520652f6b63a09d2ef [formerly 42f25260bb808235785af682cc8227be5ced64dd]] Former-commit-id: 82fd5b55a89ae15950b1bae4164fc93f4761edf9 [formerly 7be9e16acf53f75829a6ef00cea4aca8032820de] Former-commit-id: f96d5a14ced9e7aa0a16c63c0a9c467d752ecf05 --- include/Nazara/Utility/Animation.hpp | 29 +- .../Nazara/Utility/Formats/MD5AnimParser.hpp | 14 +- .../Nazara/Utility/Formats/MD5MeshParser.hpp | 6 +- include/Nazara/Utility/Formats/OBJParser.hpp | 34 +- include/Nazara/Utility/Formats/OBJParser.inl | 30 +- include/Nazara/Utility/Mesh.hpp | 30 +- include/Nazara/Utility/Sequence.hpp | 6 +- include/Nazara/Utility/Skeleton.hpp | 10 +- include/Nazara/Utility/SubMesh.hpp | 10 +- include/Nazara/Utility/VertexMapper.inl | 2 +- src/Nazara/Utility/Animation.cpp | 326 +++--------------- src/Nazara/Utility/Formats/MD5AnimLoader.cpp | 12 +- src/Nazara/Utility/Formats/MD5AnimParser.cpp | 52 +-- src/Nazara/Utility/Formats/MD5MeshLoader.cpp | 12 +- src/Nazara/Utility/Formats/MD5MeshParser.cpp | 18 +- src/Nazara/Utility/Formats/MTLParser.cpp | 16 +- src/Nazara/Utility/Formats/OBJLoader.cpp | 22 +- src/Nazara/Utility/Formats/OBJParser.cpp | 28 +- src/Nazara/Utility/Formats/OBJSaver.cpp | 14 +- src/Nazara/Utility/Mesh.cpp | 58 ++-- src/Nazara/Utility/Skeleton.cpp | 32 +- src/Nazara/Utility/SubMesh.cpp | 4 +- 22 files changed, 276 insertions(+), 489 deletions(-) diff --git a/include/Nazara/Utility/Animation.hpp b/include/Nazara/Utility/Animation.hpp index e196a0f77..2ab1f2baa 100644 --- a/include/Nazara/Utility/Animation.hpp +++ b/include/Nazara/Utility/Animation.hpp @@ -20,16 +20,15 @@ #include #include #include -#include namespace Nz { struct NAZARA_UTILITY_API AnimationParams : ResourceParameters { // La frame de fin à charger - unsigned int endFrame = std::numeric_limits::max(); + UInt32 endFrame = 0xFFFFFFFF; // La frame de début à charger - unsigned int startFrame = 0; + UInt32 startFrame = 0; bool IsValid() const; }; @@ -57,27 +56,27 @@ namespace Nz ~Animation(); bool AddSequence(const Sequence& sequence); - void AnimateSkeleton(Skeleton* targetSkeleton, unsigned int frameA, unsigned int frameB, float interpolation) const; + void AnimateSkeleton(Skeleton* targetSkeleton, UInt32 frameA, UInt32 frameB, float interpolation) const; - bool CreateSkeletal(unsigned int frameCount, unsigned int jointCount); + bool CreateSkeletal(UInt32 frameCount, UInt32 jointCount); void Destroy(); void EnableLoopPointInterpolation(bool loopPointInterpolation); - unsigned int GetFrameCount() const; - unsigned int GetJointCount() const; + UInt32 GetFrameCount() const; + UInt32 GetJointCount() const; Sequence* GetSequence(const String& sequenceName); - Sequence* GetSequence(unsigned int index); + Sequence* GetSequence(UInt32 index); const Sequence* GetSequence(const String& sequenceName) const; - const Sequence* GetSequence(unsigned int index) const; - unsigned int GetSequenceCount() const; - int GetSequenceIndex(const String& sequenceName) const; - SequenceJoint* GetSequenceJoints(unsigned int frameIndex = 0); - const SequenceJoint* GetSequenceJoints(unsigned int frameIndex = 0) const; + const Sequence* GetSequence(UInt32 index) const; + UInt32 GetSequenceCount() const; + UInt32 GetSequenceIndex(const String& sequenceName) const; + SequenceJoint* GetSequenceJoints(UInt32 frameIndex = 0); + const SequenceJoint* GetSequenceJoints(UInt32 frameIndex = 0) const; AnimationType GetType() const; bool HasSequence(const String& sequenceName) const; - bool HasSequence(unsigned int index = 0) const; + bool HasSequence(UInt32 index = 0) const; bool IsLoopPointInterpolationEnabled() const; bool IsValid() const; @@ -87,7 +86,7 @@ namespace Nz bool LoadFromStream(Stream& stream, const AnimationParams& params = AnimationParams()); void RemoveSequence(const String& sequenceName); - void RemoveSequence(unsigned int index); + void RemoveSequence(UInt32 index); template static AnimationRef New(Args&&... args); diff --git a/include/Nazara/Utility/Formats/MD5AnimParser.hpp b/include/Nazara/Utility/Formats/MD5AnimParser.hpp index 558608142..3a9e2163d 100644 --- a/include/Nazara/Utility/Formats/MD5AnimParser.hpp +++ b/include/Nazara/Utility/Formats/MD5AnimParser.hpp @@ -34,12 +34,12 @@ namespace Nz struct Joint { + Int32 parent; Quaternionf bindOrient; String name; Vector3f bindPos; - int parent; - unsigned int flags; - unsigned int index; + UInt32 flags; + UInt32 index; }; MD5AnimParser(Stream& stream); @@ -47,12 +47,12 @@ namespace Nz Ternary Check(); - std::size_t GetAnimatedComponentCount() const; + UInt32 GetAnimatedComponentCount() const; const Frame* GetFrames() const; - std::size_t GetFrameCount() const; - std::size_t GetFrameRate() const; + UInt32 GetFrameCount() const; + UInt32 GetFrameRate() const; const Joint* GetJoints() const; - std::size_t GetJointCount() const; + UInt32 GetJointCount() const; bool Parse(); diff --git a/include/Nazara/Utility/Formats/MD5MeshParser.hpp b/include/Nazara/Utility/Formats/MD5MeshParser.hpp index cd2d19309..b515c1226 100644 --- a/include/Nazara/Utility/Formats/MD5MeshParser.hpp +++ b/include/Nazara/Utility/Formats/MD5MeshParser.hpp @@ -22,10 +22,10 @@ namespace Nz public: struct Joint { + Int32 parent; Quaternionf bindOrient; String name; Vector3f bindPos; - int parent; }; typedef Vector3ui Triangle; @@ -58,9 +58,9 @@ namespace Nz Ternary Check(); const Joint* GetJoints() const; - std::size_t GetJointCount() const; + UInt32 GetJointCount() const; const Mesh* GetMeshes() const; - std::size_t GetMeshCount() const; + UInt32 GetMeshCount() const; bool Parse(); diff --git a/include/Nazara/Utility/Formats/OBJParser.hpp b/include/Nazara/Utility/Formats/OBJParser.hpp index 114f72635..6c0c35af4 100644 --- a/include/Nazara/Utility/Formats/OBJParser.hpp +++ b/include/Nazara/Utility/Formats/OBJParser.hpp @@ -31,43 +31,43 @@ namespace Nz inline String* GetMaterials(); inline const String* GetMaterials() const; - inline unsigned int GetMaterialCount() const; + inline UInt32 GetMaterialCount() const; inline Mesh* GetMeshes(); inline const Mesh* GetMeshes() const; - inline unsigned int GetMeshCount() const; + inline UInt32 GetMeshCount() const; inline const String& GetMtlLib() const; inline Vector3f* GetNormals(); inline const Vector3f* GetNormals() const; - inline unsigned int GetNormalCount() const; + inline UInt32 GetNormalCount() const; inline Vector4f* GetPositions(); inline const Vector4f* GetPositions() const; - inline unsigned int GetPositionCount() const; + inline UInt32 GetPositionCount() const; inline Vector3f* GetTexCoords(); inline const Vector3f* GetTexCoords() const; - inline unsigned int GetTexCoordCount() const; + inline UInt32 GetTexCoordCount() const; - bool Parse(Stream& stream, std::size_t reservedVertexCount = 100); + bool Parse(Stream& stream, UInt32 reservedVertexCount = 100); bool Save(Stream& stream) const; - inline String* SetMaterialCount(std::size_t materialCount); - inline Mesh* SetMeshCount(std::size_t meshCount); + inline String* SetMaterialCount(UInt32 materialCount); + inline Mesh* SetMeshCount(UInt32 meshCount); inline void SetMtlLib(const String& mtlLib); - inline Vector3f* SetNormalCount(std::size_t normalCount); - inline Vector4f* SetPositionCount(std::size_t positionCount); - inline Vector3f* SetTexCoordCount(std::size_t texCoordCount); + inline Vector3f* SetNormalCount(UInt32 normalCount); + inline Vector4f* SetPositionCount(UInt32 positionCount); + inline Vector3f* SetTexCoordCount(UInt32 texCoordCount); struct Face { - std::size_t firstVertex; - std::size_t vertexCount; + UInt32 firstVertex; + UInt32 vertexCount; }; struct FaceVertex { - std::size_t normal; - std::size_t position; - std::size_t texCoord; + UInt32 normal; + UInt32 position; + UInt32 texCoord; }; struct Mesh @@ -75,7 +75,7 @@ namespace Nz std::vector faces; std::vector vertices; String name; - std::size_t material; + UInt32 material; }; private: diff --git a/include/Nazara/Utility/Formats/OBJParser.inl b/include/Nazara/Utility/Formats/OBJParser.inl index b04506fdf..41e794f82 100644 --- a/include/Nazara/Utility/Formats/OBJParser.inl +++ b/include/Nazara/Utility/Formats/OBJParser.inl @@ -27,9 +27,9 @@ namespace Nz return m_materials.data(); } - inline unsigned int OBJParser::GetMaterialCount() const + inline UInt32 OBJParser::GetMaterialCount() const { - return m_materials.size(); + return static_cast(m_materials.size()); } inline OBJParser::Mesh* OBJParser::GetMeshes() @@ -42,9 +42,9 @@ namespace Nz return m_meshes.data(); } - inline unsigned int OBJParser::GetMeshCount() const + inline UInt32 OBJParser::GetMeshCount() const { - return m_meshes.size(); + return static_cast(m_meshes.size()); } inline const String& OBJParser::GetMtlLib() const @@ -62,9 +62,9 @@ namespace Nz return m_normals.data(); } - inline unsigned int OBJParser::GetNormalCount() const + inline UInt32 OBJParser::GetNormalCount() const { - return m_normals.size(); + return static_cast(m_normals.size()); } inline Vector4f* OBJParser::GetPositions() @@ -77,9 +77,9 @@ namespace Nz return m_positions.data(); } - inline unsigned int OBJParser::GetPositionCount() const + inline UInt32 OBJParser::GetPositionCount() const { - return m_positions.size(); + return static_cast(m_positions.size()); } inline Vector3f* OBJParser::GetTexCoords() @@ -92,18 +92,18 @@ namespace Nz return m_texCoords.data(); } - inline unsigned int OBJParser::GetTexCoordCount() const + inline UInt32 OBJParser::GetTexCoordCount() const { - return m_texCoords.size(); + return static_cast(m_texCoords.size()); } - inline String* OBJParser::SetMaterialCount(std::size_t materialCount) + inline String* OBJParser::SetMaterialCount(UInt32 materialCount) { m_materials.resize(materialCount); return m_materials.data(); } - inline OBJParser::Mesh* OBJParser::SetMeshCount(std::size_t meshCount) + inline OBJParser::Mesh* OBJParser::SetMeshCount(UInt32 meshCount) { m_meshes.resize(meshCount); return m_meshes.data(); @@ -114,19 +114,19 @@ namespace Nz m_mtlLib = mtlLib; } - inline Vector3f* OBJParser::SetNormalCount(std::size_t normalCount) + inline Vector3f* OBJParser::SetNormalCount(UInt32 normalCount) { m_normals.resize(normalCount); return m_normals.data(); } - inline Vector4f* OBJParser::SetPositionCount(std::size_t positionCount) + inline Vector4f* OBJParser::SetPositionCount(UInt32 positionCount) { m_positions.resize(positionCount); return m_positions.data(); } - inline Vector3f* OBJParser::SetTexCoordCount(std::size_t texCoordCount) + inline Vector3f* OBJParser::SetTexCoordCount(UInt32 texCoordCount) { m_texCoords.resize(texCoordCount); return m_texCoords.data(); diff --git a/include/Nazara/Utility/Mesh.hpp b/include/Nazara/Utility/Mesh.hpp index 62a372384..60ccb98b1 100644 --- a/include/Nazara/Utility/Mesh.hpp +++ b/include/Nazara/Utility/Mesh.hpp @@ -84,7 +84,7 @@ namespace Nz SubMesh* BuildSubMesh(const Primitive& primitive, const MeshParams& params = MeshParams()); void BuildSubMeshes(const PrimitiveList& list, const MeshParams& params = MeshParams()); - bool CreateSkeletal(unsigned int jointCount); + bool CreateSkeletal(UInt32 jointCount); bool CreateStatic(); void Destroy(); @@ -95,23 +95,23 @@ namespace Nz const Boxf& GetAABB() const; String GetAnimation() const; AnimationType GetAnimationType() const; - unsigned int GetJointCount() const; - ParameterList& GetMaterialData(unsigned int index); - const ParameterList& GetMaterialData(unsigned int index) const; - unsigned int GetMaterialCount() const; + UInt32 GetJointCount() const; + ParameterList& GetMaterialData(UInt32 index); + const ParameterList& GetMaterialData(UInt32 index) const; + UInt32 GetMaterialCount() const; Skeleton* GetSkeleton(); const Skeleton* GetSkeleton() const; SubMesh* GetSubMesh(const String& identifier); - SubMesh* GetSubMesh(unsigned int index); + SubMesh* GetSubMesh(UInt32 index); const SubMesh* GetSubMesh(const String& identifier) const; - const SubMesh* GetSubMesh(unsigned int index) const; - unsigned int GetSubMeshCount() const; - int GetSubMeshIndex(const String& identifier) const; - unsigned int GetTriangleCount() const; - unsigned int GetVertexCount() const; + const SubMesh* GetSubMesh(UInt32 index) const; + UInt32 GetSubMeshCount() const; + UInt32 GetSubMeshIndex(const String& identifier) const; + UInt32 GetTriangleCount() const; + UInt32 GetVertexCount() const; bool HasSubMesh(const String& identifier) const; - bool HasSubMesh(unsigned int index = 0) const; + bool HasSubMesh(UInt32 index = 0) const; void InvalidateAABB() const; @@ -125,14 +125,14 @@ namespace Nz void Recenter(); void RemoveSubMesh(const String& identifier); - void RemoveSubMesh(unsigned int index); + void RemoveSubMesh(UInt32 index); bool SaveToFile(const String& filePath, const MeshParams& params = MeshParams()); bool SaveToStream(Stream& stream, const String& format, const MeshParams& params = MeshParams()); void SetAnimation(const String& animationPath); - void SetMaterialCount(unsigned int matCount); - void SetMaterialData(unsigned int matIndex, ParameterList data); + void SetMaterialCount(UInt32 matCount); + void SetMaterialData(UInt32 matIndex, ParameterList data); void Transform(const Matrix4f& matrix); diff --git a/include/Nazara/Utility/Sequence.hpp b/include/Nazara/Utility/Sequence.hpp index 1c6812eb7..b8549a4bf 100644 --- a/include/Nazara/Utility/Sequence.hpp +++ b/include/Nazara/Utility/Sequence.hpp @@ -16,9 +16,9 @@ namespace Nz struct Sequence { String name; - unsigned int firstFrame; - unsigned int frameCount; - unsigned int frameRate; + UInt32 firstFrame; + UInt32 frameCount; + UInt32 frameRate; }; struct SequenceJoint diff --git a/include/Nazara/Utility/Skeleton.hpp b/include/Nazara/Utility/Skeleton.hpp index fa217e6d4..8312f967f 100644 --- a/include/Nazara/Utility/Skeleton.hpp +++ b/include/Nazara/Utility/Skeleton.hpp @@ -37,21 +37,21 @@ namespace Nz Skeleton(const Skeleton& skeleton); ~Skeleton(); - bool Create(unsigned int jointCount); + bool Create(UInt32 jointCount); void Destroy(); const Boxf& GetAABB() const; Joint* GetJoint(const String& jointName); - Joint* GetJoint(unsigned int index); + Joint* GetJoint(UInt32 index); const Joint* GetJoint(const String& jointName) const; - const Joint* GetJoint(unsigned int index) const; + const Joint* GetJoint(UInt32 index) const; Joint* GetJoints(); const Joint* GetJoints() const; - unsigned int GetJointCount() const; + UInt32 GetJointCount() const; int GetJointIndex(const String& jointName) const; void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation); - void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, unsigned int* indices, unsigned int indiceCount); + void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, UInt32* indices, UInt32 indiceCount); bool IsValid() const; diff --git a/include/Nazara/Utility/SubMesh.hpp b/include/Nazara/Utility/SubMesh.hpp index 6eee3a152..525930e0b 100644 --- a/include/Nazara/Utility/SubMesh.hpp +++ b/include/Nazara/Utility/SubMesh.hpp @@ -39,15 +39,15 @@ namespace Nz virtual const Boxf& GetAABB() const = 0; virtual AnimationType GetAnimationType() const = 0; virtual const IndexBuffer* GetIndexBuffer() const = 0; - unsigned int GetMaterialIndex() const; + UInt32 GetMaterialIndex() const; const Mesh* GetParent() const; PrimitiveMode GetPrimitiveMode() const; - unsigned int GetTriangleCount() const; - virtual unsigned int GetVertexCount() const = 0; + UInt32 GetTriangleCount() const; + virtual UInt32 GetVertexCount() const = 0; virtual bool IsAnimated() const = 0; - void SetMaterialIndex(unsigned int matIndex); + void SetMaterialIndex(UInt32 matIndex); void SetPrimitiveMode(PrimitiveMode mode); // Signals: @@ -56,7 +56,7 @@ namespace Nz protected: PrimitiveMode m_primitiveMode; const Mesh* m_parent; - unsigned int m_matIndex; + UInt32 m_matIndex; }; } diff --git a/include/Nazara/Utility/VertexMapper.inl b/include/Nazara/Utility/VertexMapper.inl index 7b36743eb..4a155bfbd 100644 --- a/include/Nazara/Utility/VertexMapper.inl +++ b/include/Nazara/Utility/VertexMapper.inl @@ -28,8 +28,8 @@ namespace Nz { NazaraError("Attribute 0x" + String::Number(component, 16) + " is not enabled"); return SparsePtr(); + } } } -} #include diff --git a/src/Nazara/Utility/Animation.cpp b/src/Nazara/Utility/Animation.cpp index 62591344b..a996f85a5 100644 --- a/src/Nazara/Utility/Animation.cpp +++ b/src/Nazara/Utility/Animation.cpp @@ -14,13 +14,13 @@ namespace Nz { struct AnimationImpl { - std::unordered_map sequenceMap; + std::unordered_map sequenceMap; std::vector sequences; std::vector sequenceJoints; // Uniquement pour les animations squelettiques AnimationType type; bool loopPointInterpolation = false; - unsigned int frameCount; - unsigned int jointCount; // Uniquement pour les animations squelettiques + UInt32 frameCount; + UInt32 jointCount; // Uniquement pour les animations squelettiques }; bool AnimationParams::IsValid() const @@ -43,40 +43,18 @@ namespace Nz bool Animation::AddSequence(const Sequence& sequence) { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return false; - } - - if (sequence.frameCount == 0) - { - NazaraError("Sequence frame count must be over zero"); - return false; - } - #endif + NazaraAssert(m_impl, "Animation not created"); + NazaraAssert(sequence.frameCount > 0, "Sequence frame count must be over zero"); if (m_impl->type == AnimationType_Skeletal) { - unsigned int endFrame = sequence.firstFrame + sequence.frameCount - 1; + UInt32 endFrame = sequence.firstFrame + sequence.frameCount - 1; if (endFrame >= m_impl->frameCount) { m_impl->frameCount = endFrame+1; m_impl->sequenceJoints.resize(m_impl->frameCount*m_impl->jointCount); } } - #if NAZARA_UTILITY_SAFE - else - { - unsigned int endFrame = sequence.firstFrame + sequence.frameCount - 1; - if (endFrame >= m_impl->frameCount) - { - NazaraError("Sequence end frame is over animation end frame"); - return false; - } - } - #endif if (!sequence.name.IsEmpty()) { @@ -84,12 +62,12 @@ namespace Nz auto it = m_impl->sequenceMap.find(sequence.name); if (it != m_impl->sequenceMap.end()) { - NazaraError("Sequence name \"" + sequence.name + "\" is already used"); + NazaraError("Sequence name \"" + sequence.name + "\" is already in use"); return false; } #endif - m_impl->sequenceMap[sequence.name] = m_impl->sequences.size(); + m_impl->sequenceMap[sequence.name] = static_cast(m_impl->sequences.size()); } m_impl->sequences.push_back(sequence); @@ -97,55 +75,16 @@ namespace Nz return true; } - void Animation::AnimateSkeleton(Skeleton* targetSkeleton, unsigned int frameA, unsigned int frameB, float interpolation) const + void Animation::AnimateSkeleton(Skeleton* targetSkeleton, UInt32 frameA, UInt32 frameB, float interpolation) const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return; - } + NazaraAssert(m_impl, "Animation not created"); + NazaraAssert(m_impl->type == AnimationType_Skeletal, "Animation is not skeletal"); + NazaraAssert(targetSkeleton && targetSkeleton->IsValid(), "Invalid skeleton"); + NazaraAssert(targetSkeleton->GetJointCount() == m_impl->jointCount, "Skeleton joint does not match animation joint count"); + NazaraAssert(frameA < m_impl->frameCount, "FrameA is out of range"); + NazaraAssert(frameB < m_impl->frameCount, "FrameB is out of range"); - if (m_impl->type != AnimationType_Skeletal) - { - NazaraError("Animation is not skeletal"); - return; - } - - if (!targetSkeleton || !targetSkeleton->IsValid()) - { - NazaraError("Target skeleton is invalid"); - return; - } - - if (targetSkeleton->GetJointCount() != m_impl->jointCount) - { - NazaraError("Target skeleton joint count must match animation joint count"); - return; - } - - if (frameA >= m_impl->frameCount) - { - NazaraError("Frame A is out of range (" + String::Number(frameA) + " >= " + String::Number(m_impl->frameCount) + ')'); - return; - } - - if (frameB >= m_impl->frameCount) - { - NazaraError("Frame B is out of range (" + String::Number(frameB) + " >= " + String::Number(m_impl->frameCount) + ')'); - return; - } - #endif - - #ifdef NAZARA_DEBUG - if (interpolation < 0.f || interpolation > 1.f) - { - NazaraError("Interpolation must be in range [0..1] (Got " + String::Number(interpolation) + ')'); - return; - } - #endif - - for (unsigned int i = 0; i < m_impl->jointCount; ++i) + for (UInt32 i = 0; i < m_impl->jointCount; ++i) { Joint* joint = targetSkeleton->GetJoint(i); @@ -158,17 +97,12 @@ namespace Nz } } - bool Animation::CreateSkeletal(unsigned int frameCount, unsigned int jointCount) + bool Animation::CreateSkeletal(UInt32 frameCount, UInt32 jointCount) { - Destroy(); + NazaraAssert(frameCount > 0, "Frame count must be over zero"); + NazaraAssert(jointCount > 0, "Frame count must be over zero"); - #if NAZARA_UTILITY_SAFE - if (frameCount == 0) - { - NazaraError("Frame count must be over zero"); - return false; - } - #endif + Destroy(); m_impl = new AnimationImpl; m_impl->frameCount = frameCount; @@ -192,255 +126,130 @@ namespace Nz void Animation::EnableLoopPointInterpolation(bool loopPointInterpolation) { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return; - } - #endif + NazaraAssert(m_impl, "Animation not created"); m_impl->loopPointInterpolation = loopPointInterpolation; } - unsigned int Animation::GetFrameCount() const + UInt32 Animation::GetFrameCount() const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return false; - } - #endif + NazaraAssert(m_impl, "Animation not created"); return m_impl->frameCount; } - unsigned int Animation::GetJointCount() const + UInt32 Animation::GetJointCount() const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return 0; - } - - if (m_impl->type != AnimationType_Skeletal) - { - NazaraError("Animation is not skeletal"); - return 0; - } - #endif + NazaraAssert(m_impl, "Animation not created"); return m_impl->jointCount; } Sequence* Animation::GetSequence(const String& sequenceName) { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return nullptr; - } - #endif + NazaraAssert(m_impl, "Animation not created"); auto it = m_impl->sequenceMap.find(sequenceName); - - #if NAZARA_UTILITY_SAFE if (it == m_impl->sequenceMap.end()) { NazaraError("Sequence not found"); return nullptr; } - #endif return &m_impl->sequences[it->second]; } - Sequence* Animation::GetSequence(unsigned int index) + Sequence* Animation::GetSequence(UInt32 index) { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return nullptr; - } - - if (index >= m_impl->sequences.size()) - { - NazaraError("Sequence index out of range (" + String::Number(index) + " >= " + String::Number(m_impl->sequences.size()) + ')'); - return nullptr; - } - #endif + NazaraAssert(m_impl, "Animation not created"); + NazaraAssert(index < m_impl->sequences.size(), "Sequence index out of range"); return &m_impl->sequences[index]; } const Sequence* Animation::GetSequence(const String& sequenceName) const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return nullptr; - } - #endif + NazaraAssert(m_impl, "Animation not created"); auto it = m_impl->sequenceMap.find(sequenceName); - - #if NAZARA_UTILITY_SAFE if (it == m_impl->sequenceMap.end()) { NazaraError("Sequence not found"); return nullptr; } - #endif return &m_impl->sequences[it->second]; } - const Sequence* Animation::GetSequence(unsigned int index) const + const Sequence* Animation::GetSequence(UInt32 index) const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return nullptr; - } - - if (index >= m_impl->sequences.size()) - { - NazaraError("Sequence index out of range (" + String::Number(index) + " >= " + String::Number(m_impl->sequences.size()) + ')'); - return nullptr; - } - #endif + NazaraAssert(m_impl, "Animation not created"); + NazaraAssert(index < m_impl->sequences.size(), "Sequence index out of range"); return &m_impl->sequences[index]; } - unsigned int Animation::GetSequenceCount() const + UInt32 Animation::GetSequenceCount() const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return 0; - } - #endif + NazaraAssert(m_impl, "Animation not created"); - return m_impl->sequences.size(); + return static_cast(m_impl->sequences.size()); } - int Animation::GetSequenceIndex(const String& sequenceName) const + UInt32 Animation::GetSequenceIndex(const String& sequenceName) const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return -1; - } - #endif + NazaraAssert(m_impl, "Animation not created"); auto it = m_impl->sequenceMap.find(sequenceName); - - #if NAZARA_UTILITY_SAFE if (it == m_impl->sequenceMap.end()) { NazaraError("Sequence not found"); - return -1; + return 0xFFFFFFFF; } - #endif return it->second; } - SequenceJoint* Animation::GetSequenceJoints(unsigned int frameIndex) + SequenceJoint* Animation::GetSequenceJoints(UInt32 frameIndex) { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return nullptr; - } - - if (m_impl->type != AnimationType_Skeletal) - { - NazaraError("Animation is not skeletal"); - return nullptr; - } - #endif + NazaraAssert(m_impl, "Animation not created"); + NazaraAssert(m_impl->type == AnimationType_Skeletal, "Animation is not skeletal"); return &m_impl->sequenceJoints[frameIndex*m_impl->jointCount]; } - const SequenceJoint* Animation::GetSequenceJoints(unsigned int frameIndex) const + const SequenceJoint* Animation::GetSequenceJoints(UInt32 frameIndex) const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return nullptr; - } - - if (m_impl->type != AnimationType_Skeletal) - { - NazaraError("Animation is not skeletal"); - return nullptr; - } - #endif + NazaraAssert(m_impl, "Animation not created"); + NazaraAssert(m_impl->type == AnimationType_Skeletal, "Animation is not skeletal"); return &m_impl->sequenceJoints[frameIndex*m_impl->jointCount]; } AnimationType Animation::GetType() const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return AnimationType_Static; // Ce qui est une valeur invalide pour Animation - } - #endif + NazaraAssert(m_impl, "Animation not created"); return m_impl->type; } bool Animation::HasSequence(const String& sequenceName) const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return false; - } - #endif + NazaraAssert(m_impl, "Animation not created"); return m_impl->sequenceMap.find(sequenceName) != m_impl->sequenceMap.end(); } - bool Animation::HasSequence(unsigned int index) const + bool Animation::HasSequence(UInt32 index) const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return false; - } - #endif + NazaraAssert(m_impl, "Animation not created"); return index >= m_impl->sequences.size(); } bool Animation::IsLoopPointInterpolationEnabled() const { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return false; - } - #endif + NazaraAssert(m_impl, "Animation not created"); return m_impl->loopPointInterpolation; } @@ -467,12 +276,7 @@ namespace Nz void Animation::RemoveSequence(const String& identifier) { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return; - } + NazaraAssert(m_impl, "Animation not created"); auto it = m_impl->sequenceMap.find(identifier); if (it == m_impl->sequenceMap.end()) @@ -481,32 +285,16 @@ namespace Nz return; } - int index = it->second; - #else - int index = m_impl->sequenceMap[identifier]; - #endif + auto sequenceIt = m_impl->sequences.begin(); + std::advance(sequenceIt, it->second); - auto it2 = m_impl->sequences.begin(); - std::advance(it2, index); - - m_impl->sequences.erase(it2); + m_impl->sequences.erase(sequenceIt); } - void Animation::RemoveSequence(unsigned int index) + void Animation::RemoveSequence(UInt32 index) { - #if NAZARA_UTILITY_SAFE - if (!m_impl) - { - NazaraError("Animation not created"); - return; - } - - if (index >= m_impl->sequences.size()) - { - NazaraError("Sequence index out of range (" + String::Number(index) + " >= " + String::Number(m_impl->sequences.size()) + ')'); - return; - } - #endif + NazaraAssert(m_impl, "Animation not created"); + NazaraAssert(index < m_impl->sequences.size(), "Sequence index out of range"); auto it = m_impl->sequences.begin(); std::advance(it, index); diff --git a/src/Nazara/Utility/Formats/MD5AnimLoader.cpp b/src/Nazara/Utility/Formats/MD5AnimLoader.cpp index e61f6dda2..942b54f8e 100644 --- a/src/Nazara/Utility/Formats/MD5AnimLoader.cpp +++ b/src/Nazara/Utility/Formats/MD5AnimLoader.cpp @@ -37,10 +37,10 @@ namespace Nz } const MD5AnimParser::Frame* frames = parser.GetFrames(); - std::size_t frameCount = parser.GetFrameCount(); - std::size_t frameRate = parser.GetFrameRate(); + UInt32 frameCount = parser.GetFrameCount(); + UInt32 frameRate = parser.GetFrameRate(); const MD5AnimParser::Joint* joints = parser.GetJoints(); - std::size_t jointCount = parser.GetJointCount(); + UInt32 jointCount = parser.GetJointCount(); // À ce stade, nous sommes censés avoir assez d'informations pour créer l'animation animation->CreateSkeletal(frameCount, jointCount); @@ -57,12 +57,12 @@ namespace Nz // Pour que le squelette soit correctement aligné, il faut appliquer un quaternion "de correction" aux joints à la base du squelette Quaternionf rotationQuat = Quaternionf::RotationBetween(Vector3f::UnitX(), Vector3f::Forward()) * - Quaternionf::RotationBetween(Vector3f::UnitZ(), Vector3f::Up()); + Quaternionf::RotationBetween(Vector3f::UnitZ(), Vector3f::Up()); - for (std::size_t i = 0; i < jointCount; ++i) + for (UInt32 i = 0; i < jointCount; ++i) { int parent = joints[i].parent; - for (std::size_t j = 0; j < frameCount; ++j) + for (UInt32 j = 0; j < frameCount; ++j) { SequenceJoint& sequenceJoint = sequenceJoints[j*jointCount + i]; diff --git a/src/Nazara/Utility/Formats/MD5AnimParser.cpp b/src/Nazara/Utility/Formats/MD5AnimParser.cpp index 105944858..a1b02153b 100644 --- a/src/Nazara/Utility/Formats/MD5AnimParser.cpp +++ b/src/Nazara/Utility/Formats/MD5AnimParser.cpp @@ -48,9 +48,9 @@ namespace Nz return Ternary_False; } - std::size_t MD5AnimParser::GetAnimatedComponentCount() const + UInt32 MD5AnimParser::GetAnimatedComponentCount() const { - return m_animatedComponents.size(); + return static_cast(m_animatedComponents.size()); } const MD5AnimParser::Frame* MD5AnimParser::GetFrames() const @@ -58,12 +58,12 @@ namespace Nz return m_frames.data(); } - std::size_t MD5AnimParser::GetFrameCount() const + UInt32 MD5AnimParser::GetFrameCount() const { - return m_frames.size(); + return static_cast(m_frames.size()); } - std::size_t MD5AnimParser::GetFrameRate() const + UInt32 MD5AnimParser::GetFrameRate() const { return m_frameRate; } @@ -73,9 +73,9 @@ namespace Nz return m_joints.data(); } - std::size_t MD5AnimParser::GetJointCount() const + UInt32 MD5AnimParser::GetJointCount() const { - return m_joints.size(); + return static_cast(m_joints.size()); } bool MD5AnimParser::Parse() @@ -209,14 +209,14 @@ namespace Nz } } - unsigned int frameCount = m_frames.size(); + std::size_t frameCount = m_frames.size(); if (frameCount == 0) { NazaraError("Frame count is invalid or missing"); return false; } - unsigned int jointCount = m_joints.size(); + std::size_t jointCount = m_joints.size(); if (jointCount == 0) { NazaraError("Joint count is invalid or missing"); @@ -273,21 +273,21 @@ namespace Nz bool MD5AnimParser::ParseBaseframe() { - unsigned int jointCount = m_joints.size(); + std::size_t jointCount = m_joints.size(); if (jointCount == 0) { Error("Joint count is invalid or missing"); return false; } - for (unsigned int i = 0; i < jointCount; ++i) + for (std::size_t i = 0; i < jointCount; ++i) { if (!Advance()) return false; // Space is important for the buffer of \n if (std::sscanf(&m_currentLine[0], " ( %f %f %f ) ( %f %f %f )", &m_joints[i].bindPos.x, &m_joints[i].bindPos.y, &m_joints[i].bindPos.z, - &m_joints[i].bindOrient.x, &m_joints[i].bindOrient.y, &m_joints[i].bindOrient.z) != 6) + &m_joints[i].bindOrient.x, &m_joints[i].bindOrient.y, &m_joints[i].bindOrient.z) != 6) { UnrecognizedLine(true); return false; @@ -312,14 +312,14 @@ namespace Nz bool MD5AnimParser::ParseBounds() { - unsigned int frameCount = m_frames.size(); + std::size_t frameCount = m_frames.size(); if (frameCount == 0) { Error("Frame count is invalid or missing"); return false; } - for (unsigned int i = 0; i < frameCount; ++i) + for (std::size_t i = 0; i < frameCount; ++i) { if (!Advance()) return false; @@ -353,14 +353,14 @@ namespace Nz bool MD5AnimParser::ParseFrame() { - unsigned int animatedComponentsCount = m_animatedComponents.size(); + std::size_t animatedComponentsCount = m_animatedComponents.size(); if (animatedComponentsCount == 0) { Error("Animated components count is missing or invalid"); return false; } - unsigned int jointCount = m_joints.size(); + std::size_t jointCount = m_joints.size(); if (jointCount == 0) { Error("Joint count is invalid or missing"); @@ -369,14 +369,14 @@ namespace Nz String line; - unsigned int count = 0; + std::size_t count = 0; do { if (!Advance()) return false; - unsigned int index = 0; - unsigned int size = m_currentLine.GetSize(); + std::size_t index = 0; + std::size_t size = m_currentLine.GetSize(); do { float f; @@ -399,11 +399,11 @@ namespace Nz m_frames[m_frameIndex].joints.resize(jointCount); - for (unsigned int i = 0; i < jointCount; ++i) + for (std::size_t i = 0; i < jointCount; ++i) { Quaternionf jointOrient = m_joints[i].bindOrient; Vector3f jointPos = m_joints[i].bindPos; - unsigned int j = 0; + UInt32 j = 0; if (m_joints[i].flags & 1) // Px jointPos.x = m_animatedComponents[m_joints[i].index + j++]; @@ -447,19 +447,19 @@ namespace Nz bool MD5AnimParser::ParseHierarchy() { - unsigned int jointCount = m_joints.size(); + std::size_t jointCount = m_joints.size(); if (jointCount == 0) { Error("Joint count is invalid or missing"); return false; } - for (unsigned int i = 0; i < jointCount; ++i) + for (std::size_t i = 0; i < jointCount; ++i) { if (!Advance()) return false; - unsigned int pos = m_currentLine.Find(' '); + std::size_t pos = m_currentLine.Find(' '); if (pos == String::npos) { UnrecognizedLine(true); @@ -482,10 +482,10 @@ namespace Nz m_joints[i].name = name; m_joints[i].name.Trim('"'); - int parent = m_joints[i].parent; + Int32 parent = m_joints[i].parent; if (parent >= 0) { - if (static_cast(parent) >= jointCount) + if (static_cast(parent) >= jointCount) { Error("Joint's parent is out of bounds (" + String::Number(parent) + " >= " + String::Number(jointCount) + ')'); return false; diff --git a/src/Nazara/Utility/Formats/MD5MeshLoader.cpp b/src/Nazara/Utility/Formats/MD5MeshLoader.cpp index cd8a6813a..59988405a 100644 --- a/src/Nazara/Utility/Formats/MD5MeshLoader.cpp +++ b/src/Nazara/Utility/Formats/MD5MeshLoader.cpp @@ -53,15 +53,15 @@ namespace Nz const MD5MeshParser::Joint* joints = parser.GetJoints(); const MD5MeshParser::Mesh* meshes = parser.GetMeshes(); - std::size_t jointCount = parser.GetJointCount(); - std::size_t meshCount = parser.GetMeshCount(); + UInt32 jointCount = parser.GetJointCount(); + UInt32 meshCount = parser.GetMeshCount(); if (parameters.animated) { mesh->CreateSkeletal(jointCount); Skeleton* skeleton = mesh->GetSkeleton(); - for (std::size_t i = 0; i < jointCount; ++i) + for (UInt32 i = 0; i < jointCount; ++i) { Joint* joint = skeleton->GetJoint(i); @@ -82,7 +82,7 @@ namespace Nz } mesh->SetMaterialCount(meshCount); - for (std::size_t i = 0; i < meshCount; ++i) + for (UInt32 i = 0; i < meshCount; ++i) { const MD5MeshParser::Mesh& md5Mesh = meshes[i]; @@ -100,7 +100,7 @@ namespace Nz // Le format définit un set de triangles nous permettant de retrouver facilement les indices // Cependant les sommets des triangles ne sont pas spécifiés dans le même ordre que ceux du moteur // (On parle ici de winding) - unsigned int index = 0; + UInt32 index = 0; for (const MD5MeshParser::Triangle& triangle : md5Mesh.triangles) { // On les respécifie dans le bon ordre (inversion du winding) @@ -227,7 +227,7 @@ namespace Nz } mesh->SetMaterialCount(meshCount); - for (std::size_t i = 0; i < meshCount; ++i) + for (UInt32 i = 0; i < meshCount; ++i) { const MD5MeshParser::Mesh& md5Mesh = meshes[i]; std::size_t indexCount = md5Mesh.triangles.size()*3; diff --git a/src/Nazara/Utility/Formats/MD5MeshParser.cpp b/src/Nazara/Utility/Formats/MD5MeshParser.cpp index b4fd04a33..ce5264d01 100644 --- a/src/Nazara/Utility/Formats/MD5MeshParser.cpp +++ b/src/Nazara/Utility/Formats/MD5MeshParser.cpp @@ -58,9 +58,9 @@ namespace Nz return m_joints.data(); } - std::size_t MD5MeshParser::GetJointCount() const + UInt32 MD5MeshParser::GetJointCount() const { - return m_joints.size(); + return static_cast(m_joints.size()); } const MD5MeshParser::Mesh* MD5MeshParser::GetMeshes() const @@ -68,9 +68,9 @@ namespace Nz return m_meshes.data(); } - std::size_t MD5MeshParser::GetMeshCount() const + UInt32 MD5MeshParser::GetMeshCount() const { - return m_meshes.size(); + return static_cast(m_meshes.size()); } bool MD5MeshParser::Parse() @@ -211,19 +211,19 @@ namespace Nz bool MD5MeshParser::ParseJoints() { - unsigned int jointCount = m_joints.size(); + std::size_t jointCount = m_joints.size(); if (jointCount == 0) { Error("Joint count is invalid or missing"); return false; } - for (unsigned int i = 0; i < jointCount; ++i) + for (std::size_t i = 0; i < jointCount; ++i) { if (!Advance()) return false; - unsigned int pos = m_currentLine.Find(' '); + std::size_t pos = m_currentLine.Find(' '); if (pos == String::npos) { UnrecognizedLine(true); @@ -248,10 +248,10 @@ namespace Nz m_joints[i].name = name; m_joints[i].name.Trim('"'); - int parent = m_joints[i].parent; + Int32 parent = m_joints[i].parent; if (parent >= 0) { - if (static_cast(parent) >= jointCount) + if (static_cast(parent) >= jointCount) { Error("Joint's parent is out of bounds (" + String::Number(parent) + " >= " + String::Number(jointCount) + ')'); return false; diff --git a/src/Nazara/Utility/Formats/MTLParser.cpp b/src/Nazara/Utility/Formats/MTLParser.cpp index 6685bcd04..b31ee24a9 100644 --- a/src/Nazara/Utility/Formats/MTLParser.cpp +++ b/src/Nazara/Utility/Formats/MTLParser.cpp @@ -160,7 +160,7 @@ namespace Nz } else if (keyword == "map_ka") { - unsigned int mapPos = m_currentLine.GetWordPosition(1); + std::size_t mapPos = m_currentLine.GetWordPosition(1); if (mapPos != String::npos) { String map = m_currentLine.SubString(mapPos); @@ -172,7 +172,7 @@ namespace Nz } else if (keyword == "map_kd") { - unsigned int mapPos = m_currentLine.GetWordPosition(1); + std::size_t mapPos = m_currentLine.GetWordPosition(1); if (mapPos != String::npos) { String map = m_currentLine.SubString(mapPos); @@ -184,7 +184,7 @@ namespace Nz } else if (keyword == "map_ks") { - unsigned int mapPos = m_currentLine.GetWordPosition(1); + std::size_t mapPos = m_currentLine.GetWordPosition(1); if (mapPos != String::npos) { String map = m_currentLine.SubString(mapPos); @@ -196,7 +196,7 @@ namespace Nz } else if (keyword == "map_bump" || keyword == "bump") { - unsigned int mapPos = m_currentLine.GetWordPosition(1); + std::size_t mapPos = m_currentLine.GetWordPosition(1); if (mapPos != String::npos) { String map = m_currentLine.SubString(mapPos); @@ -208,7 +208,7 @@ namespace Nz } else if (keyword == "map_d") { - unsigned int mapPos = m_currentLine.GetWordPosition(1); + std::size_t mapPos = m_currentLine.GetWordPosition(1); if (mapPos != String::npos) { String map = m_currentLine.SubString(mapPos); @@ -220,7 +220,7 @@ namespace Nz } else if (keyword == "map_decal" || keyword == "decal") { - unsigned int mapPos = m_currentLine.GetWordPosition(1); + std::size_t mapPos = m_currentLine.GetWordPosition(1); if (mapPos != String::npos) { String map = m_currentLine.SubString(mapPos); @@ -232,7 +232,7 @@ namespace Nz } else if (keyword == "map_disp" || keyword == "disp") { - unsigned int mapPos = m_currentLine.GetWordPosition(1); + std::size_t mapPos = m_currentLine.GetWordPosition(1); if (mapPos != String::npos) { String map = m_currentLine.SubString(mapPos); @@ -244,7 +244,7 @@ namespace Nz } else if (keyword == "map_refl" || keyword == "refl") { - unsigned int mapPos = m_currentLine.GetWordPosition(1); + std::size_t mapPos = m_currentLine.GetWordPosition(1); if (mapPos != String::npos) { String map = m_currentLine.SubString(mapPos); diff --git a/src/Nazara/Utility/Formats/OBJLoader.cpp b/src/Nazara/Utility/Formats/OBJLoader.cpp index 405c845ea..11029bada 100644 --- a/src/Nazara/Utility/Formats/OBJLoader.cpp +++ b/src/Nazara/Utility/Formats/OBJLoader.cpp @@ -40,7 +40,7 @@ namespace Nz return Ternary_Unknown; } - bool ParseMTL(Mesh* mesh, const String& filePath, const String* materials, const OBJParser::Mesh* meshes, unsigned int meshCount) + bool ParseMTL(Mesh* mesh, const String& filePath, const String* materials, const OBJParser::Mesh* meshes, UInt32 meshCount) { File file(filePath); if (!file.Open(OpenMode_ReadOnly | OpenMode_Text)) @@ -58,7 +58,7 @@ namespace Nz std::unordered_map materialCache; String baseDir = file.GetDirectory(); - for (unsigned int i = 0; i < meshCount; ++i) + for (UInt32 i = 0; i < meshCount; ++i) { const String& matName = materials[meshes[i].material]; const MTLParser::Material* mtlMat = materialParser.GetMaterial(matName); @@ -154,21 +154,21 @@ namespace Nz const Vector3f* texCoords = parser.GetTexCoords(); const OBJParser::Mesh* meshes = parser.GetMeshes(); - unsigned int meshCount = parser.GetMeshCount(); + UInt32 meshCount = parser.GetMeshCount(); NazaraAssert(materials != nullptr && positions != nullptr && normals != nullptr && texCoords != nullptr && meshes != nullptr && meshCount > 0, "Invalid OBJParser output"); // Un conteneur temporaire pour contenir les indices de face avant triangulation - std::vector faceIndices(3); // Comme il y aura au moins trois sommets - for (unsigned int i = 0; i < meshCount; ++i) + std::vector faceIndices(3); // Comme il y aura au moins trois sommets + for (UInt32 i = 0; i < meshCount; ++i) { - unsigned int faceCount = meshes[i].faces.size(); + std::size_t faceCount = meshes[i].faces.size(); if (faceCount == 0) continue; - std::vector indices; + std::vector indices; indices.reserve(faceCount*3); // Pire cas si les faces sont des triangles // Afin d'utiliser OBJParser::FaceVertex comme clé dans un unordered_map, @@ -205,10 +205,10 @@ namespace Nz unsigned int vertexCount = 0; for (unsigned int j = 0; j < faceCount; ++j) { - unsigned int faceVertexCount = meshes[i].faces[j].vertexCount; + UInt32 faceVertexCount = meshes[i].faces[j].vertexCount; faceIndices.resize(faceVertexCount); - for (unsigned int k = 0; k < faceVertexCount; ++k) + for (UInt32 k = 0; k < faceVertexCount; ++k) { const OBJParser::FaceVertex& vertex = meshes[i].vertices[meshes[i].faces[j].firstVertex + k]; @@ -220,7 +220,7 @@ namespace Nz } // Triangulation - for (unsigned int k = 1; k < faceVertexCount-1; ++k) + for (UInt32 k = 1; k < faceVertexCount-1; ++k) { indices.push_back(faceIndices[0]); indices.push_back(faceIndices[k]); @@ -234,7 +234,7 @@ namespace Nz // Remplissage des indices IndexMapper indexMapper(indexBuffer, BufferAccess_WriteOnly); - for (unsigned int j = 0; j < indices.size(); ++j) + for (std::size_t j = 0; j < indices.size(); ++j) indexMapper.Set(j, indices[j]); indexMapper.Unmap(); // Pour laisser les autres tâches affecter l'index buffer diff --git a/src/Nazara/Utility/Formats/OBJParser.cpp b/src/Nazara/Utility/Formats/OBJParser.cpp index e2b63b467..a520d6be1 100644 --- a/src/Nazara/Utility/Formats/OBJParser.cpp +++ b/src/Nazara/Utility/Formats/OBJParser.cpp @@ -13,7 +13,7 @@ namespace Nz { - bool OBJParser::Parse(Nz::Stream& stream, std::size_t reservedVertexCount) + bool OBJParser::Parse(Nz::Stream& stream, UInt32 reservedVertexCount) { m_currentStream = &stream; @@ -50,8 +50,8 @@ namespace Nz using MatPair = std::pair; std::unordered_map> meshesByName; - std::size_t faceReserve = 0; - std::size_t vertexReserve = 0; + UInt32 faceReserve = 0; + UInt32 vertexReserve = 0; unsigned int matCount = 0; auto GetMaterial = [&] (const String& meshName, const String& matName) -> Mesh* { @@ -79,16 +79,16 @@ namespace Nz { case '#': //< Comment // Some softwares write comments to gives the number of vertex/faces an importer can expect - std::size_t data; - if (std::sscanf(m_currentLine.GetConstBuffer(), "# position count: %zu", &data) == 1) + unsigned int data; + if (std::sscanf(m_currentLine.GetConstBuffer(), "# position count: %u", &data) == 1) m_positions.reserve(data); - else if (std::sscanf(m_currentLine.GetConstBuffer(), "# normal count: %zu", &data) == 1) + else if (std::sscanf(m_currentLine.GetConstBuffer(), "# normal count: %u", &data) == 1) m_normals.reserve(data); - else if (std::sscanf(m_currentLine.GetConstBuffer(), "# texcoords count: %zu", &data) == 1) + else if (std::sscanf(m_currentLine.GetConstBuffer(), "# texcoords count: %u", &data) == 1) m_texCoords.reserve(data); - else if (std::sscanf(m_currentLine.GetConstBuffer(), "# face count: %zu", &data) == 1) + else if (std::sscanf(m_currentLine.GetConstBuffer(), "# face count: %u", &data) == 1) faceReserve = data; - else if (std::sscanf(m_currentLine.GetConstBuffer(), "# vertex count: %zu", &data) == 1) + else if (std::sscanf(m_currentLine.GetConstBuffer(), "# vertex count: %u", &data) == 1) vertexReserve = data; break; @@ -118,8 +118,8 @@ namespace Nz currentMesh = GetMaterial(meshName, matName); Face face; - face.firstVertex = currentMesh->vertices.size(); - face.vertexCount = vertexCount; + face.firstVertex = static_cast(currentMesh->vertices.size()); + face.vertexCount = static_cast(vertexCount); currentMesh->vertices.resize(face.firstVertex + vertexCount, FaceVertex{0, 0, 0}); @@ -203,9 +203,9 @@ namespace Nz break; } - currentMesh->vertices[face.firstVertex + i].normal = static_cast(n); - currentMesh->vertices[face.firstVertex + i].position = static_cast(p); - currentMesh->vertices[face.firstVertex + i].texCoord = static_cast(t); + currentMesh->vertices[face.firstVertex + i].normal = static_cast(n); + currentMesh->vertices[face.firstVertex + i].position = static_cast(p); + currentMesh->vertices[face.firstVertex + i].texCoord = static_cast(t); pos += offset; } diff --git a/src/Nazara/Utility/Formats/OBJSaver.cpp b/src/Nazara/Utility/Formats/OBJSaver.cpp index a7a2cda0b..534eb1952 100644 --- a/src/Nazara/Utility/Formats/OBJSaver.cpp +++ b/src/Nazara/Utility/Formats/OBJSaver.cpp @@ -78,7 +78,7 @@ namespace Nz return false; } - std::size_t worstCacheVertexCount = mesh.GetVertexCount(); + UInt32 worstCacheVertexCount = mesh.GetVertexCount(); OBJParser objFormat; objFormat.SetNormalCount(worstCacheVertexCount); objFormat.SetPositionCount(worstCacheVertexCount); @@ -101,9 +101,9 @@ namespace Nz MTLParser mtlFormat; std::unordered_set registredMaterials; - std::size_t matCount = mesh.GetMaterialCount(); + UInt32 matCount = mesh.GetMaterialCount(); String* materialNames = objFormat.SetMaterialCount(matCount); - for (std::size_t i = 0; i < matCount; ++i) + for (UInt32 i = 0; i < matCount; ++i) { const ParameterList& matData = mesh.GetMaterialData(i); @@ -152,13 +152,13 @@ namespace Nz } // Meshes - std::size_t meshCount = mesh.GetSubMeshCount(); + UInt32 meshCount = mesh.GetSubMeshCount(); OBJParser::Mesh* meshes = objFormat.SetMeshCount(meshCount); - for (std::size_t i = 0; i < meshCount; ++i) + for (UInt32 i = 0; i < meshCount; ++i) { const StaticMesh* staticMesh = static_cast(mesh.GetSubMesh(i)); - std::size_t triangleCount = staticMesh->GetTriangleCount(); + UInt32 triangleCount = staticMesh->GetTriangleCount(); meshes[i].faces.resize(triangleCount); meshes[i].material = staticMesh->GetMaterialIndex(); @@ -180,7 +180,7 @@ namespace Nz face.firstVertex = faceIndex * 3; face.vertexCount = 3; - for (std::size_t j = 0; j < 3; ++j) + for (unsigned int j = 0; j < 3; ++j) { OBJParser::FaceVertex& vertexIndices = meshes[i].vertices[face.firstVertex + j]; diff --git a/src/Nazara/Utility/Mesh.cpp b/src/Nazara/Utility/Mesh.cpp index 84559abda..363be074d 100644 --- a/src/Nazara/Utility/Mesh.cpp +++ b/src/Nazara/Utility/Mesh.cpp @@ -55,7 +55,7 @@ namespace Nz materialData.resize(1); // Un matériau par défaut } - std::unordered_map subMeshMap; + std::unordered_map subMeshMap; std::vector materialData; std::vector subMeshes; AnimationType animationType; @@ -63,7 +63,7 @@ namespace Nz Skeleton skeleton; // Uniquement pour les meshs squelettiques String animationPath; bool aabbUpdated = false; - unsigned int jointCount; // Uniquement pour les meshs squelettiques + UInt32 jointCount; // Uniquement pour les meshs squelettiques }; Mesh::~Mesh() @@ -92,7 +92,7 @@ namespace Nz NazaraAssert(subMesh, "Invalid submesh"); NazaraAssert(subMesh->GetAnimationType() == m_impl->animationType, "Submesh animation type doesn't match mesh animation type"); - int index = m_impl->subMeshes.size(); + UInt32 index = m_impl->subMeshes.size(); m_impl->subMeshes.push_back(subMesh); m_impl->subMeshMap[identifier] = index; @@ -276,11 +276,11 @@ namespace Nz void Mesh::BuildSubMeshes(const PrimitiveList& list, const MeshParams& params) { - for (unsigned int i = 0; i < list.GetSize(); ++i) + for (UInt32 i = 0; i < list.GetSize(); ++i) BuildSubMesh(list.GetPrimitive(i), params); } - bool Mesh::CreateSkeletal(unsigned int jointCount) + bool Mesh::CreateSkeletal(UInt32 jointCount) { Destroy(); @@ -349,11 +349,11 @@ namespace Nz if (!m_impl->aabbUpdated) { - unsigned int subMeshCount = m_impl->subMeshes.size(); + UInt32 subMeshCount = m_impl->subMeshes.size(); if (subMeshCount > 0) { m_impl->aabb.Set(m_impl->subMeshes[0]->GetAABB()); - for (unsigned int i = 1; i < subMeshCount; ++i) + for (UInt32 i = 1; i < subMeshCount; ++i) m_impl->aabb.ExtendTo(m_impl->subMeshes[i]->GetAABB()); } else @@ -379,7 +379,7 @@ namespace Nz return m_impl->animationType; } - unsigned int Mesh::GetJointCount() const + UInt32 Mesh::GetJointCount() const { NazaraAssert(m_impl, "Mesh should be created first"); NazaraAssert(m_impl->animationType == AnimationType_Skeletal, "Mesh is not skeletal"); @@ -387,7 +387,7 @@ namespace Nz return m_impl->jointCount; } - ParameterList& Mesh::GetMaterialData(unsigned int index) + ParameterList& Mesh::GetMaterialData(UInt32 index) { NazaraAssert(m_impl, "Mesh should be created first"); NazaraAssert(index < m_impl->materialData.size(), "Material index out of range"); @@ -395,7 +395,7 @@ namespace Nz return m_impl->materialData[index]; } - const ParameterList& Mesh::GetMaterialData(unsigned int index) const + const ParameterList& Mesh::GetMaterialData(UInt32 index) const { NazaraAssert(m_impl, "Mesh should be created first"); NazaraAssert(index < m_impl->materialData.size(), "Material index out of range"); @@ -403,7 +403,7 @@ namespace Nz return m_impl->materialData[index]; } - unsigned int Mesh::GetMaterialCount() const + UInt32 Mesh::GetMaterialCount() const { NazaraAssert(m_impl, "Mesh should be created first"); @@ -436,7 +436,7 @@ namespace Nz return m_impl->subMeshes[it->second]; } - SubMesh* Mesh::GetSubMesh(unsigned int index) + SubMesh* Mesh::GetSubMesh(UInt32 index) { NazaraAssert(m_impl, "Mesh should be created first"); NazaraAssert(index < m_impl->subMeshes.size(), "Submesh index out of range"); @@ -454,7 +454,7 @@ namespace Nz return m_impl->subMeshes[it->second]; } - const SubMesh* Mesh::GetSubMesh(unsigned int index) const + const SubMesh* Mesh::GetSubMesh(UInt32 index) const { NazaraAssert(m_impl, "Mesh should be created first"); NazaraAssert(index < m_impl->subMeshes.size(), "Submesh index out of range"); @@ -462,14 +462,14 @@ namespace Nz return m_impl->subMeshes[index]; } - unsigned int Mesh::GetSubMeshCount() const + UInt32 Mesh::GetSubMeshCount() const { NazaraAssert(m_impl, "Mesh should be created first"); return m_impl->subMeshes.size(); } - int Mesh::GetSubMeshIndex(const String& identifier) const + UInt32 Mesh::GetSubMeshIndex(const String& identifier) const { NazaraAssert(m_impl, "Mesh should be created first"); @@ -479,22 +479,22 @@ namespace Nz return it->second; } - unsigned int Mesh::GetTriangleCount() const + UInt32 Mesh::GetTriangleCount() const { NazaraAssert(m_impl, "Mesh should be created first"); - unsigned int triangleCount = 0; + UInt32 triangleCount = 0; for (SubMesh* subMesh : m_impl->subMeshes) triangleCount += subMesh->GetTriangleCount(); return triangleCount; } - unsigned int Mesh::GetVertexCount() const + UInt32 Mesh::GetVertexCount() const { NazaraAssert(m_impl, "Mesh should be created first"); - unsigned int vertexCount = 0; + UInt32 vertexCount = 0; for (SubMesh* subMesh : m_impl->subMeshes) vertexCount += subMesh->GetVertexCount(); @@ -515,7 +515,7 @@ namespace Nz return m_impl->subMeshMap.find(identifier) != m_impl->subMeshMap.end(); } - bool Mesh::HasSubMesh(unsigned int index) const + bool Mesh::HasSubMesh(UInt32 index) const { NazaraAssert(m_impl, "Mesh should be created first"); @@ -564,8 +564,8 @@ namespace Nz BufferMapper mapper(staticMesh->GetVertexBuffer(), BufferAccess_ReadWrite); MeshVertex* vertices = static_cast(mapper.GetPointer()); - unsigned int vertexCount = staticMesh->GetVertexCount(); - for (unsigned int i = 0; i < vertexCount; ++i) + UInt32 vertexCount = staticMesh->GetVertexCount(); + for (UInt32 i = 0; i < vertexCount; ++i) { vertices->position -= center; vertices++; @@ -583,7 +583,7 @@ namespace Nz void Mesh::RemoveSubMesh(const String& identifier) { - unsigned int index = GetSubMeshIndex(identifier); + UInt32 index = GetSubMeshIndex(identifier); // On déplace l'itérateur du début d'une distance de x auto it2 = m_impl->subMeshes.begin(); @@ -593,7 +593,7 @@ namespace Nz InvalidateAABB(); } - void Mesh::RemoveSubMesh(unsigned int index) + void Mesh::RemoveSubMesh(UInt32 index) { NazaraAssert(m_impl, "Mesh should be created first"); NazaraAssert(index < m_impl->subMeshes.size(), "Submesh index out of range"); @@ -623,7 +623,7 @@ namespace Nz m_impl->animationPath = animationPath; } - void Mesh::SetMaterialData(unsigned int matIndex, ParameterList data) + void Mesh::SetMaterialData(UInt32 matIndex, ParameterList data) { NazaraAssert(m_impl, "Mesh should be created first"); NazaraAssert(matIndex < m_impl->materialData.size(), "Material index out of range"); @@ -631,7 +631,7 @@ namespace Nz m_impl->materialData[matIndex] = std::move(data); } - void Mesh::SetMaterialCount(unsigned int matCount) + void Mesh::SetMaterialCount(UInt32 matCount) { NazaraAssert(m_impl, "Mesh should be created first"); NazaraAssert(matCount > 0, "A mesh should have at least a material"); @@ -641,7 +641,7 @@ namespace Nz #ifdef NAZARA_DEBUG for (SubMesh* subMesh : m_impl->subMeshes) { - unsigned int matIndex = subMesh->GetMaterialIndex(); + UInt32 matIndex = subMesh->GetMaterialIndex(); if (matIndex >= matCount) { subMesh->SetMaterialIndex(0); // To prevent a crash @@ -665,8 +665,8 @@ namespace Nz Boxf aabb(vertices->position.x, vertices->position.y, vertices->position.z, 0.f, 0.f, 0.f); - unsigned int vertexCount = staticMesh->GetVertexCount(); - for (unsigned int i = 0; i < vertexCount; ++i) + UInt32 vertexCount = staticMesh->GetVertexCount(); + for (UInt32 i = 0; i < vertexCount; ++i) { vertices->position = matrix.Transform(vertices->position); aabb.ExtendTo(vertices->position); diff --git a/src/Nazara/Utility/Skeleton.cpp b/src/Nazara/Utility/Skeleton.cpp index ad5632b90..70f7adb07 100644 --- a/src/Nazara/Utility/Skeleton.cpp +++ b/src/Nazara/Utility/Skeleton.cpp @@ -10,7 +10,7 @@ namespace Nz { struct SkeletonImpl { - std::unordered_map jointMap; + std::unordered_map jointMap; std::vector joints; Boxf aabb; bool aabbUpdated = false; @@ -31,7 +31,7 @@ namespace Nz Destroy(); } - bool Skeleton::Create(unsigned int jointCount) + bool Skeleton::Create(UInt32 jointCount) { #if NAZARA_UTILITY_SAFE if (jointCount == 0) @@ -72,12 +72,12 @@ namespace Nz if (!m_impl->aabbUpdated) { - unsigned int jointCount = m_impl->joints.size(); + UInt32 jointCount = m_impl->joints.size(); if (jointCount > 0) { Vector3f pos = m_impl->joints[0].GetPosition(); m_impl->aabb.Set(pos.x, pos.y, pos.z, 0.f, 0.f, 0.f); - for (unsigned int i = 1; i < jointCount; ++i) + for (UInt32 i = 1; i < jointCount; ++i) m_impl->aabb.ExtendTo(m_impl->joints[i].GetPosition()); } else @@ -117,7 +117,7 @@ namespace Nz return &m_impl->joints[it->second]; } - Joint* Skeleton::GetJoint(unsigned int index) + Joint* Skeleton::GetJoint(UInt32 index) { #if NAZARA_UTILITY_SAFE if (!m_impl) @@ -164,7 +164,7 @@ namespace Nz return &m_impl->joints[it->second]; } - const Joint* Skeleton::GetJoint(unsigned int index) const + const Joint* Skeleton::GetJoint(UInt32 index) const { #if NAZARA_UTILITY_SAFE if (!m_impl) @@ -209,7 +209,7 @@ namespace Nz return &m_impl->joints[0]; } - unsigned int Skeleton::GetJointCount() const + UInt32 Skeleton::GetJointCount() const { #if NAZARA_UTILITY_SAFE if (!m_impl) @@ -278,13 +278,13 @@ namespace Nz Joint* jointsA = &skeletonA.m_impl->joints[0]; Joint* jointsB = &skeletonB.m_impl->joints[0]; - for (unsigned int i = 0; i < m_impl->joints.size(); ++i) + for (std::size_t i = 0; i < m_impl->joints.size(); ++i) m_impl->joints[i].Interpolate(jointsA[i], jointsB[i], interpolation, CoordSys_Local); InvalidateJoints(); } - void Skeleton::Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, unsigned int* indices, unsigned int indiceCount) + void Skeleton::Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, UInt32* indices, UInt32 indiceCount) { #if NAZARA_UTILITY_SAFE if (!m_impl) @@ -314,9 +314,9 @@ namespace Nz const Joint* jointsA = &skeletonA.m_impl->joints[0]; const Joint* jointsB = &skeletonB.m_impl->joints[0]; - for (unsigned int i = 0; i < indiceCount; ++i) + for (UInt32 i = 0; i < indiceCount; ++i) { - unsigned int index = indices[i]; + UInt32 index = indices[i]; #if NAZARA_UTILITY_SAFE if (index >= m_impl->joints.size()) @@ -351,16 +351,16 @@ namespace Nz m_impl->jointMapUpdated = skeleton.m_impl->jointMapUpdated; m_impl->joints = skeleton.m_impl->joints; - // Code crade mais son optimisation demanderait de stocker jointCount*sizeof(unsigned int) en plus + // Code crade mais son optimisation demanderait de stocker jointCount*sizeof(UInt32) en plus // Ce qui, pour juste une copie qui ne se fera que rarement, ne vaut pas le coup // L'éternel trade-off mémoire/calculs .. - unsigned int jointCount = skeleton.m_impl->joints.size(); - for (unsigned int i = 0; i < jointCount; ++i) + std::size_t jointCount = skeleton.m_impl->joints.size(); + for (std::size_t i = 0; i < jointCount; ++i) { const Node* parent = skeleton.m_impl->joints[i].GetParent(); if (parent) { - for (unsigned int j = 0; j < i; ++j) // Le parent se trouve forcément avant nous + for (std::size_t j = 0; j < i; ++j) // Le parent se trouve forcément avant nous { if (parent == &skeleton.m_impl->joints[j]) // A-t-on trouvé le parent ? { @@ -406,7 +406,7 @@ namespace Nz #endif m_impl->jointMap.clear(); - for (unsigned int i = 0; i < m_impl->joints.size(); ++i) + for (std::size_t i = 0; i < m_impl->joints.size(); ++i) { String name = m_impl->joints[i].GetName(); if (!name.IsEmpty()) diff --git a/src/Nazara/Utility/SubMesh.cpp b/src/Nazara/Utility/SubMesh.cpp index 8b0589808..c8da223f0 100644 --- a/src/Nazara/Utility/SubMesh.cpp +++ b/src/Nazara/Utility/SubMesh.cpp @@ -196,7 +196,7 @@ namespace Nz return 0; } - unsigned int SubMesh::GetMaterialIndex() const + UInt32 SubMesh::GetMaterialIndex() const { return m_matIndex; } @@ -206,7 +206,7 @@ namespace Nz m_primitiveMode = mode; } - void SubMesh::SetMaterialIndex(unsigned int matIndex) + void SubMesh::SetMaterialIndex(UInt32 matIndex) { m_matIndex = matIndex; } From 2674937384ae382110a2b26cbed023c0a2ffeb17 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 4 Sep 2016 20:40:02 +0200 Subject: [PATCH 72/74] Clean up some code Former-commit-id: 0bc6e1d237dfe261aa413d75f66da8a7cef01e79 [formerly bd0666073e7d9b9ec6228738741f7ce563c5f309] [formerly 0757422d16c83bfd7ff4b099beed99c68afd1fbb [formerly db0fa1476c93cbfe2ce5e76ffcb726812c338dcf]] Former-commit-id: bd671d7c3e5a0da5c9088baed015f6c8462892dd [formerly 324d8fe2327a2b508ba3dcd29ec9c7b8adc9c56c] Former-commit-id: ee42b1f6a136b99e954b38fe386d0faf24621efa --- include/Nazara/Physics/Geom.hpp | 2 +- src/Nazara/Network/Win32/IpAddressImpl.cpp | 2 +- src/Nazara/Physics/Geom.cpp | 21 +++++++-------------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/include/Nazara/Physics/Geom.hpp b/include/Nazara/Physics/Geom.hpp index 23a02c72b..e228c3d07 100644 --- a/include/Nazara/Physics/Geom.hpp +++ b/include/Nazara/Physics/Geom.hpp @@ -134,7 +134,7 @@ namespace Nz class NAZARA_PHYSICS_API CompoundGeom : public PhysGeom { public: - CompoundGeom(PhysGeom** geoms, unsigned int geomCount); + CompoundGeom(PhysGeom** geoms, std::size_t geomCount); const std::vector& GetGeoms() const; GeomType GetType() const override; diff --git a/src/Nazara/Network/Win32/IpAddressImpl.cpp b/src/Nazara/Network/Win32/IpAddressImpl.cpp index cbcebb83b..0097227ef 100644 --- a/src/Nazara/Network/Win32/IpAddressImpl.cpp +++ b/src/Nazara/Network/Win32/IpAddressImpl.cpp @@ -56,7 +56,7 @@ namespace Nz std::array hostnameBuffer; std::array serviceBuffer; - int result = getnameinfo(socketAddress, socketLen, hostnameBuffer.data(), static_cast(hostnameBuffer.size()), serviceBuffer.data(), static_cast(serviceBuffer.size()), flags); + int result = getnameinfo(socketAddress, socketLen, hostnameBuffer.data(), static_cast(hostnameBuffer.size()), serviceBuffer.data(), static_cast(serviceBuffer.size()), flags); if (result == 0) { if (hostname) diff --git a/src/Nazara/Physics/Geom.cpp b/src/Nazara/Physics/Geom.cpp index e814b8618..48d6f0090 100644 --- a/src/Nazara/Physics/Geom.cpp +++ b/src/Nazara/Physics/Geom.cpp @@ -125,16 +125,7 @@ namespace Nz PhysGeomRef PhysGeom::Build(const PrimitiveList& list) { - unsigned int primitiveCount = list.GetSize(); - - #if NAZARA_PHYSICS_SAFE - if (primitiveCount == 0) - { - NazaraError("PrimitiveList must have at least one primitive"); - return nullptr; - } - #endif - + std::size_t primitiveCount = list.GetSize(); if (primitiveCount > 1) { std::vector geoms(primitiveCount); @@ -144,8 +135,10 @@ namespace Nz return CompoundGeom::New(&geoms[0], primitiveCount); } - else + else if (primitiveCount > 0) return CreateGeomFromPrimitive(list.GetPrimitive(0)); + else + return NullGeom::New(); } bool PhysGeom::Initialize() @@ -246,10 +239,10 @@ namespace Nz /******************************* CompoundGeom ********************************/ - CompoundGeom::CompoundGeom(PhysGeom** geoms, unsigned int geomCount) + CompoundGeom::CompoundGeom(PhysGeom** geoms, std::size_t geomCount) { m_geoms.reserve(geomCount); - for (unsigned int i = 0; i < geomCount; ++i) + for (std::size_t i = 0; i < geomCount; ++i) m_geoms.emplace_back(geoms[i]); } @@ -349,7 +342,7 @@ namespace Nz NewtonCollision* ConvexHullGeom::CreateHandle(PhysWorld* world) const { - return NewtonCreateConvexHull(world->GetHandle(), m_vertices.size(), reinterpret_cast(m_vertices.data()), sizeof(Vector3f), m_tolerance, 0, m_matrix); + return NewtonCreateConvexHull(world->GetHandle(), static_cast(m_vertices.size()), reinterpret_cast(m_vertices.data()), sizeof(Vector3f), m_tolerance, 0, m_matrix); } /******************************* CylinderGeom ********************************/ From 4345d540bbc1d8d74556a6a6899bf7d7e0e15823 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 4 Sep 2016 21:00:23 +0200 Subject: [PATCH 73/74] Utility/OBJSaver: Remove some warnings Former-commit-id: c47426ecb066ecbe830e4cf6851a276745926b57 [formerly 47cf19babea78aa4d5b29b79a7c7d9941088b0bc] [formerly 0288f40d97b0f87d12eaf08e69a16ee7715b0762 [formerly 7b5b6e118e169b4ebfb8dde49bdb810a0f21eb1d]] Former-commit-id: bc9752730450af8e66d24274ae0bacd6217cee56 [formerly 202ce44372bee0be3078342cb0f4751a646539e3] Former-commit-id: cce7de20700fa56f008f510caad71e8adb53e82a --- include/Nazara/Core/Bitset.inl | 2 +- src/Nazara/Utility/Formats/OBJSaver.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/Nazara/Core/Bitset.inl b/include/Nazara/Core/Bitset.inl index 21457d7c7..d29315afd 100644 --- a/include/Nazara/Core/Bitset.inl +++ b/include/Nazara/Core/Bitset.inl @@ -121,7 +121,7 @@ namespace Nz if (sizeof(T) <= sizeof(Block)) { m_bitCount = std::numeric_limits::digits; - m_blocks.push_back(value); + m_blocks.push_back(static_cast(value)); } else { diff --git a/src/Nazara/Utility/Formats/OBJSaver.cpp b/src/Nazara/Utility/Formats/OBJSaver.cpp index 534eb1952..6ed15e717 100644 --- a/src/Nazara/Utility/Formats/OBJSaver.cpp +++ b/src/Nazara/Utility/Formats/OBJSaver.cpp @@ -35,12 +35,12 @@ namespace Nz { } - std::size_t GetCount() const + UInt32 GetCount() const { return m_count; } - std::size_t Insert(const T& data) + UInt32 Insert(const T& data) { auto it = m_cache.find(data); if (it == m_cache.end()) @@ -54,8 +54,8 @@ namespace Nz } private: - std::size_t m_count; - std::map m_cache; + UInt32 m_count; + std::map m_cache; T* m_buffer; }; @@ -172,7 +172,7 @@ namespace Nz SparsePtr positionPtr = vertexMapper.GetComponentPtr(VertexComponent_Position); SparsePtr texCoordsPtr = vertexMapper.GetComponentPtr(VertexComponent_TexCoord); - std::size_t faceIndex = 0; + UInt32 faceIndex = 0; TriangleIterator triangle(staticMesh); do { @@ -184,7 +184,7 @@ namespace Nz { OBJParser::FaceVertex& vertexIndices = meshes[i].vertices[face.firstVertex + j]; - std::size_t index = triangle[j]; + UInt32 index = triangle[j]; vertexIndices.normal = normalCache.Insert(normalPtr[index]); vertexIndices.position = positionCache.Insert(positionPtr[index]); vertexIndices.texCoord = texCoordsCache.Insert(texCoordsPtr[index]); From fda4877d1a3a1fed7075d6eececd0cd3cde0bee9 Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 6 Sep 2016 13:30:53 +0200 Subject: [PATCH 74/74] SDK/Binding: Fix compilation Former-commit-id: 60505c729d1495bd9055e2a9b4d423e10f5a95e5 [formerly d82a60a0788b574e801a5db5e2ea63e767b4ccfa] [formerly 008de73ef33c0be8a77ffeec85c0d4794ca4afee [formerly 8c92cdf09ec067f19aafebc00d3da1e2d671d37d]] Former-commit-id: a2470f3223dbc4a38a42d6bd77b7858b1ca59135 [formerly deb714657888d052465d632d7c46e4c1dc014404] Former-commit-id: 4a75b39c325313a6c26fa8282f4db17c816d94d5 --- SDK/src/NDK/LuaBinding_SDK.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDK/src/NDK/LuaBinding_SDK.cpp b/SDK/src/NDK/LuaBinding_SDK.cpp index 35c59ae68..1ccd16342 100644 --- a/SDK/src/NDK/LuaBinding_SDK.cpp +++ b/SDK/src/NDK/LuaBinding_SDK.cpp @@ -139,7 +139,7 @@ namespace Ndk #ifndef NDK_SERVER /*********************************** Ndk::GraphicsComponent **********************************/ - graphicsComponent.BindMethod("Attach", &GraphicsComponent::Attach, 0); + graphicsComponent.BindMethod("Attach", (void(Ndk::GraphicsComponent::*)(Nz::InstancedRenderableRef, int)) &GraphicsComponent::Attach, 0); #endif