summaryrefslogtreecommitdiff
path: root/indra/newview/llface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r--indra/newview/llface.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index c1776705f9..2c04224fa0 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -488,6 +488,11 @@ U16 LLFace::getGeometry(LLStrider<LLVector3> &vertices, LLStrider<LLVector3> &no
return mGeomIndex;
}
+LLVector3 LLFace::getAverageNormal()
+{
+ return mAverageNormal;
+}
+
void LLFace::updateCenterAgent()
{
if (mDrawablep->isActive())
@@ -1889,14 +1894,21 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
F32* normals = (F32*) norm.get();
LLVector4a* src = vf.mNormals;
LLVector4a* end = src+num_vertices;
-
+
+ LLVector4a normal_total;
+
while (src < end)
{
LLVector4a normal;
mat_normal.rotate(*src++, normal);
normal.store4a(normals);
+ normal_total.add(normal);
normals += 4;
}
+
+ normal_total.div(LLVector4a(num_vertices));
+
+ mAverageNormal = LLVector3(normal_total[0], normal_total[1], normal_total[2]);
}
if (rebuild_tangent)