From da04af47cc6e9f6acfcac0d2d6f1466b6f9baec2 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 26 Oct 2010 16:19:24 -0500 Subject: Fix for bad binormals. --- indra/llmath/llvolume.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 0fe309ddf3..a0874e859c 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -6139,6 +6139,14 @@ void LLVolumeFace::createBinormals() LLVector2* tc = (LLVector2*) mTexCoords; LLVector4a* binorm = (LLVector4a*) mBinormals; + LLVector4a* end = mBinormals+mNumVertices; + while (binorm < end) + { + (*binorm++).clear(); + } + + binorm = mBinormals; + for (U32 i = 0; i < mNumIndices/3; i++) { //for each triangle const U16& i0 = mIndices[i*3+0]; -- cgit v1.2.3 From 78e62d00306f55c4f04366bf8f89fd7b3ccdf489 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 29 Oct 2010 12:06:20 -0500 Subject: Fix for bad normals on some prim faces. --- indra/llmath/llvolume.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index a0874e859c..2411bb7900 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -92,11 +92,13 @@ extern BOOL gDebugGL; void assert_aligned(void* ptr, U32 alignment) { +#if 0 U32 t = (U32) ptr; if (t%alignment != 0) { llerrs << "WTF?" << llendl; } +#endif } BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) @@ -6600,6 +6602,12 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) } } + //clear normals + for (U32 i = 0; i < mNumVertices; i++) + { + mNormals[i].clear(); + } + //generate normals for (U32 i = 0; i < mNumIndices/3; i++) //for each triangle { -- cgit v1.2.3 From ed29cac3a18aeaa366b51c9d5ad89e128787b11f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 29 Oct 2010 16:10:17 -0500 Subject: SH-92 Fix for busted bounding boxes for mirrored meshes. --- indra/llmath/llvolume.cpp | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'indra/llmath') 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]); + } } } -- cgit v1.2.3 From 117af7e7e3061a4111678dd2bfd5adfcf71b45df Mon Sep 17 00:00:00 2001 From: JonathanLinden Date: Wed, 3 Nov 2010 13:23:53 -0700 Subject: Fix for SH-391 'Viewer crash when enabling align planar faces on a mesh object'. Paired with Runitai --- indra/llmath/llvolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 9fe4c622d7..a129182f01 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2593,7 +2593,7 @@ S32 LLVolume::getNumFaces() const if (sculpt_type == LL_SCULPT_TYPE_MESH) { - return LL_SCULPT_MESH_MAX_FACES; + return llmax((S32)mVolumeFaces.size(), 1); } return (S32)mProfilep->mFaces.size(); -- cgit v1.2.3 From ffb8b78ae9b0c0f4be8ac262054681ed11726993 Mon Sep 17 00:00:00 2001 From: JonathanLinden Date: Wed, 3 Nov 2010 17:11:08 -0700 Subject: Reverting fix for SH-391 until it works for all use cases --- indra/llmath/llvolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index a129182f01..9fe4c622d7 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2593,7 +2593,7 @@ S32 LLVolume::getNumFaces() const if (sculpt_type == LL_SCULPT_TYPE_MESH) { - return llmax((S32)mVolumeFaces.size(), 1); + return LL_SCULPT_MESH_MAX_FACES; } return (S32)mProfilep->mFaces.size(); -- cgit v1.2.3