diff options
author | Brad Linden <brad@lindenlab.com> | 2024-05-23 11:35:23 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2024-05-23 11:35:23 -0700 |
commit | 9f6849e081deac1f62ab3010ee0984e17749c9e6 (patch) | |
tree | 8d916206343d075fc85e90e83ec9dabe8b01376d /indra/newview/gltf/accessor.h | |
parent | a1f49564d670a2c41bfa25c833bba2564b9b7f48 (diff) | |
parent | 03c4458bdcc6821a3047f93b729d412e274ab9af (diff) |
Merge remote-tracking branch 'origin/project/gltf_development' into brad/merge-maint-a-to-dev
Diffstat (limited to 'indra/newview/gltf/accessor.h')
-rw-r--r-- | indra/newview/gltf/accessor.h | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/indra/newview/gltf/accessor.h b/indra/newview/gltf/accessor.h index 6849cd8609..3bbc5216bd 100644 --- a/indra/newview/gltf/accessor.h +++ b/indra/newview/gltf/accessor.h @@ -28,14 +28,15 @@ #include "../lltinygltfhelper.h" #include "llstrider.h" +#include "boost/json.hpp" + +#include "common.h" // LL GLTF Implementation namespace LL { namespace GLTF { - class Asset; - constexpr S32 INVALID_INDEX = -1; class Buffer @@ -44,11 +45,14 @@ namespace LL std::vector<U8> mData; std::string mName; std::string mUri; + S32 mByteLength = 0; // erase the given range from this buffer. // also updates all buffer views in given asset that reference this buffer void erase(Asset& asset, S32 offset, S32 length); + void serialize(boost::json::object& obj) const; + const Buffer& operator=(const Value& value); const Buffer& operator=(const tinygltf::Buffer& src); }; @@ -56,25 +60,25 @@ namespace LL { public: S32 mBuffer = INVALID_INDEX; - S32 mByteLength; - S32 mByteOffset; - S32 mByteStride; - S32 mTarget; - S32 mComponentType; + S32 mByteLength = 0; + S32 mByteOffset = 0; + S32 mByteStride = 0; + S32 mTarget = -1; std::string mName; + void serialize(boost::json::object& obj) const; + const BufferView& operator=(const Value& value); const BufferView& operator=(const tinygltf::BufferView& src); - }; class Accessor { public: S32 mBufferView = INVALID_INDEX; - S32 mByteOffset; - S32 mComponentType; - S32 mCount; + S32 mByteOffset = 0; + S32 mComponentType = 0; + S32 mCount = 0; std::vector<double> mMax; std::vector<double> mMin; @@ -89,11 +93,19 @@ namespace LL MAT4 = TINYGLTF_TYPE_MAT4 }; - S32 mType; - bool mNormalized; + Type mType = Type::SCALAR; + bool mNormalized = false; std::string mName; + void serialize(boost::json::object& obj) const; + const Accessor& operator=(const Value& value); const Accessor& operator=(const tinygltf::Accessor& src); }; + + // convert from "SCALAR", "VEC2", etc to Accessor::Type + Accessor::Type gltf_type_to_enum(const std::string& type); + + // convert from Accessor::Type to "SCALAR", "VEC2", etc + std::string enum_to_gltf_type(Accessor::Type type); } } |