diff options
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r-- | indra/newview/llvovolume.cpp | 119 |
1 files changed, 41 insertions, 78 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 0ea315af1b..91e64d611c 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -622,8 +622,18 @@ void LLVOVolume::animateTextures() continue; } - LLGLTFMaterial *gltf_mat = te->getGLTFRenderMaterial(); - const bool is_pbr = gltf_mat != nullptr; + if (!(result & LLViewerTextureAnim::ROTATE)) + { + te->getRotation(&rot); + } + if (!(result & LLViewerTextureAnim::TRANSLATE)) + { + te->getOffset(&off_s,&off_t); + } + if (!(result & LLViewerTextureAnim::SCALE)) + { + te->getScale(&scale_s, &scale_t); + } if (!facep->mTextureMatrix) { @@ -632,80 +642,22 @@ void LLVOVolume::animateTextures() LLMatrix4& tex_mat = *facep->mTextureMatrix; tex_mat.setIdentity(); + LLVector3 trans ; - if (!is_pbr) - { - if (!(result & LLViewerTextureAnim::ROTATE)) - { - te->getRotation(&rot); - } - if (!(result & LLViewerTextureAnim::TRANSLATE)) - { - te->getOffset(&off_s,&off_t); - } - if (!(result & LLViewerTextureAnim::SCALE)) - { - te->getScale(&scale_s, &scale_t); - } - - LLVector3 trans ; - - trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f)); - tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); - - LLVector3 scale(scale_s, scale_t, 1.f); - LLQuaternion quat; - quat.setQuat(rot, 0, 0, -1.f); - - tex_mat.rotate(quat); - - LLMatrix4 mat; - mat.initAll(scale, LLQuaternion(), LLVector3()); - tex_mat *= mat; - - tex_mat.translate(trans); - } - else - { - if (!(result & LLViewerTextureAnim::ROTATE)) - { - rot = 0.0f; - } - if (!(result & LLViewerTextureAnim::TRANSLATE)) - { - off_s = 0.0f; - off_t = 0.0f; - } - if (!(result & LLViewerTextureAnim::SCALE)) - { - scale_s = 1.0f; - scale_t = 1.0f; - } - - // For PBR materials, use Blinn-Phong rotation as hint for - // translation direction. In a Blinn-Phong material, the - // translation direction would be a byproduct the texture - // transform. - F32 rot_frame; - te->getRotation(&rot_frame); - - tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); - - LLQuaternion quat; - quat.setQuat(rot, 0, 0, -1.f); - tex_mat.rotate(quat); + trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f)); + tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); - LLMatrix4 mat; - LLVector3 scale(scale_s, scale_t, 1.f); - mat.initAll(scale, LLQuaternion(), LLVector3()); - tex_mat *= mat; - - LLVector3 off(off_s, off_t, 0.f); - off.rotVec(rot_frame, 0, 0, 1.f); - tex_mat.translate(off); + LLVector3 scale(scale_s, scale_t, 1.f); + LLQuaternion quat; + quat.setQuat(rot, 0, 0, -1.f); + + tex_mat.rotate(quat); - tex_mat.translate(LLVector3(0.5f, 0.5f, 0.f)); - } + LLMatrix4 mat; + mat.initAll(scale, LLQuaternion(), LLVector3()); + tex_mat *= mat; + + tex_mat.translate(trans); } } else @@ -4672,7 +4624,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& if (!pick_unselectable) { - if (!LLSelectMgr::instance().canSelectObject(this)) + if (!LLSelectMgr::instance().canSelectObject(this, TRUE)) { return FALSE; } @@ -5161,8 +5113,6 @@ void LLControlAVBridge::updateSpatialExtents() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE - LLControlAvatar* controlAvatar = getVObj()->getControlAvatar(); - LLSpatialGroup* root = (LLSpatialGroup*)mOctree->getListener(0); bool rootWasDirty = root->isDirty(); @@ -5173,7 +5123,11 @@ void LLControlAVBridge::updateSpatialExtents() // disappear when root goes off-screen" // // Expand extents to include Control Avatar placed outside of the bounds - if (controlAvatar && (rootWasDirty || controlAvatar->mPlaying)) + LLControlAvatar* controlAvatar = getVObj() ? getVObj()->getControlAvatar() : NULL; + if (controlAvatar + && controlAvatar->mDrawable + && controlAvatar->mDrawable->getEntry() + && (rootWasDirty || controlAvatar->mPlaying)) { root->expandExtents(controlAvatar->mDrawable->getSpatialExtents(), *mDrawable->getXform()); } @@ -5909,7 +5863,16 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } else { - if (te->getColor().mV[3] > 0.f || te->getGlow() > 0.f) + F32 alpha; + if (is_pbr) + { + alpha = gltf_mat ? gltf_mat->mBaseColor.mV[3] : 1.0; + } + else + { + alpha = te->getColor().mV[3]; + } + if (alpha > 0.f || te->getGlow() > 0.f) { //only treat as alpha in the pipeline if < 100% transparent drawablep->setState(LLDrawable::HAS_ALPHA); add_face(sAlphaFaces, alpha_count, facep); |