summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl50
-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/llfloaterland.cpp2
-rw-r--r--indra/newview/llfloaterregioninfo.cpp2
-rw-r--r--indra/newview/lllegacyatmospherics.cpp29
-rw-r--r--indra/newview/lllegacyatmospherics.h111
-rw-r--r--indra/newview/llpanelenvironment.cpp68
-rw-r--r--indra/newview/llpanelenvironment.h1
-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.cpp53
21 files changed, 514 insertions, 159 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
index 5ce246a114..2cd660ab79 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -129,8 +129,6 @@ void main()
// Add "minimum anti-solar illumination"
temp2.x += .25;
- //temp2.x *= sun_moon_glow_factor;
-
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient_color)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index d81a8feb96..0d141342ce 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -54,17 +54,19 @@ uniform float max_y;
uniform vec4 glow;
uniform float sun_moon_glow_factor;
+
uniform vec4 cloud_color;
void main()
{
// World / view / projection
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
// Get relative position
vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
- //vec3 P = position.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
@@ -78,7 +80,8 @@ void main()
// Can normalize then
vec3 Pn = normalize(P);
- float Plen = length(P);
+
+ float Plen = length(P);
// Initialize temp variables
vec4 temp1 = vec4(0.);
@@ -89,29 +92,28 @@ void main()
vec4 light_atten;
float dens_mul = density_multiplier;
- float dist_mul = max(0.05, distance_multiplier);
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
// Calculate relative weights
- temp1 = blue_density + haze_density;
+ temp1 = abs(blue_density) + vec4(abs(haze_density));
blue_weight = blue_density / temp1;
haze_weight = haze_density / temp1;
// Compute sunlight from P & lightnorm (for long rays like sky)
- temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
- temp2.y = 1. / temp2.y;
- sunlight *= exp( - light_atten * temp2.y);
+ temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
+ temp2.y = 1. / temp2.y;
+ sunlight *= exp( - light_atten * temp2.y);
// Distance
temp2.z = Plen * dens_mul;
// Transparency (-> temp1)
- // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
- // compiler gets confused.
- temp1 = exp(-temp1 * temp2.z);
+ // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
+ // compiler gets confused.
+ temp1 = exp(-temp1 * temp2.z);
// Compute haze glow
temp2.x = dot(Pn, lightnorm.xyz);
@@ -124,40 +126,36 @@ void main()
temp2.x = pow(temp2.x, glow.z);
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
- temp2.x *= sun_moon_glow_factor;
-
// Add "minimum anti-solar illumination"
temp2.x += .25;
+ vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient_color)
+ + (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
+ );
- // Haze color above cloud
- vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient_color)
- + (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
- );
+ // Final atmosphere additive
+ color *= (1. - temp1);
// Increase ambient when there are more clouds
vec4 tmpAmbient = ambient_color;
- tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
+ tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
// Dim sunlight by cloud shadow percentage
- sunlight *= (1. - cloud_shadow);
+ sunlight *= max(0.0, (1. - cloud_shadow));
// Haze color below cloud
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
);
- // Final atmosphere additive
- vary_HazeColor *= (1. - temp1);
-
// Attenuate cloud color by atmosphere
temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds
// At horizon, blend high altitude sky color towards the darker color below the clouds
- vary_HazeColor += (additiveColorBelowCloud - vary_HazeColor) * (1. - sqrt(temp1));
-
- // won't compile on mac without this being set
- //vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
+ color += (additiveColorBelowCloud - color) * (1. - sqrt(temp1));
+
+ // Haze color above cloud
+ vary_HazeColor = color;
}
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/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 4a93f1b886..4f147fdb07 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -3319,6 +3319,8 @@ void LLPanelLandEnvironment::refresh()
if (gDisconnected)
return;
+ commitDayLenOffsetChanges(false); // commit unsaved changes if any
+
if (!isSameRegion())
{
setCrossRegion(true);
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index ab91c34b3d..83215a7fec 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -3731,6 +3731,8 @@ BOOL LLPanelRegionEnvironment::postBuild()
void LLPanelRegionEnvironment::refresh()
{
+ commitDayLenOffsetChanges(false); // commit unsaved changes if any
+
if (!mCurrentEnvironment)
{
if (mCurEnvVersion <= INVALID_PARCEL_ENVIRONMENT_VERSION)
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index 68613be19c..720c7e2388 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -242,7 +242,8 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(AtmosphericsVars& vars, const LLVecto
calcSkyColorWLVert(Pn, vars);
- LLColor3 sky_color = isShiny ? vars.hazeColor : psky->gammaCorrect(vars.hazeColor * 2.0f);
+ LLColor3 sky_color = isShiny ? vars.hazeColor :
+ !gPipeline.canUseWindLightShaders() ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f);
if (isShiny)
{
@@ -306,6 +307,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
// this is used later for sunlight modulation at various altitudes
LLColor3 light_atten = vars.light_atten;
LLColor3 light_transmittance = psky->getLightTransmittance(Plen);
+ (void)light_transmittance; // silence Clang warn-error
// Calculate relative weights
LLColor3 temp2(0.f, 0.f, 0.f);
@@ -321,22 +323,18 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
}
// Compute sunlight from P & lightnorm (for long rays like sky)
- temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, lighty));
-
- if (temp2.mV[1] > 0.0000001f)
- {
- temp2.mV[1] = 1.f / temp2.mV[1];
- }
- temp2.mV[1] = llmax(temp2.mV[1], 0.0000001f);
+ temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, Pn[1]) * 1.0f + sun_norm.mV[1] );
+ temp2.mV[1] = 1.f / temp2.mV[1];
componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1]));
- componentMultBy(sunlight, light_transmittance);
+ //componentMultBy(sunlight, light_transmittance);
// Distance
temp2.mV[2] = Plen * density_multiplier;
// Transparency (-> temp1)
- temp1 = componentExp((temp1 * -1.f) * temp2.mV[2] * distance_multiplier);
+ temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]);// * distance_multiplier);
+ (void)distance_multiplier;
// Compute haze glow
temp2.mV[0] = Pn * LLVector3(sun_norm);
@@ -347,7 +345,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
- temp2.mV[0] *= (glow.mV[0] > 0) ? glow.mV[0] : F32_MIN;
+ temp2.mV[0] *= glow.mV[0];
temp2.mV[0] = pow(temp2.mV[0], glow.mV[2]);
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
@@ -374,10 +372,13 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
final_atten.mV[2] = llmax(final_atten.mV[2], 0.0f);
// Final atmosphere additive
- componentMultBy(vars.hazeColor, final_atten);
+ componentMultBy(vars.hazeColor, LLColor3::white - temp1);
+
+ // Attenuate cloud color by atmosphere
+ temp1 = componentSqrt(temp1); //less atmos opacity (more transparency) below clouds
// At horizon, blend high altitude sky color towards the darker color below the clouds
- vars.hazeColor += componentMult(vars.hazeColorBelowCloud - vars.hazeColor, final_atten);
+ vars.hazeColor += componentMult(vars.hazeColorBelowCloud - vars.hazeColor, LLColor3::white - componentSqrt(temp1));
}
void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
@@ -441,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/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 554fe6e9bc..d63ae4e434 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -215,6 +215,8 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility)
}
else
{
+ commitDayLenOffsetChanges(false); // arrow-key changes
+
LLFloaterSettingsPicker *picker = getSettingsPicker(false);
if (picker)
{
@@ -718,6 +720,11 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value)
void LLPanelEnvironmentInfo::onDayLenOffsetMouseUp()
{
+ commitDayLenOffsetChanges(true);
+}
+
+void LLPanelEnvironmentInfo::commitDayLenOffsetChanges(bool need_callback)
+{
if (mCurrentEnvironment && (getDirtyFlag() & (DIRTY_FLAG_DAYLENGTH | DIRTY_FLAG_DAYOFFSET)))
{
clearDirtyFlag(DIRTY_FLAG_DAYOFFSET);
@@ -725,9 +732,23 @@ void LLPanelEnvironmentInfo::onDayLenOffsetMouseUp()
LLHandle<LLPanel> that_h = getHandle();
- LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(),
- mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), LLEnvironment::altitudes_vect_t(),
- [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
+ if (need_callback)
+ {
+ LLEnvironment::instance().updateParcel(getParcelId(),
+ LLSettingsDay::ptr_t(),
+ mCurrentEnvironment->mDayLength.value(),
+ mCurrentEnvironment->mDayOffset.value(),
+ LLEnvironment::altitudes_vect_t(),
+ [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
+ }
+ else
+ {
+ LLEnvironment::instance().updateParcel(getParcelId(),
+ LLSettingsDay::ptr_t(),
+ mCurrentEnvironment->mDayLength.value(),
+ mCurrentEnvironment->mDayOffset.value(),
+ LLEnvironment::altitudes_vect_t());
+ }
}
}
@@ -776,6 +797,8 @@ void LLPanelEnvironmentInfo::onAltSliderMouseUp()
if (isRegion() && (getDirtyFlag() & DIRTY_FLAG_ALTITUDES))
{
clearDirtyFlag(DIRTY_FLAG_ALTITUDES);
+ clearDirtyFlag(DIRTY_FLAG_DAYLENGTH);
+ clearDirtyFlag(DIRTY_FLAG_DAYOFFSET);
LLHandle<LLPanel> that_h = getHandle();
LLEnvironment::altitudes_vect_t alts;
@@ -785,7 +808,11 @@ void LLPanelEnvironmentInfo::onAltSliderMouseUp()
alts.push_back(alt.second.mAltitude);
}
setControlsEnabled(false);
- LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(), -1, -1, alts);
+ LLEnvironment::instance().updateParcel(getParcelId(),
+ LLSettingsDay::ptr_t(),
+ mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1,
+ mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1,
+ alts);
}
}
@@ -852,14 +879,21 @@ void LLPanelEnvironmentInfo::onBtnRstAltitudes()
LLHandle<LLPanel> that_h = getHandle();
LLEnvironment::altitudes_vect_t alts;
+ clearDirtyFlag(DIRTY_FLAG_ALTITUDES);
+ clearDirtyFlag(DIRTY_FLAG_DAYLENGTH);
+ clearDirtyFlag(DIRTY_FLAG_DAYOFFSET);
+
for (S32 idx = 1; idx <= ALTITUDE_SLIDER_COUNT; ++idx)
{
F32 new_height = idx * ALTITUDE_DEFAULT_HEIGHT_STEP;
alts.push_back(new_height);
}
- LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(),
- -1, -1, alts,
+ LLEnvironment::instance().updateParcel(getParcelId(),
+ LLSettingsDay::ptr_t(),
+ mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1,
+ mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1,
+ alts,
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
}
}
@@ -930,11 +964,16 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, S32 track_num)
if (itemp)
{
LLHandle<LLPanel> that_h = getHandle();
+ clearDirtyFlag(DIRTY_FLAG_DAYLENGTH);
+ clearDirtyFlag(DIRTY_FLAG_DAYOFFSET);
- LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(),
- itemp->getName(),
- track_num,
- -1, -1, LLEnvironment::altitudes_vect_t(),
+ LLEnvironment::instance().updateParcel(getParcelId(),
+ itemp->getAssetUUID(),
+ itemp->getName(),
+ track_num,
+ mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1,
+ mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1,
+ LLEnvironment::altitudes_vect_t(),
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
}
}
@@ -960,9 +999,14 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday)
if (newhash != oldhash)
{
LLHandle<LLPanel> that_h = getHandle();
+ clearDirtyFlag(DIRTY_FLAG_DAYLENGTH);
+ clearDirtyFlag(DIRTY_FLAG_DAYOFFSET);
- LLEnvironment::instance().updateParcel(getParcelId(), newday,
- -1, -1, LLEnvironment::altitudes_vect_t(),
+ LLEnvironment::instance().updateParcel(getParcelId(),
+ newday,
+ mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1,
+ mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1,
+ LLEnvironment::altitudes_vect_t(),
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
}
}
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index 9eb4040758..50ec1165be 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -126,6 +126,7 @@ protected:
void onPickerCommitted(LLUUID item_id, S32 track_num = LLEnvironment::NO_TRACK);
void onEditCommitted(LLSettingsDay::ptr_t newday);
void onDayLenOffsetMouseUp();
+ void commitDayLenOffsetChanges(bool need_callback);
void onPickerAssetDownloaded(LLSettingsBase::ptr_t settings);
void onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo);
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 9fa29abc4d..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
@@ -5546,11 +5572,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
U32 mask = mat->getShaderMask(alpha_mode);
pool->addRiggedFace(facep, mask);
}
-
- if(vobj->isAnimatedObject() && vobj->isRiggedMesh())
- {
- pool->updateRiggedVertexBuffers(vobj->getAvatar());
- }
}
else if (mat)
{