From cb3bd8865aa0f9fb8a247ea595cf1973057ba91f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 30 May 2024 15:41:36 +0200 Subject: Fix a bunch of uninitialized variable warnings that showed up in Visual Studio --- indra/llprimitive/llmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index ae195525ef..20d643d642 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -357,7 +357,7 @@ public: protected: LLUUID mDiffuseMapID; - void* mOpaqueData; // allow refs to viewer/platform-specific structs for each material + void* mOpaqueData{ nullptr }; // allow refs to viewer/platform-specific structs for each material // currently only stores an LLPointer< LLViewerFetchedTexture > > to // maintain refs to textures associated with each material for free // ref counting. -- cgit v1.2.3 From b42f9d836b4c0f7fbd4bdae1734021e2a09fdbe8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 1 Jun 2024 15:49:26 +0200 Subject: Re-enable a lot of compiler warnings for MSVC and address the C4267 "possible loss of precision" warnings --- indra/llprimitive/lldaeloader.cpp | 40 ++++++++++++++-------------- indra/llprimitive/llgltfloader.cpp | 2 +- indra/llprimitive/llgltfmaterial.cpp | 2 +- indra/llprimitive/llgltfmaterial_templates.h | 4 +-- indra/llprimitive/llmediaentry.cpp | 4 +-- indra/llprimitive/llmodel.cpp | 38 +++++++++++++------------- indra/llprimitive/llmodel.h | 4 +-- indra/llprimitive/llprimtexturelist.cpp | 24 ++++++++--------- indra/llprimitive/tests/llprimitive_test.cpp | 2 +- 9 files changed, 60 insertions(+), 60 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index de5a2fe1fa..9bc6c7092f 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -258,7 +258,7 @@ LLModel::EModelStatus load_face_from_dom_triangles( // Don't share verts within the same tri, degenerate // - U32 indx_size = indices.size(); + U32 indx_size = static_cast(indices.size()); U32 verts_new_tri = indx_size % 3; if ((verts_new_tri < 1 || indices[indx_size - 1] != shared_index) && (verts_new_tri < 2 || indices[indx_size - 2] != shared_index)) @@ -732,7 +732,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac { //for each vertex if (j > 2) { - U32 size = verts.size(); + auto size = verts.size(); LLVolumeFace::VertexData v0 = verts[size-3]; LLVolumeFace::VertexData v1 = verts[size-1]; @@ -1098,7 +1098,7 @@ bool LLDAELoader::OpenFile(const std::string& filename) while (model_iter != mModelList.end()) { LLModel* mdl = *model_iter; - U32 material_count = mdl->mMaterialList.size(); + U32 material_count = static_cast(mdl->mMaterialList.size()); LL_INFOS() << "Importing " << mdl->mLabel << " model with " << material_count << " material references" << LL_ENDL; std::vector::iterator mat_iter = mdl->mMaterialList.begin(); std::vector::iterator end_iter = material_count > LIMIT_MATERIALS_OUTPUT @@ -1287,11 +1287,11 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do { //Get the children at this level daeTArray< daeSmartRef > children = pScene->getChildren(); - S32 childCount = children.getCount(); + auto childCount = children.getCount(); //Process any children that are joints //Not all children are joints, some could be ambient lights, cameras, geometry etc.. - for (S32 i = 0; i < childCount; ++i) + for (size_t i = 0; i < childCount; ++i) { domNode* pNode = daeSafeCast(children[i]); if (pNode) @@ -1312,7 +1312,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if ( pSkeletonRootNode ) { //Once we have the root node - start acccessing it's joint components - const int jointCnt = mJointMap.size(); + const int jointCnt = static_cast(mJointMap.size()); JointMap :: const_iterator jointIt = mJointMap.begin(); //Loop over all the possible joints within the .dae - using the allowed joint list in the ctor. @@ -1453,9 +1453,9 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if (t) { domListOfFloats& transform = t->getValue(); - S32 count = transform.getCount()/16; + auto count = transform.getCount()/16; - for (S32 k = 0; k < count; ++k) + for (size_t k = 0; k < count; ++k) { LLMatrix4 mat; @@ -1531,7 +1531,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do //with the skeleton are not stored in the same order as they are in the exported joint buffer. //This remaps the skeletal joints to be in the same order as the joints stored in the model. std::vector :: const_iterator jointIt = model->mSkinInfo.mJointNames.begin(); - const int jointCnt = model->mSkinInfo.mJointNames.size(); + const int jointCnt = static_cast(model->mSkinInfo.mJointNames.size()); for ( int i=0; imSkinInfo.mAlternateBindMatrix.size(); + auto bind_count = model->mSkinInfo.mAlternateBindMatrix.size(); if (bind_count > 0 && bind_count != jointCnt) { LL_WARNS("Mesh") << "Model " << model->mLabel << " has invalid joint bind matrix list." << LL_ENDL; @@ -1699,8 +1699,8 @@ void LLDAELoader::buildJointToNodeMappingFromScene( daeElement* pRoot ) if ( pScene ) { daeTArray< daeSmartRef > children = pScene->getChildren(); - S32 childCount = children.getCount(); - for (S32 i = 0; i < childCount; ++i) + auto childCount = children.getCount(); + for (size_t i = 0; i < childCount; ++i) { domNode* pNode = daeSafeCast(children[i]); processJointToNodeMapping( pNode ); @@ -1745,8 +1745,8 @@ void LLDAELoader::processJointToNodeMapping( domNode* pNode ) void LLDAELoader::processChildJoints( domNode* pParentNode ) { daeTArray< daeSmartRef > childOfChild = pParentNode->getChildren(); - S32 childOfChildCount = childOfChild.getCount(); - for (S32 i = 0; i < childOfChildCount; ++i) + auto childOfChildCount = childOfChild.getCount(); + for (size_t i = 0; i < childOfChildCount; ++i) { domNode* pChildNode = daeSafeCast( childOfChild[i] ); if ( pChildNode ) @@ -1847,7 +1847,7 @@ bool LLDAELoader::verifyController( domController* pController ) { sum += pVertexWeights->getVcount()->getValue()[i]; } - result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); + result = verifyCount( sum * static_cast(inputs.getCount()), (domInt) static_cast(pVertexWeights->getV()->getValue().getCount()) ); } } @@ -1980,9 +1980,9 @@ void LLDAELoader::processJointNode( domNode* pNode, JointTransformMap& jointTran //Gather and handle the incoming nodes children daeTArray< daeSmartRef > childOfChild = pNode->getChildren(); - S32 childOfChildCount = childOfChild.getCount(); + auto childOfChildCount = childOfChild.getCount(); - for (S32 i = 0; i < childOfChildCount; ++i) + for (size_t i = 0; i < childOfChildCount; ++i) { domNode* pChildNode = daeSafeCast( childOfChild[i] ); if ( pChildNode ) @@ -2192,8 +2192,8 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da //process children daeTArray< daeSmartRef > children = element->getChildren(); - int childCount = children.getCount(); - for (S32 i = 0; i < childCount; i++) + auto childCount = children.getCount(); + for (size_t i = 0; i < childCount; i++) { processElement(children[i],badElement, dae); } @@ -2568,7 +2568,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector& mo ret->remapVolumeFaces(); } - volume_faces = remainder.size(); + volume_faces = static_cast(remainder.size()); models_out.push_back(ret); diff --git a/indra/llprimitive/llgltfloader.cpp b/indra/llprimitive/llgltfloader.cpp index 810b648f17..776f81cc01 100644 --- a/indra/llprimitive/llgltfloader.cpp +++ b/indra/llprimitive/llgltfloader.cpp @@ -231,7 +231,7 @@ bool LLGLTFLoader::parseMaterials() image.numChannels = in_image.component; image.bytesPerChannel = in_image.bits >> 3; // Convert bits to bytes image.pixelType = in_image.pixel_type; // Maps exactly, i.e. TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE == GL_UNSIGNED_BYTE, etc - image.size = in_image.image.size(); + image.size = static_cast(in_image.image.size()); image.height = in_image.height; image.width = in_image.width; image.data = in_image.image.data(); diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index 12af568b7e..dd4ab82abc 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -180,7 +180,7 @@ bool LLGLTFMaterial::fromJSON(const std::string& json, std::string& warn_msg, st tinygltf::Model model_in; - if (gltf.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, json.c_str(), json.length(), "")) + if (gltf.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, json.c_str(), static_cast(json.length()), "")) { setFromModel(model_in, 0); diff --git a/indra/llprimitive/llgltfmaterial_templates.h b/indra/llprimitive/llgltfmaterial_templates.h index 276cc71b19..4ec7f312af 100644 --- a/indra/llprimitive/llgltfmaterial_templates.h +++ b/indra/llprimitive/llgltfmaterial_templates.h @@ -87,12 +87,12 @@ void LLGLTFMaterial::setFromTexture(const tinygltf::Model& model, const T& textu template void LLGLTFMaterial::allocateTextureImage(tinygltf::Model& model, T& texture_info, const std::string& uri) { - const S32 image_idx = model.images.size(); + const S32 image_idx = static_cast(model.images.size()); model.images.emplace_back(); model.images[image_idx].uri = uri; // The texture, not to be confused with the texture info - const S32 texture_idx = model.textures.size(); + const S32 texture_idx = static_cast(model.textures.size()); model.textures.emplace_back(); tinygltf::Texture& texture = model.textures[texture_idx]; texture.source = image_idx; diff --git a/indra/llprimitive/llmediaentry.cpp b/indra/llprimitive/llmediaentry.cpp index e626a989f6..b5b17c53aa 100644 --- a/indra/llprimitive/llmediaentry.cpp +++ b/indra/llprimitive/llmediaentry.cpp @@ -353,7 +353,7 @@ U32 LLMediaEntry::setWhiteList( const std::vector &whitelist ) { // *NOTE: This code is VERY similar to the setWhitelist below. // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! - U32 size = 0; + size_t size = 0; U32 count = 0; // First count to make sure the size constraint is not violated std::vector::const_iterator iter = whitelist.begin(); @@ -394,7 +394,7 @@ U32 LLMediaEntry::setWhiteList( const LLSD &whitelist ) { // *NOTE: This code is VERY similar to the setWhitelist above. // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! - U32 size = 0; + size_t size = 0; U32 count = 0; // First check to make sure the size and count constraints are not violated LLSD::array_const_iterator iter = whitelist.beginArray(); diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 37917c0c04..6a322bb9ec 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -918,7 +918,7 @@ LLSD LLModel::writeModel( //copy ostr to binary buffer std::string data = ostr.str(); const U8* buff = (U8*)data.data(); - U32 bytes = data.size(); + U32 bytes = static_cast(data.size()); LLSD::Binary w(bytes); for (U32 j = 0; j < bytes; ++j) @@ -965,7 +965,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, bool nowrite, bo { //write out skin block skin = zip_llsd(mdl["skin"]); - U32 size = skin.size(); + U32 size = static_cast(skin.size()); if (size > 0) { header["skin"]["offset"] = (LLSD::Integer) cur_offset; @@ -980,7 +980,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, bool nowrite, bo { //write out convex decomposition decomposition = zip_llsd(mdl["physics_convex"]); - U32 size = decomposition.size(); + U32 size = static_cast(decomposition.size()); if (size > 0) { header["physics_convex"]["offset"] = (LLSD::Integer) cur_offset; @@ -1002,7 +1002,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, bool nowrite, bo { out[i] = zip_llsd(mdl[model_names[i]]); - U32 size = out[i].size(); + U32 size = static_cast(out[i].size()); header[model_names[i]]["offset"] = (LLSD::Integer) cur_offset; header[model_names[i]]["size"] = (LLSD::Integer) size; @@ -1159,7 +1159,7 @@ void LLModel::updateHullCenters() mCenterOfHullCenters += cur_center; cur_center *= 1.f/mPhysics.mHull[i].size(); mHullCenter[i] = cur_center; - mHullPoints += mPhysics.mHull[i].size(); + mHullPoints += static_cast(mPhysics.mHull[i].size()); } if (mHullPoints > 0) @@ -1280,14 +1280,14 @@ bool LLModel::loadModel(std::istream& is) bool LLModel::isMaterialListSubset( LLModel* ref ) { - int refCnt = ref->mMaterialList.size(); - int modelCnt = mMaterialList.size(); + auto refCnt = ref->mMaterialList.size(); + auto modelCnt = mMaterialList.size(); - for (U32 src = 0; src < modelCnt; ++src) + for (size_t src = 0; src < modelCnt; ++src) { bool foundRef = false; - for (U32 dst = 0; dst < refCnt; ++dst) + for (size_t dst = 0; dst < refCnt; ++dst) { //LL_INFOS()<mMaterialList[dst]<mMaterialList[dst]; @@ -1630,15 +1630,15 @@ U32 LLMeshSkinInfo::sizeBytes() const { U32 res = sizeof(LLUUID); // mMeshID - res += sizeof(std::vector) + sizeof(std::string) * mJointNames.size(); + res += sizeof(std::vector) + sizeof(std::string) * static_cast(mJointNames.size()); for (U32 i = 0; i < mJointNames.size(); ++i) { - res += mJointNames[i].size(); // actual size, not capacity + res += static_cast(mJointNames[i].size()); // actual size, not capacity } - res += sizeof(std::vector) + sizeof(S32) * mJointNums.size(); - res += sizeof(std::vector) + 16 * sizeof(float) * mInvBindMatrix.size(); - res += sizeof(std::vector) + 16 * sizeof(float) * mAlternateBindMatrix.size(); + res += sizeof(std::vector) + sizeof(S32) * static_cast(mJointNums.size()); + res += sizeof(std::vector) + 16 * sizeof(float) * static_cast(mInvBindMatrix.size()); + res += sizeof(std::vector) + 16 * sizeof(float) * static_cast(mAlternateBindMatrix.size()); res += 16 * sizeof(float); //mBindShapeMatrix res += sizeof(float) + 3 * sizeof(bool); @@ -1755,15 +1755,15 @@ U32 LLModel::Decomposition::sizeBytes() const { U32 res = sizeof(LLUUID); // mMeshID - res += sizeof(LLModel::convex_hull_decomposition) + sizeof(std::vector) * mHull.size(); + res += sizeof(LLModel::convex_hull_decomposition) + sizeof(std::vector) * static_cast(mHull.size()); for (U32 i = 0; i < mHull.size(); ++i) { - res += mHull[i].size() * sizeof(LLVector3); + res += static_cast(mHull[i].size()) * sizeof(LLVector3); } - res += sizeof(LLModel::hull) + sizeof(LLVector3) * mBaseHull.size(); + res += sizeof(LLModel::hull) + sizeof(LLVector3) * static_cast(mBaseHull.size()); - res += sizeof(std::vector) + sizeof(std::vector) * mMesh.size(); + res += sizeof(std::vector) + sizeof(std::vector) * static_cast(mMesh.size()); for (U32 i = 0; i < mMesh.size(); ++i) { res += mMesh[i].sizeBytes(); @@ -1814,7 +1814,7 @@ LLSD LLModel::Decomposition::asLLSD() const for (U32 i = 0; i < mHull.size(); ++i) { - U32 size = mHull[i].size(); + U32 size = static_cast(mHull[i].size()); total += size; hulls[i] = (U8) (size); diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 20d643d642..b0cba2d655 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -122,8 +122,8 @@ public: U32 sizeBytes() const { U32 res = sizeof(std::vector) * 2; - res += sizeof(LLVector3) * mPositions.size(); - res += sizeof(LLVector3) * mNormals.size(); + res += sizeof(LLVector3) * static_cast(mPositions.size()); + res += sizeof(LLVector3) * static_cast(mNormals.size()); return res; } }; diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp index ce4df843ea..68f3f5ffac 100644 --- a/indra/llprimitive/llprimtexturelist.cpp +++ b/indra/llprimitive/llprimtexturelist.cpp @@ -83,13 +83,13 @@ void LLPrimTextureList::clear() void LLPrimTextureList::copy(const LLPrimTextureList& other_list) { // compare the sizes - S32 this_size = mEntryList.size(); - S32 other_size = other_list.mEntryList.size(); + auto this_size = mEntryList.size(); + auto other_size = other_list.mEntryList.size(); if (this_size > other_size) { // remove the extra entries - for (S32 index = this_size; index > other_size; --index) + for (size_t index = this_size; index > other_size; --index) { delete mEntryList[index-1]; } @@ -97,18 +97,18 @@ void LLPrimTextureList::copy(const LLPrimTextureList& other_list) this_size = other_size; } - S32 index = 0; + size_t index = 0; // copy for the entries that already exist for ( ; index < this_size; ++index) { delete mEntryList[index]; - mEntryList[index] = other_list.getTexture(index)->newCopy(); + mEntryList[index] = other_list.getTexture(static_cast(index))->newCopy(); } // add new entires if needed for ( ; index < other_size; ++index) { - mEntryList.push_back( other_list.getTexture(index)->newCopy() ); + mEntryList.push_back( other_list.getTexture(static_cast(index))->newCopy()); } } @@ -127,9 +127,9 @@ void LLPrimTextureList::take(LLPrimTextureList& other_list) // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te) { - if (S32(index) >= mEntryList.size()) + if (size_t(index) >= mEntryList.size()) { - S32 current_size = mEntryList.size(); + auto current_size = mEntryList.size(); LL_WARNS() << "ignore copy of index = " << S32(index) << " into texture entry list of size = " << current_size << LL_ENDL; return TEM_CHANGE_NONE; } @@ -389,7 +389,7 @@ LLMaterialPtr LLPrimTextureList::getMaterialParams(const U8 index) S32 LLPrimTextureList::size() const { - return mEntryList.size(); + return static_cast(mEntryList.size()); } // sets the size of the mEntryList container @@ -400,12 +400,12 @@ void LLPrimTextureList::setSize(S32 new_size) new_size = 0; } - S32 current_size = mEntryList.size(); + auto current_size = mEntryList.size(); if (new_size > current_size) { mEntryList.resize(new_size); - for (S32 index = current_size; index < new_size; ++index) + for (size_t index = current_size; index < new_size; ++index) { if (current_size > 0 && mEntryList[current_size - 1]) @@ -423,7 +423,7 @@ void LLPrimTextureList::setSize(S32 new_size) } else if (new_size < current_size) { - for (S32 index = current_size-1; index >= new_size; --index) + for (size_t index = current_size-1; index >= new_size; --index) { delete mEntryList[index]; } diff --git a/indra/llprimitive/tests/llprimitive_test.cpp b/indra/llprimitive/tests/llprimitive_test.cpp index 60960067d0..0213a3e8b6 100644 --- a/indra/llprimitive/tests/llprimitive_test.cpp +++ b/indra/llprimitive/tests/llprimitive_test.cpp @@ -109,7 +109,7 @@ void LLPrimTextureList::take(LLPrimTextureList &other_list) { } void LLPrimTextureList::setSize(S32 new_size) { mEntryList.resize(new_size); } void LLPrimTextureList::setAllIDs(const LLUUID &id) { } LLTextureEntry * LLPrimTextureList::getTexture(const U8 index) const { return nullptr; } -S32 LLPrimTextureList::size() const { return mEntryList.size(); } +S32 LLPrimTextureList::size() const { return static_cast(mEntryList.size()); } class PRIMITIVE_TEST_SETUP { -- cgit v1.2.3 From c0fad3028fd55c2067ce6a0ae4382cffe1014284 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 10 Jun 2024 16:42:43 +0200 Subject: Re-enable compiler warnings C4018, C4100, C4231 and C4506 --- indra/llprimitive/lldaeloader.cpp | 6 +++--- indra/llprimitive/llmodel.cpp | 44 +++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 9bc6c7092f..1480322935 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -1000,9 +1000,9 @@ bool LLDAELoader::OpenFile(const std::string& filename) //Verify some basic properties of the dae //1. Basic validity check on controller - U32 controllerCount = (int) db->getElementCount( NULL, "controller" ); + U32 controllerCount = db->getElementCount(NULL, "controller"); bool result = false; - for ( int i=0; igetElement( (daeElement**) &pController, i , NULL, "controller" ); @@ -1255,7 +1255,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do //Some collada setup for accessing the skeleton U32 skeleton_count = dae->getDatabase()->getElementCount( NULL, "skeleton" ); std::vector skeletons; - for (S32 i=0; igetDatabase()->getElement( &pElement, i, 0, "skeleton" ); diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 6a322bb9ec..e7152a2291 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -101,7 +101,7 @@ void LLModel::offsetMesh( const LLVector3& pivotPoint ) LLVolumeFace& face = *currentFaceIt; LLVector4a *pos = (LLVector4a*) face.mPositions; - for (U32 i=0; i new_count)) + if (new_count > 0 && ((U32)getNumVolumeFaces() > new_count)) { // Copy out remaining volume faces for alternative handling, if provided // @@ -224,7 +224,7 @@ void LLModel::normalizeVolumeFaces() min_tc = face.mTexCoords[0]; max_tc = face.mTexCoords[0]; - for (U32 j = 1; j < face.mNumVertices; ++j) + for (S32 j = 1; j < face.mNumVertices; ++j) { update_min_max(min_tc, max_tc, face.mTexCoords[j]); } @@ -299,7 +299,7 @@ void LLModel::normalizeVolumeFaces() LLVector4a* norm = (LLVector4a*) face.mNormals; LLVector4a* t = (LLVector4a*)face.mTangents; - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { pos[j].add(trans); pos[j].mul(scale); @@ -363,7 +363,7 @@ LLVector3 LLModel::getTransformedCenter(const LLMatrix4& mat) { LLVolumeFace& face = mVolumeFaces[i]; - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { m.affineTransform(face.mPositions[j],t); update_min_max(minv, maxv, t); @@ -475,7 +475,7 @@ void LLModel::generateNormals(F32 angle_cutoff) faceted.resizeVertices(vol_face.mNumIndices); faceted.resizeIndices(vol_face.mNumIndices); //bake out triangles into temporary face, clearing texture coordinates - for (U32 i = 0; i < vol_face.mNumIndices; ++i) + for (S32 i = 0; i < vol_face.mNumIndices; ++i) { U32 idx = vol_face.mIndices[i]; @@ -485,7 +485,7 @@ void LLModel::generateNormals(F32 angle_cutoff) } //generate normals for temporary face - for (U32 i = 0; i < faceted.mNumIndices; i += 3) + for (S32 i = 0; i < faceted.mNumIndices; i += 3) { //for each triangle U16 i0 = faceted.mIndices[i+0]; U16 i1 = faceted.mIndices[i+1]; @@ -514,12 +514,12 @@ void LLModel::generateNormals(F32 angle_cutoff) //generate normals for welded face based on new topology (step 3) - for (U32 i = 0; i < faceted.mNumVertices; i++) + for (S32 i = 0; i < faceted.mNumVertices; i++) { faceted.mNormals[i].clear(); } - for (U32 i = 0; i < faceted.mNumIndices; i += 3) + for (S32 i = 0; i < faceted.mNumIndices; i += 3) { //for each triangle U16 i0 = faceted.mIndices[i+0]; U16 i1 = faceted.mIndices[i+1]; @@ -548,7 +548,7 @@ void LLModel::generateNormals(F32 angle_cutoff) //normalize normals and build point map LLVolumeFace::VertexMapData::PointMap point_map; - for (U32 i = 0; i < faceted.mNumVertices; ++i) + for (S32 i = 0; i < faceted.mNumVertices; ++i) { faceted.mNormals[i].normalize3(); @@ -566,7 +566,7 @@ void LLModel::generateNormals(F32 angle_cutoff) new_face.resizeIndices(vol_face.mNumIndices); new_face.resizeVertices(vol_face.mNumIndices); - for (U32 i = 0; i < vol_face.mNumIndices; ++i) + for (S32 i = 0; i < vol_face.mNumIndices; ++i) { U32 idx = vol_face.mIndices[i]; LLVolumeFace::VertexData v; @@ -577,7 +577,7 @@ void LLModel::generateNormals(F32 angle_cutoff) if (vol_face.mTexCoords) { - for (U32 i = 0; i < vol_face.mNumIndices; i++) + for (S32 i = 0; i < vol_face.mNumIndices; i++) { U32 idx = vol_face.mIndices[i]; new_face.mTexCoords[i] = vol_face.mTexCoords[idx]; @@ -590,7 +590,7 @@ void LLModel::generateNormals(F32 angle_cutoff) } //generate normals for new face - for (U32 i = 0; i < new_face.mNumIndices; i += 3) + for (S32 i = 0; i < new_face.mNumIndices; i += 3) { //for each triangle U16 i0 = new_face.mIndices[i+0]; U16 i1 = new_face.mIndices[i+1]; @@ -615,7 +615,7 @@ void LLModel::generateNormals(F32 angle_cutoff) } //swap out normals in new_face with best match from point map (step 5) - for (U32 i = 0; i < new_face.mNumVertices; ++i) + for (S32 i = 0; i < new_face.mNumVertices; ++i) { //LLVolumeFace::VertexData v = new_face.mVertices[i]; @@ -725,7 +725,7 @@ LLSD LLModel::writeModel( for (S32 i = 0; i < model[idx]->getNumVolumeFaces(); ++i) { //for each face const LLVolumeFace& face = model[idx]->getVolumeFace(i); - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { update_min_max(min_pos, max_pos, face.mPositions[j].getF32ptr()); } @@ -762,7 +762,7 @@ LLSD LLModel::writeModel( max_tc = min_tc; //get texture coordinate domain - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { update_min_max(min_tc, max_tc, ftc[j]); } @@ -770,7 +770,7 @@ LLSD LLModel::writeModel( LLVector2 tc_range = max_tc - min_tc; - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { //for each vert F32* pos = face.mPositions[j].getF32ptr(); @@ -840,7 +840,7 @@ LLSD LLModel::writeModel( } U32 idx_idx = 0; - for (U32 j = 0; j < face.mNumIndices; ++j) + for (S32 j = 0; j < face.mNumIndices; ++j) { U8* buff = (U8*) &(face.mIndices[j]); indices[idx_idx++] = buff[0]; @@ -887,7 +887,7 @@ LLSD LLModel::writeModel( // a bone index of 0xFF signifies no more influences for this vertex std::stringstream ostr; - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { LLVector3 pos(face.mPositions[j].getF32ptr()); @@ -2015,7 +2015,7 @@ bool ll_is_degenerate(const LLVector4a& a, const LLVector4a& b, const LLVector4a bool validate_face(const LLVolumeFace& face) { - for (U32 i = 0; i < face.mNumIndices; ++i) + for (S32 i = 0; i < face.mNumIndices; ++i) { if (face.mIndices[i] >= face.mNumVertices) { -- cgit v1.2.3 From 4b52dd754b41948efca0087ccac6d813f1fcce3f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 10 Jun 2024 18:16:13 +0200 Subject: Fix incorrect use of VX/VY/VZ/VW indices when color components are accessed --- indra/llprimitive/lltextureentry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index 684660e24a..9ebbeac482 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -407,9 +407,9 @@ S32 LLTextureEntry::setColor(const LLColor3 &color) S32 LLTextureEntry::setAlpha(const F32 alpha) { - if (mColor.mV[VW] != alpha) + if (mColor.mV[VALPHA] != alpha) { - mColor.mV[VW] = alpha; + mColor.mV[VALPHA] = alpha; return TEM_CHANGE_COLOR; } return TEM_CHANGE_NONE; -- cgit v1.2.3 From c95b4bf3ea2b681d6d05468b07e60fedb71fa2cf Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 10 Jun 2024 20:42:42 +0300 Subject: Post-merge - trim trailing whitespace --- indra/llprimitive/llgltfmaterial.cpp | 14 +++++++------- indra/llprimitive/llmaterial.h | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index dd4ab82abc..e6cc070114 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -5,21 +5,21 @@ * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -72,7 +72,7 @@ LLGLTFMaterial::LLGLTFMaterial() #if 0 mTextureTransform[i].mOffset.clear(); mTextureTransform[i].mRotation = 0.f; -#endif +#endif } #if 0 mLocalTexDataDigest = 0; @@ -783,7 +783,7 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data) { mMetallicFactor = mf.asReal(); if (mMetallicFactor == getDefaultMetallicFactor()) - { + { // HACK -- nudge by epsilon if we receive a default value (indicates override to default) mMetallicFactor -= FLT_EPSILON; } @@ -794,7 +794,7 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data) { mRoughnessFactor = rf.asReal(); if (mRoughnessFactor == getDefaultRoughnessFactor()) - { + { // HACK -- nudge by epsilon if we receive a default value (indicates override to default) mRoughnessFactor -= FLT_EPSILON; } diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index 2bed37cbde..a7719c1475 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -5,21 +5,21 @@ * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -- cgit v1.2.3 From 1ebf62e102cb3f328aa90809f7f5060b8f065db1 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 11 Jun 2024 15:40:09 +0200 Subject: Clean up line endings that got mangled up during last merge --- indra/llprimitive/llgltfmaterial.h | 10 +++++----- indra/llprimitive/tests/llgltfmaterial_test.cpp | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index e9b48a60dd..f501a03854 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -5,21 +5,21 @@ * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -178,7 +178,7 @@ public: void writeToModel(tinygltf::Model& model, S32 mat_index) const; virtual void applyOverride(const LLGLTFMaterial& override_mat); - + // apply the given LLSD override data void applyOverrideLLSD(const LLSD& data); diff --git a/indra/llprimitive/tests/llgltfmaterial_test.cpp b/indra/llprimitive/tests/llgltfmaterial_test.cpp index 823a36ec3a..7a276c7b82 100644 --- a/indra/llprimitive/tests/llgltfmaterial_test.cpp +++ b/indra/llprimitive/tests/llgltfmaterial_test.cpp @@ -1,26 +1,26 @@ -/** +/** * @file llgltfmaterial_test.cpp * - * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ + * $/LicenseInfo$ */ #include "linden_common.h" -- cgit v1.2.3 From 8444cd9562a6a7b755fcb075864e205122354192 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Wed, 12 Jun 2024 13:51:21 -0700 Subject: Fix whitespace pre-commit hook failures --- indra/llprimitive/tests/llgltfmaterial_test.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/tests/llgltfmaterial_test.cpp b/indra/llprimitive/tests/llgltfmaterial_test.cpp index 585b9da3ad..4f2de82386 100644 --- a/indra/llprimitive/tests/llgltfmaterial_test.cpp +++ b/indra/llprimitive/tests/llgltfmaterial_test.cpp @@ -1,26 +1,26 @@ -/** +/** * @file llgltfmaterial_test.cpp * - * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ + * $/LicenseInfo$ */ #include "linden_common.h" -- cgit v1.2.3