Made rigged matrix cache toggleable via setting, for testing. Speculative fix for hairbase incorrectly appearing on animesh.

This commit is contained in:
Shyotl
2019-03-19 15:17:14 -05:00
parent 7f7267027e
commit 5a9ad787d5
4 changed files with 41 additions and 19 deletions

View File

@@ -39,6 +39,7 @@ public:
LLControlAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
virtual void initInstance(); // Called after construction to initialize the class.
virtual ~LLControlAvatar();
virtual LLControlAvatar* asControlAvatar() { return this; }
void getNewConstraintFixups(LLVector3& new_pos_constraint, F32& new_scale_constraint) const;
void matchVolumeTransform();

View File

@@ -1457,6 +1457,11 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
LLPointer<LLVertexBuffer> buffer = face->getVertexBuffer();
LLDrawable* drawable = face->getDrawable();
if (drawable->getVOVolume() && drawable->getVOVolume()->isNoLOD())
{
return;
}
U32 data_mask = face->getRiggedVertexBufferDataMask();
if (!vol_face.mWeightsScrubbed)
@@ -1557,9 +1562,15 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
{
if (sShaderLevel > 0)
{
auto& mesh_cache = avatar->getRiggedMatrixCache();
auto& mesh_id = skin->mMeshID;
auto rigged_matrix_data_iter = find_if(mesh_cache.begin(), mesh_cache.end(), [&mesh_id](decltype(mesh_cache[0]) & entry) { return entry.first == mesh_id; });
static LLCachedControl<bool> sh_use_rigging_cache("SHUseRiggedMatrixCache", true);
auto& mesh_cache = avatar->getRiggedMatrixCache();;
auto rigged_matrix_data_iter = mesh_cache.cend();
if (sh_use_rigging_cache)
{
auto& mesh_id = skin->mMeshID;
rigged_matrix_data_iter = find_if(mesh_cache.begin(), mesh_cache.end(), [&mesh_id](decltype(mesh_cache[0]) & entry) { return entry.first == mesh_id; });
}
if (rigged_matrix_data_iter != avatar->getRiggedMatrixCache().cend())
{
LLDrawPoolAvatar::sVertexProgram->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
@@ -1567,8 +1578,6 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
FALSE,
(GLfloat*)rigged_matrix_data_iter->second.second.data());
LLDrawPoolAvatar::sVertexProgram->uniform1f(LLShaderMgr::AVATAR_MAX_WEIGHT, F32(rigged_matrix_data_iter->second.first - 1));
stop_glerror();
}
else
{
@@ -1600,7 +1609,8 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
mp[idx + 10] = m[10];
mp[idx + 11] = m[14];
}
mesh_cache.emplace_back(std::make_pair( skin->mMeshID, std::make_pair(count, mp) ) );
if (sh_use_rigging_cache)
mesh_cache.emplace_back(std::make_pair( skin->mMeshID, std::make_pair(count, mp) ) );
LLDrawPoolAvatar::sVertexProgram->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
count,
FALSE,

View File

@@ -4912,7 +4912,7 @@ void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool w
root_pos += LLVector3d(getHoverOffset());
}
LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(this);
LLControlAvatar *cav = asControlAvatar();
if (cav)
{
// SL-1350: Moved to LLDrawable::updateXform()
@@ -5003,7 +5003,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
bool is_attachment = false;
if (is_control_avatar)
{
LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(this);
LLControlAvatar *cav = asControlAvatar();
is_attachment = cav && cav->mRootVolp && cav->mRootVolp->isAttachment(); // For attached animated objects
}
@@ -5577,10 +5577,19 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass)
}
first_pass = FALSE;
}
// Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair)
// TODO: 1.25 will be able to switch this logic back to calling isTextureVisible();
if ((getImage(TEX_HAIR_BAKED, 0) &&
getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE) || LLDrawPoolAlpha::sShowDebugAlpha)
bool show_hair = false;
if (isControlAvatar())
{
show_hair = isTextureVisible(TEX_HAIR_BAKED);
}
else
{
// Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair)
// TODO: 1.25 will be able to switch this logic back to calling isTextureVisible();
auto image = getImage(TEX_HAIR_BAKED, 0);
show_hair = LLDrawPoolAlpha::sShowDebugAlpha || (image && image->getID() != IMG_INVISIBLE);
}
if (show_hair)
{
LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
if (hair_mesh)
@@ -6783,7 +6792,7 @@ void LLVOAvatar::rebuildAttachmentOverrides()
clearAttachmentOverrides();
// Handle the case that we're resetting the skeleton of an animated object.
LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this);
LLControlAvatar *control_av = asControlAvatar();
if (control_av)
{
LLVOVolume *volp = control_av->mRootVolp;
@@ -6837,7 +6846,7 @@ void LLVOAvatar::updateAttachmentOverrides()
std::set<LLUUID> meshes_seen;
// Handle the case that we're updating the skeleton of an animated object.
LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this);
LLControlAvatar *control_av = asControlAvatar();
if (control_av)
{
LLVOVolume *volp = control_av->mRootVolp;
@@ -10402,7 +10411,7 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
}
}
LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this);
LLControlAvatar *control_av = asControlAvatar();
if (control_av)
{
LLVOVolume *volp = control_av->mRootVolp;
@@ -10616,7 +10625,7 @@ void LLVOAvatar::idleUpdateRenderComplexity()
{
if (isControlAvatar())
{
LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(this);
LLControlAvatar *cav = asControlAvatar();
bool is_attachment = cav && cav->mRootVolp && cav->mRootVolp->isAttachment(); // For attached animated objects
if (is_attachment)
{
@@ -10891,7 +10900,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
// A standalone animated object needs to be accounted for
// using its associated volume. Attached animated objects
// will be covered by the subsequent loop over attachments.
LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this);
LLControlAvatar *control_av = asControlAvatar();
if (control_av)
{
LLVOVolume *volp = control_av->mRootVolp;

View File

@@ -82,6 +82,7 @@ class LLViewerJoint;
struct LLAppearanceMessageContents;
class LLMeshSkinInfo;
class LLViewerJointMesh;
class LLControlAvatar;
class SHClientTagMgr : public LLSingleton<SHClientTagMgr>, public boost::signals2::trackable
{
@@ -296,8 +297,9 @@ public:
public:
virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
virtual bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user)
virtual bool isUIAvatar() const { return mIsUIAvatar; } // True if this avatar is a supplemental av used in some UI views (no associated user)
bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user)
virtual LLControlAvatar* asControlAvatar() { return nullptr; }
bool isUIAvatar() const { return mIsUIAvatar; } // True if this avatar is a supplemental av used in some UI views (no associated user)
private: //aligned members
LL_ALIGN_16(LLVector4a mImpostorExtents[2]);