Merge branch 'nazara-next' of https://github.com/DigitalPulseSoftware/NazaraEngine into nazara-next

This commit is contained in:
Jérôme Leclercq
2021-06-20 14:13:21 +02:00
57 changed files with 1382 additions and 51 deletions

View File

@@ -0,0 +1,46 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_ECS_HPP
#define NAZARA_ECS_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Core.hpp>
#include <entt/entt.hpp>
namespace Nz
{
class GraphicsComponent;
class NodeComponent;
class RigidBody3DComponent;
class ECS : public ModuleBase<ECS>
{
friend ModuleBase;
friend class Audio;
friend class Graphics;
friend class Physics2D;
friend class Physics3D;
friend class Utility;
public:
using Dependencies = TypeList<Core>;
struct Config {};
inline ECS(Config /*config*/);
~ECS() = default;
private:
static inline void RegisterComponents();
NAZARA_CORE_API static ECS* s_instance;
};
}
#include <Nazara/Core/ECS.inl>
#endif

View File

@@ -0,0 +1,35 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/ECS.hpp>
#include <stdexcept>
#include <Nazara/Core/Debug.hpp>
namespace Nz
{
/*!
* \ingroup core
* \class Nz::ECS
* \brief Core class that represents the ECS module
*/
inline ECS::ECS(Config /*config*/) :
ModuleBase("ECS", this)
{
RegisterComponents();
}
inline void ECS::RegisterComponents()
{
if (entt::type_seq<NodeComponent>() != 0)
throw std::runtime_error("NodeComponent has wrong index, please initialize Nazara ECS before instancing your own components");
if (entt::type_seq<GraphicsComponent>() != 1)
throw std::runtime_error("GraphicsComponent has wrong index, please initialize Nazara ECS before instancing your own components");
if (entt::type_seq<RigidBody3DComponent>() != 2)
throw std::runtime_error("GraphicsComponent has wrong index, please initialize Nazara ECS before instancing your own components");
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -39,6 +39,7 @@
#include <Nazara/Graphics/FramePassAttachment.hpp>
#include <Nazara/Graphics/GraphicalMesh.hpp>
#include <Nazara/Graphics/Graphics.hpp>
#include <Nazara/Graphics/InstancedRenderable.hpp>
#include <Nazara/Graphics/Material.hpp>
#include <Nazara/Graphics/MaterialPipeline.hpp>
#include <Nazara/Graphics/MaterialSettings.hpp>

View File

@@ -0,0 +1,34 @@
// This file was automatically generated
/*
Nazara Engine - Graphics module
Copyright (C) 2020 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_GRAPHICS_COMPONENTS_HPP
#define NAZARA_GLOBAL_GRAPHICS_COMPONENTS_HPP
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
#endif // NAZARA_GLOBAL_GRAPHICS_COMPONENTS_HPP

View File

@@ -0,0 +1,45 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_GRAPHICSCOMPONENT_HPP
#define NAZARA_GRAPHICSCOMPONENT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/ECS.hpp>
#include <Nazara/Graphics/InstancedRenderable.hpp>
#include <Nazara/Graphics/WorldInstance.hpp>
#include <memory>
#include <vector>
namespace Nz
{
class NAZARA_GRAPHICS_API GraphicsComponent
{
public:
GraphicsComponent() = default;
GraphicsComponent(const GraphicsComponent&) = default;
GraphicsComponent(GraphicsComponent&&) = default;
~GraphicsComponent() = default;
inline void AttachRenderable(std::shared_ptr<InstancedRenderable> renderable);
inline void DetachRenderable(const std::shared_ptr<InstancedRenderable>& renderable);
inline const std::vector<std::shared_ptr<InstancedRenderable>>& GetRenderables() const;
inline WorldInstance& GetWorldInstance();
inline const WorldInstance& GetWorldInstance() const;
GraphicsComponent& operator=(const GraphicsComponent&) = default;
GraphicsComponent& operator=(GraphicsComponent&&) = default;
private:
std::vector<std::shared_ptr<InstancedRenderable>> m_renderables;
WorldInstance m_worldInstance;
};
}
#include <Nazara/Graphics/Components/GraphicsComponent.inl>
#endif

View File

@@ -0,0 +1,37 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Utility/Components/NodeComponent.hpp>
#include <Nazara/Utility/Debug.hpp>
#include "GraphicsComponent.hpp"
namespace Nz
{
inline void GraphicsComponent::AttachRenderable(std::shared_ptr<InstancedRenderable> renderable)
{
m_renderables.push_back(std::move(renderable));
}
inline void GraphicsComponent::DetachRenderable(const std::shared_ptr<InstancedRenderable>& renderable)
{
auto it = std::find(m_renderables.begin(), m_renderables.end(), renderable);
if (it != m_renderables.end())
m_renderables.erase(it);
}
inline const std::vector<std::shared_ptr<InstancedRenderable>>& GraphicsComponent::GetRenderables() const
{
return m_renderables;
}
inline WorldInstance& GraphicsComponent::GetWorldInstance()
{
return m_worldInstance;
}
inline const WorldInstance& GraphicsComponent::GetWorldInstance() const
{
return m_worldInstance;
}
}

View File

@@ -23,7 +23,7 @@ namespace Nz
InstancedRenderable(InstancedRenderable&&) noexcept = default;
~InstancedRenderable();
virtual void Draw(CommandBufferBuilder& commandBuffer, WorldInstance& instance) const = 0;
virtual void Draw(CommandBufferBuilder& commandBuffer, const WorldInstance& instance) const = 0;
InstancedRenderable& operator=(const InstancedRenderable&) = delete;
InstancedRenderable& operator=(InstancedRenderable&&) noexcept = default;

View File

@@ -68,6 +68,7 @@ namespace Nz
inline const std::shared_ptr<MaterialPipeline>& GetPipeline() const;
inline const MaterialPipelineInfo& GetPipelineInfo() const;
inline float GetPointSize() const;
inline PrimitiveMode GetPrimitiveMode() const;
inline const std::shared_ptr<const MaterialSettings>& GetSettings() const;
inline const std::shared_ptr<UberShader>& GetShader(ShaderStageType shaderStage) const;
inline ShaderBinding& GetShaderBinding();
@@ -100,6 +101,7 @@ namespace Nz
inline void SetFaceFilling(FaceFilling filling);
inline void SetLineWidth(float lineWidth);
inline void SetPointSize(float pointSize);
inline void SetPrimitiveMode(PrimitiveMode mode);
inline void SetTexture(std::size_t textureIndex, std::shared_ptr<Texture> texture);
inline void SetTextureSampler(std::size_t textureIndex, TextureSamplerInfo samplerInfo);
inline void SetUniformBuffer(std::size_t bufferIndex, std::shared_ptr<AbstractBuffer> uniformBuffer);

View File

@@ -425,6 +425,11 @@ namespace Nz
return m_pipelineInfo.pointSize;
}
inline PrimitiveMode Material::GetPrimitiveMode() const
{
return m_pipelineInfo.primitiveMode;
}
inline const std::shared_ptr<const MaterialSettings>& Material::GetSettings() const
{
return m_settings;
@@ -693,6 +698,14 @@ namespace Nz
InvalidatePipeline();
}
inline void Material::SetPrimitiveMode(PrimitiveMode mode)
{
m_pipelineInfo.primitiveMode = mode;
InvalidatePipeline();
}
inline void Material::SetTexture(std::size_t textureIndex, std::shared_ptr<Texture> texture)
{
NazaraAssert(textureIndex < m_textures.size(), "Invalid texture index");

View File

@@ -28,7 +28,7 @@ namespace Nz
Model(Model&&) noexcept = default;
~Model() = default;
void Draw(CommandBufferBuilder& commandBuffer, WorldInstance& instance) const override;
void Draw(CommandBufferBuilder& commandBuffer, const WorldInstance& instance) const override;
const std::shared_ptr<AbstractBuffer>& GetIndexBuffer(std::size_t subMeshIndex) const;
std::size_t GetIndexCount(std::size_t subMeshIndex) const;

View File

@@ -31,6 +31,7 @@ namespace Nz
inline std::shared_ptr<AbstractBuffer>& GetInstanceBuffer();
inline const std::shared_ptr<AbstractBuffer>& GetInstanceBuffer() const;
inline ShaderBinding& GetShaderBinding();
inline const ShaderBinding& GetShaderBinding() const;
void UpdateBuffers(UploadPool& uploadPool, CommandBufferBuilder& builder);
inline void UpdateWorldMatrix(const Matrix4f& worldMatrix);

View File

@@ -23,6 +23,11 @@ namespace Nz
return *m_shaderBinding;
}
inline const ShaderBinding& WorldInstance::GetShaderBinding() const
{
return *m_shaderBinding;
}
inline void WorldInstance::UpdateWorldMatrix(const Matrix4f& worldMatrix)
{
m_worldMatrix = worldMatrix;

View File

@@ -40,6 +40,7 @@
#include <Nazara/Math/Frustum.hpp>
#include <Nazara/Math/Matrix4.hpp>
#include <Nazara/Math/OrientedBox.hpp>
#include <Nazara/Math/PidController.hpp>
#include <Nazara/Math/Plane.hpp>
#include <Nazara/Math/Quaternion.hpp>
#include <Nazara/Math/Ray.hpp>

View File

@@ -0,0 +1,31 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Mathematics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_PIDCONTROLLER_HPP
#define NAZARA_PIDCONTROLLER_HPP
namespace Nz
{
template<typename T>
class PidController
{
public:
PidController(float p, float i, float d);
T Update(const T& currentError, float elapsedTime);
private:
T m_lastError;
T m_integral;
float m_dFactor;
float m_iFactor;
float m_pFactor;
};
}
#include <Nazara/Math/PidController.inl>
#endif

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Mathematics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Math/PidController.hpp>
namespace Nz
{
template<typename T>
PidController<T>::PidController(float p, float i, float d) :
m_lastError(0),
m_integral(0),
m_dFactor(d),
m_iFactor(i),
m_pFactor(p)
{
}
template<typename T>
T PidController<T>::Update(const T& currentError, float elapsedTime)
{
m_integral += currentError * elapsedTime;
T deriv = (currentError - m_lastError) / elapsedTime;
m_lastError = currentError;
return currentError * m_pFactor + m_integral * m_iFactor + deriv * m_dFactor;
}
}

View File

@@ -31,6 +31,7 @@ namespace Nz
inline GLenum ToOpenGL(BlendEquation blendEquation);
inline GLenum ToOpenGL(BlendFunc blendFunc);
inline GLenum ToOpenGL(FaceFilling filling);
inline GLenum ToOpenGL(FaceSide side);
inline GLenum ToOpenGL(FrontFace face);
inline GLenum ToOpenGL(PrimitiveMode primitiveMode);

View File

@@ -74,6 +74,19 @@ namespace Nz
NazaraError("Unhandled BlendFunc 0x" + NumberToString(UnderlyingCast(blendFunc), 16));
return {};
}
inline GLenum ToOpenGL(FaceFilling side)
{
switch (side)
{
case FaceFilling::Fill: return GL_FILL;
case FaceFilling::Line: return GL_LINE;
case FaceFilling::Point: return GL_POINT;
}
NazaraError("Unhandled FaceFilling 0x" + NumberToString(UnderlyingCast(side), 16));
return {};
}
inline GLenum ToOpenGL(FaceSide side)
{

View File

@@ -1,5 +1,29 @@
// This file was automatically generated
/*
Nazara Engine - OpenGL
Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_OPENGLRENDERER_WRAPPER_HPP

View File

@@ -12,8 +12,12 @@
#include <GLES2/gl2ext.h>
// Define some OpenGL (not ES) extensions
#define GL_POINT 0x1B00
#define GL_LINE 0x1B01
#define GL_FILL 0x1B02
#define GL_SHADER_BINARY_FORMAT_SPIR_V_ARB 0x9551
#define GL_SPIR_V_BINARY_ARB 0x9552
typedef void (GL_APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode);
typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const GLchar* pEntryPoint, GLuint numSpecializationConstants, const GLuint* pConstantIndex, const GLuint* pConstantValue);
// OpenGL core
@@ -163,6 +167,8 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const G
\
extCb(glDebugMessageCallback, PFNGLDEBUGMESSAGECALLBACKPROC) \
\
extCb(glPolygonMode, PFNGLPOLYGONMODEPROC) \
\
extCb(glMemoryBarrier, PFNGLMEMORYBARRIERPROC) \
extCb(glMemoryBarrierByRegion, PFNGLMEMORYBARRIERBYREGIONPROC) \
\

View File

@@ -30,6 +30,7 @@ namespace Nz
class PrimitiveList;
class PhysWorld3D;
class StaticMesh;
class NAZARA_PHYSICS3D_API Collider3D
{
@@ -48,6 +49,8 @@ namespace Nz
virtual void ForEachPolygon(const std::function<void(const Vector3f* vertices, std::size_t vertexCount)>& callback) const;
virtual std::shared_ptr<StaticMesh> GenerateMesh() const;
NewtonCollision* GetHandle(PhysWorld3D* world) const;
virtual ColliderType3D GetType() const = 0;

View File

@@ -0,0 +1,34 @@
// This file was automatically generated
/*
Nazara Engine - Physics 3D module
Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_PHYSICS3D_COMPONENTS_HPP
#define NAZARA_GLOBAL_PHYSICS3D_COMPONENTS_HPP
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
#endif // NAZARA_GLOBAL_PHYSICS3D_COMPONENTS_HPP

View File

@@ -0,0 +1,30 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Physics 3D module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_RIGIDBODYCOMPONENT_HPP
#define NAZARA_RIGIDBODYCOMPONENT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Physics3D/RigidBody3D.hpp>
namespace Nz
{
class NAZARA_PHYSICS3D_API RigidBody3DComponent : public RigidBody3D
{
public:
using RigidBody3D::RigidBody3D;
RigidBody3DComponent(const RigidBody3DComponent&) = default;
RigidBody3DComponent(RigidBody3DComponent&&) noexcept = default;
~RigidBody3DComponent() = default;
RigidBody3DComponent& operator=(const RigidBody3DComponent&) = default;
RigidBody3DComponent& operator=(RigidBody3DComponent&&) noexcept = default;
};
}
#include <Nazara/Physics3D/Components/RigidBody3DComponent.inl>
#endif

View File

@@ -0,0 +1,12 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Physics 3D module"
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
#include <Nazara/Physics3D/Debug.hpp>
namespace Nz
{
}
#include <Nazara/Physics3D/DebugOff.hpp>

View File

@@ -33,7 +33,7 @@ namespace Nz
PhysWorld3D();
PhysWorld3D(const PhysWorld3D&) = delete;
PhysWorld3D(PhysWorld3D&&) noexcept = default;
PhysWorld3D(PhysWorld3D&& ph) noexcept;
~PhysWorld3D();
int CreateMaterial(std::string name = {});
@@ -62,7 +62,7 @@ namespace Nz
void Step(float timestep);
PhysWorld3D& operator=(const PhysWorld3D&) = delete;
PhysWorld3D& operator=(PhysWorld3D&&) noexcept = default;
PhysWorld3D& operator=(PhysWorld3D&&) noexcept;
private:
struct Callback

View File

@@ -9,6 +9,7 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Enums.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Math/Matrix4.hpp>
#include <Nazara/Math/Quaternion.hpp>
#include <Nazara/Math/Vector3.hpp>
@@ -27,7 +28,7 @@ namespace Nz
RigidBody3D(PhysWorld3D* world, const Matrix4f& mat = Matrix4f::Identity());
RigidBody3D(PhysWorld3D* world, std::shared_ptr<Collider3D> geom, const Matrix4f& mat = Matrix4f::Identity());
RigidBody3D(const RigidBody3D& object);
RigidBody3D(RigidBody3D&& object);
RigidBody3D(RigidBody3D&& object) noexcept;
~RigidBody3D();
void AddForce(const Vector3f& force, CoordSys coordSys = CoordSys::Global);
@@ -74,7 +75,7 @@ namespace Nz
void SetUserdata(void* ud);
RigidBody3D& operator=(const RigidBody3D& object);
RigidBody3D& operator=(RigidBody3D&& object);
RigidBody3D& operator=(RigidBody3D&& object) noexcept;
private:
void UpdateBody();
@@ -83,9 +84,9 @@ namespace Nz
std::shared_ptr<Collider3D> m_geom;
Matrix4f m_matrix;
MovablePtr<NewtonBody> m_body;
Vector3f m_forceAccumulator;
Vector3f m_torqueAccumulator;
NewtonBody* m_body;
PhysWorld3D* m_world;
void* m_userdata;
float m_gravityFactor;

View File

@@ -0,0 +1,34 @@
// This file was automatically generated
/*
Nazara Engine - Physics 3D module
Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_PHYSICS3D_SYSTEMS_HPP
#define NAZARA_GLOBAL_PHYSICS3D_SYSTEMS_HPP
#include <Nazara/Physics3D/Systems/Physics3DSystem.hpp>
#endif // NAZARA_GLOBAL_PHYSICS3D_SYSTEMS_HPP

View File

@@ -0,0 +1,45 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_PHYSICS3DSYSTEM_HPP
#define NAZARA_PHYSICS3DSYSTEM_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/ECS.hpp>
#include <Nazara/Physics3D/PhysWorld3D.hpp>
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
namespace Nz
{
class NAZARA_PHYSICS3D_API Physics3DSystem
{
public:
Physics3DSystem(entt::registry& registry);
Physics3DSystem(const Physics3DSystem&) = delete;
Physics3DSystem(Physics3DSystem&&) = delete;
~Physics3DSystem();
template<typename... Args> RigidBody3DComponent CreateRigidBody(Args&&... args);
inline PhysWorld3D& GetPhysWorld();
inline const PhysWorld3D& GetPhysWorld() const;
void Update(entt::registry& registry, float elapsedTime);
Physics3DSystem& operator=(const Physics3DSystem&) = delete;
Physics3DSystem& operator=(Physics3DSystem&&) = delete;
private:
static void OnConstruct(entt::registry& registry, entt::entity entity);
entt::connection m_constructConnection;
PhysWorld3D m_physWorld;
};
}
#include <Nazara/Physics3D/Systems/Physics3DSystem.inl>
#endif

View File

@@ -0,0 +1,27 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Physics3D/Systems/Physics3DSystem.hpp>
#include <Nazara/Physics3D/Debug.hpp>
namespace Nz
{
template<typename... Args>
RigidBody3DComponent Physics3DSystem::CreateRigidBody(Args&&... args)
{
return RigidBody3DComponent(&m_physWorld, std::forward<Args>(args)...);
}
inline PhysWorld3D& Physics3DSystem::GetPhysWorld()
{
return m_physWorld;
}
inline const PhysWorld3D& Physics3DSystem::GetPhysWorld() const
{
return m_physWorld;
}
}
#include <Nazara/Physics3D/DebugOff.hpp>

View File

@@ -16,6 +16,7 @@ namespace Nz
struct RenderDeviceFeatures
{
bool anisotropicFiltering = false;
bool nonSolidFaceFilling = false;
};
struct RenderDeviceLimits

View File

@@ -0,0 +1,34 @@
// This file was automatically generated
/*
Nazara Engine - Utility module
Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_UTILITY_COMPONENTS_HPP
#define NAZARA_GLOBAL_UTILITY_COMPONENTS_HPP
#include <Nazara/Utility/Components/NodeComponent.hpp>
#endif // NAZARA_GLOBAL_UTILITY_COMPONENTS_HPP

View File

@@ -0,0 +1,34 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_NODECOMPONENT_HPP
#define NAZARA_NODECOMPONENT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/ECS.hpp>
#include <Nazara/Utility/Node.hpp>
namespace Nz
{
class NAZARA_UTILITY_API NodeComponent : public Node
{
public:
NodeComponent() = default;
NodeComponent(const NodeComponent&) = default;
NodeComponent(NodeComponent&&) noexcept = default;
~NodeComponent() = default;
void SetParent(entt::registry& registry, entt::entity entity, bool keepDerived = false);
using Node::SetParent;
NodeComponent& operator=(const NodeComponent&) = default;
NodeComponent& operator=(NodeComponent&&) noexcept = default;
};
}
#include <Nazara/Utility/Components/NodeComponent.inl>
#endif

View File

@@ -0,0 +1,12 @@
// Copyright (C) 2021 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Utility/Components/NodeComponent.hpp>
#include <Nazara/Utility/Debug.hpp>
namespace Nz
{
}
#include <Nazara/Utility/DebugOff.hpp>

View File

@@ -57,6 +57,7 @@ namespace Nz
class Mesh;
struct Primitive;
class PrimitiveList;
class StaticMesh;
class SubMesh;
using MeshVertex = VertexStruct_XYZ_Normal_UV_Tangent;
@@ -132,6 +133,8 @@ namespace Nz
Mesh& operator=(const Mesh&) = delete;
Mesh& operator=(Mesh&&) = delete;
static inline std::shared_ptr<Mesh> Build(std::shared_ptr<StaticMesh> staticMesh);
static std::shared_ptr<Mesh> LoadFromFile(const std::filesystem::path& filePath, const MeshParams& params = MeshParams());
static std::shared_ptr<Mesh> LoadFromMemory(const void* data, std::size_t size, const MeshParams& params = MeshParams());
static std::shared_ptr<Mesh> LoadFromStream(Stream& stream, const MeshParams& params = MeshParams());

View File

@@ -4,16 +4,26 @@
#include <Nazara/Utility/Mesh.hpp>
#include <memory>
#include <Nazara/Utility/StaticMesh.hpp>
#include <Nazara/Utility/Debug.hpp>
namespace Nz
{
Mesh::Mesh() :
inline Mesh::Mesh() :
m_materialData(1),
m_aabbUpdated(false),
m_isValid(false)
{
}
inline std::shared_ptr<Mesh> Mesh::Build(std::shared_ptr<StaticMesh> staticMesh)
{
std::shared_ptr<Mesh> mesh = std::make_shared<Mesh>();
mesh->CreateStatic();
mesh->AddSubMesh(std::move(staticMesh));
return mesh;
}
}
#include <Nazara/Utility/DebugOff.hpp>

View File

@@ -23,6 +23,7 @@ namespace Nz
public:
Node();
Node(const Node& node);
Node(Node&& node) noexcept;
virtual ~Node();
void EnsureDerivedUpdate() const;
@@ -92,6 +93,7 @@ namespace Nz
Vector3f ToLocalScale(const Vector3f& globalScale) const;
Node& operator=(const Node& node);
Node& operator=(Node&& node) noexcept;
// Signals:
NazaraSignal(OnNodeInvalidation, const Node* /*node*/);

View File

@@ -54,6 +54,5 @@
#include <Nazara/VulkanRenderer/VulkanTexture.hpp>
#include <Nazara/VulkanRenderer/VulkanTextureSampler.hpp>
#include <Nazara/VulkanRenderer/VulkanUploadPool.hpp>
#include <Nazara/VulkanRenderer/Wrapper.hpp>
#endif // NAZARA_GLOBAL_VULKANRENDERER_HPP

View File

@@ -1,5 +1,29 @@
// This file was automatically generated
/*
Nazara Engine - Vulkan
Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_VULKANRENDERER_WRAPPER_HPP