summaryrefslogtreecommitdiff
path: root/indra/llappearance
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-06-11 13:38:43 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-06-11 13:38:43 +0200
commitd9789bfaf230e301873bd700f6f360d306dc2486 (patch)
tree4b2dd2680905ca9821e2b11b36aa63dfe7af4f84 /indra/llappearance
parent9f6b8484dfb7dfa981d8a8ac3693d3f68e32bc12 (diff)
parenta73773bc1abdac6bc3beea36fd4ba58eba686e13 (diff)
Merge branch 'main' of https://github.com/secondlife/viewer into DRTVWR-600-maint-A
# Conflicts: # indra/llappearance/llavatarappearance.h # indra/llimage/llimage.cpp # indra/llmath/llvolume.cpp # indra/llmath/llvolume.h # indra/llprimitive/llgltfmaterial.h # indra/llrender/llrendertarget.cpp # indra/llrender/llshadermgr.cpp # indra/newview/lldynamictexture.cpp # indra/newview/llenvironment.cpp # indra/newview/llfetchedgltfmaterial.cpp # indra/newview/llfloaterimagepreview.cpp # indra/newview/llfloaterimagepreview.h # indra/newview/llfloaterregioninfo.cpp # indra/newview/llfloaterregioninfo.h # indra/newview/llmaniprotate.cpp # indra/newview/llmaniptranslate.cpp # indra/newview/llpanelvolume.cpp # indra/newview/llselectmgr.cpp # indra/newview/llselectmgr.h # indra/newview/llsurface.cpp # indra/newview/llsurface.h # indra/newview/llsurfacepatch.cpp # indra/newview/lltexturectrl.cpp # indra/newview/lltexturectrl.h # indra/newview/lltinygltfhelper.cpp # indra/newview/llviewertexture.cpp # indra/newview/llviewerwindow.cpp # indra/newview/llviewerwindow.h # indra/newview/llvlcomposition.cpp # indra/newview/llvlcomposition.h # indra/newview/llvocache.cpp # indra/newview/llvovolume.cpp # indra/newview/pipeline.cpp
Diffstat (limited to 'indra/llappearance')
-rw-r--r--indra/llappearance/llavatarappearance.cpp87
-rw-r--r--indra/llappearance/llavatarappearance.h2
2 files changed, 56 insertions, 33 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index de18fce0f8..47b08e0db3 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -482,45 +482,70 @@ void LLAvatarAppearance::computeBodySize()
mCurrBodySizeState["mAnkleLeft scale"] = mAnkleLeftp->getScale();
mCurrBodySizeState["mFootLeft pos"] = mFootLeftp->getPosition();
- F32 old_height = mBodySize.mV[VZ];
+ LLVector3 pelvis_scale = mPelvisp->getScale();
+
+ // some of the joints have not been cached
+ LLVector3 skull = mSkullp->getPosition();
+ //LLVector3 skull_scale = mSkullp->getScale();
+
+ LLVector3 neck = mNeckp->getPosition();
+ LLVector3 neck_scale = mNeckp->getScale();
+
+ LLVector3 chest = mChestp->getPosition();
+ LLVector3 chest_scale = mChestp->getScale();
+
+ // the rest of the joints have been cached
+ LLVector3 head = mHeadp->getPosition();
+ LLVector3 head_scale = mHeadp->getScale();
+
+ LLVector3 torso = mTorsop->getPosition();
+ LLVector3 torso_scale = mTorsop->getScale();
+
+ LLVector3 hip = mHipLeftp->getPosition();
+ LLVector3 hip_scale = mHipLeftp->getScale();
+
+ LLVector3 knee = mKneeLeftp->getPosition();
+ LLVector3 knee_scale = mKneeLeftp->getScale();
+
+ LLVector3 ankle = mAnkleLeftp->getPosition();
+ LLVector3 ankle_scale = mAnkleLeftp->getScale();
+
+ LLVector3 foot = mFootLeftp->getPosition();
+
F32 old_offset = mAvatarOffset.mV[VZ];
- // TODO: Measure the real depth and width
- mPelvisToFoot = computePelvisToFoot();
- F32 new_height = computeBodyHeight();
- mBodySize.set(DEFAULT_AGENT_DEPTH, DEFAULT_AGENT_WIDTH, new_height);
- F32 new_offset = getVisualParamWeight(AVATAR_HOVER);
- mAvatarOffset.set(0, 0, new_offset);
+ mAvatarOffset.mV[VZ] = getVisualParamWeight(AVATAR_HOVER);
+
+ mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] -
+ knee.mV[VZ] * hip_scale.mV[VZ] -
+ ankle.mV[VZ] * knee_scale.mV[VZ] -
+ foot.mV[VZ] * ankle_scale.mV[VZ];
- if (mBodySize.mV[VZ] != old_height || new_offset != old_offset)
+ LLVector3 new_body_size;
+ new_body_size.mV[VZ] = mPelvisToFoot +
+ // the sqrt(2) correction below is an approximate
+ // correction to get to the top of the head
+ F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) +
+ head.mV[VZ] * neck_scale.mV[VZ] +
+ neck.mV[VZ] * chest_scale.mV[VZ] +
+ chest.mV[VZ] * torso_scale.mV[VZ] +
+ torso.mV[VZ] * pelvis_scale.mV[VZ];
+
+ // TODO -- measure the real depth and width
+ new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH;
+ new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH;
+
+ mAvatarOffset.mV[VX] = 0.0f;
+ mAvatarOffset.mV[VY] = 0.0f;
+
+ if (new_body_size != mBodySize || old_offset != mAvatarOffset.mV[VZ])
{
+ mBodySize = new_body_size;
+
compareJointStateMaps(mLastBodySizeState, mCurrBodySizeState);
}
}
-F32 LLAvatarAppearance::computeBodyHeight()
-{
- F32 result = mPelvisToFoot +
- // all these relative positions usually are positive
- mPelvisp->getScale().mV[VZ] * mTorsop->getPosition().mV[VZ] +
- mTorsop->getScale().mV[VZ] * mChestp->getPosition().mV[VZ] +
- mChestp->getScale().mV[VZ] * mNeckp->getPosition().mV[VZ] +
- mNeckp->getScale().mV[VZ] * mHeadp->getPosition().mV[VZ] +
- mHeadp->getScale().mV[VZ] * mSkullp->getPosition().mV[VZ] * 2;
- return result;
-}
-
-F32 LLAvatarAppearance::computePelvisToFoot()
-{
- F32 result =
- // all these relative positions usually are negative
- mPelvisp->getScale().mV[VZ] * mHipLeftp->getPosition().mV[VZ] +
- mHipLeftp->getScale().mV[VZ] * mKneeLeftp->getPosition().mV[VZ] +
- mKneeLeftp->getScale().mV[VZ] * mAnkleLeftp->getPosition().mV[VZ] +
- mAnkleLeftp->getScale().mV[VZ] * mFootLeftp->getPosition().mV[VZ] / 2;
- return -result;
-}
-
//-----------------------------------------------------------------------------
// parseSkeletonFile()
//-----------------------------------------------------------------------------
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index 1f33ae290e..13e504e639 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -147,8 +147,6 @@ public:
void compareJointStateMaps(joint_state_map_t& last_state,
joint_state_map_t& curr_state);
void computeBodySize();
- F32 computeBodyHeight();
- F32 computePelvisToFoot();
public:
typedef std::vector<LLAvatarJoint*> avatar_joint_list_t;