summaryrefslogtreecommitdiff
path: root/indra/llmath/llvolume.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-04-03 19:21:14 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-04-03 19:21:14 +0000
commitb5936a4b1d8780b5b8cd425998eacd2c64ffa693 (patch)
treec1581bcf34e96a897c6e1d9a4aed95f353713baa /indra/llmath/llvolume.cpp
parent55c25229b79b1755c989e5996c8e8d118f369721 (diff)
1.19.1 Viewer merge: QAR_367, QAR-374, QAR-408, QAR-426
QAR_367 (RC1) - merge Branch_1-19-1-Viewer -r 81609 : 81993 -> release QAR-374 (RC2) - merge Branch_1-19-1-Viewer -r 81993 : 82589 -> release QAR-408 (RC3) - merge Branch_1-19-1-Viewer -r 82589 : 83128 -> release QAR-426 (rc4) - merge Branch_1-19-1-Viewer -r 83125 : 83719 -> release (Actual merge: release@83793 Branch_1-19-1-Viewer-merge@83953 -> release)
Diffstat (limited to 'indra/llmath/llvolume.cpp')
-rw-r--r--indra/llmath/llvolume.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 984c13e0d8..0c711cabcd 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -2075,6 +2075,14 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
}
mSculptLevel = sculpt_level;
+
+ // Delete any existing faces so that they get regenerated
+ if (mVolumeFaces)
+ {
+ delete[] mVolumeFaces;
+ mVolumeFaces = NULL;
+ }
+
createVolumeFaces();
}
@@ -4817,29 +4825,33 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
}
}
- //generate normals
- for (U32 i = 0; i < mIndices.size()/3; i++) { //for each triangle
- const VertexData& v0 = mVertices[mIndices[i*3+0]];
- const VertexData& v1 = mVertices[mIndices[i*3+1]];
- const VertexData& v2 = mVertices[mIndices[i*3+2]];
+ //generate normals
+ for (U32 i = 0; i < mIndices.size()/3; i++) //for each triangle
+ {
+ const S32 i0 = mIndices[i*3+0];
+ const S32 i1 = mIndices[i*3+1];
+ const S32 i2 = mIndices[i*3+2];
+ const VertexData& v0 = mVertices[i0];
+ const VertexData& v1 = mVertices[i1];
+ const VertexData& v2 = mVertices[i2];
//calculate triangle normal
- LLVector3 norm = (v0.mPosition-v1.mPosition)%
- (v0.mPosition-v2.mPosition);
+ LLVector3 norm = (v0.mPosition-v1.mPosition) % (v0.mPosition-v2.mPosition);
for (U32 j = 0; j < 3; j++)
{ //add triangle normal to vertices
- mVertices[mIndices[i*3+j]].mNormal += norm; // * (weight_sum - d[j])/weight_sum;
+ const S32 idx = mIndices[i*3+j];
+ mVertices[idx].mNormal += norm; // * (weight_sum - d[j])/weight_sum;
}
//even out quad contributions
- if (i % 2 == 0)
+ if ((i & 1) == 0)
{
- mVertices[mIndices[i*3+2]].mNormal += norm;
+ mVertices[i2].mNormal += norm;
}
else
{
- mVertices[mIndices[i*3+1]].mNormal += norm;
+ mVertices[i1].mNormal += norm;
}
}