summaryrefslogtreecommitdiff
path: root/indra/newview/llgltfmateriallist.cpp
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-05 08:37:16 -0400
committerGitHub <noreply@github.com>2024-09-05 08:37:16 -0400
commit7ac4c3b56e5246fceaa73e7c9c665d3c04827d6c (patch)
treee96334bd9299102ebdaf229eec9cf4c2165f8c2f /indra/newview/llgltfmateriallist.cpp
parent487973d3f0ee9b8583b3d977ca6a405cba5fe518 (diff)
parent6a747e1ce027700a3609f4c377179bfa29c3ce31 (diff)
Merge pull request #2450 from secondlife/lua-merge
Merge updated 'main' branch into release/luau-scripting
Diffstat (limited to 'indra/newview/llgltfmateriallist.cpp')
-rw-r--r--indra/newview/llgltfmateriallist.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 4c9dc8f7cd..215f3dd3a7 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -47,9 +47,6 @@
#include "tinygltf/tiny_gltf.h"
#include <strstream>
-#include "json/reader.h"
-#include "json/value.h"
-
#include <unordered_set>
LLGLTFMaterialList gGLTFMaterialList;
@@ -76,7 +73,7 @@ static bool is_valid_update(const LLSD& data)
++count;
}
else
- {
+ {
LL_WARNS() << "Missing required parameter: object_id" << LL_ENDL;
return false;
}
@@ -96,7 +93,7 @@ static bool is_valid_update(const LLSD& data)
++count;
}
else
- {
+ {
LL_WARNS() << "Missing required parameter: side" << LL_ENDL;
return false;
}
@@ -122,7 +119,7 @@ static bool is_valid_update(const LLSD& data)
}
if (count < 3)
- {
+ {
LL_WARNS() << "Only specified object_id and side, update won't actually change anything and is just noise" << LL_ENDL;
return false;
}
@@ -176,7 +173,7 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
LLSDSerialize::fromNotation(data, str, data_in.length());
const LLHost& host = msg->getSender();
-
+
LLViewerRegion* region = LLWorld::instance().getRegion(host);
llassert(region);
@@ -202,14 +199,14 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
bool has_te[MAX_TES] = { false };
if (tes.isArray()) // NOTE: if no "te" array exists, this is a malformed message (null out all overrides will come in as an empty te array)
- {
+ {
LLGLTFOverrideCacheEntry cache;
cache.mLocalId = local_id;
cache.mObjectId = id;
cache.mRegionHandle = region->getHandle();
- U32 count = llmin(tes.size(), MAX_TES);
- for (U32 i = 0; i < count; ++i)
+ auto count = llmin(tes.size(), MAX_TES);
+ for (size_t i = 0; i < count; ++i)
{
LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership
mat->applyOverrideLLSD(od[i]);
@@ -255,7 +252,7 @@ void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFM
{
#if 0
override_list_t& overrides = mQueuedOverrides[id];
-
+
if (overrides.size() < side + 1)
{
overrides.resize(side + 1);
@@ -375,7 +372,7 @@ void LLGLTFMaterialList::queueUpdate(const LLSD& data)
{
sUpdates = LLSD::emptyArray();
}
-
+
sUpdates[sUpdates.size()] = data;
}
@@ -383,7 +380,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool))
{
LLSD& data = sUpdates;
- S32 i = data.size();
+ auto i = data.size();
for (ModifyMaterialData& e : sModifyQueue)
{
@@ -395,7 +392,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool))
data[i]["object_id"] = e.object_id;
data[i]["side"] = e.side;
-
+
if (e.has_override)
{
data[i]["gltf_json"] = e.override_data.asJSON();
@@ -494,7 +491,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp
}
buffer.resize(size);
- file.read((U8*)&buffer[0], buffer.size());
+ file.read((U8*)&buffer[0], static_cast<S32>(buffer.size()));
}
{
@@ -503,7 +500,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp
LLSD asset;
// read file into buffer
- std::istrstream str(&buffer[0], buffer.size());
+ std::istrstream str(&buffer[0], static_cast<S32>(buffer.size()));
if (LLSDSerialize::deserialize(asset, str, buffer.size()))
{
@@ -520,7 +517,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp
LL_PROFILE_ZONE_SCOPED;
tinygltf::TinyGLTF gltf;
- if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), data.length(), ""))
+ if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), static_cast<U32>(data.length()), ""))
{
LL_WARNS("GLTF") << "Failed to decode material asset: "
<< LL_NEWLINE
@@ -581,7 +578,7 @@ LLFetchedGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id)
gAssetStorage->getAssetData(id, LLAssetType::AT_MATERIAL, onAssetLoadComplete, (void*)user_data);
}
-
+
return mat;
}