Remove Utility module and move its content to Core and TextRenderer modules

This commit is contained in:
SirLynix
2024-02-10 22:46:53 +01:00
committed by Jérôme Leclercq
parent 965a00182c
commit e64c2b036e
364 changed files with 2336 additions and 2516 deletions

View File

@@ -8,8 +8,8 @@
#define NAZARA_CORE_COMPONENTS_DISABLEDCOMPONENT_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/Config.hpp>
#include <Nazara/Core/Time.hpp>
#include <Nazara/Utility/Config.hpp>
namespace Nz
{

View File

@@ -8,8 +8,8 @@
#define NAZARA_CORE_COMPONENTS_LIFETIMECOMPONENT_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/Config.hpp>
#include <Nazara/Core/Time.hpp>
#include <Nazara/Utility/Config.hpp>
namespace Nz
{

View File

@@ -0,0 +1,36 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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_CORE_COMPONENTS_NODECOMPONENT_HPP
#define NAZARA_CORE_COMPONENTS_NODECOMPONENT_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/Node.hpp>
#include <entt/entt.hpp>
namespace Nz
{
class NAZARA_CORE_API NodeComponent : public Node
{
public:
using Node::Node;
NodeComponent(const NodeComponent&) = default;
NodeComponent(NodeComponent&&) noexcept = default;
~NodeComponent() = default;
void SetParent(entt::handle entity, bool keepDerived = false);
void SetParentJoint(entt::handle entity, std::string_view jointName, bool keepDerived = false);
void SetParentJoint(entt::handle entity, std::size_t jointIndex, bool keepDerived = false);
using Node::SetParent;
NodeComponent& operator=(const NodeComponent&) = default;
NodeComponent& operator=(NodeComponent&&) noexcept = default;
};
}
#include <Nazara/Core/Components/NodeComponent.inl>
#endif // NAZARA_CORE_COMPONENTS_NODECOMPONENT_HPP

View File

@@ -0,0 +1,11 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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/Debug.hpp>
namespace Nz
{
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -0,0 +1,46 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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_CORE_COMPONENTS_SHAREDSKELETONCOMPONENT_HPP
#define NAZARA_CORE_COMPONENTS_SHAREDSKELETONCOMPONENT_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/Skeleton.hpp>
#include <Nazara/Core/Components/SkeletonComponentBase.hpp>
namespace Nz
{
class NAZARA_CORE_API SharedSkeletonComponent final : public SkeletonComponentBase
{
friend class SkeletonSystem;
public:
SharedSkeletonComponent(std::shared_ptr<Skeleton> skeleton);
SharedSkeletonComponent(const SharedSkeletonComponent& sharedSkeletalComponent);
SharedSkeletonComponent(SharedSkeletonComponent&& sharedSkeletalComponent) noexcept;
~SharedSkeletonComponent() = default;
SharedSkeletonComponent& operator=(const SharedSkeletonComponent& sharedSkeletalComponent);
SharedSkeletonComponent& operator=(SharedSkeletonComponent&& sharedSkeletalComponent) noexcept;
private:
const Skeleton& GetAttachedSkeleton() const override;
inline bool IsAttachedSkeletonOutdated() const;
void OnReferenceJointsInvalidated(const Skeleton* skeleton);
void SetSkeletonParent(Node* parent);
void SetupSkeleton();
void UpdateAttachedSkeletonJoints();
NazaraSlot(Skeleton, OnSkeletonJointsInvalidated, m_onSkeletonJointsInvalidated);
Skeleton m_attachedSkeleton;
bool m_skeletonJointInvalidated;
};
}
#include <Nazara/Core/Components/SharedSkeletonComponent.inl>
#endif // NAZARA_CORE_COMPONENTS_SHAREDSKELETONCOMPONENT_HPP

View File

@@ -0,0 +1,15 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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/Debug.hpp>
namespace Nz
{
inline bool SharedSkeletonComponent::IsAttachedSkeletonOutdated() const
{
return m_skeletonJointInvalidated;
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -0,0 +1,38 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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_CORE_COMPONENTS_SKELETONCOMPONENT_HPP
#define NAZARA_CORE_COMPONENTS_SKELETONCOMPONENT_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/Skeleton.hpp>
#include <Nazara/Core/Components/SkeletonComponentBase.hpp>
namespace Nz
{
class Node;
class NAZARA_CORE_API SkeletonComponent final : public SkeletonComponentBase
{
public:
inline SkeletonComponent(std::shared_ptr<Skeleton> skeleton);
SkeletonComponent(const SkeletonComponent&) = delete;
SkeletonComponent(SkeletonComponent&& skeletalComponent) noexcept = default;
~SkeletonComponent() = default;
inline Node* GetRootNode();
SkeletonComponent& operator=(const SkeletonComponent&) = delete;
SkeletonComponent& operator=(SkeletonComponent&& skeletalComponent) noexcept = default;
private:
inline const Skeleton& GetAttachedSkeleton() const override;
};
}
#include <Nazara/Core/Components/SkeletonComponent.inl>
#endif // NAZARA_CORE_COMPONENTS_SKELETONCOMPONENT_HPP

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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/Debug.hpp>
namespace Nz
{
inline SkeletonComponent::SkeletonComponent(std::shared_ptr<Skeleton> skeleton) :
SkeletonComponentBase(std::move(skeleton))
{
}
inline Node* SkeletonComponent::GetRootNode()
{
return m_referenceSkeleton->GetRootJoint();
}
inline const Skeleton& SkeletonComponent::GetAttachedSkeleton() const
{
return *m_referenceSkeleton;
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -0,0 +1,42 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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_CORE_COMPONENTS_SKELETONCOMPONENTBASE_HPP
#define NAZARA_CORE_COMPONENTS_SKELETONCOMPONENTBASE_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/Joint.hpp>
#include <Nazara/Core/Skeleton.hpp>
namespace Nz
{
class NAZARA_CORE_API SkeletonComponentBase
{
public:
SkeletonComponentBase(const SkeletonComponentBase&) = default;
SkeletonComponentBase(SkeletonComponentBase&&) noexcept = default;
~SkeletonComponentBase() = default;
inline std::size_t FindJointByName(std::string_view jointName) const;
inline const Joint& GetAttachedJoint(std::size_t jointIndex) const;
inline const std::shared_ptr<Skeleton>& GetSkeleton() const;
SkeletonComponentBase& operator=(const SkeletonComponentBase&) = default;
SkeletonComponentBase& operator=(SkeletonComponentBase&&) noexcept = default;
protected:
SkeletonComponentBase(std::shared_ptr<Skeleton> skeleton);
virtual const Skeleton& GetAttachedSkeleton() const = 0;
std::shared_ptr<Skeleton> m_referenceSkeleton;
};
}
#include <Nazara/Core/Components/SkeletonComponentBase.inl>
#endif // NAZARA_CORE_COMPONENTS_SKELETONCOMPONENTBASE_HPP

View File

@@ -0,0 +1,30 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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/Debug.hpp>
namespace Nz
{
inline SkeletonComponentBase::SkeletonComponentBase(std::shared_ptr<Skeleton> skeleton) :
m_referenceSkeleton(std::move(skeleton))
{
}
inline std::size_t SkeletonComponentBase::FindJointByName(std::string_view jointName) const
{
return m_referenceSkeleton->GetJointIndex(jointName);
}
inline const Joint& SkeletonComponentBase::GetAttachedJoint(std::size_t jointIndex) const
{
return *GetAttachedSkeleton().GetJoint(jointIndex);
}
inline const std::shared_ptr<Skeleton>& SkeletonComponentBase::GetSkeleton() const
{
return m_referenceSkeleton;
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -0,0 +1,38 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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_CORE_COMPONENTS_VELOCITYCOMPONENT_HPP
#define NAZARA_CORE_COMPONENTS_VELOCITYCOMPONENT_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/Config.hpp>
#include <Nazara/Math/Vector3.hpp>
namespace Nz
{
class NAZARA_CORE_API VelocityComponent
{
public:
inline VelocityComponent(const Vector3f& linearVelocity = Vector3f::Zero());
VelocityComponent(const VelocityComponent&) = default;
VelocityComponent(VelocityComponent&&) = default;
~VelocityComponent() = default;
inline const Vector3f& GetLinearVelocity() const;
inline void UpdateLinearVelocity(const Vector3f& linearVelocity);
VelocityComponent& operator=(const VelocityComponent&) = default;
VelocityComponent& operator=(VelocityComponent&&) = default;
private:
Vector3f m_linearVelocity;
};
}
#include <Nazara/Core/Components/VelocityComponent.inl>
#endif // NAZARA_CORE_COMPONENTS_VELOCITYCOMPONENT_HPP

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// 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/Debug.hpp>
namespace Nz
{
inline VelocityComponent::VelocityComponent(const Vector3f& linearVelocity) :
m_linearVelocity(linearVelocity)
{
}
inline const Vector3f& VelocityComponent::GetLinearVelocity() const
{
return m_linearVelocity;
}
inline void VelocityComponent::UpdateLinearVelocity(const Vector3f& linearVelocity)
{
m_linearVelocity = linearVelocity;
}
}
#include <Nazara/Core/DebugOff.hpp>