summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lldaeloader.cpp46
-rw-r--r--indra/llprimitive/llgltfloader.cpp2
-rw-r--r--indra/llprimitive/llgltfmaterial.cpp16
-rw-r--r--indra/llprimitive/llgltfmaterial.h37
-rw-r--r--indra/llprimitive/llgltfmaterial_templates.h4
-rw-r--r--indra/llprimitive/llmaterial.h8
-rw-r--r--indra/llprimitive/llmediaentry.cpp4
-rw-r--r--indra/llprimitive/llmodel.cpp82
-rw-r--r--indra/llprimitive/llmodel.h6
-rw-r--r--indra/llprimitive/llprimtexturelist.cpp24
-rw-r--r--indra/llprimitive/lltextureentry.cpp4
-rw-r--r--indra/llprimitive/tests/llprimitive_test.cpp2
12 files changed, 115 insertions, 120 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index de5a2fe1fa..1480322935 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<U32>(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<LLVolumeFace>& 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];
@@ -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; i<controllerCount; ++i )
+ for (U32 i = 0; i < controllerCount; ++i)
{
domController* pController = NULL;
db->getElement( (daeElement**) &pController, i , NULL, "controller" );
@@ -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<U32>(mdl->mMaterialList.size());
LL_INFOS() << "Importing " << mdl->mLabel << " model with " << material_count << " material references" << LL_ENDL;
std::vector<std::string>::iterator mat_iter = mdl->mMaterialList.begin();
std::vector<std::string>::iterator end_iter = material_count > LIMIT_MATERIALS_OUTPUT
@@ -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<domInstance_controller::domSkeleton*> skeletons;
- for (S32 i=0; i<skeleton_count; i++)
+ for (U32 i = 0; i < skeleton_count; i++)
{
daeElement* pElement = 0;
dae->getDatabase()->getElement( &pElement, i, 0, "skeleton" );
@@ -1287,11 +1287,11 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
{
//Get the children at this level
daeTArray< daeSmartRef<daeElement> > 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<domNode>(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<int>(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<std::string> :: const_iterator jointIt = model->mSkinInfo.mJointNames.begin();
- const int jointCnt = model->mSkinInfo.mJointNames.size();
+ const int jointCnt = static_cast<int>(model->mSkinInfo.mJointNames.size());
for ( int i=0; i<jointCnt; ++i, ++jointIt )
{
std::string lookingForJoint = (*jointIt).c_str();
@@ -1550,7 +1550,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
}
}
- U32 bind_count = model->mSkinInfo.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<daeElement> > 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<domNode>(children[i]);
processJointToNodeMapping( pNode );
@@ -1745,8 +1745,8 @@ void LLDAELoader::processJointToNodeMapping( domNode* pNode )
void LLDAELoader::processChildJoints( domNode* pParentNode )
{
daeTArray< daeSmartRef<daeElement> > 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<domNode>( 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<U32>(inputs.getCount()), (domInt) static_cast<int>(pVertexWeights->getV()->getValue().getCount()) );
}
}
@@ -1980,9 +1980,9 @@ void LLDAELoader::processJointNode( domNode* pNode, JointTransformMap& jointTran
//Gather and handle the incoming nodes children
daeTArray< daeSmartRef<daeElement> > 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<domNode>( childOfChild[i] );
if ( pChildNode )
@@ -2192,8 +2192,8 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
//process children
daeTArray< daeSmartRef<daeElement> > 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<LLModel*>& mo
ret->remapVolumeFaces();
}
- volume_faces = remainder.size();
+ volume_faces = static_cast<U32>(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<U32>(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 008c72462c..e8c9af5ea3 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;
@@ -189,7 +189,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<unsigned int>(json.length()), ""))
{
setFromModel(model_in, 0);
@@ -792,7 +792,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;
}
@@ -803,7 +803,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/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h
index e04b6d5eee..10df4c8ee1 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$
*/
@@ -115,18 +115,6 @@ public:
static const char* const GLTF_FILE_EXTENSION_TRANSFORM_ROTATION;
static const LLUUID GLTF_OVERRIDE_NULL_UUID;
- // *TODO: If/when we implement additional GLTF extensions, they may not be
- // compatible with our GLTF terrain implementation. We may want to disallow
- // materials with some features from being set on terrain, if their
- // implementation on terrain is not compliant with the spec:
- // - KHR_materials_transmission: Probably OK?
- // - KHR_materials_ior: Probably OK?
- // - KHR_materials_volume: Likely incompatible, as our terrain
- // heightmaps cannot currently be described as finite enclosed
- // volumes.
- // See also LLPanelRegionTerrainInfo::validateMaterials
-public:
-
// get a UUID based on a hash of this LLGLTFMaterial
LLUUID getHash() const;
@@ -195,7 +183,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);
@@ -249,10 +237,17 @@ protected:
void updateLocalTexDataDigest();
public:
+ // *TODO: If/when we implement additional GLTF extensions, they may not be
+ // compatible with our GLTF terrain implementation. We may want to disallow
+ // materials with some features from being set on terrain, if their
+ // implementation on terrain is not compliant with the spec:
+ // - KHR_materials_transmission: Probably OK?
+ // - KHR_materials_ior: Probably OK?
+ // - KHR_materials_volume: Likely incompatible, as our terrain
+ // heightmaps cannot currently be described as finite enclosed
+ // volumes.
+ // See also LLPanelRegionTerrainInfo::validateMaterials
// These fields are local to viewer and are a part of local bitmap support
- // IMPORTANT: do not move this member down (and do not move
- // mLocalTexDataDigest either): the getHash() method does rely on the
- // current ordering. HB
typedef std::map<LLUUID, LLUUID> local_tex_map_t;
local_tex_map_t mTrackingIdToLocalTexture;
@@ -273,7 +268,7 @@ public:
F32 mAlphaCutoff;
AlphaMode mAlphaMode;
-
+
bool mDoubleSided = false;
// Override specific flags for state that can't use off-by-epsilon or UUID
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<typename T>
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<S32>(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<S32>(model.textures.size());
model.textures.emplace_back();
tinygltf::Texture& texture = model.textures[texture_idx];
texture.source = image_idx;
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$
*/
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<std::string> &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<std::string>::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..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<face.mNumVertices; ++i )
+ for (S32 i=0; i<face.mNumVertices; ++i )
{
pos[i].add( pivot );
}
@@ -110,7 +110,7 @@ void LLModel::offsetMesh( const LLVector3& pivotPoint )
void LLModel::remapVolumeFaces()
{
- for (U32 i = 0; i < getNumVolumeFaces(); ++i)
+ for (S32 i = 0; i < getNumVolumeFaces(); ++i)
{
mVolumeFaces[i].remap();
}
@@ -118,7 +118,7 @@ void LLModel::remapVolumeFaces()
void LLModel::optimizeVolumeFaces()
{
- for (U32 i = 0; i < getNumVolumeFaces(); ++i)
+ for (S32 i = 0; i < getNumVolumeFaces(); ++i)
{
mVolumeFaces[i].optimize();
}
@@ -173,7 +173,7 @@ void LLModel::trimVolumeFacesToSize(U32 new_count, LLVolume::face_list_t* remain
{
llassert(new_count <= LL_SCULPT_MESH_MAX_FACES);
- if (new_count && (getNumVolumeFaces() > 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());
@@ -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<U32>(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<U32>(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<U32>(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<U32>(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<U32>(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[src]<<" "<<ref->mMaterialList[dst]<<LL_ENDL;
foundRef = mMaterialList[src] == ref->mMaterialList[dst];
@@ -1630,15 +1630,15 @@ U32 LLMeshSkinInfo::sizeBytes() const
{
U32 res = sizeof(LLUUID); // mMeshID
- res += sizeof(std::vector<std::string>) + sizeof(std::string) * mJointNames.size();
+ res += sizeof(std::vector<std::string>) + sizeof(std::string) * static_cast<U32>(mJointNames.size());
for (U32 i = 0; i < mJointNames.size(); ++i)
{
- res += mJointNames[i].size(); // actual size, not capacity
+ res += static_cast<U32>(mJointNames[i].size()); // actual size, not capacity
}
- res += sizeof(std::vector<S32>) + sizeof(S32) * mJointNums.size();
- res += sizeof(std::vector<LLMatrix4>) + 16 * sizeof(float) * mInvBindMatrix.size();
- res += sizeof(std::vector<LLMatrix4>) + 16 * sizeof(float) * mAlternateBindMatrix.size();
+ res += sizeof(std::vector<S32>) + sizeof(S32) * static_cast<U32>(mJointNums.size());
+ res += sizeof(std::vector<LLMatrix4>) + 16 * sizeof(float) * static_cast<U32>(mInvBindMatrix.size());
+ res += sizeof(std::vector<LLMatrix4>) + 16 * sizeof(float) * static_cast<U32>(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<LLVector3>) * mHull.size();
+ res += sizeof(LLModel::convex_hull_decomposition) + sizeof(std::vector<LLVector3>) * static_cast<U32>(mHull.size());
for (U32 i = 0; i < mHull.size(); ++i)
{
- res += mHull[i].size() * sizeof(LLVector3);
+ res += static_cast<U32>(mHull[i].size()) * sizeof(LLVector3);
}
- res += sizeof(LLModel::hull) + sizeof(LLVector3) * mBaseHull.size();
+ res += sizeof(LLModel::hull) + sizeof(LLVector3) * static_cast<U32>(mBaseHull.size());
- res += sizeof(std::vector<LLModel::PhysicsMesh>) + sizeof(std::vector<LLModel::PhysicsMesh>) * mMesh.size();
+ res += sizeof(std::vector<LLModel::PhysicsMesh>) + sizeof(std::vector<LLModel::PhysicsMesh>) * static_cast<U32>(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<U32>(mHull[i].size());
total += size;
hulls[i] = (U8) (size);
@@ -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)
{
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index ae195525ef..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<LLVector3>) * 2;
- res += sizeof(LLVector3) * mPositions.size();
- res += sizeof(LLVector3) * mNormals.size();
+ res += sizeof(LLVector3) * static_cast<U32>(mPositions.size());
+ res += sizeof(LLVector3) * static_cast<U32>(mNormals.size());
return res;
}
};
@@ -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.
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<U8>(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<U8>(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<S32>(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/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp
index 2ed8f8c044..ac482ffbf9 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;
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<S32>(mEntryList.size()); }
class PRIMITIVE_TEST_SETUP
{