Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void add_number(rapidjson::Value &target, const char* name, float_2 src, Document::AllocatorType& alloc)
- {
- std::ostringstream ss;
- ss << src.x << " " << src.y;
- std::string s(ss.str());
- target.AddMember(StringRef(name), s, alloc);
- }
- static void add_number(rapidjson::Value &target, const char* name, float_3 src, Document::AllocatorType& alloc)
- {
- std::ostringstream ss;
- ss << src.x << " " << src.y << " " << src.z;
- std::string s(ss.str());
- target.AddMember(StringRef(name), s, alloc);
- }
- template <typename T>
- static void add_number(rapidjson::Value &target, const char* name, T src, Document::AllocatorType& alloc)
- {
- std::ostringstream ss;
- switch(src.size){
- case 2: ss << src.x << " " << src.y;
- case 3: ss << src.x << " " << src.y << " " << src.z;
- case 4: ss << src.x << " " << src.y << " " << src.z << " " << src.w;
- }
- target.AddMember(StringRef(name), s, alloc);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement