diff --git a/.gitignore b/.gitignore index 3bfc4dcac..882d16beb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ build/config.lua # Nazara libraries lib/* +# Self-hosted thirdparty libraries binaries +thirdparty/genlib/* + # Nazara plugin libraries plugins/lib/* diff --git a/ChangeLog.md b/ChangeLog.md index 80276aa97..c87390157 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -9,6 +9,12 @@ Miscellaneous: - Updated stb_image to version 2.16 and stb_image_write to version 1.07 (allowing support for JPEG writing) - ⚠️ Renamed extlibs folder to thirdparty - Partial fix for Premake regenerating projects for no reason +- FirstScene now uses the EventHandler (#151) +- ⚠️ Rename Prerequesites.hpp to Prerequisites.hpp (#153) +- Updated premake5-linux64 with a nightly to fix a build error when a previous version of Nazara was installed on the system. +- Fix compilation with some MinGW distributions +- Add Lua unit tests +- NDEBUG is now defined in Release Nazara Engine: - VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned. @@ -53,6 +59,13 @@ Nazara Engine: - Fix OBJParser relative offsets handling - Add JPEG image saver - Update Constraint2Ds classes (Add : Ref, Library, ConstRef, New function and Update : ctors) +- Fix LuaClass not working correctly when Lua stack wasn't empty +- Add RigidBody2D simulation control (via EnableSimulation and IsSimulationEnabled), which allows to disable physics and collisions at will. +- ⚠️ LuaInstance no longer load all lua libraries on construction, this is done in the new LoadLibraries method which allows you to excludes some libraries +- Clock::Restart now returns the elapsed microseconds since construction or last Restart call +- Add PhysWorld2D::[Get|Set]IterationCount to control how many iterations chipmunk will perform per step. +- Add PhysWorld2D::UseSpatialHash to use spatial hashing instead of bounding box trees, which may speedup simulation in some cases. +- Add PhysWorld[2D|3D] max step count per Step call (default: 50), to avoid spirals of death when the physics engine simulation time is over step size. Nazara Development Kit: - Added ImageWidget (#139) @@ -84,6 +97,10 @@ Nazara Development Kit: - Fix PhysicsComponent3D copy which was not copying physics state (such as mass, mass center, damping values, gravity factor and auto-sleep mode) - Fix TextAreaWidget::Clear crash - Add ConstraintComponent2D class +- Fix CollisionComponent3D initialization (teleportation to their real coordinates) which could sometimes mess up the physics scene. +- ⚠️ Renamed World::Update() to World::Refresh() for more clarity and to differentiate it from World::Update(elapsedTime) +- World entity ids are now reused from lowest to highest (they were previously reused in reverse order of death) +- World now has an internal profiler, allowing to measure the refresh and system update time # 0.4: diff --git a/NazaraModuleTemplate/include/Nazara/ModuleName/ModuleName.hpp b/NazaraModuleTemplate/include/Nazara/ModuleName/ModuleName.hpp index 031f37d9a..c018f899f 100644 --- a/NazaraModuleTemplate/include/Nazara/ModuleName/ModuleName.hpp +++ b/NazaraModuleTemplate/include/Nazara/ModuleName/ModuleName.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MODULENAME_HPP #define NAZARA_MODULENAME_HPP -#include +#include #include #include diff --git a/SDK/include/NDK/Algorithm.hpp b/SDK/include/NDK/Algorithm.hpp index 9e29f53cf..21eefd68a 100644 --- a/SDK/include/NDK/Algorithm.hpp +++ b/SDK/include/NDK/Algorithm.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_ALGORITHM_HPP #define NDK_ALGORITHM_HPP -#include +#include namespace Ndk { diff --git a/SDK/include/NDK/Algorithm.inl b/SDK/include/NDK/Algorithm.inl index 39762243b..2f9c42a10 100644 --- a/SDK/include/NDK/Algorithm.inl +++ b/SDK/include/NDK/Algorithm.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/include/NDK/Application.hpp b/SDK/include/NDK/Application.hpp index 3b53488e4..401f80228 100644 --- a/SDK/include/NDK/Application.hpp +++ b/SDK/include/NDK/Application.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_APPLICATION_HPP #define NDK_APPLICATION_HPP -#include +#include #include #include #include diff --git a/SDK/include/NDK/Application.inl b/SDK/include/NDK/Application.inl index cf5160e2f..e01fb2ce4 100644 --- a/SDK/include/NDK/Application.inl +++ b/SDK/include/NDK/Application.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/BaseComponent.hpp b/SDK/include/NDK/BaseComponent.hpp index 696e43719..013fe255f 100644 --- a/SDK/include/NDK/BaseComponent.hpp +++ b/SDK/include/NDK/BaseComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/BaseComponent.inl b/SDK/include/NDK/BaseComponent.inl index 0e27c1731..a484a87df 100644 --- a/SDK/include/NDK/BaseComponent.inl +++ b/SDK/include/NDK/BaseComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/include/NDK/BaseSystem.hpp b/SDK/include/NDK/BaseSystem.hpp index 18cbef454..a3d967a9c 100644 --- a/SDK/include/NDK/BaseSystem.hpp +++ b/SDK/include/NDK/BaseSystem.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/BaseSystem.inl b/SDK/include/NDK/BaseSystem.inl index 560b06584..843448988 100644 --- a/SDK/include/NDK/BaseSystem.inl +++ b/SDK/include/NDK/BaseSystem.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include @@ -164,8 +164,10 @@ namespace Ndk } else { - OnUpdate(m_maxUpdateRate); - m_updateCounter -= m_maxUpdateRate; + float updateRate = std::max(elapsedTime, m_maxUpdateRate); + + OnUpdate(updateRate); + m_updateCounter -= updateRate; } } } diff --git a/SDK/include/NDK/BaseWidget.hpp b/SDK/include/NDK/BaseWidget.hpp index 175a1d71d..0804a5191 100644 --- a/SDK/include/NDK/BaseWidget.hpp +++ b/SDK/include/NDK/BaseWidget.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_BASEWIDGET_HPP #define NDK_BASEWIDGET_HPP -#include +#include #include #include #include diff --git a/SDK/include/NDK/BaseWidget.inl b/SDK/include/NDK/BaseWidget.inl index 948769890..6c7a0a3dd 100644 --- a/SDK/include/NDK/BaseWidget.inl +++ b/SDK/include/NDK/BaseWidget.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Canvas.hpp b/SDK/include/NDK/Canvas.hpp index 5735f1f94..f99900d30 100644 --- a/SDK/include/NDK/Canvas.hpp +++ b/SDK/include/NDK/Canvas.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_CANVAS_HPP #define NDK_CANVAS_HPP -#include +#include #include #include #include diff --git a/SDK/include/NDK/Canvas.inl b/SDK/include/NDK/Canvas.inl index f37132a51..251a09fbc 100644 --- a/SDK/include/NDK/Canvas.inl +++ b/SDK/include/NDK/Canvas.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Component.hpp b/SDK/include/NDK/Component.hpp index 14afd253b..a3bc1cac2 100644 --- a/SDK/include/NDK/Component.hpp +++ b/SDK/include/NDK/Component.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Component.inl b/SDK/include/NDK/Component.inl index a629dc8b4..e90cada8a 100644 --- a/SDK/include/NDK/Component.inl +++ b/SDK/include/NDK/Component.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Components/CameraComponent.hpp b/SDK/include/NDK/Components/CameraComponent.hpp index 2474a093e..e9a4de2da 100644 --- a/SDK/include/NDK/Components/CameraComponent.hpp +++ b/SDK/include/NDK/Components/CameraComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/CameraComponent.inl b/SDK/include/NDK/Components/CameraComponent.inl index 7d624f522..4baad5225 100644 --- a/SDK/include/NDK/Components/CameraComponent.inl +++ b/SDK/include/NDK/Components/CameraComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Components/CollisionComponent2D.hpp b/SDK/include/NDK/Components/CollisionComponent2D.hpp index 35247ead6..6908c2bef 100644 --- a/SDK/include/NDK/Components/CollisionComponent2D.hpp +++ b/SDK/include/NDK/Components/CollisionComponent2D.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/CollisionComponent2D.inl b/SDK/include/NDK/Components/CollisionComponent2D.inl index f3728de84..b85fe3017 100644 --- a/SDK/include/NDK/Components/CollisionComponent2D.inl +++ b/SDK/include/NDK/Components/CollisionComponent2D.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Components/CollisionComponent3D.hpp b/SDK/include/NDK/Components/CollisionComponent3D.hpp index f57464a79..5c14f2c70 100644 --- a/SDK/include/NDK/Components/CollisionComponent3D.hpp +++ b/SDK/include/NDK/Components/CollisionComponent3D.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/CollisionComponent3D.inl b/SDK/include/NDK/Components/CollisionComponent3D.inl index 69842c867..73225b262 100644 --- a/SDK/include/NDK/Components/CollisionComponent3D.inl +++ b/SDK/include/NDK/Components/CollisionComponent3D.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Components/GraphicsComponent.hpp b/SDK/include/NDK/Components/GraphicsComponent.hpp index b59ca2921..cd6b90c8c 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.hpp +++ b/SDK/include/NDK/Components/GraphicsComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index b8e438888..da8764d73 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Components/LightComponent.hpp b/SDK/include/NDK/Components/LightComponent.hpp index ba1c5f5c7..fcf59f179 100644 --- a/SDK/include/NDK/Components/LightComponent.hpp +++ b/SDK/include/NDK/Components/LightComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Jrme Leclercq // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/LightComponent.inl b/SDK/include/NDK/Components/LightComponent.inl index 10237b8ac..7ddb5d788 100644 --- a/SDK/include/NDK/Components/LightComponent.inl +++ b/SDK/include/NDK/Components/LightComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 Jrme Leclercq // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Components/ListenerComponent.hpp b/SDK/include/NDK/Components/ListenerComponent.hpp index 6e4b8284f..605f425a2 100644 --- a/SDK/include/NDK/Components/ListenerComponent.hpp +++ b/SDK/include/NDK/Components/ListenerComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/ListenerComponent.inl b/SDK/include/NDK/Components/ListenerComponent.inl index 8728ce9bc..52032dfb3 100644 --- a/SDK/include/NDK/Components/ListenerComponent.inl +++ b/SDK/include/NDK/Components/ListenerComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Components/NodeComponent.hpp b/SDK/include/NDK/Components/NodeComponent.hpp index a04f9b333..5661ab3ea 100644 --- a/SDK/include/NDK/Components/NodeComponent.hpp +++ b/SDK/include/NDK/Components/NodeComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/NodeComponent.inl b/SDK/include/NDK/Components/NodeComponent.inl index 0e953c86e..a7eb1f9bc 100644 --- a/SDK/include/NDK/Components/NodeComponent.inl +++ b/SDK/include/NDK/Components/NodeComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Components/ParticleEmitterComponent.hpp b/SDK/include/NDK/Components/ParticleEmitterComponent.hpp index d89d9114f..f50229ef5 100644 --- a/SDK/include/NDK/Components/ParticleEmitterComponent.hpp +++ b/SDK/include/NDK/Components/ParticleEmitterComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/ParticleEmitterComponent.inl b/SDK/include/NDK/Components/ParticleEmitterComponent.inl index 47c3602ab..dd60f1a88 100644 --- a/SDK/include/NDK/Components/ParticleEmitterComponent.inl +++ b/SDK/include/NDK/Components/ParticleEmitterComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.hpp b/SDK/include/NDK/Components/ParticleGroupComponent.hpp index 533eb907e..981dbd11e 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.hpp +++ b/SDK/include/NDK/Components/ParticleGroupComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.inl b/SDK/include/NDK/Components/ParticleGroupComponent.inl index afbfc15da..d6225df3b 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.inl +++ b/SDK/include/NDK/Components/ParticleGroupComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include @@ -49,7 +49,7 @@ namespace Ndk inline void ParticleGroupComponent::AddEmitter(Entity* emitter) { NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); - NazaraAssert(emitter->HasComponent(), "Entity must have a NodeComponent"); + NazaraAssert(emitter->HasComponent(), "Entity must have a ParticleEmitterComponent"); auto& emitterComponent = emitter->GetComponent(); ParticleGroup::AddEmitter(&emitterComponent); @@ -68,7 +68,7 @@ namespace Ndk inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter) { NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); - NazaraAssert(emitter->HasComponent(), "Entity must have a NodeComponent"); + NazaraAssert(emitter->HasComponent(), "Entity must have a ParticleEmitterComponent"); auto& emitterComponent = emitter->GetComponent(); ParticleGroup::RemoveEmitter(&emitterComponent); diff --git a/SDK/include/NDK/Components/PhysicsComponent2D.hpp b/SDK/include/NDK/Components/PhysicsComponent2D.hpp index 216e733b2..5c4081652 100644 --- a/SDK/include/NDK/Components/PhysicsComponent2D.hpp +++ b/SDK/include/NDK/Components/PhysicsComponent2D.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/PhysicsComponent2D.inl b/SDK/include/NDK/Components/PhysicsComponent2D.inl index 23ac0d5d3..03f98bf0b 100644 --- a/SDK/include/NDK/Components/PhysicsComponent2D.inl +++ b/SDK/include/NDK/Components/PhysicsComponent2D.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/include/NDK/Components/PhysicsComponent3D.hpp b/SDK/include/NDK/Components/PhysicsComponent3D.hpp index 397f13cc2..98e36079a 100644 --- a/SDK/include/NDK/Components/PhysicsComponent3D.hpp +++ b/SDK/include/NDK/Components/PhysicsComponent3D.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once @@ -54,6 +54,8 @@ namespace Ndk void SetLinearVelocity(const Nz::Vector3f& velocity); void SetMass(float mass); void SetMassCenter(const Nz::Vector3f& center); + void SetMaterial(const Nz::String& materialName); + void SetMaterial(int materialIndex); void SetPosition(const Nz::Vector3f& position); void SetRotation(const Nz::Quaternionf& rotation); diff --git a/SDK/include/NDK/Components/PhysicsComponent3D.inl b/SDK/include/NDK/Components/PhysicsComponent3D.inl index 65195a7f1..22123ca52 100644 --- a/SDK/include/NDK/Components/PhysicsComponent3D.inl +++ b/SDK/include/NDK/Components/PhysicsComponent3D.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include "PhysicsComponent3D.hpp" @@ -396,7 +396,6 @@ namespace Ndk * * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent3D::SetMassCenter(const Nz::Vector3f& center) { NazaraAssert(m_object, "Invalid physics object"); @@ -404,6 +403,34 @@ namespace Ndk m_object->SetMassCenter(center); } + /*! + * \brief Sets the material of the object, affecting how object does respond to collisions + * + * \param materialName Name of the material, previously registered to physics world + * + * \remark materialName must exists in PhysWorld before this call + */ + inline void PhysicsComponent3D::SetMaterial(const Nz::String& materialName) + { + NazaraAssert(m_object, "Invalid physics object"); + + m_object->SetMaterial(materialName); + } + + /*! + * \brief Sets the material of the object, affecting how object does respond to collisions + * + * \param materialIndex Id of the material, previously retrieved from a physics world + * + * \remark materialIndex must come from a call to in PhysWorld::CreateMaterial + */ + inline void PhysicsComponent3D::SetMaterial(int materialIndex) + { + NazaraAssert(m_object, "Invalid physics object"); + + m_object->SetMaterial(materialIndex); + } + /*! * \brief Sets the position of the physics object * diff --git a/SDK/include/NDK/Components/VelocityComponent.hpp b/SDK/include/NDK/Components/VelocityComponent.hpp index 39cdd9f1a..6497fd61a 100644 --- a/SDK/include/NDK/Components/VelocityComponent.hpp +++ b/SDK/include/NDK/Components/VelocityComponent.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Components/VelocityComponent.inl b/SDK/include/NDK/Components/VelocityComponent.inl index 052985ddf..3ca449132 100644 --- a/SDK/include/NDK/Components/VelocityComponent.inl +++ b/SDK/include/NDK/Components/VelocityComponent.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Console.hpp b/SDK/include/NDK/Console.hpp index afe4b156e..728cbcbb0 100644 --- a/SDK/include/NDK/Console.hpp +++ b/SDK/include/NDK/Console.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Console.inl b/SDK/include/NDK/Console.inl index fd461905f..746616ffd 100644 --- a/SDK/include/NDK/Console.inl +++ b/SDK/include/NDK/Console.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Entity.hpp b/SDK/include/NDK/Entity.hpp index 3f785fa76..2bf6b6dad 100644 --- a/SDK/include/NDK/Entity.hpp +++ b/SDK/include/NDK/Entity.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/SDK/include/NDK/Entity.inl b/SDK/include/NDK/Entity.inl index 06922097e..7b8fa5736 100644 --- a/SDK/include/NDK/Entity.inl +++ b/SDK/include/NDK/Entity.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/EntityList.hpp b/SDK/include/NDK/EntityList.hpp index 4620837a0..0f89d0cad 100644 --- a/SDK/include/NDK/EntityList.hpp +++ b/SDK/include/NDK/EntityList.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once @@ -8,7 +8,7 @@ #define NDK_ENTITYLIST_HPP #include -#include +#include #include namespace Ndk diff --git a/SDK/include/NDK/EntityList.inl b/SDK/include/NDK/EntityList.inl index a56eafa24..ce77c1238 100644 --- a/SDK/include/NDK/EntityList.inl +++ b/SDK/include/NDK/EntityList.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/EntityOwner.hpp b/SDK/include/NDK/EntityOwner.hpp index e007163b8..4dca6010c 100644 --- a/SDK/include/NDK/EntityOwner.hpp +++ b/SDK/include/NDK/EntityOwner.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/EntityOwner.inl b/SDK/include/NDK/EntityOwner.inl index 7a7c94815..a1e28bc2a 100644 --- a/SDK/include/NDK/EntityOwner.inl +++ b/SDK/include/NDK/EntityOwner.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Lua/LuaBinding.hpp b/SDK/include/NDK/Lua/LuaBinding.hpp index c93f21a42..2a14cb5a5 100644 --- a/SDK/include/NDK/Lua/LuaBinding.hpp +++ b/SDK/include/NDK/Lua/LuaBinding.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding.inl b/SDK/include/NDK/Lua/LuaBinding.inl index c7fb53ed4..95ea207ab 100644 --- a/SDK/include/NDK/Lua/LuaBinding.inl +++ b/SDK/include/NDK/Lua/LuaBinding.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Lua/LuaBinding_Audio.hpp b/SDK/include/NDK/Lua/LuaBinding_Audio.hpp index d842ecc9b..f2ee8c1ac 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Audio.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Audio.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding_Base.hpp b/SDK/include/NDK/Lua/LuaBinding_Base.hpp index 21d86f191..5a52e0bc2 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Base.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Base.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once @@ -9,7 +9,7 @@ #include #include -#include +#include namespace Ndk { diff --git a/SDK/include/NDK/Lua/LuaBinding_Core.hpp b/SDK/include/NDK/Lua/LuaBinding_Core.hpp index decca39fc..3149fdcc8 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Core.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Core.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding_Graphics.hpp b/SDK/include/NDK/Lua/LuaBinding_Graphics.hpp index cd71f0fc5..7a804dd0f 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Graphics.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Graphics.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding_Math.hpp b/SDK/include/NDK/Lua/LuaBinding_Math.hpp index 386912bab..5849a7c33 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Math.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Math.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding_Network.hpp b/SDK/include/NDK/Lua/LuaBinding_Network.hpp index daee2b224..1b7f32f27 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Network.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Network.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding_Platform.hpp b/SDK/include/NDK/Lua/LuaBinding_Platform.hpp index 502a443a5..2d28841e7 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Platform.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Platform.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding_Renderer.hpp b/SDK/include/NDK/Lua/LuaBinding_Renderer.hpp index af1ffeaa5..daa75e4af 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Renderer.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Renderer.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding_SDK.hpp b/SDK/include/NDK/Lua/LuaBinding_SDK.hpp index 18cbe96c2..a663edce4 100644 --- a/SDK/include/NDK/Lua/LuaBinding_SDK.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_SDK.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Lua/LuaBinding_Utility.hpp b/SDK/include/NDK/Lua/LuaBinding_Utility.hpp index 33f19184d..6f7fde64b 100644 --- a/SDK/include/NDK/Lua/LuaBinding_Utility.hpp +++ b/SDK/include/NDK/Lua/LuaBinding_Utility.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/LuaAPI.hpp b/SDK/include/NDK/LuaAPI.hpp index d3e755fc6..457ffb980 100644 --- a/SDK/include/NDK/LuaAPI.hpp +++ b/SDK/include/NDK/LuaAPI.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_LUAINTERFACE_HPP #define NDK_LUAINTERFACE_HPP -#include +#include namespace Nz { diff --git a/SDK/include/NDK/LuaAPI.inl b/SDK/include/NDK/LuaAPI.inl index 3eee85bc1..318bb6add 100644 --- a/SDK/include/NDK/LuaAPI.inl +++ b/SDK/include/NDK/LuaAPI.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Prerequesites.hpp b/SDK/include/NDK/Prerequisites.hpp similarity index 93% rename from SDK/include/NDK/Prerequesites.hpp rename to SDK/include/NDK/Prerequisites.hpp index f1ff2757a..bff15d808 100644 --- a/SDK/include/NDK/Prerequesites.hpp +++ b/SDK/include/NDK/Prerequisites.hpp @@ -22,15 +22,15 @@ SOFTWARE. */ -#ifndef NDK_PREREQUESITES_HPP -#define NDK_PREREQUESITES_HPP +#ifndef NDK_PREREQUISITES_HPP +#define NDK_PREREQUISITES_HPP /*! * \defgroup NDK (NazaraSDK) Nazara Development Kit * A library grouping every modules of Nazara into multiple higher-level features suchs as scene management (handled by an ECS), application, lua binding, etc. */ -#include +#include // Importation/Exportation of the API #if defined(NAZARA_STATIC) @@ -51,4 +51,4 @@ namespace Ndk using SystemIndex = Nz::UInt32; } -#endif // NDK_PREREQUESITES_HPP +#endif // NDK_PREREQUISITES_HPP diff --git a/SDK/include/NDK/Sdk.hpp b/SDK/include/NDK/Sdk.hpp index 5b976d1eb..7b096c583 100644 --- a/SDK/include/NDK/Sdk.hpp +++ b/SDK/include/NDK/Sdk.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_SDK_HPP #define NDK_SDK_HPP -#include +#include namespace Ndk { diff --git a/SDK/include/NDK/Sdk.inl b/SDK/include/NDK/Sdk.inl index de2bb8043..6c8a860e3 100644 --- a/SDK/include/NDK/Sdk.inl +++ b/SDK/include/NDK/Sdk.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/State.hpp b/SDK/include/NDK/State.hpp index cc8155ccf..3b3664218 100644 --- a/SDK/include/NDK/State.hpp +++ b/SDK/include/NDK/State.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 Jrme Leclercq // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_STATE_HPP #define NDK_STATE_HPP -#include +#include namespace Ndk { diff --git a/SDK/include/NDK/StateMachine.hpp b/SDK/include/NDK/StateMachine.hpp index 830391e55..57398a619 100644 --- a/SDK/include/NDK/StateMachine.hpp +++ b/SDK/include/NDK/StateMachine.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_STATEMACHINE_HPP #define NDK_STATEMACHINE_HPP -#include +#include #include #include #include diff --git a/SDK/include/NDK/StateMachine.inl b/SDK/include/NDK/StateMachine.inl index cfc021233..1b2a625ab 100644 --- a/SDK/include/NDK/StateMachine.inl +++ b/SDK/include/NDK/StateMachine.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/System.hpp b/SDK/include/NDK/System.hpp index b828d1fcb..d1b3cc39e 100644 --- a/SDK/include/NDK/System.hpp +++ b/SDK/include/NDK/System.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/System.inl b/SDK/include/NDK/System.inl index 65bbe0907..3902205c0 100644 --- a/SDK/include/NDK/System.inl +++ b/SDK/include/NDK/System.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/include/NDK/Systems/ListenerSystem.hpp b/SDK/include/NDK/Systems/ListenerSystem.hpp index 290700284..fce5e8cae 100644 --- a/SDK/include/NDK/Systems/ListenerSystem.hpp +++ b/SDK/include/NDK/Systems/ListenerSystem.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Systems/ListenerSystem.inl b/SDK/include/NDK/Systems/ListenerSystem.inl index e555b080e..5302ce8d0 100644 --- a/SDK/include/NDK/Systems/ListenerSystem.inl +++ b/SDK/include/NDK/Systems/ListenerSystem.inl @@ -1,3 +1,3 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp diff --git a/SDK/include/NDK/Systems/ParticleSystem.hpp b/SDK/include/NDK/Systems/ParticleSystem.hpp index 950ec80c9..adbfc7e39 100644 --- a/SDK/include/NDK/Systems/ParticleSystem.hpp +++ b/SDK/include/NDK/Systems/ParticleSystem.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Systems/ParticleSystem.inl b/SDK/include/NDK/Systems/ParticleSystem.inl index e555b080e..5302ce8d0 100644 --- a/SDK/include/NDK/Systems/ParticleSystem.inl +++ b/SDK/include/NDK/Systems/ParticleSystem.inl @@ -1,3 +1,3 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp diff --git a/SDK/include/NDK/Systems/PhysicsSystem2D.hpp b/SDK/include/NDK/Systems/PhysicsSystem2D.hpp index a117abaee..66c8b1c61 100644 --- a/SDK/include/NDK/Systems/PhysicsSystem2D.hpp +++ b/SDK/include/NDK/Systems/PhysicsSystem2D.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Systems/PhysicsSystem2D.inl b/SDK/include/NDK/Systems/PhysicsSystem2D.inl index 1199d8830..5f0755cff 100644 --- a/SDK/include/NDK/Systems/PhysicsSystem2D.inl +++ b/SDK/include/NDK/Systems/PhysicsSystem2D.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Systems/PhysicsSystem3D.hpp b/SDK/include/NDK/Systems/PhysicsSystem3D.hpp index 9d653695a..07e4c7220 100644 --- a/SDK/include/NDK/Systems/PhysicsSystem3D.hpp +++ b/SDK/include/NDK/Systems/PhysicsSystem3D.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once @@ -18,7 +18,6 @@ namespace Ndk { public: PhysicsSystem3D(); - PhysicsSystem3D(const PhysicsSystem3D& system); ~PhysicsSystem3D() = default; Nz::PhysWorld3D& GetWorld(); diff --git a/SDK/include/NDK/Systems/PhysicsSystem3D.inl b/SDK/include/NDK/Systems/PhysicsSystem3D.inl index 3ea4b6be2..70d41b104 100644 --- a/SDK/include/NDK/Systems/PhysicsSystem3D.inl +++ b/SDK/include/NDK/Systems/PhysicsSystem3D.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Systems/RenderSystem.hpp b/SDK/include/NDK/Systems/RenderSystem.hpp index 4ed015365..1cfa1eabf 100644 --- a/SDK/include/NDK/Systems/RenderSystem.hpp +++ b/SDK/include/NDK/Systems/RenderSystem.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Systems/RenderSystem.inl b/SDK/include/NDK/Systems/RenderSystem.inl index aa5c6bdae..7018ceef2 100644 --- a/SDK/include/NDK/Systems/RenderSystem.inl +++ b/SDK/include/NDK/Systems/RenderSystem.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Systems/VelocitySystem.hpp b/SDK/include/NDK/Systems/VelocitySystem.hpp index d46eb7678..7bc836d90 100644 --- a/SDK/include/NDK/Systems/VelocitySystem.hpp +++ b/SDK/include/NDK/Systems/VelocitySystem.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Systems/VelocitySystem.inl b/SDK/include/NDK/Systems/VelocitySystem.inl index e555b080e..5302ce8d0 100644 --- a/SDK/include/NDK/Systems/VelocitySystem.inl +++ b/SDK/include/NDK/Systems/VelocitySystem.inl @@ -1,3 +1,3 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp diff --git a/SDK/include/NDK/Widgets/ButtonWidget.hpp b/SDK/include/NDK/Widgets/ButtonWidget.hpp index 6214c8599..12fc12762 100644 --- a/SDK/include/NDK/Widgets/ButtonWidget.hpp +++ b/SDK/include/NDK/Widgets/ButtonWidget.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_WIDGETS_BUTTONWIDGET_HPP #define NDK_WIDGETS_BUTTONWIDGET_HPP -#include +#include #include #include #include diff --git a/SDK/include/NDK/Widgets/ButtonWidget.inl b/SDK/include/NDK/Widgets/ButtonWidget.inl index 68df431bd..757b33ab2 100644 --- a/SDK/include/NDK/Widgets/ButtonWidget.inl +++ b/SDK/include/NDK/Widgets/ButtonWidget.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/include/NDK/Widgets/CheckboxWidget.hpp b/SDK/include/NDK/Widgets/CheckboxWidget.hpp index 1659199d6..c938740e4 100644 --- a/SDK/include/NDK/Widgets/CheckboxWidget.hpp +++ b/SDK/include/NDK/Widgets/CheckboxWidget.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_WIDGETS_CHECKBOXWIDGET_HPP #define NDK_WIDGETS_CHECKBOXWIDGET_HPP -#include +#include #include #include #include diff --git a/SDK/include/NDK/Widgets/CheckboxWidget.inl b/SDK/include/NDK/Widgets/CheckboxWidget.inl index cb20a1c0c..3b4823fde 100644 --- a/SDK/include/NDK/Widgets/CheckboxWidget.inl +++ b/SDK/include/NDK/Widgets/CheckboxWidget.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Widgets/Enums.hpp b/SDK/include/NDK/Widgets/Enums.hpp index 93e51c018..111ee43db 100644 --- a/SDK/include/NDK/Widgets/Enums.hpp +++ b/SDK/include/NDK/Widgets/Enums.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Widgets/ImageWidget.hpp b/SDK/include/NDK/Widgets/ImageWidget.hpp index 7fe59c9f2..51fe4de87 100644 --- a/SDK/include/NDK/Widgets/ImageWidget.hpp +++ b/SDK/include/NDK/Widgets/ImageWidget.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_WIDGETS_IMAGEWIDGET_HPP #define NDK_WIDGETS_IMAGEWIDGET_HPP -#include +#include #include #include #include diff --git a/SDK/include/NDK/Widgets/ImageWidget.inl b/SDK/include/NDK/Widgets/ImageWidget.inl index 05c530f83..1ba13d525 100644 --- a/SDK/include/NDK/Widgets/ImageWidget.inl +++ b/SDK/include/NDK/Widgets/ImageWidget.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/include/NDK/Widgets/LabelWidget.hpp b/SDK/include/NDK/Widgets/LabelWidget.hpp index afad46f3c..5cb01b92a 100644 --- a/SDK/include/NDK/Widgets/LabelWidget.hpp +++ b/SDK/include/NDK/Widgets/LabelWidget.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_WIDGETS_LABELWIDGET_HPP #define NDK_WIDGETS_LABELWIDGET_HPP -#include +#include #include #include diff --git a/SDK/include/NDK/Widgets/LabelWidget.inl b/SDK/include/NDK/Widgets/LabelWidget.inl index a2d5d891f..72d0ad1a6 100644 --- a/SDK/include/NDK/Widgets/LabelWidget.inl +++ b/SDK/include/NDK/Widgets/LabelWidget.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/include/NDK/Widgets/ProgressBarWidget.hpp b/SDK/include/NDK/Widgets/ProgressBarWidget.hpp index f8399ca6c..2faa8093d 100644 --- a/SDK/include/NDK/Widgets/ProgressBarWidget.hpp +++ b/SDK/include/NDK/Widgets/ProgressBarWidget.hpp @@ -1,13 +1,13 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_WIDGETS_PROGRESSBARWIDGET_HPP #define NDK_WIDGETS_PROGRESSBARWIDGET_HPP -#include +#include #include #include #include diff --git a/SDK/include/NDK/Widgets/ProgressBarWidget.inl b/SDK/include/NDK/Widgets/ProgressBarWidget.inl index 325149af9..a90641203 100644 --- a/SDK/include/NDK/Widgets/ProgressBarWidget.inl +++ b/SDK/include/NDK/Widgets/ProgressBarWidget.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp namespace Ndk { diff --git a/SDK/include/NDK/Widgets/TextAreaWidget.hpp b/SDK/include/NDK/Widgets/TextAreaWidget.hpp index 300cc2196..e0f08053e 100644 --- a/SDK/include/NDK/Widgets/TextAreaWidget.hpp +++ b/SDK/include/NDK/Widgets/TextAreaWidget.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/SDK/include/NDK/Widgets/TextAreaWidget.inl b/SDK/include/NDK/Widgets/TextAreaWidget.inl index e66d062ae..07daf7896 100644 --- a/SDK/include/NDK/Widgets/TextAreaWidget.inl +++ b/SDK/include/NDK/Widgets/TextAreaWidget.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/include/NDK/World.hpp b/SDK/include/NDK/World.hpp index 9cc6d8901..8a0fe2648 100644 --- a/SDK/include/NDK/World.hpp +++ b/SDK/include/NDK/World.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once @@ -29,6 +29,7 @@ namespace Ndk public: using EntityVector = std::vector; + struct ProfilerData; inline World(bool addDefaultSystems = true); World(const World&) = delete; @@ -46,8 +47,12 @@ namespace Ndk void Clear() noexcept; const EntityHandle& CloneEntity(EntityId id); + inline void DisableProfiler(); + inline void EnableProfiler(bool enable = true); + inline const EntityHandle& GetEntity(EntityId id); inline const EntityList& GetEntities() const; + inline const ProfilerData& GetProfilerData() const; inline BaseSystem& GetSystem(SystemIndex index); template SystemType& GetSystem(); @@ -59,17 +64,27 @@ namespace Ndk inline bool IsEntityValid(const Entity* entity) const; inline bool IsEntityIdValid(EntityId id) const; + inline bool IsProfilerEnabled() const; + + void Refresh(); inline void RemoveAllSystems(); inline void RemoveSystem(SystemIndex index); template void RemoveSystem(); + inline void ResetProfiler(); - void Update(); - inline void Update(float elapsedTime); + void Update(float elapsedTime); World& operator=(const World&) = delete; inline World& operator=(World&& world) noexcept; + struct ProfilerData + { + Nz::UInt64 refreshTime = 0; + std::vector updateTime; + std::size_t updateCount = 0; + }; + private: inline void Invalidate(); inline void Invalidate(EntityId id); @@ -95,11 +110,13 @@ namespace Ndk std::vector m_entities; std::vector m_entityBlocks; std::vector> m_waitingEntities; - std::vector m_freeIdList; EntityList m_aliveEntities; + ProfilerData m_profilerData; Nz::Bitset m_dirtyEntities; + Nz::Bitset m_freeEntityIds; Nz::Bitset m_killedEntities; bool m_orderedSystemsUpdated; + bool m_isProfilerEnabled; }; } diff --git a/SDK/include/NDK/World.inl b/SDK/include/NDK/World.inl index 88e33ec1d..32903502d 100644 --- a/SDK/include/NDK/World.inl +++ b/SDK/include/NDK/World.inl @@ -1,7 +1,8 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp +#include #include #include @@ -13,7 +14,9 @@ namespace Ndk * \param addDefaultSystems Should default provided systems be used */ - inline World::World(bool addDefaultSystems) + inline World::World(bool addDefaultSystems) : + m_orderedSystemsUpdated(false), + m_isProfilerEnabled(false) { if (addDefaultSystems) AddDefaultSystems(); @@ -46,7 +49,10 @@ namespace Ndk // We must ensure that the vector is big enough to hold the new system if (index >= m_systems.size()) + { m_systems.resize(index + 1); + m_profilerData.updateTime.resize(index + 1, 0); + } // Affectation and return of system m_systems[index] = std::move(system); @@ -81,7 +87,6 @@ namespace Ndk * * \param count Number of entities to create */ - inline World::EntityVector World::CreateEntities(unsigned int count) { EntityVector list; @@ -93,16 +98,79 @@ namespace Ndk return list; } + /*! + * \brief Disables the profiler, clearing up results + * + * This is just a shortcut to EnableProfiler(false) + * + * \param enable Should the entity be enabled + * + * \see EnableProfiler + */ + inline void World::DisableProfiler() + { + EnableProfiler(false); + } + + /*! + * \brief Enables/Disables the internal profiler + * + * Worlds come with a built-in profiler, allowing to measure update count along with time passed in refresh and system updates. + * This is disabled by default as it adds an small overhead to the update process. + * + * \param enable Should the profiler be enabled + * + * \remark Disabling the profiler clears up results, as if ResetProfiler has been called + */ + inline void World::EnableProfiler(bool enable) + { + if (m_isProfilerEnabled != enable) + { + m_isProfilerEnabled = enable; + + if (enable) + ResetProfiler(); + } + } + + /*! + * \brief Gets an entity + * \return A constant reference to a handle of the entity + * + * \param id Identifier of the entity + * + * \remark Handle referenced by this function can move in memory when updating the world, do not keep a handle reference from a world update to another + * \remark If an invalid identifier is provided, an error got triggered and an invalid handle is returned + */ + inline const EntityHandle& World::GetEntity(EntityId id) + { + if (IsEntityIdValid(id)) + return m_entityBlocks[id]->handle; + else + { + NazaraError("Invalid ID"); + return EntityHandle::InvalidHandle; + } + } + /*! * \brief Gets every entities in the world * \return A constant reference to the entities */ - inline const EntityList& World::GetEntities() const { return m_aliveEntities; } + /*! + * \brief Gets the latest profiler data + * \return A constant reference to the profiler data + */ + inline const World::ProfilerData& World::GetProfilerData() const + { + return m_profilerData; + } + /*! * \brief Gets a system in the world by index * \return A reference to the system @@ -191,26 +259,6 @@ namespace Ndk KillEntity(entity); } - /*! - * \brief Gets an entity - * \return A constant reference to a handle of the entity - * - * \param id Identifier of the entity - * - * \remark Handle referenced by this function can move in memory when updating the world, do not keep a handle reference from a world update to another - * \remark If an invalid identifier is provided, an error got triggered and an invalid handle is returned - */ - inline const EntityHandle& World::GetEntity(EntityId id) - { - if (IsEntityIdValid(id)) - return m_entityBlocks[id]->handle; - else - { - NazaraError("Invalid ID"); - return EntityHandle::InvalidHandle; - } - } - /*! * \brief Checks whether or not an entity is valid * \return true If it is the case @@ -229,12 +277,22 @@ namespace Ndk * * \param id Identifier of the entity */ - inline bool World::IsEntityIdValid(EntityId id) const { return id < m_entityBlocks.size() && m_entityBlocks[id]->entity.IsValid(); } + /*! + * \brief Checks whether or not the profiler is enabled + * \return true If it is the case + * + * \see EnableProfiler + */ + inline bool World::IsProfilerEnabled() const + { + return m_isProfilerEnabled; + } + /*! * \brief Removes each system from the world */ @@ -264,10 +322,21 @@ namespace Ndk } } + /*! + * \brief Clear profiler results + * + * This reset the profiler results, filling all counters with zero + */ + inline void World::ResetProfiler() + { + m_profilerData.refreshTime = 0; + m_profilerData.updateCount = 0; + std::fill(m_profilerData.updateTime.begin(), m_profilerData.updateTime.end(), 0); + } + /*! * \brief Removes a system from the world by type */ - template void World::RemoveSystem() { @@ -277,21 +346,6 @@ 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 - - // And then update systems - for (auto& systemPtr : m_orderedSystems) - systemPtr->Update(elapsedTime); - } - /*! * \brief Moves a world into another world object * \return A reference to the object @@ -302,10 +356,12 @@ namespace Ndk m_aliveEntities = std::move(world.m_aliveEntities); m_dirtyEntities = std::move(world.m_dirtyEntities); m_entityBlocks = std::move(world.m_entityBlocks); - m_freeIdList = std::move(world.m_freeIdList); + m_freeEntityIds = std::move(world.m_freeEntityIds); m_killedEntities = std::move(world.m_killedEntities); m_orderedSystems = std::move(world.m_orderedSystems); m_orderedSystemsUpdated = world.m_orderedSystemsUpdated; + m_profilerData = std::move(world.m_profilerData); + m_isProfilerEnabled = m_isProfilerEnabled; m_entities = std::move(world.m_entities); for (EntityBlock& block : m_entities) diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index e9b866d4e..a4fca055a 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include @@ -107,8 +107,7 @@ namespace Ndk if (m_shouldQuit) return false; - m_updateTime = m_updateClock.GetSeconds(); - m_updateClock.Restart(); + m_updateTime = m_updateClock.Restart() / 1'000'000.f; for (World& world : m_worlds) world.Update(m_updateTime); @@ -165,6 +164,7 @@ namespace Ndk consoleRef.AddLine(str); }); + overlay->lua.LoadLibraries(); LuaAPI::RegisterClasses(overlay->lua); // Override "print" function to add a line in the console diff --git a/SDK/src/NDK/BaseComponent.cpp b/SDK/src/NDK/BaseComponent.cpp index 36d726adf..5092b9b65 100644 --- a/SDK/src/NDK/BaseComponent.cpp +++ b/SDK/src/NDK/BaseComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/src/NDK/BaseSystem.cpp b/SDK/src/NDK/BaseSystem.cpp index c7e6c8741..11a8e1926 100644 --- a/SDK/src/NDK/BaseSystem.cpp +++ b/SDK/src/NDK/BaseSystem.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/BaseWidget.cpp b/SDK/src/NDK/BaseWidget.cpp index ff38e6f34..d8aa9fbfa 100644 --- a/SDK/src/NDK/BaseWidget.cpp +++ b/SDK/src/NDK/BaseWidget.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Canvas.cpp b/SDK/src/NDK/Canvas.cpp index 32f02d5c5..9a5996432 100644 --- a/SDK/src/NDK/Canvas.cpp +++ b/SDK/src/NDK/Canvas.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Components/CameraComponent.cpp b/SDK/src/NDK/Components/CameraComponent.cpp index 58523bcea..a688a0ca5 100644 --- a/SDK/src/NDK/Components/CameraComponent.cpp +++ b/SDK/src/NDK/Components/CameraComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Components/CollisionComponent2D.cpp b/SDK/src/NDK/Components/CollisionComponent2D.cpp index 96e2116da..2fe1c8b22 100644 --- a/SDK/src/NDK/Components/CollisionComponent2D.cpp +++ b/SDK/src/NDK/Components/CollisionComponent2D.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Components/CollisionComponent3D.cpp b/SDK/src/NDK/Components/CollisionComponent3D.cpp index 69ab957c3..a147043d7 100644 --- a/SDK/src/NDK/Components/CollisionComponent3D.cpp +++ b/SDK/src/NDK/Components/CollisionComponent3D.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include @@ -59,6 +59,7 @@ namespace Ndk m_staticBody = std::make_unique(&physWorld, m_geom); m_staticBody->EnableAutoSleep(false); + m_staticBody->SetUserdata(reinterpret_cast(static_cast(m_entity->GetId()))); } /*! diff --git a/SDK/src/NDK/Components/GraphicsComponent.cpp b/SDK/src/NDK/Components/GraphicsComponent.cpp index 73f6ca7f4..a4bc6e439 100644 --- a/SDK/src/NDK/Components/GraphicsComponent.cpp +++ b/SDK/src/NDK/Components/GraphicsComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Components/LightComponent.cpp b/SDK/src/NDK/Components/LightComponent.cpp index f463eb52d..8aeb3f8a9 100644 --- a/SDK/src/NDK/Components/LightComponent.cpp +++ b/SDK/src/NDK/Components/LightComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Jrme Leclercq // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/src/NDK/Components/ListenerComponent.cpp b/SDK/src/NDK/Components/ListenerComponent.cpp index 3d261fcb3..420e685cb 100644 --- a/SDK/src/NDK/Components/ListenerComponent.cpp +++ b/SDK/src/NDK/Components/ListenerComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/src/NDK/Components/NodeComponent.cpp b/SDK/src/NDK/Components/NodeComponent.cpp index d54da5ecb..5a78ae093 100644 --- a/SDK/src/NDK/Components/NodeComponent.cpp +++ b/SDK/src/NDK/Components/NodeComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/src/NDK/Components/ParticleEmitterComponent.cpp b/SDK/src/NDK/Components/ParticleEmitterComponent.cpp index 89cbaf983..d128f4c16 100644 --- a/SDK/src/NDK/Components/ParticleEmitterComponent.cpp +++ b/SDK/src/NDK/Components/ParticleEmitterComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Jrme Leclercq // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Components/ParticleGroupComponent.cpp b/SDK/src/NDK/Components/ParticleGroupComponent.cpp index c9c64f1e4..7042eb298 100644 --- a/SDK/src/NDK/Components/ParticleGroupComponent.cpp +++ b/SDK/src/NDK/Components/ParticleGroupComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Jrme Leclercq // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/src/NDK/Components/PhysicsComponent2D.cpp b/SDK/src/NDK/Components/PhysicsComponent2D.cpp index 2061029de..087eee04d 100644 --- a/SDK/src/NDK/Components/PhysicsComponent2D.cpp +++ b/SDK/src/NDK/Components/PhysicsComponent2D.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Components/PhysicsComponent3D.cpp b/SDK/src/NDK/Components/PhysicsComponent3D.cpp index b93068fa7..4615d3c43 100644 --- a/SDK/src/NDK/Components/PhysicsComponent3D.cpp +++ b/SDK/src/NDK/Components/PhysicsComponent3D.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include @@ -41,6 +41,7 @@ namespace Ndk matrix.MakeIdentity(); m_object = std::make_unique(&world, geom, matrix); + m_object->SetUserdata(reinterpret_cast(static_cast(m_entity->GetId()))); if (m_pendingStates.valid) ApplyPhysicsState(*m_object); diff --git a/SDK/src/NDK/Components/VelocityComponent.cpp b/SDK/src/NDK/Components/VelocityComponent.cpp index be1fcec02..a457c4483 100644 --- a/SDK/src/NDK/Components/VelocityComponent.cpp +++ b/SDK/src/NDK/Components/VelocityComponent.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/src/NDK/Console.cpp b/SDK/src/NDK/Console.cpp index 0c8ceaa5d..e5b4f1306 100644 --- a/SDK/src/NDK/Console.cpp +++ b/SDK/src/NDK/Console.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Entity.cpp b/SDK/src/NDK/Entity.cpp index b92405cb0..863428d2a 100644 --- a/SDK/src/NDK/Entity.cpp +++ b/SDK/src/NDK/Entity.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/EntityList.cpp b/SDK/src/NDK/EntityList.cpp index 03fd3afc3..49841843d 100644 --- a/SDK/src/NDK/EntityList.cpp +++ b/SDK/src/NDK/EntityList.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Lua/LuaBinding_Graphics.cpp b/SDK/src/NDK/Lua/LuaBinding_Graphics.cpp index 909a91daa..14105eb3c 100644 --- a/SDK/src/NDK/Lua/LuaBinding_Graphics.cpp +++ b/SDK/src/NDK/Lua/LuaBinding_Graphics.cpp @@ -1,5 +1,5 @@ // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Lua/LuaBinding_Platform.cpp b/SDK/src/NDK/Lua/LuaBinding_Platform.cpp index b910770fa..2a2b02e7e 100644 --- a/SDK/src/NDK/Lua/LuaBinding_Platform.cpp +++ b/SDK/src/NDK/Lua/LuaBinding_Platform.cpp @@ -1,5 +1,5 @@ // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Lua/LuaBinding_Renderer.cpp b/SDK/src/NDK/Lua/LuaBinding_Renderer.cpp index 1ab24cedb..108941880 100644 --- a/SDK/src/NDK/Lua/LuaBinding_Renderer.cpp +++ b/SDK/src/NDK/Lua/LuaBinding_Renderer.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Jérôme Leclercq, Arnaud Cadot // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Lua/LuaBinding_SDK.cpp b/SDK/src/NDK/Lua/LuaBinding_SDK.cpp index 88190fc09..36c28d973 100644 --- a/SDK/src/NDK/Lua/LuaBinding_SDK.cpp +++ b/SDK/src/NDK/Lua/LuaBinding_SDK.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Jérôme Leclercq, Arnaud Cadot // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include @@ -179,6 +179,12 @@ namespace Ndk world.BindMethod("CreateEntity", &World::CreateEntity); world.BindMethod("CreateEntities", &World::CreateEntities); world.BindMethod("Clear", &World::Clear); + world.BindMethod("DisableProfiler", &World::DisableProfiler); + world.BindMethod("EnableProfiler", &World::EnableProfiler); + world.BindMethod("IsProfilerEnabled", &World::IsProfilerEnabled); + world.BindMethod("Refresh", &World::Refresh); + world.BindMethod("ResetProfiler", &World::ResetProfiler); + world.BindMethod("Update", &World::Update); world.BindMethod("IsValidHandle", &WorldHandle::IsValid); } diff --git a/SDK/src/NDK/Lua/LuaBinding_Utility.cpp b/SDK/src/NDK/Lua/LuaBinding_Utility.cpp index 14fddec73..5fdd52d01 100644 --- a/SDK/src/NDK/Lua/LuaBinding_Utility.cpp +++ b/SDK/src/NDK/Lua/LuaBinding_Utility.cpp @@ -1,5 +1,5 @@ // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Sdk.cpp b/SDK/src/NDK/Sdk.cpp index f041cfd1f..e4a7008b7 100644 --- a/SDK/src/NDK/Sdk.cpp +++ b/SDK/src/NDK/Sdk.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/State.cpp b/SDK/src/NDK/State.cpp index afe0fd708..dc569c1ac 100644 --- a/SDK/src/NDK/State.cpp +++ b/SDK/src/NDK/State.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include diff --git a/SDK/src/NDK/Systems/ListenerSystem.cpp b/SDK/src/NDK/Systems/ListenerSystem.cpp index 6c41de58f..b6cdd55d9 100644 --- a/SDK/src/NDK/Systems/ListenerSystem.cpp +++ b/SDK/src/NDK/Systems/ListenerSystem.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Systems/ParticleSystem.cpp b/SDK/src/NDK/Systems/ParticleSystem.cpp index 9a60e0595..b374bf1e7 100644 --- a/SDK/src/NDK/Systems/ParticleSystem.cpp +++ b/SDK/src/NDK/Systems/ParticleSystem.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Systems/PhysicsSystem2D.cpp b/SDK/src/NDK/Systems/PhysicsSystem2D.cpp index 7ab95e32a..95c3f426b 100644 --- a/SDK/src/NDK/Systems/PhysicsSystem2D.cpp +++ b/SDK/src/NDK/Systems/PhysicsSystem2D.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Systems/PhysicsSystem3D.cpp b/SDK/src/NDK/Systems/PhysicsSystem3D.cpp index d30a2f12a..d0256a416 100644 --- a/SDK/src/NDK/Systems/PhysicsSystem3D.cpp +++ b/SDK/src/NDK/Systems/PhysicsSystem3D.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Systems/RenderSystem.cpp b/SDK/src/NDK/Systems/RenderSystem.cpp index 3dfc81724..9798731b7 100644 --- a/SDK/src/NDK/Systems/RenderSystem.cpp +++ b/SDK/src/NDK/Systems/RenderSystem.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Systems/VelocitySystem.cpp b/SDK/src/NDK/Systems/VelocitySystem.cpp index dddceb2fe..35109dbcd 100644 --- a/SDK/src/NDK/Systems/VelocitySystem.cpp +++ b/SDK/src/NDK/Systems/VelocitySystem.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Widgets/ButtonWidget.cpp b/SDK/src/NDK/Widgets/ButtonWidget.cpp index 35e781992..e44348dc6 100644 --- a/SDK/src/NDK/Widgets/ButtonWidget.cpp +++ b/SDK/src/NDK/Widgets/ButtonWidget.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Widgets/CheckboxWidget.cpp b/SDK/src/NDK/Widgets/CheckboxWidget.cpp index 3dcdb682c..237aff415 100644 --- a/SDK/src/NDK/Widgets/CheckboxWidget.cpp +++ b/SDK/src/NDK/Widgets/CheckboxWidget.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Widgets/ImageWidget.cpp b/SDK/src/NDK/Widgets/ImageWidget.cpp index a845979f7..d03c67651 100644 --- a/SDK/src/NDK/Widgets/ImageWidget.cpp +++ b/SDK/src/NDK/Widgets/ImageWidget.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Widgets/LabelWidget.cpp b/SDK/src/NDK/Widgets/LabelWidget.cpp index ae05450de..a93503d60 100644 --- a/SDK/src/NDK/Widgets/LabelWidget.cpp +++ b/SDK/src/NDK/Widgets/LabelWidget.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Widgets/ProgressBarWidget.cpp b/SDK/src/NDK/Widgets/ProgressBarWidget.cpp index 7ad293539..721636ffc 100644 --- a/SDK/src/NDK/Widgets/ProgressBarWidget.cpp +++ b/SDK/src/NDK/Widgets/ProgressBarWidget.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 Samy Bensaid // This file is part of the "Nazara Development Kit" -// For conditions of distribution and use, see copyright notice in Prerequesites.hpp +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/Widgets/TextAreaWidget.cpp b/SDK/src/NDK/Widgets/TextAreaWidget.cpp index 586de7456..a46089fc3 100644 --- a/SDK/src/NDK/Widgets/TextAreaWidget.cpp +++ b/SDK/src/NDK/Widgets/TextAreaWidget.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/SDK/src/NDK/World.cpp b/SDK/src/NDK/World.cpp index 774c42867..7582461b9 100644 --- a/SDK/src/NDK/World.cpp +++ b/SDK/src/NDK/World.cpp @@ -1,8 +1,9 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include +#include #include #include #include @@ -61,11 +62,14 @@ namespace Ndk { EntityId id; EntityBlock* entBlock; - if (!m_freeIdList.empty()) + + std::size_t freeEntityId = m_freeEntityIds.FindFirst(); + if (freeEntityId != m_freeEntityIds.npos) { // We get an identifier - id = m_freeIdList.back(); - m_freeIdList.pop_back(); + m_freeEntityIds.Reset(freeEntityId); //< Remove id from free entity id + + id = static_cast(freeEntityId); entBlock = &m_entities[id]; entBlock->handle.Reset(&entBlock->entity); //< Reset handle (as it was reset when entity got destroyed) @@ -81,7 +85,7 @@ namespace Ndk { NazaraAssert(m_waitingEntities.empty(), "There should be no waiting entities if space is available in main container"); - m_entities.push_back(Entity(this, id)); //< We can't use emplace_back due to the scope + m_entities.emplace_back(Entity(this, id)); //< We can't make our vector create the entity due to the scope entBlock = &m_entities.back(); } else @@ -124,11 +128,11 @@ namespace Ndk m_entityBlocks.clear(); m_entities.clear(); - m_freeIdList.clear(); m_waitingEntities.clear(); m_aliveEntities.Clear(); m_dirtyEntities.Clear(); + m_freeEntityIds.Clear(); m_killedEntities.Clear(); } @@ -166,12 +170,21 @@ namespace Ndk } /*! - * \brief Updates the world + * \brief Refreshes the world * - * \remark Produces a NazaraAssert if an entity is invalid + * This function will perform all pending operations in the following order: + * - Reorder systems according to their update order if needed + * - Moving newly created entities (whose which allocate never-used id) data and handles to normal entity list, this will invalidate references to world EntityHandle + * - Destroying dead entities and allowing their ids to be used by newly created entities + * - Update dirty entities, destroying their removed components and filtering them along systems + * + * \remark This is called automatically by Update and you most likely won't need to call it yourself + * \remark Calling this outside of Update will not increase the profiler values + * + * \see GetProfilerData + * \see Update */ - - void World::Update() + void World::Refresh() { if (!m_orderedSystemsUpdated) ReorderSystems(); @@ -203,7 +216,7 @@ namespace Ndk entity->Destroy(); // Send back the identifier of the entity to the free queue - m_freeIdList.push_back(entity->GetId()); + m_freeEntityIds.UnboundedSet(entity->GetId()); } m_killedEntities.Reset(); @@ -248,6 +261,43 @@ namespace Ndk m_dirtyEntities.Reset(); } + /*! + * \brief Updates the world + * \param elapsedTime Delta time used for the update + * + * This function Refreshes the world and calls the Update function of every active system part of it with the elapsedTime value. + * It also increase the profiler data with the elapsed time passed in Refresh and every system update. + */ + void World::Update(float elapsedTime) + { + if (m_isProfilerEnabled) + { + Nz::UInt64 t1 = Nz::GetElapsedMicroseconds(); + Refresh(); + Nz::UInt64 t2 = Nz::GetElapsedMicroseconds(); + + m_profilerData.refreshTime += t2 - t1; + + for (auto& systemPtr : m_orderedSystems) + { + systemPtr->Update(elapsedTime); + + Nz::UInt64 t3 = Nz::GetElapsedMicroseconds(); + m_profilerData.updateTime[systemPtr->GetIndex()] += t3 - t2; + t2 = t3; + } + + m_profilerData.updateCount++; + } + else + { + Refresh(); + + for (auto& systemPtr : m_orderedSystems) + systemPtr->Update(elapsedTime); + } + } + void World::ReorderSystems() { m_orderedSystems.clear(); diff --git a/appveyor.yml b/appveyor.yml index b6f1df78f..8c53f2bd8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -47,3 +47,11 @@ artifacts: on_success: - cd tests && "./NazaraUnitTestsServer.exe" + +notifications: + - provider: Slack + incoming_webhook: + secure: 5FSnJzsZCMXNDqPYGhN4ZSX7qa1KMmbV0UGT9i0LcElk3X91z3fs1TZRpZZ3++Tkw8qAk1G/qDChom5GQ7Vj7X29cScQHvGHXffl3qaC5EdSiGpjloMZKfeiGTnf798IX0n/ABSlDHG7GrB8IiulRGx3iVOpPQmrPWCiz9ZPtY8h84xpd65FGd8gETKG/sYk + on_build_success: true + on_build_failure: true + on_build_status_changed: false diff --git a/build/scripts/common.lua b/build/scripts/common.lua index adc069ab5..f4572322e 100644 --- a/build/scripts/common.lua +++ b/build/scripts/common.lua @@ -73,7 +73,7 @@ function NazaraBuild:Execute() -- Extern libraries if (self.Config["BuildDependencies"]) then - self:FilterLibDirectory("../thirdparty/lib/", targetdir) + self:FilterLibDirectory("../thirdparty/genlib/", targetdir) -- For generated libraries for k, libTable in ipairs(self.OrderedExtLibs) do project(libTable.Name) @@ -788,6 +788,7 @@ function NazaraBuild:PrepareGeneric() cppdialect("C++14") + self:FilterLibDirectory("../thirdparty/genlib/", libdirs) self:FilterLibDirectory("../thirdparty/lib/", libdirs) -- Fixes Premake stuff @@ -820,6 +821,7 @@ function NazaraBuild:PrepareGeneric() -- Setup some optimizations for release filter("configurations:Release*") + defines("NDEBUG") optimize("Speed") vectorextensions("SSE2") diff --git a/build/scripts/modules/core.lua b/build/scripts/modules/core.lua index b33c0b61f..ae87461e8 100644 --- a/build/scripts/modules/core.lua +++ b/build/scripts/modules/core.lua @@ -2,7 +2,7 @@ MODULE.Name = "Core" MODULE.Excludable = false -- Excluding the core makes no sense as everything relies on it MODULE.Files = { -- Other files will be automatically added - "../include/Nazara/Prerequesites.hpp", + "../include/Nazara/Prerequisites.hpp", "../include/Nazara/Math/**.hpp", "../include/Nazara/Math/**.inl", } diff --git a/examples/FirstScene/main.cpp b/examples/FirstScene/main.cpp index 3da45342e..2aec4861e 100644 --- a/examples/FirstScene/main.cpp +++ b/examples/FirstScene/main.cpp @@ -34,7 +34,6 @@ int main() { // Ndk::Application est une classe s'occupant de l'initialisation du moteur ainsi que de la gestion de beaucoup de choses Ndk::Application application; - Nz::Initializer network; // Nazara étant initialisé, nous pouvons créer le monde pour contenir notre scène. // Dans un ECS, le monde représente bien ce que son nom indique, c'est l'ensemble de ce qui existe au niveau de l'application. @@ -275,70 +274,58 @@ int main() consoleOverlay.lua.PushGlobal("Spaceship", spaceship->CreateHandle()); consoleOverlay.lua.PushGlobal("World", world->CreateHandle()); + + //Gestion des Evenements + Nz::EventHandler& eventHandler = window.GetEventHandler(); + + eventHandler.OnMouseMoved.Connect([&camAngles, &cameraNode, &window](const Nz::EventHandler*, const Nz::WindowEvent::MouseMoveEvent& event) + { + if (Ndk::Application::Instance()->IsConsoleEnabled()) + { + Ndk::Application::ConsoleOverlay& consoleOverlay = Ndk::Application::Instance()->GetConsoleOverlay(); + if (consoleOverlay.console->IsVisible()) + return; + } + // Gestion de la caméra free-fly (Rotation) + float sensitivity = 0.3f; // Sensibilité de la souris + + // On modifie l'angle de la caméra grâce au déplacement relatif sur X de la souris + camAngles.yaw = Nz::NormalizeAngle(camAngles.yaw - event.deltaX*sensitivity); + + // Idem, mais pour éviter les problèmes de calcul de la matrice de vue, on restreint les angles + camAngles.pitch = Nz::Clamp(camAngles.pitch - event.deltaY*sensitivity, -89.f, 89.f); + + // On applique les angles d'Euler à notre caméra + cameraNode.SetRotation(camAngles); + + // Pour éviter que le curseur ne sorte de l'écran, nous le renvoyons au centre de la fenétre + // Cette fonction est codée de sorte à ne pas provoquer d'événement MouseMoved + Nz::Vector2ui size = window.GetSize(); + Nz::Mouse::SetPosition(size.x / 2, size.y / 2, window); + }); + + eventHandler.OnKeyPressed.Connect([&targetPos, &cameraNode, &smoothMovement, &window](const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& event) + { + // Une touche a été pressée ! + if (event.code == Nz::Keyboard::Key::Escape) + window.Close(); + else if (event.code == Nz::Keyboard::F1) + { + if (smoothMovement) + { + targetPos = cameraNode.GetPosition(); + smoothMovement = false; + } + else + smoothMovement = true; + } + }); + // Début de la boucle de rendu du programme (s'occupant par exemple de mettre à jour le monde) while (application.Run()) { - // Ensuite nous allons traiter les évènements (Étape indispensable pour la fenêtre) - Nz::WindowEvent event; - while (window.PollEvent(&event)) - { - switch (event.type) - { - case Nz::WindowEventType_MouseMoved: // La souris a bougé - { - 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 - - // On modifie l'angle de la caméra grâce au déplacement relatif sur X de la souris - camAngles.yaw = Nz::NormalizeAngle(camAngles.yaw - event.mouseMove.deltaX*sensitivity); - - // Idem, mais pour éviter les problèmes de calcul de la matrice de vue, on restreint les angles - camAngles.pitch = Nz::Clamp(camAngles.pitch - event.mouseMove.deltaY*sensitivity, -89.f, 89.f); - - // On applique les angles d'Euler à notre caméra - cameraNode.SetRotation(camAngles); - - // Pour éviter que le curseur ne sorte de l'écran, nous le renvoyons au centre de la fenêtre - // Cette fonction est codée de sorte à ne pas provoquer d'évènement MouseMoved - Nz::Vector2ui size = window.GetSize(); - Nz::Mouse::SetPosition(size.x / 2, size.y / 2, window); - break; - } - - case Nz::WindowEventType_Quit: // L'utilisateur a cliqué sur la croix, ou l'OS veut terminer notre programme - application.Quit(); - break; - - case Nz::WindowEventType_KeyPressed: // Une touche a été pressée ! - if (event.key.code == Nz::Keyboard::Key::Escape) - window.Close(); - else if (event.key.code == Nz::Keyboard::F1) - { - if (smoothMovement) - { - targetPos = cameraNode.GetPosition(); - smoothMovement = false; - } - else - smoothMovement = true; - } - break; - - default: - break; - } - } - - Nz::UInt64 elapsedUS = updateClock.GetMicroseconds(); - // On relance l'horloge - updateClock.Restart(); + Nz::UInt64 elapsedUS = updateClock.Restart() / 1'000'000; // Mise à jour (Caméra) const Nz::UInt64 updateRate = 1000000 / 60; // 60 fois par seconde @@ -370,7 +357,7 @@ int main() // Pour que nos déplacement soient liés à la rotation de la caméra, nous allons utiliser // les directions locales de la caméra - // Si la flèche du haut ou la touche Z (vive ZQSD) est pressée, on avance + // Si la flèche du haut ou la touche Z (vive ZQSD !!) est pressée, on avance if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Up) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Z)) targetPos += cameraNode.GetForward() * cameraSpeed; @@ -429,7 +416,7 @@ Nz::Vector3f DampedString(const Nz::Vector3f& currentPos, const Nz::Vector3f& ta const float dampConstant = 0.000065f; // Something v.small to offset 1/ displacement length // the strength of the spring increases the further away the camera is from the target. - float springMagitude = springStrength*displacementLength + dampConstant*invDisplacementLength; + float springMagitude = springStrength * displacementLength + dampConstant * invDisplacementLength; // Normalise the displacement and scale by the spring magnitude // and the amount of time passed diff --git a/include/Nazara/Audio/Algorithm.hpp b/include/Nazara/Audio/Algorithm.hpp index 5173cbdb2..de8fac319 100644 --- a/include/Nazara/Audio/Algorithm.hpp +++ b/include/Nazara/Audio/Algorithm.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ALGORITHM_AUDIO_HPP #define NAZARA_ALGORITHM_AUDIO_HPP -#include +#include namespace Nz { diff --git a/include/Nazara/Audio/Audio.hpp b/include/Nazara/Audio/Audio.hpp index 84aee8b84..848202970 100644 --- a/include/Nazara/Audio/Audio.hpp +++ b/include/Nazara/Audio/Audio.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_AUDIO_HPP #define NAZARA_AUDIO_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Audio/Music.hpp b/include/Nazara/Audio/Music.hpp index 34b8926a4..fc43d514c 100644 --- a/include/Nazara/Audio/Music.hpp +++ b/include/Nazara/Audio/Music.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MUSIC_HPP #define NAZARA_MUSIC_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Audio/OpenAL.hpp b/include/Nazara/Audio/OpenAL.hpp index 79345c907..9688129e4 100644 --- a/include/Nazara/Audio/OpenAL.hpp +++ b/include/Nazara/Audio/OpenAL.hpp @@ -9,7 +9,7 @@ #ifdef NAZARA_AUDIO_OPENAL -#include +#include #include #include #include diff --git a/include/Nazara/Audio/Sound.hpp b/include/Nazara/Audio/Sound.hpp index 114b177ab..f416f208a 100644 --- a/include/Nazara/Audio/Sound.hpp +++ b/include/Nazara/Audio/Sound.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SOUND_HPP #define NAZARA_SOUND_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Audio/SoundBuffer.hpp b/include/Nazara/Audio/SoundBuffer.hpp index ee2671070..46f37ab05 100644 --- a/include/Nazara/Audio/SoundBuffer.hpp +++ b/include/Nazara/Audio/SoundBuffer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SOUNDBUFFER_HPP #define NAZARA_SOUNDBUFFER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Audio/SoundEmitter.hpp b/include/Nazara/Audio/SoundEmitter.hpp index 5c755d253..614a1058e 100644 --- a/include/Nazara/Audio/SoundEmitter.hpp +++ b/include/Nazara/Audio/SoundEmitter.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SOUNDEMITTER_HPP #define NAZARA_SOUNDEMITTER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Audio/SoundStream.hpp b/include/Nazara/Audio/SoundStream.hpp index 1d821272b..9b9731b41 100644 --- a/include/Nazara/Audio/SoundStream.hpp +++ b/include/Nazara/Audio/SoundStream.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SOUNDSTREAM_HPP #define NAZARA_SOUNDSTREAM_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/AbstractHash.hpp b/include/Nazara/Core/AbstractHash.hpp index 92da667bd..dc227d0f7 100644 --- a/include/Nazara/Core/AbstractHash.hpp +++ b/include/Nazara/Core/AbstractHash.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTHASH_HPP #define NAZARA_ABSTRACTHASH_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/AbstractLogger.hpp b/include/Nazara/Core/AbstractLogger.hpp index 2f523e2d2..2bcc53e28 100644 --- a/include/Nazara/Core/AbstractLogger.hpp +++ b/include/Nazara/Core/AbstractLogger.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTLOGGER_HPP #define NAZARA_ABSTRACTLOGGER_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/Algorithm.hpp b/include/Nazara/Core/Algorithm.hpp index ceba7f14e..1425c6220 100644 --- a/include/Nazara/Core/Algorithm.hpp +++ b/include/Nazara/Core/Algorithm.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ALGORITHM_CORE_HPP #define NAZARA_ALGORITHM_CORE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/Bitset.hpp b/include/Nazara/Core/Bitset.hpp index b175021b4..16cca14fb 100644 --- a/include/Nazara/Core/Bitset.hpp +++ b/include/Nazara/Core/Bitset.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_BITSET_HPP #define NAZARA_BITSET_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/ByteArray.hpp b/include/Nazara/Core/ByteArray.hpp index d6a4a6f27..9cc226c1d 100644 --- a/include/Nazara/Core/ByteArray.hpp +++ b/include/Nazara/Core/ByteArray.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_BYTEARRAY_HPP #define NAZARA_BYTEARRAY_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/ByteStream.hpp b/include/Nazara/Core/ByteStream.hpp index e6e941256..58dd138cd 100644 --- a/include/Nazara/Core/ByteStream.hpp +++ b/include/Nazara/Core/ByteStream.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_BYTESTREAM_HPP #define NAZARA_BYTESTREAM_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/CallOnExit.hpp b/include/Nazara/Core/CallOnExit.hpp index dd0d60728..3b38a3fb2 100644 --- a/include/Nazara/Core/CallOnExit.hpp +++ b/include/Nazara/Core/CallOnExit.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CALLONEXIT_HPP #define NAZARA_CALLONEXIT_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/Clock.hpp b/include/Nazara/Core/Clock.hpp index 870d88c9f..a6b464db6 100644 --- a/include/Nazara/Core/Clock.hpp +++ b/include/Nazara/Core/Clock.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CLOCK_HPP #define NAZARA_CLOCK_HPP -#include +#include #if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_CLOCK #include @@ -32,7 +32,7 @@ namespace Nz bool IsPaused() const; void Pause(); - void Restart(); + UInt64 Restart(); void Unpause(); Clock& operator=(const Clock& clock) = default; @@ -46,7 +46,7 @@ namespace Nz bool m_paused; }; - typedef UInt64 (*ClockFunction)(); + using ClockFunction = UInt64 (*)(); extern NAZARA_CORE_API ClockFunction GetElapsedMicroseconds; extern NAZARA_CORE_API ClockFunction GetElapsedMilliseconds; diff --git a/include/Nazara/Core/Color.hpp b/include/Nazara/Core/Color.hpp index 0e0247f0a..3f3447710 100644 --- a/include/Nazara/Core/Color.hpp +++ b/include/Nazara/Core/Color.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_COLOR_HPP #define NAZARA_COLOR_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/ConditionVariable.hpp b/include/Nazara/Core/ConditionVariable.hpp index 97d4ed10f..4b69926d3 100644 --- a/include/Nazara/Core/ConditionVariable.hpp +++ b/include/Nazara/Core/ConditionVariable.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CONDITIONVARIABLE_HPP #define NAZARA_CONDITIONVARIABLE_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/Core.hpp b/include/Nazara/Core/Core.hpp index e5b0166d5..e5d8e2705 100644 --- a/include/Nazara/Core/Core.hpp +++ b/include/Nazara/Core/Core.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CORE_HPP #define NAZARA_CORE_HPP -#include +#include namespace Nz { diff --git a/include/Nazara/Core/Debug/NewRedefinition.hpp b/include/Nazara/Core/Debug/NewRedefinition.hpp index b50d4feb3..06245f378 100644 --- a/include/Nazara/Core/Debug/NewRedefinition.hpp +++ b/include/Nazara/Core/Debug/NewRedefinition.hpp @@ -10,7 +10,7 @@ #ifndef NAZARA_DEBUG_NEWREDEFINITION_HPP #define NAZARA_DEBUG_NEWREDEFINITION_HPP -#include +#include #include NAZARA_CORE_API void* operator new(std::size_t size, const char* file, unsigned int line); diff --git a/include/Nazara/Core/Directory.hpp b/include/Nazara/Core/Directory.hpp index ea828fe45..1ac3af76b 100644 --- a/include/Nazara/Core/Directory.hpp +++ b/include/Nazara/Core/Directory.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DIRECTORY_HPP #define NAZARA_DIRECTORY_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/DynLib.hpp b/include/Nazara/Core/DynLib.hpp index edf8ed647..266334b3e 100644 --- a/include/Nazara/Core/DynLib.hpp +++ b/include/Nazara/Core/DynLib.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DYNLIB_HPP #define NAZARA_DYNLIB_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Endianness.hpp b/include/Nazara/Core/Endianness.hpp index 5ebd558e2..c76836b25 100644 --- a/include/Nazara/Core/Endianness.hpp +++ b/include/Nazara/Core/Endianness.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ENDIANNESS_HPP #define NAZARA_ENDIANNESS_HPP -#include +#include #include #if !defined(NAZARA_BIG_ENDIAN) && !defined(NAZARA_LITTLE_ENDIAN) diff --git a/include/Nazara/Core/Error.hpp b/include/Nazara/Core/Error.hpp index cd9e49fe6..8081340f7 100644 --- a/include/Nazara/Core/Error.hpp +++ b/include/Nazara/Core/Error.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ERROR_HPP #define NAZARA_ERROR_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/ErrorFlags.hpp b/include/Nazara/Core/ErrorFlags.hpp index 945acc45c..41e33ff82 100644 --- a/include/Nazara/Core/ErrorFlags.hpp +++ b/include/Nazara/Core/ErrorFlags.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ERRORFLAGS_HPP #define NAZARA_ERRORFLAGS_HPP -#include +#include namespace Nz { diff --git a/include/Nazara/Core/File.hpp b/include/Nazara/Core/File.hpp index 859b7395b..ce3025ca5 100644 --- a/include/Nazara/Core/File.hpp +++ b/include/Nazara/Core/File.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FILE_HPP #define NAZARA_FILE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/FileLogger.hpp b/include/Nazara/Core/FileLogger.hpp index 7ca79f66c..8f4e4fb60 100644 --- a/include/Nazara/Core/FileLogger.hpp +++ b/include/Nazara/Core/FileLogger.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FILELOGGER_HPP #define NAZARA_FILELOGGER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/Flags.hpp b/include/Nazara/Core/Flags.hpp index 86844b806..c30959446 100644 --- a/include/Nazara/Core/Flags.hpp +++ b/include/Nazara/Core/Flags.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FLAGS_HPP #define NAZARA_FLAGS_HPP -#include +#include #include namespace Nz @@ -67,7 +67,7 @@ namespace Nz static constexpr BitField GetFlagValue(E enumValue); - static constexpr BitField ValueMask = ((BitField(1) << (MaxValue + 1)) - 1); + static constexpr BitField ValueMask = BitField((UInt64(1) << (MaxValue + 1)) - 1); private: BitField m_value; diff --git a/include/Nazara/Core/GuillotineBinPack.hpp b/include/Nazara/Core/GuillotineBinPack.hpp index 0736447fc..d9f2590a5 100644 --- a/include/Nazara/Core/GuillotineBinPack.hpp +++ b/include/Nazara/Core/GuillotineBinPack.hpp @@ -10,7 +10,7 @@ #ifndef NAZARA_GUILLOTINEBINPACK_HPP #define NAZARA_GUILLOTINEBINPACK_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/HandledObject.hpp b/include/Nazara/Core/HandledObject.hpp index a103f6750..4377377de 100644 --- a/include/Nazara/Core/HandledObject.hpp +++ b/include/Nazara/Core/HandledObject.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once diff --git a/include/Nazara/Core/HandledObject.inl b/include/Nazara/Core/HandledObject.inl index 53f77bbed..2b0bb3f23 100644 --- a/include/Nazara/Core/HandledObject.inl +++ b/include/Nazara/Core/HandledObject.inl @@ -1,6 +1,6 @@ // Copyright (C) 2017 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 +// For conditions of distribution and use, see copyright notice in Prerequisites.hpp #include #include diff --git a/include/Nazara/Core/HardwareInfo.hpp b/include/Nazara/Core/HardwareInfo.hpp index 73b49e894..dace7ed0c 100644 --- a/include/Nazara/Core/HardwareInfo.hpp +++ b/include/Nazara/Core/HardwareInfo.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HARDWAREINFO_HPP #define NAZARA_HARDWAREINFO_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/CRC32.hpp b/include/Nazara/Core/Hash/CRC32.hpp index 444b81ae5..63a8a60f7 100644 --- a/include/Nazara/Core/Hash/CRC32.hpp +++ b/include/Nazara/Core/Hash/CRC32.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_CRC32_HPP #define NAZARA_HASH_CRC32_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/CRC64.hpp b/include/Nazara/Core/Hash/CRC64.hpp index 1c9819e5f..c65eea4f9 100644 --- a/include/Nazara/Core/Hash/CRC64.hpp +++ b/include/Nazara/Core/Hash/CRC64.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_CRC64_HPP #define NAZARA_HASH_CRC64_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/Fletcher16.hpp b/include/Nazara/Core/Hash/Fletcher16.hpp index 85325e20c..54f44b901 100644 --- a/include/Nazara/Core/Hash/Fletcher16.hpp +++ b/include/Nazara/Core/Hash/Fletcher16.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_FLETCHER16_HPP #define NAZARA_HASH_FLETCHER16_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/MD5.hpp b/include/Nazara/Core/Hash/MD5.hpp index 28026816b..61d960783 100644 --- a/include/Nazara/Core/Hash/MD5.hpp +++ b/include/Nazara/Core/Hash/MD5.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_MD5_HPP #define NAZARA_HASH_MD5_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/SHA1.hpp b/include/Nazara/Core/Hash/SHA1.hpp index 55291e1f7..a8e63e563 100644 --- a/include/Nazara/Core/Hash/SHA1.hpp +++ b/include/Nazara/Core/Hash/SHA1.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_SHA1_HPP #define NAZARA_HASH_SHA1_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/SHA224.hpp b/include/Nazara/Core/Hash/SHA224.hpp index 3013a8170..6e79c99d5 100644 --- a/include/Nazara/Core/Hash/SHA224.hpp +++ b/include/Nazara/Core/Hash/SHA224.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_SHA224_HPP #define NAZARA_HASH_SHA224_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/SHA256.hpp b/include/Nazara/Core/Hash/SHA256.hpp index e20e1d994..3b04986b6 100644 --- a/include/Nazara/Core/Hash/SHA256.hpp +++ b/include/Nazara/Core/Hash/SHA256.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_SHA256_HPP #define NAZARA_HASH_SHA256_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/SHA384.hpp b/include/Nazara/Core/Hash/SHA384.hpp index 814d80f57..4aaab3127 100644 --- a/include/Nazara/Core/Hash/SHA384.hpp +++ b/include/Nazara/Core/Hash/SHA384.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_SHA384_HPP #define NAZARA_HASH_SHA384_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/SHA512.hpp b/include/Nazara/Core/Hash/SHA512.hpp index df09cd163..6523a2848 100644 --- a/include/Nazara/Core/Hash/SHA512.hpp +++ b/include/Nazara/Core/Hash/SHA512.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HASH_SHA512_HPP #define NAZARA_HASH_SHA512_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Hash/Whirlpool.hpp b/include/Nazara/Core/Hash/Whirlpool.hpp index caff8f349..a6a9a84d9 100644 --- a/include/Nazara/Core/Hash/Whirlpool.hpp +++ b/include/Nazara/Core/Hash/Whirlpool.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_HASH_WHIRLPOOL_HPP #define NAZARA_HASH_WHIRLPOOL_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/Initializer.hpp b/include/Nazara/Core/Initializer.hpp index c09ae55af..06e90da59 100644 --- a/include/Nazara/Core/Initializer.hpp +++ b/include/Nazara/Core/Initializer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_INITIALIZER_HPP #define NAZARA_INITIALIZER_HPP -#include +#include namespace Nz { diff --git a/include/Nazara/Core/LockGuard.hpp b/include/Nazara/Core/LockGuard.hpp index d8d03725c..59ece007c 100644 --- a/include/Nazara/Core/LockGuard.hpp +++ b/include/Nazara/Core/LockGuard.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOCKGUARD_HPP #define NAZARA_LOCKGUARD_HPP -#include +#include namespace Nz { diff --git a/include/Nazara/Core/Log.hpp b/include/Nazara/Core/Log.hpp index 1538068a2..edb8f7947 100644 --- a/include/Nazara/Core/Log.hpp +++ b/include/Nazara/Core/Log.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOG_HPP #define NAZARA_LOG_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/MemoryManager.hpp b/include/Nazara/Core/MemoryManager.hpp index 22c59de2d..f0363781f 100644 --- a/include/Nazara/Core/MemoryManager.hpp +++ b/include/Nazara/Core/MemoryManager.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MEMORYMANAGER_HPP #define NAZARA_MEMORYMANAGER_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/MemoryPool.hpp b/include/Nazara/Core/MemoryPool.hpp index 10f147f5c..101c29d3a 100644 --- a/include/Nazara/Core/MemoryPool.hpp +++ b/include/Nazara/Core/MemoryPool.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MEMORYPOOL_HPP #define NAZARA_MEMORYPOOL_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/MemoryStream.hpp b/include/Nazara/Core/MemoryStream.hpp index 4c34eabc6..fed53fe3b 100644 --- a/include/Nazara/Core/MemoryStream.hpp +++ b/include/Nazara/Core/MemoryStream.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MEMORYSTREAM_HPP #define NAZARA_MEMORYSTREAM_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/MemoryView.hpp b/include/Nazara/Core/MemoryView.hpp index 5b3cf63b7..7b5fbab45 100644 --- a/include/Nazara/Core/MemoryView.hpp +++ b/include/Nazara/Core/MemoryView.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MEMORYVIEW_HPP #define NAZARA_MEMORYVIEW_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/Mutex.hpp b/include/Nazara/Core/Mutex.hpp index b317cf58b..d5d5180bb 100644 --- a/include/Nazara/Core/Mutex.hpp +++ b/include/Nazara/Core/Mutex.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MUTEX_HPP #define NAZARA_MUTEX_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/ObjectRef.hpp b/include/Nazara/Core/ObjectRef.hpp index 3a9e57628..379f56e02 100644 --- a/include/Nazara/Core/ObjectRef.hpp +++ b/include/Nazara/Core/ObjectRef.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RESOURCEREF_HPP #define NAZARA_RESOURCEREF_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/ParameterList.hpp b/include/Nazara/Core/ParameterList.hpp index d6b3985b4..bc0d33a81 100644 --- a/include/Nazara/Core/ParameterList.hpp +++ b/include/Nazara/Core/ParameterList.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARAMETERLIST_HPP #define NAZARA_PARAMETERLIST_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/PluginManager.hpp b/include/Nazara/Core/PluginManager.hpp index 5857a2255..13b384109 100644 --- a/include/Nazara/Core/PluginManager.hpp +++ b/include/Nazara/Core/PluginManager.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PLUGINMANAGER_HPP #define NAZARA_PLUGINMANAGER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/PrimitiveList.hpp b/include/Nazara/Core/PrimitiveList.hpp index a8cbed1d0..98c132279 100644 --- a/include/Nazara/Core/PrimitiveList.hpp +++ b/include/Nazara/Core/PrimitiveList.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PRIMITIVELIST_HPP #define NAZARA_PRIMITIVELIST_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/RefCounted.hpp b/include/Nazara/Core/RefCounted.hpp index 472c8a2fa..421da4c0e 100644 --- a/include/Nazara/Core/RefCounted.hpp +++ b/include/Nazara/Core/RefCounted.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_REFCOUNTED_HPP #define NAZARA_REFCOUNTED_HPP -#include +#include #include #if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_REFCOUNTED diff --git a/include/Nazara/Core/Resource.hpp b/include/Nazara/Core/Resource.hpp index aea1e4d6c..6f651ecf8 100644 --- a/include/Nazara/Core/Resource.hpp +++ b/include/Nazara/Core/Resource.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RESOURCE_HPP #define NAZARA_RESOURCE_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/Semaphore.hpp b/include/Nazara/Core/Semaphore.hpp index 985b49ba6..cb7fdbe56 100644 --- a/include/Nazara/Core/Semaphore.hpp +++ b/include/Nazara/Core/Semaphore.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SEMAPHORE_HPP #define NAZARA_SEMAPHORE_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/SerializationContext.hpp b/include/Nazara/Core/SerializationContext.hpp index 7839c484a..102e82850 100644 --- a/include/Nazara/Core/SerializationContext.hpp +++ b/include/Nazara/Core/SerializationContext.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SERIALIZATION_HPP #define NAZARA_SERIALIZATION_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/SparsePtr.hpp b/include/Nazara/Core/SparsePtr.hpp index b90067bc2..862ddba4c 100644 --- a/include/Nazara/Core/SparsePtr.hpp +++ b/include/Nazara/Core/SparsePtr.hpp @@ -9,7 +9,7 @@ ///FIXME: Is SparsePtr a really good name for this class ? -#include +#include #include #include diff --git a/include/Nazara/Core/StdLogger.hpp b/include/Nazara/Core/StdLogger.hpp index ecc6e1ac7..998ec7b53 100644 --- a/include/Nazara/Core/StdLogger.hpp +++ b/include/Nazara/Core/StdLogger.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_STDLOGGER_HPP #define NAZARA_STDLOGGER_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/Stream.hpp b/include/Nazara/Core/Stream.hpp index f00c373e8..2c140c144 100644 --- a/include/Nazara/Core/Stream.hpp +++ b/include/Nazara/Core/Stream.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_STREAM_HPP #define NAZARA_STREAM_HPP -#include +#include #include #include diff --git a/include/Nazara/Core/String.hpp b/include/Nazara/Core/String.hpp index 293dcfa8f..0c8f2c7f8 100644 --- a/include/Nazara/Core/String.hpp +++ b/include/Nazara/Core/String.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_STRING_HPP #define NAZARA_STRING_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/StringStream.hpp b/include/Nazara/Core/StringStream.hpp index baabda3b0..8a410a275 100644 --- a/include/Nazara/Core/StringStream.hpp +++ b/include/Nazara/Core/StringStream.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_STRINGSTREAM_HPP #define NAZARA_STRINGSTREAM_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/TaskScheduler.hpp b/include/Nazara/Core/TaskScheduler.hpp index 405e88ed3..ac79f16c9 100644 --- a/include/Nazara/Core/TaskScheduler.hpp +++ b/include/Nazara/Core/TaskScheduler.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TASKSCHEDULER_HPP #define NAZARA_TASKSCHEDULER_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/Thread.hpp b/include/Nazara/Core/Thread.hpp index 9c77d7301..7143a881f 100644 --- a/include/Nazara/Core/Thread.hpp +++ b/include/Nazara/Core/Thread.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_THREAD_HPP #define NAZARA_THREAD_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Core/Unicode.hpp b/include/Nazara/Core/Unicode.hpp index 4dfb670a3..056d61f7d 100644 --- a/include/Nazara/Core/Unicode.hpp +++ b/include/Nazara/Core/Unicode.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_UNICODE_HPP #define NAZARA_UNICODE_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Core/Updatable.hpp b/include/Nazara/Core/Updatable.hpp index e1a7cf5a9..32657793a 100644 --- a/include/Nazara/Core/Updatable.hpp +++ b/include/Nazara/Core/Updatable.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_UPDATABLE_HPP #define NAZARA_UPDATABLE_HPP -#include +#include namespace Nz { diff --git a/include/Nazara/Graphics/AbstractBackground.hpp b/include/Nazara/Graphics/AbstractBackground.hpp index 7c6ce8348..fb0bc3df8 100644 --- a/include/Nazara/Graphics/AbstractBackground.hpp +++ b/include/Nazara/Graphics/AbstractBackground.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTBACKGROUND_HPP #define NAZARA_ABSTRACTBACKGROUND_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/AbstractRenderQueue.hpp b/include/Nazara/Graphics/AbstractRenderQueue.hpp index 173ea0142..db4139c73 100644 --- a/include/Nazara/Graphics/AbstractRenderQueue.hpp +++ b/include/Nazara/Graphics/AbstractRenderQueue.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTRENDERQUEUE_HPP #define NAZARA_ABSTRACTRENDERQUEUE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/AbstractRenderTechnique.hpp b/include/Nazara/Graphics/AbstractRenderTechnique.hpp index 7dba6273c..0897c5312 100644 --- a/include/Nazara/Graphics/AbstractRenderTechnique.hpp +++ b/include/Nazara/Graphics/AbstractRenderTechnique.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTRENDERTECHNIQUE_HPP #define NAZARA_ABSTRACTRENDERTECHNIQUE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/AbstractViewer.hpp b/include/Nazara/Graphics/AbstractViewer.hpp index 21a62a890..2821fdbec 100644 --- a/include/Nazara/Graphics/AbstractViewer.hpp +++ b/include/Nazara/Graphics/AbstractViewer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTVIEWER_HPP #define NAZARA_ABSTRACTVIEWER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/Billboard.hpp b/include/Nazara/Graphics/Billboard.hpp index d4c5b6bd8..af77001bd 100644 --- a/include/Nazara/Graphics/Billboard.hpp +++ b/include/Nazara/Graphics/Billboard.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_BILLBOARD_HPP #define NAZARA_BILLBOARD_HPP -#include +#include #include #include diff --git a/include/Nazara/Graphics/ColorBackground.hpp b/include/Nazara/Graphics/ColorBackground.hpp index d76a92977..2f0fdd8fc 100644 --- a/include/Nazara/Graphics/ColorBackground.hpp +++ b/include/Nazara/Graphics/ColorBackground.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_COLORBACKGROUND_HPP #define NAZARA_COLORBACKGROUND_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/CullingList.hpp b/include/Nazara/Graphics/CullingList.hpp index e484be81a..7232e9cdb 100644 --- a/include/Nazara/Graphics/CullingList.hpp +++ b/include/Nazara/Graphics/CullingList.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CULLINGLIST_HPP #define NAZARA_CULLINGLIST_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredBloomPass.hpp b/include/Nazara/Graphics/DeferredBloomPass.hpp index c00cc3c4c..c34f16534 100644 --- a/include/Nazara/Graphics/DeferredBloomPass.hpp +++ b/include/Nazara/Graphics/DeferredBloomPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDBLOOMPASS_HPP #define NAZARA_DEFERREDBLOOMPASS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredDOFPass.hpp b/include/Nazara/Graphics/DeferredDOFPass.hpp index b4025be7d..4d5778dcd 100644 --- a/include/Nazara/Graphics/DeferredDOFPass.hpp +++ b/include/Nazara/Graphics/DeferredDOFPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDDOFPASS_HPP #define NAZARA_DEFERREDDOFPASS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredFXAAPass.hpp b/include/Nazara/Graphics/DeferredFXAAPass.hpp index e8179f46d..0b9c22494 100644 --- a/include/Nazara/Graphics/DeferredFXAAPass.hpp +++ b/include/Nazara/Graphics/DeferredFXAAPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDFXAAPASS_HPP #define NAZARA_DEFERREDFXAAPASS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredFinalPass.hpp b/include/Nazara/Graphics/DeferredFinalPass.hpp index d99c8ed30..1407502a3 100644 --- a/include/Nazara/Graphics/DeferredFinalPass.hpp +++ b/include/Nazara/Graphics/DeferredFinalPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDFINALPASS_HPP #define NAZARA_DEFERREDFINALPASS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredFogPass.hpp b/include/Nazara/Graphics/DeferredFogPass.hpp index c1ccbdc88..5bf9e81f4 100644 --- a/include/Nazara/Graphics/DeferredFogPass.hpp +++ b/include/Nazara/Graphics/DeferredFogPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDFOGPASS_HPP #define NAZARA_DEFERREDFOGPASS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredForwardPass.hpp b/include/Nazara/Graphics/DeferredForwardPass.hpp index 7fc619da2..2e26dde03 100644 --- a/include/Nazara/Graphics/DeferredForwardPass.hpp +++ b/include/Nazara/Graphics/DeferredForwardPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDFORWARDPASS_HPP #define NAZARA_DEFERREDFORWARDPASS_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Graphics/DeferredGeometryPass.hpp b/include/Nazara/Graphics/DeferredGeometryPass.hpp index b390263b6..aaa8f6471 100644 --- a/include/Nazara/Graphics/DeferredGeometryPass.hpp +++ b/include/Nazara/Graphics/DeferredGeometryPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDGEOMETRYPASS_HPP #define NAZARA_DEFERREDGEOMETRYPASS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredPhongLightingPass.hpp b/include/Nazara/Graphics/DeferredPhongLightingPass.hpp index cbff41041..76b826f92 100644 --- a/include/Nazara/Graphics/DeferredPhongLightingPass.hpp +++ b/include/Nazara/Graphics/DeferredPhongLightingPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDPHONGLIGHTINGPASS_HPP #define NAZARA_DEFERREDPHONGLIGHTINGPASS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredRenderPass.hpp b/include/Nazara/Graphics/DeferredRenderPass.hpp index 77dff072e..4c54d5777 100644 --- a/include/Nazara/Graphics/DeferredRenderPass.hpp +++ b/include/Nazara/Graphics/DeferredRenderPass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDRENDERPASS_HPP #define NAZARA_DEFERREDRENDERPASS_HPP -#include +#include #include #include diff --git a/include/Nazara/Graphics/DeferredRenderQueue.hpp b/include/Nazara/Graphics/DeferredRenderQueue.hpp index c6ffcacac..0cb390ace 100644 --- a/include/Nazara/Graphics/DeferredRenderQueue.hpp +++ b/include/Nazara/Graphics/DeferredRenderQueue.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDRENDERQUEUE_HPP #define NAZARA_DEFERREDRENDERQUEUE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DeferredRenderTechnique.hpp b/include/Nazara/Graphics/DeferredRenderTechnique.hpp index 025fb1e52..96f7df1fa 100644 --- a/include/Nazara/Graphics/DeferredRenderTechnique.hpp +++ b/include/Nazara/Graphics/DeferredRenderTechnique.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEFERREDRENDERTECHNIQUE_HPP #define NAZARA_DEFERREDRENDERTECHNIQUE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DepthRenderQueue.hpp b/include/Nazara/Graphics/DepthRenderQueue.hpp index 8de0a2bf2..69f1ceae9 100644 --- a/include/Nazara/Graphics/DepthRenderQueue.hpp +++ b/include/Nazara/Graphics/DepthRenderQueue.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEPTHRENDERQUEUE_HPP #define NAZARA_DEPTHRENDERQUEUE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/DepthRenderTechnique.hpp b/include/Nazara/Graphics/DepthRenderTechnique.hpp index cc3b7bcd8..0e1e6daea 100644 --- a/include/Nazara/Graphics/DepthRenderTechnique.hpp +++ b/include/Nazara/Graphics/DepthRenderTechnique.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEPTHRENDERTECHNIQUE_HPP #define NAZARA_DEPTHRENDERTECHNIQUE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/Drawable.hpp b/include/Nazara/Graphics/Drawable.hpp index 13a2141b5..a8605a4cc 100644 --- a/include/Nazara/Graphics/Drawable.hpp +++ b/include/Nazara/Graphics/Drawable.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DRAWABLE_HPP #define NAZARA_DRAWABLE_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Graphics/ForwardRenderQueue.hpp b/include/Nazara/Graphics/ForwardRenderQueue.hpp index a51e617c3..37f1db554 100644 --- a/include/Nazara/Graphics/ForwardRenderQueue.hpp +++ b/include/Nazara/Graphics/ForwardRenderQueue.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORWARDRENDERQUEUE_HPP #define NAZARA_FORWARDRENDERQUEUE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/ForwardRenderTechnique.hpp b/include/Nazara/Graphics/ForwardRenderTechnique.hpp index 208b24ea0..f5972d974 100644 --- a/include/Nazara/Graphics/ForwardRenderTechnique.hpp +++ b/include/Nazara/Graphics/ForwardRenderTechnique.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORWARDRENDERTECHNIQUE_HPP #define NAZARA_FORWARDRENDERTECHNIQUE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/Graphics.hpp b/include/Nazara/Graphics/Graphics.hpp index f8687b80e..a44abdcfa 100644 --- a/include/Nazara/Graphics/Graphics.hpp +++ b/include/Nazara/Graphics/Graphics.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_GRAPHICS_HPP #define NAZARA_GRAPHICS_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Graphics/GuillotineTextureAtlas.hpp b/include/Nazara/Graphics/GuillotineTextureAtlas.hpp index 3c5aa2d4b..318cf8655 100644 --- a/include/Nazara/Graphics/GuillotineTextureAtlas.hpp +++ b/include/Nazara/Graphics/GuillotineTextureAtlas.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_GUILLOTINETEXTUREATLAS_HPP #define NAZARA_GUILLOTINETEXTUREATLAS_HPP -#include +#include #include #include diff --git a/include/Nazara/Graphics/Light.hpp b/include/Nazara/Graphics/Light.hpp index 77274b6ca..2f20f5762 100644 --- a/include/Nazara/Graphics/Light.hpp +++ b/include/Nazara/Graphics/Light.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LIGHT_HPP #define NAZARA_LIGHT_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/Material.hpp b/include/Nazara/Graphics/Material.hpp index 77b57c87e..8baab7e62 100644 --- a/include/Nazara/Graphics/Material.hpp +++ b/include/Nazara/Graphics/Material.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MATERIAL_HPP #define NAZARA_MATERIAL_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/MaterialPipeline.hpp b/include/Nazara/Graphics/MaterialPipeline.hpp index 372572264..75e5731e0 100644 --- a/include/Nazara/Graphics/MaterialPipeline.hpp +++ b/include/Nazara/Graphics/MaterialPipeline.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MATERIALPIPELINE_HPP #define NAZARA_MATERIALPIPELINE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/Model.hpp b/include/Nazara/Graphics/Model.hpp index bffba9bab..32cfdfada 100644 --- a/include/Nazara/Graphics/Model.hpp +++ b/include/Nazara/Graphics/Model.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MODEL_HPP #define NAZARA_MODEL_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/ParticleController.hpp b/include/Nazara/Graphics/ParticleController.hpp index 5012c82d2..3328958bf 100644 --- a/include/Nazara/Graphics/ParticleController.hpp +++ b/include/Nazara/Graphics/ParticleController.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLECONTROLLER_HPP #define NAZARA_PARTICLECONTROLLER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/ParticleDeclaration.hpp b/include/Nazara/Graphics/ParticleDeclaration.hpp index db5519d24..89a7dfb32 100644 --- a/include/Nazara/Graphics/ParticleDeclaration.hpp +++ b/include/Nazara/Graphics/ParticleDeclaration.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLEDECLARATION_HPP #define NAZARA_PARTICLEDECLARATION_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/ParticleEmitter.hpp b/include/Nazara/Graphics/ParticleEmitter.hpp index c085c9062..7e7dfca31 100644 --- a/include/Nazara/Graphics/ParticleEmitter.hpp +++ b/include/Nazara/Graphics/ParticleEmitter.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLEEMITTER_HPP #define NAZARA_PARTICLEEMITTER_HPP -#include +#include #include #include diff --git a/include/Nazara/Graphics/ParticleFunctionController.hpp b/include/Nazara/Graphics/ParticleFunctionController.hpp index c61197fc2..c9965c4ac 100644 --- a/include/Nazara/Graphics/ParticleFunctionController.hpp +++ b/include/Nazara/Graphics/ParticleFunctionController.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLEFUNCTIONCONTROLLER_HPP #define NAZARA_PARTICLEFUNCTIONCONTROLLER_HPP -#include +#include #include #include diff --git a/include/Nazara/Graphics/ParticleFunctionGenerator.hpp b/include/Nazara/Graphics/ParticleFunctionGenerator.hpp index 63d7fd755..70729c011 100644 --- a/include/Nazara/Graphics/ParticleFunctionGenerator.hpp +++ b/include/Nazara/Graphics/ParticleFunctionGenerator.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLEFUNCTIONGENERATOR_HPP #define NAZARA_PARTICLEFUNCTIONGENERATOR_HPP -#include +#include #include #include diff --git a/include/Nazara/Graphics/ParticleFunctionRenderer.hpp b/include/Nazara/Graphics/ParticleFunctionRenderer.hpp index b4d8772df..54c9fb176 100644 --- a/include/Nazara/Graphics/ParticleFunctionRenderer.hpp +++ b/include/Nazara/Graphics/ParticleFunctionRenderer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLEFUNCTIONRENDERER_HPP #define NAZARA_PARTICLEFUNCTIONRENDERER_HPP -#include +#include #include #include diff --git a/include/Nazara/Graphics/ParticleGenerator.hpp b/include/Nazara/Graphics/ParticleGenerator.hpp index d4fcb71fa..795d1ca49 100644 --- a/include/Nazara/Graphics/ParticleGenerator.hpp +++ b/include/Nazara/Graphics/ParticleGenerator.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLEGENERATOR_HPP #define NAZARA_PARTICLEGENERATOR_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/ParticleGroup.hpp b/include/Nazara/Graphics/ParticleGroup.hpp index 22f15432d..1d6bdae89 100644 --- a/include/Nazara/Graphics/ParticleGroup.hpp +++ b/include/Nazara/Graphics/ParticleGroup.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLEGROUP_HPP #define NAZARA_PARTICLEGROUP_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/ParticleMapper.hpp b/include/Nazara/Graphics/ParticleMapper.hpp index ba5a8e0f1..a980d7bb8 100644 --- a/include/Nazara/Graphics/ParticleMapper.hpp +++ b/include/Nazara/Graphics/ParticleMapper.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLEMAPPER_HPP #define NAZARA_PARTICLEMAPPER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/ParticleRenderer.hpp b/include/Nazara/Graphics/ParticleRenderer.hpp index 4549d0701..0a076156e 100644 --- a/include/Nazara/Graphics/ParticleRenderer.hpp +++ b/include/Nazara/Graphics/ParticleRenderer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PARTICLERENDERER_HPP #define NAZARA_PARTICLERENDERER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/RenderTechniques.hpp b/include/Nazara/Graphics/RenderTechniques.hpp index 79fb0c629..3854af1d4 100644 --- a/include/Nazara/Graphics/RenderTechniques.hpp +++ b/include/Nazara/Graphics/RenderTechniques.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RENDERTECHNIQUES_HPP #define NAZARA_RENDERTECHNIQUES_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/SkeletalModel.hpp b/include/Nazara/Graphics/SkeletalModel.hpp index 2f7630af2..72489d905 100644 --- a/include/Nazara/Graphics/SkeletalModel.hpp +++ b/include/Nazara/Graphics/SkeletalModel.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SKELETALMODEL_HPP #define NAZARA_SKELETALMODEL_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/SkinningManager.hpp b/include/Nazara/Graphics/SkinningManager.hpp index 040964428..34d578b3e 100644 --- a/include/Nazara/Graphics/SkinningManager.hpp +++ b/include/Nazara/Graphics/SkinningManager.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SKINNINGMANAGER_HPP #define NAZARA_SKINNINGMANAGER_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Graphics/SkyboxBackground.hpp b/include/Nazara/Graphics/SkyboxBackground.hpp index 1e80d7be4..675c2c27a 100644 --- a/include/Nazara/Graphics/SkyboxBackground.hpp +++ b/include/Nazara/Graphics/SkyboxBackground.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SKYBOXBACKGROUND_HPP #define NAZARA_SKYBOXBACKGROUND_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/Sprite.hpp b/include/Nazara/Graphics/Sprite.hpp index 5b0702ed1..34e75f353 100644 --- a/include/Nazara/Graphics/Sprite.hpp +++ b/include/Nazara/Graphics/Sprite.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SPRITE_HPP #define NAZARA_SPRITE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/TextSprite.hpp b/include/Nazara/Graphics/TextSprite.hpp index c4f774774..5fddf7e99 100644 --- a/include/Nazara/Graphics/TextSprite.hpp +++ b/include/Nazara/Graphics/TextSprite.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TEXTSPRITE_HPP #define NAZARA_TEXTSPRITE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/TextureBackground.hpp b/include/Nazara/Graphics/TextureBackground.hpp index bdb088812..c74539e38 100644 --- a/include/Nazara/Graphics/TextureBackground.hpp +++ b/include/Nazara/Graphics/TextureBackground.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TEXTUREBACKGROUND_HPP #define NAZARA_TEXTUREBACKGROUND_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Graphics/TileMap.hpp b/include/Nazara/Graphics/TileMap.hpp index 310d94afd..4a8499599 100644 --- a/include/Nazara/Graphics/TileMap.hpp +++ b/include/Nazara/Graphics/TileMap.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TILEMAP_HPP #define NAZARA_TILEMAP_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Lua/Enums.hpp b/include/Nazara/Lua/Enums.hpp index f62357e6f..e92f058d5 100644 --- a/include/Nazara/Lua/Enums.hpp +++ b/include/Nazara/Lua/Enums.hpp @@ -7,6 +7,8 @@ #ifndef NAZARA_ENUMS_LUA_HPP #define NAZARA_ENUMS_LUA_HPP +#include + namespace Nz { enum LuaBindMode @@ -26,6 +28,21 @@ namespace Nz LuaComparison_Max = LuaComparison_LessOrEqual }; + enum LuaLib + { + LuaLib_Coroutine, + LuaLib_Debug, + LuaLib_Math, + LuaLib_Io, + LuaLib_Package, + LuaLib_Os, + LuaLib_String, + LuaLib_Table, + LuaLib_Utf8, + + LuaLib_Max = LuaLib_Utf8 + }; + enum LuaOperation { LuaOperation_Addition, @@ -61,6 +78,16 @@ namespace Nz LuaType_Max = LuaType_Userdata }; + + template<> + struct EnumAsFlags + { + static constexpr LuaLib max = LuaLib_Max; + }; + + using LuaLibFlags = Flags; + + constexpr LuaLibFlags LuaLib_All = LuaLibFlags(LuaLibFlags::ValueMask); } #endif // NAZARA_ENUMS_LUA_HPP diff --git a/include/Nazara/Lua/Lua.hpp b/include/Nazara/Lua/Lua.hpp index 011b9e36f..d884a22b9 100644 --- a/include/Nazara/Lua/Lua.hpp +++ b/include/Nazara/Lua/Lua.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LUA_HPP #define NAZARA_LUA_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Lua/LuaClass.hpp b/include/Nazara/Lua/LuaClass.hpp index 6c7329204..79558a3b6 100644 --- a/include/Nazara/Lua/LuaClass.hpp +++ b/include/Nazara/Lua/LuaClass.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LUACLASS_HPP #define NAZARA_LUACLASS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Lua/LuaCoroutine.hpp b/include/Nazara/Lua/LuaCoroutine.hpp index 71232791a..cdda83b3a 100644 --- a/include/Nazara/Lua/LuaCoroutine.hpp +++ b/include/Nazara/Lua/LuaCoroutine.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LUACOROUTINE_HPP #define NAZARA_LUACOROUTINE_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Lua/LuaInstance.hpp b/include/Nazara/Lua/LuaInstance.hpp index 6bdbc6338..c45a77a94 100644 --- a/include/Nazara/Lua/LuaInstance.hpp +++ b/include/Nazara/Lua/LuaInstance.hpp @@ -7,8 +7,9 @@ #ifndef NAZARA_LUAINSTANCE_HPP #define NAZARA_LUAINSTANCE_HPP -#include +#include #include +#include #include #include @@ -29,6 +30,8 @@ namespace Nz inline std::size_t GetMemoryUsage() const; inline UInt32 GetTimeLimit() const; + void LoadLibraries(LuaLibFlags libFlags = LuaLib_All); + inline void SetMemoryLimit(std::size_t memoryLimit); inline void SetTimeLimit(UInt32 limit); diff --git a/include/Nazara/Lua/LuaState.hpp b/include/Nazara/Lua/LuaState.hpp index 22b8ceebb..14f0898c2 100644 --- a/include/Nazara/Lua/LuaState.hpp +++ b/include/Nazara/Lua/LuaState.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LUASTATE_HPP #define NAZARA_LUASTATE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Math/Algorithm.hpp b/include/Nazara/Math/Algorithm.hpp index 5ffbe8106..dd9cb4d5a 100644 --- a/include/Nazara/Math/Algorithm.hpp +++ b/include/Nazara/Math/Algorithm.hpp @@ -8,7 +8,7 @@ #ifndef NAZARA_ALGORITHM_MATH_HPP #define NAZARA_ALGORITHM_MATH_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/AbstractSocket.hpp b/include/Nazara/Network/AbstractSocket.hpp index 0b33c6a8f..0af1c8b19 100644 --- a/include/Nazara/Network/AbstractSocket.hpp +++ b/include/Nazara/Network/AbstractSocket.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTSOCKET_HPP #define NAZARA_ABSTRACTSOCKET_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/Algorithm.hpp b/include/Nazara/Network/Algorithm.hpp index 2c0467e64..c2306ac5c 100644 --- a/include/Nazara/Network/Algorithm.hpp +++ b/include/Nazara/Network/Algorithm.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ALGORITHM_NETWORK_HPP #define NAZARA_ALGORITHM_NETWORK_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/ENetCompressor.hpp b/include/Nazara/Network/ENetCompressor.hpp index 5466c80b6..3ff6cbca2 100644 --- a/include/Nazara/Network/ENetCompressor.hpp +++ b/include/Nazara/Network/ENetCompressor.hpp @@ -17,7 +17,7 @@ #ifndef NAZARA_ENETCOMPRESSOR_HPP #define NAZARA_ENETCOMPRESSOR_HPP -#include +#include #include #include diff --git a/include/Nazara/Network/ENetHost.hpp b/include/Nazara/Network/ENetHost.hpp index b15bd79b4..39bc0be62 100644 --- a/include/Nazara/Network/ENetHost.hpp +++ b/include/Nazara/Network/ENetHost.hpp @@ -17,7 +17,7 @@ #ifndef NAZARA_ENETHOST_HPP #define NAZARA_ENETHOST_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/ENetPacket.hpp b/include/Nazara/Network/ENetPacket.hpp index 8d224a0f4..7054e6b45 100644 --- a/include/Nazara/Network/ENetPacket.hpp +++ b/include/Nazara/Network/ENetPacket.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ENETPACKET_HPP #define NAZARA_ENETPACKET_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Network/ENetPeer.hpp b/include/Nazara/Network/ENetPeer.hpp index b8aa0fead..a58d28201 100644 --- a/include/Nazara/Network/ENetPeer.hpp +++ b/include/Nazara/Network/ENetPeer.hpp @@ -17,7 +17,7 @@ #ifndef NAZARA_ENETPEER_HPP #define NAZARA_ENETPEER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/ENetProtocol.hpp b/include/Nazara/Network/ENetProtocol.hpp index dab014aa2..d7312ee8f 100644 --- a/include/Nazara/Network/ENetProtocol.hpp +++ b/include/Nazara/Network/ENetProtocol.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ENETPROTOCOL_HPP #define NAZARA_ENETPROTOCOL_HPP -#include +#include #include #include diff --git a/include/Nazara/Network/IpAddress.hpp b/include/Nazara/Network/IpAddress.hpp index f5e1ca9d8..965ad924f 100644 --- a/include/Nazara/Network/IpAddress.hpp +++ b/include/Nazara/Network/IpAddress.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_IPADDRESS_HPP #define NAZARA_IPADDRESS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/NetBuffer.hpp b/include/Nazara/Network/NetBuffer.hpp index 0c05c53b2..d3a23bda3 100644 --- a/include/Nazara/Network/NetBuffer.hpp +++ b/include/Nazara/Network/NetBuffer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_NETBUFFER_HPP #define NAZARA_NETBUFFER_HPP -#include +#include namespace Nz { diff --git a/include/Nazara/Network/NetPacket.hpp b/include/Nazara/Network/NetPacket.hpp index 8de3d9258..62be3e990 100644 --- a/include/Nazara/Network/NetPacket.hpp +++ b/include/Nazara/Network/NetPacket.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_NETPACKET_HPP #define NAZARA_NETPACKET_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/Network.hpp b/include/Nazara/Network/Network.hpp index bcda5a83e..cf2e662f7 100644 --- a/include/Nazara/Network/Network.hpp +++ b/include/Nazara/Network/Network.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MODULENAME_HPP #define NAZARA_MODULENAME_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Network/RUdpConnection.hpp b/include/Nazara/Network/RUdpConnection.hpp index d04211d07..64a30c0b8 100644 --- a/include/Nazara/Network/RUdpConnection.hpp +++ b/include/Nazara/Network/RUdpConnection.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RUDPSERVER_HPP #define NAZARA_RUDPSERVER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/RUdpMessage.hpp b/include/Nazara/Network/RUdpMessage.hpp index d0c10197c..afd24e916 100644 --- a/include/Nazara/Network/RUdpMessage.hpp +++ b/include/Nazara/Network/RUdpMessage.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RUDMESSAGE_HPP #define NAZARA_RUDMESSAGE_HPP -#include +#include #include #include diff --git a/include/Nazara/Network/SocketHandle.hpp b/include/Nazara/Network/SocketHandle.hpp index be87e1da7..d0e09c6a0 100644 --- a/include/Nazara/Network/SocketHandle.hpp +++ b/include/Nazara/Network/SocketHandle.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SOCKETHANDLE_HPP #define NAZARA_SOCKETHANDLE_HPP -#include +#include #if defined(NAZARA_PLATFORM_WINDOWS) #include diff --git a/include/Nazara/Network/SocketPoller.hpp b/include/Nazara/Network/SocketPoller.hpp index 9e7d34a61..9a5af5452 100644 --- a/include/Nazara/Network/SocketPoller.hpp +++ b/include/Nazara/Network/SocketPoller.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SOCKETPOLLER_HPP #define NAZARA_SOCKETPOLLER_HPP -#include +#include #include #include diff --git a/include/Nazara/Network/TcpClient.hpp b/include/Nazara/Network/TcpClient.hpp index 8acdc0b5d..39ac2d9ac 100644 --- a/include/Nazara/Network/TcpClient.hpp +++ b/include/Nazara/Network/TcpClient.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TCPCLIENT_HPP #define NAZARA_TCPCLIENT_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Network/TcpServer.hpp b/include/Nazara/Network/TcpServer.hpp index 9eab2f0a3..6f26ed1f1 100644 --- a/include/Nazara/Network/TcpServer.hpp +++ b/include/Nazara/Network/TcpServer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TCPSERVER_HPP #define NAZARA_TCPSERVER_HPP -#include +#include #include #include diff --git a/include/Nazara/Network/UdpSocket.hpp b/include/Nazara/Network/UdpSocket.hpp index ec4228bd3..0b7c8d4d9 100644 --- a/include/Nazara/Network/UdpSocket.hpp +++ b/include/Nazara/Network/UdpSocket.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_UDPSOCKET_HPP #define NAZARA_UDPSOCKET_HPP -#include +#include #include #include diff --git a/include/Nazara/Noise/FBM.hpp b/include/Nazara/Noise/FBM.hpp index 3f573f630..743ab41fc 100644 --- a/include/Nazara/Noise/FBM.hpp +++ b/include/Nazara/Noise/FBM.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_FBM_HPP #define NAZARA_FBM_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Noise/HybridMultiFractal.hpp b/include/Nazara/Noise/HybridMultiFractal.hpp index 78d94f4de..da2456e40 100644 --- a/include/Nazara/Noise/HybridMultiFractal.hpp +++ b/include/Nazara/Noise/HybridMultiFractal.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_HYBRIDMULTIFRACTAL_HPP #define NAZARA_HYBRIDMULTIFRACTAL_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Noise/MixerBase.hpp b/include/Nazara/Noise/MixerBase.hpp index 06d658282..f509c0493 100644 --- a/include/Nazara/Noise/MixerBase.hpp +++ b/include/Nazara/Noise/MixerBase.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_MIXERBASE_HPP #define NAZARA_MIXERBASE_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Noise/Noise.hpp b/include/Nazara/Noise/Noise.hpp index 49ddcedd3..eb27d1a26 100644 --- a/include/Nazara/Noise/Noise.hpp +++ b/include/Nazara/Noise/Noise.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_NOISE_HPP #define NAZARA_NOISE_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Noise/NoiseBase.hpp b/include/Nazara/Noise/NoiseBase.hpp index dc57a6e40..e19339316 100644 --- a/include/Nazara/Noise/NoiseBase.hpp +++ b/include/Nazara/Noise/NoiseBase.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_NOISEBASE_HPP #define NAZARA_NOISEBASE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Noise/Perlin.hpp b/include/Nazara/Noise/Perlin.hpp index f5af29bcf..480af41bd 100644 --- a/include/Nazara/Noise/Perlin.hpp +++ b/include/Nazara/Noise/Perlin.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_PERLIN_HPP #define NAZARA_PERLIN_HPP -#include +#include #include #include diff --git a/include/Nazara/Noise/Simplex.hpp b/include/Nazara/Noise/Simplex.hpp index 90bab5ec5..cbe037821 100644 --- a/include/Nazara/Noise/Simplex.hpp +++ b/include/Nazara/Noise/Simplex.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_SIMPLEX_HPP #define NAZARA_SIMPLEX_HPP -#include +#include #include #include diff --git a/include/Nazara/Noise/Worley.hpp b/include/Nazara/Noise/Worley.hpp index 421f192a5..22e6b86e5 100644 --- a/include/Nazara/Noise/Worley.hpp +++ b/include/Nazara/Noise/Worley.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_WORLEY_HPP #define NAZARA_WORLEY_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Physics2D/Collider2D.hpp b/include/Nazara/Physics2D/Collider2D.hpp index 633d556a8..78e76d6d6 100644 --- a/include/Nazara/Physics2D/Collider2D.hpp +++ b/include/Nazara/Physics2D/Collider2D.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_COLLIDER2D_HPP #define NAZARA_COLLIDER2D_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Physics2D/Constraint2D.hpp b/include/Nazara/Physics2D/Constraint2D.hpp index 32d6ba719..9b2bf814b 100644 --- a/include/Nazara/Physics2D/Constraint2D.hpp +++ b/include/Nazara/Physics2D/Constraint2D.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CONSTRAINT2D_HPP #define NAZARA_CONSTRAINT2D_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Physics2D/PhysWorld2D.hpp b/include/Nazara/Physics2D/PhysWorld2D.hpp index e0fa516d3..e2ec3b042 100644 --- a/include/Nazara/Physics2D/PhysWorld2D.hpp +++ b/include/Nazara/Physics2D/PhysWorld2D.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PHYSWORLD2D_HPP #define NAZARA_PHYSWORLD2D_HPP -#include +#include #include #include #include @@ -54,6 +54,8 @@ namespace Nz float GetDamping() const; Vector2f GetGravity() const; cpSpace* GetHandle() const; + std::size_t GetIterationCount() const; + std::size_t GetMaxStepCount() const; float GetStepSize() const; bool NearestBodyQuery(const Vector2f& from, float maxDistance, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, RigidBody2D** nearestBody = nullptr); @@ -69,10 +71,14 @@ namespace Nz void SetDamping(float dampingValue); void SetGravity(const Vector2f& gravity); + void SetIterationCount(std::size_t iterationCount); + void SetMaxStepCount(std::size_t maxStepCount); void SetStepSize(float stepSize); void Step(float timestep); + void UseSpatialHash(float cellSize, std::size_t entityCount); + PhysWorld2D& operator=(const PhysWorld2D&) = delete; PhysWorld2D& operator=(PhysWorld2D&&) = delete; ///TODO @@ -140,6 +146,7 @@ namespace Nz static_assert(std::is_nothrow_move_constructible::value, "PostStepContainer should be noexcept MoveConstructible"); + std::size_t m_maxStepCount; std::unordered_map> m_callbacks; std::unordered_map m_rigidPostSteps; cpSpace* m_handle; diff --git a/include/Nazara/Physics2D/Physics2D.hpp b/include/Nazara/Physics2D/Physics2D.hpp index 73387980e..16547ffdc 100644 --- a/include/Nazara/Physics2D/Physics2D.hpp +++ b/include/Nazara/Physics2D/Physics2D.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PHYSICS2D_HPP #define NAZARA_PHYSICS2D_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Physics2D/RigidBody2D.hpp b/include/Nazara/Physics2D/RigidBody2D.hpp index 49df6a775..4ca95717f 100644 --- a/include/Nazara/Physics2D/RigidBody2D.hpp +++ b/include/Nazara/Physics2D/RigidBody2D.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RIGIDBODY2D_HPP #define NAZARA_RIGIDBODY2D_HPP -#include +#include #include #include #include @@ -36,6 +36,8 @@ namespace Nz void AddImpulse(const Vector2f& impulse, const Vector2f& point, CoordSys coordSys = CoordSys_Global); void AddTorque(float torque); + void EnableSimulation(bool simulation); + Rectf GetAABB() const; float GetAngularVelocity() const; Vector2f GetCenterOfGravity(CoordSys coordSys = CoordSys_Local) const; @@ -51,6 +53,7 @@ namespace Nz PhysWorld2D* GetWorld() const; bool IsKinematic() const; + bool IsSimulationEnabled() const; bool IsSleeping() const; bool IsStatic() const; @@ -76,6 +79,8 @@ namespace Nz private: cpBody* Create(float mass = 1.f, float moment = 1.f); void Destroy(); + void RegisterToSpace(); + void UnregisterFromSpace(); static void CopyBodyData(cpBody* from, cpBody* to); @@ -84,6 +89,8 @@ namespace Nz cpBody* m_handle; void* m_userData; PhysWorld2D* m_world; + bool m_isRegistered; + bool m_isSimulationEnabled; bool m_isStatic; float m_gravityFactor; float m_mass; diff --git a/include/Nazara/Physics3D/Collider3D.hpp b/include/Nazara/Physics3D/Collider3D.hpp index b7a5fe08c..b8a239349 100644 --- a/include/Nazara/Physics3D/Collider3D.hpp +++ b/include/Nazara/Physics3D/Collider3D.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_COLLIDER3D_HPP #define NAZARA_COLLIDER3D_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Physics3D/PhysWorld3D.hpp b/include/Nazara/Physics3D/PhysWorld3D.hpp index db6c5af00..cae9e4178 100644 --- a/include/Nazara/Physics3D/PhysWorld3D.hpp +++ b/include/Nazara/Physics3D/PhysWorld3D.hpp @@ -7,36 +7,74 @@ #ifndef NAZARA_PHYSWORLD_HPP #define NAZARA_PHYSWORLD_HPP -#include +#include +#include +#include #include #include +#include +class NewtonBody; +class NewtonJoint; +class NewtonMaterial; class NewtonWorld; namespace Nz { + class RigidBody3D; + class NAZARA_PHYSICS3D_API PhysWorld3D { public: + using BodyIterator = std::function; + using AABBOverlapCallback = std::function; + using CollisionCallback = std::function; + PhysWorld3D(); PhysWorld3D(const PhysWorld3D&) = delete; PhysWorld3D(PhysWorld3D&&) = delete; ///TODO ~PhysWorld3D(); + int CreateMaterial(Nz::String name = Nz::String()); + + void ForEachBodyInAABB(const Nz::Boxf& box, const BodyIterator& iterator); + Vector3f GetGravity() const; NewtonWorld* GetHandle() const; + int GetMaterial(const Nz::String& name); + std::size_t GetMaxStepCount() const; float GetStepSize() const; void SetGravity(const Vector3f& gravity); + void SetMaxStepCount(std::size_t maxStepCount); void SetSolverModel(unsigned int model); void SetStepSize(float stepSize); + void SetMaterialCollisionCallback(int firstMaterial, int secondMaterial, AABBOverlapCallback aabbOverlapCallback, CollisionCallback collisionCallback); + void SetMaterialDefaultCollidable(int firstMaterial, int secondMaterial, bool collidable); + void SetMaterialDefaultElasticity(int firstMaterial, int secondMaterial, float elasticCoef); + void SetMaterialDefaultFriction(int firstMaterial, int secondMaterial, float staticFriction, float kineticFriction); + void SetMaterialDefaultSoftness(int firstMaterial, int secondMaterial, float softness); + void SetMaterialSurfaceThickness(int firstMaterial, int secondMaterial, float thickness); + void Step(float timestep); PhysWorld3D& operator=(const PhysWorld3D&) = delete; PhysWorld3D& operator=(PhysWorld3D&&) = delete; ///TODO private: + struct Callback + { + AABBOverlapCallback aabbOverlapCallback; + CollisionCallback collisionCallback; + }; + + static int OnAABBOverlap(const NewtonMaterial* const material, const NewtonBody* const body0, const NewtonBody* const body1, int threadIndex); + static void ProcessContact(const NewtonJoint* const contact, float timestep, int threadIndex); + + std::unordered_map> m_callbacks; + std::unordered_map m_materialIds; + std::size_t m_maxStepCount; Vector3f m_gravity; NewtonWorld* m_world; float m_stepSize; diff --git a/include/Nazara/Physics3D/Physics3D.hpp b/include/Nazara/Physics3D/Physics3D.hpp index d97e7405d..2e1d98929 100644 --- a/include/Nazara/Physics3D/Physics3D.hpp +++ b/include/Nazara/Physics3D/Physics3D.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PHYSICS3D_HPP #define NAZARA_PHYSICS3D_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Physics3D/RigidBody3D.hpp b/include/Nazara/Physics3D/RigidBody3D.hpp index cb0128994..28f53536f 100644 --- a/include/Nazara/Physics3D/RigidBody3D.hpp +++ b/include/Nazara/Physics3D/RigidBody3D.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RIGIDBODY3D_HPP #define NAZARA_RIGIDBODY3D_HPP -#include +#include #include #include #include @@ -47,9 +47,11 @@ namespace Nz Vector3f GetLinearVelocity() const; float GetMass() const; Vector3f GetMassCenter(CoordSys coordSys = CoordSys_Local) const; + int GetMaterial() const; const Matrix4f& GetMatrix() const; Vector3f GetPosition() const; Quaternionf GetRotation() const; + void* GetUserdata() const; PhysWorld3D* GetWorld() const; bool IsAutoSleepEnabled() const; @@ -65,8 +67,11 @@ namespace Nz void SetLinearVelocity(const Vector3f& velocity); void SetMass(float mass); void SetMassCenter(const Vector3f& center); + void SetMaterial(const Nz::String& materialName); + void SetMaterial(int materialIndex); void SetPosition(const Vector3f& position); void SetRotation(const Quaternionf& rotation); + void SetUserdata(void* ud); RigidBody3D& operator=(const RigidBody3D& object); RigidBody3D& operator=(RigidBody3D&& object); @@ -82,6 +87,7 @@ namespace Nz Vector3f m_torqueAccumulator; NewtonBody* m_body; PhysWorld3D* m_world; + void* m_userdata; float m_gravityFactor; float m_mass; }; diff --git a/include/Nazara/Platform/Cursor.hpp b/include/Nazara/Platform/Cursor.hpp index 7cf5c979d..dc435cd94 100644 --- a/include/Nazara/Platform/Cursor.hpp +++ b/include/Nazara/Platform/Cursor.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CURSOR_HPP #define NAZARA_CURSOR_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Platform/CursorController.hpp b/include/Nazara/Platform/CursorController.hpp index 07c86e92b..8c4f8ed15 100644 --- a/include/Nazara/Platform/CursorController.hpp +++ b/include/Nazara/Platform/CursorController.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CURSORCONTROLLER_HPP #define NAZARA_CURSORCONTROLLER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Platform/EventHandler.hpp b/include/Nazara/Platform/EventHandler.hpp index b2390c35e..5aa12bae5 100644 --- a/include/Nazara/Platform/EventHandler.hpp +++ b/include/Nazara/Platform/EventHandler.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_EVENTHANDLER_HPP #define NAZARA_EVENTHANDLER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Platform/Icon.hpp b/include/Nazara/Platform/Icon.hpp index 7426cf265..85f89a5f4 100644 --- a/include/Nazara/Platform/Icon.hpp +++ b/include/Nazara/Platform/Icon.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ICON_HPP #define NAZARA_ICON_HPP -#include +#include #include #include diff --git a/include/Nazara/Platform/Joystick.hpp b/include/Nazara/Platform/Joystick.hpp index eb961b87d..a54f7c569 100644 --- a/include/Nazara/Platform/Joystick.hpp +++ b/include/Nazara/Platform/Joystick.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_JOYSTICK_HPP #define NAZARA_JOYSTICK_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Platform/Keyboard.hpp b/include/Nazara/Platform/Keyboard.hpp index df0513c2d..24c5c4b4b 100644 --- a/include/Nazara/Platform/Keyboard.hpp +++ b/include/Nazara/Platform/Keyboard.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_KEYBOARD_HPP #define NAZARA_KEYBOARD_HPP -#include +#include #include #include diff --git a/include/Nazara/Platform/Mouse.hpp b/include/Nazara/Platform/Mouse.hpp index 74af3a419..9a77179f9 100644 --- a/include/Nazara/Platform/Mouse.hpp +++ b/include/Nazara/Platform/Mouse.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_MOUSE_HPP #define NAZARA_MOUSE_HPP -#include +#include #include #include diff --git a/include/Nazara/Platform/Platform.hpp b/include/Nazara/Platform/Platform.hpp index 59a36ebc5..94a245220 100644 --- a/include/Nazara/Platform/Platform.hpp +++ b/include/Nazara/Platform/Platform.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PLATFORM_HPP #define NAZARA_PLATFORM_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Platform/VideoMode.hpp b/include/Nazara/Platform/VideoMode.hpp index 364da9488..663e5721b 100644 --- a/include/Nazara/Platform/VideoMode.hpp +++ b/include/Nazara/Platform/VideoMode.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_VIDEOMODE_HPP #define NAZARA_VIDEOMODE_HPP -#include +#include #include #include diff --git a/include/Nazara/Platform/Window.hpp b/include/Nazara/Platform/Window.hpp index 28c77d76f..7eb5f449a 100644 --- a/include/Nazara/Platform/Window.hpp +++ b/include/Nazara/Platform/Window.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_WINDOW_HPP #define NAZARA_WINDOW_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Platform/WindowHandle.hpp b/include/Nazara/Platform/WindowHandle.hpp index ea034d4e8..b0916498c 100644 --- a/include/Nazara/Platform/WindowHandle.hpp +++ b/include/Nazara/Platform/WindowHandle.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_WINDOWHANDLE_HPP #define NAZARA_WINDOWHANDLE_HPP -#include +#include #if defined(NAZARA_PLATFORM_X11) #include #endif diff --git a/include/Nazara/Prerequesites.hpp b/include/Nazara/Prerequisites.hpp similarity index 98% rename from include/Nazara/Prerequesites.hpp rename to include/Nazara/Prerequisites.hpp index 0ac6b0fae..765d14b52 100644 --- a/include/Nazara/Prerequesites.hpp +++ b/include/Nazara/Prerequisites.hpp @@ -22,8 +22,8 @@ SOFTWARE. */ -#ifndef NAZARA_PREREQUESITES_HPP -#define NAZARA_PREREQUESITES_HPP +#ifndef NAZARA_PREREQUISITES_HPP +#define NAZARA_PREREQUISITES_HPP // Try to identify the compiler #if defined(__BORLANDC__) @@ -179,4 +179,4 @@ namespace Nz typedef uint64_t UInt64; } -#endif // NAZARA_PREREQUESITES_HPP +#endif // NAZARA_PREREQUISITES_HPP diff --git a/include/Nazara/Renderer/DebugDrawer.hpp b/include/Nazara/Renderer/DebugDrawer.hpp index ad893cf35..a001b1bab 100644 --- a/include/Nazara/Renderer/DebugDrawer.hpp +++ b/include/Nazara/Renderer/DebugDrawer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DEBUGDRAWER_HPP #define NAZARA_DEBUGDRAWER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Renderer/GlslWriter.hpp b/include/Nazara/Renderer/GlslWriter.hpp index 3767846b9..c6194845f 100644 --- a/include/Nazara/Renderer/GlslWriter.hpp +++ b/include/Nazara/Renderer/GlslWriter.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_GLSLWRITER_HPP #define NAZARA_GLSLWRITER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Renderer/RenderStates.hpp b/include/Nazara/Renderer/RenderStates.hpp index dee9db808..642f9e93f 100644 --- a/include/Nazara/Renderer/RenderStates.hpp +++ b/include/Nazara/Renderer/RenderStates.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RENDERSTATES_HPP #define NAZARA_RENDERSTATES_HPP -#include +#include #include namespace Nz diff --git a/include/Nazara/Renderer/RenderWindow.hpp b/include/Nazara/Renderer/RenderWindow.hpp index b6bd9edf9..73dfa55a9 100644 --- a/include/Nazara/Renderer/RenderWindow.hpp +++ b/include/Nazara/Renderer/RenderWindow.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RENDERWINDOW_HPP #define NAZARA_RENDERWINDOW_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Renderer/Renderer.hpp b/include/Nazara/Renderer/Renderer.hpp index 3b88ad505..1f14c04c0 100644 --- a/include/Nazara/Renderer/Renderer.hpp +++ b/include/Nazara/Renderer/Renderer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_RENDERER_HPP #define NAZARA_RENDERER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Renderer/Shader.hpp b/include/Nazara/Renderer/Shader.hpp index 8db02e356..42e8ba26e 100644 --- a/include/Nazara/Renderer/Shader.hpp +++ b/include/Nazara/Renderer/Shader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SHADER_HPP #define NAZARA_SHADER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Renderer/ShaderAst.hpp b/include/Nazara/Renderer/ShaderAst.hpp index fd7c6dd30..856c5858c 100644 --- a/include/Nazara/Renderer/ShaderAst.hpp +++ b/include/Nazara/Renderer/ShaderAst.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SHADER_AST_HPP #define NAZARA_SHADER_AST_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Renderer/ShaderBuilder.hpp b/include/Nazara/Renderer/ShaderBuilder.hpp index 97eddde62..8b7b9a4df 100644 --- a/include/Nazara/Renderer/ShaderBuilder.hpp +++ b/include/Nazara/Renderer/ShaderBuilder.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SHADER_BUILDER_HPP #define NAZARA_SHADER_BUILDER_HPP -#include +#include #include #include diff --git a/include/Nazara/Renderer/ShaderWriter.hpp b/include/Nazara/Renderer/ShaderWriter.hpp index 13ef6e367..f20061e05 100644 --- a/include/Nazara/Renderer/ShaderWriter.hpp +++ b/include/Nazara/Renderer/ShaderWriter.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SHADERWRITER_HPP #define NAZARA_SHADERWRITER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Renderer/Texture.hpp b/include/Nazara/Renderer/Texture.hpp index 638d1da15..ef90efcf6 100644 --- a/include/Nazara/Renderer/Texture.hpp +++ b/include/Nazara/Renderer/Texture.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TEXTURE_HPP #define NAZARA_TEXTURE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/AbstractAtlas.hpp b/include/Nazara/Utility/AbstractAtlas.hpp index 95890a248..bb6c77c2f 100644 --- a/include/Nazara/Utility/AbstractAtlas.hpp +++ b/include/Nazara/Utility/AbstractAtlas.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTATLAS_HPP #define NAZARA_ABSTRACTATLAS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/AbstractImage.hpp b/include/Nazara/Utility/AbstractImage.hpp index 7bba13de1..e40ed7a5e 100644 --- a/include/Nazara/Utility/AbstractImage.hpp +++ b/include/Nazara/Utility/AbstractImage.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTIMAGE_HPP #define NAZARA_ABSTRACTIMAGE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/AbstractTextDrawer.hpp b/include/Nazara/Utility/AbstractTextDrawer.hpp index becb9dac6..2ef500aab 100644 --- a/include/Nazara/Utility/AbstractTextDrawer.hpp +++ b/include/Nazara/Utility/AbstractTextDrawer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ABSTRACTTEXTDRAWER_HPP #define NAZARA_ABSTRACTTEXTDRAWER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Algorithm.hpp b/include/Nazara/Utility/Algorithm.hpp index 9c275021d..339b5c681 100644 --- a/include/Nazara/Utility/Algorithm.hpp +++ b/include/Nazara/Utility/Algorithm.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ALGORITHM_UTILITY_HPP #define NAZARA_ALGORITHM_UTILITY_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Animation.hpp b/include/Nazara/Utility/Animation.hpp index 2e1753c6a..f714aa5a6 100644 --- a/include/Nazara/Utility/Animation.hpp +++ b/include/Nazara/Utility/Animation.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ANIMATION_HPP #define NAZARA_ANIMATION_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Buffer.hpp b/include/Nazara/Utility/Buffer.hpp index 526a153e4..1b7709efb 100644 --- a/include/Nazara/Utility/Buffer.hpp +++ b/include/Nazara/Utility/Buffer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_BUFFER_HPP #define NAZARA_BUFFER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Font.hpp b/include/Nazara/Utility/Font.hpp index 643120aab..7f1a411cd 100644 --- a/include/Nazara/Utility/Font.hpp +++ b/include/Nazara/Utility/Font.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_FONT_HPP #define NAZARA_FONT_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/FontData.hpp b/include/Nazara/Utility/FontData.hpp index 5b0868e3c..efd2e6d94 100644 --- a/include/Nazara/Utility/FontData.hpp +++ b/include/Nazara/Utility/FontData.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FONTDATA_HPP #define NAZARA_FONTDATA_HPP -#include +#include #include #include diff --git a/include/Nazara/Utility/Formats/MD5AnimParser.hpp b/include/Nazara/Utility/Formats/MD5AnimParser.hpp index ca61876b3..98f209aaf 100644 --- a/include/Nazara/Utility/Formats/MD5AnimParser.hpp +++ b/include/Nazara/Utility/Formats/MD5AnimParser.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORMATS_MD5ANIMPARSER_HPP #define NAZARA_FORMATS_MD5ANIMPARSER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Formats/MD5MeshParser.hpp b/include/Nazara/Utility/Formats/MD5MeshParser.hpp index 880236ac4..8f3165fc8 100644 --- a/include/Nazara/Utility/Formats/MD5MeshParser.hpp +++ b/include/Nazara/Utility/Formats/MD5MeshParser.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORMATS_MD5MESHPARSER_HPP #define NAZARA_FORMATS_MD5MESHPARSER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Formats/MTLParser.hpp b/include/Nazara/Utility/Formats/MTLParser.hpp index 272d67062..0cacd0886 100644 --- a/include/Nazara/Utility/Formats/MTLParser.hpp +++ b/include/Nazara/Utility/Formats/MTLParser.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORMATS_MTLPARSER_HPP #define NAZARA_FORMATS_MTLPARSER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Formats/OBJParser.hpp b/include/Nazara/Utility/Formats/OBJParser.hpp index 86b0e9f12..91c82e4d9 100644 --- a/include/Nazara/Utility/Formats/OBJParser.hpp +++ b/include/Nazara/Utility/Formats/OBJParser.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORMATS_OBJPARSER_HPP #define NAZARA_FORMATS_OBJPARSER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/GuillotineImageAtlas.hpp b/include/Nazara/Utility/GuillotineImageAtlas.hpp index 739328dc6..5a1633113 100644 --- a/include/Nazara/Utility/GuillotineImageAtlas.hpp +++ b/include/Nazara/Utility/GuillotineImageAtlas.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_GUILLOTINEIMAGEATLAS_HPP #define NAZARA_GUILLOTINEIMAGEATLAS_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Image.hpp b/include/Nazara/Utility/Image.hpp index 53c3efbb4..ccefd2fee 100644 --- a/include/Nazara/Utility/Image.hpp +++ b/include/Nazara/Utility/Image.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_IMAGE_HPP #define NAZARA_IMAGE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/IndexBuffer.hpp b/include/Nazara/Utility/IndexBuffer.hpp index 2c66bc6ed..7feee06e8 100644 --- a/include/Nazara/Utility/IndexBuffer.hpp +++ b/include/Nazara/Utility/IndexBuffer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_INDEXBUFFER_HPP #define NAZARA_INDEXBUFFER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/IndexIterator.hpp b/include/Nazara/Utility/IndexIterator.hpp index 63f9d96b9..3733e48ab 100644 --- a/include/Nazara/Utility/IndexIterator.hpp +++ b/include/Nazara/Utility/IndexIterator.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_INDEXITERATOR_HPP #define NAZARA_INDEXITERATOR_HPP -#include +#include namespace Nz { diff --git a/include/Nazara/Utility/IndexMapper.hpp b/include/Nazara/Utility/IndexMapper.hpp index fe7ab318c..6ac654194 100644 --- a/include/Nazara/Utility/IndexMapper.hpp +++ b/include/Nazara/Utility/IndexMapper.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_INDEXMAPPER_HPP #define NAZARA_INDEXMAPPER_HPP -#include +#include #include #include diff --git a/include/Nazara/Utility/Joint.hpp b/include/Nazara/Utility/Joint.hpp index fad4b3d22..261530a3c 100644 --- a/include/Nazara/Utility/Joint.hpp +++ b/include/Nazara/Utility/Joint.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_JOINT_HPP #define NAZARA_JOINT_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Mesh.hpp b/include/Nazara/Utility/Mesh.hpp index ca0971aa2..0848ee2fb 100644 --- a/include/Nazara/Utility/Mesh.hpp +++ b/include/Nazara/Utility/Mesh.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MESH_HPP #define NAZARA_MESH_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Node.hpp b/include/Nazara/Utility/Node.hpp index 22a96eed2..6065d1e04 100644 --- a/include/Nazara/Utility/Node.hpp +++ b/include/Nazara/Utility/Node.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_NODE_HPP #define NAZARA_NODE_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/PixelFormat.hpp b/include/Nazara/Utility/PixelFormat.hpp index f6c3a36a4..317a9b228 100644 --- a/include/Nazara/Utility/PixelFormat.hpp +++ b/include/Nazara/Utility/PixelFormat.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_PIXELFORMAT_HPP #define NAZARA_PIXELFORMAT_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/SimpleTextDrawer.hpp b/include/Nazara/Utility/SimpleTextDrawer.hpp index 90b501690..d3c3bd9cc 100644 --- a/include/Nazara/Utility/SimpleTextDrawer.hpp +++ b/include/Nazara/Utility/SimpleTextDrawer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SIMPLETEXTDRAWER_HPP #define NAZARA_SIMPLETEXTDRAWER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/SkeletalMesh.hpp b/include/Nazara/Utility/SkeletalMesh.hpp index 0dc436588..d1f652e85 100644 --- a/include/Nazara/Utility/SkeletalMesh.hpp +++ b/include/Nazara/Utility/SkeletalMesh.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SKELETALMESH_HPP #define NAZARA_SKELETALMESH_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/Skeleton.hpp b/include/Nazara/Utility/Skeleton.hpp index f2c2fb5a8..75341b9d7 100644 --- a/include/Nazara/Utility/Skeleton.hpp +++ b/include/Nazara/Utility/Skeleton.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SKELETON_HPP #define NAZARA_SKELETON_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/SoftwareBuffer.hpp b/include/Nazara/Utility/SoftwareBuffer.hpp index f199a9a8e..0c792a4c2 100644 --- a/include/Nazara/Utility/SoftwareBuffer.hpp +++ b/include/Nazara/Utility/SoftwareBuffer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SOFTWAREBUFFER_HPP #define NAZARA_SOFTWAREBUFFER_HPP -#include +#include #include #include diff --git a/include/Nazara/Utility/StaticMesh.hpp b/include/Nazara/Utility/StaticMesh.hpp index 125af6301..395713835 100644 --- a/include/Nazara/Utility/StaticMesh.hpp +++ b/include/Nazara/Utility/StaticMesh.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_STATICMESH_HPP #define NAZARA_STATICMESH_HPP -#include +#include #include #include diff --git a/include/Nazara/Utility/SubMesh.hpp b/include/Nazara/Utility/SubMesh.hpp index c3c6e4dbb..54c948f89 100644 --- a/include/Nazara/Utility/SubMesh.hpp +++ b/include/Nazara/Utility/SubMesh.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SUBMESH_HPP #define NAZARA_SUBMESH_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/TriangleIterator.hpp b/include/Nazara/Utility/TriangleIterator.hpp index 8bf17a2eb..6263112e4 100644 --- a/include/Nazara/Utility/TriangleIterator.hpp +++ b/include/Nazara/Utility/TriangleIterator.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TRIANGLEITERATOR_HPP #define NAZARA_TRIANGLEITERATOR_HPP -#include +#include #include #include diff --git a/include/Nazara/Utility/Utility.hpp b/include/Nazara/Utility/Utility.hpp index 8f4556de6..46d5e0f08 100644 --- a/include/Nazara/Utility/Utility.hpp +++ b/include/Nazara/Utility/Utility.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_UTILITY_HPP #define NAZARA_UTILITY_HPP -#include +#include #include #include diff --git a/include/Nazara/Utility/VertexBuffer.hpp b/include/Nazara/Utility/VertexBuffer.hpp index 8f5b608e2..ca9a20a10 100644 --- a/include/Nazara/Utility/VertexBuffer.hpp +++ b/include/Nazara/Utility/VertexBuffer.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_VERTEXBUFFER_HPP #define NAZARA_VERTEXBUFFER_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/VertexDeclaration.hpp b/include/Nazara/Utility/VertexDeclaration.hpp index 1490857cf..536707e17 100644 --- a/include/Nazara/Utility/VertexDeclaration.hpp +++ b/include/Nazara/Utility/VertexDeclaration.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_VERTEXDECLARATION_HPP #define NAZARA_VERTEXDECLARATION_HPP -#include +#include #include #include #include diff --git a/include/Nazara/Utility/VertexMapper.hpp b/include/Nazara/Utility/VertexMapper.hpp index 050bdf500..1b0bfbf3a 100644 --- a/include/Nazara/Utility/VertexMapper.hpp +++ b/include/Nazara/Utility/VertexMapper.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_VERTEXMAPPER_HPP #define NAZARA_VERTEXMAPPER_HPP -#include +#include #include #include #include diff --git a/readme.md b/readme.md index 2c470a751..b35253f90 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ Platform | Build Status | Nightlies ------------ | ------------- | ------------- -Windows | [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/dj5qx7axym4uakmy/branch/master?svg=true)](https://ci.appveyor.com/project/DrLynix/nazaraengine/branch/master) | MSVC14: [x86](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20Win32) [x86_64](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20x64) +Windows | [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/rqxfj343mh3ab2we/branch/master?svg=true)](https://ci.appveyor.com/project/DrLynix/nazaraengine/branch/master) | MSVC14: [x86](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20Win32) [x86_64](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20x64) Linux | [![Travis CI Build Status](https://travis-ci.org/DigitalPulseSoftware/NazaraEngine.svg?branch=master)](https://travis-ci.org/DigitalPulseSoftware/NazaraEngine) | No # Nazara Engine @@ -15,7 +15,7 @@ You can use it in any kind of commercial/non-commercial applications without any ## Authors Jérôme "Lynix" Leclercq - main developper () -Rémi "overdrivr" Bèges - developper & helper - Noise Module - () +Full Cycle Games - sponsor and contributor since January 2017. ## Install @@ -39,13 +39,14 @@ You can find tutorials on installation, compilation and use on the [official wik [Website](https://nazara.digitalpulsesoftware.net) [Documentation](https://nazara.digitalpulsesoftware.net/doc) -[Mattermost](https://mattermost.digitalpulsesoftware.net) +[Discord](https://discord.gg/MvwNx73) [Wiki](https://github.com/DigitalPulseSoftware/NazaraEngine/wiki) [Forum](https://forum.digitalpulsesoftware.net) ## Thanks to: -- **RafBill** and **Raakz:** Finding bugs and/or testing -- **Fissal "DrFisher" Hannoun**: Helping a lot in architecture design -- **Alexandre "Danman" Janniaux**: Helping making the POSIX implementation +- **RafBill** and **Raakz:** Finding bugs and/or testing. +- **Fissal "DrFisher" Hannoun**: Helping a lot in architecture design. +- **Alexandre "Danman" Janniaux**: Helping making the POSIX implementation. - **Youri "Gawaboumga" Hubaut**: Improving the whole project by making the documentation, improving the code, and more. +- **Rémi "overdrivr" Bèges**: Made the Noise module. diff --git a/readme_fr.md b/readme_fr.md index 639ef666c..ef57f0448 100644 --- a/readme_fr.md +++ b/readme_fr.md @@ -1,6 +1,6 @@ Platforme | Build Status | Nightlies ------------ | ------------- | ------------- -Windows | [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/dj5qx7axym4uakmy/branch/master?svg=true)](https://ci.appveyor.com/project/DrLynix/nazaraengine/branch/master) | MSVC14: [x86](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20Win32) [x86_64](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20x64) +Windows | [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/rqxfj343mh3ab2we/branch/master?svg=true)](https://ci.appveyor.com/project/DrLynix/nazaraengine/branch/master) | MSVC14: [x86](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20Win32) [x86_64](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20x64) Linux | [![Travis CI Build Status](https://travis-ci.org/DigitalPulseSoftware/NazaraEngine.svg?branch=master)](https://travis-ci.org/DigitalPulseSoftware/NazaraEngine) | Non # Nazara Engine @@ -15,7 +15,7 @@ Vous pouvez également l'utiliser pour toute application commerciale sans aucune ## Auteurs Jérôme "Lynix" Leclercq - développeur principal () -Rémi "overdrivr" Bèges - développeur & aide - module Noise - () +Full Cycle Games - sponsor et contributeur depuis Janvier 2017. ## Installation @@ -39,13 +39,14 @@ Vous pouvez lire des tutoriaux sur l'installation, la compilation et l'utilisati [Website](https://nazara.digitalpulsesoftware.net) [Documentation](https://nazara.digitalpulsesoftware.net/doc) -[Mattermost](https://mattermost.digitalpulsesoftware.net) +[Discord](https://discord.gg/MvwNx73) [Wiki](https://github.com/DigitalPulseSoftware/NazaraEngine/wiki) [Forum](https://forum.digitalpulsesoftware.net) ### Remerciements: -- **RafBill** et **Raakz:** Recherche de bugs et/ou tests -- **Fissal "DrFisher" Hannoun**: Aide et conseils lors de la conception de l'architecture du moteur -- **Alexandre "Danman" Janniaux**: Aide sur l'implémentation POSIX +- **RafBill** et **Raakz:** Recherche de bugs et/ou tests. +- **Fissal "DrFisher" Hannoun**: Aide et conseils lors de la conception de l'architecture du moteur. +- **Alexandre "Danman" Janniaux**: Aide sur l'implémentation POSIX. - **Youri "Gawaboumga" Hubaut**: Amélioration du moteur tant au niveau du code que de sa documentation et du projet en général. +- **Rémi "overdrivr" Bèges**: Développement du module Noise. diff --git a/src/Nazara/Audio/Formats/sndfileLoader.hpp b/src/Nazara/Audio/Formats/sndfileLoader.hpp index 724b5a5fe..1d39c8b11 100644 --- a/src/Nazara/Audio/Formats/sndfileLoader.hpp +++ b/src/Nazara/Audio/Formats/sndfileLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_SNDFILE_HPP #define NAZARA_LOADERS_SNDFILE_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Core/Clock.cpp b/src/Nazara/Core/Clock.cpp index 92183674c..13554a1fa 100644 --- a/src/Nazara/Core/Clock.cpp +++ b/src/Nazara/Core/Clock.cpp @@ -67,7 +67,7 @@ namespace Nz */ float Clock::GetSeconds() const { - return GetMicroseconds()/1000000.f; + return GetMicroseconds()/1'000'000.f; } /*! @@ -132,15 +132,26 @@ namespace Nz /*! * \brief Restart the clock + * \return Microseconds elapsed + * * Restarts the clock, putting it's time counter back to zero (as if the clock got constructed). + * It also compute the elapsed microseconds since the last Restart() call without any time loss (a problem that the combination of GetElapsedMicroseconds and Restart have). */ - void Clock::Restart() + UInt64 Clock::Restart() { NazaraLock(m_mutex); + Nz::UInt64 now = GetElapsedMicroseconds(); + + Nz::UInt64 elapsedTime = m_elapsedTime; + if (!m_paused) + elapsedTime += (now - m_refTime); + m_elapsedTime = 0; - m_refTime = GetElapsedMicroseconds(); + m_refTime = now; m_paused = false; + + return elapsedTime; } /*! diff --git a/src/Nazara/Core/Hash/SHA/Internal.hpp b/src/Nazara/Core/Hash/SHA/Internal.hpp index 35171eeb9..a4544f309 100644 --- a/src/Nazara/Core/Hash/SHA/Internal.hpp +++ b/src/Nazara/Core/Hash/SHA/Internal.hpp @@ -42,7 +42,7 @@ #ifndef NAZARA_HASH_SHA2_INTERNAL_HPP #define NAZARA_HASH_SHA2_INTERNAL_HPP -#include +#include /* Digest lengths for SHA-1/224/256/384/512 */ #define SHA1_DIGEST_LENGTH 20 diff --git a/src/Nazara/Core/Posix/ClockImpl.hpp b/src/Nazara/Core/Posix/ClockImpl.hpp index 552a00bf6..5a4fd18e4 100644 --- a/src/Nazara/Core/Posix/ClockImpl.hpp +++ b/src/Nazara/Core/Posix/ClockImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CLOCKIMPL_POSIX_HPP #define NAZARA_CLOCKIMPL_POSIX_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Core/Posix/ConditionVariableImpl.hpp b/src/Nazara/Core/Posix/ConditionVariableImpl.hpp index a5dea1e8b..e5da2d984 100644 --- a/src/Nazara/Core/Posix/ConditionVariableImpl.hpp +++ b/src/Nazara/Core/Posix/ConditionVariableImpl.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_CONDITIONVARIABLEIMPL_HPP #define NAZARA_CONDITIONVARIABLEIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Core/Posix/DirectoryImpl.hpp b/src/Nazara/Core/Posix/DirectoryImpl.hpp index af857fada..50d1b96aa 100644 --- a/src/Nazara/Core/Posix/DirectoryImpl.hpp +++ b/src/Nazara/Core/Posix/DirectoryImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DIRECTORYIMPL_HPP #define NAZARA_DIRECTORYIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Core/Posix/FileImpl.hpp b/src/Nazara/Core/Posix/FileImpl.hpp index cf396e0fa..ef519eda0 100644 --- a/src/Nazara/Core/Posix/FileImpl.hpp +++ b/src/Nazara/Core/Posix/FileImpl.hpp @@ -11,7 +11,7 @@ #define _LARGEFILE64_SOURCE #endif -#include +#include #include #include diff --git a/src/Nazara/Core/Posix/HardwareInfoImpl.hpp b/src/Nazara/Core/Posix/HardwareInfoImpl.hpp index fec00ec93..fab07f2a7 100644 --- a/src/Nazara/Core/Posix/HardwareInfoImpl.hpp +++ b/src/Nazara/Core/Posix/HardwareInfoImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HARDWAREINFOIMPL_POSIX_HPP #define NAZARA_HARDWAREINFOIMPL_POSIX_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Core/Posix/SemaphoreImpl.hpp b/src/Nazara/Core/Posix/SemaphoreImpl.hpp index c1dedc6b9..367d35811 100644 --- a/src/Nazara/Core/Posix/SemaphoreImpl.hpp +++ b/src/Nazara/Core/Posix/SemaphoreImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SEMAPHOREIMPL_HPP #define NAZARA_SEMAPHOREIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Core/Posix/TaskSchedulerImpl.hpp b/src/Nazara/Core/Posix/TaskSchedulerImpl.hpp index 43ce552b6..405216286 100644 --- a/src/Nazara/Core/Posix/TaskSchedulerImpl.hpp +++ b/src/Nazara/Core/Posix/TaskSchedulerImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TASKSCHEDULERIMPL_HPP #define NAZARA_TASKSCHEDULERIMPL_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Core/Posix/ThreadImpl.hpp b/src/Nazara/Core/Posix/ThreadImpl.hpp index fe3e593fe..f8c024cb5 100644 --- a/src/Nazara/Core/Posix/ThreadImpl.hpp +++ b/src/Nazara/Core/Posix/ThreadImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_THREADIMPL_HPP #define NAZARA_THREADIMPL_HPP -#include +#include #if defined(__GNUC__) && !defined(_GNU_SOURCE) #define _GNU_SOURCE diff --git a/src/Nazara/Core/Win32/ClockImpl.hpp b/src/Nazara/Core/Win32/ClockImpl.hpp index 46411b68b..5a234e674 100644 --- a/src/Nazara/Core/Win32/ClockImpl.hpp +++ b/src/Nazara/Core/Win32/ClockImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CLOCKIMPL_WINDOWS_HPP #define NAZARA_CLOCKIMPL_WINDOWS_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Core/Win32/ConditionVariableImpl.hpp b/src/Nazara/Core/Win32/ConditionVariableImpl.hpp index 36b559ff3..852241ae3 100644 --- a/src/Nazara/Core/Win32/ConditionVariableImpl.hpp +++ b/src/Nazara/Core/Win32/ConditionVariableImpl.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_CONDITIONVARIABLEIMPL_HPP #define NAZARA_CONDITIONVARIABLEIMPL_HPP -#include +#include #include #include diff --git a/src/Nazara/Core/Win32/DirectoryImpl.hpp b/src/Nazara/Core/Win32/DirectoryImpl.hpp index 141d4070c..358910be4 100644 --- a/src/Nazara/Core/Win32/DirectoryImpl.hpp +++ b/src/Nazara/Core/Win32/DirectoryImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DIRECTORYIMPL_HPP #define NAZARA_DIRECTORYIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Core/Win32/DynLibImpl.hpp b/src/Nazara/Core/Win32/DynLibImpl.hpp index e61969e84..c9d88d57d 100644 --- a/src/Nazara/Core/Win32/DynLibImpl.hpp +++ b/src/Nazara/Core/Win32/DynLibImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_DYNLIBIMPL_HPP #define NAZARA_DYNLIBIMPL_HPP -#include +#include #include #include diff --git a/src/Nazara/Core/Win32/FileImpl.hpp b/src/Nazara/Core/Win32/FileImpl.hpp index 000835f6f..6595c58b2 100644 --- a/src/Nazara/Core/Win32/FileImpl.hpp +++ b/src/Nazara/Core/Win32/FileImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FILEIMPL_HPP #define NAZARA_FILEIMPL_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Core/Win32/HardwareInfoImpl.hpp b/src/Nazara/Core/Win32/HardwareInfoImpl.hpp index f876cefb9..e3f4d612d 100644 --- a/src/Nazara/Core/Win32/HardwareInfoImpl.hpp +++ b/src/Nazara/Core/Win32/HardwareInfoImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_HARDWAREINFOIMPL_WINDOWS_HPP #define NAZARA_HARDWAREINFOIMPL_WINDOWS_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Core/Win32/MutexImpl.hpp b/src/Nazara/Core/Win32/MutexImpl.hpp index ac9717846..e411d4fa2 100644 --- a/src/Nazara/Core/Win32/MutexImpl.hpp +++ b/src/Nazara/Core/Win32/MutexImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_MUTEXIMPL_HPP #define NAZARA_MUTEXIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Core/Win32/SemaphoreImpl.hpp b/src/Nazara/Core/Win32/SemaphoreImpl.hpp index a78b2328f..3dad0d9a3 100644 --- a/src/Nazara/Core/Win32/SemaphoreImpl.hpp +++ b/src/Nazara/Core/Win32/SemaphoreImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SEMAPHOREIMPL_HPP #define NAZARA_SEMAPHOREIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Core/Win32/TaskSchedulerImpl.hpp b/src/Nazara/Core/Win32/TaskSchedulerImpl.hpp index 59dc79c73..fa41d6e71 100644 --- a/src/Nazara/Core/Win32/TaskSchedulerImpl.hpp +++ b/src/Nazara/Core/Win32/TaskSchedulerImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_TASKSCHEDULERIMPL_HPP #define NAZARA_TASKSCHEDULERIMPL_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Core/Win32/ThreadImpl.cpp b/src/Nazara/Core/Win32/ThreadImpl.cpp index 134e5472a..4dd557536 100644 --- a/src/Nazara/Core/Win32/ThreadImpl.cpp +++ b/src/Nazara/Core/Win32/ThreadImpl.cpp @@ -11,6 +11,7 @@ namespace Nz { +#ifdef NAZARA_COMPILER_MSVC namespace { #pragma pack(push,8) @@ -23,6 +24,7 @@ namespace Nz }; #pragma pack(pop) } +#endif ThreadImpl::ThreadImpl(Functor* functor) { diff --git a/src/Nazara/Core/Win32/ThreadImpl.hpp b/src/Nazara/Core/Win32/ThreadImpl.hpp index 8070f7a22..8bc25930d 100644 --- a/src/Nazara/Core/Win32/ThreadImpl.hpp +++ b/src/Nazara/Core/Win32/ThreadImpl.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_THREADIMPL_HPP #define NAZARA_THREADIMPL_HPP -#include +#include #include #include diff --git a/src/Nazara/Core/Win32/Time.hpp b/src/Nazara/Core/Win32/Time.hpp index 9ad8a7aa6..25ac664c1 100644 --- a/src/Nazara/Core/Win32/Time.hpp +++ b/src/Nazara/Core/Win32/Time.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_WINDOWS_TIME_HPP #define NAZARA_WINDOWS_TIME_HPP -#include +#include #include #include diff --git a/src/Nazara/Graphics/Formats/MeshLoader.hpp b/src/Nazara/Graphics/Formats/MeshLoader.hpp index 215e19c44..558d3dfb3 100644 --- a/src/Nazara/Graphics/Formats/MeshLoader.hpp +++ b/src/Nazara/Graphics/Formats/MeshLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_MESH_HPP #define NAZARA_LOADERS_MESH_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Graphics/Formats/TextureLoader.hpp b/src/Nazara/Graphics/Formats/TextureLoader.hpp index f068aeb5d..483d69546 100644 --- a/src/Nazara/Graphics/Formats/TextureLoader.hpp +++ b/src/Nazara/Graphics/Formats/TextureLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_TEXTURE_HPP #define NAZARA_LOADERS_TEXTURE_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index 64eedf502..85567df81 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,6 @@ namespace Nz m_state = lua_newstate(MemoryAllocator, this); lua_atpanic(m_state, AtPanic); lua_sethook(m_state, TimeLimiter, LUA_MASKCOUNT, 1000); - luaL_openlibs(m_state); } LuaInstance::LuaInstance(LuaInstance&& instance) : @@ -60,6 +60,48 @@ namespace Nz lua_close(m_state); } + void LuaInstance::LoadLibraries(LuaLibFlags libFlags) + { + // From luaL_openlibs + std::array libs; + std::size_t libCount = 0; + + libs[libCount++] = { "_G", luaopen_base }; + + if (libFlags & LuaLib_Coroutine) + libs[libCount++] = { LUA_COLIBNAME, luaopen_coroutine }; + + if (libFlags & LuaLib_Debug) + libs[libCount++] = { LUA_DBLIBNAME, luaopen_debug }; + + if (libFlags & LuaLib_Io) + libs[libCount++] = { LUA_IOLIBNAME, luaopen_io }; + + if (libFlags & LuaLib_Math) + libs[libCount++] = { LUA_MATHLIBNAME, luaopen_math }; + + if (libFlags & LuaLib_Os) + libs[libCount++] = { LUA_OSLIBNAME, luaopen_os }; + + if (libFlags & LuaLib_Package) + libs[libCount++] = { LUA_LOADLIBNAME, luaopen_package }; + + if (libFlags & LuaLib_String) + libs[libCount++] = { LUA_STRLIBNAME, luaopen_string }; + + if (libFlags & LuaLib_Table) + libs[libCount++] = { LUA_TABLIBNAME, luaopen_table }; + + if (libFlags & LuaLib_Utf8) + libs[libCount++] = { LUA_UTF8LIBNAME, luaopen_utf8 }; + + for (std::size_t i = 0; i < libCount; ++i) + { + luaL_requiref(m_state, libs[i].name, libs[i].func, 1); + lua_pop(m_state, 1); /* remove lib */ + } + } + LuaInstance& LuaInstance::operator=(LuaInstance&& instance) { LuaState::operator=(std::move(instance)); diff --git a/src/Nazara/Network/Win32/IpAddressImpl.cpp b/src/Nazara/Network/Win32/IpAddressImpl.cpp index 992b075a9..257e50cf6 100644 --- a/src/Nazara/Network/Win32/IpAddressImpl.cpp +++ b/src/Nazara/Network/Win32/IpAddressImpl.cpp @@ -9,6 +9,15 @@ #include #include +// some MinGW distributions seem to lack some defines +#ifndef ERROR_NOT_ENOUGH_MEMORY +#define ERROR_NOT_ENOUGH_MEMORY 8L +#endif + +#ifndef WSA_NOT_ENOUGH_MEMORY +#define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY) +#endif + namespace Nz { namespace Detail diff --git a/src/Nazara/Network/Win32/SocketImpl.cpp b/src/Nazara/Network/Win32/SocketImpl.cpp index b410af93c..b14202cc7 100644 --- a/src/Nazara/Network/Win32/SocketImpl.cpp +++ b/src/Nazara/Network/Win32/SocketImpl.cpp @@ -8,8 +8,15 @@ #include #include -#if defined(NAZARA_COMPILER_MINGW) && __GNUC__ < 5 -// Some compilers (olders versions of MinGW) are lacking Mstcpip.h which defines the following struct/#define +// Some compilers (older versions of MinGW) lack Mstcpip.h which defines some structs/defines +#if defined(__has_include) + #define NZ_HAS_MSTCPIP_HEADER __has_include() +#else + // If this version of MinGW doesn't support __has_include, assume it hasn't Mstcpip.h + #define NZ_HAS_MSTCPIP_HEADER !defined(NAZARA_COMPILER_MINGW) +#endif + +#if NZ_HAS_MSTCPIP_HEADER struct tcp_keepalive { u_long onoff; diff --git a/src/Nazara/Network/Win32/SocketPollerImpl.cpp b/src/Nazara/Network/Win32/SocketPollerImpl.cpp index 43dc9fec2..658e86c8e 100644 --- a/src/Nazara/Network/Win32/SocketPollerImpl.cpp +++ b/src/Nazara/Network/Win32/SocketPollerImpl.cpp @@ -37,7 +37,7 @@ namespace Nz #if NAZARA_NETWORK_POLL_SUPPORT return m_readyToReadSockets.count(socket) != 0; #else - return FD_ISSET(socket, &m_readyToReadSockets) != 0; + return FD_ISSET(socket, const_cast(&m_readyToReadSockets)) != 0; //< FD_ISSET is not const-correct #endif } @@ -46,7 +46,7 @@ namespace Nz #if NAZARA_NETWORK_POLL_SUPPORT return m_readyToWriteSockets.count(socket) != 0; #else - return FD_ISSET(socket, &m_readyToWriteSockets) != 0; + return FD_ISSET(socket, const_cast(&m_readyToWriteSockets)) != 0; //< FD_ISSET is not const-correct #endif } @@ -55,8 +55,9 @@ namespace Nz #if NAZARA_NETWORK_POLL_SUPPORT return m_allSockets.count(socket) != 0; #else - return FD_ISSET(socket, &m_readSockets) != 0 || - FD_ISSET(socket, &m_writeSockets) != 0; + // FD_ISSET is not const-correct + return FD_ISSET(socket, const_cast(&m_readSockets)) != 0 || + FD_ISSET(socket, const_cast(&m_writeSockets)) != 0; #endif } diff --git a/src/Nazara/Physics2D/PhysWorld2D.cpp b/src/Nazara/Physics2D/PhysWorld2D.cpp index c0db3749f..807c0e7cc 100644 --- a/src/Nazara/Physics2D/PhysWorld2D.cpp +++ b/src/Nazara/Physics2D/PhysWorld2D.cpp @@ -80,6 +80,7 @@ namespace Nz } PhysWorld2D::PhysWorld2D() : + m_maxStepCount(50), m_stepSize(0.005f), m_timestepAccumulator(0.f) { @@ -144,6 +145,16 @@ namespace Nz return m_handle; } + std::size_t PhysWorld2D::GetIterationCount() const + { + return cpSpaceGetIterations(m_handle); + } + + std::size_t PhysWorld2D::GetMaxStepCount() const + { + return m_maxStepCount; + } + float PhysWorld2D::GetStepSize() const { return m_stepSize; @@ -281,6 +292,16 @@ namespace Nz cpSpaceSetGravity(m_handle, cpv(gravity.x, gravity.y)); } + void PhysWorld2D::SetIterationCount(std::size_t iterationCount) + { + cpSpaceSetIterations(m_handle, int(iterationCount)); + } + + void PhysWorld2D::SetMaxStepCount(std::size_t maxStepCount) + { + m_maxStepCount = maxStepCount; + } + void PhysWorld2D::SetStepSize(float stepSize) { m_stepSize = stepSize; @@ -290,7 +311,8 @@ namespace Nz { m_timestepAccumulator += timestep; - while (m_timestepAccumulator >= m_stepSize) + std::size_t stepCount = 0; + while (m_timestepAccumulator >= m_stepSize && stepCount < m_maxStepCount) { OnPhysWorld2DPreStep(this); @@ -309,9 +331,15 @@ namespace Nz } m_timestepAccumulator -= m_stepSize; + stepCount++; } } + void PhysWorld2D::UseSpatialHash(float cellSize, std::size_t entityCount) + { + cpSpaceUseSpatialHash(m_handle, cpFloat(cellSize), int(entityCount)); + } + void PhysWorld2D::InitCallbacks(cpCollisionHandler* handler, const Callback& callbacks) { auto it = m_callbacks.emplace(handler, std::make_unique(callbacks)).first; diff --git a/src/Nazara/Physics2D/RigidBody2D.cpp b/src/Nazara/Physics2D/RigidBody2D.cpp index fd54909b4..6e61af384 100644 --- a/src/Nazara/Physics2D/RigidBody2D.cpp +++ b/src/Nazara/Physics2D/RigidBody2D.cpp @@ -20,6 +20,8 @@ namespace Nz m_geom(), m_userData(nullptr), m_world(world), + m_isRegistered(false), + m_isSimulationEnabled(true), m_isStatic(false), m_gravityFactor(1.f), m_mass(mass) @@ -34,6 +36,8 @@ namespace Nz m_geom(object.m_geom), m_userData(object.m_userData), m_world(object.m_world), + m_isRegistered(false), + m_isSimulationEnabled(true), m_isStatic(object.m_isStatic), m_gravityFactor(object.m_gravityFactor), m_mass(object.GetMass()) @@ -58,6 +62,8 @@ namespace Nz m_handle(object.m_handle), m_userData(object.m_userData), m_world(object.m_world), + m_isRegistered(object.m_isRegistered), + m_isSimulationEnabled(object.m_isSimulationEnabled), m_isStatic(object.m_isStatic), m_gravityFactor(object.m_gravityFactor), m_mass(object.m_mass) @@ -121,6 +127,19 @@ namespace Nz cpBodySetTorque(m_handle, cpBodyGetTorque(m_handle) + ToRadians(torque)); } + void RigidBody2D::EnableSimulation(bool simulation) + { + if (m_isRegistered != simulation) + { + m_isRegistered = simulation; + + if (simulation) + RegisterToSpace(); + else + UnregisterFromSpace(); + } + } + Rectf RigidBody2D::GetAABB() const { if (m_shapes.empty()) @@ -217,6 +236,11 @@ namespace Nz return m_mass <= 0.f; } + bool RigidBody2D::IsSimulationEnabled() const + { + return m_isRegistered; + } + bool RigidBody2D::IsSleeping() const { return cpBodyIsSleeping(m_handle) != 0; @@ -244,6 +268,7 @@ namespace Nz cpBody* newHandle = Create(static_cast(mass), static_cast(moment)); CopyBodyData(m_handle, newHandle); + Destroy(); m_handle = newHandle; @@ -258,10 +283,10 @@ namespace Nz cpSpace* space = m_world->GetHandle(); for (cpShape* shape : m_shapes) - { cpShapeSetUserData(shape, this); - cpSpaceAddShape(space, shape); - } + + if (m_isSimulationEnabled) + RegisterToSpace(); if (recomputeMoment) { @@ -383,14 +408,16 @@ namespace Nz OnRigidBody2DMove = std::move(object.OnRigidBody2DMove); OnRigidBody2DRelease = std::move(object.OnRigidBody2DRelease); - m_handle = object.m_handle; - m_isStatic = object.m_isStatic; - m_geom = std::move(object.m_geom); - m_gravityFactor = object.m_gravityFactor; - m_mass = object.m_mass; - m_shapes = std::move(object.m_shapes); - m_userData = object.m_userData; - m_world = object.m_world; + m_handle = object.m_handle; + m_isRegistered = object.m_isRegistered; + m_isSimulationEnabled = object.m_isSimulationEnabled; + m_isStatic = object.m_isStatic; + m_geom = std::move(object.m_geom); + m_gravityFactor = object.m_gravityFactor; + m_mass = object.m_mass; + m_shapes = std::move(object.m_shapes); + m_userData = object.m_userData; + m_world = object.m_world; cpBodySetUserData(m_handle, this); for (cpShape* shape : m_shapes) @@ -417,28 +444,54 @@ namespace Nz handle = cpBodyNew(mass, moment); cpBodySetUserData(handle, this); - cpSpaceAddBody(m_world->GetHandle(), handle); return handle; } void RigidBody2D::Destroy() { + UnregisterFromSpace(); + cpSpace* space = m_world->GetHandle(); for (cpShape* shape : m_shapes) - { - cpSpaceRemoveShape(space, shape); cpShapeFree(shape); - } if (m_handle) - { - cpSpaceRemoveBody(space, m_handle); cpBodyFree(m_handle); - } + m_shapes.clear(); } + void RigidBody2D::RegisterToSpace() + { + if (!m_isRegistered) + { + cpSpace* space = m_world->GetHandle(); + for (cpShape* shape : m_shapes) + cpSpaceAddShape(space, shape); + + if (m_handle) + cpSpaceAddBody(space, m_handle); + + m_isRegistered = true; + } + } + + void RigidBody2D::UnregisterFromSpace() + { + if (m_isRegistered) + { + cpSpace* space = m_world->GetHandle(); + for (cpShape* shape : m_shapes) + cpSpaceRemoveShape(space, shape); + + if (m_handle) + cpSpaceRemoveBody(space, m_handle); + + m_isRegistered = false; + } + } + void RigidBody2D::CopyBodyData(cpBody* from, cpBody* to) { cpBodySetAngle(to, cpBodyGetAngle(from)); diff --git a/src/Nazara/Physics3D/PhysWorld3D.cpp b/src/Nazara/Physics3D/PhysWorld3D.cpp index be2677ef6..cc7ab7208 100644 --- a/src/Nazara/Physics3D/PhysWorld3D.cpp +++ b/src/Nazara/Physics3D/PhysWorld3D.cpp @@ -3,18 +3,23 @@ // For conditions of distribution and use, see copyright notice in Config.hpp #include +#include #include +#include #include namespace Nz { PhysWorld3D::PhysWorld3D() : m_gravity(Vector3f::Zero()), + m_maxStepCount(50), m_stepSize(0.005f), m_timestepAccumulator(0.f) { m_world = NewtonCreate(); NewtonWorldSetUserData(m_world, this); + + m_materialIds.emplace("default", NewtonMaterialGetDefaultGroupID(m_world)); } PhysWorld3D::~PhysWorld3D() @@ -22,6 +27,28 @@ namespace Nz NewtonDestroy(m_world); } + int PhysWorld3D::CreateMaterial(Nz::String name) + { + NazaraAssert(m_materialIds.find(name) == m_materialIds.end(), "Material \"" + name + "\" already exists"); + + int materialId = NewtonMaterialCreateGroupID(m_world); + m_materialIds.emplace(std::move(name), materialId); + + return materialId; + } + + void PhysWorld3D::ForEachBodyInAABB(const Nz::Boxf& box, const BodyIterator& iterator) + { + auto NewtonCallback = [](const NewtonBody* const body, void* const userdata) -> int + { + const BodyIterator& iterator = *static_cast(userdata); + RigidBody3D* nzBody = static_cast(NewtonBodyGetUserData(body)); + return iterator(*nzBody); + }; + + NewtonWorldForEachBodyInAABBDo(m_world, box.GetMinimum(), box.GetMaximum(), NewtonCallback, const_cast(static_cast(&iterator))); + } + Vector3f PhysWorld3D::GetGravity() const { return m_gravity; @@ -32,6 +59,19 @@ namespace Nz return m_world; } + int PhysWorld3D::GetMaterial(const Nz::String& name) + { + auto it = m_materialIds.find(name); + NazaraAssert(it != m_materialIds.end(), "Material \"" + name + "\" does not exists"); + + return it->second; + } + + std::size_t PhysWorld3D::GetMaxStepCount() const + { + return m_maxStepCount; + } + float PhysWorld3D::GetStepSize() const { return m_stepSize; @@ -42,6 +82,11 @@ namespace Nz m_gravity = gravity; } + void PhysWorld3D::SetMaxStepCount(std::size_t maxStepCount) + { + m_maxStepCount = maxStepCount; + } + void PhysWorld3D::SetSolverModel(unsigned int model) { NewtonSetSolverModel(m_world, model); @@ -52,14 +97,100 @@ namespace Nz m_stepSize = stepSize; } + void PhysWorld3D::SetMaterialCollisionCallback(int firstMaterial, int secondMaterial, AABBOverlapCallback aabbOverlapCallback, CollisionCallback collisionCallback) + { + static_assert(sizeof(Nz::UInt64) >= 2 * sizeof(int), "Oops"); + + auto callbackPtr = std::make_unique(); + callbackPtr->aabbOverlapCallback = std::move(aabbOverlapCallback); + callbackPtr->collisionCallback = std::move(collisionCallback); + + NewtonMaterialSetCollisionCallback(m_world, firstMaterial, secondMaterial, callbackPtr.get(), (callbackPtr->aabbOverlapCallback) ? OnAABBOverlap : nullptr, (callbackPtr->collisionCallback) ? ProcessContact : nullptr); + + Nz::UInt64 firstMaterialId(firstMaterial); + Nz::UInt64 secondMaterialId(secondMaterial); + + Nz::UInt64 callbackIndex = firstMaterialId << 32 | secondMaterialId; + m_callbacks[callbackIndex] = std::move(callbackPtr); + } + + void PhysWorld3D::SetMaterialDefaultCollidable(int firstMaterial, int secondMaterial, bool collidable) + { + NewtonMaterialSetDefaultCollidable(m_world, firstMaterial, secondMaterial, collidable); + } + + void PhysWorld3D::SetMaterialDefaultElasticity(int firstMaterial, int secondMaterial, float elasticCoef) + { + NewtonMaterialSetDefaultElasticity(m_world, firstMaterial, secondMaterial, elasticCoef); + } + + void PhysWorld3D::SetMaterialDefaultFriction(int firstMaterial, int secondMaterial, float staticFriction, float kineticFriction) + { + NewtonMaterialSetDefaultFriction(m_world, firstMaterial, secondMaterial, staticFriction, kineticFriction); + } + + void PhysWorld3D::SetMaterialDefaultSoftness(int firstMaterial, int secondMaterial, float softness) + { + NewtonMaterialSetDefaultSoftness(m_world, firstMaterial, secondMaterial, softness); + } + + void PhysWorld3D::SetMaterialSurfaceThickness(int firstMaterial, int secondMaterial, float thickness) + { + NewtonMaterialSetSurfaceThickness(m_world, firstMaterial, secondMaterial, thickness); + } + void PhysWorld3D::Step(float timestep) { m_timestepAccumulator += timestep; - while (m_timestepAccumulator >= m_stepSize) + std::size_t stepCount = 0; + while (m_timestepAccumulator >= m_stepSize && stepCount < m_maxStepCount) { NewtonUpdate(m_world, m_stepSize); m_timestepAccumulator -= m_stepSize; + stepCount++; + } + } + + int PhysWorld3D::OnAABBOverlap(const NewtonMaterial* const material, const NewtonBody* const body0, const NewtonBody* const body1, int threadIndex) + { + Nz::RigidBody3D* bodyA = static_cast(NewtonBodyGetUserData(body0)); + Nz::RigidBody3D* bodyB = static_cast(NewtonBodyGetUserData(body1)); + assert(bodyA && bodyB); + + Callback* callbackData = static_cast(NewtonMaterialGetMaterialPairUserData(material)); + assert(callbackData); + assert(callbackData->aabbOverlapCallback); + + return callbackData->aabbOverlapCallback(*bodyA, *bodyB); + } + + void PhysWorld3D::ProcessContact(const NewtonJoint* const contactJoint, float timestep, int threadIndex) + { + Nz::RigidBody3D* bodyA = static_cast(NewtonBodyGetUserData(NewtonJointGetBody0(contactJoint))); + Nz::RigidBody3D* bodyB = static_cast(NewtonBodyGetUserData(NewtonJointGetBody1(contactJoint))); + assert(bodyA && bodyB); + + using ContactJoint = void*; + + // Query all joints first, to prevent removing a joint from the list while iterating on it + Nz::StackArray contacts = NazaraStackAllocationNoInit(ContactJoint, NewtonContactJointGetContactCount(contactJoint)); + std::size_t contactIndex = 0; + for (ContactJoint contact = NewtonContactJointGetFirstContact(contactJoint); contact; contact = NewtonContactJointGetNextContact(contactJoint, contact)) + { + assert(contactIndex < contacts.size()); + contacts[contactIndex++] = contact; + } + + for (ContactJoint contact : contacts) + { + NewtonMaterial* material = NewtonContactGetMaterial(contact); + Callback* callbackData = static_cast(NewtonMaterialGetMaterialPairUserData(material)); + assert(callbackData); + assert(callbackData->collisionCallback); + + if (!callbackData->collisionCallback(*bodyA, *bodyB)) + NewtonContactJointRemoveContact(contactJoint, contact); } } } diff --git a/src/Nazara/Physics3D/RigidBody3D.cpp b/src/Nazara/Physics3D/RigidBody3D.cpp index 2718f93f8..34e6ce12f 100644 --- a/src/Nazara/Physics3D/RigidBody3D.cpp +++ b/src/Nazara/Physics3D/RigidBody3D.cpp @@ -216,6 +216,11 @@ namespace Nz return center; } + int RigidBody3D::GetMaterial() const + { + return NewtonBodyGetMaterialGroupID(m_body); + } + const Matrix4f& RigidBody3D::GetMatrix() const { return m_matrix; @@ -231,6 +236,11 @@ namespace Nz return m_matrix.GetRotation(); } + void* RigidBody3D::GetUserdata() const + { + return m_userdata; + } + PhysWorld3D* RigidBody3D::GetWorld() const { return m_world; @@ -335,6 +345,16 @@ namespace Nz NewtonBodySetCentreOfMass(m_body, center); } + void RigidBody3D::SetMaterial(const Nz::String& materialName) + { + SetMaterial(m_world->GetMaterial(materialName)); + } + + void RigidBody3D::SetMaterial(int materialIndex) + { + NewtonBodySetMaterialGroupID(m_body, materialIndex); + } + void RigidBody3D::SetPosition(const Vector3f& position) { m_matrix.SetTranslation(position); @@ -349,6 +369,11 @@ namespace Nz UpdateBody(); } + void RigidBody3D::SetUserdata(void* ud) + { + m_userdata = ud; + } + RigidBody3D& RigidBody3D::operator=(const RigidBody3D& object) { RigidBody3D physObj(object); diff --git a/src/Nazara/Platform/Win32/CursorImpl.hpp b/src/Nazara/Platform/Win32/CursorImpl.hpp index ad0324d79..c3c1f4040 100644 --- a/src/Nazara/Platform/Win32/CursorImpl.hpp +++ b/src/Nazara/Platform/Win32/CursorImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CURSORIMPL_HPP #define NAZARA_CURSORIMPL_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Platform/Win32/IconImpl.hpp b/src/Nazara/Platform/Win32/IconImpl.hpp index 48644198c..e3e7b49a9 100644 --- a/src/Nazara/Platform/Win32/IconImpl.hpp +++ b/src/Nazara/Platform/Win32/IconImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ICONIMPL_HPP #define NAZARA_ICONIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Platform/Win32/WindowImpl.hpp b/src/Nazara/Platform/Win32/WindowImpl.hpp index 6e10a5283..b9d18dcd9 100644 --- a/src/Nazara/Platform/Win32/WindowImpl.hpp +++ b/src/Nazara/Platform/Win32/WindowImpl.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_WINDOWIMPL_HPP #define NAZARA_WINDOWIMPL_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Platform/X11/CursorImpl.hpp b/src/Nazara/Platform/X11/CursorImpl.hpp index 85b0bf4ef..1c3ec15bf 100644 --- a/src/Nazara/Platform/X11/CursorImpl.hpp +++ b/src/Nazara/Platform/X11/CursorImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_CURSORIMPL_HPP #define NAZARA_CURSORIMPL_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Platform/X11/Display.hpp b/src/Nazara/Platform/X11/Display.hpp index 37ee8877d..2746f30c1 100644 --- a/src/Nazara/Platform/X11/Display.hpp +++ b/src/Nazara/Platform/X11/Display.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_X11DISPLAY_HPP #define NAZARA_X11DISPLAY_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Platform/X11/IconImpl.hpp b/src/Nazara/Platform/X11/IconImpl.hpp index e72faa26a..4e099d091 100644 --- a/src/Nazara/Platform/X11/IconImpl.hpp +++ b/src/Nazara/Platform/X11/IconImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_ICONIMPL_HPP #define NAZARA_ICONIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Platform/X11/InputImpl.hpp b/src/Nazara/Platform/X11/InputImpl.hpp index b6c30df0a..5f82dc8e4 100644 --- a/src/Nazara/Platform/X11/InputImpl.hpp +++ b/src/Nazara/Platform/X11/InputImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_INPUTIMPL_HPP #define NAZARA_INPUTIMPL_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Platform/X11/ScopedXCB.hpp b/src/Nazara/Platform/X11/ScopedXCB.hpp index 3e6131db2..fb4c26dab 100644 --- a/src/Nazara/Platform/X11/ScopedXCB.hpp +++ b/src/Nazara/Platform/X11/ScopedXCB.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_SCOPEDXCB_HPP #define NAZARA_SCOPEDXCB_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Platform/X11/VideoModeImpl.hpp b/src/Nazara/Platform/X11/VideoModeImpl.hpp index fd502b828..a182239b0 100644 --- a/src/Nazara/Platform/X11/VideoModeImpl.hpp +++ b/src/Nazara/Platform/X11/VideoModeImpl.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_VIDEOMODEIMPL_HPP #define NAZARA_VIDEOMODEIMPL_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Platform/X11/WindowImpl.hpp b/src/Nazara/Platform/X11/WindowImpl.hpp index 0bd286944..d9e9d8652 100644 --- a/src/Nazara/Platform/X11/WindowImpl.hpp +++ b/src/Nazara/Platform/X11/WindowImpl.hpp @@ -9,7 +9,7 @@ #ifndef NAZARA_WINDOWIMPL_HPP #define NAZARA_WINDOWIMPL_HPP -#include +#include #include #include #include diff --git a/src/Nazara/Renderer/HardwareBuffer.hpp b/src/Nazara/Renderer/HardwareBuffer.hpp new file mode 100644 index 000000000..a640d3eb0 --- /dev/null +++ b/src/Nazara/Renderer/HardwareBuffer.hpp @@ -0,0 +1,44 @@ +// Copyright (C) 2017 Jérôme Leclercq +// This file is part of the "Nazara Engine - Renderer module" +// For conditions of distribution and use, see copyright notice in Config.hpp + +#pragma once + +#ifndef NAZARA_HARDWAREBUFFER_HPP +#define NAZARA_HARDWAREBUFFER_HPP + +#include +#include +#include + +namespace Nz +{ + class Buffer; + + class HardwareBuffer : public AbstractBuffer + { + public: + HardwareBuffer(Buffer* parent, BufferType type); + ~HardwareBuffer(); + + bool Fill(const void* data, UInt32 offset, UInt32 size) override; + + bool Initialize(unsigned int size, BufferUsageFlags usage) override; + + DataStorage GetStorage() const override; + + void* Map(BufferAccess access, UInt32 offset = 0, UInt32 size = 0) override; + bool Unmap() override; + + // Fonctions OpenGL + void Bind() const; + GLuint GetOpenGLID() const; + + private: + GLuint m_buffer; + BufferType m_type; + Buffer* m_parent; + }; +} + +#endif // NAZARA_HARDWAREBUFFER_HPP diff --git a/src/Nazara/Renderer/Win32/ContextImpl.hpp b/src/Nazara/Renderer/Win32/ContextImpl.hpp new file mode 100644 index 000000000..b3cf0d053 --- /dev/null +++ b/src/Nazara/Renderer/Win32/ContextImpl.hpp @@ -0,0 +1,41 @@ +// Copyright (C) 2017 Jérôme Leclercq +// This file is part of the "Nazara Engine". +// For conditions of distribution and use, see copyright notice in Config.hpp + +#pragma once + +#ifndef NAZARA_CONTEXTIMPL_HPP +#define NAZARA_CONTEXTIMPL_HPP + +#include +#include +#include + +namespace Nz +{ + class ContextImpl + { + public: + ContextImpl(); + + bool Activate() const; + + bool Create(ContextParameters& parameters); + + void Destroy(); + + void EnableVerticalSync(bool enabled); + + void SwapBuffers(); + + static bool Desactivate(); + + private: + HDC m_deviceContext; + HGLRC m_context; + HWND m_window; + bool m_ownsWindow; + }; +} + +#endif // NAZARA_CONTEXTIMPL_HPP diff --git a/src/Nazara/Utility/Formats/DDSConstants.hpp b/src/Nazara/Utility/Formats/DDSConstants.hpp index 4839df800..7233e7497 100644 --- a/src/Nazara/Utility/Formats/DDSConstants.hpp +++ b/src/Nazara/Utility/Formats/DDSConstants.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_DDS_CONSTANTS_HPP #define NAZARA_LOADERS_DDS_CONSTANTS_HPP -#include +#include #include #include diff --git a/src/Nazara/Utility/Formats/DDSLoader.hpp b/src/Nazara/Utility/Formats/DDSLoader.hpp index dd524fd04..dc95ce950 100644 --- a/src/Nazara/Utility/Formats/DDSLoader.hpp +++ b/src/Nazara/Utility/Formats/DDSLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_DDS_HPP #define NAZARA_LOADERS_DDS_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/FreeTypeLoader.hpp b/src/Nazara/Utility/Formats/FreeTypeLoader.hpp index f7775fca5..f2abc1406 100644 --- a/src/Nazara/Utility/Formats/FreeTypeLoader.hpp +++ b/src/Nazara/Utility/Formats/FreeTypeLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_FREETYPE_HPP #define NAZARA_LOADERS_FREETYPE_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/MD2Constants.hpp b/src/Nazara/Utility/Formats/MD2Constants.hpp index deb16757d..cb1a533a2 100644 --- a/src/Nazara/Utility/Formats/MD2Constants.hpp +++ b/src/Nazara/Utility/Formats/MD2Constants.hpp @@ -5,7 +5,7 @@ #ifndef NAZARA_LOADERS_MD2_CONSTANTS_HPP #define NAZARA_LOADERS_MD2_CONSTANTS_HPP -#include +#include #include namespace Nz diff --git a/src/Nazara/Utility/Formats/MD2Loader.hpp b/src/Nazara/Utility/Formats/MD2Loader.hpp index 98a405600..84a05d4e3 100644 --- a/src/Nazara/Utility/Formats/MD2Loader.hpp +++ b/src/Nazara/Utility/Formats/MD2Loader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_MD2_HPP #define NAZARA_LOADERS_MD2_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/MD5AnimLoader.hpp b/src/Nazara/Utility/Formats/MD5AnimLoader.hpp index 610d0d53f..43b118369 100644 --- a/src/Nazara/Utility/Formats/MD5AnimLoader.hpp +++ b/src/Nazara/Utility/Formats/MD5AnimLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_MD5ANIM_HPP #define NAZARA_LOADERS_MD5ANIM_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/MD5MeshLoader.hpp b/src/Nazara/Utility/Formats/MD5MeshLoader.hpp index b59d57998..06450f740 100644 --- a/src/Nazara/Utility/Formats/MD5MeshLoader.hpp +++ b/src/Nazara/Utility/Formats/MD5MeshLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_MD5MESH_HPP #define NAZARA_LOADERS_MD5MESH_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/OBJLoader.hpp b/src/Nazara/Utility/Formats/OBJLoader.hpp index dbbeaa6bc..afbb59eed 100644 --- a/src/Nazara/Utility/Formats/OBJLoader.hpp +++ b/src/Nazara/Utility/Formats/OBJLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_OBJ_HPP #define NAZARA_LOADERS_OBJ_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/OBJSaver.hpp b/src/Nazara/Utility/Formats/OBJSaver.hpp index 3647a317c..f6242e2d2 100644 --- a/src/Nazara/Utility/Formats/OBJSaver.hpp +++ b/src/Nazara/Utility/Formats/OBJSaver.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORMATS_OBJSAVER_HPP #define NAZARA_FORMATS_OBJSAVER_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/PCXLoader.hpp b/src/Nazara/Utility/Formats/PCXLoader.hpp index be3574026..1819e8468 100644 --- a/src/Nazara/Utility/Formats/PCXLoader.hpp +++ b/src/Nazara/Utility/Formats/PCXLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_LOADERS_PCX_HPP #define NAZARA_LOADERS_PCX_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/STBLoader.hpp b/src/Nazara/Utility/Formats/STBLoader.hpp index 4b94f84e9..6978aa8ef 100644 --- a/src/Nazara/Utility/Formats/STBLoader.hpp +++ b/src/Nazara/Utility/Formats/STBLoader.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORMATS_STBLOADER_HPP #define NAZARA_FORMATS_STBLOADER_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/Formats/STBSaver.hpp b/src/Nazara/Utility/Formats/STBSaver.hpp index e1bbbe3e1..c5126b61e 100644 --- a/src/Nazara/Utility/Formats/STBSaver.hpp +++ b/src/Nazara/Utility/Formats/STBSaver.hpp @@ -7,7 +7,7 @@ #ifndef NAZARA_FORMATS_STBSAVER_HPP #define NAZARA_FORMATS_STBSAVER_HPP -#include +#include namespace Nz { diff --git a/src/Nazara/Utility/SimpleTextDrawer.cpp b/src/Nazara/Utility/SimpleTextDrawer.cpp index 6216a815b..62df4412b 100644 --- a/src/Nazara/Utility/SimpleTextDrawer.cpp +++ b/src/Nazara/Utility/SimpleTextDrawer.cpp @@ -354,7 +354,7 @@ namespace Nz { glyph.atlas = nullptr; - glyph.bounds.Set(float(m_drawPos.x), float(m_drawPos.y), float(advance), float(sizeInfo.lineHeight)); + glyph.bounds.Set(float(m_drawPos.x), float(0.f), float(advance), float(sizeInfo.lineHeight)); glyph.corners[0].Set(glyph.bounds.GetCorner(RectCorner_LeftTop)); glyph.corners[1].Set(glyph.bounds.GetCorner(RectCorner_RightTop)); diff --git a/tests/Engine/Lua/LuaClass.cpp b/tests/Engine/Lua/LuaClass.cpp new file mode 100644 index 000000000..b6963a3bd --- /dev/null +++ b/tests/Engine/Lua/LuaClass.cpp @@ -0,0 +1,249 @@ +#include +#include +#include +#include + +class Test +{ + public: + Test() = default; + Test(const Test& other) = default; + Test& operator=(const Test& other) = default; + virtual ~Test() = default; + + Test(int i, bool j = false) : + m_i(i), + m_j(j) + { + } + + virtual int GetI() const + { + return m_i; + } + + bool GetJ() const + { + return m_j; + } + + int GetDefault(int defaultValue = 0) + { + return defaultValue; + } + + static int StaticMethodWithArguments(int a, int b) + { + return a + b; + } + + private: + int m_i; + bool m_j; +}; + +class InheritTest : public Test +{ + public: + InheritTest() : + Test(5, true) + { + } + + int GetI() const override + { + return Test::GetI() + 3; + } +}; + +class TestWithHandle : public Nz::HandledObject +{ + public: + int GetI() const + { + return m_i; + } + + int GetDefault(int defaultValue = 0) + { + return defaultValue; + } + + private: + int m_i = 8; +}; + +inline unsigned int LuaImplQueryArg(const Nz::LuaState& instance, int index, Test* arg, Nz::TypeTag) +{ + REQUIRE(instance.IsOfType(index, "Test")); + *arg = *static_cast(instance.ToUserdata(index)); + return 1; +} + +inline unsigned int LuaImplQueryArg(const Nz::LuaState& instance, int index, Nz::ObjectHandle* arg, Nz::TypeTag>) +{ + REQUIRE(instance.IsOfType(index, "TestWithHandle")); + *arg = *static_cast*>(instance.ToUserdata(index)); + return 1; +} + +inline unsigned int LuaImplQueryArg(const Nz::LuaState& instance, int index, InheritTest* arg, Nz::TypeTag) +{ + REQUIRE(instance.IsOfType(index, "InheritTest")); + *arg = *static_cast(instance.ToUserdata(index)); + return 1; +} + +SCENARIO("LuaClass", "[LUA][LUACLASS]") +{ + GIVEN("One lua class for our Test class") + { + Nz::LuaInstance luaInstance; + Nz::LuaClass test; + Nz::LuaClass inheritTest; + using TestHandle = Nz::ObjectHandle; + Nz::LuaClass testHandle; + + WHEN("We bind the methods") + { + test.Reset("Test"); + + test.BindDefaultConstructor(); + + test.SetConstructor([] (Nz::LuaState& lua, Test* instance, std::size_t argumentCount) + { + std::size_t argCount = std::min(argumentCount, 2U); + + int argIndex = 1; + switch (argCount) + { + case 1: + { + int iValue = lua.Check(&argIndex, 0); + + Nz::PlacementNew(instance, iValue); + return true; + } + + case 2: + { + int iValue = lua.Check(&argIndex, 0); + bool j = lua.Check(&argIndex, false); + + Nz::PlacementNew(instance, iValue, j); + return true; + } + } + + lua.Error("No matching overload for Test constructor"); + return false; + }); + + test.BindMethod("GetI", &Test::GetI); + test.BindMethod("GetJ", &Test::GetJ); + test.BindMethod("GetDefault", &Test::GetDefault, 0); + + test.BindStaticMethod("StaticMethodWithArguments", [] (Nz::LuaState& state) -> int + { + int argIndex = 1; + int result = Test::StaticMethodWithArguments(state.Check(&argIndex), state.Check(&argIndex)); + + state.Push(result); + return 1; + }); + + test.Register(luaInstance); + + THEN("We should be able to call them") + { + int value = 1; + int staticResult = value + value; + + luaInstance.PushFunction([=](Nz::LuaState& state) -> int + { + int argIndex = 1; + Test result = state.Check(&argIndex); + CHECK(result.GetI() == value); + CHECK_FALSE(result.GetJ()); + return 1; + }); + luaInstance.SetGlobal("CheckTest"); + + luaInstance.PushFunction([=](Nz::LuaState& state) -> int + { + int argIndex = 1; + int result = state.Check(&argIndex); + CHECK(result == staticResult); + return 1; + }); + luaInstance.SetGlobal("CheckStatic"); + + luaInstance.PushFunction([=](Nz::LuaState& state) -> int + { + int argIndex = 1; + Test result = state.Check(&argIndex); + CHECK(result.GetI() == staticResult); + CHECK(result.GetJ()); + return 1; + }); + luaInstance.SetGlobal("CheckFinalTest"); + + REQUIRE(luaInstance.ExecuteFromFile("resources/Engine/Lua/LuaClass.lua")); + REQUIRE(luaInstance.GetGlobal("test_Test") == Nz::LuaType_Function); + luaInstance.Call(0); + } + + AND_THEN("With a subclass") + { + inheritTest.Reset("InheritTest"); + + inheritTest.Inherit(test); + inheritTest.BindDefaultConstructor(); + + inheritTest.Register(luaInstance); + + luaInstance.PushFunction([=](Nz::LuaState& state) -> int + { + int argIndex = 1; + InheritTest result = state.Check(&argIndex); + CHECK(result.GetI() == 8); + CHECK(result.GetJ()); + return 1; + }); + luaInstance.SetGlobal("CheckInheritTest"); + + REQUIRE(luaInstance.ExecuteFromFile("resources/Engine/Lua/LuaClass.lua")); + REQUIRE(luaInstance.GetGlobal("test_InheritTest") == Nz::LuaType_Function); + luaInstance.Call(0); + } + } + + WHEN("We bind the object with Handle") + { + int defaultValue = 5; + + testHandle.Reset("TestHandle"); + testHandle.BindMethod("IsValid", &TestHandle::IsValid); + testHandle.BindMethod("GetI", &TestWithHandle::GetI); + testHandle.BindMethod("GetDefault", &TestWithHandle::GetDefault, defaultValue); + testHandle.Register(luaInstance); + + THEN("We can ensure the following properties") + { + luaInstance.PushFunction([=](Nz::LuaState& state) -> int + { + int argIndex = 1; + TestHandle result = state.Check(&argIndex); + CHECK(result->GetI() == 8); + CHECK(result->GetDefault() == defaultValue); + return 1; + }); + luaInstance.SetGlobal("CheckTestHandle"); + + REQUIRE(luaInstance.ExecuteFromFile("resources/Engine/Lua/LuaClass.lua")); + REQUIRE(luaInstance.GetGlobal("test_TestHandle") == Nz::LuaType_Function); + luaInstance.Call(0); + } + } + } +} diff --git a/tests/Engine/Lua/LuaCoroutine.cpp b/tests/Engine/Lua/LuaCoroutine.cpp new file mode 100644 index 000000000..3ab42d6b9 --- /dev/null +++ b/tests/Engine/Lua/LuaCoroutine.cpp @@ -0,0 +1,31 @@ +#include +#include +#include + +SCENARIO("LuaCoroutine", "[LUA][LUACOROUTINE]") +{ + GIVEN("One lua with coroutine") + { + Nz::LuaInstance luaInstance; + luaInstance.LoadLibraries(Nz::LuaLib_Coroutine); + + REQUIRE(luaInstance.ExecuteFromFile("resources/Engine/Lua/LuaCoroutine.lua")); + + Nz::LuaCoroutine coroutine = luaInstance.NewCoroutine(); + REQUIRE(coroutine.GetGlobal("infinite") == Nz::LuaType_Function); + coroutine.PushInteger(4); + CHECK(coroutine.Call(1)); + + coroutine.Resume(); + CHECK(coroutine.CheckInteger(1) == 1); + coroutine.Resume(); + CHECK(coroutine.CheckInteger(1) == -1); + coroutine.Resume(); + CHECK(coroutine.CheckInteger(1) == 0); + coroutine.Resume(); + CHECK(coroutine.CheckInteger(1) == 1); + + coroutine.Resume(); + CHECK_FALSE(coroutine.CanResume()); + } +} diff --git a/tests/Engine/Lua/LuaInstance.cpp b/tests/Engine/Lua/LuaInstance.cpp new file mode 100644 index 000000000..6042704bf --- /dev/null +++ b/tests/Engine/Lua/LuaInstance.cpp @@ -0,0 +1,84 @@ +#include +#include +#include + +SCENARIO("LuaInstance", "[LUA][LUAINSTANCE]") +{ + GIVEN("One lua instance") + { + Nz::LuaInstance luaInstance; + + WHEN("We set memory constraint") + { + luaInstance.SetMemoryLimit(1'000); + + THEN("If we excess memory, it should crash") + { + REQUIRE_THROWS_WITH(luaInstance.Execute(R"( + global t = {} + for 1,10000000 do + t[i] = i + end + )"), Catch::Matchers::Contains("memory")); + } + } + + WHEN("We set time constraint") + { + luaInstance.SetTimeLimit(10); + + THEN("If we excess time, it should produce an error") + { + CHECK(!luaInstance.Execute(R"( + function ack(M,N) + if M == 0 then return N + 1 end + if N == 0 then return ack(M-1,1) end + return ack(M-1,ack(M, N-1)) + end + ack(100, 100) + )")); + + REQUIRE_THAT(luaInstance.GetLastError().ToStdString(), Catch::Matchers::Contains("time")); + } + } + } + + GIVEN("Two instances") + { + Nz::LuaInstance luaInstance; + + int memoryLimit = 10'000; + int timeLimit = 1'000; + luaInstance.SetMemoryLimit(memoryLimit); + luaInstance.SetTimeLimit(timeLimit); + + int value = 5; + luaInstance.PushInteger(value); + + WHEN("We use move constructor") + { + Nz::LuaInstance movedInstance(std::move(luaInstance)); + + THEN("We should be able to retrieve the value") + { + CHECK(movedInstance.CheckInteger(1) == value); + CHECK(movedInstance.GetMemoryLimit() == memoryLimit); + CHECK(movedInstance.GetTimeLimit() == timeLimit); + } + } + + WHEN("We use move assignment") + { + Nz::LuaInstance movedInstance; + movedInstance.PushInteger(value + 1); + movedInstance = std::move(luaInstance); + + THEN("We should be able to retrieve the value") + { + CHECK(movedInstance.CheckInteger(1) == value); + CHECK(movedInstance.GetMemoryLimit() == memoryLimit); + CHECK(movedInstance.GetTimeLimit() == timeLimit); + } + } + } +} diff --git a/tests/Engine/Lua/LuaState.cpp b/tests/Engine/Lua/LuaState.cpp new file mode 100644 index 000000000..ef2965517 --- /dev/null +++ b/tests/Engine/Lua/LuaState.cpp @@ -0,0 +1,187 @@ +#include +#include + +static int counter(lua_State* L) +{ + Nz::LuaInstance& luaInstance = Nz::LuaInstance::GetInstance(L); + double val = luaInstance.ToNumber(luaInstance.GetIndexOfUpValue(1)); + luaInstance.PushNumber(++val); + luaInstance.PushValue(-1); + luaInstance.Replace(luaInstance.GetIndexOfUpValue(1)); + return 1; +} + +struct TestLuaState +{ + int a = 3; + float b = 5.f; +}; + +struct TestMetaTable +{ + float x = 1.f; + float y = 2.f; +}; + +inline int LuaImplReplyVal(const Nz::LuaState& state, TestLuaState&& val, Nz::TypeTag) +{ + state.PushTable(); + state.PushField("a", val.a); + state.PushField("b", val.b); + + return 1; +} + +inline unsigned int LuaImplQueryArg(const Nz::LuaState& state, int index, TestLuaState* arg, Nz::TypeTag) +{ + state.CheckType(index, Nz::LuaType_Table); + + arg->a = state.CheckField("a", index); + arg->b = state.CheckField("b", index); + + return 1; +} + +SCENARIO("LuaState", "[LUA][LUASTATE]") +{ + GIVEN("One lua instance") + { + Nz::LuaInstance luaInstance; + luaInstance.LoadLibraries(Nz::LuaLib_Math); + + WHEN("We push different primitive types") + { + bool booleanValue = true; + long long integerValue = 5LL; + double doubleValue = -55.0; + const char* stringValue = "test"; + Nz::String nazaraValue = "Nazara"; + luaInstance.PushBoolean(booleanValue); + luaInstance.PushInteger(integerValue); + luaInstance.PushNil(); + luaInstance.PushNumber(doubleValue); + luaInstance.PushString(stringValue); + luaInstance.PushString(nazaraValue); + + THEN("We should be able to retrieve them") + { + CHECK(luaInstance.CheckBoolean(1) == booleanValue); + CHECK(luaInstance.CheckInteger(2) == integerValue); + bool succeeded = false; + CHECK(luaInstance.ToInteger(2, &succeeded) == integerValue); + CHECK(succeeded); + CHECK(luaInstance.ToPointer(3) == nullptr); + CHECK(luaInstance.CheckNumber(4) == Approx(doubleValue)); + succeeded = false; + CHECK(luaInstance.ToNumber(4, &succeeded) == Approx(doubleValue)); + CHECK(succeeded); + CHECK(luaInstance.CheckString(5) == std::string(stringValue)); + CHECK(luaInstance.CheckString(6) == nazaraValue); + std::size_t length = 0; + CHECK(luaInstance.ToString(6, &length) == nazaraValue); + CHECK(length == nazaraValue.GetSize()); + } + } + + WHEN("We use basic operations") + { + luaInstance.PushInteger(1); + luaInstance.PushInteger(2); + + THEN("We should behave normally") + { + CHECK(luaInstance.Compare(1, 2, Nz::LuaComparison_Less)); + luaInstance.Compute(Nz::LuaOperation_Substraction); + CHECK(luaInstance.ToInteger(1) == -1); + } + } + + WHEN("We manipulate the stack") + { + Nz::String stringValue = "hello"; + luaInstance.PushBoolean(true); + luaInstance.PushNumber(10.0); + luaInstance.PushNil(); + luaInstance.PushString(stringValue); + /* true 10.0 nil hello */ + + THEN("These effects are expected") + { + luaInstance.PushValue(-4); + /* true 10.0 nil hello true */ + CHECK(luaInstance.CheckBoolean(5)); + + luaInstance.Replace(3); + /* true 10.0 true hello */ + CHECK(luaInstance.CheckBoolean(3)); + + luaInstance.Remove(-2); + /* true 10.0 hello */ + CHECK(luaInstance.CheckString(3) == stringValue); + + luaInstance.Pop(2); + /* true */ + CHECK_FALSE(luaInstance.IsValid(2)); + } + } + + WHEN("We try the CFunction") + { + double counterValue = 55.0; + luaInstance.PushFunction([=](Nz::LuaState& s) -> int { + s.PushNumber(counterValue); + s.PushCFunction(&counter, 1); + return 1; + }); + + THEN("We can call them") + { + luaInstance.Call(0); // We call our counter creator + luaInstance.Call(0); // We call our counter, which increments the value + CHECK(luaInstance.ToNumber(0) == Approx(counterValue + 1.0)); + } + } + + WHEN("We push our user type locally") + { + luaInstance.Push(TestLuaState()); + + THEN("We can retrieve it") + { + int index = 1; + TestLuaState popped = luaInstance.Check(&index); + CHECK(popped.a == 3); + CHECK(popped.b == Approx(5.0)); + } + } + + WHEN("We push our user type globally") + { + luaInstance.PushGlobal("TestLuaState", TestLuaState()); + + THEN("We can retrieve it") + { + TestLuaState popped = luaInstance.CheckGlobal("TestLuaState"); + CHECK(popped.a == 3); + CHECK(popped.b == Approx(5.0)); + } + } + + WHEN("We define a lua function") + { + luaInstance.Execute(R"( + function f (x, y) + return (x^2 * math.sin(y))/(1 - x) + end + )"); + + THEN("We can call it from the code") + { + REQUIRE(luaInstance.GetGlobal("f") == Nz::LuaType_Function); + luaInstance.Push(3.0, 2.0); + luaInstance.Call(2, 1); + CHECK(luaInstance.ToNumber(1) == Approx(-4.09).margin(0.1)); + } + } + } +} diff --git a/tests/Engine/Physics2D/Collider2D.cpp b/tests/Engine/Physics2D/Collider2D.cpp index dee2b85c8..811b75ded 100644 --- a/tests/Engine/Physics2D/Collider2D.cpp +++ b/tests/Engine/Physics2D/Collider2D.cpp @@ -98,7 +98,7 @@ SCENARIO("Collider2D", "[PHYSICS2D][COLLIDER2D]") THEN("We expect those to be true") { CHECK(segment.GetFirstPoint() == firstPoint); - CHECK(segment.GetLength() == firstPoint.Distance(secondPoint)); + CHECK(segment.GetLength() == Approx(firstPoint.Distance(secondPoint))); CHECK(segment.GetSecondPoint() == secondPoint); CHECK(segment.GetType() == Nz::ColliderType2D_Segment); } diff --git a/tests/Engine/Physics2D/RigidBody2D.cpp b/tests/Engine/Physics2D/RigidBody2D.cpp index b5d0a1ec2..c2b05438a 100644 --- a/tests/Engine/Physics2D/RigidBody2D.cpp +++ b/tests/Engine/Physics2D/RigidBody2D.cpp @@ -1,6 +1,7 @@ #include #include #include +#include Nz::RigidBody2D CreateBody(Nz::PhysWorld2D& world); void EQUALITY(const Nz::RigidBody2D& left, const Nz::RigidBody2D& right); @@ -11,6 +12,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") GIVEN("A physic world and a rigid body") { Nz::PhysWorld2D world; + world.SetMaxStepCount(std::numeric_limits::max()); Nz::Vector2f positionAABB(3.f, 4.f); Nz::Rectf aabb(positionAABB.x, positionAABB.y, 1.f, 2.f); @@ -82,6 +84,8 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") GIVEN("A physic world") { Nz::PhysWorld2D world; + world.SetMaxStepCount(std::numeric_limits::max()); + Nz::Rectf aabb(3.f, 4.f, 1.f, 2.f); WHEN("We get a rigid body from a function") @@ -102,6 +106,8 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") GIVEN("A physic world and a rigid body") { Nz::PhysWorld2D world; + world.SetMaxStepCount(std::numeric_limits::max()); + Nz::Vector2f positionAABB(3.f, 4.f); Nz::Rectf aabb(positionAABB.x, positionAABB.y, 1.f, 2.f); Nz::Collider2DRef box = Nz::BoxCollider2D::New(aabb); @@ -200,6 +206,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") GIVEN("A physic world and a rigid body of circle") { Nz::PhysWorld2D world; + world.SetMaxStepCount(std::numeric_limits::max()); Nz::Vector2f position(3.f, 4.f); float radius = 5.f; @@ -221,6 +228,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") GIVEN("A physic world and a rigid body of compound") { Nz::PhysWorld2D world; + world.SetMaxStepCount(std::numeric_limits::max()); Nz::Rectf aabb(0.f, 0.f, 1.f, 1.f); Nz::BoxCollider2DRef box1 = Nz::BoxCollider2D::New(aabb); @@ -249,6 +257,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") GIVEN("A physic world and a rigid body of circle") { Nz::PhysWorld2D world; + world.SetMaxStepCount(std::numeric_limits::max()); std::vector vertices; vertices.push_back(Nz::Vector2f(0.f, 0.f)); @@ -275,6 +284,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") GIVEN("A physic world and a rigid body of segment") { Nz::PhysWorld2D world; + world.SetMaxStepCount(std::numeric_limits::max()); Nz::Vector2f positionA(3.f, 4.f); Nz::Vector2f positionB(1.f, -4.f); @@ -306,13 +316,13 @@ Nz::RigidBody2D CreateBody(Nz::PhysWorld2D& world) void EQUALITY(const Nz::RigidBody2D& left, const Nz::RigidBody2D& right) { CHECK(left.GetAABB() == right.GetAABB()); - CHECK(left.GetAngularVelocity() == right.GetAngularVelocity()); + CHECK(left.GetAngularVelocity() == Approx(right.GetAngularVelocity())); CHECK(left.GetCenterOfGravity() == right.GetCenterOfGravity()); CHECK(left.GetGeom() == right.GetGeom()); CHECK(left.GetHandle() != right.GetHandle()); - CHECK(left.GetMass() == right.GetMass()); + CHECK(left.GetMass() == Approx(right.GetMass())); CHECK(left.GetPosition() == right.GetPosition()); - CHECK(left.GetRotation() == right.GetRotation()); + CHECK(left.GetRotation() == Approx(right.GetRotation())); CHECK(left.GetUserdata() == right.GetUserdata()); CHECK(left.GetVelocity() == right.GetVelocity()); } diff --git a/tests/Engine/Platform/EventHandler.cpp b/tests/Engine/Platform/EventHandler.cpp index b143b949a..a2f64e9f4 100644 --- a/tests/Engine/Platform/EventHandler.cpp +++ b/tests/Engine/Platform/EventHandler.cpp @@ -51,9 +51,8 @@ SCENARIO("EventHandler", "[PLATFORM][EVENTHANDLER][INTERACTIVE][.]") while (app.Run()) { window.Display(); - float elapsedTime = elapsedTimeClock.GetSeconds(); - elapsedTimeClock.Restart(); + float elapsedTime = elapsedTimeClock.Restart() / 1'000'000; if (!fsm.Update(elapsedTime)) { NazaraError("Failed to update state machine."); diff --git a/tests/SDK/NDK/EntityOwner.cpp b/tests/SDK/NDK/EntityOwner.cpp index 9ff8e1396..2d240a6d0 100644 --- a/tests/SDK/NDK/EntityOwner.cpp +++ b/tests/SDK/NDK/EntityOwner.cpp @@ -17,7 +17,7 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]") Ndk::EntityOwner entityOwner(entity); - world.Update(); + world.Refresh(); CHECK(entity.IsValid()); } @@ -29,12 +29,12 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]") Ndk::EntityOwner entityOwner2(std::move(entityOwner)); entityOwner.Reset(); - world.Update(); + world.Refresh(); CHECK(entity.IsValid()); entityOwner2.Reset(); - world.Update(); + world.Refresh(); CHECK(!entity.IsValid()); } @@ -47,12 +47,12 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]") entityOwner2 = std::move(entityOwner); entityOwner.Reset(); - world.Update(); + world.Refresh(); CHECK(entity.IsValid()); entityOwner2.Reset(); - world.Update(); + world.Refresh(); CHECK(!entity.IsValid()); } @@ -64,7 +64,7 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]") Ndk::EntityOwner entityOwner(entity); } - world.Update(); + world.Refresh(); CHECK(!entity.IsValid()); } @@ -76,7 +76,7 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]") Ndk::EntityOwner entityOwner(entity); entityOwner.Reset(); - world.Update(); + world.Refresh(); CHECK(!entity.IsValid()); } @@ -87,7 +87,7 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]") Ndk::EntityOwner entityOwner(entity); entityOwner = world.CreateEntity(); - world.Update(); + world.Refresh(); CHECK(!entity.IsValid()); } @@ -100,7 +100,7 @@ SCENARIO("EntityOwner", "[NDK][ENTITYOWNER]") entityOwner = std::move(entity2); - world.Update(); + world.Refresh(); CHECK(!entity.IsValid()); } } diff --git a/tests/SDK/NDK/System.cpp b/tests/SDK/NDK/System.cpp index ba7e9f4aa..5f6d74284 100644 --- a/tests/SDK/NDK/System.cpp +++ b/tests/SDK/NDK/System.cpp @@ -1,30 +1,40 @@ #include #include -/* + namespace { class TestSystem : public Ndk::System { public: - TestSystem(int value) : - m_value(value) + TestSystem() : + m_updateCounter(0), + m_elapsedTime(0.f) { } - int GetValue() const - { - return m_value; - } - ~TestSystem() = default; + float GetElapsedTime() const + { + return m_elapsedTime; + } + + std::size_t GetLoopCount() const + { + return m_updateCounter; + } + static Ndk::SystemIndex systemIndex; private: - int m_value; + std::size_t m_updateCounter; + float m_elapsedTime; void OnUpdate(float elapsedTime) override { + ++m_updateCounter; + + m_elapsedTime += elapsedTime; } }; @@ -35,16 +45,63 @@ SCENARIO("System", "[NDK][SYSTEM]") { GIVEN("Our TestSystem") { - TestSystem testSystem(666); + TestSystem testSystem; + testSystem.SetMaximumUpdateRate(30.f); - WHEN("We clone it") + float maxTimePerFrame = 1 / 30.f; + + WHEN("We update it with a higher framerate") { - std::unique_ptr clone = testSystem.Clone(); + float timePerFrame = maxTimePerFrame / 2.f; + float elapsedTime = 2.f; - THEN("We should get a copy") + std::size_t loopCount = static_cast(std::round(elapsedTime / timePerFrame)); + + for (std::size_t i = 0; i < loopCount; ++i) + testSystem.Update(timePerFrame); + + CHECK(testSystem.GetLoopCount() == loopCount / 2); + CHECK(testSystem.GetElapsedTime() == Approx(elapsedTime).epsilon(timePerFrame)); + } + + WHEN("We update it with a lower framerate") + { + float timePerFrame = maxTimePerFrame * 2.f; + float elapsedTime = 10.f; + + std::size_t loopCount = static_cast(std::round(elapsedTime / timePerFrame)); + + for (std::size_t i = 0; i < loopCount; ++i) + testSystem.Update(timePerFrame); + + CHECK(testSystem.GetLoopCount() == loopCount); + CHECK(testSystem.GetElapsedTime() == Approx(elapsedTime).epsilon(timePerFrame)); + + AND_WHEN("We suddenly increase framerate") { - REQUIRE(static_cast(clone.get())->GetValue() == 666); + float newTimePerFrame = 1 / 300.f; + float newElapsedTime = 100.f; + + std::size_t newLoopCount = static_cast(std::round(newElapsedTime / newTimePerFrame)); + + for (std::size_t i = 0; i < newLoopCount; ++i) + testSystem.Update(newTimePerFrame); + + CHECK(testSystem.GetLoopCount() == loopCount + newLoopCount / 10); + CHECK(testSystem.GetElapsedTime() == Approx(elapsedTime + newElapsedTime).epsilon(newTimePerFrame)); } } + + + WHEN("We update it with a very low framerate") + { + float timePerFrame = 0.5f; + + for (std::size_t i = 0; i < 10; ++i) + testSystem.Update(timePerFrame); + + CHECK(testSystem.GetLoopCount() == 10); + CHECK(testSystem.GetElapsedTime() == Approx(5.f)); + } } -}*/ \ No newline at end of file +} diff --git a/tests/SDK/NDK/Systems/PhysicsSystem2D.cpp b/tests/SDK/NDK/Systems/PhysicsSystem2D.cpp index 9173ab167..53808dc42 100644 --- a/tests/SDK/NDK/Systems/PhysicsSystem2D.cpp +++ b/tests/SDK/NDK/Systems/PhysicsSystem2D.cpp @@ -4,6 +4,7 @@ #include #include #include +#include Ndk::EntityHandle CreateBaseEntity(Ndk::World& world, const Nz::Vector2f& position, const Nz::Rectf AABB); @@ -19,8 +20,9 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]") Ndk::NodeComponent& nodeComponent = movingEntity->GetComponent(); Ndk::PhysicsComponent2D& physicsComponent2D = movingEntity->AddComponent(); - world.GetSystem().SetFixedUpdateRate(30.f); - + world.GetSystem().SetMaximumUpdateRate(0.f); + world.GetSystem().GetWorld().SetMaxStepCount(std::numeric_limits::max()); + WHEN("We update the world") { world.Update(1.f); @@ -43,7 +45,7 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]") world.Update(1.f); - THEN("It should moved freely") + THEN("It should move freely") { REQUIRE(nodeComponent.GetPosition() == position); movingAABB.Translate(position); @@ -89,7 +91,7 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]") THEN("It should have been rotated") { - CHECK(physicsComponent2D.GetAngularVelocity() == angularSpeed); + CHECK(physicsComponent2D.GetAngularVelocity() == Approx(angularSpeed)); CHECK(physicsComponent2D.GetAABB() == Nz::Rectf(-2.f, 0.f, 2.f, 1.f)); CHECK(physicsComponent2D.GetRotation() == Approx(Nz::FromDegrees(90.f))); CHECK(nodeComponent.GetRotation().ToEulerAngles().roll == Approx(Nz::FromDegrees(90.f))); diff --git a/tests/resources/Engine/Lua/LuaClass.lua b/tests/resources/Engine/Lua/LuaClass.lua new file mode 100644 index 000000000..3434a7d94 --- /dev/null +++ b/tests/resources/Engine/Lua/LuaClass.lua @@ -0,0 +1,24 @@ + +function test_Test() + local test = Test(1) + + local i = test:GetI() + local result = Test.StaticMethodWithArguments(i, i) + local finalTest = Test(result + test:GetDefault(), true) + + CheckTest(test) + CheckStatic(result) + CheckFinalTest(finalTest) +end + +function test_InheritTest() + local test = InheritTest() + + CheckInheritTest(test) +end + +function test_TestHandle() + local test = TestHandle() + + CheckTestHandle() +end diff --git a/tests/resources/Engine/Lua/LuaCoroutine.lua b/tests/resources/Engine/Lua/LuaCoroutine.lua new file mode 100644 index 000000000..4a235cbe5 --- /dev/null +++ b/tests/resources/Engine/Lua/LuaCoroutine.lua @@ -0,0 +1,15 @@ + +function even (x) + coroutine.yield(1) +end + +function odd (x) + coroutine.yield(0) +end + +function infinite (x) + for i=1,x do + if i==3 then coroutine.yield(-1) end + if i % 2 == 0 then even(i) else odd(i) end + end +end diff --git a/writing style.md b/writing style.md index e05f25470..08df4b18a 100644 --- a/writing style.md +++ b/writing style.md @@ -13,7 +13,7 @@ Class header: #ifndef NAZARA_FILENAME_HPP #define NAZARA_FILENAME_HPP -#include +#include #include #include