summaryrefslogtreecommitdiff
path: root/indra/newview/llface.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-05-18 16:59:36 -0500
committerDave Parks <davep@lindenlab.com>2010-05-18 16:59:36 -0500
commitf41e2d3752646fd5ffdb9764b1d3434e68a9baeb (patch)
tree742dbe98debda634f289a3fcc3fb49ce4c08e194 /indra/newview/llface.cpp
parentb27ed1f58e1d7d278a7110392b741bb98083381f (diff)
parent387b7adbc4edea3f5c649b48b0714bf73d7af9da (diff)
merge
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r--indra/newview/llface.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 9df692e787..365f2fbe1a 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -896,6 +896,11 @@ void LLFace::updateRebuildFlags()
bool LLFace::canRenderAsMask()
{
+ if (LLPipeline::sNoAlpha)
+ {
+ return true;
+ }
+
const LLTextureEntry* te = getTextureEntry();
return (
(
@@ -1205,6 +1210,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
mVObjp->getVolume()->genBinormals(f);
}
+ //if it's not fullbright and has no normals, bake sunlight based on face normal
+ bool bake_sunlight = !getTextureEntry()->getFullbright() &&
+ !mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
+
for (S32 i = 0; i < num_vertices; i++)
{
if (rebuild_tcoord)
@@ -1382,7 +1391,19 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
if (rebuild_color)
{
- *colors++ = color;
+ if (bake_sunlight)
+ {
+ LLVector3 normal = vf.mVertices[i].mNormal * mat_normal;
+ normal.normVec();
+
+ F32 da = normal * gPipeline.mSunDir;
+
+ *colors++ = LLColor4U(color.mV[0]*da, color.mV[1]*da, color.mV[2]*da, color.mV[3]);
+ }
+ else
+ {
+ *colors++ = color;
+ }
}
}