3#include "pixelbullet/serialization/node.h"
11inline Node& operator<<(
Node& node,
const glm::vec2& value)
13 node.set_type(NodeType::Array);
14 auto& properties = node.properties();
21 properties.emplace_back(
"", std::move(x));
22 properties.emplace_back(
"", std::move(y));
26inline void operator>>(
const Node& node, glm::vec2& value)
28 ASSERT(node.type() == NodeType::Array,
"Node is not an array");
29 const auto& properties = node.properties();
30 ASSERT(properties.size() >= 2,
"Insufficient elements for glm::vec2");
31 properties[0].second >> value.x;
32 properties[1].second >> value.y;
35inline Node& operator<<(
Node& node,
const glm::vec3& value)
37 node.set_type(NodeType::Array);
38 auto& properties = node.properties();
47 properties.emplace_back(
"", std::move(x));
48 properties.emplace_back(
"", std::move(y));
49 properties.emplace_back(
"", std::move(z));
53inline void operator>>(
const Node& node, glm::vec3& value)
55 ASSERT(node.type() == NodeType::Array,
"Node is not an array");
56 const auto& properties = node.properties();
57 ASSERT(properties.size() >= 3,
"Insufficient elements for glm::vec3");
58 properties[0].second >> value.x;
59 properties[1].second >> value.y;
60 properties[2].second >> value.z;
63inline Node& operator<<(
Node& node,
const glm::vec4& value)
65 node.set_type(NodeType::Array);
66 auto& properties = node.properties();
77 properties.emplace_back(
"", std::move(x));
78 properties.emplace_back(
"", std::move(y));
79 properties.emplace_back(
"", std::move(z));
80 properties.emplace_back(
"", std::move(w));
84inline void operator>>(
const Node& node, glm::vec4& value)
86 ASSERT(node.type() == NodeType::Array,
"Node is not an array");
87 const auto& properties = node.properties();
88 ASSERT(properties.size() >= 4,
"Insufficient elements for glm::vec4");
89 properties[0].second >> value.x;
90 properties[1].second >> value.y;
91 properties[2].second >> value.z;
92 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