3#include "pixelbullet/serialization/node.h"
4#include "pixelbullet/serialization/node_reader.h"
12inline Node& operator<<(
Node& node,
const glm::vec2& value)
14 node.set_type(NodeType::Array);
15 auto& properties = node.properties();
22 properties.emplace_back(
"", std::move(x));
23 properties.emplace_back(
"", std::move(y));
27inline void operator>>(
const Node& node, glm::vec2& value)
29 ASSERT(node.type() == NodeType::Array,
"Node is not an array");
30 const auto& properties = node.properties();
31 ASSERT(properties.size() >= 2,
"Insufficient elements for glm::vec2");
32 properties[0].second >> value.x;
33 properties[1].second >> value.y;
36inline Node& operator<<(
Node& node,
const glm::vec3& value)
38 node.set_type(NodeType::Array);
39 auto& properties = node.properties();
48 properties.emplace_back(
"", std::move(x));
49 properties.emplace_back(
"", std::move(y));
50 properties.emplace_back(
"", std::move(z));
54inline void operator>>(
const Node& node, glm::vec3& value)
56 ASSERT(node.type() == NodeType::Array,
"Node is not an array");
57 const auto& properties = node.properties();
58 ASSERT(properties.size() >= 3,
"Insufficient elements for glm::vec3");
59 properties[0].second >> value.x;
60 properties[1].second >> value.y;
61 properties[2].second >> value.z;
64inline Node& operator<<(
Node& node,
const glm::vec4& value)
66 node.set_type(NodeType::Array);
67 auto& properties = node.properties();
78 properties.emplace_back(
"", std::move(x));
79 properties.emplace_back(
"", std::move(y));
80 properties.emplace_back(
"", std::move(z));
81 properties.emplace_back(
"", std::move(w));
85inline void operator>>(
const Node& node, glm::vec4& value)
87 ASSERT(node.type() == NodeType::Array,
"Node is not an array");
88 const auto& properties = node.properties();
89 ASSERT(properties.size() >= 4,
"Insufficient elements for glm::vec4");
90 properties[0].second >> value.x;
91 properties[1].second >> value.y;
92 properties[2].second >> value.z;
93 properties[3].second >> value.w;
#define ASSERT(condition,...)
Asserts that a condition is true.
Definition assert.h:142
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:49