summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llcontrolavatar.cpp2
-rw-r--r--indra/newview/lldrawpoolavatar.cpp133
-rw-r--r--indra/newview/lldrawpoolavatar.h2
-rw-r--r--indra/newview/lldrawpoolsky.cpp55
-rw-r--r--indra/newview/lldrawpoolsky.h2
-rw-r--r--indra/newview/lldrawpoolwater.cpp3
-rw-r--r--indra/newview/lllegacyatmospherics.cpp2
-rw-r--r--indra/newview/lllegacyatmospherics.h111
-rw-r--r--indra/newview/llskinningutil.cpp71
-rw-r--r--indra/newview/llskinningutil.h29
-rw-r--r--indra/newview/llviewerdisplay.cpp12
-rw-r--r--indra/newview/llviewerjoint.cpp7
-rw-r--r--indra/newview/llvosky.cpp32
-rw-r--r--indra/newview/llvosky.h7
-rw-r--r--indra/newview/llvovolume.cpp48
15 files changed, 415 insertions, 101 deletions
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index 1e8ec4fe0f..6da7163f9f 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -255,7 +255,7 @@ void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor)
{
joint->setScale(factor * joint->getScale());
- for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
+ for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
iter != joint->mChildren.end(); ++iter)
{
LLJoint* child = *iter;
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 15a0595179..789a254389 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -38,6 +38,7 @@
#include "lldrawable.h"
#include "lldrawpoolbump.h"
#include "llface.h"
+#include "llvolume.h"
#include "llmeshrepository.h"
#include "llsky.h"
#include "llviewercamera.h"
@@ -1833,15 +1834,13 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(
LLFace* face,
const LLMeshSkinInfo* skin,
LLVolume* volume,
- const LLVolumeFace& vol_face)
+ LLVolumeFace& vol_face)
{
LLVector4a* weights = vol_face.mWeights;
if (!weights)
{
return;
}
- // FIXME ugly const cast
- LLSkinningUtil::scrubInvalidJoints(avatar, const_cast<LLMeshSkinInfo*>(skin));
LLPointer<LLVertexBuffer> buffer = face->getVertexBuffer();
LLDrawable* drawable = face->getDrawable();
@@ -1851,6 +1850,48 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(
return;
}
+ const U32 max_joints = LLSkinningUtil::getMaxJointCount();
+
+#if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS
+ #define CONDITION_WEIGHT(f) ((U8)llclamp((S32)f, (S32)0, (S32)max_joints-1))
+ LLVector4a* just_weights = vol_face.mJustWeights;
+ // we need to calculate the separated indices and store just the matrix weights for this vol...
+ if (!vol_face.mJointIndices)
+ {
+ // not very consty after all...
+ vol_face.allocateJointIndices(vol_face.mNumVertices);
+ just_weights = vol_face.mJustWeights;
+
+ U8* joint_indices_cursor = vol_face.mJointIndices;
+ for (int i = 0; i < vol_face.mNumVertices; i++)
+ {
+ F32* w = weights[i].getF32ptr();
+ F32* w_ = just_weights[i].getF32ptr();
+
+ F32 w0 = floorf(w[0]);
+ F32 w1 = floorf(w[1]);
+ F32 w2 = floorf(w[2]);
+ F32 w3 = floorf(w[3]);
+
+ joint_indices_cursor[0] = CONDITION_WEIGHT(w0);
+ joint_indices_cursor[1] = CONDITION_WEIGHT(w1);
+ joint_indices_cursor[2] = CONDITION_WEIGHT(w2);
+ joint_indices_cursor[3] = CONDITION_WEIGHT(w3);
+
+ // remove joint portion of combined weight
+ w_[0] = w[0] - w0;
+ w_[1] = w[1] - w1;
+ w_[2] = w[2] - w2;
+ w_[3] = w[3] - w3;
+
+ joint_indices_cursor += 4;
+ }
+ }
+#endif
+
+ // FIXME ugly const cast
+ LLSkinningUtil::scrubInvalidJoints(avatar, const_cast<LLMeshSkinInfo*>(skin));
+
U32 data_mask = face->getRiggedVertexBufferDataMask();
if (!vol_face.mWeightsScrubbed)
@@ -1927,29 +1968,67 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(
LLMatrix4a bind_shape_matrix;
bind_shape_matrix.loadu(skin->mBindShapeMatrix);
- const U32 max_joints = LLSkinningUtil::getMaxJointCount();
- for (U32 j = 0; j < buffer->getNumVerts(); ++j)
- {
- LLMatrix4a final_mat;
- LLSkinningUtil::getPerVertexSkinMatrix(weights[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;
-
- if (norm)
- {
- LLVector4a& n = vol_face.mNormals[j];
- bind_shape_matrix.rotate(n, t);
- final_mat.rotate(t, dst);
- dst.normalize3fast();
- norm[j] = dst;
- }
- }
+#if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS
+ U8* joint_indices_cursor = vol_face.mJointIndices;
+ // fast path with joint indices separate from weights
+ if (joint_indices_cursor)
+ {
+ LLMatrix4a src[4];
+ for (U32 j = 0; j < buffer->getNumVerts(); ++j)
+ {
+ LLMatrix4a final_mat;
+ //LLMatrix4a final_mat_correct;
+
+ F32* jw = just_weights[j].getF32ptr();
+
+ LLSkinningUtil::getPerVertexSkinMatrixWithIndices(jw, 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;
+
+ if (norm)
+ {
+ LLVector4a& n = vol_face.mNormals[j];
+ bind_shape_matrix.rotate(n, t);
+ final_mat.rotate(t, dst);
+ dst.normalize3fast();
+ norm[j] = dst;
+ }
+ }
+ }
+ // slow path with joint indices calculated from weights
+ else
+#endif
+ {
+ for (U32 j = 0; j < buffer->getNumVerts(); ++j)
+ {
+ LLMatrix4a final_mat;
+ LLSkinningUtil::getPerVertexSkinMatrix(weights[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;
+
+ if (norm)
+ {
+ LLVector4a& n = vol_face.mNormals[j];
+ bind_shape_matrix.rotate(n, t);
+ final_mat.rotate(t, dst);
+ //dst.normalize3fast();
+ norm[j] = dst;
+ }
+ }
+ }
}
}
@@ -2301,7 +2380,7 @@ void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)
stop_glerror();
- const LLVolumeFace& vol_face = volume->getVolumeFace(te);
+ LLVolumeFace& vol_face = volume->getVolumeFace(te);
updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face);
}
}
diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h
index e8add0e1d8..cb09eb18e2 100644
--- a/indra/newview/lldrawpoolavatar.h
+++ b/indra/newview/lldrawpoolavatar.h
@@ -257,7 +257,7 @@ typedef enum
LLFace* facep,
const LLMeshSkinInfo* skin,
LLVolume* volume,
- const LLVolumeFace& vol_face);
+ LLVolumeFace& vol_face);
void updateRiggedVertexBuffers(LLVOAvatar* avatar);
void renderRigged(LLVOAvatar* avatar, U32 type, bool glow = false);
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index 12614b5e2d..dbe8724088 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -111,37 +111,52 @@ void LLDrawPoolSky::render(S32 pass)
LLVertexBuffer::unbind();
gGL.diffuseColor4f(1,1,1,1);
- for (S32 i = 0; i < llmin(6, face_count); ++i)
+ for (S32 i = 0; i < face_count; ++i)
{
- renderSkyCubeFace(i);
+ renderSkyFace(i);
}
gGL.popMatrix();
}
-void LLDrawPoolSky::renderSkyCubeFace(U8 side)
+void LLDrawPoolSky::renderSkyFace(U8 index)
{
- LLFace &face = *mDrawFace[LLVOSky::FACE_SIDE0 + side];
- if (!face.getGeomCount())
+ LLFace* face = mDrawFace[index];
+
+ if (!face || !face->getGeomCount())
{
return;
}
- llassert(mSkyTex);
- mSkyTex[side].bindTexture(TRUE);
-
- gGL.getTexUnit(0)->setTextureColorSpace(LLTexUnit::TCS_SRGB);
-
- face.renderIndexed();
-
- if (LLSkyTex::doInterpolate())
- {
-
- LLGLEnable blend(GL_BLEND);
- mSkyTex[side].bindTexture(FALSE);
- gGL.diffuseColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled
- face.renderIndexed();
- }
+ F32 interp_val = gSky.mVOSkyp ? gSky.mVOSkyp->getInterpVal() : 0.0f;
+
+ if (index < 6) // sky tex...interp
+ {
+ llassert(mSkyTex);
+ mSkyTex[index].bindTexture(true); // bind the current tex
+
+ face->renderIndexed();
+
+ if (interp_val > 0.01f) // iff, we've got enough info to lerp (a to and a from)
+ {
+ LLGLEnable blend(GL_BLEND);
+ llassert(mSkyTex);
+ mSkyTex[index].bindTexture(false); // bind the "other" texture
+ gGL.diffuseColor4f(1, 1, 1, interp_val); // lighting is disabled
+ face->renderIndexed();
+ }
+ }
+ else // heavenly body faces, no interp...
+ {
+ LLGLEnable blend(GL_BLEND);
+
+ LLViewerTexture* tex = face->getTexture(LLRender::DIFFUSE_MAP);
+ if (tex)
+ {
+ gGL.getTexUnit(0)->bind(tex, true);
+ face->renderIndexed();
+ }
+ }
}
void LLDrawPoolSky::endRenderPass( S32 pass )
diff --git a/indra/newview/lldrawpoolsky.h b/indra/newview/lldrawpoolsky.h
index 098bd2134a..916d8c1cbe 100644
--- a/indra/newview/lldrawpoolsky.h
+++ b/indra/newview/lldrawpoolsky.h
@@ -61,7 +61,7 @@ public:
/*virtual*/ void endRenderPass(S32 pass);
void setSkyTex(LLSkyTex* const st) { mSkyTex = st; }
- void renderSkyCubeFace(U8 side);
+ void renderSkyFace(U8 index);
void renderHeavenlyBody(U8 hb, LLFace* face);
void renderSunHalo(LLFace* face);
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 1b5c154378..13420fc001 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -500,6 +500,9 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
}
}
+ LLColor4 specular(psky->getIsSunUp() ? psky->getSunlightColor() : psky->getMoonlightColor());
+ shader->uniform4fv(LLShaderMgr::SPECULAR_COLOR, 1, specular.mV);
+
sTime = (F32)LLFrameTimer::getElapsedSeconds() * 0.5f;
S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX);
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index 1660a1897e..720c7e2388 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -442,7 +442,7 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
vars.density_multiplier = psky->getDensityMultiplier();
vars.distance_multiplier = psky->getDistanceMultiplier();
vars.max_y = psky->getMaxY();
- vars.sun_norm = LLEnvironment::instance().getLightDirectionCFR();
+ vars.sun_norm = LLEnvironment::instance().getSunDirectionCFR();
vars.sunlight = psky->getSunlightColor();
vars.ambient = psky->getAmbientColor();
vars.glow = psky->getGlow();
diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h
index e304ac3043..95700227f9 100644
--- a/indra/newview/lllegacyatmospherics.h
+++ b/indra/newview/lllegacyatmospherics.h
@@ -206,6 +206,8 @@ public:
{
}
+ LL_FORCE_INLINE friend bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b);
+
LLColor3 hazeColor;
LLColor3 hazeColorBelowCloud;
LLColor3 cloudColorSun;
@@ -231,6 +233,115 @@ public:
LLColor3 total_density;
};
+bool operator==(const AtmosphericsVars& a, const AtmosphericsVars& b)
+{
+ if (a.hazeColor != b.hazeColor)
+ {
+ return false;
+ }
+
+ if (a.hazeColorBelowCloud != b.hazeColorBelowCloud)
+ {
+ return false;
+ }
+
+ if (a.cloudColorSun != b.cloudColorSun)
+ {
+ return false;
+ }
+
+ if (a.cloudColorAmbient != b.cloudColorAmbient)
+ {
+ return false;
+ }
+
+ if (a.cloudDensity != b.cloudDensity)
+ {
+ return false;
+ }
+
+ if (a.density_multiplier != b.density_multiplier)
+ {
+ return false;
+ }
+
+ if (a.haze_horizon != b.haze_horizon)
+ {
+ return false;
+ }
+
+ if (a.haze_density != b.haze_density)
+ {
+ return false;
+ }
+
+ if (a.blue_horizon != b.blue_horizon)
+ {
+ return false;
+ }
+
+ if (a.blue_density != b.blue_density)
+ {
+ return false;
+ }
+
+ if (a.dome_offset != b.dome_offset)
+ {
+ return false;
+ }
+
+ if (a.dome_radius != b.dome_radius)
+ {
+ return false;
+ }
+
+ if (a.cloud_shadow != b.cloud_shadow)
+ {
+ return false;
+ }
+
+ if (a.glow != b.glow)
+ {
+ return false;
+ }
+
+ if (a.ambient != b.ambient)
+ {
+ return false;
+ }
+
+ if (a.sunlight != b.sunlight)
+ {
+ return false;
+ }
+
+ if (a.sun_norm != b.sun_norm)
+ {
+ return false;
+ }
+
+ if (a.gamma != b.gamma)
+ {
+ return false;
+ }
+
+ if (a.max_y != b.max_y)
+ {
+ return false;
+ }
+
+ if (a.distance_multiplier != b.distance_multiplier)
+ {
+ return false;
+ }
+
+ // light_atten, light_transmittance, total_density
+ // are ignored as they always change when the values above do
+ // they're just shared calc across the sky map generation to save cycles
+
+ return true;
+}
+
class LLAtmospherics
{
public:
diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp
index 0fa4c2b114..83b9c8971a 100644
--- a/indra/newview/llskinningutil.cpp
+++ b/indra/newview/llskinningutil.cpp
@@ -34,8 +34,12 @@
#include "llvolume.h"
#include "llrigginginfo.h"
+#define DEBUG_SKINNING LL_DEBUG
+#define MAT_USE_SSE 1
+
void dump_avatar_and_skin_state(const std::string& reason, LLVOAvatar *avatar, const LLMeshSkinInfo *skin)
{
+#if DEBUG_SKINNING
static S32 dump_count = 0;
const S32 max_dump = 10;
@@ -81,16 +85,16 @@ void dump_avatar_and_skin_state(const std::string& reason, LLVOAvatar *avatar, c
dump_count++;
}
+#endif
}
void LLSkinningUtil::initClass()
{
}
-U32 LLSkinningUtil::getMaxJointCount()
+S32 LLSkinningUtil::getMaxJointCount()
{
- U32 result = LL_MAX_JOINTS_PER_MESH_OBJECT;
- return result;
+ return (S32)LL_MAX_JOINTS_PER_MESH_OBJECT;
}
U32 LLSkinningUtil::getMeshJointCount(const LLMeshSkinInfo *skin)
@@ -120,6 +124,8 @@ void LLSkinningUtil::scrubInvalidJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin
skin->mInvalidJointsScrubbed = true;
}
+#define MAT_USE_SSE 1
+
void LLSkinningUtil::initSkinningMatrixPalette(
LLMatrix4* mat,
S32 count,
@@ -130,9 +136,9 @@ void LLSkinningUtil::initSkinningMatrixPalette(
for (U32 j = 0; j < count; ++j)
{
LLJoint *joint = avatar->getJoint(skin->mJointNums[j]);
+ llassert(joint);
if (joint)
{
-#define MAT_USE_SSE
#ifdef MAT_USE_SSE
LLMatrix4a bind, world, res;
bind.loadu(skin->mInvBindMatrix[j]);
@@ -147,6 +153,7 @@ void LLSkinningUtil::initSkinningMatrixPalette(
else
{
mat[j] = skin->mInvBindMatrix[j];
+#if DEBUG_SKINNING
// This shouldn't happen - in mesh upload, skinned
// rendering should be disabled unless all joints are
// valid. In other cases of skinned rendering, invalid
@@ -157,16 +164,15 @@ void LLSkinningUtil::initSkinningMatrixPalette(
LL_WARNS_ONCE("Avatar") << avatar->getFullname()
<< " avatar build state: isBuilt() " << avatar->isBuilt()
<< " mInitFlags " << avatar->mInitFlags << LL_ENDL;
-#if 0
- dump_avatar_and_skin_state("initSkinningMatrixPalette joint not found", avatar, skin);
#endif
+ dump_avatar_and_skin_state("initSkinningMatrixPalette joint not found", avatar, skin);
}
}
}
void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin)
{
-#ifdef SHOW_ASSERT // same condition that controls llassert()
+#if DEBUG_SKINNING
const S32 max_joints = skin->mJointNames.size();
for (U32 j=0; j<num_vertices; j++)
{
@@ -265,6 +271,7 @@ void LLSkinningUtil::initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar)
{
for (U32 j = 0; j < skin->mJointNames.size(); ++j)
{
+ #if DEBUG_SKINNING
LLJoint *joint = NULL;
if (skin->mJointNums[j] == -1)
{
@@ -282,11 +289,16 @@ void LLSkinningUtil::initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar)
{
LL_WARNS_ONCE("Avatar") << avatar->getFullname() << " unable to find joint " << skin->mJointNames[j] << LL_ENDL;
LL_WARNS_ONCE("Avatar") << avatar->getFullname() << " avatar build state: isBuilt() " << avatar->isBuilt() << " mInitFlags " << avatar->mInitFlags << LL_ENDL;
-#if 0
dump_avatar_and_skin_state("initJointNums joint not found", avatar, skin);
-#endif
+ skin->mJointNums[j] = 0;
}
}
+ #else
+ LLJoint *joint = (skin->mJointNums[j] == -1) ? avatar->getJoint(skin->mJointNames[j]) : avatar->getJoint(skin->mJointNums[j]);
+ skin->mJointNums[j] = joint ? joint->getJointNum() : 0;
+ #endif
+ // insure we have *a* valid joint to reference
+ llassert(skin->mJointNums[j] >= 0);
}
skin->mJointNumsInitialized = true;
}
@@ -344,14 +356,17 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
// FIXME could precompute these matMuls.
LLMatrix4a bind_shape;
- bind_shape.loadu(skin->mBindShapeMatrix);
LLMatrix4a inv_bind;
- inv_bind.loadu(skin->mInvBindMatrix[joint_index]);
LLMatrix4a mat;
- matMul(bind_shape, inv_bind, mat);
LLVector4a pos_joint_space;
+
+ bind_shape.loadu(skin->mBindShapeMatrix);
+ inv_bind.loadu(skin->mInvBindMatrix[joint_index]);
+ matMul(bind_shape, inv_bind, mat);
+
mat.affineTransform(pos, pos_joint_space);
pos_joint_space.mul(wght[k]);
+
LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents();
update_min_max(extents[0], extents[1], pos_joint_space);
}
@@ -366,6 +381,8 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
vol_face.mJointRiggingInfoTab.setNeedsUpdate(false);
}
}
+
+#if DEBUG_SKINNING
if (vol_face.mJointRiggingInfoTab.size()!=0)
{
LL_DEBUGS("RigSpammish") << "we have rigging info for vf " << &vol_face
@@ -376,10 +393,40 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
LL_DEBUGS("RigSpammish") << "no rigging info for vf " << &vol_face
<< " num_verts " << vol_face.mNumVertices << LL_ENDL;
}
+#endif
}
}
+void LLSkinningUtil::updateRiggingInfo_(LLMeshSkinInfo* skin, LLVOAvatar *avatar, S32 num_verts, LLVector4a* weights, LLVector4a* positions, U8* joint_indices, LLJointRiggingInfoTab &rig_info_tab)
+{
+ LL_RECORD_BLOCK_TIME(FTM_FACE_RIGGING_INFO);
+ for (S32 i=0; i < num_verts; i++)
+ {
+ LLVector4a& pos = positions[i];
+ LLVector4a& wght = weights[i];
+ for (U32 k=0; k<4; ++k)
+ {
+ S32 joint_num = skin->mJointNums[joint_indices[k]];
+ llassert(joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS);
+ {
+ rig_info_tab[joint_num].setIsRiggedTo(true);
+ LLMatrix4a bind_shape;
+ bind_shape.loadu(skin->mBindShapeMatrix);
+ LLMatrix4a inv_bind;
+ inv_bind.loadu(skin->mInvBindMatrix[joint_indices[k]]);
+ LLMatrix4a mat;
+ matMul(bind_shape, inv_bind, mat);
+ LLVector4a pos_joint_space;
+ mat.affineTransform(pos, pos_joint_space);
+ pos_joint_space.mul(wght[k]);
+ LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents();
+ update_min_max(extents[0], extents[1], pos_joint_space);
+ }
+ }
+ }
+}
+
// This is used for extracting rotation from a bind shape matrix that
// already has scales baked in
LLQuaternion LLSkinningUtil::getUnscaledQuaternion(const LLMatrix4& mat4)
diff --git a/indra/newview/llskinningutil.h b/indra/newview/llskinningutil.h
index ccc501adc0..d39356451d 100644
--- a/indra/newview/llskinningutil.h
+++ b/indra/newview/llskinningutil.h
@@ -27,23 +27,48 @@
#ifndef LLSKINNINGUTIL_H
#define LLSKINNINGUTIL_H
+#include "v2math.h"
+#include "v4math.h"
+#include "llvector4a.h"
+#include "llmatrix4a.h"
+
class LLVOAvatar;
class LLMeshSkinInfo;
-class LLMatrix4a;
class LLVolumeFace;
+class LLJointRiggingInfoTab;
namespace LLSkinningUtil
{
void initClass();
- U32 getMaxJointCount();
+ S32 getMaxJointCount();
U32 getMeshJointCount(const LLMeshSkinInfo *skin);
void scrubInvalidJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin);
void initSkinningMatrixPalette(LLMatrix4* mat, S32 count, const LLMeshSkinInfo* skin, LLVOAvatar *avatar);
void checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin);
void scrubSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin);
void getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat, U32 max_joints);
+
+ LL_FORCE_INLINE void getPerVertexSkinMatrixWithIndices(
+ F32* weights,
+ U8* idx,
+ LLMatrix4a* mat,
+ LLMatrix4a& final_mat,
+ LLMatrix4a* src)
+ {
+ final_mat.clear();
+ src[0].setMul(mat[idx[0]], weights[0]);
+ src[1].setMul(mat[idx[1]], weights[1]);
+ final_mat.add(src[0]);
+ final_mat.add(src[1]);
+ src[2].setMul(mat[idx[2]], weights[2]);
+ src[3].setMul(mat[idx[3]], weights[3]);
+ final_mat.add(src[2]);
+ final_mat.add(src[3]);
+ }
+
void initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar);
void updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face);
+ void updateRiggingInfo_(LLMeshSkinInfo* skin, LLVOAvatar *avatar, S32 num_verts, LLVector4a* weights, LLVector4a* positions, U8* joint_indices, LLJointRiggingInfoTab &rig_info_tab);
LLQuaternion getUnscaledQuaternion(const LLMatrix4& mat4);
};
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index b78937e3b0..ddce419f19 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -196,9 +196,6 @@ void display_update_camera()
LLViewerCamera::getInstance()->setFar(final_far);
gViewerWindow->setup3DRender();
- // update all the sky/atmospheric/water settings
- LLEnvironment::instance().update(LLViewerCamera::getInstance());
-
// Update land visibility too
LLWorld::getInstance()->setLandFarClip(final_far);
}
@@ -245,6 +242,7 @@ static LLTrace::BlockTimerStatHandle FTM_HUD_UPDATE("HUD Update");
static LLTrace::BlockTimerStatHandle FTM_DISPLAY_UPDATE_GEOM("Update Geom");
static LLTrace::BlockTimerStatHandle FTM_TEXTURE_UNBIND("Texture Unbind");
static LLTrace::BlockTimerStatHandle FTM_TELEPORT_DISPLAY("Teleport Display");
+static LLTrace::BlockTimerStatHandle FTM_EEP_UPDATE("Env Update");
// Paint the display!
void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
@@ -627,7 +625,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
stop_glerror();
display_update_camera();
stop_glerror();
-
+
+ {
+ LL_RECORD_BLOCK_TIME(FTM_EEP_UPDATE);
+ // update all the sky/atmospheric/water settings
+ LLEnvironment::instance().update(LLViewerCamera::getInstance());
+ }
+
// *TODO: merge these two methods
{
LL_RECORD_BLOCK_TIME(FTM_HUD_UPDATE);
diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp
index b7bd131246..a448a95904 100644
--- a/indra/newview/llviewerjoint.cpp
+++ b/indra/newview/llviewerjoint.cpp
@@ -141,11 +141,10 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
//----------------------------------------------------------------
// render children
//----------------------------------------------------------------
- for (child_list_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* j : mChildren)
{
- LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
- F32 jointLOD = joint->getLOD();
+ LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(j);
+ F32 jointLOD = joint ? joint->getLOD() : 0;
if (pixelArea >= jointLOD || sDisableLOD)
{
triangle_count += joint->render( pixelArea, TRUE, is_dummy );
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index ad452659c6..78c782eb5f 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -90,7 +90,6 @@ namespace
S32 LLSkyTex::sComponents = 4;
S32 LLSkyTex::sResolution = 64;
-F32 LLSkyTex::sInterpVal = 0.f;
S32 LLSkyTex::sCurrent = 0;
@@ -479,8 +478,8 @@ void LLVOSky::init()
m_atmosphericsVars.haze_horizon = psky->getHazeHorizon();
m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier();
m_atmosphericsVars.max_y = psky->getMaxY();
- m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedLightNorm();
- m_atmosphericsVars.sunlight = psky->getSunlightColor();
+ m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedSunNorm();
+ m_atmosphericsVars.sunlight = psky->getIsSunUp() ? psky->getSunlightColor() : psky->getMoonlightColor();
m_atmosphericsVars.ambient = psky->getAmbientColor();
m_atmosphericsVars.glow = psky->getGlow();
m_atmosphericsVars.cloud_shadow = psky->getCloudShadow();
@@ -531,8 +530,8 @@ void LLVOSky::calc()
m_atmosphericsVars.density_multiplier = psky->getDensityMultiplier();
m_atmosphericsVars.distance_multiplier = psky->getDistanceMultiplier();
m_atmosphericsVars.max_y = psky->getMaxY();
- m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedLightNorm();
- m_atmosphericsVars.sunlight = psky->getSunlightColor();
+ m_atmosphericsVars.sun_norm = LLEnvironment::instance().getClampedSunNorm();
+ m_atmosphericsVars.sunlight = psky->getIsSunUp() ? psky->getSunlightColor() : psky->getMoonlightColor();
m_atmosphericsVars.ambient = psky->getAmbientColor();
m_atmosphericsVars.glow = psky->getGlow();
m_atmosphericsVars.cloud_shadow = psky->getCloudShadow();
@@ -725,8 +724,6 @@ bool LLVOSky::updateSky()
next_frame = next_frame % cycle_frame_no;
mInterpVal = (!mInitialized) ? 1 : (F32)next_frame / cycle_frame_no;
- // sInterpVal = (F32)next_frame / cycle_frame_no;
- LLSkyTex::setInterpVal( mInterpVal );
LLHeavenBody::setInterpVal( mInterpVal );
updateDirections();
@@ -753,7 +750,9 @@ bool LLVOSky::updateSky()
calc();
- if (mForceUpdate && mForceUpdateThrottle.hasExpired())
+ bool same_atmospherics = m_lastAtmosphericsVars == m_atmosphericsVars;
+
+ if (mForceUpdate && mForceUpdateThrottle.hasExpired() && !same_atmospherics)
{
LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED);
@@ -761,6 +760,8 @@ bool LLVOSky::updateSky()
LLSkyTex::stepCurrent();
+ m_lastAtmosphericsVars = m_atmosphericsVars;
+
if (!direction.isExactlyZero())
{
mLastTotalAmbient = total_ambient;
@@ -912,6 +913,8 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur
mSunTexturep[0] = sun_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
mSunTexturep[1] = sun_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(sun_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
+ bool can_use_wl = gPipeline.canUseWindLightShaders();
+
if (mFace[FACE_SUN])
{
if (mSunTexturep[0])
@@ -934,11 +937,14 @@ void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_textur
mFace[FACE_SUN]->setTexture(LLRender::DIFFUSE_MAP, mSunTexturep[0]);
- if (mSunTexturep[1])
+ if (can_use_wl)
{
- mSunTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ if (mSunTexturep[1])
+ {
+ mSunTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
+ mFace[FACE_SUN]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mSunTexturep[1]);
}
- mFace[FACE_SUN]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mSunTexturep[1]);
}
}
@@ -946,6 +952,8 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex
{
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+ bool can_use_wl = gPipeline.canUseWindLightShaders();
+
mMoonTexturep[0] = moon_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
mMoonTexturep[1] = moon_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
@@ -957,7 +965,7 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex
}
mFace[FACE_MOON]->setTexture(LLRender::DIFFUSE_MAP, mMoonTexturep[0]);
- if (mMoonTexturep[1])
+ if (mMoonTexturep[1] && can_use_wl)
{
mMoonTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
mFace[FACE_MOON]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mMoonTexturep[1]);
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 8c2817e1ed..5f27085599 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -57,13 +57,8 @@ private:
LLColor4 *mSkyData;
LLVector3 *mSkyDirs; // Cache of sky direction vectors
static S32 sCurrent;
- static F32 sInterpVal;
public:
- static F32 getInterpVal() { return sInterpVal; }
- static void setInterpVal(const F32 v) { sInterpVal = v; }
- static BOOL doInterpolate() { return sInterpVal > 0.001f; }
-
void bindTexture(BOOL curr = TRUE);
protected:
@@ -299,6 +294,8 @@ public:
LLFace *mFace[FACE_COUNT];
LLVector3 mBumpSunDir;
+ F32 getInterpVal() const { return mInterpVal; }
+
protected:
~LLVOSky();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 02ef7612a7..706e2c6895 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4787,18 +4787,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