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.cpp125
1 files changed, 89 insertions, 36 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 0a1efd564f..c1dd356586 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3247,6 +3247,19 @@ LLColor3 LLVOVolume::getLightColor() const
}
}
+LLColor3 LLVOVolume::getLightSRGBColor() const
+{
+ const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
+ if (param_block)
+ {
+ return LLColor3(param_block->getSRGBColor()) * param_block->getSRGBColor().mV[3];
+ }
+ else
+ {
+ return LLColor3(1, 1, 1);
+ }
+}
+
LLUUID LLVOVolume::getLightTextureID() const
{
if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE))
@@ -3283,18 +3296,16 @@ F32 LLVOVolume::getSpotLightPriority() const
void LLVOVolume::updateSpotLightPriority()
{
+ F32 r = getLightRadius();
LLVector3 pos = mDrawable->getPositionAgent();
+
LLVector3 at(0,0,-1);
at *= getRenderRotation();
-
- F32 r = getLightRadius()*0.5f;
-
pos += at * r;
at = LLViewerCamera::getInstance()->getAtAxis();
-
pos -= at * r;
-
+
mSpotLightPriority = gPipeline.calcPixelArea(pos, LLVector3(r,r,r), *LLViewerCamera::getInstance());
if (mLightTexture.notNull())
@@ -3366,7 +3377,7 @@ F32 LLVOVolume::getLightFalloff() const
const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
if (param_block)
{
- return param_block->getFalloff();
+ return param_block->getFalloff() * 0.5f;
}
else
{
@@ -4575,12 +4586,10 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
}
}
+ BOOL no_texture = !face->getTexture() || !face->getTexture()->hasGLTexture();
+ BOOL mask = no_texture ? FALSE : face->getTexture()->getMask(face->surfaceToTexture(tc, p, n));
if (face &&
- (ignore_alpha ||
- pick_transparent ||
- !face->getTexture() ||
- !face->getTexture()->hasGLTexture() ||
- face->getTexture()->getMask(face->surfaceToTexture(tc, p, n))))
+ (ignore_alpha || pick_transparent || no_texture || mask))
{
local_end = p;
if (face_hitp != NULL)
@@ -4785,18 +4794,44 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
U32 max_joints = LLSkinningUtil::getMaxJointCount();
rigged_vert_count += dst_face.mNumVertices;
rigged_face_count++;
- for (U32 j = 0; j < dst_face.mNumVertices; ++j)
- {
- LLMatrix4a final_mat;
- LLSkinningUtil::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints);
+
+ #if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS
+ if (vol_face.mJointIndices) // fast path with preconditioned joint indices
+ {
+ LLMatrix4a src[4];
+ U8* joint_indices_cursor = vol_face.mJointIndices;
+ LLVector4a* just_weights = vol_face.mJustWeights;
+ for (U32 j = 0; j < dst_face.mNumVertices; ++j)
+ {
+ LLMatrix4a final_mat;
+ F32* w = just_weights[j].getF32ptr();
+ LLSkinningUtil::getPerVertexSkinMatrixWithIndices(w, joint_indices_cursor, mat, final_mat, src);
+ joint_indices_cursor += 4;
+
+ LLVector4a& v = vol_face.mPositions[j];
+ LLVector4a t;
+ LLVector4a dst;
+ bind_shape_matrix.affineTransform(v, t);
+ final_mat.affineTransform(t, dst);
+ pos[j] = dst;
+ }
+ }
+ else
+ #endif
+ {
+ for (U32 j = 0; j < dst_face.mNumVertices; ++j)
+ {
+ LLMatrix4a final_mat;
+ LLSkinningUtil::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints);
- LLVector4a& v = vol_face.mPositions[j];
- LLVector4a t;
- LLVector4a dst;
- bind_shape_matrix.affineTransform(v, t);
- final_mat.affineTransform(t, dst);
- pos[j] = dst;
- }
+ LLVector4a& v = vol_face.mPositions[j];
+ LLVector4a t;
+ LLVector4a dst;
+ bind_shape_matrix.affineTransform(v, t);
+ final_mat.affineTransform(t, dst);
+ pos[j] = dst;
+ }
+ }
//update bounding box
// VFExtents change
@@ -4977,7 +5012,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
if ( type == LLRenderPass::PASS_ALPHA
&& facep->getTextureEntry()->getMaterialParams().notNull()
&& !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_TANGENT)
- && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1)
+ && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1)
{
LL_WARNS_ONCE("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL;
}
@@ -5512,6 +5547,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
LLViewerTexture* tex = facep->getTexture();
U32 type = gPipeline.getPoolTypeFromTE(te, tex);
+ F32 te_alpha = te->getColor().mV[3];
if (te->getGlow())
{
@@ -5519,6 +5555,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
LLMaterial* mat = te->getMaterialParams().get();
+ bool fullbright = te->getFullbright();
if (mat && LLPipeline::sRenderDeferred)
{
@@ -5526,14 +5563,18 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
bool is_alpha = type == LLDrawPool::POOL_ALPHA &&
(alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND ||
- te->getColor().mV[3] < 0.999f);
+ te_alpha < 0.999f);
if (is_alpha)
{ //this face needs alpha blending, override alpha mode
alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
}
- if (!is_alpha || te->getColor().mV[3] > 0.f) // //only add the face if it will actually be visible
+ if (fullbright && (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE))
+ {
+ pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT);
+ }
+ else if (!is_alpha || te_alpha > 0.f) // //only add the face if it will actually be visible
{
U32 mask = mat->getShaderMask(alpha_mode);
pool->addRiggedFace(facep, mask);
@@ -5545,8 +5586,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
}
else if (mat)
- {
- bool fullbright = te->getFullbright();
+ {
bool is_alpha = type == LLDrawPool::POOL_ALPHA;
U8 mode = mat->getDiffuseAlphaMode();
bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
@@ -5883,7 +5923,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
spec_mask = spec_mask | LLVertexBuffer::MAP_EMISSIVE;
}
- BOOL batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1;
+ BOOL batch_textures = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1;
if (batch_textures)
{
@@ -6451,8 +6491,12 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
}
+ F32 te_alpha = te->getColor().mV[3];
bool use_legacy_bump = te->getBumpmap() && (te->getBumpmap() < 18) && (!mat || mat->getNormalID().isNull());
- bool opaque = te->getColor().mV[3] >= 0.999f;
+ bool opaque = te_alpha >= 0.999f;
+ bool transparent = te_alpha < 0.999f;
+
+ is_alpha = (is_alpha || transparent) ? TRUE : FALSE;
if (mat && LLPipeline::sRenderDeferred && !hud_group)
{
@@ -6481,14 +6525,20 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
}
else
{
- if (mat->getEnvironmentIntensity() > 0 ||
- te->getShiny() > 0)
+ if (mat->getEnvironmentIntensity() > 0 || te->getShiny() > 0)
{
material_pass = true;
}
else
{
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
+ if (opaque)
+ {
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
+ }
+ else
+ {
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA);
+ }
}
}
}
@@ -6496,7 +6546,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
{
registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
}
- else if (te->getColor().mV[3] < 0.999f)
+ else if (transparent)
{
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
}
@@ -6544,7 +6594,10 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
else if (mat)
{
U8 mode = mat->getDiffuseAlphaMode();
- if (te->getColor().mV[3] < 0.999f)
+
+ is_alpha = (is_alpha || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND));
+
+ if (is_alpha)
{
mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
}
@@ -6553,7 +6606,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
{
registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK);
}
- else if (is_alpha || (te->getColor().mV[3] < 0.999f))
+ else if (is_alpha )
{
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
}
@@ -6669,7 +6722,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
{
registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
}
- }
+ }
}