summaryrefslogtreecommitdiff
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
parentb27ed1f58e1d7d278a7110392b741bb98083381f (diff)
parent387b7adbc4edea3f5c649b48b0714bf73d7af9da (diff)
merge
-rw-r--r--indra/newview/app_settings/settings.xml39
-rw-r--r--indra/newview/llface.cpp23
-rw-r--r--indra/newview/llviewercontrol.cpp2
-rw-r--r--indra/newview/llvovolume.cpp10
-rw-r--r--indra/newview/pipeline.cpp4
-rw-r--r--indra/newview/pipeline.h2
6 files changed, 75 insertions, 5 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 4c72b03b2e..9b7cc04120 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -6313,6 +6313,7 @@
<key>Value</key>
<integer>0</integer>
</map>
+
<key>RenderAnimateRes</key>
<map>
<key>Comment</key>
@@ -6324,7 +6325,31 @@
<key>Value</key>
<integer>0</integer>
</map>
-
+
+ <key>RenderBakeSunlight</key>
+ <map>
+ <key>Comment</key>
+ <string>Bake sunlight into vertex buffers for static objects.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
+
+ <key>RenderNoAlpha</key>
+ <map>
+ <key>Comment</key>
+ <string>Disable rendering of alpha objects (render all alpha objects as alpha masks).</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
+
<key>RenderAnimateTrees</key>
<map>
<key>Comment</key>
@@ -6481,6 +6506,18 @@
<real>16.0</real>
</map>
+ <key>RenderMinimumLODTriangleCount</key>
+ <map>
+ <key>Comment</key>
+ <string>Triangle count threshold at which automatic LOD generation stops</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>U32</string>
+ <key>Value</key>
+ <real>16</real>
+ </map>
+
<key>RenderEdgeDepthCutoff</key>
<map>
<key>Comment</key>
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;
+ }
}
}
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index c985a9aa80..481c96dae3 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -508,6 +508,8 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _2));
gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
+ gSavedSettings.getControl("RenderBakeSunlight")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
+ gSavedSettings.getControl("RenderNoAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 396d716ae2..cea964a100 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3521,6 +3521,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
vobj->isMesh() &&
gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID());
+ bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic();
+
//for each face
for (S32 i = 0; i < drawablep->getNumFaces(); i++)
{
@@ -3720,7 +3722,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
bump_faces.push_back(facep);
}
else if ((te->getShiny() && LLPipeline::sRenderBump) ||
- !te->getFullbright())
+ !(te->getFullbright() || bake_sunlight))
{ //needs normal
simple_faces.push_back(facep);
}
@@ -3930,6 +3932,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
buffer_index = 0;
}
+ bool bake_sunlight = LLPipeline::sBakeSunlight && facep->getDrawable()->isStatic();
+
U32 index_count = facep->getIndicesCount();
U32 geom_count = facep->getGeomCount();
@@ -4035,7 +4039,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
// can we safely treat this as an alpha mask?
if (facep->canRenderAsMask())
{
- if (te->getFullbright())
+ if (te->getFullbright() || LLPipeline::sNoAlpha)
{
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
}
@@ -4099,7 +4103,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
{ //invisiprim
registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
}
- else if (fullbright)
+ else if (fullbright || bake_sunlight)
{ //fullbright
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && te->getBumpmap())
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index ab41635b5e..91c3805d3b 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -275,6 +275,8 @@ BOOL LLPipeline::sAutoMaskAlphaDeferred = TRUE;
BOOL LLPipeline::sAutoMaskAlphaNonDeferred = FALSE;
BOOL LLPipeline::sDisableShaders = FALSE;
BOOL LLPipeline::sRenderBump = TRUE;
+BOOL LLPipeline::sBakeSunlight = FALSE;
+BOOL LLPipeline::sNoAlpha = FALSE;
BOOL LLPipeline::sUseTriStrips = TRUE;
BOOL LLPipeline::sUseFarClip = TRUE;
BOOL LLPipeline::sShadowRender = FALSE;
@@ -5494,6 +5496,8 @@ void LLPipeline::resetVertexBuffers()
sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");
sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips");
LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("RenderUseStreamVBO");
+ sBakeSunlight = gSavedSettings.getBOOL("RenderBakeSunlight");
+ sNoAlpha = gSavedSettings.getBOOL("RenderNoAlpha");
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index f2e1d8eacb..c9384f5ba2 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -472,6 +472,8 @@ public:
static BOOL sAutoMaskAlphaNonDeferred;
static BOOL sDisableShaders; // if TRUE, rendering will be done without shaders
static BOOL sRenderBump;
+ static BOOL sBakeSunlight;
+ static BOOL sNoAlpha;
static BOOL sUseTriStrips;
static BOOL sUseFarClip;
static BOOL sShadowRender;