diff --git a/include/Nazara/Graphics/RenderQueueRegistry.hpp b/include/Nazara/Graphics/RenderQueueRegistry.hpp index f6fb8151d..907ad66c9 100644 --- a/include/Nazara/Graphics/RenderQueueRegistry.hpp +++ b/include/Nazara/Graphics/RenderQueueRegistry.hpp @@ -14,6 +14,7 @@ namespace Nz { class MaterialInstance; + class RenderBuffer; class RenderPipeline; class Skeleton; class VertexDeclaration; diff --git a/include/Nazara/Graphics/RenderSubmesh.hpp b/include/Nazara/Graphics/RenderSubmesh.hpp index 0fa6e842e..612c3bf81 100644 --- a/include/Nazara/Graphics/RenderSubmesh.hpp +++ b/include/Nazara/Graphics/RenderSubmesh.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/include/Nazara/Physics2D/Constraint2D.hpp b/include/Nazara/Physics2D/Constraint2D.hpp index eae34146b..4ccee3fb8 100644 --- a/include/Nazara/Physics2D/Constraint2D.hpp +++ b/include/Nazara/Physics2D/Constraint2D.hpp @@ -55,7 +55,7 @@ namespace Nz Constraint2D& operator=(Constraint2D&& rhs); protected: - Constraint2D(Nz::PhysWorld2D* world, cpConstraint* constraint); + Constraint2D(PhysWorld2D* world, cpConstraint* constraint); MovablePtr m_constraint; }; diff --git a/include/Nazara/Physics2D/PhysWorld2D.hpp b/include/Nazara/Physics2D/PhysWorld2D.hpp index fefccb37c..6d6a73839 100644 --- a/include/Nazara/Physics2D/PhysWorld2D.hpp +++ b/include/Nazara/Physics2D/PhysWorld2D.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -62,15 +63,15 @@ namespace Nz std::size_t GetMaxStepCount() const; Time GetStepSize() const; - bool NearestBodyQuery(const Vector2f& from, float maxDistance, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, RigidBody2D** nearestBody = nullptr); - bool NearestBodyQuery(const Vector2f& from, float maxDistance, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, NearestQueryResult* result); + bool NearestBodyQuery(const Vector2f& from, float maxDistance, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, RigidBody2D** nearestBody = nullptr); + bool NearestBodyQuery(const Vector2f& from, float maxDistance, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, NearestQueryResult* result); - void RaycastQuery(const Nz::Vector2f& from, const Nz::Vector2f& to, float radius, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, const std::function& callback); - bool RaycastQuery(const Nz::Vector2f& from, const Nz::Vector2f& to, float radius, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, std::vector* hitInfos); - bool RaycastQueryFirst(const Nz::Vector2f& from, const Nz::Vector2f& to, float radius, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, RaycastHit* hitInfo = nullptr); + void RaycastQuery(const Vector2f& from, const Vector2f& to, float radius, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, const FunctionRef& callback); + bool RaycastQuery(const Vector2f& from, const Vector2f& to, float radius, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, std::vector* hitInfos); + bool RaycastQueryFirst(const Vector2f& from, const Vector2f& to, float radius, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, RaycastHit* hitInfo = nullptr); - void RegionQuery(const Nz::Rectf& boundingBox, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, const std::function& callback); - void RegionQuery(const Nz::Rectf& boundingBox, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, std::vector* bodies); + void RegionQuery(const Rectf& boundingBox, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, const FunctionRef& callback); + void RegionQuery(const Rectf& boundingBox, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, std::vector* bodies); void RegisterCallbacks(unsigned int collisionId, Callback callbacks); void RegisterCallbacks(unsigned int collisionIdA, unsigned int collisionIdB, Callback callbacks); @@ -116,17 +117,17 @@ namespace Nz struct NearestQueryResult { - Nz::RigidBody2D* nearestBody; - Nz::Vector2f closestPoint; - Nz::Vector2f fraction; + RigidBody2D* nearestBody; + Vector2f closestPoint; + Vector2f fraction; float distance; }; struct RaycastHit { - Nz::RigidBody2D* nearestBody; - Nz::Vector2f hitPos; - Nz::Vector2f hitNormal; + RigidBody2D* nearestBody; + Vector2f hitPos; + Vector2f hitNormal; float fraction; }; @@ -136,7 +137,7 @@ namespace Nz private: void InitCallbacks(cpCollisionHandler* handler, Callback callbacks); - using PostStep = std::function; + using PostStep = std::function; void OnRigidBodyMoved(RigidBody2D* oldPointer, RigidBody2D* newPointer); void OnRigidBodyRelease(RigidBody2D* rigidBody); diff --git a/include/Nazara/Physics2D/RigidBody2D.hpp b/include/Nazara/Physics2D/RigidBody2D.hpp index 5e2411ab5..b8ed48206 100644 --- a/include/Nazara/Physics2D/RigidBody2D.hpp +++ b/include/Nazara/Physics2D/RigidBody2D.hpp @@ -27,7 +27,7 @@ namespace Nz class NAZARA_PHYSICS2D_API RigidBody2D { public: - using VelocityFunc = std::function; + using VelocityFunc = std::function; RigidBody2D(PhysWorld2D* world, float mass); RigidBody2D(PhysWorld2D* world, float mass, std::shared_ptr geom); @@ -41,11 +41,11 @@ namespace Nz void AddImpulse(const Vector2f& impulse, const Vector2f& point, CoordSys coordSys = CoordSys::Global); void AddTorque(const RadianAnglef& torque); - bool ClosestPointQuery(const Nz::Vector2f& position, Nz::Vector2f* closestPoint = nullptr, float* closestDistance = nullptr) const; + bool ClosestPointQuery(const Vector2f& position, Vector2f* closestPoint = nullptr, float* closestDistance = nullptr) const; void EnableSimulation(bool simulation); - void ForEachArbiter(std::function callback); + void ForEachArbiter(std::function callback); void ForceSleep(); Rectf GetAABB() const; @@ -98,7 +98,7 @@ namespace Nz void SetVelocity(const Vector2f& velocity); void SetVelocityFunction(VelocityFunc velocityFunc); - void UpdateVelocity(const Nz::Vector2f& gravity, float damping, float deltaTime); + void UpdateVelocity(const Vector2f& gravity, float damping, float deltaTime); void Wakeup(); diff --git a/include/Nazara/Renderer/RenderStates.hpp b/include/Nazara/Renderer/RenderStates.hpp index bc5261350..290c261bd 100644 --- a/include/Nazara/Renderer/RenderStates.hpp +++ b/include/Nazara/Renderer/RenderStates.hpp @@ -8,6 +8,7 @@ #define NAZARA_RENDERER_RENDERSTATES_HPP #include +#include #include #include #include diff --git a/include/Nazara/VulkanRenderer/Wrapper/AutoFree.inl b/include/Nazara/VulkanRenderer/Wrapper/AutoFree.inl index 0ef59d45c..deedd1fce 100644 --- a/include/Nazara/VulkanRenderer/Wrapper/AutoFree.inl +++ b/include/Nazara/VulkanRenderer/Wrapper/AutoFree.inl @@ -2,6 +2,7 @@ // This file is part of the "Nazara Engine - Vulkan renderer" // For conditions of distribution and use, see copyright notice in Config.hpp +#include #include namespace Nz::Vk diff --git a/src/Nazara/Physics2D/Constraint2D.cpp b/src/Nazara/Physics2D/Constraint2D.cpp index 7b26411b3..1d5b73ef1 100644 --- a/src/Nazara/Physics2D/Constraint2D.cpp +++ b/src/Nazara/Physics2D/Constraint2D.cpp @@ -8,7 +8,7 @@ namespace Nz { - Constraint2D::Constraint2D(Nz::PhysWorld2D* world, cpConstraint* constraint) : + Constraint2D::Constraint2D(PhysWorld2D* world, cpConstraint* constraint) : m_constraint(constraint) { cpConstraintSetUserData(m_constraint, this); diff --git a/src/Nazara/Physics2D/PhysWorld2D.cpp b/src/Nazara/Physics2D/PhysWorld2D.cpp index 9c610c4a6..dc2d721b0 100644 --- a/src/Nazara/Physics2D/PhysWorld2D.cpp +++ b/src/Nazara/Physics2D/PhysWorld2D.cpp @@ -159,14 +159,14 @@ namespace Nz return m_stepSize; } - bool PhysWorld2D::NearestBodyQuery(const Vector2f & from, float maxDistance, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, RigidBody2D** nearestBody) + bool PhysWorld2D::NearestBodyQuery(const Vector2f & from, float maxDistance, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, RigidBody2D** nearestBody) { cpShapeFilter filter = cpShapeFilterNew(collisionGroup, categoryMask, collisionMask); if (cpShape* shape = cpSpacePointQueryNearest(m_handle, {from.x, from.y}, maxDistance, filter, nullptr)) { if (nearestBody) - *nearestBody = static_cast(cpShapeGetUserData(shape)); + *nearestBody = static_cast(cpShapeGetUserData(shape)); return true; } @@ -174,7 +174,7 @@ namespace Nz return false; } - bool PhysWorld2D::NearestBodyQuery(const Vector2f& from, float maxDistance, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, NearestQueryResult* result) + bool PhysWorld2D::NearestBodyQuery(const Vector2f& from, float maxDistance, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, NearestQueryResult* result) { cpShapeFilter filter = cpShapeFilterNew(collisionGroup, categoryMask, collisionMask); @@ -184,10 +184,10 @@ namespace Nz if (cpSpacePointQueryNearest(m_handle, { from.x, from.y }, maxDistance, filter, &queryInfo)) { - result->closestPoint.Set(Nz::Vector2(queryInfo.point.x, queryInfo.point.y)); + result->closestPoint.Set(Vector2(queryInfo.point.x, queryInfo.point.y)); result->distance = float(queryInfo.distance); - result->fraction.Set(Nz::Vector2(queryInfo.gradient.x, queryInfo.gradient.y)); - result->nearestBody = static_cast(cpShapeGetUserData(queryInfo.shape)); + result->fraction.Set(Vector2(queryInfo.gradient.x, queryInfo.gradient.y)); + result->nearestBody = static_cast(cpShapeGetUserData(queryInfo.shape)); return true; } @@ -203,7 +203,7 @@ namespace Nz } } - void PhysWorld2D::RaycastQuery(const Nz::Vector2f& from, const Nz::Vector2f& to, float radius, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, const std::function& callback) + void PhysWorld2D::RaycastQuery(const Vector2f& from, const Vector2f& to, float radius, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, const FunctionRef& callback) { using CallbackType = const std::function; @@ -213,9 +213,9 @@ namespace Nz RaycastHit hitInfo; hitInfo.fraction = float(alpha); - hitInfo.hitNormal.Set(Nz::Vector2(normal.x, normal.y)); - hitInfo.hitPos.Set(Nz::Vector2(point.x, point.y)); - hitInfo.nearestBody = static_cast(cpShapeGetUserData(shape)); + hitInfo.hitNormal.Set(Vector2(normal.x, normal.y)); + hitInfo.hitPos.Set(Vector2(point.x, point.y)); + hitInfo.nearestBody = static_cast(cpShapeGetUserData(shape)); callback(hitInfo); }; @@ -224,7 +224,7 @@ namespace Nz cpSpaceSegmentQuery(m_handle, { from.x, from.y }, { to.x, to.y }, radius, filter, cpCallback, const_cast(static_cast(&callback))); } - bool PhysWorld2D::RaycastQuery(const Nz::Vector2f& from, const Nz::Vector2f& to, float radius, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, std::vector* hitInfos) + bool PhysWorld2D::RaycastQuery(const Vector2f& from, const Vector2f& to, float radius, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, std::vector* hitInfos) { using ResultType = decltype(hitInfos); @@ -234,9 +234,9 @@ namespace Nz RaycastHit hitInfo; hitInfo.fraction = float(alpha); - hitInfo.hitNormal.Set(Nz::Vector2(normal.x, normal.y)); - hitInfo.hitPos.Set(Nz::Vector2(point.x, point.y)); - hitInfo.nearestBody = static_cast(cpShapeGetUserData(shape)); + hitInfo.hitNormal.Set(Vector2(normal.x, normal.y)); + hitInfo.hitPos.Set(Vector2(point.x, point.y)); + hitInfo.nearestBody = static_cast(cpShapeGetUserData(shape)); results->emplace_back(std::move(hitInfo)); }; @@ -249,7 +249,7 @@ namespace Nz return hitInfos->size() != previousSize; } - bool PhysWorld2D::RaycastQueryFirst(const Nz::Vector2f& from, const Nz::Vector2f& to, float radius, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, RaycastHit* hitInfo) + bool PhysWorld2D::RaycastQueryFirst(const Vector2f& from, const Vector2f& to, float radius, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, RaycastHit* hitInfo) { cpShapeFilter filter = cpShapeFilterNew(collisionGroup, categoryMask, collisionMask); @@ -260,9 +260,9 @@ namespace Nz if (cpSpaceSegmentQueryFirst(m_handle, { from.x, from.y }, { to.x, to.y }, radius, filter, &queryInfo)) { hitInfo->fraction = float(queryInfo.alpha); - hitInfo->hitNormal.Set(Nz::Vector2(queryInfo.normal.x, queryInfo.normal.y)); - hitInfo->hitPos.Set(Nz::Vector2(queryInfo.point.x, queryInfo.point.y)); - hitInfo->nearestBody = static_cast(cpShapeGetUserData(queryInfo.shape)); + hitInfo->hitNormal.Set(Vector2(queryInfo.normal.x, queryInfo.normal.y)); + hitInfo->hitPos.Set(Vector2(queryInfo.point.x, queryInfo.point.y)); + hitInfo->nearestBody = static_cast(cpShapeGetUserData(queryInfo.shape)); return true; } @@ -278,28 +278,28 @@ namespace Nz } } - void PhysWorld2D::RegionQuery(const Nz::Rectf& boundingBox, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, const std::function& callback) + void PhysWorld2D::RegionQuery(const Rectf& boundingBox, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, const FunctionRef& callback) { - using CallbackType = const std::function; + using CallbackType = const std::function; auto cpCallback = [](cpShape* shape, void* data) { CallbackType& callback = *static_cast(data); - callback(static_cast(cpShapeGetUserData(shape))); + callback(static_cast(cpShapeGetUserData(shape))); }; cpShapeFilter filter = cpShapeFilterNew(collisionGroup, categoryMask, collisionMask); cpSpaceBBQuery(m_handle, cpBBNew(boundingBox.x, boundingBox.y, boundingBox.x + boundingBox.width, boundingBox.y + boundingBox.height), filter, cpCallback, const_cast(static_cast(&callback))); } - void PhysWorld2D::RegionQuery(const Nz::Rectf& boundingBox, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, std::vector* bodies) + void PhysWorld2D::RegionQuery(const Rectf& boundingBox, UInt32 collisionGroup, UInt32 categoryMask, UInt32 collisionMask, std::vector* bodies) { using ResultType = decltype(bodies); auto callback = [] (cpShape* shape, void* data) { ResultType results = static_cast(data); - results->push_back(static_cast(cpShapeGetUserData(shape))); + results->push_back(static_cast(cpShapeGetUserData(shape))); }; cpShapeFilter filter = cpShapeFilterNew(collisionGroup, categoryMask, collisionMask); diff --git a/src/Nazara/Platform/SDL2/WindowImpl.cpp b/src/Nazara/Platform/SDL2/WindowImpl.cpp index 5844c459d..a2e0cf2f4 100644 --- a/src/Nazara/Platform/SDL2/WindowImpl.cpp +++ b/src/Nazara/Platform/SDL2/WindowImpl.cpp @@ -118,7 +118,7 @@ namespace Nz } case WindowBackend::Cocoa: systemHandle = handle.cocoa.window; break; - case WindowBackend::X11: systemHandle = (void*) handle.x11.window; break; + case WindowBackend::X11: systemHandle = reinterpret_cast(std::uintptr_t(handle.x11.window)); break; case WindowBackend::Windows: systemHandle = handle.windows.window; break; } diff --git a/xmake.lua b/xmake.lua index 4c5ec28c8..c1196a8a3 100644 --- a/xmake.lua +++ b/xmake.lua @@ -305,7 +305,7 @@ if is_plat("windows") then set_runtimes(is_mode("debug") and "MDd" or "MD") end - add_defines("_CRT_SECURE_NO_WARNINGS") + add_defines("_CRT_SECURE_NO_WARNINGS", "_ENABLE_EXTENDED_ALIGNED_STORAGE") add_cxxflags("/bigobj", "/permissive-", "/Zc:__cplusplus", "/Zc:externConstexpr", "/Zc:inline", "/Zc:lambda", "/Zc:preprocessor", "/Zc:referenceBinding", "/Zc:strictStrings", "/Zc:throwingNew") add_cxflags("/w44062") -- Enable warning: switch case not handled add_cxflags("/wd4251") -- Disable warning: class needs to have dll-interface to be used by clients of class blah blah blah