diff options
8 files changed, 52 insertions, 7 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl index a897198062..5264b3b716 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl @@ -25,6 +25,7 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; @@ -70,7 +71,7 @@ void main() #endif vary_position = pos.xyz; - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; #ifndef HAS_REFLECTION_PROBES vec3 ref = reflect(pos.xyz, -norm); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl index 1855cfceeb..ad2170bbd3 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl @@ -50,7 +50,7 @@ void fullbright_lighting() discard; } - color.rgb *= vertex_color.rgb; + color *= vertex_color; color.rgb = pow(color.rgb, vec3(texture_gamma)); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl index ace2574ac2..891515ab1e 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -25,6 +25,7 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; @@ -70,7 +71,7 @@ void main() vec3 ref = reflect(pos.xyz, -norm); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - vary_texcoord1 = transpose(normal_matrix) * ref; + vary_texcoord1 = (texture_matrix1 * vec4(ref,1.0)).xyz; calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index 097e42d233..3ad7bcaa50 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -25,6 +25,7 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; @@ -69,7 +70,7 @@ void main() vec3 ref = reflect(pos.xyz, -norm); vary_texcoord0 = (texture_matrix0*vec4(texcoord0,0,1)).xy; - vary_texcoord1 = transpose(normal_matrix) * ref; + vary_texcoord1 = (texture_matrix1 * vec4(ref,1.0)).xyz; calcAtmospherics(pos.xyz); diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 3fe3896aa2..288ba8f536 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -311,6 +311,7 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV); if (shader_level > 1) { + cube_map->setMatrix(1); // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for // the cube map in the one pass shiny shaders cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); @@ -319,6 +320,7 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di } else { + cube_map->setMatrix(0); cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); diffuse_channel = -1; cube_map->enable(cube_channel); @@ -332,6 +334,7 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di diffuse_channel = -1; gGL.getTexUnit(0)->disable(); cube_map->enable(0); + cube_map->setMatrix(0); gGL.getTexUnit(0)->bind(cube_map); } } @@ -390,6 +393,7 @@ void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& // Moved below shader->disableTexture call to avoid false alarms from auto-re-enable of textures on stage 0 // MAINT-755 cube_map->disable(); + cube_map->restoreMatrix(); } } @@ -460,6 +464,7 @@ void LLDrawPoolBump::beginFullbrightShiny() LLVector4 vec4(vec, gShinyOrigin.mV[3]); shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV); + cube_map->setMatrix(1); if (shader->mFeatures.hasReflectionProbes) { gPipeline.bindReflectionProbes(*shader); @@ -525,6 +530,7 @@ void LLDrawPoolBump::endFullbrightShiny() if( cube_map ) { cube_map->disable(); + cube_map->restoreMatrix(); if (shader->mFeatures.hasReflectionProbes) { gPipeline.unbindReflectionProbes(*shader); diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index a30660b2de..e9d84ecf06 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -256,6 +256,19 @@ public: } }; + struct CompareRenderOrder + { + bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs) + { + if (lhs->mAvatarp != rhs->mAvatarp) + { + return lhs->mAvatarp < rhs->mAvatarp; + } + + return lhs->mRenderOrder > rhs->mRenderOrder; + } + }; + typedef enum { GEOM_DIRTY = LLViewerOctreeGroup::INVALID_STATE, @@ -354,6 +367,9 @@ public: F32 mPixelArea; F32 mRadius; + //used by LLVOAVatar to set render order in alpha draw pool to preserve legacy render order behavior + LLVOAvatar* mAvatarp = nullptr; + U32 mRenderOrder = 0; // Reflection Probe associated with this node (if any) LLPointer<LLReflectionMap> mReflectionProbe = nullptr; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ccb1662139..314c22eb6c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2809,6 +2809,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) // update attachments positions if (detailed_update) { + U32 draw_order = 0; for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -2847,9 +2848,17 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) } } - - attached_object->mDrawable->makeActive(); - attached_object->mDrawable->updateXform(TRUE); + // if selecting any attachments, update all of them as non-damped + if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment()) + { + gPipeline.updateMoveNormalAsync(attached_object->mDrawable); + } + else + { + // Note: SL-17415; While most objects follow joints, + // some objects get position updates from server + gPipeline.updateMoveDampedAsync(attached_object->mDrawable); + } // override_bbox calls movePartition() and getSpatialPartition(), // so bridge might no longer be valid, get it again. @@ -2867,6 +2876,13 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) bridge->setState(LLDrawable::MOVE_UNDAMPED); bridge->updateMove(); bridge->setState(LLDrawable::EARLY_MOVE); + + LLSpatialGroup* group = attached_object->mDrawable->getSpatialGroup(); + if (group) + { //set draw order of group + group->mAvatarp = this; + group->mRenderOrder = draw_order++; + } } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 55819449c6..3332185bfd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3877,7 +3877,11 @@ void LLPipeline::postSort(LLCamera& camera) if (!sShadowRender) { + // order alpha groups by distance std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater()); + + // order rigged alpha groups by avatar attachment order + std::sort(sCull->beginRiggedAlphaGroups(), sCull->endRiggedAlphaGroups(), LLSpatialGroup::CompareRenderOrder()); } LL_PUSH_CALLSTACKS(); |