From ac2bef24dda949d735167604b5e0edad0e5e4a1d Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Mon, 30 Jan 2023 01:43:53 -0500 Subject: [PATCH] Revert "Eliminate joint dynamic cast" This reverts commit a530c817c7ba475ade7d463a32a64bf3fdf6432a. --- indra/llcharacter/lljoint.h | 6 ------ indra/newview/llviewerjoint.h | 3 --- indra/newview/llviewerjointattachment.h | 5 +---- indra/newview/llviewerjointmesh.h | 2 -- indra/newview/llvoavatar.cpp | 6 +++--- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index f0fb5826a59..1f19cec64a8 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -41,9 +41,6 @@ #include "xform.h" #include "llmatrix4a.h" -class LLViewerJoint; -class LLViewerJointAttachment; - const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; // Need to set this to count of animate-able joints, // currently = #bones + #collision_volumes + #attachments + 2, @@ -193,9 +190,6 @@ class LLJoint LLJoint( const std::string &name, LLJoint *parent=NULL ); virtual ~LLJoint(); - virtual LLViewerJointAttachment* asViewerJointAttachment() { return nullptr; } - virtual LLViewerJoint* asViewerJoint() { return nullptr; } - private: void init(); diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h index a74549596f6..b020d46f9a1 100644 --- a/indra/newview/llviewerjoint.h +++ b/indra/newview/llviewerjoint.h @@ -35,7 +35,6 @@ class LLFace; class LLViewerJointMesh; -class LLViewerJoint; //----------------------------------------------------------------------------- // class LLViewerJoint @@ -51,8 +50,6 @@ class LLViewerJoint : LLViewerJoint(const std::string &name, LLJoint *parent = NULL); virtual ~LLViewerJoint(); - LLViewerJoint* asViewerJoint() override { return static_cast<LLViewerJoint*>(this); } - // Render character hierarchy. // Traverses the entire joint hierarchy, setting up // transforms and calling the drawShape(). diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index 2e84b0f6abc..c20ba9c3931 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -36,22 +36,19 @@ class LLDrawable; class LLViewerObject; -class LLViewerJointAttachment; extern const F32 MAX_ATTACHMENT_DIST; //----------------------------------------------------------------------------- // class LLViewerJointAttachment //----------------------------------------------------------------------------- -class LLViewerJointAttachment final : +class LLViewerJointAttachment : public LLViewerJoint { public: LLViewerJointAttachment(); virtual ~LLViewerJointAttachment(); - LLViewerJointAttachment* asViewerJointAttachment() final { return static_cast<LLViewerJointAttachment*>(this); } - //virtual U32 render( F32 pixelArea ); // Returns triangle count // Returns true if this object is transparent. diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index 45ca5e84f05..05ca4204c48 100644 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -50,8 +50,6 @@ class LLViewerJointMesh final : public LLAvatarJointMesh, public LLViewerJoint // Destructor virtual ~LLViewerJointMesh(); - LLViewerJoint* asViewerJoint() override { return static_cast<LLViewerJoint*>(this); } - // Render time method to upload batches of joint matrices void uploadJointMatrices(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9eae0ffd823..c9cd39d690f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1520,7 +1520,7 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) if (joint && rig_info && rig_info->isRiggedTo()) { - LLViewerJointAttachment *as_joint_attach = joint->asViewerJointAttachment(); + LLViewerJointAttachment *as_joint_attach = dynamic_cast<LLViewerJointAttachment*>(joint); if (as_joint_attach && as_joint_attach->getIsHUDAttachment()) { // Ignore bounding box of HUD joints @@ -7419,7 +7419,7 @@ BOOL LLVOAvatar::updateJointLODs() } // now select meshes to render based on adjusted pixel area - LLViewerJoint* root = mRoot && mRoot->asViewerJoint() ? mRoot->asViewerJoint() : nullptr; + LLViewerJoint* root = dynamic_cast<LLViewerJoint*>(mRoot); BOOL res = FALSE; if (root) { @@ -7519,7 +7519,7 @@ void LLVOAvatar::dirtyMesh(S32 priority) //----------------------------------------------------------------------------- LLViewerJoint* LLVOAvatar::getViewerJoint(S32 idx) { - return (mMeshLOD[idx] && mMeshLOD[idx]->asViewerJoint()) ? mMeshLOD[idx]->asViewerJoint() : nullptr; + return dynamic_cast<LLViewerJoint*>(mMeshLOD[idx]); } //----------------------------------------------------------------------------- -- GitLab