Nameless Engine
Loading...
Searching...
No Matches
GlmVecFieldSerializer.h
1#pragma once
2
3// Custom.
4#include "io/serializers/IFieldSerializer.hpp"
5
6namespace ne {
11 public:
12 GlmVecFieldSerializer() = default;
13 virtual ~GlmVecFieldSerializer() override = default;
14
22 virtual bool isFieldTypeSupported(const rfk::Field* pField) override;
23
42 [[nodiscard]] virtual std::optional<Error> serializeField(
43 toml::value* pTomlData,
44 Serializable* pFieldOwner,
45 const rfk::Field* pField,
46 const std::string& sSectionName,
47 const std::string& sEntityId,
48 size_t& iSubEntityId,
49 Serializable* pOriginalObject = nullptr) override;
50
66 [[nodiscard]] virtual std::optional<Error> deserializeField(
67 const toml::value* pTomlDocument,
68 const toml::value* pTomlValue,
69 Serializable* pFieldOwner,
70 const rfk::Field* pField,
71 const std::string& sOwnerSectionName,
72 const std::string& sEntityId,
73 std::unordered_map<std::string, std::string>& customAttributes) override;
74
85 [[nodiscard]] virtual std::optional<Error> cloneField(
86 Serializable* pFromInstance,
87 const rfk::Field* pFromField,
88 Serializable* pToInstance,
89 const rfk::Field* pToField) override;
90
102 virtual bool isFieldValueEqual(
103 Serializable* pFieldAOwner,
104 const rfk::Field* pFieldA,
105 Serializable* pFieldBOwner,
106 const rfk::Field* pFieldB) override;
107
108 private:
110 static inline const std::string sVec2CanonicalTypeName1 = "glm::vec<2, float>";
111
113 static inline const std::string sVec2CanonicalTypeName2 = "glm::vec<2, float, glm::packed_highp>";
114
116 static inline const std::string sVec3CanonicalTypeName1 = "glm::vec<3, float>";
117
119 static inline const std::string sVec3CanonicalTypeName2 = "glm::vec<3, float, glm::packed_highp>";
120
122 static inline const std::string sVec4CanonicalTypeName1 = "glm::vec<4, float>";
123
125 static inline const std::string sVec4CanonicalTypeName2 = "glm::vec<4, float, glm::packed_highp>";
126
128 static inline const float floatEpsilon = 0.00001f;
129 };
130} // namespace ne
Definition: GlmVecFieldSerializer.h:10
virtual bool isFieldTypeSupported(const rfk::Field *pField) override
Definition: GlmVecFieldSerializer.cpp:10
static const std::string sVec4CanonicalTypeName1
Definition: GlmVecFieldSerializer.h:122
static const std::string sVec3CanonicalTypeName2
Definition: GlmVecFieldSerializer.h:119
static const std::string sVec2CanonicalTypeName1
Definition: GlmVecFieldSerializer.h:110
virtual bool isFieldValueEqual(Serializable *pFieldAOwner, const rfk::Field *pFieldA, Serializable *pFieldBOwner, const rfk::Field *pFieldB) override
Definition: GlmVecFieldSerializer.cpp:259
static const std::string sVec4CanonicalTypeName2
Definition: GlmVecFieldSerializer.h:125
virtual std::optional< Error > deserializeField(const toml::value *pTomlDocument, const toml::value *pTomlValue, Serializable *pFieldOwner, const rfk::Field *pField, const std::string &sOwnerSectionName, const std::string &sEntityId, std::unordered_map< std::string, std::string > &customAttributes) override
Definition: GlmVecFieldSerializer.cpp:67
virtual std::optional< Error > cloneField(Serializable *pFromInstance, const rfk::Field *pFromField, Serializable *pToInstance, const rfk::Field *pToField) override
Definition: GlmVecFieldSerializer.cpp:216
static const std::string sVec3CanonicalTypeName1
Definition: GlmVecFieldSerializer.h:116
static const float floatEpsilon
Definition: GlmVecFieldSerializer.h:128
virtual std::optional< Error > serializeField(toml::value *pTomlData, Serializable *pFieldOwner, const rfk::Field *pField, const std::string &sSectionName, const std::string &sEntityId, size_t &iSubEntityId, Serializable *pOriginalObject=nullptr) override
Definition: GlmVecFieldSerializer.cpp:29
static const std::string sVec2CanonicalTypeName2
Definition: GlmVecFieldSerializer.h:113
Definition: IFieldSerializer.hpp:33
Definition: Serializable.h:113