summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-10-29 16:10:17 -0500
committerDave Parks <davep@lindenlab.com>2010-10-29 16:10:17 -0500
commited29cac3a18aeaa366b51c9d5ad89e128787b11f (patch)
treea53fbbb47c042f000f2c64254db57dee75d1a708 /indra/llmath
parent2ca8a4865ade974b556d4a9c14ad378814c4e7a6 (diff)
SH-92 Fix for busted bounding boxes for mirrored meshes.
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llvolume.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 2411bb7900..9fe4c622d7 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -2320,12 +2320,6 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
pos_range.setSub(max_pos, min_pos);
LLVector2 tc_range = max_tc - min_tc;
- LLVector4a& min = face.mExtents[0];
- LLVector4a& max = face.mExtents[1];
-
- min.clear();
- max.clear();
-
LLVector4a* pos_out = face.mPositions;
LLVector4a* norm_out = face.mNormals;
LLVector2* tc_out = face.mTexCoords;
@@ -2339,17 +2333,6 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
pos_out->mul(pos_range);
pos_out->add(min_pos);
- if (j == 0)
- {
- min = *pos_out;
- max = min;
- }
- else
- {
- min.setMin(min, *pos_out);
- max.setMax(max, *pos_out);
- }
-
pos_out++;
U16* n = (U16*) &(norm[j*3*2]);
@@ -2426,6 +2409,19 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
}
}
+ //calculate bounding box
+ LLVector4a& min = face.mExtents[0];
+ LLVector4a& max = face.mExtents[1];
+
+ min.clear();
+ max.clear();
+ min = max = face.mPositions[0];
+
+ for (S32 i = 1; i < face.mNumVertices; ++i)
+ {
+ min.setMin(min, face.mPositions[i]);
+ max.setMax(max, face.mPositions[i]);
+ }
}
}