summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2021-10-28 22:09:22 +0000
committerDave Parks <davep@lindenlab.com>2021-10-28 22:09:22 +0000
commit68b75be652575ff301172b7b19522d4f0494bdf0 (patch)
tree6552c3753946a0a21accebf874af23a271866cd6 /indra/newview
parent8d20480c5f77fe1fab8149d3cda79bdd61e77656 (diff)
SL-9436 Don't render 100% transparent objects.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llviewermenu.cpp1
-rw-r--r--indra/newview/llvovolume.cpp82
2 files changed, 31 insertions, 52 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index ad81cb07c1..534c03d581 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -8314,6 +8314,7 @@ class LLViewHighlightTransparent : public view_listener_t
bool handleEvent(const LLSD& userdata)
{
LLDrawPoolAlpha::sShowDebugAlpha = !LLDrawPoolAlpha::sShowDebugAlpha;
+ gPipeline.resetVertexBuffers();
return true;
}
};
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index be390e44a3..893c5f4fac 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5385,6 +5385,16 @@ void handleRenderAutoMuteByteLimitChanged(const LLSD& new_value)
}
}
+// add a face pointer to a list of face pointers without going over MAX_COUNT faces
+template<typename T>
+static inline void add_face(T** list, U32& count, T* face)
+{
+ if (count < MAX_FACE_COUNT)
+ {
+ list[count++] = face;
+ }
+}
+
void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
LL_PROFILE_ZONE_SCOPED;
@@ -5801,21 +5811,19 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (facep->canRenderAsMask())
{ //can be treated as alpha mask
- if (simple_count < MAX_FACE_COUNT)
- {
- sSimpleFaces[simple_count++] = facep;
- }
+ add_face(sSimpleFaces, simple_count, facep);
}
else
{
- if (te->getColor().mV[3] > 0.f)
- { //only treat as alpha in the pipeline if < 100% transparent
- drawablep->setState(LLDrawable::HAS_ALPHA);
- }
- if (alpha_count < MAX_FACE_COUNT)
- {
- sAlphaFaces[alpha_count++] = facep;
- }
+ if (te->getColor().mV[3] > 0.f)
+ { //only treat as alpha in the pipeline if < 100% transparent
+ drawablep->setState(LLDrawable::HAS_ALPHA);
+ add_face(sAlphaFaces, alpha_count, facep);
+ }
+ else if (LLDrawPoolAlpha::sShowDebugAlpha)
+ {
+ add_face(sAlphaFaces, alpha_count, facep);
+ }
}
}
else
@@ -5835,81 +5843,51 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (mat->getSpecularID().notNull())
{ //has normal and specular maps (needs texcoord1, texcoord2, and tangent)
- if (normspec_count < MAX_FACE_COUNT)
- {
- sNormSpecFaces[normspec_count++] = facep;
- }
+ add_face(sNormSpecFaces, normspec_count, facep);
}
else
{ //has normal map (needs texcoord1 and tangent)
- if (norm_count < MAX_FACE_COUNT)
- {
- sNormFaces[norm_count++] = facep;
- }
+ add_face(sNormFaces, norm_count, facep);
}
}
else if (mat->getSpecularID().notNull())
{ //has specular map but no normal map, needs texcoord2
- if (spec_count < MAX_FACE_COUNT)
- {
- sSpecFaces[spec_count++] = facep;
- }
+ add_face(sSpecFaces, spec_count, facep);
}
else
{ //has neither specular map nor normal map, only needs texcoord0
- if (simple_count < MAX_FACE_COUNT)
- {
- sSimpleFaces[simple_count++] = facep;
- }
+ add_face(sSimpleFaces, simple_count, facep);
}
}
else if (te->getBumpmap())
{ //needs normal + tangent
- if (bump_count < MAX_FACE_COUNT)
- {
- sBumpFaces[bump_count++] = facep;
- }
+ add_face(sBumpFaces, bump_count, facep);
}
else if (te->getShiny() || !te->getFullbright())
{ //needs normal
- if (simple_count < MAX_FACE_COUNT)
- {
- sSimpleFaces[simple_count++] = facep;
- }
+ add_face(sSimpleFaces, simple_count, facep);
}
else
{ //doesn't need normal
facep->setState(LLFace::FULLBRIGHT);
- if (fullbright_count < MAX_FACE_COUNT)
- {
- sFullbrightFaces[fullbright_count++] = facep;
- }
+ add_face(sFullbrightFaces, fullbright_count, facep);
}
}
else
{
if (te->getBumpmap() && LLPipeline::sRenderBump)
{ //needs normal + tangent
- if (bump_count < MAX_FACE_COUNT)
- {
- sBumpFaces[bump_count++] = facep;
- }
+ add_face(sBumpFaces, bump_count, facep);
}
else if ((te->getShiny() && LLPipeline::sRenderBump) ||
!(te->getFullbright() || bake_sunlight))
{ //needs normal
- if (simple_count < MAX_FACE_COUNT)
- {
- sSimpleFaces[simple_count++] = facep;
- }
+ add_face(sSimpleFaces, simple_count, facep);
}
else
{ //doesn't need normal
facep->setState(LLFace::FULLBRIGHT);
- if (fullbright_count < MAX_FACE_COUNT)
- {
- sFullbrightFaces[fullbright_count++] = facep;
- }
+ add_face(sFullbrightFaces, fullbright_count, facep);
}
}
}