mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-12 23:23:35 +00:00
fixing UUID issue
This commit is contained in:
@@ -17,6 +17,7 @@ namespace Scop
|
||||
public:
|
||||
Actor();
|
||||
Actor(Model model);
|
||||
Actor(std::uint64_t uuid, Model model);
|
||||
|
||||
inline void AttachScript(std::shared_ptr<ActorScript> script) { p_script = script; }
|
||||
|
||||
@@ -32,7 +33,7 @@ namespace Scop
|
||||
[[nodiscard]] inline const Quatf& GetOrientation() const noexcept { return m_orientation; }
|
||||
[[nodiscard]] inline const Model& GetModel() const noexcept { return m_model; }
|
||||
[[nodiscard]] inline Model& GetModelRef() noexcept { return m_model; }
|
||||
[[nodiscard]] inline std::uint32_t GetUUID() const noexcept { return m_uuid; }
|
||||
[[nodiscard]] inline std::uint64_t GetUUID() const noexcept { return m_uuid; }
|
||||
[[nodiscard]] inline bool IsVisible() const noexcept { return m_is_visible; }
|
||||
|
||||
~Actor();
|
||||
@@ -52,4 +53,16 @@ namespace Scop
|
||||
};
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<Scop::Actor>
|
||||
{
|
||||
std::size_t operator()(const Scop::Actor& a) const noexcept
|
||||
{
|
||||
return static_cast<std::size_t>(a.GetUUID());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,8 +16,9 @@ namespace Scop
|
||||
|
||||
public:
|
||||
Narrator() : m_uuid(UUID()) {}
|
||||
Narrator(std::uint64_t uuid) : m_uuid(uuid) {}
|
||||
inline void AttachScript(std::shared_ptr<NarratorScript> script) { p_script = script; }
|
||||
[[nodiscard]] inline std::uint32_t GetUUID() const noexcept { return m_uuid; }
|
||||
[[nodiscard]] inline std::uint64_t GetUUID() const noexcept { return m_uuid; }
|
||||
inline ~Narrator()
|
||||
{
|
||||
if(p_script)
|
||||
@@ -37,5 +38,16 @@ namespace Scop
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<Scop::Narrator>
|
||||
{
|
||||
std::size_t operator()(const Scop::Narrator& n) const noexcept
|
||||
{
|
||||
return static_cast<std::size_t>(n.GetUUID());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <map>
|
||||
|
||||
#include <Utils/NonOwningPtr.h>
|
||||
|
||||
@@ -66,8 +67,8 @@ namespace Scop
|
||||
void SwitchToParent() const noexcept;
|
||||
|
||||
[[nodiscard]] inline ForwardData& GetForwardData() noexcept { return m_forward; }
|
||||
[[nodiscard]] inline const std::vector<Actor>& GetActors() const noexcept { return m_actors; }
|
||||
[[nodiscard]] inline const std::vector<Sprite>& GetSprites() const noexcept { return m_sprites; }
|
||||
[[nodiscard]] inline const std::map<std::uint64_t, Actor>& GetActors() const noexcept { return m_actors; }
|
||||
[[nodiscard]] inline const std::map<std::uint64_t, Sprite>& GetSprites() const noexcept { return m_sprites; }
|
||||
[[nodiscard]] inline const std::string& GetName() const noexcept { return m_name; }
|
||||
[[nodiscard]] inline GraphicPipeline& GetPipeline() noexcept { return m_pipeline; }
|
||||
[[nodiscard]] inline std::shared_ptr<BaseCamera> GetCamera() const { return m_descriptor.camera; }
|
||||
@@ -90,9 +91,9 @@ namespace Scop
|
||||
DepthImage m_depth;
|
||||
SceneDescriptor m_descriptor;
|
||||
std::shared_ptr<CubeTexture> p_skybox;
|
||||
std::vector<Actor> m_actors;
|
||||
std::vector<Sprite> m_sprites;
|
||||
std::vector<Narrator> m_narrators;
|
||||
std::map<std::uint64_t, Actor> m_actors;
|
||||
std::map<std::uint64_t, Sprite> m_sprites;
|
||||
std::map<std::uint64_t, Narrator> m_narrators;
|
||||
std::vector<Scene> m_scene_children;
|
||||
std::string m_name;
|
||||
NonOwningPtr<Scene> p_parent;
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Scop
|
||||
|
||||
public:
|
||||
Sprite(std::shared_ptr<Texture> texture);
|
||||
Sprite(std::uint64_t uuid, std::shared_ptr<Texture> texture);
|
||||
|
||||
inline void AttachScript(std::shared_ptr<SpriteScript> script) { p_script = script; }
|
||||
void Update(NonOwningPtr<class Scene> scene, class Inputs& input, float timestep);
|
||||
@@ -31,7 +32,7 @@ namespace Scop
|
||||
[[nodiscard]] inline const Vec2f& GetScale() const noexcept { return m_scale; }
|
||||
[[nodiscard]] inline std::shared_ptr<Mesh> GetMesh() const { return p_mesh; }
|
||||
[[nodiscard]] inline std::shared_ptr<Texture> GetTexture() const { return p_texture; }
|
||||
[[nodiscard]] inline std::uint32_t GetUUID() const noexcept { return m_uuid; }
|
||||
[[nodiscard]] inline std::uint64_t GetUUID() const noexcept { return m_uuid; }
|
||||
|
||||
~Sprite();
|
||||
|
||||
@@ -62,4 +63,16 @@ namespace Scop
|
||||
};
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<Scop::Sprite>
|
||||
{
|
||||
std::size_t operator()(const Scop::Sprite& s) const noexcept
|
||||
{
|
||||
return static_cast<std::size_t>(s.GetUUID());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user