summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp96
1 files changed, 54 insertions, 42 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 24e2f745d4..5644e02134 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2460,6 +2460,17 @@ void LLVOVolume::updateSpotLightPriority()
}
+bool LLVOVolume::isLightSpotlight() const
+{
+ LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
+ if (params)
+ {
+ return params->isLightSpotlight();
+ }
+ return false;
+}
+
+
LLViewerTexture* LLVOVolume::getLightTexture()
{
LLUUID id = getLightTextureID();
@@ -2919,9 +2930,7 @@ F32 LLVOVolume::getBinRadius()
{
LLFace* face = mDrawable->getFace(i);
if (face->getPoolType() == LLDrawPool::POOL_ALPHA &&
- (!LLPipeline::sFastAlpha ||
- face->getFaceColor().mV[3] != 1.f ||
- !face->getTexture()->getIsAlphaMask()))
+ !face->canRenderAsMask())
{
alpha_wrap = TRUE;
break;
@@ -3197,11 +3206,10 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
S32 idx = draw_vec.size()-1;
-
BOOL fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) ||
- (type == LLRenderPass::PASS_INVISIBLE) ||
- (type == LLRenderPass::PASS_ALPHA ? facep->isState(LLFace::FULLBRIGHT) : FALSE);
-
+ (type == LLRenderPass::PASS_INVISIBLE) ||
+ (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT));
+
if (!fullbright && type != LLRenderPass::PASS_GLOW && !facep->mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL))
{
llwarns << "Non fullbright face has no normals!" << llendl;
@@ -3226,16 +3234,12 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
model_mat = &(drawable->getRegion()->mRenderMatrix);
}
- U8 bump = (type == LLRenderPass::PASS_BUMP ? facep->getTextureEntry()->getBumpmap() : 0);
+
+ U8 bump = (type == LLRenderPass::PASS_BUMP || type == LLRenderPass::PASS_POST_BUMP) ? facep->getTextureEntry()->getBumpmap() : 0;
LLViewerTexture* tex = facep->getTexture();
- U8 glow = 0;
-
- if (type == LLRenderPass::PASS_GLOW)
- {
- glow = (U8) (facep->getTextureEntry()->getGlow() * 255);
- }
+ U8 glow = (U8) (facep->getTextureEntry()->getGlow() * 255);
if (facep->mVertexBuffer.isNull())
{
@@ -3300,6 +3304,7 @@ void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group)
static LLFastTimer::DeclareTimer FTM_REBUILD_VOLUME_VB("Volume");
static LLFastTimer::DeclareTimer FTM_REBUILD_VBO("VBO Rebuilt");
+
void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (group->changeLOD())
@@ -3425,10 +3430,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (type == LLDrawPool::POOL_ALPHA)
{
- if (LLPipeline::sFastAlpha &&
- (te->getColor().mV[VW] == 1.0f) &&
- (!te->getFullbright()) && // hack: alpha masking renders fullbright faces invisible, need to figure out why - for now, avoid
- facep->getTexture()->getIsAlphaMask())
+ if (facep->canRenderAsMask())
{ //can be treated as alpha mask
simple_faces.push_back(facep);
}
@@ -3530,6 +3532,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
static LLFastTimer::DeclareTimer FTM_VOLUME_GEOM("Volume Geometry");
+static LLFastTimer::DeclareTimer FTM_VOLUME_GEOM_PARTIAL("Terse Rebuild");
+
void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
{
llassert(group);
@@ -3542,6 +3546,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
{
+ LLFastTimer t(FTM_VOLUME_GEOM_PARTIAL);
LLDrawable* drawablep = *drawable_iter;
if (drawablep->isDead() || drawablep->isState(LLDrawable::FORCE_INVISIBLE) )
@@ -3769,15 +3774,12 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
const LLTextureEntry* te = facep->getTextureEntry();
- BOOL is_alpha = facep->getPoolType() == LLDrawPool::POOL_ALPHA ? TRUE : FALSE;
+ BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE;
if (is_alpha)
{
// can we safely treat this as an alpha mask?
- if (LLPipeline::sFastAlpha &&
- (te->getColor().mV[VW] == 1.0f) &&
- (!te->getFullbright()) && // hack: alpha masking renders fullbright faces invisible, need to figure out why - for now, avoid
- facep->getTexture()->getIsAlphaMask())
+ if (facep->canRenderAsMask())
{
if (te->getFullbright())
{
@@ -3802,66 +3804,76 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
&& group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_HUD
&& LLPipeline::sRenderBump
&& te->getShiny())
- {
+ { //shiny
if (tex->getPrimaryFormat() == GL_ALPHA)
- {
+ { //invisiprim+shiny
registerFace(group, facep, LLRenderPass::PASS_INVISI_SHINY);
registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
}
else if (LLPipeline::sRenderDeferred)
- {
- if (te->getBumpmap())
- {
- registerFace(group, facep, LLRenderPass::PASS_BUMP);
- }
- else if (te->getFullbright())
- {
+ { //deferred rendering
+ if (te->getFullbright())
+ { //register in post deferred fullbright shiny pass
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_SHINY);
+ if (te->getBumpmap())
+ { //register in post deferred bump pass
+ registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
+ }
+ }
+ else if (te->getBumpmap())
+ { //register in deferred bump pass
+ registerFace(group, facep, LLRenderPass::PASS_BUMP);
}
else
- {
+ { //register in deferred simple pass (deferred simple includes shiny)
llassert(mask & LLVertexBuffer::MAP_NORMAL);
registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
}
}
else if (fullbright)
- {
+ { //not deferred, register in standard fullbright shiny pass
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_SHINY);
}
else
- {
+ { //not deferred or fullbright, register in standard shiny pass
registerFace(group, facep, LLRenderPass::PASS_SHINY);
}
}
else
- {
+ { //not alpha and not shiny
if (!is_alpha && tex->getPrimaryFormat() == GL_ALPHA)
- {
+ { //invisiprim
registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
}
else if (fullbright)
- {
+ { //fullbright
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
+ if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && te->getBumpmap())
+ { //if this is the deferred render and a bump map is present, register in post deferred bump
+ registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
+ }
}
else
{
- if (LLPipeline::sRenderDeferred && te->getBumpmap())
- {
+ if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && te->getBumpmap())
+ { //non-shiny or fullbright deferred bump
registerFace(group, facep, LLRenderPass::PASS_BUMP);
}
else
- {
+ { //all around simple
llassert(mask & LLVertexBuffer::MAP_NORMAL);
registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
}
}
+ //not sure why this is here -- shiny HUD attachments maybe? -- davep 5/11/2010
if (!is_alpha && te->getShiny() && LLPipeline::sRenderBump)
{
registerFace(group, facep, LLRenderPass::PASS_SHINY);
}
}
+ //not sure why this is here, and looks like it might cause bump mapped objects to get rendered redundantly -- davep 5/11/2010
if (!is_alpha && !LLPipeline::sRenderDeferred)
{
llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright);
@@ -3873,7 +3885,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
}
}
- if (LLPipeline::sRenderGlow && te->getGlow() > 0.f)
+ if (!is_alpha && LLPipeline::sRenderGlow && te->getGlow() > 0.f)
{
registerFace(group, facep, LLRenderPass::PASS_GLOW);
}