prep linden avatar prep linden committed 9d427b0

Fix for path-826. Safeguarding against a mull weight being used

Comments (0)

Files changed (1)

indra/newview/llvovolume.cpp

 		
 		LLVector4a* weight = vol_face.mWeights;
 
-		LLMatrix4a bind_shape_matrix;
-		bind_shape_matrix.loadu(skin->mBindShapeMatrix);
-
-		LLVector4a* pos = dst_face.mPositions;
-
+		if ( weight )
 		{
-			LLFastTimer t(FTM_SKIN_RIGGED);
-
-			for (U32 j = 0; j < dst_face.mNumVertices; ++j)
+			LLMatrix4a bind_shape_matrix;
+			bind_shape_matrix.loadu(skin->mBindShapeMatrix);
+
+			LLVector4a* pos = dst_face.mPositions;
+
 			{
-				LLMatrix4a final_mat;
-				final_mat.clear();
-
-				S32 idx[4];
-
-				LLVector4 wght;
-
-				F32 scale = 0.f;
-				for (U32 k = 0; k < 4; k++)
+				LLFastTimer t(FTM_SKIN_RIGGED);
+
+				for (U32 j = 0; j < dst_face.mNumVertices; ++j)
 				{
-					F32 w = weight[j][k];
-
-					idx[k] = (S32) floorf(w);
-					wght[k] = w - floorf(w);
-					scale += wght[k];
+					LLMatrix4a final_mat;
+					final_mat.clear();
+
+					S32 idx[4];
+
+					LLVector4 wght;
+
+					F32 scale = 0.f;
+					for (U32 k = 0; k < 4; k++)
+					{
+						F32 w = weight[j][k];
+
+						idx[k] = (S32) floorf(w);
+						wght[k] = w - floorf(w);
+						scale += wght[k];
+					}
+
+					wght *= 1.f/scale;
+
+					for (U32 k = 0; k < 4; k++)
+					{
+						F32 w = wght[k];
+
+						LLMatrix4a src;
+						src.setMul(mp[idx[k]], w);
+
+						final_mat.add(src);
+					}
+
+				
+					LLVector4a& v = vol_face.mPositions[j];
+					LLVector4a t;
+					LLVector4a dst;
+					bind_shape_matrix.affineTransform(v, t);
+					final_mat.affineTransform(t, dst);
+					pos[j] = dst;
 				}
 
-				wght *= 1.f/scale;
-
-				for (U32 k = 0; k < 4; k++)
+				//update bounding box
+				LLVector4a& min = dst_face.mExtents[0];
+				LLVector4a& max = dst_face.mExtents[1];
+
+				min = pos[0];
+				max = pos[1];
+
+				for (U32 j = 1; j < dst_face.mNumVertices; ++j)
 				{
-					F32 w = wght[k];
-
-					LLMatrix4a src;
-					src.setMul(mp[idx[k]], w);
-
-					final_mat.add(src);
+					min.setMin(min, pos[j]);
+					max.setMax(max, pos[j]);
 				}
 
-				
-				LLVector4a& v = vol_face.mPositions[j];
-				LLVector4a t;
-				LLVector4a dst;
-				bind_shape_matrix.affineTransform(v, t);
-				final_mat.affineTransform(t, dst);
-				pos[j] = dst;
+				dst_face.mCenter->setAdd(dst_face.mExtents[0], dst_face.mExtents[1]);
+				dst_face.mCenter->mul(0.5f);
+
 			}
 
-			//update bounding box
-			LLVector4a& min = dst_face.mExtents[0];
-			LLVector4a& max = dst_face.mExtents[1];
-
-			min = pos[0];
-			max = pos[1];
-
-			for (U32 j = 1; j < dst_face.mNumVertices; ++j)
 			{
-				min.setMin(min, pos[j]);
-				max.setMax(max, pos[j]);
+				LLFastTimer t(FTM_RIGGED_OCTREE);
+				delete dst_face.mOctree;
+				dst_face.mOctree = NULL;
+
+				LLVector4a size;
+				size.setSub(dst_face.mExtents[1], dst_face.mExtents[0]);
+				size.splat(size.getLength3().getF32()*0.5f);
+			
+				dst_face.createOctree(1.f);
 			}
-
-			dst_face.mCenter->setAdd(dst_face.mExtents[0], dst_face.mExtents[1]);
-			dst_face.mCenter->mul(0.5f);
-
-		}
-
-		{
-			LLFastTimer t(FTM_RIGGED_OCTREE);
-			delete dst_face.mOctree;
-			dst_face.mOctree = NULL;
-
-			LLVector4a size;
-			size.setSub(dst_face.mExtents[1], dst_face.mExtents[0]);
-			size.splat(size.getLength3().getF32()*0.5f);
-			
-			dst_face.createOctree(1.f);
 		}
 	}
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.