summaryrefslogtreecommitdiff
path: root/indra/newview/gltf/buffer_util.h
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2024-06-12 10:31:27 -0700
committerBrad Linden <brad@lindenlab.com>2024-06-12 10:31:27 -0700
commitd12c897bfc77a800fcec5e22a21c9d0344b0d0bc (patch)
tree18752bdf92b12fce68642c94acec2d78b9c43fbe /indra/newview/gltf/buffer_util.h
parent9775d7ea10ff87d913b1ba361a9204f961cd9c3f (diff)
parentf0de2ba6340e0d540aa70ac0086defde52cf60af (diff)
Merge remote-tracking branch 'origin/project/gltf_development' into brad/maint-a-merge-to-gltf-dev
# Conflicts: # indra/newview/gltf/primitive.cpp
Diffstat (limited to 'indra/newview/gltf/buffer_util.h')
-rw-r--r--indra/newview/gltf/buffer_util.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h
index c26752a6b6..c1101818b7 100644
--- a/indra/newview/gltf/buffer_util.h
+++ b/indra/newview/gltf/buffer_util.h
@@ -590,8 +590,8 @@ namespace LL
// Write all extensions to dst.extensions
// Usage:
// write_extensions(dst,
- // "KHR_materials_unlit", mUnlit,
- // "KHR_materials_pbrSpecularGlossiness", mPbrSpecularGlossiness);
+ // mUnlit, "KHR_materials_unlit",
+ // mPbrSpecularGlossiness, "KHR_materials_pbrSpecularGlossiness");
// returns true if any of the extensions are written
template<class... Types>
inline bool write_extensions(boost::json::object& dst, Types... args)
@@ -816,6 +816,39 @@ namespace LL
return true;
}
+ // vec2
+ template<>
+ inline bool copy(const Value& src, vec2& dst)
+ {
+ if (src.is_array())
+ {
+ const boost::json::array& arr = src.as_array();
+ if (arr.size() == 2)
+ {
+ std::error_code ec;
+ vec2 t;
+ t.x = arr[0].to_number<F32>(ec); if (ec) return false;
+ t.y = arr[1].to_number<F32>(ec); if (ec) return false;
+
+ dst = t;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ template<>
+ inline bool write(const vec2& src, Value& dst)
+ {
+ dst = boost::json::array();
+ boost::json::array& arr = dst.as_array();
+ arr.resize(2);
+ arr[0] = src.x;
+ arr[1] = src.y;
+
+ return true;
+ }
+
// bool
template<>
inline bool copy(const Value& src, bool& dst)