diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-08-31 21:25:47 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-09-01 20:43:42 +0800 |
commit | 95582654e49422d51b55665c3f2821c848ad1cb8 (patch) | |
tree | d6d03a887b8e1b6c3be1b139d63b1638c5d0fdcd /indra/newview/gltf | |
parent | ab3f483a3e5ed213882a83b882095cfdb6a4de57 (diff) | |
parent | b0fefd62adbf51f32434ba077e9f52d8a9241d15 (diff) |
Merge remote-tracking branch 'secondlife/release/2024.08-DeltaFPS' into 2024.08-DeltaFPS
Diffstat (limited to 'indra/newview/gltf')
-rw-r--r-- | indra/newview/gltf/accessor.cpp | 4 | ||||
-rw-r--r-- | indra/newview/gltf/accessor.h | 2 | ||||
-rw-r--r-- | indra/newview/gltf/animation.cpp | 4 | ||||
-rw-r--r-- | indra/newview/gltf/asset.cpp | 15 | ||||
-rw-r--r-- | indra/newview/gltf/buffer_util.h | 20 | ||||
-rw-r--r-- | indra/newview/gltf/common.h | 2 | ||||
-rw-r--r-- | indra/newview/gltf/primitive.cpp | 2 |
7 files changed, 33 insertions, 16 deletions
diff --git a/indra/newview/gltf/accessor.cpp b/indra/newview/gltf/accessor.cpp index 2ef9237f2d..d1845605d4 100644 --- a/indra/newview/gltf/accessor.cpp +++ b/indra/newview/gltf/accessor.cpp @@ -104,7 +104,7 @@ namespace LL void Buffer::erase(Asset& asset, S32 offset, S32 length) { - S32 idx = this - &asset.mBuffers[0]; + S32 idx = (S32)(this - &asset.mBuffers[0]); mData.erase(mData.begin() + offset, mData.begin() + offset + length); @@ -197,7 +197,7 @@ bool Buffer::save(Asset& asset, const std::string& folder) { if (mName.empty()) { - S32 idx = this - &asset.mBuffers[0]; + S32 idx = (S32)(this - &asset.mBuffers[0]); mUri = llformat("buffer_%d.bin", idx); } else diff --git a/indra/newview/gltf/accessor.h b/indra/newview/gltf/accessor.h index ec68c5f624..85ea0f2967 100644 --- a/indra/newview/gltf/accessor.h +++ b/indra/newview/gltf/accessor.h @@ -36,8 +36,6 @@ namespace LL { namespace GLTF { - constexpr S32 INVALID_INDEX = -1; - class Buffer { public: diff --git a/indra/newview/gltf/animation.cpp b/indra/newview/gltf/animation.cpp index 3dff67d746..31549986af 100644 --- a/indra/newview/gltf/animation.cpp +++ b/indra/newview/gltf/animation.cpp @@ -127,8 +127,8 @@ void Animation::apply(Asset& asset, float time) bool Animation::Sampler::prep(Asset& asset) { Accessor& accessor = asset.mAccessors[mInput]; - mMinTime = accessor.mMin[0]; - mMaxTime = accessor.mMax[0]; + mMinTime = (F32)accessor.mMin[0]; + mMaxTime = (F32)accessor.mMax[0]; mFrameTimes.resize(accessor.mCount); diff --git a/indra/newview/gltf/asset.cpp b/indra/newview/gltf/asset.cpp index 24df41c6b3..a399a59f40 100644 --- a/indra/newview/gltf/asset.cpp +++ b/indra/newview/gltf/asset.cpp @@ -105,7 +105,7 @@ void Node::updateTransforms(Asset& asset, const mat4& parentMatrix) mAssetMatrixInv = glm::inverse(mAssetMatrix); - S32 my_index = this - &asset.mNodes[0]; + S32 my_index = (S32)(this - &asset.mNodes[0]); for (auto& childIndex : mChildren) { @@ -271,11 +271,11 @@ S32 Asset::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, local_end = p; // pointer math to get the node index - node_hit = &node - &mNodes[0]; + node_hit = (S32)(&node - &mNodes[0]); llassert(&mNodes[node_hit] == &node); //pointer math to get the primitive index - primitive_hit = &primitive - &mesh.mPrimitives[0]; + primitive_hit = (S32)(&primitive - &mesh.mPrimitives[0]); llassert(&mesh.mPrimitives[primitive_hit] == &primitive); } } @@ -476,6 +476,7 @@ void Asset::update() { // HACK - force texture to be loaded full rez // TODO: calculate actual vsize image.mTexture->addTextureStats(2048.f * 2048.f); + image.mTexture->setBoostLevel(LLViewerTexture::BOOST_HIGH); } } } @@ -990,6 +991,12 @@ bool Image::prep(Asset& asset) return false; } + if (!asset.mFilename.empty()) + { // local preview, boost image so it doesn't discard and force to save raw image in case we save out or upload + mTexture->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); + mTexture->forceToSaveRawImage(0, F32_MAX); + } + return true; } @@ -1027,7 +1034,7 @@ bool Image::save(Asset& asset, const std::string& folder) const std::string& delim = gDirUtilp->getDirDelimiter(); if (name.empty()) { - S32 idx = this - asset.mImages.data(); + S32 idx = (S32)(this - asset.mImages.data()); name = llformat("image_%d", idx); } diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h index 40f9448aaf..ef9bba8128 100644 --- a/indra/newview/gltf/buffer_util.h +++ b/indra/newview/gltf/buffer_util.h @@ -161,7 +161,7 @@ namespace LL template<> inline void copyVec3<U16, LLColor4U>(U16* src, LLColor4U& dst) { - dst.set(src[0], src[1], src[2], 255); + dst.set((U8)(src[0]), (U8)(src[1]), (U8)(src[2]), 255); } template<> @@ -181,15 +181,25 @@ namespace LL } template<> + inline void copyVec4<U8, U64>(U8* src, U64& dst) + { + U8* data = (U8*)&dst; + data[0] = src[0]; + data[1] = src[1]; + data[2] = src[2]; + data[3] = src[3]; + } + + template<> inline void copyVec4<U16, LLColor4U>(U16* src, LLColor4U& dst) { - dst.set(src[0], src[1], src[2], src[3]); + dst.set((U8)(src[0]), (U8)(src[1]), (U8)(src[2]), ((U8)src[3])); } template<> inline void copyVec4<F32, LLColor4U>(F32* src, LLColor4U& dst) { - dst.set(src[0]*255, src[1]*255, src[2]*255, src[3]*255); + dst.set((U8)(src[0]*255.f), (U8)(src[1]*255.f), (U8)(src[2]*255.f), (U8)(src[3]*255.f)); } template<> @@ -892,7 +902,7 @@ namespace LL { if (src.is_int64()) { - dst = src.get_int64(); + dst = (U32)src.get_int64(); return true; } return false; @@ -947,7 +957,7 @@ namespace LL { if (src.is_int64()) { - dst = src.get_int64(); + dst = (U32)src.get_int64(); return true; } return false; diff --git a/indra/newview/gltf/common.h b/indra/newview/gltf/common.h index b9698d4017..742daff715 100644 --- a/indra/newview/gltf/common.h +++ b/indra/newview/gltf/common.h @@ -43,6 +43,8 @@ namespace LL { namespace GLTF { + constexpr S32 INVALID_INDEX = -1; + using Value = boost::json::value; using mat4 = glm::mat4; diff --git a/indra/newview/gltf/primitive.cpp b/indra/newview/gltf/primitive.cpp index 7613d81af4..5de45119fc 100644 --- a/indra/newview/gltf/primitive.cpp +++ b/indra/newview/gltf/primitive.cpp @@ -113,7 +113,7 @@ struct MikktMesh for (U32 tri_idx = 0; tri_idx < U32(triangle_count); ++tri_idx) { - U32 idx[3]; + U32 idx[3] = {0, 0, 0}; if (prim->mMode == Primitive::Mode::TRIANGLES) { |