aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorArmin Weatherwax2010-03-04 22:26:26 +0100
committerArmin Weatherwax2010-03-04 22:44:09 +0100
commit05a2f6f0f5ce6f762feea4cd50e4fd543ba7a0db (patch)
tree74cd32571968d72c8353224326dac9a886afbc7b
parentLinux: de-obfuscate dbus handling; better handle_secondlifeprotocol.sh. (diff)
downloadmeta-impy-05a2f6f0f5ce6f762feea4cd50e4fd543ba7a0db.zip
meta-impy-05a2f6f0f5ce6f762feea4cd50e4fd543ba7a0db.tar.gz
meta-impy-05a2f6f0f5ce6f762feea4cd50e4fd543ba7a0db.tar.bz2
meta-impy-05a2f6f0f5ce6f762feea4cd50e4fd543ba7a0db.tar.xz
Updating some clothing layer related changes to latest version of emerald.
-rw-r--r--linden/indra/newview/llvoavatar.cpp559
1 files changed, 285 insertions, 274 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index 66fd9f2..3692b1b 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -229,7 +229,7 @@ public:
229 std::for_each(mChildList.begin(), mChildList.end(), DeletePointer()); 229 std::for_each(mChildList.begin(), mChildList.end(), DeletePointer());
230 } 230 }
231 BOOL parseXml(LLXmlTreeNode* node); 231 BOOL parseXml(LLXmlTreeNode* node);
232 232
233private: 233private:
234 std::string mName; 234 std::string mName;
235 BOOL mIsJoint; 235 BOOL mIsJoint;
@@ -258,7 +258,7 @@ public:
258 BOOL parseXml(LLXmlTreeNode* node); 258 BOOL parseXml(LLXmlTreeNode* node);
259 S32 getNumBones() const { return mNumBones; } 259 S32 getNumBones() const { return mNumBones; }
260 S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; } 260 S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; }
261 261
262private: 262private:
263 S32 mNumBones; 263 S32 mNumBones;
264 S32 mNumCollisionVolumes; 264 S32 mNumCollisionVolumes;
@@ -277,14 +277,14 @@ class LLVOAvatarXmlInfo
277public: 277public:
278 LLVOAvatarXmlInfo(); 278 LLVOAvatarXmlInfo();
279 ~LLVOAvatarXmlInfo(); 279 ~LLVOAvatarXmlInfo();
280 280
281private: 281private:
282 BOOL parseXmlSkeletonNode(LLXmlTreeNode* root); 282 BOOL parseXmlSkeletonNode(LLXmlTreeNode* root);
283 BOOL parseXmlMeshNodes(LLXmlTreeNode* root); 283 BOOL parseXmlMeshNodes(LLXmlTreeNode* root);
284 BOOL parseXmlColorNodes(LLXmlTreeNode* root); 284 BOOL parseXmlColorNodes(LLXmlTreeNode* root);
285 BOOL parseXmlLayerNodes(LLXmlTreeNode* root); 285 BOOL parseXmlLayerNodes(LLXmlTreeNode* root);
286 BOOL parseXmlDriverNodes(LLXmlTreeNode* root); 286 BOOL parseXmlDriverNodes(LLXmlTreeNode* root);
287 287
288 struct LLVOAvatarMeshInfo 288 struct LLVOAvatarMeshInfo
289 { 289 {
290 typedef std::pair<LLPolyMorphTargetInfo*,BOOL> morph_info_pair_t; 290 typedef std::pair<LLPolyMorphTargetInfo*,BOOL> morph_info_pair_t;
@@ -313,7 +313,7 @@ private:
313 313
314 typedef std::vector<LLPolySkeletalDistortionInfo*> skeletal_distortion_info_list_t; 314 typedef std::vector<LLPolySkeletalDistortionInfo*> skeletal_distortion_info_list_t;
315 skeletal_distortion_info_list_t mSkeletalDistortionInfoList; 315 skeletal_distortion_info_list_t mSkeletalDistortionInfoList;
316 316
317 struct LLVOAvatarAttachmentInfo 317 struct LLVOAvatarAttachmentInfo
318 { 318 {
319 LLVOAvatarAttachmentInfo() 319 LLVOAvatarAttachmentInfo()
@@ -333,7 +333,7 @@ private:
333 }; 333 };
334 typedef std::vector<LLVOAvatarAttachmentInfo*> attachment_info_list_t; 334 typedef std::vector<LLVOAvatarAttachmentInfo*> attachment_info_list_t;
335 attachment_info_list_t mAttachmentInfoList; 335 attachment_info_list_t mAttachmentInfoList;
336 336
337 LLTexGlobalColorInfo *mTexSkinColorInfo; 337 LLTexGlobalColorInfo *mTexSkinColorInfo;
338 LLTexGlobalColorInfo *mTexHairColorInfo; 338 LLTexGlobalColorInfo *mTexHairColorInfo;
339 LLTexGlobalColorInfo *mTexEyeColorInfo; 339 LLTexGlobalColorInfo *mTexEyeColorInfo;
@@ -507,7 +507,7 @@ public:
507 // called after parameters have been set 507 // called after parameters have been set
508 // must return true to indicate success and be available for activation 508 // must return true to indicate success and be available for activation
509 virtual LLMotionInitStatus onInitialize(LLCharacter *character) 509 virtual LLMotionInitStatus onInitialize(LLCharacter *character)
510 { 510 {
511 mCharacter = character; 511 mCharacter = character;
512 bool success = true; 512 bool success = true;
513 513
@@ -849,7 +849,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
849 mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); 849 mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c");
850 gGL.getTexUnit(0)->bind(mShadowImagep.get()); 850 gGL.getTexUnit(0)->bind(mShadowImagep.get());
851 mShadowImagep->setAddressMode(LLTexUnit::TAM_CLAMP); 851 mShadowImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
852 852
853 mInAir = FALSE; 853 mInAir = FALSE;
854 854
855 mStepOnLand = TRUE; 855 mStepOnLand = TRUE;
@@ -875,7 +875,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
875 joint->setName(mesh_dict->mName); 875 joint->setName(mesh_dict->mName);
876 joint->setMeshID(mesh_index); 876 joint->setMeshID(mesh_index);
877 mMeshLOD.push_back(joint); 877 mMeshLOD.push_back(joint);
878 878
879 /* mHairLOD.setName("mHairLOD"); 879 /* mHairLOD.setName("mHairLOD");
880 mHairMesh0.setName("mHairMesh0"); 880 mHairMesh0.setName("mHairMesh0");
881 mHairMesh0.setMeshID(MESH_ID_HAIR); 881 mHairMesh0.setMeshID(MESH_ID_HAIR);
@@ -968,7 +968,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
968 registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create ); 968 registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create );
969 registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create ); 969 registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create );
970 registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create ); 970 registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create );
971 971
972 // motions without a start/stop bit 972 // motions without a start/stop bit
973 registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create ); 973 registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create );
974 registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create ); 974 registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create );
@@ -996,9 +996,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
996 createMotion( ANIM_AGENT_CUSTOMIZE_DONE); 996 createMotion( ANIM_AGENT_CUSTOMIZE_DONE);
997 997
998 //VTPause(); // VTune 998 //VTPause(); // VTune
999 999
1000 mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) ); 1000 mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) );
1001 mCurrentGesticulationLevel = 0; 1001 mCurrentGesticulationLevel = 0;
1002} 1002}
1003 1003
1004//------------------------------------------------------------------------ 1004//------------------------------------------------------------------------
@@ -1020,7 +1020,7 @@ LLVOAvatar::~LLVOAvatar()
1020 1020
1021 delete mScreenp; 1021 delete mScreenp;
1022 mScreenp = NULL; 1022 mScreenp = NULL;
1023 1023
1024 delete [] mCollisionVolumes; 1024 delete [] mCollisionVolumes;
1025 mCollisionVolumes = NULL; 1025 mCollisionVolumes = NULL;
1026 1026
@@ -1055,9 +1055,9 @@ LLVOAvatar::~LLVOAvatar()
1055 } 1055 }
1056 std::for_each(mMeshLOD.begin(), mMeshLOD.end(), DeletePointer()); 1056 std::for_each(mMeshLOD.begin(), mMeshLOD.end(), DeletePointer());
1057 mMeshLOD.clear(); 1057 mMeshLOD.clear();
1058 1058
1059 mDead = TRUE; 1059 mDead = TRUE;
1060 1060
1061 // Clean up class data 1061 // Clean up class data
1062 LLVOAvatar::cullAvatarsByPixelArea(); 1062 LLVOAvatar::cullAvatarsByPixelArea();
1063 1063
@@ -1117,7 +1117,7 @@ void LLVOAvatar::deleteLayerSetCaches(bool clearAll)
1117 } 1117 }
1118} 1118}
1119 1119
1120// static 1120// static
1121BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) 1121BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars)
1122{ 1122{
1123 BOOL res = TRUE; 1123 BOOL res = TRUE;
@@ -1148,7 +1148,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars)
1148 return res; 1148 return res;
1149} 1149}
1150 1150
1151// static 1151// static
1152void LLVOAvatar::dumpScratchTextureByteCount() 1152void LLVOAvatar::dumpScratchTextureByteCount()
1153{ 1153{
1154 llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl; 1154 llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl;
@@ -1211,7 +1211,7 @@ void LLVOAvatar::dumpBakedStatus()
1211 else 1211 else
1212 { 1212 {
1213 llcont << " Unbaked ("; 1213 llcont << " Unbaked (";
1214 1214
1215 for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); 1215 for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
1216 iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); 1216 iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
1217 iter++) 1217 iter++)
@@ -1326,9 +1326,9 @@ if(gAuditTexture)
1326 } 1326 }
1327 LLTexLayerSet::sHasCaches = FALSE; 1327 LLTexLayerSet::sHasCaches = FALSE;
1328 } 1328 }
1329 1329
1330 for( LLGLuint* namep = sScratchTexNames.getFirstData(); 1330 for( LLGLuint* namep = sScratchTexNames.getFirstData();
1331 namep; 1331 namep;
1332 namep = sScratchTexNames.getNextData() ) 1332 namep = sScratchTexNames.getNextData() )
1333 { 1333 {
1334 LLImageGL::deleteTextures(1, (U32 *)namep ); 1334 LLImageGL::deleteTextures(1, (U32 *)namep );
@@ -1354,7 +1354,7 @@ if(gAuditTexture)
1354// LLVOAvatar::initClass() 1354// LLVOAvatar::initClass()
1355//------------------------------------------------------------------------ 1355//------------------------------------------------------------------------
1356void LLVOAvatar::initClass() 1356void LLVOAvatar::initClass()
1357{ 1357{
1358 std::string xmlFile; 1358 std::string xmlFile;
1359 1359
1360 xmlFile = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR) + "_lad.xml"; 1360 xmlFile = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR) + "_lad.xml";
@@ -1366,7 +1366,7 @@ void LLVOAvatar::initClass()
1366 1366
1367 // now sanity check xml file 1367 // now sanity check xml file
1368 LLXmlTreeNode* root = sXMLTree.getRoot(); 1368 LLXmlTreeNode* root = sXMLTree.getRoot();
1369 if (!root) 1369 if (!root)
1370 { 1370 {
1371 llerrs << "No root node found in avatar configuration file: " << xmlFile << llendl; 1371 llerrs << "No root node found in avatar configuration file: " << xmlFile << llendl;
1372 return; 1372 return;
@@ -1379,7 +1379,7 @@ void LLVOAvatar::initClass()
1379 { 1379 {
1380 llerrs << "Invalid avatar file header: " << xmlFile << llendl; 1380 llerrs << "Invalid avatar file header: " << xmlFile << llendl;
1381 } 1381 }
1382 1382
1383 std::string version; 1383 std::string version;
1384 static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); 1384 static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
1385 if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) 1385 if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") )
@@ -1400,14 +1400,14 @@ void LLVOAvatar::initClass()
1400 llerrs << "No skeleton in avatar configuration file: " << xmlFile << llendl; 1400 llerrs << "No skeleton in avatar configuration file: " << xmlFile << llendl;
1401 return; 1401 return;
1402 } 1402 }
1403 1403
1404 std::string skeleton_file_name; 1404 std::string skeleton_file_name;
1405 static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); 1405 static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name");
1406 if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name)) 1406 if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name))
1407 { 1407 {
1408 llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << llendl; 1408 llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << llendl;
1409 } 1409 }
1410 1410
1411 std::string skeleton_path; 1411 std::string skeleton_path;
1412 skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name); 1412 skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name);
1413 if (!parseSkeletonFile(skeleton_path)) 1413 if (!parseSkeletonFile(skeleton_path))
@@ -1499,7 +1499,7 @@ void LLVOAvatar::updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax)
1499 { 1499 {
1500 LLVector3 delta = getRenderPosition() - 1500 LLVector3 delta = getRenderPosition() -
1501 ((LLVector3(mDrawable->getPositionGroup())-mImpostorOffset)); 1501 ((LLVector3(mDrawable->getPositionGroup())-mImpostorOffset));
1502 1502
1503 newMin = mLastAnimExtents[0] + delta; 1503 newMin = mLastAnimExtents[0] + delta;
1504 newMax = mLastAnimExtents[1] + delta; 1504 newMax = mLastAnimExtents[1] + delta;
1505 } 1505 }
@@ -1536,7 +1536,7 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax)
1536 mPixelArea = LLPipeline::calcPixelArea((newMin+newMax)*0.5f, (newMax-newMin)*0.5f, *LLViewerCamera::getInstance()); 1536 mPixelArea = LLPipeline::calcPixelArea((newMin+newMax)*0.5f, (newMax-newMin)*0.5f, *LLViewerCamera::getInstance());
1537 1537
1538 //stretch bounding box by attachments 1538 //stretch bounding box by attachments
1539 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 1539 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
1540 iter != mAttachmentPoints.end(); 1540 iter != mAttachmentPoints.end();
1541 ++iter) 1541 ++iter)
1542 { 1542 {
@@ -1558,11 +1558,11 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax)
1558 { 1558 {
1559 const LLVector3* ext = bridge->getSpatialExtents(); 1559 const LLVector3* ext = bridge->getSpatialExtents();
1560 LLVector3 distance = (ext[1] - ext[0]); 1560 LLVector3 distance = (ext[1] - ext[0]);
1561 1561
1562 // Only add the prim to spatial extents calculations if it isn't a megaprim. 1562 // Only add the prim to spatial extents calculations if it isn't a megaprim.
1563 // max_attachment_span calculated at the start of the function 1563 // max_attachment_span calculated at the start of the function
1564 // (currently 5 times our max prim size) 1564 // (currently 5 times our max prim size)
1565 if (distance.mV[0] < max_attachment_span 1565 if (distance.mV[0] < max_attachment_span
1566 && distance.mV[1] < max_attachment_span 1566 && distance.mV[1] < max_attachment_span
1567 && distance.mV[2] < max_attachment_span) 1567 && distance.mV[2] < max_attachment_span)
1568 { 1568 {
@@ -1574,7 +1574,7 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax)
1574 } 1574 }
1575 } 1575 }
1576 1576
1577 //pad bounding box 1577 //pad bounding box
1578 newMin -= buffer; 1578 newMin -= buffer;
1579 newMax += buffer; 1579 newMax += buffer;
1580} 1580}
@@ -1607,7 +1607,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
1607 ) 1607 )
1608{ 1608{
1609 1609
1610 if (mIsSelf && !gAgent.needsRenderAvatar() || !LLPipeline::sPickAvatar) 1610 if ((mIsSelf && !gAgent.needsRenderAvatar()) || !LLPipeline::sPickAvatar)
1611 { 1611 {
1612 return FALSE; 1612 return FALSE;
1613 } 1613 }
@@ -1635,7 +1635,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
1635 { 1635 {
1636 glh::vec3f res_pos(position.mV); 1636 glh::vec3f res_pos(position.mV);
1637 mat.mult_matrix_vec(res_pos); 1637 mat.mult_matrix_vec(res_pos);
1638 1638
1639 norm.normalize(); 1639 norm.normalize();
1640 glh::vec3f res_norm(norm.mV); 1640 glh::vec3f res_norm(norm.mV);
1641 norm_mat.mult_matrix_dir(res_norm); 1641 norm_mat.mult_matrix_dir(res_norm);
@@ -1654,7 +1654,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
1654 } 1654 }
1655 } 1655 }
1656 } 1656 }
1657 1657
1658 LLVector3 position; 1658 LLVector3 position;
1659 if (mNameText.notNull() && mNameText->lineSegmentIntersect(start, end, position)) 1659 if (mNameText.notNull() && mNameText->lineSegmentIntersect(start, end, position))
1660 { 1660 {
@@ -1675,7 +1675,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
1675BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) 1675BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename)
1676{ 1676{
1677 LLMemType mt(LLMemType::MTYPE_AVATAR); 1677 LLMemType mt(LLMemType::MTYPE_AVATAR);
1678 1678
1679 //------------------------------------------------------------------------- 1679 //-------------------------------------------------------------------------
1680 // parse the file 1680 // parse the file
1681 //------------------------------------------------------------------------- 1681 //-------------------------------------------------------------------------
@@ -1689,7 +1689,7 @@ BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename)
1689 1689
1690 // now sanity check xml file 1690 // now sanity check xml file
1691 LLXmlTreeNode* root = sSkeletonXMLTree.getRoot(); 1691 LLXmlTreeNode* root = sSkeletonXMLTree.getRoot();
1692 if (!root) 1692 if (!root)
1693 { 1693 {
1694 llerrs << "No root node found in avatar skeleton file: " << filename << llendl; 1694 llerrs << "No root node found in avatar skeleton file: " << filename << llendl;
1695 } 1695 }
@@ -1715,7 +1715,7 @@ BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename)
1715BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 &volume_num, S32 &joint_num) 1715BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 &volume_num, S32 &joint_num)
1716{ 1716{
1717 LLMemType mt(LLMemType::MTYPE_AVATAR); 1717 LLMemType mt(LLMemType::MTYPE_AVATAR);
1718 1718
1719 LLViewerJoint* joint = NULL; 1719 LLViewerJoint* joint = NULL;
1720 1720
1721 if (info->mIsJoint) 1721 if (info->mIsJoint)
@@ -1784,11 +1784,10 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent
1784BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) 1784BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info)
1785{ 1785{
1786 LLMemType mt(LLMemType::MTYPE_AVATAR); 1786 LLMemType mt(LLMemType::MTYPE_AVATAR);
1787 1787
1788 //this can get called with null info on startup sometimes 1788 //this can get called with null info on startup sometimes
1789 if (!info) 1789 if (!info)
1790 return FALSE; 1790 return FALSE;
1791
1792 //------------------------------------------------------------------------- 1791 //-------------------------------------------------------------------------
1793 // allocate joints 1792 // allocate joints
1794 //------------------------------------------------------------------------- 1793 //-------------------------------------------------------------------------
@@ -1797,7 +1796,7 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info)
1797 llerrs << "Can't allocate " << info->mNumBones << " joints" << llendl; 1796 llerrs << "Can't allocate " << info->mNumBones << " joints" << llendl;
1798 return FALSE; 1797 return FALSE;
1799 } 1798 }
1800 1799
1801 //------------------------------------------------------------------------- 1800 //-------------------------------------------------------------------------
1802 // allocate volumes 1801 // allocate volumes
1803 //------------------------------------------------------------------------- 1802 //-------------------------------------------------------------------------
@@ -1866,7 +1865,7 @@ void LLVOAvatar::startDefaultMotions()
1866void LLVOAvatar::buildCharacter() 1865void LLVOAvatar::buildCharacter()
1867{ 1866{
1868 LLMemType mt(LLMemType::MTYPE_AVATAR); 1867 LLMemType mt(LLMemType::MTYPE_AVATAR);
1869 1868
1870 //------------------------------------------------------------------------- 1869 //-------------------------------------------------------------------------
1871 // remove all references to our existing skeleton 1870 // remove all references to our existing skeleton
1872 // so we can rebuild it 1871 // so we can rebuild it
@@ -1949,7 +1948,7 @@ void LLVOAvatar::buildCharacter()
1949 //------------------------------------------------------------------------- 1948 //-------------------------------------------------------------------------
1950 // Make sure "well known" pointers exist 1949 // Make sure "well known" pointers exist
1951 //------------------------------------------------------------------------- 1950 //-------------------------------------------------------------------------
1952 if (!(mPelvisp && 1951 if (!(mPelvisp &&
1953 mTorsop && 1952 mTorsop &&
1954 mChestp && 1953 mChestp &&
1955 mNeckp && 1954 mNeckp &&
@@ -1976,7 +1975,7 @@ void LLVOAvatar::buildCharacter()
1976 // initialize the pelvis 1975 // initialize the pelvis
1977 //------------------------------------------------------------------------- 1976 //-------------------------------------------------------------------------
1978 mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) ); 1977 mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) );
1979 1978
1980 //------------------------------------------------------------------------- 1979 //-------------------------------------------------------------------------
1981 // set head offset from pelvis 1980 // set head offset from pelvis
1982 //------------------------------------------------------------------------- 1981 //-------------------------------------------------------------------------
@@ -2045,7 +2044,7 @@ void LLVOAvatar::buildCharacter()
2045 else 2044 else
2046 { 2045 {
2047 BOOL attachment_found = FALSE; 2046 BOOL attachment_found = FALSE;
2048 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 2047 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
2049 iter != mAttachmentPoints.end(); ) 2048 iter != mAttachmentPoints.end(); )
2050 { 2049 {
2051 attachment_map_t::iterator curiter = iter++; 2050 attachment_map_t::iterator curiter = iter++;
@@ -2055,15 +2054,15 @@ void LLVOAvatar::buildCharacter()
2055 LLMenuItemCallGL* item; 2054 LLMenuItemCallGL* item;
2056// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) 2055// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c)
2057 // We need the userdata param to disable options in this pie menu later on (Left Hand / Right Hand option) 2056 // We need the userdata param to disable options in this pie menu later on (Left Hand / Right Hand option)
2058 item = new LLMenuItemCallGL(attachment->getName(), 2057 item = new LLMenuItemCallGL(attachment->getName(),
2059 NULL, 2058 NULL,
2060 object_selected_and_point_valid, attachment); 2059 object_selected_and_point_valid, attachment);
2061// [/RLVa:KB] 2060// [/RLVa:KB]
2062// item = new LLMenuItemCallGL(attachment->getName(), 2061// item = new LLMenuItemCallGL(attachment->getName(),
2063// NULL, 2062// NULL,
2064// object_selected_and_point_valid); 2063// object_selected_and_point_valid);
2065 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); 2064 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
2066 2065
2067 gAttachPieMenu->append(item); 2066 gAttachPieMenu->append(item);
2068 2067
2069 attachment_found = TRUE; 2068 attachment_found = TRUE;
@@ -2085,14 +2084,14 @@ void LLVOAvatar::buildCharacter()
2085 else 2084 else
2086 { 2085 {
2087 BOOL attachment_found = FALSE; 2086 BOOL attachment_found = FALSE;
2088 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 2087 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
2089 iter != mAttachmentPoints.end(); ) 2088 iter != mAttachmentPoints.end(); )
2090 { 2089 {
2091 attachment_map_t::iterator curiter = iter++; 2090 attachment_map_t::iterator curiter = iter++;
2092 LLViewerJointAttachment* attachment = curiter->second; 2091 LLViewerJointAttachment* attachment = curiter->second;
2093 if (attachment->getGroup() == i) 2092 if (attachment->getGroup() == i)
2094 { 2093 {
2095 gDetachPieMenu->append(new LLMenuItemCallGL(attachment->getName(), 2094 gDetachPieMenu->append(new LLMenuItemCallGL(attachment->getName(),
2096 &handle_detach_from_avatar, object_attached, attachment)); 2095 &handle_detach_from_avatar, object_attached, attachment));
2097 2096
2098 attachment_found = TRUE; 2097 attachment_found = TRUE;
@@ -2108,7 +2107,7 @@ void LLVOAvatar::buildCharacter()
2108 } 2107 }
2109 2108
2110 // add screen attachments 2109 // add screen attachments
2111 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 2110 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
2112 iter != mAttachmentPoints.end(); ) 2111 iter != mAttachmentPoints.end(); )
2113 { 2112 {
2114 attachment_map_t::iterator curiter = iter++; 2113 attachment_map_t::iterator curiter = iter++;
@@ -2118,23 +2117,23 @@ void LLVOAvatar::buildCharacter()
2118 LLMenuItemCallGL* item; 2117 LLMenuItemCallGL* item;
2119// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) 2118// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c)
2120 // We need the userdata param to disable options in this pie menu later on 2119 // We need the userdata param to disable options in this pie menu later on
2121 item = new LLMenuItemCallGL(attachment->getName(), 2120 item = new LLMenuItemCallGL(attachment->getName(),
2122 NULL, 2121 NULL,
2123 object_selected_and_point_valid, attachment); 2122 object_selected_and_point_valid, attachment);
2124// [/RLVa:KB] 2123// [/RLVa:KB]
2125// item = new LLMenuItemCallGL(attachment->getName(), 2124// item = new LLMenuItemCallGL(attachment->getName(),
2126// NULL, 2125// NULL,
2127// object_selected_and_point_valid); 2126// object_selected_and_point_valid);
2128 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); 2127 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
2129 gAttachScreenPieMenu->append(item); 2128 gAttachScreenPieMenu->append(item);
2130 gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(), 2129 gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(),
2131 &handle_detach_from_avatar, object_attached, attachment)); 2130 &handle_detach_from_avatar, object_attached, attachment));
2132 } 2131 }
2133 } 2132 }
2134 2133
2135 for (S32 pass = 0; pass < 2; pass++) 2134 for (S32 pass = 0; pass < 2; pass++)
2136 { 2135 {
2137 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 2136 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
2138 iter != mAttachmentPoints.end(); ) 2137 iter != mAttachmentPoints.end(); )
2139 { 2138 {
2140 attachment_map_t::iterator curiter = iter++; 2139 attachment_map_t::iterator curiter = iter++;
@@ -2144,16 +2143,15 @@ void LLVOAvatar::buildCharacter()
2144 continue; 2143 continue;
2145 } 2144 }
2146 // RELEASE-RLVa: random comment because we want know if LL ever changes this to not include "attachment" as userdata 2145 // RELEASE-RLVa: random comment because we want know if LL ever changes this to not include "attachment" as userdata
2147 LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), 2146 LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(),
2148 NULL, &object_selected_and_point_valid, 2147 NULL, &object_selected_and_point_valid,
2149 &attach_label, attachment); 2148 &attach_label, attachment);
2150if (item){
2151 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); 2149 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
2152 gAttachSubMenu->append(item); 2150 gAttachSubMenu->append(item);
2153} 2151
2154 gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(), 2152 gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(),
2155 &handle_detach_from_avatar, object_attached, &detach_label, attachment)); 2153 &handle_detach_from_avatar, object_attached, &detach_label, attachment));
2156 2154
2157 } 2155 }
2158 if (pass == 0) 2156 if (pass == 0)
2159 { 2157 {
@@ -2174,7 +2172,7 @@ if (item){
2174 std::multimap<S32, S32> attachment_pie_menu_map; 2172 std::multimap<S32, S32> attachment_pie_menu_map;
2175 2173
2176 // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number 2174 // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number
2177 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 2175 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
2178 iter != mAttachmentPoints.end(); ) 2176 iter != mAttachmentPoints.end(); )
2179 { 2177 {
2180 attachment_map_t::iterator curiter = iter++; 2178 attachment_map_t::iterator curiter = iter++;
@@ -2206,14 +2204,14 @@ if (item){
2206 { 2204 {
2207// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) 2205// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c)
2208 // We need the userdata param to disable options in this pie menu later on 2206 // We need the userdata param to disable options in this pie menu later on
2209 LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), 2207 LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(),
2210 NULL, object_selected_and_point_valid, attachment); 2208 NULL, object_selected_and_point_valid, attachment);
2211// [/RLVa:KB] 2209// [/RLVa:KB]
2212// LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), 2210// LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(),
2213// NULL, object_selected_and_point_valid); 2211// NULL, object_selected_and_point_valid);
2214 gAttachBodyPartPieMenus[group]->append(item); 2212 gAttachBodyPartPieMenus[group]->append(item);
2215 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index); 2213 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index);
2216 gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), 2214 gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(),
2217 &handle_detach_from_avatar, 2215 &handle_detach_from_avatar,
2218 object_attached, attachment)); 2216 object_attached, attachment));
2219 cur_pie_slice++; 2217 cur_pie_slice++;
@@ -2232,7 +2230,7 @@ if (item){
2232void LLVOAvatar::releaseMeshData() 2230void LLVOAvatar::releaseMeshData()
2233{ 2231{
2234 LLMemType mt(LLMemType::MTYPE_AVATAR); 2232 LLMemType mt(LLMemType::MTYPE_AVATAR);
2235 2233
2236 if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || mIsDummy) 2234 if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || mIsDummy)
2237 { 2235 {
2238 return; 2236 return;
@@ -2259,8 +2257,8 @@ void LLVOAvatar::releaseMeshData()
2259 facep->setSize(0, 0); 2257 facep->setSize(0, 0);
2260 } 2258 }
2261 } 2259 }
2262 2260
2263 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 2261 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
2264 iter != mAttachmentPoints.end(); ) 2262 iter != mAttachmentPoints.end(); )
2265 { 2263 {
2266 attachment_map_t::iterator curiter = iter++; 2264 attachment_map_t::iterator curiter = iter++;
@@ -2279,7 +2277,7 @@ void LLVOAvatar::releaseMeshData()
2279void LLVOAvatar::restoreMeshData() 2277void LLVOAvatar::restoreMeshData()
2280{ 2278{
2281 LLMemType mt(LLMemType::MTYPE_AVATAR); 2279 LLMemType mt(LLMemType::MTYPE_AVATAR);
2282 2280
2283 //llinfos << "Restoring" << llendl; 2281 //llinfos << "Restoring" << llendl;
2284 mMeshValid = TRUE; 2282 mMeshValid = TRUE;
2285 updateJointLODs(); 2283 updateJointLODs();
@@ -2290,7 +2288,7 @@ void LLVOAvatar::restoreMeshData()
2290 } 2288 }
2291 else 2289 else
2292 { 2290 {
2293 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 2291 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
2294 iter != mAttachmentPoints.end(); ) 2292 iter != mAttachmentPoints.end(); )
2295 { 2293 {
2296 attachment_map_t::iterator curiter = iter++; 2294 attachment_map_t::iterator curiter = iter++;
@@ -2342,12 +2340,12 @@ void LLVOAvatar::updateMeshData()
2342 if(last_v_num > 0)//put the last inserted part into next vertex buffer. 2340 if(last_v_num > 0)//put the last inserted part into next vertex buffer.
2343 { 2341 {
2344 num_vertices = last_v_num ; 2342 num_vertices = last_v_num ;
2345 num_indices = last_i_num ; 2343 num_indices = last_i_num ;
2346 part_index-- ; 2344 part_index-- ;
2347 } 2345 }
2348 2346
2349 LLFace* facep ; 2347 LLFace* facep ;
2350 if(f_num < mDrawable->getNumFaces()) 2348 if(f_num < mDrawable->getNumFaces())
2351 { 2349 {
2352 facep = mDrawable->getFace(f_num); 2350 facep = mDrawable->getFace(f_num);
2353 } 2351 }
@@ -2355,7 +2353,7 @@ void LLVOAvatar::updateMeshData()
2355 { 2353 {
2356 facep = mDrawable->addFace(mDrawable->getFace(0)->getPool(), mDrawable->getFace(0)->getTexture()) ; 2354 facep = mDrawable->addFace(mDrawable->getFace(0)->getPool(), mDrawable->getFace(0)->getTexture()) ;
2357 } 2355 }
2358 2356
2359 // resize immediately 2357 // resize immediately
2360 facep->setSize(num_vertices, num_indices); 2358 facep->setSize(num_vertices, num_indices);
2361 2359
@@ -2368,10 +2366,10 @@ void LLVOAvatar::updateMeshData()
2368 { 2366 {
2369 facep->mVertexBuffer->resizeBuffer(num_vertices, num_indices) ; 2367 facep->mVertexBuffer->resizeBuffer(num_vertices, num_indices) ;
2370 } 2368 }
2371 2369
2372 facep->setGeomIndex(0); 2370 facep->setGeomIndex(0);
2373 facep->setIndicesIndex(0); 2371 facep->setIndicesIndex(0);
2374 2372
2375 // This is a hack! Avatars have their own pool, so we are detecting 2373 // This is a hack! Avatars have their own pool, so we are detecting
2376 // the case of more than one avatar in the pool (thus > 0 instead of >= 0) 2374 // the case of more than one avatar in the pool (thus > 0 instead of >= 0)
2377 if (facep->getGeomIndex() > 0) 2375 if (facep->getGeomIndex() > 0)
@@ -2404,7 +2402,7 @@ void LLVOAvatar::updateMeshData()
2404//------------------------------------------------------------------------ 2402//------------------------------------------------------------------------
2405// The viewer can only suggest a good size for the agent, 2403// The viewer can only suggest a good size for the agent,
2406// the simulator will keep it inside a reasonable range. 2404// the simulator will keep it inside a reasonable range.
2407void LLVOAvatar::computeBodySize() 2405void LLVOAvatar::computeBodySize()
2408{ 2406{
2409 LLVector3 pelvis_scale = mPelvisp->getScale(); 2407 LLVector3 pelvis_scale = mPelvisp->getScale();
2410 2408
@@ -2444,11 +2442,11 @@ void LLVOAvatar::computeBodySize()
2444 mBodySize.mV[VZ] = mPelvisToFoot + 2442 mBodySize.mV[VZ] = mPelvisToFoot +
2445 // the sqrt(2) correction below is an approximate 2443 // the sqrt(2) correction below is an approximate
2446 // correction to get to the top of the head 2444 // correction to get to the top of the head
2447 F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) + 2445 F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) +
2448 head.mV[VZ] * neck_scale.mV[VZ] + 2446 head.mV[VZ] * neck_scale.mV[VZ] +
2449 neck.mV[VZ] * chest_scale.mV[VZ] + 2447 neck.mV[VZ] * chest_scale.mV[VZ] +
2450 chest.mV[VZ] * torso_scale.mV[VZ] + 2448 chest.mV[VZ] * torso_scale.mV[VZ] +
2451 torso.mV[VZ] * pelvis_scale.mV[VZ]; 2449 torso.mV[VZ] * pelvis_scale.mV[VZ];
2452 2450
2453 // TODO -- measure the real depth and width 2451 // TODO -- measure the real depth and width
2454 mBodySize.mV[VX] = DEFAULT_AGENT_DEPTH; 2452 mBodySize.mV[VX] = DEFAULT_AGENT_DEPTH;
@@ -2489,7 +2487,7 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys,
2489 LLDataPacker *dp) 2487 LLDataPacker *dp)
2490{ 2488{
2491 LLMemType mt(LLMemType::MTYPE_AVATAR); 2489 LLMemType mt(LLMemType::MTYPE_AVATAR);
2492 2490
2493 LLVector3 old_vel = getVelocity(); 2491 LLVector3 old_vel = getVelocity();
2494 // Do base class updates... 2492 // Do base class updates...
2495 U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp); 2493 U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
@@ -2514,15 +2512,15 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid)
2514{ 2512{
2515 // The core setTETexture() method requests images, so we need 2513 // The core setTETexture() method requests images, so we need
2516 // to redirect certain avatar texture requests to different sims. 2514 // to redirect certain avatar texture requests to different sims.
2517 if (isIndexBakedTexture((ETextureIndex)te)) 2515 /* if (isIndexBakedTexture((ETextureIndex)te))
2518 { 2516 {*/
2519 LLHost target_host = getObjectHost(); 2517 LLHost target_host = getObjectHost();
2520 return setTETextureCore(te, uuid, target_host); 2518 return setTETextureCore(te, uuid, target_host);
2521 } 2519 /*}
2522 else 2520 else
2523 { 2521 {
2524 return setTETextureCore(te, uuid, LLHost::invalid); 2522 return setTETextureCore(te, uuid, LLHost::invalid);
2525 } 2523 }*/
2526} 2524}
2527 2525
2528 2526
@@ -2546,15 +2544,15 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
2546 { 2544 {
2547 return TRUE; 2545 return TRUE;
2548 } 2546 }
2549 2547
2550 // force immediate pixel area update on avatars using last frames data (before drawable or camera updates) 2548 // force immediate pixel area update on avatars using last frames data (before drawable or camera updates)
2551 setPixelAreaAndAngle(gAgent); 2549 setPixelAreaAndAngle(gAgent);
2552 2550
2553 // force asynchronous drawable update 2551 // force asynchronous drawable update
2554 if(mDrawable.notNull() && !gNoRender) 2552 if(mDrawable.notNull() && !gNoRender)
2555 { 2553 {
2556 LLFastTimer t(LLFastTimer::FTM_JOINT_UPDATE); 2554 LLFastTimer t(LLFastTimer::FTM_JOINT_UPDATE);
2557 2555
2558 if (mIsSitting && getParent()) 2556 if (mIsSitting && getParent())
2559 { 2557 {
2560 LLViewerObject *root_object = (LLViewerObject*)getRoot(); 2558 LLViewerObject *root_object = (LLViewerObject*)getRoot();
@@ -2572,7 +2570,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
2572 } 2570 }
2573 } 2571 }
2574 } 2572 }
2575 else 2573 else
2576 { 2574 {
2577 gPipeline.updateMoveDampedAsync(mDrawable); 2575 gPipeline.updateMoveDampedAsync(mDrawable);
2578 } 2576 }
@@ -2585,7 +2583,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
2585 if (mIsSelf) 2583 if (mIsSelf)
2586 { 2584 {
2587 LLViewerObject::idleUpdate(agent, world, time); 2585 LLViewerObject::idleUpdate(agent, world, time);
2588 2586
2589 // trigger fidget anims 2587 // trigger fidget anims
2590 if (isAnyAnimationSignaled(AGENT_STAND_ANIMS, NUM_AGENT_STAND_ANIMS)) 2588 if (isAnyAnimationSignaled(AGENT_STAND_ANIMS, NUM_AGENT_STAND_ANIMS))
2591 { 2589 {
@@ -2602,7 +2600,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
2602 2600
2603 // attach objects that were waiting for a drawable 2601 // attach objects that were waiting for a drawable
2604 lazyAttach(); 2602 lazyAttach();
2605 2603
2606 // animate the character 2604 // animate the character
2607 // store off last frame's root position to be consistent with camera position 2605 // store off last frame's root position to be consistent with camera position
2608 LLVector3 root_pos_last = mRoot.getWorldPosition(); 2606 LLVector3 root_pos_last = mRoot.getWorldPosition();
@@ -2614,9 +2612,20 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
2614 return TRUE; 2612 return TRUE;
2615 } 2613 }
2616 2614
2615 //Zwag: Make sure all composites and bakes are active.
2616 if(mIsSelf)
2617 {
2618 for(U8 i=0;i<getNumTEs();++i)
2619 {
2620 LLViewerImage* te = getTEImage(i);
2621 te->forceActive();
2622 }
2623 }
2624
2617 idleUpdateVoiceVisualizer( voice_enabled ); 2625 idleUpdateVoiceVisualizer( voice_enabled );
2618 idleUpdateMisc( detailed_update ); 2626 idleUpdateMisc( detailed_update );
2619 idleUpdateAppearanceAnimation(); 2627 idleUpdateAppearanceAnimation();
2628
2620 idleUpdateLipSync( voice_enabled ); 2629 idleUpdateLipSync( voice_enabled );
2621 idleUpdateLoadingEffect(); 2630 idleUpdateLoadingEffect();
2622 idleUpdateBelowWater(); // wind effect uses this 2631 idleUpdateBelowWater(); // wind effect uses this
@@ -2632,18 +2641,18 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
2632 // disable voice visualizer when in mouselook 2641 // disable voice visualizer when in mouselook
2633 mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(mIsSelf && gAgent.cameraMouselook()) ); 2642 mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(mIsSelf && gAgent.cameraMouselook()) );
2634 if ( voice_enabled ) 2643 if ( voice_enabled )
2635 { 2644 {
2636 //---------------------------------------------------------------- 2645 //----------------------------------------------------------------
2637 // Only do gesture triggering for your own avatar, and only when you're in a proximal channel. 2646 // Only do gesture triggering for your own avatar, and only when you're in a proximal channel.
2638 //---------------------------------------------------------------- 2647 //----------------------------------------------------------------
2639 if( mIsSelf ) 2648 if( mIsSelf )
2640 { 2649 {
2641 //---------------------------------------------------------------------------------------- 2650 //----------------------------------------------------------------------------------------
2642 // The following takes the voice signal and uses that to trigger gesticulations. 2651 // The following takes the voice signal and uses that to trigger gesticulations.
2643 //---------------------------------------------------------------------------------------- 2652 //----------------------------------------------------------------------------------------
2644 int lastGesticulationLevel = mCurrentGesticulationLevel; 2653 int lastGesticulationLevel = mCurrentGesticulationLevel;
2645 mCurrentGesticulationLevel = mVoiceVisualizer->getCurrentGesticulationLevel(); 2654 mCurrentGesticulationLevel = mVoiceVisualizer->getCurrentGesticulationLevel();
2646 2655
2647 //--------------------------------------------------------------------------------------------------- 2656 //---------------------------------------------------------------------------------------------------
2648 // If "current gesticulation level" changes, we catch this, and trigger the new gesture 2657 // If "current gesticulation level" changes, we catch this, and trigger the new gesture
2649 //--------------------------------------------------------------------------------------------------- 2658 //---------------------------------------------------------------------------------------------------
@@ -2656,32 +2665,32 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
2656 else if ( mCurrentGesticulationLevel == 1 ) { gestureString = "/voicelevel2"; } 2665 else if ( mCurrentGesticulationLevel == 1 ) { gestureString = "/voicelevel2"; }
2657 else if ( mCurrentGesticulationLevel == 2 ) { gestureString = "/voicelevel3"; } 2666 else if ( mCurrentGesticulationLevel == 2 ) { gestureString = "/voicelevel3"; }
2658 else { llinfos << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << llendl; } 2667 else { llinfos << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << llendl; }
2659 2668
2660 // this is the call that Karl S. created for triggering gestures from within the code. 2669 // this is the call that Karl S. created for triggering gestures from within the code.
2661 gGestureManager.triggerAndReviseString( gestureString ); 2670 gGestureManager.triggerAndReviseString( gestureString );
2662 } 2671 }
2663 } 2672 }
2664 2673
2665 } //if( mIsSelf ) 2674 } //if( mIsSelf )
2666 2675
2667 //----------------------------------------------------------------------------------------------------------------- 2676 //-----------------------------------------------------------------------------------------------------------------
2668 // If the avatar is speaking, then the voice amplitude signal is passed to the voice visualizer. 2677 // If the avatar is speaking, then the voice amplitude signal is passed to the voice visualizer.
2669 // Also, here we trigger voice visualizer start and stop speaking, so it can animate the voice symbol. 2678 // Also, here we trigger voice visualizer start and stop speaking, so it can animate the voice symbol.
2670 // 2679 //
2671 // Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been 2680 // Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been
2672 // "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking. 2681 // "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking.
2673 //----------------------------------------------------------------------------------------------------------------- 2682 //-----------------------------------------------------------------------------------------------------------------
2674 if ( gVoiceClient->getIsSpeaking( mID ) ) 2683 if ( gVoiceClient->getIsSpeaking( mID ) )
2675 { 2684 {
2676 if ( ! mVoiceVisualizer->getCurrentlySpeaking() ) 2685 if ( ! mVoiceVisualizer->getCurrentlySpeaking() )
2677 { 2686 {
2678 mVoiceVisualizer->setStartSpeaking(); 2687 mVoiceVisualizer->setStartSpeaking();
2679 2688
2680 //printf( "gAwayTimer.reset();\n" ); 2689 //printf( "gAwayTimer.reset();\n" );
2681 } 2690 }
2682 2691
2683 mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) ); 2692 mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) );
2684 2693
2685 if( mIsSelf ) 2694 if( mIsSelf )
2686 { 2695 {
2687 gAgent.clearAFK(); 2696 gAgent.clearAFK();
@@ -2692,28 +2701,28 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
2692 if ( mVoiceVisualizer->getCurrentlySpeaking() ) 2701 if ( mVoiceVisualizer->getCurrentlySpeaking() )
2693 { 2702 {
2694 mVoiceVisualizer->setStopSpeaking(); 2703 mVoiceVisualizer->setStopSpeaking();
2695 2704
2696 if ( mLipSyncActive ) 2705 if ( mLipSyncActive )
2697 { 2706 {
2698 if( mOohMorph ) mOohMorph->setWeight(mOohMorph->getMinWeight(), FALSE); 2707 if( mOohMorph ) mOohMorph->setWeight(mOohMorph->getMinWeight(), FALSE);
2699 if( mAahMorph ) mAahMorph->setWeight(mAahMorph->getMinWeight(), FALSE); 2708 if( mAahMorph ) mAahMorph->setWeight(mAahMorph->getMinWeight(), FALSE);
2700 2709
2701 mLipSyncActive = false; 2710 mLipSyncActive = false;
2702 LLCharacter::updateVisualParams(); 2711 LLCharacter::updateVisualParams();
2703 dirtyMesh(); 2712 dirtyMesh();
2704 } 2713 }
2705 } 2714 }
2706 } 2715 }
2707 2716
2708 //-------------------------------------------------------------------------------------------- 2717 //--------------------------------------------------------------------------------------------
2709 // here we get the approximate head position and set as sound source for the voice symbol 2718 // here we get the approximate head position and set as sound source for the voice symbol
2710 // (the following version uses a tweak of "mHeadOffset" which handle sitting vs. standing) 2719 // (the following version uses a tweak of "mHeadOffset" which handle sitting vs. standing)
2711 //-------------------------------------------------------------------------------------------- 2720 //--------------------------------------------------------------------------------------------
2712 LLVector3 headOffset = LLVector3( 0.0f, 0.0f, mHeadOffset.mV[2] ); 2721 LLVector3 headOffset = LLVector3( 0.0f, 0.0f, mHeadOffset.mV[2] );
2713 mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot.getWorldPosition() + headOffset ); 2722 mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot.getWorldPosition() + headOffset );
2714 2723
2715 }//if ( voiceEnabled ) 2724 }//if ( voiceEnabled )
2716} 2725}
2717 2726
2718void LLVOAvatar::idleUpdateMisc(bool detailed_update) 2727void LLVOAvatar::idleUpdateMisc(bool detailed_update)
2719{ 2728{
@@ -2737,14 +2746,14 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
2737 if (detailed_update || !sUseImpostors) 2746 if (detailed_update || !sUseImpostors)
2738 { 2747 {
2739 LLFastTimer t(LLFastTimer::FTM_ATTACHMENT_UPDATE); 2748 LLFastTimer t(LLFastTimer::FTM_ATTACHMENT_UPDATE);
2740 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 2749 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
2741 iter != mAttachmentPoints.end(); ) 2750 iter != mAttachmentPoints.end(); )
2742 { 2751 {
2743 attachment_map_t::iterator curiter = iter++; 2752 attachment_map_t::iterator curiter = iter++;
2744 LLViewerJointAttachment* attachment = curiter->second; 2753 LLViewerJointAttachment* attachment = curiter->second;
2745 LLViewerObject *attached_object = attachment->getObject(); 2754 LLViewerObject *attached_object = attachment->getObject();
2746 2755
2747 BOOL visibleAttachment = visible || (attached_object && 2756 BOOL visibleAttachment = visible || (attached_object &&
2748 !(attached_object->mDrawable->getSpatialBridge() && 2757 !(attached_object->mDrawable->getSpatialBridge() &&
2749 attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0)); 2758 attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0));
2750 2759
@@ -2765,7 +2774,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
2765 { 2774 {
2766 gPipeline.updateMoveNormalAsync(bridge); 2775 gPipeline.updateMoveNormalAsync(bridge);
2767 } 2776 }
2768 attached_object->updateText(); 2777 attached_object->updateText();
2769 } 2778 }
2770 } 2779 }
2771 } 2780 }
@@ -2785,7 +2794,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
2785 F32 cur_angle = angle.mV[i]; 2794 F32 cur_angle = angle.mV[i];
2786 F32 old_angle = mImpostorAngle.mV[i]; 2795 F32 old_angle = mImpostorAngle.mV[i];
2787 F32 angle_diff = fabsf(cur_angle-old_angle); 2796 F32 angle_diff = fabsf(cur_angle-old_angle);
2788 2797
2789 if (angle_diff > 3.14159f/512.f*distance*mUpdatePeriod) 2798 if (angle_diff > 3.14159f/512.f*distance*mUpdatePeriod)
2790 { 2799 {
2791 mNeedsImpostorUpdate = TRUE; 2800 mNeedsImpostorUpdate = TRUE;
@@ -2795,7 +2804,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
2795 if (detailed_update && !mNeedsImpostorUpdate) 2804 if (detailed_update && !mNeedsImpostorUpdate)
2796 { //update impostor if view angle, distance, or bounding box change 2805 { //update impostor if view angle, distance, or bounding box change
2797 //significantly 2806 //significantly
2798 2807
2799 F32 dist_diff = fabsf(distance-mImpostorDistance); 2808 F32 dist_diff = fabsf(distance-mImpostorDistance);
2800 if (dist_diff/mImpostorDistance > 0.1f) 2809 if (dist_diff/mImpostorDistance > 0.1f)
2801 { 2810 {
@@ -2814,7 +2823,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
2814 } 2823 }
2815 2824
2816 mDrawable->movePartition(); 2825 mDrawable->movePartition();
2817 2826
2818 //force a move if sitting on an active object 2827 //force a move if sitting on an active object
2819 if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive()) 2828 if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive())
2820 { 2829 {
@@ -2957,11 +2966,12 @@ void LLVOAvatar::idleUpdateLoadingEffect()
2957 particle_parameters.mPartData.mFlags = ( LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK | 2966 particle_parameters.mPartData.mFlags = ( LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK |
2958 LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK | 2967 LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK |
2959 LLPartData::LL_PART_TARGET_POS_MASK ); 2968 LLPartData::LL_PART_TARGET_POS_MASK );
2960 2969
2961 setParticleSource(particle_parameters, getID()); 2970 setParticleSource(particle_parameters, getID());
2962 } 2971 }
2963 } 2972 }
2964} 2973}
2974
2965 2975
2966void LLVOAvatar::idleUpdateWindEffect() 2976void LLVOAvatar::idleUpdateWindEffect()
2967{ 2977{
@@ -3004,9 +3014,9 @@ void LLVOAvatar::idleUpdateWindEffect()
3004 interp = LLCriticalDamp::getInterpolant(0.4f); 3014 interp = LLCriticalDamp::getInterpolant(0.4f);
3005 } 3015 }
3006 mWindVec = lerp(mWindVec, wind, interp); 3016 mWindVec = lerp(mWindVec, wind, interp);
3007 3017
3008 F32 wind_freq = hover_strength + llclamp(8.f + (speed * 0.7f) + (noise1(mRipplePhase) * 4.f), 8.f, 25.f); 3018 F32 wind_freq = hover_strength + llclamp(8.f + (speed * 0.7f) + (noise1(mRipplePhase) * 4.f), 8.f, 25.f);
3009 mWindFreq = lerp(mWindFreq, wind_freq, interp); 3019 mWindFreq = lerp(mWindFreq, wind_freq, interp);
3010 3020
3011 if (mBelowWater) 3021 if (mBelowWater)
3012 { 3022 {
@@ -3258,7 +3268,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3258 { 3268 {
3259 mChats.clear(); 3269 mChats.clear();
3260 } 3270 }
3261 3271
3262 const F32 time_visible = mTimeVisible.getElapsedTimeF32(); 3272 const F32 time_visible = mTimeVisible.getElapsedTimeF32();
3263 const F32 NAME_SHOW_TIME = gSavedSettings.getF32("RenderNameShowTime"); // seconds 3273 const F32 NAME_SHOW_TIME = gSavedSettings.getF32("RenderNameShowTime"); // seconds
3264 const F32 FADE_DURATION = gSavedSettings.getF32("RenderNameFadeDuration"); // seconds 3274 const F32 FADE_DURATION = gSavedSettings.getF32("RenderNameFadeDuration"); // seconds
@@ -3385,7 +3395,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3385 sNumVisibleChatBubbles--; 3395 sNumVisibleChatBubbles--;
3386 } 3396 }
3387 } 3397 }
3388 3398
3389 LLNameValue *title = getNVPair("Title"); 3399 LLNameValue *title = getNVPair("Title");
3390 LLNameValue* firstname = getNVPair("FirstName"); 3400 LLNameValue* firstname = getNVPair("FirstName");
3391 LLNameValue* lastname = getNVPair("LastName"); 3401 LLNameValue* lastname = getNVPair("LastName");
@@ -3502,7 +3512,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3502 { 3512 {
3503 mNameText->setLabel(mNameString); 3513 mNameText->setLabel(mNameString);
3504 } 3514 }
3505 3515
3506 char line[MAX_STRING]; /* Flawfinder: ignore */ 3516 char line[MAX_STRING]; /* Flawfinder: ignore */
3507 line[0] = '\0'; 3517 line[0] = '\0';
3508 std::deque<LLChat>::iterator chat_iter = mChats.begin(); 3518 std::deque<LLChat>::iterator chat_iter = mChats.begin();
@@ -3511,7 +3521,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3511 LLColor4 new_chat = gColors.getColor( "AvatarNameColor" ); 3521 LLColor4 new_chat = gColors.getColor( "AvatarNameColor" );
3512 LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); 3522 LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f);
3513 LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); 3523 LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f);
3514 if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) 3524 if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES)
3515 { 3525 {
3516 ++chat_iter; 3526 ++chat_iter;
3517 } 3527 }
@@ -3597,6 +3607,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3597 } 3607 }
3598} 3608}
3599 3609
3610
3600void LLVOAvatar::idleUpdateTractorBeam() 3611void LLVOAvatar::idleUpdateTractorBeam()
3601{ 3612{
3602 //-------------------------------------------------------------------- 3613 //--------------------------------------------------------------------
@@ -3924,7 +3935,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
3924 mRoot.setWorldPosition( getPositionAgent() ); // first frame 3935 mRoot.setWorldPosition( getPositionAgent() ); // first frame
3925 mRoot.setWorldRotation( getRotation() ); 3936 mRoot.setWorldRotation( getRotation() );
3926 } 3937 }
3927 3938
3928 //-------------------------------------------------------------------- 3939 //--------------------------------------------------------------------
3929 // dont' let dT get larger than 1/5th of a second 3940 // dont' let dT get larger than 1/5th of a second
3930 //-------------------------------------------------------------------- 3941 //--------------------------------------------------------------------
@@ -3950,7 +3961,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
3950 3961
3951 resolveHeightGlobal(root_pos, ground_under_pelvis, normal); 3962 resolveHeightGlobal(root_pos, ground_under_pelvis, normal);
3952 F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); 3963 F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]);
3953 BOOL in_air = ( (!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) || 3964 BOOL in_air = ( (!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) ||
3954 foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE); 3965 foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE);
3955 3966
3956 if (in_air && !mInAir) 3967 if (in_air && !mInAir)
@@ -3959,15 +3970,15 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
3959 } 3970 }
3960 mInAir = in_air; 3971 mInAir = in_air;
3961 3972
3962 // correct for the fact that the pelvis is not necessarily the center 3973 // correct for the fact that the pelvis is not necessarily the center
3963 // of the agent's physical representation 3974 // of the agent's physical representation
3964 root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; 3975 root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot;
3965 3976
3966 3977
3967 LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); 3978 LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos);
3968 3979
3969 if (newPosition != mRoot.getXform()->getWorldPosition()) 3980 if (newPosition != mRoot.getXform()->getWorldPosition())
3970 { 3981 {
3971 mRoot.touch(); 3982 mRoot.touch();
3972 mRoot.setWorldPosition(newPosition ); // regular update 3983 mRoot.setWorldPosition(newPosition ); // regular update
3973 } 3984 }
@@ -3980,7 +3991,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
3980 { 3991 {
3981 LLQuaternion iQ; 3992 LLQuaternion iQ;
3982 LLVector3 upDir( 0.0f, 0.0f, 1.0f ); 3993 LLVector3 upDir( 0.0f, 0.0f, 1.0f );
3983 3994
3984 // Compute a forward direction vector derived from the primitive rotation 3995 // Compute a forward direction vector derived from the primitive rotation
3985 // and the velocity vector. When walking or jumping, don't let body deviate 3996 // and the velocity vector. When walking or jumping, don't let body deviate
3986 // more than 90 from the view, if necessary, flip the velocity vector. 3997 // more than 90 from the view, if necessary, flip the velocity vector.
@@ -4019,7 +4030,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
4019 LLVector3 up_vector = gAgent.getReferenceUpVector(); 4030 LLVector3 up_vector = gAgent.getReferenceUpVector();
4020 at_axis -= up_vector * (at_axis * up_vector); 4031 at_axis -= up_vector * (at_axis * up_vector);
4021 at_axis.normalize(); 4032 at_axis.normalize();
4022 4033
4023 F32 dot = fwdDir * at_axis; 4034 F32 dot = fwdDir * at_axis;
4024 if (dot < 0.f) 4035 if (dot < 0.f)
4025 { 4036 {
@@ -4027,7 +4038,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
4027 fwdDir.normalize(); 4038 fwdDir.normalize();
4028 } 4039 }
4029 } 4040 }
4030 4041
4031 } 4042 }
4032 4043
4033 LLQuaternion root_rotation = mRoot.getWorldMatrix().quaternion(); 4044 LLQuaternion root_rotation = mRoot.getWorldMatrix().quaternion();
@@ -4036,7 +4047,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
4036 4047
4037 if (sDebugAvatarRotation) 4048 if (sDebugAvatarRotation)
4038 { 4049 {
4039 llinfos << "root_roll " << RAD_TO_DEG * root_roll 4050 llinfos << "root_roll " << RAD_TO_DEG * root_roll
4040 << " root_pitch " << RAD_TO_DEG * root_pitch 4051 << " root_pitch " << RAD_TO_DEG * root_pitch
4041 << " root_yaw " << RAD_TO_DEG * root_yaw 4052 << " root_yaw " << RAD_TO_DEG * root_yaw
4042 << llendl; 4053 << llendl;
@@ -4049,7 +4060,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
4049 4060
4050 LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); 4061 LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV );
4051 F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST); 4062 F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST);
4052 4063
4053 if (self_in_mouselook) 4064 if (self_in_mouselook)
4054 { 4065 {
4055 pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR; 4066 pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR;
@@ -4127,10 +4138,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
4127 pelvis_lag_time = PELVIS_LAG_WALKING; 4138 pelvis_lag_time = PELVIS_LAG_WALKING;
4128 } 4139 }
4129 4140
4130 F32 u = llclamp((deltaTime / pelvis_lag_time), 0.0f, 1.0f); 4141 F32 u = llclamp((deltaTime / pelvis_lag_time), 0.0f, 1.0f);
4131 4142
4132 mRoot.setWorldRotation( slerp(u, mRoot.getWorldRotation(), wQv) ); 4143 mRoot.setWorldRotation( slerp(u, mRoot.getWorldRotation(), wQv) );
4133 4144
4134 } 4145 }
4135 } 4146 }
4136 else if (mDrawable.notNull()) 4147 else if (mDrawable.notNull())
@@ -4138,7 +4149,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
4138 mRoot.setPosition(mDrawable->getPosition()); 4149 mRoot.setPosition(mDrawable->getPosition());
4139 mRoot.setRotation(mDrawable->getRotation()); 4150 mRoot.setRotation(mDrawable->getRotation());
4140 } 4151 }
4141 4152
4142 //------------------------------------------------------------------------- 4153 //-------------------------------------------------------------------------
4143 // Update character motions 4154 // Update character motions
4144 //------------------------------------------------------------------------- 4155 //-------------------------------------------------------------------------
@@ -4270,7 +4281,7 @@ void LLVOAvatar::updateHeadOffset()
4270 } 4281 }
4271 if (mIsSitting) 4282 if (mIsSitting)
4272 { 4283 {
4273 mHeadOffset = midEyePt; 4284 mHeadOffset = midEyePt;
4274 } 4285 }
4275 else 4286 else
4276 { 4287 {
@@ -4362,7 +4373,7 @@ void LLVOAvatar::updateVisibility()
4362 llinfos << "PA: " << getPositionAgent() << llendl; 4373 llinfos << "PA: " << getPositionAgent() << llendl;
4363 /*llinfos << "SPA: " << sel_pos_agent << llendl; 4374 /*llinfos << "SPA: " << sel_pos_agent << llendl;
4364 llinfos << "WPA: " << wrist_right_pos_agent << llendl;*/ 4375 llinfos << "WPA: " << wrist_right_pos_agent << llendl;*/
4365 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 4376 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
4366 iter != mAttachmentPoints.end(); ) 4377 iter != mAttachmentPoints.end(); )
4367 { 4378 {
4368 attachment_map_t::iterator curiter = iter++; 4379 attachment_map_t::iterator curiter = iter++;
@@ -4424,7 +4435,7 @@ BOOL LLVOAvatar::needsRenderBeam()
4424 LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); 4435 LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
4425 4436
4426 BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); 4437 BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing());
4427 if (LLToolGrab::getInstance()->getEditingObject() && 4438 if (LLToolGrab::getInstance()->getEditingObject() &&
4428 LLToolGrab::getInstance()->getEditingObject()->isAttachment()) 4439 LLToolGrab::getInstance()->getEditingObject()->isAttachment())
4429 { 4440 {
4430 // don't render selection beam on hud objects 4441 // don't render selection beam on hud objects
@@ -4473,7 +4484,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4473 mMeshLOD[MESH_ID_HAIR]->updateJointGeometry(); 4484 mMeshLOD[MESH_ID_HAIR]->updateJointGeometry();
4474 } 4485 }
4475 mNeedsSkin = FALSE; 4486 mNeedsSkin = FALSE;
4476 4487
4477 LLVertexBuffer* vb = mDrawable->getFace(0)->mVertexBuffer; 4488 LLVertexBuffer* vb = mDrawable->getFace(0)->mVertexBuffer;
4478 if (vb) 4489 if (vb)
4479 { 4490 {
@@ -4537,19 +4548,19 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4537 { 4548 {
4538 F32 SQUARE_SIZE = 0.2f; 4549 F32 SQUARE_SIZE = 0.2f;
4539 gGL.color4f(1.f, 0.f, 0.f, 1.f); 4550 gGL.color4f(1.f, 0.f, 0.f, 1.f);
4540 4551
4541 gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]); 4552 gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]);
4542 gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]); 4553 gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]);
4543 4554
4544 gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]); 4555 gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]);
4545 gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]); 4556 gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]);
4546 4557
4547 gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]); 4558 gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]);
4548 gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]); 4559 gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]);
4549 4560
4550 gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]); 4561 gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]);
4551 gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]); 4562 gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]);
4552 4563
4553 gGL.vertex3f(collide_point.mV[VX], collide_point.mV[VY], collide_point.mV[VZ]); 4564 gGL.vertex3f(collide_point.mV[VX], collide_point.mV[VY], collide_point.mV[VZ]);
4554 gGL.vertex3f(collide_point.mV[VX] + mFootPlane.mV[VX], collide_point.mV[VY] + mFootPlane.mV[VY], collide_point.mV[VZ] + mFootPlane.mV[VZ]); 4565 gGL.vertex3f(collide_point.mV[VX] + mFootPlane.mV[VX], collide_point.mV[VY] + mFootPlane.mV[VY], collide_point.mV[VZ] + mFootPlane.mV[VZ]);
4555 4566
@@ -4566,8 +4577,8 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4566 4577
4567 if (pass == AVATAR_RENDER_PASS_SINGLE) 4578 if (pass == AVATAR_RENDER_PASS_SINGLE)
4568 { 4579 {
4569 const bool should_alpha_mask = mHasBakedHair && isTextureDefined(TEX_HEAD_BAKED) && isTextureDefined(TEX_UPPER_BAKED) 4580 const bool should_alpha_mask = mHasBakedHair && isTextureDefined(TEX_HEAD_BAKED) && isTextureDefined(TEX_UPPER_BAKED)
4570 && isTextureDefined(TEX_LOWER_BAKED) 4581 && isTextureDefined(TEX_LOWER_BAKED)
4571 && mBakedTextureData[BAKED_HEAD].mIsLoaded 4582 && mBakedTextureData[BAKED_HEAD].mIsLoaded
4572 && mBakedTextureData[BAKED_UPPER].mIsLoaded && mBakedTextureData[BAKED_LOWER].mIsLoaded 4583 && mBakedTextureData[BAKED_UPPER].mIsLoaded && mBakedTextureData[BAKED_LOWER].mIsLoaded
4573 && mBakedTextureData[BAKED_HEAD].mIsUsed 4584 && mBakedTextureData[BAKED_HEAD].mIsUsed
@@ -4581,7 +4592,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4581 { 4592 {
4582 gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); 4593 gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
4583 } 4594 }
4584 4595
4585 BOOL first_pass = TRUE; 4596 BOOL first_pass = TRUE;
4586 if (!LLDrawPoolAvatar::sSkipOpaque) 4597 if (!LLDrawPoolAvatar::sSkipOpaque)
4587 { 4598 {
@@ -4598,7 +4609,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4598 num_indices += mMeshLOD[MESH_ID_UPPER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); 4609 num_indices += mMeshLOD[MESH_ID_UPPER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy);
4599 first_pass = FALSE; 4610 first_pass = FALSE;
4600 } 4611 }
4601 4612
4602 if (isTextureVisible(TEX_LOWER_BAKED) || mIsDummy) 4613 if (isTextureVisible(TEX_LOWER_BAKED) || mIsDummy)
4603 { 4614 {
4604 num_indices += mMeshLOD[MESH_ID_LOWER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); 4615 num_indices += mMeshLOD[MESH_ID_LOWER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy);
@@ -4615,9 +4626,9 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4615 num_indices += renderTransparent(first_pass); 4626 num_indices += renderTransparent(first_pass);
4616 } 4627 }
4617 } 4628 }
4618 4629
4619 LLViewerJointMesh::sRenderPass = AVATAR_RENDER_PASS_SINGLE; 4630 LLViewerJointMesh::sRenderPass = AVATAR_RENDER_PASS_SINGLE;
4620 4631
4621 //llinfos << "Avatar render: " << render_timer.getElapsedTimeF32() << llendl; 4632 //llinfos << "Avatar render: " << render_timer.getElapsedTimeF32() << llendl;
4622 4633
4623 //render_stat.addValue(render_timer.getElapsedTimeF32()*1000.f); 4634 //render_stat.addValue(render_timer.getElapsedTimeF32()*1000.f);
@@ -4642,7 +4653,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass)
4642 { 4653 {
4643 gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); 4654 gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
4644 } 4655 }
4645 4656
4646 if (isTextureVisible(TEX_HEAD_BAKED)) 4657 if (isTextureVisible(TEX_HEAD_BAKED))
4647 { 4658 {
4648 num_indices += mMeshLOD[MESH_ID_EYELASH]->render(mAdjustedPixelArea, first_pass, mIsDummy); 4659 num_indices += mMeshLOD[MESH_ID_EYELASH]->render(mAdjustedPixelArea, first_pass, mIsDummy);
@@ -4689,13 +4700,13 @@ U32 LLVOAvatar::renderRigid()
4689 if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) 4700 if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy)
4690 { 4701 {
4691 // If the meshes need to be drawn, enable alpha masking but not blending 4702 // If the meshes need to be drawn, enable alpha masking but not blending
4692 bool should_alpha_mask = mHasBakedHair 4703 bool should_alpha_mask = mHasBakedHair
4693 && mBakedTextureData[BAKED_EYES].mIsLoaded 4704 && mBakedTextureData[BAKED_EYES].mIsLoaded
4694 && mBakedTextureData[BAKED_EYES].mIsUsed 4705 && mBakedTextureData[BAKED_EYES].mIsUsed
4695 && !(isSelf() && gAgent.cameraCustomizeAvatar()); 4706 && !(isSelf() && gAgent.cameraCustomizeAvatar());
4696 4707
4697 LLGLState test(GL_ALPHA_TEST, should_alpha_mask); 4708 LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
4698 4709
4699 if (should_alpha_mask) 4710 if (should_alpha_mask)
4700 { 4711 {
4701 gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); 4712 gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
@@ -4706,7 +4717,7 @@ U32 LLVOAvatar::renderRigid()
4706 4717
4707 gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); 4718 gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
4708 } 4719 }
4709 4720
4710 return num_indices; 4721 return num_indices;
4711} 4722}
4712 4723
@@ -4723,7 +4734,7 @@ U32 LLVOAvatar::renderFootShadows()
4723 { 4734 {
4724 return 0; 4735 return 0;
4725 } 4736 }
4726 4737
4727 if (!mIsBuilt) 4738 if (!mIsBuilt)
4728 { 4739 {
4729 return 0; 4740 return 0;
@@ -4883,7 +4894,7 @@ void LLVOAvatar::updateTextures()
4883 { 4894 {
4884 LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " 4895 LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture "
4885 << imagep->getID() << " for avatar " 4896 << imagep->getID() << " for avatar "
4886 << (mIsSelf ? "<myself>" : getID().asString()) 4897 << (mIsSelf ? "<myself>" : getID().asString())
4887 << " on host " << getRegion()->getHost() << llendl; 4898 << " on host " << getRegion()->getHost() << llendl;
4888 } 4899 }
4889 4900
@@ -4918,8 +4929,8 @@ void LLVOAvatar::updateTextures()
4918 if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) 4929 if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
4919 { 4930 {
4920 setDebugText(llformat("%4.0f:%4.0f", fsqrtf(mMinPixelArea),fsqrtf(mMaxPixelArea))); 4931 setDebugText(llformat("%4.0f:%4.0f", fsqrtf(mMinPixelArea),fsqrtf(mMaxPixelArea)));
4921 } 4932 }
4922 4933
4923 if( render_avatar ) 4934 if( render_avatar )
4924 { 4935 {
4925 mShadowImagep->addTextureStats(mPixelArea); 4936 mShadowImagep->addTextureStats(mPixelArea);
@@ -4961,7 +4972,7 @@ void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerImage* imagep,
4961 } 4972 }
4962} 4973}
4963 4974
4964 4975
4965void LLVOAvatar::addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level) 4976void LLVOAvatar::addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level)
4966{ 4977{
4967 mMaxPixelArea = llmax(pixel_area, mMaxPixelArea); 4978 mMaxPixelArea = llmax(pixel_area, mMaxPixelArea);
@@ -5041,7 +5052,7 @@ const LLUUID& LLVOAvatar::getStepSound() const
5041void LLVOAvatar::processAnimationStateChanges() 5052void LLVOAvatar::processAnimationStateChanges()
5042{ 5053{
5043 LLMemType mt(LLMemType::MTYPE_AVATAR); 5054 LLMemType mt(LLMemType::MTYPE_AVATAR);
5044 5055
5045 if (gNoRender) 5056 if (gNoRender)
5046 { 5057 {
5047 return; 5058 return;
@@ -5219,13 +5230,13 @@ void LLVOAvatar::resetAnimations()
5219 5230
5220//----------------------------------------------------------------------------- 5231//-----------------------------------------------------------------------------
5221// startMotion() 5232// startMotion()
5222// id is the asset if of the animation to start 5233// id is the asset id of the animation to start
5223// time_offset is the offset into the animation at which to start playing 5234// time_offset is the offset into the animation at which to start playing
5224//----------------------------------------------------------------------------- 5235//-----------------------------------------------------------------------------
5225BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) 5236BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
5226{ 5237{
5227 LLMemType mt(LLMemType::MTYPE_AVATAR); 5238 LLMemType mt(LLMemType::MTYPE_AVATAR);
5228 5239
5229 // start special case female walk for female avatars 5240 // start special case female walk for female avatars
5230 if (getSex() == SEX_FEMALE) 5241 if (getSex() == SEX_FEMALE)
5231 { 5242 {
@@ -5426,7 +5437,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age
5426 out_pos_agent = in_pos_agent; 5437 out_pos_agent = in_pos_agent;
5427 return; 5438 return;
5428 } 5439 }
5429 5440
5430 p0_global = gAgent.getPosGlobalFromAgent(in_pos_agent) + z_vec; 5441 p0_global = gAgent.getPosGlobalFromAgent(in_pos_agent) + z_vec;
5431 p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec; 5442 p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec;
5432 LLViewerObject *obj; 5443 LLViewerObject *obj;
@@ -5501,7 +5512,7 @@ BOOL LLVOAvatar::allocateCharacterJoints( U32 num )
5501 mNumJoints = 0; 5512 mNumJoints = 0;
5502 5513
5503 mSkeleton = new LLViewerJoint[num]; 5514 mSkeleton = new LLViewerJoint[num];
5504 5515
5505 for(S32 joint_num = 0; joint_num < (S32)num; joint_num++) 5516 for(S32 joint_num = 0; joint_num < (S32)num; joint_num++)
5506 { 5517 {
5507 mSkeleton[joint_num].setJointNum(joint_num); 5518 mSkeleton[joint_num].setJointNum(joint_num);
@@ -5541,7 +5552,7 @@ BOOL LLVOAvatar::allocateCollisionVolumes( U32 num )
5541//----------------------------------------------------------------------------- 5552//-----------------------------------------------------------------------------
5542LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) 5553LLJoint *LLVOAvatar::getCharacterJoint( U32 num )
5543{ 5554{
5544 if ((S32)num >= mNumJoints 5555 if ((S32)num >= mNumJoints
5545 || (S32)num < 0) 5556 || (S32)num < 0)
5546 { 5557 {
5547 return NULL; 5558 return NULL;
@@ -5568,7 +5579,7 @@ void LLVOAvatar::requestStopMotion( LLMotion* motion )
5568BOOL LLVOAvatar::loadAvatar() 5579BOOL LLVOAvatar::loadAvatar()
5569{ 5580{
5570// LLFastTimer t(LLFastTimer::FTM_LOAD_AVATAR); 5581// LLFastTimer t(LLFastTimer::FTM_LOAD_AVATAR);
5571 5582
5572 // avatar_skeleton.xml 5583 // avatar_skeleton.xml
5573 if( !buildSkeleton(sAvatarSkeletonInfo) ) 5584 if( !buildSkeleton(sAvatarSkeletonInfo) )
5574 { 5585 {
@@ -5582,14 +5593,14 @@ BOOL LLVOAvatar::loadAvatar()
5582 llwarns << "avatar file: loadNodeSkeleton() failed" << llendl; 5593 llwarns << "avatar file: loadNodeSkeleton() failed" << llendl;
5583 return FALSE; 5594 return FALSE;
5584 } 5595 }
5585 5596
5586 // avatar_lad.xml : <mesh> 5597 // avatar_lad.xml : <mesh>
5587 if( !loadMeshNodes() ) 5598 if( !loadMeshNodes() )
5588 { 5599 {
5589 llwarns << "avatar file: loadNodeMesh() failed" << llendl; 5600 llwarns << "avatar file: loadNodeMesh() failed" << llendl;
5590 return FALSE; 5601 return FALSE;
5591 } 5602 }
5592 5603
5593 // avatar_lad.xml : <global_color> 5604 // avatar_lad.xml : <global_color>
5594 if( sAvatarXmlInfo->mTexSkinColorInfo ) 5605 if( sAvatarXmlInfo->mTexSkinColorInfo )
5595 { 5606 {
@@ -5633,7 +5644,7 @@ BOOL LLVOAvatar::loadAvatar()
5633 llwarns << "<global_color> name=\"eye_color\" not found" << llendl; 5644 llwarns << "<global_color> name=\"eye_color\" not found" << llendl;
5634 return FALSE; 5645 return FALSE;
5635 } 5646 }
5636 5647
5637 // avatar_lad.xml : <layer_set> 5648 // avatar_lad.xml : <layer_set>
5638 if (sAvatarXmlInfo->mLayerInfoList.empty()) 5649 if (sAvatarXmlInfo->mLayerInfoList.empty())
5639 { 5650 {
@@ -5675,7 +5686,7 @@ BOOL LLVOAvatar::loadAvatar()
5675 } 5686 }
5676 } 5687 }
5677 } 5688 }
5678 5689
5679 // avatar_lad.xml : <driver_parameters> 5690 // avatar_lad.xml : <driver_parameters>
5680 { 5691 {
5681 LLVOAvatarXmlInfo::driver_info_list_t::iterator iter; 5692 LLVOAvatarXmlInfo::driver_info_list_t::iterator iter;
@@ -5696,7 +5707,7 @@ BOOL LLVOAvatar::loadAvatar()
5696 } 5707 }
5697 } 5708 }
5698 } 5709 }
5699 5710
5700 return TRUE; 5711 return TRUE;
5701} 5712}
5702 5713
@@ -5756,10 +5767,10 @@ BOOL LLVOAvatar::loadSkeletonNode ()
5756 else 5767 else
5757 { 5768 {
5758 addVisualParam(param); 5769 addVisualParam(param);
5759 } 5770 }
5760 } 5771 }
5761 } 5772 }
5762 5773
5763 // ATTACHMENTS 5774 // ATTACHMENTS
5764 { 5775 {
5765 LLVOAvatarXmlInfo::attachment_info_list_t::iterator iter; 5776 LLVOAvatarXmlInfo::attachment_info_list_t::iterator iter;
@@ -5844,7 +5855,7 @@ BOOL LLVOAvatar::loadSkeletonNode ()
5844BOOL LLVOAvatar::loadMeshNodes() 5855BOOL LLVOAvatar::loadMeshNodes()
5845{ 5856{
5846 for (LLVOAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin(); 5857 for (LLVOAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin();
5847 meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end(); 5858 meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end();
5848 meshinfo_iter++) 5859 meshinfo_iter++)
5849 { 5860 {
5850 const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo *info = *meshinfo_iter; 5861 const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo *info = *meshinfo_iter;
@@ -5885,7 +5896,7 @@ BOOL LLVOAvatar::loadMeshNodes()
5885 return FALSE; 5896 return FALSE;
5886 } 5897 }
5887 } 5898 }
5888 else 5899 else
5889 { 5900 {
5890 llwarns << "Ignoring unrecognized mesh type: " << type << llendl; 5901 llwarns << "Ignoring unrecognized mesh type: " << type << llendl;
5891 return FALSE; 5902 return FALSE;
@@ -5927,12 +5938,12 @@ BOOL LLVOAvatar::loadMeshNodes()
5927 5938
5928 // Multimap insert 5939 // Multimap insert
5929 mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh)); 5940 mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh));
5930 5941
5931 mesh->setMesh( poly_mesh ); 5942 mesh->setMesh( poly_mesh );
5932 mesh->setLOD( info->mMinPixelArea ); 5943 mesh->setLOD( info->mMinPixelArea );
5933 5944
5934 for (LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin(); 5945 for (LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin();
5935 xmlinfo_iter != info->mPolyMorphTargetInfoList.end(); 5946 xmlinfo_iter != info->mPolyMorphTargetInfoList.end();
5936 xmlinfo_iter++) 5947 xmlinfo_iter++)
5937 { 5948 {
5938 const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter); 5949 const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter);
@@ -5952,7 +5963,7 @@ BOOL LLVOAvatar::loadMeshNodes()
5952 { 5963 {
5953 addVisualParam(param); 5964 addVisualParam(param);
5954 } 5965 }
5955 } 5966 }
5956 } 5967 }
5957 } 5968 }
5958 5969
@@ -6090,7 +6101,7 @@ LLDrawable *LLVOAvatar::createDrawable(LLPipeline *pipeline)
6090 mDrawable->setState(LLDrawable::ACTIVE); 6101 mDrawable->setState(LLDrawable::ACTIVE);
6091 mDrawable->addFace(poolp, NULL); 6102 mDrawable->addFace(poolp, NULL);
6092 mDrawable->setRenderType(LLPipeline::RENDER_TYPE_AVATAR); 6103 mDrawable->setRenderType(LLPipeline::RENDER_TYPE_AVATAR);
6093 6104
6094 LLFace *facep; 6105 LLFace *facep;
6095 6106
6096 // Add faces for the foot shadows 6107 // Add faces for the foot shadows
@@ -6117,7 +6128,7 @@ BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable)
6117 { 6128 {
6118 return TRUE; 6129 return TRUE;
6119 } 6130 }
6120 6131
6121 if (!mMeshValid) 6132 if (!mMeshValid)
6122 { 6133 {
6123 return TRUE; 6134 return TRUE;
@@ -6169,7 +6180,7 @@ void LLVOAvatar::updateShadowFaces()
6169 LLVector3 joint_world_pos = mFootLeftp->getWorldPosition(); 6180 LLVector3 joint_world_pos = mFootLeftp->getWorldPosition();
6170 // this only does a ray straight down from the foot, as our client-side ray-tracing is very limited now 6181 // this only does a ray straight down from the foot, as our client-side ray-tracing is very limited now
6171 // but we make an explicit ray trace call in expectation of future improvements 6182 // but we make an explicit ray trace call in expectation of future improvements
6172 resolveRayCollisionAgent(gAgent.getPosGlobalFromAgent(joint_world_pos), 6183 resolveRayCollisionAgent(gAgent.getPosGlobalFromAgent(joint_world_pos),
6173 gAgent.getPosGlobalFromAgent(gSky.getSunDirection() + joint_world_pos), shadow_pos, normal); 6184 gAgent.getPosGlobalFromAgent(gSky.getSunDirection() + joint_world_pos), shadow_pos, normal);
6174 shadow_pos_agent = gAgent.getPosAgentFromGlobal(shadow_pos); 6185 shadow_pos_agent = gAgent.getPosAgentFromGlobal(shadow_pos);
6175 foot_height = joint_world_pos.mV[VZ] - shadow_pos_agent.mV[VZ]; 6186 foot_height = joint_world_pos.mV[VZ] - shadow_pos_agent.mV[VZ];
@@ -6193,7 +6204,7 @@ void LLVOAvatar::updateShadowFaces()
6193 //foot_to_knee.normalize(); 6204 //foot_to_knee.normalize();
6194 foot_to_knee -= projected_vec(foot_to_knee, sun_vec); 6205 foot_to_knee -= projected_vec(foot_to_knee, sun_vec);
6195 sprite.setYaw(azimuth(sun_vec - foot_to_knee)); 6206 sprite.setYaw(azimuth(sun_vec - foot_to_knee));
6196 6207
6197 sprite.updateFace(*face0p); 6208 sprite.updateFace(*face0p);
6198 } 6209 }
6199 6210
@@ -6202,7 +6213,7 @@ void LLVOAvatar::updateShadowFaces()
6202 LLVector3 joint_world_pos = mFootRightp->getWorldPosition(); 6213 LLVector3 joint_world_pos = mFootRightp->getWorldPosition();
6203 // this only does a ray straight down from the foot, as our client-side ray-tracing is very limited now 6214 // this only does a ray straight down from the foot, as our client-side ray-tracing is very limited now
6204 // but we make an explicit ray trace call in expectation of future improvements 6215 // but we make an explicit ray trace call in expectation of future improvements
6205 resolveRayCollisionAgent(gAgent.getPosGlobalFromAgent(joint_world_pos), 6216 resolveRayCollisionAgent(gAgent.getPosGlobalFromAgent(joint_world_pos),
6206 gAgent.getPosGlobalFromAgent(gSky.getSunDirection() + joint_world_pos), shadow_pos, normal); 6217 gAgent.getPosGlobalFromAgent(gSky.getSunDirection() + joint_world_pos), shadow_pos, normal);
6207 shadow_pos_agent = gAgent.getPosAgentFromGlobal(shadow_pos); 6218 shadow_pos_agent = gAgent.getPosAgentFromGlobal(shadow_pos);
6208 foot_height = joint_world_pos.mV[VZ] - shadow_pos_agent.mV[VZ]; 6219 foot_height = joint_world_pos.mV[VZ] - shadow_pos_agent.mV[VZ];
@@ -6226,7 +6237,7 @@ void LLVOAvatar::updateShadowFaces()
6226 //foot_to_knee.normalize(); 6237 //foot_to_knee.normalize();
6227 foot_to_knee -= projected_vec(foot_to_knee, sun_vec); 6238 foot_to_knee -= projected_vec(foot_to_knee, sun_vec);
6228 sprite.setYaw(azimuth(sun_vec - foot_to_knee)); 6239 sprite.setYaw(azimuth(sun_vec - foot_to_knee));
6229 6240
6230 sprite.updateFace(*face1p); 6241 sprite.updateFace(*face1p);
6231 } 6242 }
6232 } 6243 }
@@ -6259,14 +6270,13 @@ void LLVOAvatar::hideSkirt()
6259 mMeshLOD[MESH_ID_SKIRT]->setVisible(FALSE, TRUE); 6270 mMeshLOD[MESH_ID_SKIRT]->setVisible(FALSE, TRUE);
6260} 6271}
6261 6272
6262
6263//----------------------------------------------------------------------------- 6273//-----------------------------------------------------------------------------
6264// requestLayerSetUpdate() 6274// requestLayerSetUpdate()
6265//----------------------------------------------------------------------------- 6275//-----------------------------------------------------------------------------
6266void LLVOAvatar::requestLayerSetUpdate(ETextureIndex index ) 6276void LLVOAvatar::requestLayerSetUpdate(ETextureIndex index )
6267{ 6277{
6268 /* switch(index) 6278 /* switch(index)
6269 case LOCTEX_UPPER_BODYPAINT: 6279 case LOCTEX_UPPER_BODYPAINT:
6270 case LOCTEX_UPPER_SHIRT: 6280 case LOCTEX_UPPER_SHIRT:
6271 if( mUpperBodyLayerSet ) 6281 if( mUpperBodyLayerSet )
6272 mUpperBodyLayerSet->requestUpdate(); */ 6282 mUpperBodyLayerSet->requestUpdate(); */
@@ -6352,7 +6362,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
6352 if (mIsSelf) 6362 if (mIsSelf)
6353 { 6363 {
6354 updateAttachmentVisibility(gAgent.getCameraMode()); 6364 updateAttachmentVisibility(gAgent.getCameraMode());
6355 6365
6356// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a 6366// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a
6357 if (rlv_handler_t::isEnabled()) 6367 if (rlv_handler_t::isEnabled())
6358 { 6368 {
@@ -6374,7 +6384,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
6374void LLVOAvatar::lazyAttach() 6384void LLVOAvatar::lazyAttach()
6375{ 6385{
6376 std::vector<LLPointer<LLViewerObject> > still_pending; 6386 std::vector<LLPointer<LLViewerObject> > still_pending;
6377 6387
6378 for (U32 i = 0; i < mPendingAttachment.size(); i++) 6388 for (U32 i = 0; i < mPendingAttachment.size(); i++)
6379 { 6389 {
6380 if (mPendingAttachment[i]->mDrawable) 6390 if (mPendingAttachment[i]->mDrawable)
@@ -6392,7 +6402,7 @@ void LLVOAvatar::lazyAttach()
6392 6402
6393void LLVOAvatar::resetHUDAttachments() 6403void LLVOAvatar::resetHUDAttachments()
6394{ 6404{
6395 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 6405 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
6396 iter != mAttachmentPoints.end(); ) 6406 iter != mAttachmentPoints.end(); )
6397 { 6407 {
6398 attachment_map_t::iterator curiter = iter++; 6408 attachment_map_t::iterator curiter = iter++;
@@ -6413,7 +6423,7 @@ void LLVOAvatar::resetHUDAttachments()
6413//----------------------------------------------------------------------------- 6423//-----------------------------------------------------------------------------
6414BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) 6424BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
6415{ 6425{
6416 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 6426 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
6417 iter != mAttachmentPoints.end(); ) 6427 iter != mAttachmentPoints.end(); )
6418 { 6428 {
6419 attachment_map_t::iterator curiter = iter++; 6429 attachment_map_t::iterator curiter = iter++;
@@ -6463,7 +6473,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
6463 } 6473 }
6464 } 6474 }
6465 6475
6466 6476
6467 return FALSE; 6477 return FALSE;
6468} 6478}
6469 6479
@@ -6526,10 +6536,10 @@ void LLVOAvatar::getOffObject()
6526 { 6536 {
6527 return; 6537 return;
6528 } 6538 }
6529 6539
6530 LLViewerObject* sit_object = (LLViewerObject*)getParent(); 6540 LLViewerObject* sit_object = (LLViewerObject*)getParent();
6531 6541
6532 if (sit_object) 6542 if (sit_object)
6533 { 6543 {
6534 stopMotionFromSource(sit_object->getID()); 6544 stopMotionFromSource(sit_object->getID());
6535 LLFollowCamMgr::setCameraActive(sit_object->getID(), FALSE); 6545 LLFollowCamMgr::setCameraActive(sit_object->getID(), FALSE);
@@ -6551,8 +6561,8 @@ void LLVOAvatar::getOffObject()
6551 6561
6552 // set *local* position based on last *world* position, since we're unparenting the avatar 6562 // set *local* position based on last *world* position, since we're unparenting the avatar
6553 mDrawable->mXform.setPosition(cur_position_world); 6563 mDrawable->mXform.setPosition(cur_position_world);
6554 mDrawable->mXform.setRotation(cur_rotation_world); 6564 mDrawable->mXform.setRotation(cur_rotation_world);
6555 6565
6556 gPipeline.markMoved(mDrawable, TRUE); 6566 gPipeline.markMoved(mDrawable, TRUE);
6557 6567
6558 mIsSitting = FALSE; 6568 mIsSitting = FALSE;
@@ -6617,7 +6627,7 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj )
6617//----------------------------------------------------------------------------- 6627//-----------------------------------------------------------------------------
6618BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id ) 6628BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id )
6619{ 6629{
6620 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 6630 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
6621 iter != mAttachmentPoints.end(); ) 6631 iter != mAttachmentPoints.end(); )
6622 { 6632 {
6623 attachment_map_t::iterator curiter = iter++; 6633 attachment_map_t::iterator curiter = iter++;
@@ -6635,7 +6645,7 @@ BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id )
6635//----------------------------------------------------------------------------- 6645//-----------------------------------------------------------------------------
6636LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id ) 6646LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id )
6637{ 6647{
6638 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 6648 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
6639 iter != mAttachmentPoints.end(); ) 6649 iter != mAttachmentPoints.end(); )
6640 { 6650 {
6641 attachment_map_t::iterator curiter = iter++; 6651 attachment_map_t::iterator curiter = iter++;
@@ -6666,7 +6676,7 @@ const std::string LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id)
6666 6676
6667 6677
6668//----------------------------------------------------------------------------- 6678//-----------------------------------------------------------------------------
6669// static 6679// static
6670// onLocalTextureLoaded() 6680// onLocalTextureLoaded()
6671//----------------------------------------------------------------------------- 6681//-----------------------------------------------------------------------------
6672 6682
@@ -6732,7 +6742,7 @@ void LLVOAvatar::updateComposites()
6732{ 6742{
6733 for (U32 i = 0; i < mBakedTextureData.size(); i++) 6743 for (U32 i = 0; i < mBakedTextureData.size(); i++)
6734 { 6744 {
6735 if ( mBakedTextureData[i].mTexLayerSet 6745 if ( mBakedTextureData[i].mTexLayerSet
6736 && ((i != BAKED_SKIRT) || isWearingWearableType( WT_SKIRT )) ) 6746 && ((i != BAKED_SKIRT) || isWearingWearableType( WT_SKIRT )) )
6737 { 6747 {
6738 mBakedTextureData[i].mTexLayerSet->updateComposite(); 6748 mBakedTextureData[i].mTexLayerSet->updateComposite();
@@ -6828,7 +6838,7 @@ void LLVOAvatar::onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_
6828{ 6838{
6829 if( global_color == mTexSkinColor ) 6839 if( global_color == mTexSkinColor )
6830 { 6840 {
6831// llinfos << "invalidateComposite cause: onGlobalColorChanged( skin color )" << llendl; 6841// llinfos << "invalidateComposite cause: onGlobalColorChanged( skin color )" << llendl;
6832 invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); 6842 invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user );
6833 invalidateComposite( mBakedTextureData[BAKED_UPPER].mTexLayerSet, set_by_user ); 6843 invalidateComposite( mBakedTextureData[BAKED_UPPER].mTexLayerSet, set_by_user );
6834 invalidateComposite( mBakedTextureData[BAKED_LOWER].mTexLayerSet, set_by_user ); 6844 invalidateComposite( mBakedTextureData[BAKED_LOWER].mTexLayerSet, set_by_user );
@@ -6836,10 +6846,10 @@ void LLVOAvatar::onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_
6836 else 6846 else
6837 if( global_color == mTexHairColor ) 6847 if( global_color == mTexHairColor )
6838 { 6848 {
6839// llinfos << "invalidateComposite cause: onGlobalColorChanged( hair color )" << llendl; 6849// llinfos << "invalidateComposite cause: onGlobalColorChanged( hair color )" << llendl;
6840 invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); 6850 invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user );
6841 invalidateComposite( mBakedTextureData[BAKED_HAIR].mTexLayerSet, set_by_user ); 6851 invalidateComposite( mBakedTextureData[BAKED_HAIR].mTexLayerSet, set_by_user );
6842 6852
6843 // ! BACKWARDS COMPATIBILITY ! 6853 // ! BACKWARDS COMPATIBILITY !
6844 // Fix for dealing with avatars from viewers that don't bake hair. 6854 // Fix for dealing with avatars from viewers that don't bake hair.
6845 if (!isTextureDefined(mBakedTextureData[BAKED_HAIR].mTextureIndex)) 6855 if (!isTextureDefined(mBakedTextureData[BAKED_HAIR].mTextureIndex))
@@ -6854,7 +6864,7 @@ void LLVOAvatar::onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_
6854 else 6864 else
6855 if( global_color == mTexEyeColor ) 6865 if( global_color == mTexEyeColor )
6856 { 6866 {
6857// llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; 6867// llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl;
6858 invalidateComposite( mBakedTextureData[BAKED_EYES].mTexLayerSet, set_by_user ); 6868 invalidateComposite( mBakedTextureData[BAKED_EYES].mTexLayerSet, set_by_user );
6859 } 6869 }
6860 updateMeshTextures(); 6870 updateMeshTextures();
@@ -6900,7 +6910,7 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
6900 LLVOAvatar* self = gAgent.getAvatarObject(); 6910 LLVOAvatar* self = gAgent.getAvatarObject();
6901 if (!self) return; 6911 if (!self) return;
6902 6912
6903 // If this is a texture corresponding to one of our baked entries, 6913 // If this is a texture corresponding to one of our baked entries,
6904 // just rebake that layer set. 6914 // just rebake that layer set.
6905 BOOL found = FALSE; 6915 BOOL found = FALSE;
6906 6916
@@ -6998,7 +7008,7 @@ BOOL LLVOAvatar::getLocalTextureGL(ETextureIndex index, LLImageGL** image_gl_pp)
6998const LLUUID& LLVOAvatar::getLocalTextureID(ETextureIndex index) 7008const LLUUID& LLVOAvatar::getLocalTextureID(ETextureIndex index)
6999{ 7009{
7000 if (!isIndexLocalTexture(index)) return IMG_DEFAULT_AVATAR; 7010 if (!isIndexLocalTexture(index)) return IMG_DEFAULT_AVATAR;
7001 7011
7002 if (mLocalTextureData[index].mImage.notNull()) 7012 if (mLocalTextureData[index].mImage.notNull())
7003 { 7013 {
7004 return mLocalTextureData[index].mImage->getID(); 7014 return mLocalTextureData[index].mImage->getID();
@@ -7046,7 +7056,7 @@ BOOL LLVOAvatar::updateIsFullyLoaded()
7046 loading = TRUE; 7056 loading = TRUE;
7047 } 7057 }
7048 7058
7049 // 7059 //
7050 if (mIsSelf) 7060 if (mIsSelf)
7051 { 7061 {
7052 if (!isTextureDefined(TEX_HAIR)) 7062 if (!isTextureDefined(TEX_HAIR))
@@ -7058,7 +7068,7 @@ BOOL LLVOAvatar::updateIsFullyLoaded()
7058 { 7068 {
7059 loading = TRUE; 7069 loading = TRUE;
7060 } 7070 }
7061 7071
7062 // special case to keep nudity off orientation island - 7072 // special case to keep nudity off orientation island -
7063 // this is fragilely dependent on the compositing system, 7073 // this is fragilely dependent on the compositing system,
7064 // which gets available textures in the following order: 7074 // which gets available textures in the following order:
@@ -7087,16 +7097,16 @@ BOOL LLVOAvatar::updateIsFullyLoaded()
7087 } 7097 }
7088 } 7098 }
7089 7099
7090 7100
7091 // we wait a little bit before giving the all clear, 7101 // we wait a little bit before giving the all clear,
7092 // to let textures settle down 7102 // to let textures settle down
7093 const F32 PAUSE = 1.f; 7103 const F32 PAUSE = 1.f;
7094 if (loading) 7104 if (loading)
7095 mFullyLoadedTimer.reset(); 7105 mFullyLoadedTimer.reset();
7096 7106
7097 mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > PAUSE); 7107 mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > PAUSE);
7098 7108
7099 7109
7100 // did our loading state "change" from last call? 7110 // did our loading state "change" from last call?
7101 const S32 UPDATE_RATE = 30; 7111 const S32 UPDATE_RATE = 30;
7102 BOOL changed = 7112 BOOL changed =
@@ -7192,8 +7202,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes )
7192 { 7202 {
7193 case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; 7203 case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break;
7194 case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; 7204 case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break;
7195// Support for GL_EXT_paletted_texture is deprecated 7205 case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break;
7196// case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break;
7197 case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; 7206 case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break;
7198 case GL_RGB: components = 3; internal_format = GL_RGB8; break; 7207 case GL_RGB: components = 3; internal_format = GL_RGB8; break;
7199 case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; 7208 case GL_RGBA: components = 4; internal_format = GL_RGBA8; break;
@@ -7201,7 +7210,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes )
7201 } 7210 }
7202 7211
7203 *texture_bytes = components * SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT; 7212 *texture_bytes = components * SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT;
7204 7213
7205 if( LLVOAvatar::sScratchTexNames.checkData( format ) ) 7214 if( LLVOAvatar::sScratchTexNames.checkData( format ) )
7206 { 7215 {
7207 return *( LLVOAvatar::sScratchTexNames.getData( format ) ); 7216 return *( LLVOAvatar::sScratchTexNames.getData( format ) );
@@ -7219,7 +7228,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes )
7219 stop_glerror(); 7228 stop_glerror();
7220 7229
7221 LLImageGL::setManualImage( 7230 LLImageGL::setManualImage(
7222 GL_TEXTURE_2D, 0, internal_format, 7231 GL_TEXTURE_2D, 0, internal_format,
7223 SCRATCH_TEX_WIDTH, SCRATCH_TEX_HEIGHT, 7232 SCRATCH_TEX_WIDTH, SCRATCH_TEX_HEIGHT,
7224 format, GL_UNSIGNED_BYTE, NULL ); 7233 format, GL_UNSIGNED_BYTE, NULL );
7225 stop_glerror(); 7234 stop_glerror();
@@ -7339,9 +7348,9 @@ void LLVOAvatar::updateMeshTextures()
7339 // When an avatar is changing clothes and not in Appearance mode, 7348 // When an avatar is changing clothes and not in Appearance mode,
7340 // use the last-known good baked texture until it finish the first 7349 // use the last-known good baked texture until it finish the first
7341 // render of the new layerset. 7350 // render of the new layerset.
7342 use_lkg_baked_layer[i] = (!is_layer_baked[i] 7351 use_lkg_baked_layer[i] = (!is_layer_baked[i]
7343 && (mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) 7352 && (mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR)
7344 && mBakedTextureData[i].mTexLayerSet 7353 && mBakedTextureData[i].mTexLayerSet
7345 && !mBakedTextureData[i].mTexLayerSet->getComposite()->isInitialized()); 7354 && !mBakedTextureData[i].mTexLayerSet->getComposite()->isInitialized());
7346 if (use_lkg_baked_layer[i]) 7355 if (use_lkg_baked_layer[i])
7347 { 7356 {
@@ -7350,7 +7359,7 @@ void LLVOAvatar::updateMeshTextures()
7350 } 7359 }
7351 else 7360 else
7352 { 7361 {
7353 use_lkg_baked_layer[i] = (!is_layer_baked[i] 7362 use_lkg_baked_layer[i] = (!is_layer_baked[i]
7354 && mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); 7363 && mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR);
7355 if (mBakedTextureData[i].mTexLayerSet) 7364 if (mBakedTextureData[i].mTexLayerSet)
7356 { 7365 {
@@ -7366,7 +7375,7 @@ void LLVOAvatar::updateMeshTextures()
7366 { 7375 {
7367 llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; 7376 llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl;
7368 } 7377 }
7369 7378
7370 for (U32 i=0; i < mBakedTextureData.size(); i++) 7379 for (U32 i=0; i < mBakedTextureData.size(); i++)
7371 { 7380 {
7372 if (use_lkg_baked_layer[i] && !self_customizing ) 7381 if (use_lkg_baked_layer[i] && !self_customizing )
@@ -7391,7 +7400,7 @@ void LLVOAvatar::updateMeshTextures()
7391 mBakedTextureData[i].mIsLoaded = FALSE; 7400 mBakedTextureData[i].mIsLoaded = FALSE;
7392 if ( (i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER) ) 7401 if ( (i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER) )
7393 { 7402 {
7394 baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); 7403 baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ));
7395 } 7404 }
7396 baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) ); 7405 baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) );
7397 } 7406 }
@@ -7402,7 +7411,7 @@ void LLVOAvatar::updateMeshTextures()
7402 { 7411 {
7403 mBakedTextureData[i].mTexLayerSet->createComposite(); 7412 mBakedTextureData[i].mTexLayerSet->createComposite();
7404 mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( TRUE ); 7413 mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( TRUE );
7405 mBakedTextureData[i].mIsUsed = FALSE; 7414 mBakedTextureData[i].mIsUsed = FALSE;
7406 for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) 7415 for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++)
7407 { 7416 {
7408 mBakedTextureData[i].mMeshes[k]->setLayerSet( mBakedTextureData[i].mTexLayerSet ); 7417 mBakedTextureData[i].mMeshes[k]->setLayerSet( mBakedTextureData[i].mTexLayerSet );
@@ -7423,12 +7432,12 @@ void LLVOAvatar::updateMeshTextures()
7423 mBakedTextureData[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); 7432 mBakedTextureData[BAKED_HAIR].mMeshes[i]->setTexture( hair_img );
7424 } 7433 }
7425 mHasBakedHair = FALSE; 7434 mHasBakedHair = FALSE;
7426 } 7435 }
7427 else 7436 else
7428 { 7437 {
7429 mHasBakedHair = TRUE; 7438 mHasBakedHair = TRUE;
7430 } 7439 }
7431 7440
7432 /* // Head 7441 /* // Head
7433 BOOL head_baked_ready = (is_layer_baked[BAKED_HEAD] && mBakedTextureData[BAKED_HEAD].mIsLoaded) || other_culled; 7442 BOOL head_baked_ready = (is_layer_baked[BAKED_HEAD] && mBakedTextureData[BAKED_HEAD].mIsLoaded) || other_culled;
7434 setLocalTexture( TEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), head_baked_ready ); */ 7443 setLocalTexture( TEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), head_baked_ready ); */
@@ -7438,7 +7447,7 @@ void LLVOAvatar::updateMeshTextures()
7438 { 7447 {
7439 const EBakedTextureIndex baked_index = baked_iter->first; 7448 const EBakedTextureIndex baked_index = baked_iter->first;
7440 const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; 7449 const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second;
7441 7450
7442 for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); 7451 for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
7443 local_tex_iter != baked_dict->mLocalTextures.end(); 7452 local_tex_iter != baked_dict->mLocalTextures.end();
7444 local_tex_iter++) 7453 local_tex_iter++)
@@ -7659,7 +7668,7 @@ ETextureIndex LLVOAvatar::getBakedTE( LLTexLayerSet* layerset )
7659void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) 7668void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
7660{ 7669{
7661 // Baked textures live on other sims. 7670 // Baked textures live on other sims.
7662 LLHost target_host = getObjectHost(); 7671 LLHost target_host = getObjectHost();
7663 setTEImage( te, gImageList.getImageFromHost( uuid, target_host ) ); 7672 setTEImage( te, gImageList.getImageFromHost( uuid, target_host ) );
7664 updateMeshTextures(); 7673 updateMeshTextures();
7665 dirtyMesh(); 7674 dirtyMesh();
@@ -7680,10 +7689,10 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
7680 { 7689 {
7681 llwarns << "New baked texture: unknown te " << te << llendl; 7690 llwarns << "New baked texture: unknown te " << te << llendl;
7682 } 7691 }
7683 7692
7684 // dumpAvatarTEs( "setNewBakedTexture() send" ); 7693 // dumpAvatarTEs( "setNewBakedTexture() send" );
7685 // RN: throttle uploads 7694 // RN: throttle uploads
7686 if (!hasPendingBakedUploads()) 7695 // if (!hasPendingBakedUploads())//update bit by bit better than delaying
7687 { 7696 {
7688 gAgent.sendAgentSetAppearance(); 7697 gAgent.sendAgentSetAppearance();
7689 } 7698 }
@@ -7743,8 +7752,10 @@ void LLVOAvatar::releaseUnnecessaryTextures()
7743 { 7752 {
7744 const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); 7753 const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
7745 // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID 7754 // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID
7746 if(baked_index == BAKED_HEAD)//for client detection 7755 if(baked_index == BAKED_HEAD)//for client detection
7747 continue; 7756 continue;
7757 if(baked_index == BAKED_EYES)
7758 continue;
7748 if (!isTextureDefined(bakedDicEntry->mTextureIndex) 7759 if (!isTextureDefined(bakedDicEntry->mTextureIndex)
7749 && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) )) 7760 && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ))
7750 { 7761 {
@@ -7765,8 +7776,8 @@ void LLVOAvatar::releaseUnnecessaryTextures()
7765//----------------------------------------------------------------------------- 7776//-----------------------------------------------------------------------------
7766void LLVOAvatar::onCustomizeStart() 7777void LLVOAvatar::onCustomizeStart()
7767{ 7778{
7768 // We're no longer doing any baking or invalidating on entering 7779 // We're no longer doing any baking or invalidating on entering
7769 // appearance editing mode. Leaving function in place in case 7780 // appearance editing mode. Leaving function in place in case
7770 // further changes require us to do something at this point - Nyx 7781 // further changes require us to do something at this point - Nyx
7771} 7782}
7772 7783
@@ -7848,7 +7859,7 @@ BOOL LLVOAvatar::teToColorParams( ETextureIndex te, const char* param_name[3] )
7848 param_name[1] = "undershirt_green"; 7859 param_name[1] = "undershirt_green";
7849 param_name[2] = "undershirt_blue"; 7860 param_name[2] = "undershirt_blue";
7850 break; 7861 break;
7851 7862
7852 case TEX_LOWER_UNDERPANTS: 7863 case TEX_LOWER_UNDERPANTS:
7853 param_name[0] = "underpants_red"; 7864 param_name[0] = "underpants_red";
7854 param_name[1] = "underpants_green"; 7865 param_name[1] = "underpants_green";
@@ -7897,7 +7908,7 @@ LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te )
7897 7908
7898 7909
7899void LLVOAvatar::dumpAvatarTEs( const std::string& context ) 7910void LLVOAvatar::dumpAvatarTEs( const std::string& context )
7900{ 7911{
7901 /* const char* te_name[] = { 7912 /* const char* te_name[] = {
7902 "TEX_HEAD_BODYPAINT ", 7913 "TEX_HEAD_BODYPAINT ",
7903 "TEX_UPPER_SHIRT ", */ 7914 "TEX_UPPER_SHIRT ", */
@@ -7936,7 +7947,7 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context )
7936//----------------------------------------------------------------------------- 7947//-----------------------------------------------------------------------------
7937void LLVOAvatar::updateAttachmentVisibility(U32 camera_mode) 7948void LLVOAvatar::updateAttachmentVisibility(U32 camera_mode)
7938{ 7949{
7939 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 7950 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
7940 iter != mAttachmentPoints.end(); ) 7951 iter != mAttachmentPoints.end(); )
7941 { 7952 {
7942 attachment_map_t::iterator curiter = iter++; 7953 attachment_map_t::iterator curiter = iter++;
@@ -8117,7 +8128,7 @@ void LLVOAvatar::wearableUpdated( EWearableType type )
8117 mBakedTextureData[index].mTexLayerSet->requestUpdate(); 8128 mBakedTextureData[index].mTexLayerSet->requestUpdate();
8118 mBakedTextureData[index].mTexLayerSet->requestUpload(); 8129 mBakedTextureData[index].mTexLayerSet->requestUpload();
8119 } 8130 }
8120 break; 8131 break;
8121 } 8132 }
8122 } 8133 }
8123 } 8134 }
@@ -8134,7 +8145,7 @@ void LLVOAvatar::clampAttachmentPositions()
8134 { 8145 {
8135 return; 8146 return;
8136 } 8147 }
8137 for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); 8148 for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
8138 iter != mAttachmentPoints.end(); ) 8149 iter != mAttachmentPoints.end(); )
8139 { 8150 {
8140 attachment_map_t::iterator curiter = iter++; 8151 attachment_map_t::iterator curiter = iter++;
@@ -8148,7 +8159,7 @@ void LLVOAvatar::clampAttachmentPositions()
8148 8159
8149BOOL LLVOAvatar::hasHUDAttachment() const 8160BOOL LLVOAvatar::hasHUDAttachment() const
8150{ 8161{
8151 for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); 8162 for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
8152 iter != mAttachmentPoints.end(); ) 8163 iter != mAttachmentPoints.end(); )
8153 { 8164 {
8154 attachment_map_t::const_iterator curiter = iter++; 8165 attachment_map_t::const_iterator curiter = iter++;
@@ -8164,7 +8175,7 @@ BOOL LLVOAvatar::hasHUDAttachment() const
8164LLBBox LLVOAvatar::getHUDBBox() const 8175LLBBox LLVOAvatar::getHUDBBox() const
8165{ 8176{
8166 LLBBox bbox; 8177 LLBBox bbox;
8167 for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); 8178 for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
8168 iter != mAttachmentPoints.end(); ) 8179 iter != mAttachmentPoints.end(); )
8169 { 8180 {
8170 attachment_map_t::const_iterator curiter = iter++; 8181 attachment_map_t::const_iterator curiter = iter++;
@@ -8236,7 +8247,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8236 llwarns << "Blocking AvatarAppearance message" << llendl; 8247 llwarns << "Blocking AvatarAppearance message" << llendl;
8237 return; 8248 return;
8238 } 8249 }
8239 8250
8240 LLMemType mt(LLMemType::MTYPE_AVATAR); 8251 LLMemType mt(LLMemType::MTYPE_AVATAR);
8241 8252
8242// llinfos << "processAvatarAppearance start " << mID << llendl; 8253// llinfos << "processAvatarAppearance start " << mID << llendl;
@@ -8269,7 +8280,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8269 // prevent the overwriting of valid baked textures with invalid baked textures 8280 // prevent the overwriting of valid baked textures with invalid baked textures
8270 for (U8 baked_index = 0; baked_index < mBakedTextureData.size(); baked_index++) 8281 for (U8 baked_index = 0; baked_index < mBakedTextureData.size(); baked_index++)
8271 { 8282 {
8272 if (!isTextureDefined(mBakedTextureData[baked_index].mTextureIndex) 8283 if (!isTextureDefined(mBakedTextureData[baked_index].mTextureIndex)
8273 && mBakedTextureData[baked_index].mLastTextureIndex != IMG_DEFAULT 8284 && mBakedTextureData[baked_index].mLastTextureIndex != IMG_DEFAULT
8274 && baked_index != BAKED_SKIRT) 8285 && baked_index != BAKED_SKIRT)
8275 { 8286 {
@@ -8285,7 +8296,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8285 // (isTextureDefined(TEX_SKIRT_BAKED) ? "SKIRT " : "skirt " ) << (getTEImage(TEX_SKIRT_BAKED)->getID()) << std::endl << 8296 // (isTextureDefined(TEX_SKIRT_BAKED) ? "SKIRT " : "skirt " ) << (getTEImage(TEX_SKIRT_BAKED)->getID()) << std::endl <<
8286 // (isTextureDefined(TEX_HAIR_BAKED) ? "HAIR" : "hair " ) << (getTEImage(TEX_HAIR_BAKED)->getID()) << std::endl << 8297 // (isTextureDefined(TEX_HAIR_BAKED) ? "HAIR" : "hair " ) << (getTEImage(TEX_HAIR_BAKED)->getID()) << std::endl <<
8287 // (isTextureDefined(TEX_EYES_BAKED) ? "EYES" : "eyes" ) << (getTEImage(TEX_EYES_BAKED)->getID()) << llendl ; 8298 // (isTextureDefined(TEX_EYES_BAKED) ? "EYES" : "eyes" ) << (getTEImage(TEX_EYES_BAKED)->getID()) << llendl ;
8288 8299
8289 if( !mFirstTEMessageReceived ) 8300 if( !mFirstTEMessageReceived )
8290 { 8301 {
8291 onFirstTEMessageReceived(); 8302 onFirstTEMessageReceived();
@@ -8297,7 +8308,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8297 { 8308 {
8298 releaseUnnecessaryTextures(); 8309 releaseUnnecessaryTextures();
8299 } 8310 }
8300 8311
8301 updateMeshTextures(); // enables updates for laysets without baked textures. 8312 updateMeshTextures(); // enables updates for laysets without baked textures.
8302 8313
8303 // parse visual params 8314 // parse visual params
@@ -8306,7 +8317,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8306 { 8317 {
8307 BOOL params_changed = FALSE; 8318 BOOL params_changed = FALSE;
8308 BOOL interp_params = FALSE; 8319 BOOL interp_params = FALSE;
8309 8320
8310 LLVisualParam* param = getFirstVisualParam(); 8321 LLVisualParam* param = getFirstVisualParam();
8311 if (!param) 8322 if (!param)
8312 { 8323 {
@@ -8320,7 +8331,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8320 { 8331 {
8321 param = getNextVisualParam(); 8332 param = getNextVisualParam();
8322 } 8333 }
8323 8334
8324 if( !param ) 8335 if( !param )
8325 { 8336 {
8326 llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl; 8337 llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file." << llendl;
@@ -8371,7 +8382,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8371 if( old_sex != new_sex ) 8382 if( old_sex != new_sex )
8372 { 8383 {
8373 updateSexDependentLayerSets( FALSE ); 8384 updateSexDependentLayerSets( FALSE );
8374 } 8385 }
8375 } 8386 }
8376 } 8387 }
8377 else 8388 else
@@ -8402,7 +8413,7 @@ void LLVOAvatar::getAnimLabels( LLDynamicArray<std::string>* labels )
8402 labels->put( "Away From Keyboard" ); 8413 labels->put( "Away From Keyboard" );
8403} 8414}
8404 8415
8405// static 8416// static
8406void LLVOAvatar::getAnimNames( LLDynamicArray<std::string>* names ) 8417void LLVOAvatar::getAnimNames( LLDynamicArray<std::string>* names )
8407{ 8418{
8408 S32 i; 8419 S32 i;
@@ -8423,7 +8434,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi,
8423 //llinfos << "onBakedTextureMasksLoaded: " << src_vi->getID() << llendl; 8434 //llinfos << "onBakedTextureMasksLoaded: " << src_vi->getID() << llendl;
8424 const LLMemType mt(LLMemType::MTYPE_AVATAR); 8435 const LLMemType mt(LLMemType::MTYPE_AVATAR);
8425 const LLUUID id = src_vi->getID(); 8436 const LLUUID id = src_vi->getID();
8426 8437
8427 LLTextureMaskData* maskData = (LLTextureMaskData*) userdata; 8438 LLTextureMaskData* maskData = (LLTextureMaskData*) userdata;
8428 LLVOAvatar* self = (LLVOAvatar*) gObjectList.findObject( maskData->mAvatarID ); 8439 LLVOAvatar* self = (LLVOAvatar*) gObjectList.findObject( maskData->mAvatarID );
8429 8440
@@ -8447,7 +8458,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi,
8447 stop_glerror(); 8458 stop_glerror();
8448 8459
8449 LLImageGL::setManualImage( 8460 LLImageGL::setManualImage(
8450 GL_TEXTURE_2D, 0, GL_ALPHA8, 8461 GL_TEXTURE_2D, 0, GL_ALPHA8,
8451 aux_src->getWidth(), aux_src->getHeight(), 8462 aux_src->getWidth(), aux_src->getHeight(),
8452 GL_ALPHA, GL_UNSIGNED_BYTE, aux_src->getData()); 8463 GL_ALPHA, GL_UNSIGNED_BYTE, aux_src->getData());
8453 stop_glerror(); 8464 stop_glerror();
@@ -8501,7 +8512,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi,
8501 } 8512 }
8502 else 8513 else
8503 { 8514 {
8504 // this can happen when someone uses an old baked texture possibly provided by 8515 // this can happen when someone uses an old baked texture possibly provided by
8505 // viewer-side baked texture caching 8516 // viewer-side baked texture caching
8506 llwarns << "Masks loaded callback but NO aux source!" << llendl; 8517 llwarns << "Masks loaded callback but NO aux source!" << llendl;
8507 } 8518 }
@@ -8627,7 +8638,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
8627 for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) 8638 for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
8628 { 8639 {
8629 LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; 8640 LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
8630 if( (viewer_param->getWearableType() == type) && 8641 if( (viewer_param->getWearableType() == type) &&
8631 (viewer_param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) ) 8642 (viewer_param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) )
8632 { 8643 {
8633 apr_file_printf( file, "\t\t<param id=\"%d\" name=\"%s\" value=\"%.3f\"/>\n", 8644 apr_file_printf( file, "\t\t<param id=\"%d\" name=\"%s\" value=\"%.3f\"/>\n",
@@ -8704,7 +8715,7 @@ struct CompareScreenAreaGreater
8704void LLVOAvatar::cullAvatarsByPixelArea() 8715void LLVOAvatar::cullAvatarsByPixelArea()
8705{ 8716{
8706 std::sort(LLCharacter::sInstances.begin(), LLCharacter::sInstances.end(), CompareScreenAreaGreater()); 8717 std::sort(LLCharacter::sInstances.begin(), LLCharacter::sInstances.end(), CompareScreenAreaGreater());
8707 8718
8708 // Update the avatars that have changed status 8719 // Update the avatars that have changed status
8709 U32 rank = 0; 8720 U32 rank = 0;
8710 for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); 8721 for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
@@ -8716,7 +8727,7 @@ void LLVOAvatar::cullAvatarsByPixelArea()
8716 { 8727 {
8717 culled = FALSE; 8728 culled = FALSE;
8718 } 8729 }
8719 else 8730 else
8720 { 8731 {
8721 culled = TRUE; 8732 culled = TRUE;
8722 } 8733 }
@@ -8882,7 +8893,7 @@ void LLVOAvatar::dumpLocalTextures()
8882 8893
8883 llinfos << "LocTex " << name << ": " 8894 llinfos << "LocTex " << name << ": "
8884 << "Discard " << image->getDiscardLevel() << ", " 8895 << "Discard " << image->getDiscardLevel() << ", "
8885 << "(" << image->getWidth() << ", " << image->getHeight() << ") " 8896 << "(" << image->getWidth() << ", " << image->getHeight() << ") "
8886#if !LL_RELEASE_FOR_DOWNLOAD 8897#if !LL_RELEASE_FOR_DOWNLOAD
8887 // End users don't get to trivially see avatar texture IDs, 8898 // End users don't get to trivially see avatar texture IDs,
8888 // makes textures easier to steal 8899 // makes textures easier to steal
@@ -8912,7 +8923,7 @@ void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound)
8912 8923
8913 8924
8914void LLVOAvatar::removeMissingBakedTextures() 8925void LLVOAvatar::removeMissingBakedTextures()
8915{ 8926{
8916 if (!mIsSelf) return; 8927 if (!mIsSelf) return;
8917 8928
8918 BOOL removed = FALSE; 8929 BOOL removed = FALSE;
@@ -8950,13 +8961,13 @@ LLVOAvatarXmlInfo::LLVOAvatarXmlInfo()
8950LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() 8961LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo()
8951{ 8962{
8952 std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); 8963 std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer());
8953 std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); 8964 std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer());
8954 std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer()); 8965 std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer());
8955 delete mTexSkinColorInfo; 8966 delete mTexSkinColorInfo;
8956 delete mTexHairColorInfo; 8967 delete mTexHairColorInfo;
8957 delete mTexEyeColorInfo; 8968 delete mTexEyeColorInfo;
8958 std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer()); 8969 std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());
8959 std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer()); 8970 std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer());
8960} 8971}
8961 8972
8962//----------------------------------------------------------------------------- 8973//-----------------------------------------------------------------------------
@@ -9002,7 +9013,7 @@ BOOL LLVOAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
9002 llwarns << "Bone without rotation" << llendl; 9013 llwarns << "Bone without rotation" << llendl;
9003 return FALSE; 9014 return FALSE;
9004 } 9015 }
9005 9016
9006 static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); 9017 static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
9007 if (!node->getFastAttributeVector3(scale_string, mScale)) 9018 if (!node->getFastAttributeVector3(scale_string, mScale))
9008 { 9019 {
@@ -9096,7 +9107,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root)
9096 } 9107 }
9097 continue; 9108 continue;
9098 } 9109 }
9099 9110
9100 LLPolySkeletalDistortionInfo *info = new LLPolySkeletalDistortionInfo; 9111 LLPolySkeletalDistortionInfo *info = new LLPolySkeletalDistortionInfo;
9101 if (!info->parseXml(child)) 9112 if (!info->parseXml(child))
9102 { 9113 {
@@ -9158,7 +9169,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root)
9158 9169
9159 static LLStdStringHandle slot_string = LLXmlTree::addAttributeString("pie_slice"); 9170 static LLStdStringHandle slot_string = LLXmlTree::addAttributeString("pie_slice");
9160 child->getFastAttributeS32(slot_string, info->mPieMenuSlice); 9171 child->getFastAttributeS32(slot_string, info->mPieMenuSlice);
9161 9172
9162 static LLStdStringHandle visible_in_first_person_string = LLXmlTree::addAttributeString("visible_in_first_person"); 9173 static LLStdStringHandle visible_in_first_person_string = LLXmlTree::addAttributeString("visible_in_first_person");
9163 child->getFastAttributeBOOL(visible_in_first_person_string, info->mVisibleFirstPerson); 9174 child->getFastAttributeBOOL(visible_in_first_person_string, info->mVisibleFirstPerson);
9164 9175
@@ -9190,7 +9201,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
9190 delete info; 9201 delete info;
9191 return FALSE; // Ignore this element 9202 return FALSE; // Ignore this element
9192 } 9203 }
9193 9204
9194 static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod"); 9205 static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod");
9195 if (!node->getFastAttributeS32( lod_string, info->mLOD )) 9206 if (!node->getFastAttributeS32( lod_string, info->mLOD ))
9196 { 9207 {
@@ -9209,7 +9220,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
9209 9220
9210 static LLStdStringHandle reference_string = LLXmlTree::addAttributeString("reference"); 9221 static LLStdStringHandle reference_string = LLXmlTree::addAttributeString("reference");
9211 node->getFastAttributeString( reference_string, info->mReferenceMeshName ); 9222 node->getFastAttributeString( reference_string, info->mReferenceMeshName );
9212 9223
9213 // attribute: min_pixel_area 9224 // attribute: min_pixel_area
9214 static LLStdStringHandle min_pixel_area_string = LLXmlTree::addAttributeString("min_pixel_area"); 9225 static LLStdStringHandle min_pixel_area_string = LLXmlTree::addAttributeString("min_pixel_area");
9215 static LLStdStringHandle min_pixel_width_string = LLXmlTree::addAttributeString("min_pixel_width"); 9226 static LLStdStringHandle min_pixel_width_string = LLXmlTree::addAttributeString("min_pixel_width");
@@ -9223,7 +9234,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
9223 } 9234 }
9224 info->mMinPixelArea = min_pixel_area; 9235 info->mMinPixelArea = min_pixel_area;
9225 } 9236 }
9226 9237
9227 // Parse visual params for this node only if we haven't already 9238 // Parse visual params for this node only if we haven't already
9228 for (LLXmlTreeNode* child = node->getChildByName( "param" ); 9239 for (LLXmlTreeNode* child = node->getChildByName( "param" );
9229 child; 9240 child;
@@ -9414,8 +9425,8 @@ std::string LLVOAvatar::getFullname() const
9414{ 9425{
9415 std::string name; 9426 std::string name;
9416 9427
9417 LLNameValue* first = getNVPair("FirstName"); 9428 LLNameValue* first = getNVPair("FirstName");
9418 LLNameValue* last = getNVPair("LastName"); 9429 LLNameValue* last = getNVPair("LastName");
9419 if (first && last) 9430 if (first && last)
9420 { 9431 {
9421 name += first->getString(); 9432 name += first->getString();
@@ -9491,7 +9502,7 @@ BOOL LLVOAvatar::updateLOD()
9491 mNeedsSkin = TRUE; 9502 mNeedsSkin = TRUE;
9492 mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY); 9503 mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY);
9493 } 9504 }
9494 9505
9495 updateVisibility(); 9506 updateVisibility();
9496 9507
9497 return res; 9508 return res;
@@ -9503,13 +9514,13 @@ U32 LLVOAvatar::getPartitionType() const
9503} 9514}
9504 9515
9505//static 9516//static
9506void LLVOAvatar::updateImpostors() 9517void LLVOAvatar::updateImpostors()
9507{ 9518{
9508 for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); 9519 for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
9509 iter != LLCharacter::sInstances.end(); ++iter) 9520 iter != LLCharacter::sInstances.end(); ++iter)
9510 { 9521 {
9511 LLVOAvatar* avatar = (LLVOAvatar*) *iter; 9522 LLVOAvatar* avatar = (LLVOAvatar*) *iter;
9512 9523
9513 if (!avatar->isDead() && avatar->needsImpostorUpdate() && avatar->isVisible() && avatar->isImpostor()) 9524 if (!avatar->isDead() && avatar->needsImpostorUpdate() && avatar->isVisible() && avatar->isImpostor())
9514 { 9525 {
9515 gPipeline.generateImpostor(avatar); 9526 gPipeline.generateImpostor(avatar);
@@ -9574,7 +9585,7 @@ void LLVOAvatar::idleUpdateRenderCost()
9574 std::set<LLUUID> textures; 9585 std::set<LLUUID> textures;
9575 9586
9576 attachment_map_t::const_iterator iter; 9587 attachment_map_t::const_iterator iter;
9577 for (iter = mAttachmentPoints.begin(); 9588 for (iter = mAttachmentPoints.begin();
9578 iter != mAttachmentPoints.end(); 9589 iter != mAttachmentPoints.end();
9579 ++iter) 9590 ++iter)
9580 { 9591 {