diff options
author | prep linden <prep@lindenlab.com> | 2011-03-16 10:15:06 -0400 |
---|---|---|
committer | prep linden <prep@lindenlab.com> | 2011-03-16 10:15:06 -0400 |
commit | 5a940793e19225c065f1e37c1be32edd936a5246 (patch) | |
tree | a0b247190c2e8b667096ec61bb468a627effa090 /indra/newview | |
parent | 16ff50719055aae202011e4b20aeae41d98493fa (diff) |
WIP:Manual pelvis offset
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.h | 2 | ||||
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 3 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 3 |
6 files changed, 21 insertions, 10 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index d4ba039eeb..3a7732c7b3 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -469,7 +469,7 @@ void LLFloaterModelPreview::onPelvisOffsetCommit( LLUICtrl*, void* userdata ) { return; } - + fp->mModelPreview->calcResourceCost(); fp->mModelPreview->refresh(); } @@ -2232,6 +2232,7 @@ LLColor4 LLModelLoader::getDaeColor(daeElement* element) LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL) +, mPelvisZOffset( 0.0f ) { mNeedsUpdate = TRUE; mCameraDistance = 0.f; @@ -2298,13 +2299,14 @@ U32 LLModelPreview::calcResourceCost() U32 num_hulls = 0; F32 debug_scale = mFMP ? mFMP->childGetValue("import_scale").asReal() : 1.f; - + mPelvisZOffset = mFMP ? mFMP->childGetValue("pelvis_offset").asReal() : 32.0f; + F32 streaming_cost = 0.f; F32 physics_cost = 0.f; for (U32 i = 0; i < mUploadData.size(); ++i) { LLModelInstance& instance = mUploadData[i]; - + if (accounted.find(instance.mModel) == accounted.end()) { accounted.insert(instance.mModel); @@ -3746,6 +3748,7 @@ BOOL LLModelPreview::render() { LLModelInstance& instance = *model_iter; LLModel* model = instance.mModel; + model->mPelvisOffset = mPelvisZOffset; if (!model->mSkinWeights.empty()) { has_skin_weights = true; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index aac20244cc..e3b0f7522e 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -359,6 +359,8 @@ public: LLVector3 mModelPivot; bool mHasPivot; + + float mPelvisZOffset; }; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 8e869b2d5b..93e6c3aafc 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1167,7 +1167,7 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat { info.mPelvisOffset = skin["pelvis_offset"].asReal(); } - + llinfos<<"info pelvis offset"<<info.mPelvisOffset<<llendl; mSkinInfoQ.push(info); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a73bac39cf..5f0e4bcded 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -761,6 +761,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mDebugExistenceTimer.reset();
mPelvisOffset = LLVector3(0.0f,0.0f,0.0f);
mLastPelvisToFoot = 0.0f;
+ mPelvisFixup = 0.0f;
}
//------------------------------------------------------------------------
@@ -3332,7 +3333,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) mTimeVisible.reset();
}
-
+
//--------------------------------------------------------------------
// the rest should only be done occasionally for far away avatars
//--------------------------------------------------------------------
@@ -3786,13 +3787,15 @@ void LLVOAvatar::updateHeadOffset() //------------------------------------------------------------------------
// setPelvisOffset
//------------------------------------------------------------------------
-void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount )
+void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount, F32 pelvisFixup )
{
mHasPelvisOffset = hasOffset;
if ( mHasPelvisOffset )
{
+ //Store off last pelvis to foot value
mLastPelvisToFoot = mPelvisToFoot;
- mPelvisOffset = offsetAmount;
+ mPelvisOffset = offsetAmount;
+ mPelvisFixup = pelvisFixup;
}
}
//------------------------------------------------------------------------
@@ -5882,7 +5885,8 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi // correctly, but putting this check in here to be safe.
if (attachmentID & ATTACHMENT_ADD)
{
- llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl; attachmentID &= ~ATTACHMENT_ADD;
+ llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl;
+ attachmentID &= ~ATTACHMENT_ADD;
}
LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 1152475383..7209b9f1e5 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -292,13 +292,14 @@ protected: public:
void updateHeadOffset();
F32 getPelvisToFoot() const { return mPelvisToFoot; }
- void setPelvisOffset( bool hasOffset, const LLVector3& translation ) ;
+ void setPelvisOffset( bool hasOffset, const LLVector3& translation, F32 offset ) ;
bool hasPelvisOffset( void ) { return mHasPelvisOffset; }
void postPelvisSetRecalc( void );
bool mHasPelvisOffset;
LLVector3 mPelvisOffset;
F32 mLastPelvisToFoot;
+ F32 mPelvisFixup;
LLVector3 mHeadOffset; // current head position
LLViewerJoint mRoot;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 7f373736fa..43d8b9d356 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3941,6 +3941,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if ( bindCnt > 0 )
{
const int jointCnt = pSkinData->mJointNames.size();
+ const int pelvisZOffset = pSkinData->mPelvisOffset;
bool fullRig = (jointCnt>=20) ? true : false;
if ( fullRig )
{
@@ -3961,7 +3962,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) pJoint->storeCurrentXform( jointPos );
if ( !pAvatarVO->hasPelvisOffset() )
{
- pAvatarVO->setPelvisOffset( true, jointPos );
+ pAvatarVO->setPelvisOffset( true, jointPos, pelvisZOffset );
//Trigger to rebuild viewer AV
pelvisGotSet = true;
}
|