summaryrefslogtreecommitdiff
path: root/indra/llcharacter/llbvhloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcharacter/llbvhloader.cpp')
-rwxr-xr-x[-rw-r--r--]indra/llcharacter/llbvhloader.cpp57
1 files changed, 29 insertions, 28 deletions
diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp
index 532a2c1b0d..0d558aeaa2 100644..100755
--- a/indra/llcharacter/llbvhloader.cpp
+++ b/indra/llcharacter/llbvhloader.cpp
@@ -42,10 +42,10 @@ using namespace std;
#define INCHES_TO_METERS 0.02540005f
-const F32 POSITION_KEYFRAME_THRESHOLD = 0.03f;
+const F32 POSITION_KEYFRAME_THRESHOLD_SQUARED = 0.03f * 0.03f;
const F32 ROTATION_KEYFRAME_THRESHOLD = 0.01f;
-const F32 POSITION_MOTION_THRESHOLD = 0.001f;
+const F32 POSITION_MOTION_THRESHOLD_SQUARED = 0.001f * 0.001f;
const F32 ROTATION_MOTION_THRESHOLD = 0.001f;
char gInFile[1024]; /* Flawfinder: ignore */
@@ -130,14 +130,14 @@ LLQuaternion::Order bvhStringToOrder( char *str )
if (mStatus == LLBVHLoader::ST_NO_XLT_FILE)
{
- llwarns << "NOTE: No translation table found." << llendl;
+ LL_WARNS() << "NOTE: No translation table found." << LL_ENDL;
return;
}
else
{
if (mStatus != LLBVHLoader::ST_OK)
{
- llwarns << "ERROR: [line: " << getLineNumber() << "] " << mStatus << llendl;
+ LL_WARNS() << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL;
return;
}
}
@@ -147,7 +147,7 @@ LLQuaternion::Order bvhStringToOrder( char *str )
mStatus = loadBVHFile(buffer, error_text, error_line);
if (mStatus != LLBVHLoader::ST_OK)
{
- llwarns << "ERROR: [line: " << getLineNumber() << "] " << mStatus << llendl;
+ LL_WARNS() << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL;
return;
}
@@ -163,10 +163,10 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error
errorLine = 0;
mStatus = loadTranslationTable("anim.ini");
loadStatus = mStatus;
- llinfos<<"Load Status 00 : "<< loadStatus << llendl;
+ LL_INFOS()<<"Load Status 00 : "<< loadStatus << LL_ENDL;
if (mStatus == E_ST_NO_XLT_FILE)
{
- //llwarns << "NOTE: No translation table found." << llendl;
+ //LL_WARNS() << "NOTE: No translation table found." << LL_ENDL;
loadStatus = mStatus;
return;
}
@@ -174,7 +174,7 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error
{
if (mStatus != E_ST_OK)
{
- //llwarns << "ERROR: [line: " << getLineNumber() << "] " << mStatus << llendl;
+ //LL_WARNS() << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL;
errorLine = getLineNumber();
loadStatus = mStatus;
return;
@@ -187,7 +187,7 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error
if (mStatus != E_ST_OK)
{
- //llwarns << "ERROR: [line: " << getLineNumber() << "] " << mStatus << llendl;
+ //LL_WARNS() << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL;
loadStatus = mStatus;
errorLine = getLineNumber();
return;
@@ -203,6 +203,7 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error
LLBVHLoader::~LLBVHLoader()
{
std::for_each(mJoints.begin(),mJoints.end(),DeletePointer());
+ mJoints.clear();
}
//------------------------------------------------------------------------
@@ -225,7 +226,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName)
if (!fp)
return E_ST_NO_XLT_FILE;
- llinfos << "NOTE: Loading translation table: " << fileName << llendl;
+ LL_INFOS() << "NOTE: Loading translation table: " << fileName << LL_ENDL;
//--------------------------------------------------------------------
// register file to be closed on function exit
@@ -289,7 +290,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName)
return E_ST_NO_XLT_EMOTE;
mEmoteName.assign( emote_str );
-// llinfos << "NOTE: Emote: " << mEmoteName.c_str() << llendl;
+// LL_INFOS() << "NOTE: Emote: " << mEmoteName.c_str() << LL_ENDL;
continue;
}
@@ -304,7 +305,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName)
return E_ST_NO_XLT_PRIORITY;
mPriority = priority;
-// llinfos << "NOTE: Priority: " << mPriority << llendl;
+// LL_INFOS() << "NOTE: Priority: " << mPriority << LL_ENDL;
continue;
}
@@ -697,7 +698,7 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 &
if ( !strstr(line.c_str(), "HIERARCHY") )
{
-// llinfos << line << llendl;
+// LL_INFOS() << line << LL_ENDL;
return E_ST_NO_HIER;
}
@@ -1044,7 +1045,7 @@ void LLBVHLoader::applyTranslations()
//----------------------------------------------------------------
if ( trans.mIgnore )
{
- //llinfos << "NOTE: Ignoring " << joint->mName.c_str() << llendl;
+ //LL_INFOS() << "NOTE: Ignoring " << joint->mName.c_str() << LL_ENDL;
joint->mIgnore = TRUE;
continue;
}
@@ -1054,7 +1055,7 @@ void LLBVHLoader::applyTranslations()
//----------------------------------------------------------------
if ( ! trans.mOutName.empty() )
{
- //llinfos << "NOTE: Changing " << joint->mName.c_str() << " to " << trans.mOutName.c_str() << llendl;
+ //LL_INFOS() << "NOTE: Changing " << joint->mName.c_str() << " to " << trans.mOutName.c_str() << LL_ENDL;
joint->mOutName = trans.mOutName;
}
@@ -1071,25 +1072,25 @@ void LLBVHLoader::applyTranslations()
//----------------------------------------------------------------
if ( trans.mRelativePositionKey )
{
-// llinfos << "NOTE: Removing 1st position offset from all keys for " << joint->mOutName.c_str() << llendl;
+// LL_INFOS() << "NOTE: Removing 1st position offset from all keys for " << joint->mOutName.c_str() << LL_ENDL;
joint->mRelativePositionKey = TRUE;
}
if ( trans.mRelativeRotationKey )
{
-// llinfos << "NOTE: Removing 1st rotation from all keys for " << joint->mOutName.c_str() << llendl;
+// LL_INFOS() << "NOTE: Removing 1st rotation from all keys for " << joint->mOutName.c_str() << LL_ENDL;
joint->mRelativeRotationKey = TRUE;
}
if ( trans.mRelativePosition.magVec() > 0.0f )
{
joint->mRelativePosition = trans.mRelativePosition;
-// llinfos << "NOTE: Removing " <<
+// LL_INFOS() << "NOTE: Removing " <<
// joint->mRelativePosition.mV[0] << " " <<
// joint->mRelativePosition.mV[1] << " " <<
// joint->mRelativePosition.mV[2] <<
// " from all position keys in " <<
-// joint->mOutName.c_str() << llendl;
+// joint->mOutName.c_str() << LL_ENDL;
}
//----------------------------------------------------------------
@@ -1103,9 +1104,9 @@ void LLBVHLoader::applyTranslations()
//----------------------------------------------------------------
if ( ! trans.mMergeParentName.empty() )
{
-// llinfos << "NOTE: Merging " << joint->mOutName.c_str() <<
+// LL_INFOS() << "NOTE: Merging " << joint->mOutName.c_str() <<
// " with parent " <<
-// trans.mMergeParentName.c_str() << llendl;
+// trans.mMergeParentName.c_str() << LL_ENDL;
joint->mMergeParentName = trans.mMergeParentName;
}
@@ -1114,8 +1115,8 @@ void LLBVHLoader::applyTranslations()
//----------------------------------------------------------------
if ( ! trans.mMergeChildName.empty() )
{
-// llinfos << "NOTE: Merging " << joint->mName.c_str() <<
-// " with child " << trans.mMergeChildName.c_str() << llendl;
+// LL_INFOS() << "NOTE: Merging " << joint->mName.c_str() <<
+// " with child " << trans.mMergeChildName.c_str() << LL_ENDL;
joint->mMergeChildName = trans.mMergeChildName;
}
@@ -1196,7 +1197,7 @@ void LLBVHLoader::optimize()
if (ki_prev == ki_last_good_pos)
{
joint->mNumPosKeys++;
- if (dist_vec(LLVector3(ki_prev->mPos), first_frame_pos) > POSITION_MOTION_THRESHOLD)
+ if (dist_vec_squared(LLVector3(ki_prev->mPos), first_frame_pos) > POSITION_MOTION_THRESHOLD_SQUARED)
{
pos_changed = TRUE;
}
@@ -1209,12 +1210,12 @@ void LLBVHLoader::optimize()
LLVector3 current_pos(ki->mPos);
LLVector3 interp_pos = lerp(current_pos, last_good_pos, 1.f / (F32)numPosFramesConsidered);
- if (dist_vec(current_pos, first_frame_pos) > POSITION_MOTION_THRESHOLD)
+ if (dist_vec_squared(current_pos, first_frame_pos) > POSITION_MOTION_THRESHOLD_SQUARED)
{
pos_changed = TRUE;
}
- if (dist_vec(interp_pos, test_pos) < POSITION_KEYFRAME_THRESHOLD)
+ if (dist_vec_squared(interp_pos, test_pos) < POSITION_KEYFRAME_THRESHOLD_SQUARED)
{
ki_prev->mIgnorePos = TRUE;
numPosFramesConsidered++;
@@ -1310,7 +1311,7 @@ void LLBVHLoader::optimize()
// don't output joints with no motion
if (!(pos_changed || rot_changed))
{
- //llinfos << "Ignoring joint " << joint->mName << llendl;
+ //LL_INFOS() << "Ignoring joint " << joint->mName << LL_ENDL;
joint->mIgnore = TRUE;
}
}
@@ -1570,7 +1571,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
constraint_it++)
{
U8 byte = constraint_it->mChainLength;
- dp.packU8(byte, "chain_lenght");
+ dp.packU8(byte, "chain_length");
byte = constraint_it->mConstraintType;
dp.packU8(byte, "constraint_type");