diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-07-17 11:23:10 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-07-17 11:23:51 +0300 |
commit | 6e186befad1eafd091a38c9e4d6b58cc09926e57 (patch) | |
tree | c128d6fcbd9482dbe31092ac34bb9d31f69f6255 /indra/newview/gltf/buffer_util.h | |
parent | 58420b8e63d2f5ac6a0ebe858a34061b16c9c16b (diff) |
Reapply "Merge develop into glTF mesh import"
To simplify merging into mesh import branch
This reverts commit b0c951ffe348f478f27a85720cc7aeffea32fe73.
Diffstat (limited to 'indra/newview/gltf/buffer_util.h')
-rw-r--r-- | indra/newview/gltf/buffer_util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h index ef9bba8128..be36c5e90b 100644 --- a/indra/newview/gltf/buffer_util.h +++ b/indra/newview/gltf/buffer_util.h @@ -159,6 +159,12 @@ namespace LL } template<> + inline void copyVec3<F32, LLColor4U>(F32* src, LLColor4U& dst) + { + dst.set((U8)(src[0] * 255.f), (U8)(src[1] * 255.f), (U8)(src[2] * 255.f), 255); + } + + template<> inline void copyVec3<U16, LLColor4U>(U16* src, LLColor4U& dst) { dst.set((U8)(src[0]), (U8)(src[1]), (U8)(src[2]), 255); @@ -369,6 +375,11 @@ namespace LL template<class T> inline void copy(Asset& asset, Accessor& accessor, LLStrider<T>& dst) { + if (accessor.mBufferView == INVALID_INDEX) + { + LL_WARNS("GLTF") << "Invalid buffer" << LL_ENDL; + return; + } const BufferView& bufferView = asset.mBufferViews[accessor.mBufferView]; const Buffer& buffer = asset.mBuffers[bufferView.mBuffer]; const U8* src = buffer.mData.data() + bufferView.mByteOffset + accessor.mByteOffset; |