summaryrefslogtreecommitdiff
path: root/indra/llappearance
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llappearance')
-rw-r--r--indra/llappearance/llavatarappearance.cpp2983
-rw-r--r--indra/llappearance/llavatarappearance.h510
-rw-r--r--indra/llappearance/llavatarappearancedefines.cpp622
-rw-r--r--indra/llappearance/llavatarappearancedefines.h338
-rw-r--r--indra/llappearance/llavatarjoint.cpp324
-rw-r--r--indra/llappearance/llavatarjoint.h164
-rw-r--r--indra/llappearance/llavatarjointmesh.cpp300
-rw-r--r--indra/llappearance/llavatarjointmesh.h136
-rw-r--r--indra/llappearance/lldriverparam.cpp956
-rw-r--r--indra/llappearance/lldriverparam.h76
-rw-r--r--indra/llappearance/lljointpickname.h24
-rw-r--r--indra/llappearance/lllocaltextureobject.cpp194
-rw-r--r--indra/llappearance/lllocaltextureobject.h70
-rw-r--r--indra/llappearance/llpolymesh.cpp266
-rw-r--r--indra/llappearance/llpolymesh.h538
-rw-r--r--indra/llappearance/llpolymorph.cpp1206
-rw-r--r--indra/llappearance/llpolymorph.h172
-rw-r--r--indra/llappearance/llpolyskeletaldistortion.cpp82
-rw-r--r--indra/llappearance/llpolyskeletaldistortion.h104
-rw-r--r--indra/llappearance/lltexglobalcolor.cpp136
-rw-r--r--indra/llappearance/lltexglobalcolor.h58
-rw-r--r--indra/llappearance/lltexlayer.cpp2794
-rw-r--r--indra/llappearance/lltexlayer.h344
-rw-r--r--indra/llappearance/lltexlayerparams.cpp824
-rw-r--r--indra/llappearance/lltexlayerparams.h214
-rw-r--r--indra/llappearance/llviewervisualparam.cpp166
-rw-r--r--indra/llappearance/llviewervisualparam.h114
-rw-r--r--indra/llappearance/llwearable.cpp1192
-rw-r--r--indra/llappearance/llwearable.h162
-rw-r--r--indra/llappearance/llwearabledata.cpp436
-rw-r--r--indra/llappearance/llwearabledata.h104
-rw-r--r--indra/llappearance/llwearabletype.cpp106
-rw-r--r--indra/llappearance/llwearabletype.h86
33 files changed, 7889 insertions, 7912 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index b430c4c6aa..d73be024cf 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @File llavatarappearance.cpp
* @brief Implementation of LLAvatarAppearance class
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -61,29 +61,29 @@ const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0);
//------------------------------------------------------------------------
class LLAvatarBoneInfo
{
- friend class LLAvatarAppearance;
- friend class LLAvatarSkeletonInfo;
+ friend class LLAvatarAppearance;
+ friend class LLAvatarSkeletonInfo;
public:
- LLAvatarBoneInfo() : mIsJoint(FALSE) {}
- ~LLAvatarBoneInfo()
- {
- std::for_each(mChildren.begin(), mChildren.end(), DeletePointer());
- mChildren.clear();
- }
- BOOL parseXml(LLXmlTreeNode* node);
-
+ LLAvatarBoneInfo() : mIsJoint(FALSE) {}
+ ~LLAvatarBoneInfo()
+ {
+ std::for_each(mChildren.begin(), mChildren.end(), DeletePointer());
+ mChildren.clear();
+ }
+ BOOL parseXml(LLXmlTreeNode* node);
+
private:
- std::string mName;
+ std::string mName;
std::string mSupport;
std::string mAliases;
- BOOL mIsJoint;
- LLVector3 mPos;
+ BOOL mIsJoint;
+ LLVector3 mPos;
LLVector3 mEnd;
- LLVector3 mRot;
- LLVector3 mScale;
- LLVector3 mPivot;
- typedef std::vector<LLAvatarBoneInfo*> bones_t;
- bones_t mChildren;
+ LLVector3 mRot;
+ LLVector3 mScale;
+ LLVector3 mPivot;
+ typedef std::vector<LLAvatarBoneInfo*> bones_t;
+ bones_t mChildren;
};
//------------------------------------------------------------------------
@@ -92,25 +92,25 @@ private:
//------------------------------------------------------------------------
class LLAvatarSkeletonInfo
{
- friend class LLAvatarAppearance;
+ friend class LLAvatarAppearance;
public:
- LLAvatarSkeletonInfo() :
- mNumBones(0), mNumCollisionVolumes(0) {}
- ~LLAvatarSkeletonInfo()
- {
- std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer());
- mBoneInfoList.clear();
- }
- BOOL parseXml(LLXmlTreeNode* node);
- S32 getNumBones() const { return mNumBones; }
- S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; }
-
+ LLAvatarSkeletonInfo() :
+ mNumBones(0), mNumCollisionVolumes(0) {}
+ ~LLAvatarSkeletonInfo()
+ {
+ std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer());
+ mBoneInfoList.clear();
+ }
+ BOOL parseXml(LLXmlTreeNode* node);
+ S32 getNumBones() const { return mNumBones; }
+ S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; }
+
private:
- S32 mNumBones;
- S32 mNumCollisionVolumes;
+ S32 mNumBones;
+ S32 mNumCollisionVolumes;
LLAvatarAppearance::joint_alias_map_t mJointAliasMap;
- typedef std::vector<LLAvatarBoneInfo*> bone_info_list_t;
- bone_info_list_t mBoneInfoList;
+ typedef std::vector<LLAvatarBoneInfo*> bone_info_list_t;
+ bone_info_list_t mBoneInfoList;
};
//-----------------------------------------------------------------------------
@@ -118,33 +118,33 @@ private:
//-----------------------------------------------------------------------------
LLAvatarAppearance::LLAvatarXmlInfo::LLAvatarXmlInfo()
- : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0)
+ : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0)
{
}
LLAvatarAppearance::LLAvatarXmlInfo::~LLAvatarXmlInfo()
{
- std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer());
- mMeshInfoList.clear();
+ std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer());
+ mMeshInfoList.clear();
- std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer());
- mSkeletalDistortionInfoList.clear();
+ std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer());
+ mSkeletalDistortionInfoList.clear();
- std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer());
- mAttachmentInfoList.clear();
+ std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer());
+ mAttachmentInfoList.clear();
- delete_and_clear(mTexSkinColorInfo);
- delete_and_clear(mTexHairColorInfo);
- delete_and_clear(mTexEyeColorInfo);
+ delete_and_clear(mTexSkinColorInfo);
+ delete_and_clear(mTexHairColorInfo);
+ delete_and_clear(mTexEyeColorInfo);
- std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());
- mLayerInfoList.clear();
+ std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());
+ mLayerInfoList.clear();
- std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer());
- mDriverInfoList.clear();
+ std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer());
+ mDriverInfoList.clear();
- std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer());
- mMorphMaskInfoList.clear();
+ std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer());
+ mMorphMaskInfoList.clear();
}
@@ -163,102 +163,102 @@ LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* LLAvatarAppearance::sAv
LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
- LLCharacter(),
- mIsDummy(FALSE),
- mTexSkinColor( NULL ),
- mTexHairColor( NULL ),
- mTexEyeColor( NULL ),
- mPelvisToFoot(0.f),
- mHeadOffset(),
- mRoot(NULL),
- mWearableData(wearable_data),
+ LLCharacter(),
+ mIsDummy(FALSE),
+ mTexSkinColor( NULL ),
+ mTexHairColor( NULL ),
+ mTexEyeColor( NULL ),
+ mPelvisToFoot(0.f),
+ mHeadOffset(),
+ mRoot(NULL),
+ mWearableData(wearable_data),
mNumBones(0),
mNumCollisionVolumes(0),
mCollisionVolumes(NULL),
mIsBuilt(FALSE),
mInitFlags(0)
{
- llassert_always(mWearableData);
- mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++ )
- {
- mBakedTextureDatas[i].mLastTextureID = IMG_DEFAULT_AVATAR;
- mBakedTextureDatas[i].mTexLayerSet = NULL;
- mBakedTextureDatas[i].mIsLoaded = false;
- mBakedTextureDatas[i].mIsUsed = false;
- mBakedTextureDatas[i].mMaskTexName = 0;
- mBakedTextureDatas[i].mTextureIndex = sAvatarDictionary->bakedToLocalTextureIndex((LLAvatarAppearanceDefines::EBakedTextureIndex)i);
- }
+ llassert_always(mWearableData);
+ mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++ )
+ {
+ mBakedTextureDatas[i].mLastTextureID = IMG_DEFAULT_AVATAR;
+ mBakedTextureDatas[i].mTexLayerSet = NULL;
+ mBakedTextureDatas[i].mIsLoaded = false;
+ mBakedTextureDatas[i].mIsUsed = false;
+ mBakedTextureDatas[i].mMaskTexName = 0;
+ mBakedTextureDatas[i].mTextureIndex = sAvatarDictionary->bakedToLocalTextureIndex((LLAvatarAppearanceDefines::EBakedTextureIndex)i);
+ }
}
// virtual
void LLAvatarAppearance::initInstance()
{
- //-------------------------------------------------------------------------
- // initialize joint, mesh and shape members
- //-------------------------------------------------------------------------
- mRoot = createAvatarJoint();
- mRoot->setName( "mRoot" );
-
- for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
- {
- const EMeshIndex mesh_index = mesh_pair.first;
- const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
- LLAvatarJoint* joint = createAvatarJoint();
- joint->setName(mesh_dict->mName);
- joint->setMeshID(mesh_index);
- mMeshLOD.push_back(joint);
-
- /* mHairLOD.setName("mHairLOD");
- mHairMesh0.setName("mHairMesh0");
- mHairMesh0.setMeshID(MESH_ID_HAIR);
- mHairMesh1.setName("mHairMesh1"); */
- for (U32 lod = 0; lod < mesh_dict->mLOD; lod++)
- {
- LLAvatarJointMesh* mesh = createAvatarJointMesh();
- std::string mesh_name = "m" + mesh_dict->mName + std::to_string(lod);
- // We pre-pended an m - need to capitalize first character for camelCase
- mesh_name[1] = toupper(mesh_name[1]);
- mesh->setName(mesh_name);
- mesh->setMeshID(mesh_index);
- mesh->setPickName(mesh_dict->mPickName);
- mesh->setIsTransparent(FALSE);
- switch((S32)mesh_index)
- {
- case MESH_ID_HAIR:
- mesh->setIsTransparent(TRUE);
- break;
- case MESH_ID_SKIRT:
- mesh->setIsTransparent(TRUE);
- break;
- case MESH_ID_EYEBALL_LEFT:
- case MESH_ID_EYEBALL_RIGHT:
- mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f );
- break;
- }
-
- joint->mMeshParts.push_back(mesh);
- }
- }
-
- //-------------------------------------------------------------------------
- // associate baked textures with meshes
- //-------------------------------------------------------------------------
- for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
- {
- const EMeshIndex mesh_index = mesh_pair.first;
- const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
- const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID;
- // Skip it if there's no associated baked texture.
- if (baked_texture_index == BAKED_NUM_INDICES) continue;
-
- for (LLAvatarJointMesh* mesh : mMeshLOD[mesh_index]->mMeshParts)
- {
- mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh);
- }
- }
-
- buildCharacter();
+ //-------------------------------------------------------------------------
+ // initialize joint, mesh and shape members
+ //-------------------------------------------------------------------------
+ mRoot = createAvatarJoint();
+ mRoot->setName( "mRoot" );
+
+ for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
+ {
+ const EMeshIndex mesh_index = mesh_pair.first;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
+ LLAvatarJoint* joint = createAvatarJoint();
+ joint->setName(mesh_dict->mName);
+ joint->setMeshID(mesh_index);
+ mMeshLOD.push_back(joint);
+
+ /* mHairLOD.setName("mHairLOD");
+ mHairMesh0.setName("mHairMesh0");
+ mHairMesh0.setMeshID(MESH_ID_HAIR);
+ mHairMesh1.setName("mHairMesh1"); */
+ for (U32 lod = 0; lod < mesh_dict->mLOD; lod++)
+ {
+ LLAvatarJointMesh* mesh = createAvatarJointMesh();
+ std::string mesh_name = "m" + mesh_dict->mName + std::to_string(lod);
+ // We pre-pended an m - need to capitalize first character for camelCase
+ mesh_name[1] = toupper(mesh_name[1]);
+ mesh->setName(mesh_name);
+ mesh->setMeshID(mesh_index);
+ mesh->setPickName(mesh_dict->mPickName);
+ mesh->setIsTransparent(FALSE);
+ switch((S32)mesh_index)
+ {
+ case MESH_ID_HAIR:
+ mesh->setIsTransparent(TRUE);
+ break;
+ case MESH_ID_SKIRT:
+ mesh->setIsTransparent(TRUE);
+ break;
+ case MESH_ID_EYEBALL_LEFT:
+ case MESH_ID_EYEBALL_RIGHT:
+ mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f );
+ break;
+ }
+
+ joint->mMeshParts.push_back(mesh);
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ // associate baked textures with meshes
+ //-------------------------------------------------------------------------
+ for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
+ {
+ const EMeshIndex mesh_index = mesh_pair.first;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
+ const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID;
+ // Skip it if there's no associated baked texture.
+ if (baked_texture_index == BAKED_NUM_INDICES) continue;
+
+ for (LLAvatarJointMesh* mesh : mMeshLOD[mesh_index]->mMeshParts)
+ {
+ mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh);
+ }
+ }
+
+ buildCharacter();
mInitFlags |= 1<<0;
@@ -267,42 +267,42 @@ void LLAvatarAppearance::initInstance()
// virtual
LLAvatarAppearance::~LLAvatarAppearance()
{
- delete_and_clear(mTexSkinColor);
- delete_and_clear(mTexHairColor);
- delete_and_clear(mTexEyeColor);
-
- for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
- {
- delete_and_clear(mBakedTextureDatas[i].mTexLayerSet);
- mBakedTextureDatas[i].mJointMeshes.clear();
-
- for (LLMaskedMorph* masked_morph : mBakedTextureDatas[i].mMaskedMorphs)
- {
- delete masked_morph;
- }
- }
-
- if (mRoot)
- {
- mRoot->removeAllChildren();
- delete mRoot;
- mRoot = nullptr;
- }
- mJointMap.clear();
-
- clearSkeleton();
- delete_and_clear_array(mCollisionVolumes);
-
- std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer());
- mPolyMeshes.clear();
-
- for (LLAvatarJoint* joint : mMeshLOD)
- {
- std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer());
- joint->mMeshParts.clear();
- }
- std::for_each(mMeshLOD.begin(), mMeshLOD.end(), DeletePointer());
- mMeshLOD.clear();
+ delete_and_clear(mTexSkinColor);
+ delete_and_clear(mTexHairColor);
+ delete_and_clear(mTexEyeColor);
+
+ for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
+ {
+ delete_and_clear(mBakedTextureDatas[i].mTexLayerSet);
+ mBakedTextureDatas[i].mJointMeshes.clear();
+
+ for (LLMaskedMorph* masked_morph : mBakedTextureDatas[i].mMaskedMorphs)
+ {
+ delete masked_morph;
+ }
+ }
+
+ if (mRoot)
+ {
+ mRoot->removeAllChildren();
+ delete mRoot;
+ mRoot = nullptr;
+ }
+ mJointMap.clear();
+
+ clearSkeleton();
+ delete_and_clear_array(mCollisionVolumes);
+
+ std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer());
+ mPolyMeshes.clear();
+
+ for (LLAvatarJoint* joint : mMeshLOD)
+ {
+ std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer());
+ joint->mMeshParts.clear();
+ }
+ std::for_each(mMeshLOD.begin(), mMeshLOD.end(), DeletePointer());
+ mMeshLOD.clear();
}
//static
@@ -320,7 +320,7 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons
sAvatarDictionary = new LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary();
}
- std::string avatar_file_name;
+ std::string avatar_file_name;
if (!avatar_file_name_arg.empty())
{
@@ -330,49 +330,49 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons
{
avatar_file_name = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR + "_lad.xml");
}
- LLXmlTree xml_tree;
- BOOL success = xml_tree.parseFile( avatar_file_name, FALSE );
- if (!success)
- {
- LL_ERRS() << "Problem reading avatar configuration file:" << avatar_file_name << LL_ENDL;
- }
-
- // now sanity check xml file
- LLXmlTreeNode* root = xml_tree.getRoot();
- if (!root)
- {
- LL_ERRS() << "No root node found in avatar configuration file: " << avatar_file_name << LL_ENDL;
- return;
- }
-
- //-------------------------------------------------------------------------
- // <linden_avatar version="2.0"> (root)
- //-------------------------------------------------------------------------
- if( !root->hasName( "linden_avatar" ) )
- {
- LL_ERRS() << "Invalid avatar file header: " << avatar_file_name << LL_ENDL;
- }
-
- std::string version;
- static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
- if( !root->getFastAttributeString( version_string, version ) || ((version != "1.0") && (version != "2.0")))
- {
- LL_ERRS() << "Invalid avatar file version: " << version << " in file: " << avatar_file_name << LL_ENDL;
- }
-
- S32 wearable_def_version = 1;
- static LLStdStringHandle wearable_definition_version_string = LLXmlTree::addAttributeString("wearable_definition_version");
- root->getFastAttributeS32( wearable_definition_version_string, wearable_def_version );
- LLWearable::setCurrentDefinitionVersion( wearable_def_version );
-
- std::string mesh_file_name;
-
- LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" );
- if (!skeleton_node)
- {
- LL_ERRS() << "No skeleton in avatar configuration file: " << avatar_file_name << LL_ENDL;
- return;
- }
+ LLXmlTree xml_tree;
+ BOOL success = xml_tree.parseFile( avatar_file_name, FALSE );
+ if (!success)
+ {
+ LL_ERRS() << "Problem reading avatar configuration file:" << avatar_file_name << LL_ENDL;
+ }
+
+ // now sanity check xml file
+ LLXmlTreeNode* root = xml_tree.getRoot();
+ if (!root)
+ {
+ LL_ERRS() << "No root node found in avatar configuration file: " << avatar_file_name << LL_ENDL;
+ return;
+ }
+
+ //-------------------------------------------------------------------------
+ // <linden_avatar version="2.0"> (root)
+ //-------------------------------------------------------------------------
+ if( !root->hasName( "linden_avatar" ) )
+ {
+ LL_ERRS() << "Invalid avatar file header: " << avatar_file_name << LL_ENDL;
+ }
+
+ std::string version;
+ static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
+ if( !root->getFastAttributeString( version_string, version ) || ((version != "1.0") && (version != "2.0")))
+ {
+ LL_ERRS() << "Invalid avatar file version: " << version << " in file: " << avatar_file_name << LL_ENDL;
+ }
+
+ S32 wearable_def_version = 1;
+ static LLStdStringHandle wearable_definition_version_string = LLXmlTree::addAttributeString("wearable_definition_version");
+ root->getFastAttributeS32( wearable_definition_version_string, wearable_def_version );
+ LLWearable::setCurrentDefinitionVersion( wearable_def_version );
+
+ std::string mesh_file_name;
+
+ LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" );
+ if (!skeleton_node)
+ {
+ LL_ERRS() << "No skeleton in avatar configuration file: " << avatar_file_name << LL_ENDL;
+ return;
+ }
std::string skeleton_file_name = skeleton_file_name_arg;
if (skeleton_file_name.empty())
@@ -383,62 +383,62 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons
LL_ERRS() << "No file name in skeleton node in avatar config file: " << avatar_file_name << LL_ENDL;
}
}
-
- std::string skeleton_path;
- LLXmlTree skeleton_xml_tree;
- skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name);
- if (!parseSkeletonFile(skeleton_path, skeleton_xml_tree))
- {
- LL_ERRS() << "Error parsing skeleton file: " << skeleton_path << LL_ENDL;
- }
-
- // Process XML data
-
- // avatar_skeleton.xml
- if (sAvatarSkeletonInfo)
- { //this can happen if a login attempt failed
- delete sAvatarSkeletonInfo;
- }
- sAvatarSkeletonInfo = new LLAvatarSkeletonInfo;
- if (!sAvatarSkeletonInfo->parseXml(skeleton_xml_tree.getRoot()))
- {
- LL_ERRS() << "Error parsing skeleton XML file: " << skeleton_path << LL_ENDL;
- }
- // parse avatar_lad.xml
- if (sAvatarXmlInfo)
- { //this can happen if a login attempt failed
- delete_and_clear(sAvatarXmlInfo);
- }
- sAvatarXmlInfo = new LLAvatarXmlInfo;
- if (!sAvatarXmlInfo->parseXmlSkeletonNode(root))
- {
- LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
- }
- if (!sAvatarXmlInfo->parseXmlMeshNodes(root))
- {
- LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
- }
- if (!sAvatarXmlInfo->parseXmlColorNodes(root))
- {
- LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
- }
- if (!sAvatarXmlInfo->parseXmlLayerNodes(root))
- {
- LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
- }
- if (!sAvatarXmlInfo->parseXmlDriverNodes(root))
- {
- LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
- }
- if (!sAvatarXmlInfo->parseXmlMorphNodes(root))
- {
- LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
- }
+
+ std::string skeleton_path;
+ LLXmlTree skeleton_xml_tree;
+ skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name);
+ if (!parseSkeletonFile(skeleton_path, skeleton_xml_tree))
+ {
+ LL_ERRS() << "Error parsing skeleton file: " << skeleton_path << LL_ENDL;
+ }
+
+ // Process XML data
+
+ // avatar_skeleton.xml
+ if (sAvatarSkeletonInfo)
+ { //this can happen if a login attempt failed
+ delete sAvatarSkeletonInfo;
+ }
+ sAvatarSkeletonInfo = new LLAvatarSkeletonInfo;
+ if (!sAvatarSkeletonInfo->parseXml(skeleton_xml_tree.getRoot()))
+ {
+ LL_ERRS() << "Error parsing skeleton XML file: " << skeleton_path << LL_ENDL;
+ }
+ // parse avatar_lad.xml
+ if (sAvatarXmlInfo)
+ { //this can happen if a login attempt failed
+ delete_and_clear(sAvatarXmlInfo);
+ }
+ sAvatarXmlInfo = new LLAvatarXmlInfo;
+ if (!sAvatarXmlInfo->parseXmlSkeletonNode(root))
+ {
+ LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
+ }
+ if (!sAvatarXmlInfo->parseXmlMeshNodes(root))
+ {
+ LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
+ }
+ if (!sAvatarXmlInfo->parseXmlColorNodes(root))
+ {
+ LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
+ }
+ if (!sAvatarXmlInfo->parseXmlLayerNodes(root))
+ {
+ LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
+ }
+ if (!sAvatarXmlInfo->parseXmlDriverNodes(root))
+ {
+ LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
+ }
+ if (!sAvatarXmlInfo->parseXmlMorphNodes(root))
+ {
+ LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
+ }
}
void LLAvatarAppearance::cleanupClass()
{
- delete_and_clear(sAvatarXmlInfo);
+ delete_and_clear(sAvatarXmlInfo);
delete_and_clear(sAvatarDictionary);
delete_and_clear(sAvatarSkeletonInfo);
}
@@ -464,14 +464,14 @@ void LLAvatarAppearance::compareJointStateMaps(joint_state_map_t& last_state,
{
LL_DEBUGS("AvatarBodySize") << "Total of BodySize changes " << diff_count << LL_ENDL;
}
-
+
}
}
//------------------------------------------------------------------------
// The viewer can only suggest a good size for the agent,
// the simulator will keep it inside a reasonable range.
-void LLAvatarAppearance::computeBodySize()
+void LLAvatarAppearance::computeBodySize()
{
mLastBodySizeState = mCurrBodySizeState;
@@ -494,68 +494,43 @@ void LLAvatarAppearance::computeBodySize()
mCurrBodySizeState["mAnkleLeft scale"] = mAnkleLeftp->getScale();
mCurrBodySizeState["mFootLeft pos"] = mFootLeftp->getPosition();
- LLVector3 pelvis_scale = mPelvisp->getScale();
-
- // some of the joints have not been cached
- LLVector3 skull = mSkullp->getPosition();
- //LLVector3 skull_scale = mSkullp->getScale();
-
- LLVector3 neck = mNeckp->getPosition();
- LLVector3 neck_scale = mNeckp->getScale();
-
- LLVector3 chest = mChestp->getPosition();
- LLVector3 chest_scale = mChestp->getScale();
-
- // the rest of the joints have been cached
- LLVector3 head = mHeadp->getPosition();
- LLVector3 head_scale = mHeadp->getScale();
-
- LLVector3 torso = mTorsop->getPosition();
- LLVector3 torso_scale = mTorsop->getScale();
-
- LLVector3 hip = mHipLeftp->getPosition();
- LLVector3 hip_scale = mHipLeftp->getScale();
-
- LLVector3 knee = mKneeLeftp->getPosition();
- LLVector3 knee_scale = mKneeLeftp->getScale();
+ F32 old_height = mBodySize.mV[VZ];
+ F32 old_offset = mAvatarOffset.mV[VZ];
- LLVector3 ankle = mAnkleLeftp->getPosition();
- LLVector3 ankle_scale = mAnkleLeftp->getScale();
+ // TODO: Measure the real depth and width
+ mPelvisToFoot = computePelvisToFoot();
+ F32 new_height = computeBodyHeight();
+ mBodySize.set(DEFAULT_AGENT_DEPTH, DEFAULT_AGENT_WIDTH, new_height);
+ F32 new_offset = getVisualParamWeight(AVATAR_HOVER);
+ mAvatarOffset.set(0, 0, new_offset);
- LLVector3 foot = mFootLeftp->getPosition();
-
- F32 old_offset = mAvatarOffset.mV[VZ];
-
- mAvatarOffset.mV[VZ] = getVisualParamWeight(AVATAR_HOVER);
-
- mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] -
- knee.mV[VZ] * hip_scale.mV[VZ] -
- ankle.mV[VZ] * knee_scale.mV[VZ] -
- foot.mV[VZ] * ankle_scale.mV[VZ];
-
- LLVector3 new_body_size;
- new_body_size.mV[VZ] = mPelvisToFoot +
- // the sqrt(2) correction below is an approximate
- // correction to get to the top of the head
- F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) +
- head.mV[VZ] * neck_scale.mV[VZ] +
- neck.mV[VZ] * chest_scale.mV[VZ] +
- chest.mV[VZ] * torso_scale.mV[VZ] +
- torso.mV[VZ] * pelvis_scale.mV[VZ];
-
- // TODO -- measure the real depth and width
- new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH;
- new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH;
-
- mAvatarOffset.mV[VX] = 0.0f;
- mAvatarOffset.mV[VY] = 0.0f;
+ if (mBodySize.mV[VZ] != old_height || new_offset != old_offset)
+ {
+ compareJointStateMaps(mLastBodySizeState, mCurrBodySizeState);
+ }
+}
- if (new_body_size != mBodySize || old_offset != mAvatarOffset.mV[VZ])
- {
- mBodySize = new_body_size;
+F32 LLAvatarAppearance::computeBodyHeight()
+{
+ F32 result = mPelvisToFoot +
+ // all these relative positions usually are positive
+ mPelvisp->getScale().mV[VZ] * mTorsop->getPosition().mV[VZ] +
+ mTorsop->getScale().mV[VZ] * mChestp->getPosition().mV[VZ] +
+ mChestp->getScale().mV[VZ] * mNeckp->getPosition().mV[VZ] +
+ mNeckp->getScale().mV[VZ] * mHeadp->getPosition().mV[VZ] +
+ mHeadp->getScale().mV[VZ] * mSkullp->getPosition().mV[VZ] * 2;
+ return result;
+}
- compareJointStateMaps(mLastBodySizeState, mCurrBodySizeState);
- }
+F32 LLAvatarAppearance::computePelvisToFoot()
+{
+ F32 result =
+ // all these relative positions usually are negative
+ mPelvisp->getScale().mV[VZ] * mHipLeftp->getPosition().mV[VZ] +
+ mHipLeftp->getScale().mV[VZ] * mKneeLeftp->getPosition().mV[VZ] +
+ mKneeLeftp->getScale().mV[VZ] * mAnkleLeftp->getPosition().mV[VZ] +
+ mAnkleLeftp->getScale().mV[VZ] * mFootLeftp->getPosition().mV[VZ] / 2;
+ return -result;
}
//-----------------------------------------------------------------------------
@@ -563,40 +538,40 @@ void LLAvatarAppearance::computeBodySize()
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree)
{
- //-------------------------------------------------------------------------
- // parse the file
- //-------------------------------------------------------------------------
- BOOL parsesuccess = skeleton_xml_tree.parseFile( filename, FALSE );
-
- if (!parsesuccess)
- {
- LL_ERRS() << "Can't parse skeleton file: " << filename << LL_ENDL;
- return FALSE;
- }
-
- // now sanity check xml file
- LLXmlTreeNode* root = skeleton_xml_tree.getRoot();
- if (!root)
- {
- LL_ERRS() << "No root node found in avatar skeleton file: " << filename << LL_ENDL;
- return FALSE;
- }
-
- if( !root->hasName( "linden_skeleton" ) )
- {
- LL_ERRS() << "Invalid avatar skeleton file header: " << filename << LL_ENDL;
- return FALSE;
- }
-
- std::string version;
- static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
- if( !root->getFastAttributeString( version_string, version ) || ((version != "1.0") && (version != "2.0")))
- {
- LL_ERRS() << "Invalid avatar skeleton file version: " << version << " in file: " << filename << LL_ENDL;
- return FALSE;
- }
-
- return TRUE;
+ //-------------------------------------------------------------------------
+ // parse the file
+ //-------------------------------------------------------------------------
+ BOOL parsesuccess = skeleton_xml_tree.parseFile( filename, FALSE );
+
+ if (!parsesuccess)
+ {
+ LL_ERRS() << "Can't parse skeleton file: " << filename << LL_ENDL;
+ return FALSE;
+ }
+
+ // now sanity check xml file
+ LLXmlTreeNode* root = skeleton_xml_tree.getRoot();
+ if (!root)
+ {
+ LL_ERRS() << "No root node found in avatar skeleton file: " << filename << LL_ENDL;
+ return FALSE;
+ }
+
+ if( !root->hasName( "linden_skeleton" ) )
+ {
+ LL_ERRS() << "Invalid avatar skeleton file header: " << filename << LL_ENDL;
+ return FALSE;
+ }
+
+ std::string version;
+ static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
+ if( !root->getFastAttributeString( version_string, version ) || ((version != "1.0") && (version != "2.0")))
+ {
+ LL_ERRS() << "Invalid avatar skeleton file version: " << version << " in file: " << filename << LL_ENDL;
+ return FALSE;
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -604,7 +579,7 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename, LLXmlTre
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &volume_num, S32 &joint_num)
{
- LLJoint* joint = NULL;
+ LLJoint* joint = NULL;
LL_DEBUGS("BVH") << "bone info: name " << info->mName
<< " isJoint " << info->mIsJoint
@@ -612,66 +587,66 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
<< " joint_num " << joint_num
<< LL_ENDL;
- if (info->mIsJoint)
- {
- joint = getCharacterJoint(joint_num);
- if (!joint)
- {
- LL_WARNS() << "Too many bones" << LL_ENDL;
- return FALSE;
- }
- joint->setName( info->mName );
- }
- else // collision volume
- {
- if (volume_num >= (S32)mNumCollisionVolumes)
- {
- LL_WARNS() << "Too many collision volumes" << LL_ENDL;
- return FALSE;
- }
- joint = (&mCollisionVolumes[volume_num]);
- joint->setName( info->mName );
- }
-
- // add to parent
- if (parent && (joint->getParent()!=parent))
- {
- parent->addChild( joint );
- }
-
- // SL-315
- joint->setPosition(info->mPos);
+ if (info->mIsJoint)
+ {
+ joint = getCharacterJoint(joint_num);
+ if (!joint)
+ {
+ LL_WARNS() << "Too many bones" << LL_ENDL;
+ return FALSE;
+ }
+ joint->setName( info->mName );
+ }
+ else // collision volume
+ {
+ if (volume_num >= (S32)mNumCollisionVolumes)
+ {
+ LL_WARNS() << "Too many collision volumes" << LL_ENDL;
+ return FALSE;
+ }
+ joint = (&mCollisionVolumes[volume_num]);
+ joint->setName( info->mName );
+ }
+
+ // add to parent
+ if (parent && (joint->getParent()!=parent))
+ {
+ parent->addChild( joint );
+ }
+
+ // SL-315
+ joint->setPosition(info->mPos);
joint->setDefaultPosition(info->mPos);
- joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY],
- info->mRot.mV[VZ], LLQuaternion::XYZ));
- joint->setScale(info->mScale);
- joint->setDefaultScale(info->mScale);
+ joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY],
+ info->mRot.mV[VZ], LLQuaternion::XYZ));
+ joint->setScale(info->mScale);
+ joint->setDefaultScale(info->mScale);
joint->setSupport(info->mSupport);
- joint->setEnd(info->mEnd);
+ joint->setEnd(info->mEnd);
- if (info->mIsJoint)
- {
- joint->setSkinOffset( info->mPivot );
+ if (info->mIsJoint)
+ {
+ joint->setSkinOffset( info->mPivot );
joint->setJointNum(joint_num);
- joint_num++;
- }
- else // collision volume
- {
+ joint_num++;
+ }
+ else // collision volume
+ {
joint->setJointNum(mNumBones+volume_num);
- volume_num++;
- }
+ volume_num++;
+ }
- // setup children
- for (LLAvatarBoneInfo* child_info : info->mChildren)
- {
- if (!setupBone(child_info, joint, volume_num, joint_num))
- {
- return FALSE;
- }
- }
+ // setup children
+ for (LLAvatarBoneInfo* child_info : info->mChildren)
+ {
+ if (!setupBone(child_info, joint, volume_num, joint_num))
+ {
+ return FALSE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -686,7 +661,7 @@ BOOL LLAvatarAppearance::allocateCharacterJoints( U32 num )
mNumBones = num;
}
- return TRUE;
+ return TRUE;
}
@@ -697,35 +672,35 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
{
LL_DEBUGS("BVH") << "numBones " << info->mNumBones << " numCollisionVolumes " << info->mNumCollisionVolumes << LL_ENDL;
- // allocate joints
- if (!allocateCharacterJoints(info->mNumBones))
- {
- LL_ERRS() << "Can't allocate " << info->mNumBones << " joints" << LL_ENDL;
- return FALSE;
- }
-
- // allocate volumes
- if (info->mNumCollisionVolumes)
- {
- if (!allocateCollisionVolumes(info->mNumCollisionVolumes))
- {
- LL_ERRS() << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << LL_ENDL;
- return FALSE;
- }
- }
-
- S32 current_joint_num = 0;
- S32 current_volume_num = 0;
- for (LLAvatarBoneInfo* bone_info : info->mBoneInfoList)
- {
- if (!setupBone(bone_info, NULL, current_volume_num, current_joint_num))
- {
- LL_ERRS() << "Error parsing bone in skeleton file" << LL_ENDL;
- return FALSE;
- }
- }
-
- return TRUE;
+ // allocate joints
+ if (!allocateCharacterJoints(info->mNumBones))
+ {
+ LL_ERRS() << "Can't allocate " << info->mNumBones << " joints" << LL_ENDL;
+ return FALSE;
+ }
+
+ // allocate volumes
+ if (info->mNumCollisionVolumes)
+ {
+ if (!allocateCollisionVolumes(info->mNumCollisionVolumes))
+ {
+ LL_ERRS() << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << LL_ENDL;
+ return FALSE;
+ }
+ }
+
+ S32 current_joint_num = 0;
+ S32 current_volume_num = 0;
+ for (LLAvatarBoneInfo* bone_info : info->mBoneInfoList)
+ {
+ if (!setupBone(bone_info, NULL, current_volume_num, current_joint_num))
+ {
+ LL_ERRS() << "Error parsing bone in skeleton file" << LL_ENDL;
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -733,17 +708,17 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
//-----------------------------------------------------------------------------
void LLAvatarAppearance::clearSkeleton()
{
- std::for_each(mSkeleton.begin(), mSkeleton.end(), DeletePointer());
- mSkeleton.clear();
+ std::for_each(mSkeleton.begin(), mSkeleton.end(), DeletePointer());
+ mSkeleton.clear();
}
//------------------------------------------------------------------------
// addPelvisFixup
//------------------------------------------------------------------------
-void LLAvatarAppearance::addPelvisFixup( F32 fixup, const LLUUID& mesh_id )
+void LLAvatarAppearance::addPelvisFixup( F32 fixup, const LLUUID& mesh_id )
{
- LLVector3 pos(0.0,0.0,fixup);
- mPelvisFixups.add(mesh_id,pos);
+ LLVector3 pos(0.0,0.0,fixup);
+ mPelvisFixups.add(mesh_id,pos);
}
//------------------------------------------------------------------------
@@ -751,7 +726,7 @@ void LLAvatarAppearance::addPelvisFixup( F32 fixup, const LLUUID& mesh_id )
//------------------------------------------------------------------------
void LLAvatarAppearance::removePelvisFixup( const LLUUID& mesh_id )
{
- mPelvisFixups.remove(mesh_id);
+ mPelvisFixups.remove(mesh_id);
}
//------------------------------------------------------------------------
@@ -759,19 +734,19 @@ void LLAvatarAppearance::removePelvisFixup( const LLUUID& mesh_id )
//------------------------------------------------------------------------
bool LLAvatarAppearance::hasPelvisFixup( F32& fixup, LLUUID& mesh_id ) const
{
- LLVector3 pos;
- if (mPelvisFixups.findActiveOverride(mesh_id,pos))
- {
- fixup = pos[2];
- return true;
- }
- return false;
+ LLVector3 pos;
+ if (mPelvisFixups.findActiveOverride(mesh_id,pos))
+ {
+ fixup = pos[2];
+ return true;
+ }
+ return false;
}
bool LLAvatarAppearance::hasPelvisFixup( F32& fixup ) const
{
- LLUUID mesh_id;
- return hasPelvisFixup( fixup, mesh_id );
+ LLUUID mesh_id;
+ return hasPelvisFixup( fixup, mesh_id );
}
//-----------------------------------------------------------------------------
// LLAvatarAppearance::buildCharacter()
@@ -779,242 +754,242 @@ bool LLAvatarAppearance::hasPelvisFixup( F32& fixup ) const
//-----------------------------------------------------------------------------
void LLAvatarAppearance::buildCharacter()
{
- //-------------------------------------------------------------------------
- // remove all references to our existing skeleton
- // so we can rebuild it
- //-------------------------------------------------------------------------
- flushAllMotions();
-
- //-------------------------------------------------------------------------
- // remove all of mRoot's children
- //-------------------------------------------------------------------------
- mRoot->removeAllChildren();
- mJointMap.clear();
- mIsBuilt = FALSE;
-
- //-------------------------------------------------------------------------
- // clear mesh data
- //-------------------------------------------------------------------------
- for (LLAvatarJoint* joint : mMeshLOD)
- {
- for (LLAvatarJointMesh* mesh : joint->mMeshParts)
- {
- mesh->setMesh(NULL);
- }
- }
-
- //-------------------------------------------------------------------------
- // (re)load our skeleton and meshes
- //-------------------------------------------------------------------------
- LLTimer timer;
-
- BOOL status = loadAvatar();
- stop_glerror();
-
-// gPrintMessagesThisFrame = TRUE;
- LL_DEBUGS() << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << LL_ENDL;
-
- if (!status)
- {
- if (isSelf())
- {
- LL_ERRS() << "Unable to load user's avatar" << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "Unable to load other's avatar" << LL_ENDL;
- }
- return;
- }
-
- //-------------------------------------------------------------------------
- // initialize "well known" joint pointers
- //-------------------------------------------------------------------------
- mPelvisp = mRoot->findJoint("mPelvis");
- mTorsop = mRoot->findJoint("mTorso");
- mChestp = mRoot->findJoint("mChest");
- mNeckp = mRoot->findJoint("mNeck");
- mHeadp = mRoot->findJoint("mHead");
- mSkullp = mRoot->findJoint("mSkull");
- mHipLeftp = mRoot->findJoint("mHipLeft");
- mHipRightp = mRoot->findJoint("mHipRight");
- mKneeLeftp = mRoot->findJoint("mKneeLeft");
- mKneeRightp = mRoot->findJoint("mKneeRight");
- mAnkleLeftp = mRoot->findJoint("mAnkleLeft");
- mAnkleRightp = mRoot->findJoint("mAnkleRight");
- mFootLeftp = mRoot->findJoint("mFootLeft");
- mFootRightp = mRoot->findJoint("mFootRight");
- mWristLeftp = mRoot->findJoint("mWristLeft");
- mWristRightp = mRoot->findJoint("mWristRight");
- mEyeLeftp = mRoot->findJoint("mEyeLeft");
- mEyeRightp = mRoot->findJoint("mEyeRight");
-
- //-------------------------------------------------------------------------
- // Make sure "well known" pointers exist
- //-------------------------------------------------------------------------
- if (!(mPelvisp &&
- mTorsop &&
- mChestp &&
- mNeckp &&
- mHeadp &&
- mSkullp &&
- mHipLeftp &&
- mHipRightp &&
- mKneeLeftp &&
- mKneeRightp &&
- mAnkleLeftp &&
- mAnkleRightp &&
- mFootLeftp &&
- mFootRightp &&
- mWristLeftp &&
- mWristRightp &&
- mEyeLeftp &&
- mEyeRightp))
- {
- LL_ERRS() << "Failed to create avatar." << LL_ENDL;
- return;
- }
-
- //-------------------------------------------------------------------------
- // initialize the pelvis
- //-------------------------------------------------------------------------
- // SL-315
- mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) );
-
- mIsBuilt = TRUE;
- stop_glerror();
+ //-------------------------------------------------------------------------
+ // remove all references to our existing skeleton
+ // so we can rebuild it
+ //-------------------------------------------------------------------------
+ flushAllMotions();
+
+ //-------------------------------------------------------------------------
+ // remove all of mRoot's children
+ //-------------------------------------------------------------------------
+ mRoot->removeAllChildren();
+ mJointMap.clear();
+ mIsBuilt = FALSE;
+
+ //-------------------------------------------------------------------------
+ // clear mesh data
+ //-------------------------------------------------------------------------
+ for (LLAvatarJoint* joint : mMeshLOD)
+ {
+ for (LLAvatarJointMesh* mesh : joint->mMeshParts)
+ {
+ mesh->setMesh(NULL);
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ // (re)load our skeleton and meshes
+ //-------------------------------------------------------------------------
+ LLTimer timer;
+
+ BOOL status = loadAvatar();
+ stop_glerror();
+
+// gPrintMessagesThisFrame = TRUE;
+ LL_DEBUGS() << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << LL_ENDL;
+
+ if (!status)
+ {
+ if (isSelf())
+ {
+ LL_ERRS() << "Unable to load user's avatar" << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "Unable to load other's avatar" << LL_ENDL;
+ }
+ return;
+ }
+
+ //-------------------------------------------------------------------------
+ // initialize "well known" joint pointers
+ //-------------------------------------------------------------------------
+ mPelvisp = mRoot->findJoint("mPelvis");
+ mTorsop = mRoot->findJoint("mTorso");
+ mChestp = mRoot->findJoint("mChest");
+ mNeckp = mRoot->findJoint("mNeck");
+ mHeadp = mRoot->findJoint("mHead");
+ mSkullp = mRoot->findJoint("mSkull");
+ mHipLeftp = mRoot->findJoint("mHipLeft");
+ mHipRightp = mRoot->findJoint("mHipRight");
+ mKneeLeftp = mRoot->findJoint("mKneeLeft");
+ mKneeRightp = mRoot->findJoint("mKneeRight");
+ mAnkleLeftp = mRoot->findJoint("mAnkleLeft");
+ mAnkleRightp = mRoot->findJoint("mAnkleRight");
+ mFootLeftp = mRoot->findJoint("mFootLeft");
+ mFootRightp = mRoot->findJoint("mFootRight");
+ mWristLeftp = mRoot->findJoint("mWristLeft");
+ mWristRightp = mRoot->findJoint("mWristRight");
+ mEyeLeftp = mRoot->findJoint("mEyeLeft");
+ mEyeRightp = mRoot->findJoint("mEyeRight");
+
+ //-------------------------------------------------------------------------
+ // Make sure "well known" pointers exist
+ //-------------------------------------------------------------------------
+ if (!(mPelvisp &&
+ mTorsop &&
+ mChestp &&
+ mNeckp &&
+ mHeadp &&
+ mSkullp &&
+ mHipLeftp &&
+ mHipRightp &&
+ mKneeLeftp &&
+ mKneeRightp &&
+ mAnkleLeftp &&
+ mAnkleRightp &&
+ mFootLeftp &&
+ mFootRightp &&
+ mWristLeftp &&
+ mWristRightp &&
+ mEyeLeftp &&
+ mEyeRightp))
+ {
+ LL_ERRS() << "Failed to create avatar." << LL_ENDL;
+ return;
+ }
+
+ //-------------------------------------------------------------------------
+ // initialize the pelvis
+ //-------------------------------------------------------------------------
+ // SL-315
+ mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) );
+
+ mIsBuilt = TRUE;
+ stop_glerror();
}
BOOL LLAvatarAppearance::loadAvatar()
{
-// LL_RECORD_BLOCK_TIME(FTM_LOAD_AVATAR);
-
- // avatar_skeleton.xml
- if( !buildSkeleton(sAvatarSkeletonInfo) )
- {
- LL_ERRS() << "avatar file: buildSkeleton() failed" << LL_ENDL;
- return FALSE;
- }
-
- // initialize mJointAliasMap
- getJointAliases();
-
- // avatar_lad.xml : <skeleton>
- if( !loadSkeletonNode() )
- {
- LL_ERRS() << "avatar file: loadNodeSkeleton() failed" << LL_ENDL;
- return FALSE;
- }
-
- // avatar_lad.xml : <mesh>
- if( !loadMeshNodes() )
- {
- LL_ERRS() << "avatar file: loadNodeMesh() failed" << LL_ENDL;
- return FALSE;
- }
-
- // avatar_lad.xml : <global_color>
- if( sAvatarXmlInfo->mTexSkinColorInfo )
- {
- mTexSkinColor = new LLTexGlobalColor( this );
- if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) )
- {
- LL_ERRS() << "avatar file: mTexSkinColor->setInfo() failed" << LL_ENDL;
- return FALSE;
- }
- }
- else
- {
- LL_ERRS() << "<global_color> name=\"skin_color\" not found" << LL_ENDL;
- return FALSE;
- }
- if( sAvatarXmlInfo->mTexHairColorInfo )
- {
- mTexHairColor = new LLTexGlobalColor( this );
- if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) )
- {
- LL_ERRS() << "avatar file: mTexHairColor->setInfo() failed" << LL_ENDL;
- return FALSE;
- }
- }
- else
- {
- LL_ERRS() << "<global_color> name=\"hair_color\" not found" << LL_ENDL;
- return FALSE;
- }
- if( sAvatarXmlInfo->mTexEyeColorInfo )
- {
- mTexEyeColor = new LLTexGlobalColor( this );
- if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) )
- {
- LL_ERRS() << "avatar file: mTexEyeColor->setInfo() failed" << LL_ENDL;
- return FALSE;
- }
- }
- else
- {
- LL_ERRS() << "<global_color> name=\"eye_color\" not found" << LL_ENDL;
- return FALSE;
- }
-
- // avatar_lad.xml : <layer_set>
- if (sAvatarXmlInfo->mLayerInfoList.empty())
- {
- LL_ERRS() << "avatar file: missing <layer_set> node" << LL_ENDL;
- return FALSE;
- }
-
- if (sAvatarXmlInfo->mMorphMaskInfoList.empty())
- {
- LL_ERRS() << "avatar file: missing <morph_masks> node" << LL_ENDL;
- return FALSE;
- }
-
- // avatar_lad.xml : <morph_masks>
- for (LLAvatarXmlInfo::LLAvatarMorphInfo* info : sAvatarXmlInfo->mMorphMaskInfoList)
- {
- EBakedTextureIndex baked = sAvatarDictionary->findBakedByRegionName(info->mRegion);
- if (baked != BAKED_NUM_INDICES)
- {
- LLVisualParam* morph_param;
- const std::string *name = &info->mName;
- morph_param = getVisualParam(name->c_str());
- if (morph_param)
- {
- BOOL invert = info->mInvert;
- addMaskedMorph(baked, morph_param, invert, info->mLayer);
- }
- }
-
- }
-
- loadLayersets();
-
- // avatar_lad.xml : <driver_parameters>
- for (LLDriverParamInfo* info : sAvatarXmlInfo->mDriverInfoList)
- {
- LLDriverParam* driver_param = new LLDriverParam( this );
- if (driver_param->setInfo(info))
- {
- addVisualParam( driver_param );
- driver_param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
- LLVisualParam*(LLAvatarAppearance::*avatar_function)(S32)const = &LLAvatarAppearance::getVisualParam;
- if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLAvatarAppearance*)this,_1 ), false))
- {
- LL_WARNS() << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << LL_ENDL;
- continue;
- }
- }
- else
- {
- delete driver_param;
- LL_WARNS() << "avatar file: driver_param->parseData() failed" << LL_ENDL;
- return FALSE;
- }
- }
-
- return TRUE;
+// LL_RECORD_BLOCK_TIME(FTM_LOAD_AVATAR);
+
+ // avatar_skeleton.xml
+ if( !buildSkeleton(sAvatarSkeletonInfo) )
+ {
+ LL_ERRS() << "avatar file: buildSkeleton() failed" << LL_ENDL;
+ return FALSE;
+ }
+
+ // initialize mJointAliasMap
+ getJointAliases();
+
+ // avatar_lad.xml : <skeleton>
+ if( !loadSkeletonNode() )
+ {
+ LL_ERRS() << "avatar file: loadNodeSkeleton() failed" << LL_ENDL;
+ return FALSE;
+ }
+
+ // avatar_lad.xml : <mesh>
+ if( !loadMeshNodes() )
+ {
+ LL_ERRS() << "avatar file: loadNodeMesh() failed" << LL_ENDL;
+ return FALSE;
+ }
+
+ // avatar_lad.xml : <global_color>
+ if( sAvatarXmlInfo->mTexSkinColorInfo )
+ {
+ mTexSkinColor = new LLTexGlobalColor( this );
+ if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) )
+ {
+ LL_ERRS() << "avatar file: mTexSkinColor->setInfo() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ LL_ERRS() << "<global_color> name=\"skin_color\" not found" << LL_ENDL;
+ return FALSE;
+ }
+ if( sAvatarXmlInfo->mTexHairColorInfo )
+ {
+ mTexHairColor = new LLTexGlobalColor( this );
+ if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) )
+ {
+ LL_ERRS() << "avatar file: mTexHairColor->setInfo() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ LL_ERRS() << "<global_color> name=\"hair_color\" not found" << LL_ENDL;
+ return FALSE;
+ }
+ if( sAvatarXmlInfo->mTexEyeColorInfo )
+ {
+ mTexEyeColor = new LLTexGlobalColor( this );
+ if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) )
+ {
+ LL_ERRS() << "avatar file: mTexEyeColor->setInfo() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ LL_ERRS() << "<global_color> name=\"eye_color\" not found" << LL_ENDL;
+ return FALSE;
+ }
+
+ // avatar_lad.xml : <layer_set>
+ if (sAvatarXmlInfo->mLayerInfoList.empty())
+ {
+ LL_ERRS() << "avatar file: missing <layer_set> node" << LL_ENDL;
+ return FALSE;
+ }
+
+ if (sAvatarXmlInfo->mMorphMaskInfoList.empty())
+ {
+ LL_ERRS() << "avatar file: missing <morph_masks> node" << LL_ENDL;
+ return FALSE;
+ }
+
+ // avatar_lad.xml : <morph_masks>
+ for (LLAvatarXmlInfo::LLAvatarMorphInfo* info : sAvatarXmlInfo->mMorphMaskInfoList)
+ {
+ EBakedTextureIndex baked = sAvatarDictionary->findBakedByRegionName(info->mRegion);
+ if (baked != BAKED_NUM_INDICES)
+ {
+ LLVisualParam* morph_param;
+ const std::string *name = &info->mName;
+ morph_param = getVisualParam(name->c_str());
+ if (morph_param)
+ {
+ BOOL invert = info->mInvert;
+ addMaskedMorph(baked, morph_param, invert, info->mLayer);
+ }
+ }
+
+ }
+
+ loadLayersets();
+
+ // avatar_lad.xml : <driver_parameters>
+ for (LLDriverParamInfo* info : sAvatarXmlInfo->mDriverInfoList)
+ {
+ LLDriverParam* driver_param = new LLDriverParam( this );
+ if (driver_param->setInfo(info))
+ {
+ addVisualParam( driver_param );
+ driver_param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
+ LLVisualParam*(LLAvatarAppearance::*avatar_function)(S32)const = &LLAvatarAppearance::getVisualParam;
+ if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLAvatarAppearance*)this,_1 ), false))
+ {
+ LL_WARNS() << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << LL_ENDL;
+ continue;
+ }
+ }
+ else
+ {
+ delete driver_param;
+ LL_WARNS() << "avatar file: driver_param->parseData() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -1022,60 +997,60 @@ BOOL LLAvatarAppearance::loadAvatar()
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::loadSkeletonNode ()
{
- mRoot->addChild( mSkeleton[0] );
-
- // make meshes children before calling parent version of the function
- for (LLAvatarJoint* joint : mMeshLOD)
- {
- joint->mUpdateXform = FALSE;
- joint->setMeshesToChildren();
- }
-
- mRoot->addChild(mMeshLOD[MESH_ID_HEAD]);
- mRoot->addChild(mMeshLOD[MESH_ID_EYELASH]);
- mRoot->addChild(mMeshLOD[MESH_ID_UPPER_BODY]);
- mRoot->addChild(mMeshLOD[MESH_ID_LOWER_BODY]);
- mRoot->addChild(mMeshLOD[MESH_ID_SKIRT]);
-
- LLAvatarJoint *skull = (LLAvatarJoint*)mRoot->findJoint("mSkull");
- if (skull)
- {
- skull->addChild(mMeshLOD[MESH_ID_HAIR] );
- }
-
- LLAvatarJoint *eyeL = (LLAvatarJoint*)mRoot->findJoint("mEyeLeft");
- if (eyeL)
- {
- eyeL->addChild( mMeshLOD[MESH_ID_EYEBALL_LEFT] );
- }
-
- LLAvatarJoint *eyeR = (LLAvatarJoint*)mRoot->findJoint("mEyeRight");
- if (eyeR)
- {
- eyeR->addChild( mMeshLOD[MESH_ID_EYEBALL_RIGHT] );
- }
-
- // SKELETAL DISTORTIONS
- {
- for (LLViewerVisualParamInfo* visual_param_info : sAvatarXmlInfo->mSkeletalDistortionInfoList)
- {
- LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)visual_param_info;
- LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this);
- if (!param->setInfo(info))
- {
- delete param;
- return FALSE;
- }
- else
- {
- addVisualParam(param);
- param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
- }
- }
- }
-
-
- return TRUE;
+ mRoot->addChild( mSkeleton[0] );
+
+ // make meshes children before calling parent version of the function
+ for (LLAvatarJoint* joint : mMeshLOD)
+ {
+ joint->mUpdateXform = FALSE;
+ joint->setMeshesToChildren();
+ }
+
+ mRoot->addChild(mMeshLOD[MESH_ID_HEAD]);
+ mRoot->addChild(mMeshLOD[MESH_ID_EYELASH]);
+ mRoot->addChild(mMeshLOD[MESH_ID_UPPER_BODY]);
+ mRoot->addChild(mMeshLOD[MESH_ID_LOWER_BODY]);
+ mRoot->addChild(mMeshLOD[MESH_ID_SKIRT]);
+
+ LLAvatarJoint *skull = (LLAvatarJoint*)mRoot->findJoint("mSkull");
+ if (skull)
+ {
+ skull->addChild(mMeshLOD[MESH_ID_HAIR] );
+ }
+
+ LLAvatarJoint *eyeL = (LLAvatarJoint*)mRoot->findJoint("mEyeLeft");
+ if (eyeL)
+ {
+ eyeL->addChild( mMeshLOD[MESH_ID_EYEBALL_LEFT] );
+ }
+
+ LLAvatarJoint *eyeR = (LLAvatarJoint*)mRoot->findJoint("mEyeRight");
+ if (eyeR)
+ {
+ eyeR->addChild( mMeshLOD[MESH_ID_EYEBALL_RIGHT] );
+ }
+
+ // SKELETAL DISTORTIONS
+ {
+ for (LLViewerVisualParamInfo* visual_param_info : sAvatarXmlInfo->mSkeletalDistortionInfoList)
+ {
+ LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)visual_param_info;
+ LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this);
+ if (!param->setInfo(info))
+ {
+ delete param;
+ return FALSE;
+ }
+ else
+ {
+ addVisualParam(param);
+ param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
+ }
+ }
+ }
+
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -1083,115 +1058,115 @@ BOOL LLAvatarAppearance::loadSkeletonNode ()
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::loadMeshNodes()
{
- for (const LLAvatarXmlInfo::LLAvatarMeshInfo* info : sAvatarXmlInfo->mMeshInfoList)
- {
- const std::string &type = info->mType;
- S32 lod = info->mLOD;
-
- LLAvatarJointMesh* mesh = NULL;
- U8 mesh_id = 0;
- BOOL found_mesh_id = FALSE;
-
- /* if (type == "hairMesh")
- switch(lod)
- case 0:
- mesh = &mHairMesh0; */
- for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
- {
- const EMeshIndex mesh_index = mesh_pair.first;
- const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
- if (type.compare(mesh_dict->mName) == 0)
- {
- mesh_id = mesh_index;
- found_mesh_id = TRUE;
- break;
- }
- }
-
- if (found_mesh_id)
- {
- if (lod < (S32)mMeshLOD[mesh_id]->mMeshParts.size())
- {
- mesh = mMeshLOD[mesh_id]->mMeshParts[lod];
- }
- else
- {
- LL_WARNS() << "Avatar file: <mesh> has invalid lod setting " << lod << LL_ENDL;
- return FALSE;
- }
- }
- else
- {
- LL_WARNS() << "Ignoring unrecognized mesh type: " << type << LL_ENDL;
- return FALSE;
- }
-
- // LL_INFOS() << "Parsing mesh data for " << type << "..." << LL_ENDL;
-
- // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings.
- // Do not touch!!!
- mesh->setColor( LLColor4::white );
-
- LLPolyMesh *poly_mesh = NULL;
-
- if (!info->mReferenceMeshName.empty())
- {
- polymesh_map_t::const_iterator polymesh_iter = mPolyMeshes.find(info->mReferenceMeshName);
- if (polymesh_iter != mPolyMeshes.end())
- {
- poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName, polymesh_iter->second);
- poly_mesh->setAvatar(this);
- }
- else
- {
- // This should never happen
- LL_WARNS("Avatar") << "Could not find avatar mesh: " << info->mReferenceMeshName << LL_ENDL;
+ for (const LLAvatarXmlInfo::LLAvatarMeshInfo* info : sAvatarXmlInfo->mMeshInfoList)
+ {
+ const std::string &type = info->mType;
+ S32 lod = info->mLOD;
+
+ LLAvatarJointMesh* mesh = NULL;
+ U8 mesh_id = 0;
+ BOOL found_mesh_id = FALSE;
+
+ /* if (type == "hairMesh")
+ switch(lod)
+ case 0:
+ mesh = &mHairMesh0; */
+ for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
+ {
+ const EMeshIndex mesh_index = mesh_pair.first;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
+ if (type.compare(mesh_dict->mName) == 0)
+ {
+ mesh_id = mesh_index;
+ found_mesh_id = TRUE;
+ break;
+ }
+ }
+
+ if (found_mesh_id)
+ {
+ if (lod < (S32)mMeshLOD[mesh_id]->mMeshParts.size())
+ {
+ mesh = mMeshLOD[mesh_id]->mMeshParts[lod];
+ }
+ else
+ {
+ LL_WARNS() << "Avatar file: <mesh> has invalid lod setting " << lod << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Ignoring unrecognized mesh type: " << type << LL_ENDL;
+ return FALSE;
+ }
+
+ // LL_INFOS() << "Parsing mesh data for " << type << "..." << LL_ENDL;
+
+ // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings.
+ // Do not touch!!!
+ mesh->setColor( LLColor4::white );
+
+ LLPolyMesh *poly_mesh = NULL;
+
+ if (!info->mReferenceMeshName.empty())
+ {
+ polymesh_map_t::const_iterator polymesh_iter = mPolyMeshes.find(info->mReferenceMeshName);
+ if (polymesh_iter != mPolyMeshes.end())
+ {
+ poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName, polymesh_iter->second);
+ poly_mesh->setAvatar(this);
+ }
+ else
+ {
+ // This should never happen
+ LL_WARNS("Avatar") << "Could not find avatar mesh: " << info->mReferenceMeshName << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName);
+ poly_mesh->setAvatar(this);
+ }
+
+ if( !poly_mesh )
+ {
+ LL_WARNS() << "Failed to load mesh of type " << type << LL_ENDL;
+ return FALSE;
+ }
+
+ // Multimap insert
+ mPolyMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh));
+
+ mesh->setMesh( poly_mesh );
+ mesh->setLOD( info->mMinPixelArea );
+
+ for (const LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_pair_t& info_pair : info->mPolyMorphTargetInfoList)
+ {
+ LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh());
+ if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair.first))
+ {
+ delete param;
return FALSE;
- }
- }
- else
- {
- poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName);
- poly_mesh->setAvatar(this);
- }
-
- if( !poly_mesh )
- {
- LL_WARNS() << "Failed to load mesh of type " << type << LL_ENDL;
- return FALSE;
- }
-
- // Multimap insert
- mPolyMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh));
-
- mesh->setMesh( poly_mesh );
- mesh->setLOD( info->mMinPixelArea );
-
- for (const LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_pair_t& info_pair : info->mPolyMorphTargetInfoList)
- {
- LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh());
- if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair.first))
- {
- delete param;
- return FALSE;
- }
- else
- {
- if (info_pair.second)
- {
- addSharedVisualParam(param);
- param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
- }
- else
- {
- addVisualParam(param);
- param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
- }
- }
- }
- }
-
- return TRUE;
+ }
+ else
+ {
+ if (info_pair.second)
+ {
+ addSharedVisualParam(param);
+ param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
+ }
+ else
+ {
+ addVisualParam(param);
+ param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
+ }
+ }
+ }
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -1199,66 +1174,66 @@ BOOL LLAvatarAppearance::loadMeshNodes()
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::loadLayersets()
{
- BOOL success = TRUE;
- for (LLTexLayerSetInfo* layerset_info : sAvatarXmlInfo->mLayerInfoList)
- {
- if (isSelf())
- {
- // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
- LLTexLayerSet* layer_set = createTexLayerSet();
-
- if (!layer_set->setInfo(layerset_info))
- {
- stop_glerror();
- delete layer_set;
- LL_WARNS() << "avatar file: layer_set->setInfo() failed" << LL_ENDL;
- return FALSE;
- }
-
- // scan baked textures and associate the layerset with the appropriate one
- EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
- for (const LLAvatarAppearanceDictionary::BakedTextures::value_type& baked_pair : sAvatarDictionary->getBakedTextures())
- {
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_pair.second;
- if (layer_set->isBodyRegion(baked_dict->mName))
- {
- baked_index = baked_pair.first;
- // ensure both structures are aware of each other
- mBakedTextureDatas[baked_index].mTexLayerSet = layer_set;
- layer_set->setBakedTexIndex(baked_index);
- break;
- }
- }
- // if no baked texture was found, warn and cleanup
- if (baked_index == BAKED_NUM_INDICES)
- {
- LL_WARNS() << "<layer_set> has invalid body_region attribute" << LL_ENDL;
- delete layer_set;
- return FALSE;
- }
-
- // scan morph masks and let any affected layers know they have an associated morph
- for (LLMaskedMorph* morph : mBakedTextureDatas[baked_index].mMaskedMorphs)
- {
- LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer);
- if (layer)
- {
- layer->setHasMorph(TRUE);
- }
- else
- {
- LL_WARNS() << "Could not find layer named " << morph->mLayer << " to set morph flag" << LL_ENDL;
- success = FALSE;
- }
- }
- }
- else // !isSelf()
- {
- // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
- layerset_info->createVisualParams(this);
- }
- }
- return success;
+ BOOL success = TRUE;
+ for (LLTexLayerSetInfo* layerset_info : sAvatarXmlInfo->mLayerInfoList)
+ {
+ if (isSelf())
+ {
+ // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
+ LLTexLayerSet* layer_set = createTexLayerSet();
+
+ if (!layer_set->setInfo(layerset_info))
+ {
+ stop_glerror();
+ delete layer_set;
+ LL_WARNS() << "avatar file: layer_set->setInfo() failed" << LL_ENDL;
+ return FALSE;
+ }
+
+ // scan baked textures and associate the layerset with the appropriate one
+ EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
+ for (const LLAvatarAppearanceDictionary::BakedTextures::value_type& baked_pair : sAvatarDictionary->getBakedTextures())
+ {
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_pair.second;
+ if (layer_set->isBodyRegion(baked_dict->mName))
+ {
+ baked_index = baked_pair.first;
+ // ensure both structures are aware of each other
+ mBakedTextureDatas[baked_index].mTexLayerSet = layer_set;
+ layer_set->setBakedTexIndex(baked_index);
+ break;
+ }
+ }
+ // if no baked texture was found, warn and cleanup
+ if (baked_index == BAKED_NUM_INDICES)
+ {
+ LL_WARNS() << "<layer_set> has invalid body_region attribute" << LL_ENDL;
+ delete layer_set;
+ return FALSE;
+ }
+
+ // scan morph masks and let any affected layers know they have an associated morph
+ for (LLMaskedMorph* morph : mBakedTextureDatas[baked_index].mMaskedMorphs)
+ {
+ LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer);
+ if (layer)
+ {
+ layer->setHasMorph(TRUE);
+ }
+ else
+ {
+ LL_WARNS() << "Could not find layer named " << morph->mLayer << " to set morph flag" << LL_ENDL;
+ success = FALSE;
+ }
+ }
+ }
+ else // !isSelf()
+ {
+ // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
+ layerset_info->createVisualParams(this);
+ }
+ }
+ return success;
}
//-----------------------------------------------------------------------------
@@ -1266,16 +1241,16 @@ BOOL LLAvatarAppearance::loadLayersets()
//-----------------------------------------------------------------------------
LLJoint *LLAvatarAppearance::getCharacterJoint( U32 num )
{
- if ((S32)num >= mSkeleton.size()
- || (S32)num < 0)
- {
- return NULL;
- }
+ if ((S32)num >= mSkeleton.size()
+ || (S32)num < 0)
+ {
+ return NULL;
+ }
if (!mSkeleton[num])
{
mSkeleton[num] = createAvatarJoint();
}
- return mSkeleton[num];
+ return mSkeleton[num];
}
@@ -1284,12 +1259,12 @@ LLJoint *LLAvatarAppearance::getCharacterJoint( U32 num )
//-----------------------------------------------------------------------------
LLVector3 LLAvatarAppearance::getVolumePos(S32 joint_index, LLVector3& volume_offset)
{
- if (joint_index > mNumCollisionVolumes)
- {
- return LLVector3::zero;
- }
+ if (joint_index > mNumCollisionVolumes)
+ {
+ return LLVector3::zero;
+ }
- return mCollisionVolumes[joint_index].getVolumePos(volume_offset);
+ return mCollisionVolumes[joint_index].getVolumePos(volume_offset);
}
//-----------------------------------------------------------------------------
@@ -1297,12 +1272,12 @@ LLVector3 LLAvatarAppearance::getVolumePos(S32 joint_index, LLVector3& volume_of
//-----------------------------------------------------------------------------
LLJoint* LLAvatarAppearance::findCollisionVolume(S32 volume_id)
{
- if ((volume_id < 0) || (volume_id >= mNumCollisionVolumes))
- {
- return NULL;
- }
-
- return &mCollisionVolumes[volume_id];
+ if ((volume_id < 0) || (volume_id >= mNumCollisionVolumes))
+ {
+ return NULL;
+ }
+
+ return &mCollisionVolumes[volume_id];
}
//-----------------------------------------------------------------------------
@@ -1310,32 +1285,32 @@ LLJoint* LLAvatarAppearance::findCollisionVolume(S32 volume_id)
//-----------------------------------------------------------------------------
S32 LLAvatarAppearance::getCollisionVolumeID(std::string &name)
{
- for (S32 i = 0; i < mNumCollisionVolumes; i++)
- {
- if (mCollisionVolumes[i].getName() == name)
- {
- return i;
- }
- }
-
- return -1;
+ for (S32 i = 0; i < mNumCollisionVolumes; i++)
+ {
+ if (mCollisionVolumes[i].getName() == name)
+ {
+ return i;
+ }
+ }
+
+ return -1;
}
//-----------------------------------------------------------------------------
// LLAvatarAppearance::getHeadMesh()
//-----------------------------------------------------------------------------
-LLPolyMesh* LLAvatarAppearance::getHeadMesh()
+LLPolyMesh* LLAvatarAppearance::getHeadMesh()
{
- return mMeshLOD[MESH_ID_HEAD]->mMeshParts[0]->getMesh();
+ return mMeshLOD[MESH_ID_HEAD]->mMeshParts[0]->getMesh();
}
//-----------------------------------------------------------------------------
// LLAvatarAppearance::getUpperBodyMesh()
//-----------------------------------------------------------------------------
-LLPolyMesh* LLAvatarAppearance::getUpperBodyMesh()
+LLPolyMesh* LLAvatarAppearance::getUpperBodyMesh()
{
- return mMeshLOD[MESH_ID_UPPER_BODY]->mMeshParts[0]->getMesh();
+ return mMeshLOD[MESH_ID_UPPER_BODY]->mMeshParts[0]->getMesh();
}
@@ -1343,182 +1318,182 @@ LLPolyMesh* LLAvatarAppearance::getUpperBodyMesh()
// virtual
BOOL LLAvatarAppearance::isValid() const
{
- // This should only be called on ourself.
- if (!isSelf())
- {
- LL_ERRS() << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << LL_ENDL;
- }
- return TRUE;
+ // This should only be called on ourself.
+ if (!isSelf())
+ {
+ LL_ERRS() << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << LL_ENDL;
+ }
+ return TRUE;
}
// adds a morph mask to the appropriate baked texture structure
void LLAvatarAppearance::addMaskedMorph(EBakedTextureIndex index, LLVisualParam* morph_target, BOOL invert, std::string layer)
{
- if (index < BAKED_NUM_INDICES)
- {
- LLMaskedMorph *morph = new LLMaskedMorph(morph_target, invert, layer);
- mBakedTextureDatas[index].mMaskedMorphs.push_front(morph);
- }
+ if (index < BAKED_NUM_INDICES)
+ {
+ LLMaskedMorph *morph = new LLMaskedMorph(morph_target, invert, layer);
+ mBakedTextureDatas[index].mMaskedMorphs.push_front(morph);
+ }
}
//static
BOOL LLAvatarAppearance::teToColorParams( ETextureIndex te, U32 *param_name )
{
- switch( te )
- {
- case TEX_UPPER_SHIRT:
- param_name[0] = 803; //"shirt_red";
- param_name[1] = 804; //"shirt_green";
- param_name[2] = 805; //"shirt_blue";
- break;
-
- case TEX_LOWER_PANTS:
- param_name[0] = 806; //"pants_red";
- param_name[1] = 807; //"pants_green";
- param_name[2] = 808; //"pants_blue";
- break;
-
- case TEX_LOWER_SHOES:
- param_name[0] = 812; //"shoes_red";
- param_name[1] = 813; //"shoes_green";
- param_name[2] = 817; //"shoes_blue";
- break;
-
- case TEX_LOWER_SOCKS:
- param_name[0] = 818; //"socks_red";
- param_name[1] = 819; //"socks_green";
- param_name[2] = 820; //"socks_blue";
- break;
-
- case TEX_UPPER_JACKET:
- case TEX_LOWER_JACKET:
- param_name[0] = 834; //"jacket_red";
- param_name[1] = 835; //"jacket_green";
- param_name[2] = 836; //"jacket_blue";
- break;
-
- case TEX_UPPER_GLOVES:
- param_name[0] = 827; //"gloves_red";
- param_name[1] = 829; //"gloves_green";
- param_name[2] = 830; //"gloves_blue";
- break;
-
- case TEX_UPPER_UNDERSHIRT:
- param_name[0] = 821; //"undershirt_red";
- param_name[1] = 822; //"undershirt_green";
- param_name[2] = 823; //"undershirt_blue";
- break;
-
- case TEX_LOWER_UNDERPANTS:
- param_name[0] = 824; //"underpants_red";
- param_name[1] = 825; //"underpants_green";
- param_name[2] = 826; //"underpants_blue";
- break;
-
- case TEX_SKIRT:
- param_name[0] = 921; //"skirt_red";
- param_name[1] = 922; //"skirt_green";
- param_name[2] = 923; //"skirt_blue";
- break;
-
- case TEX_HEAD_TATTOO:
- case TEX_LOWER_TATTOO:
- case TEX_UPPER_TATTOO:
- param_name[0] = 1071; //"tattoo_red";
- param_name[1] = 1072; //"tattoo_green";
- param_name[2] = 1073; //"tattoo_blue";
- break;
- case TEX_HEAD_UNIVERSAL_TATTOO:
- case TEX_UPPER_UNIVERSAL_TATTOO:
- case TEX_LOWER_UNIVERSAL_TATTOO:
- case TEX_SKIRT_TATTOO:
- case TEX_HAIR_TATTOO:
- case TEX_EYES_TATTOO:
- case TEX_LEFT_ARM_TATTOO:
- case TEX_LEFT_LEG_TATTOO:
- case TEX_AUX1_TATTOO:
- case TEX_AUX2_TATTOO:
- case TEX_AUX3_TATTOO:
- param_name[0] = 1238; //"tattoo_universal_red";
- param_name[1] = 1239; //"tattoo_universal_green";
- param_name[2] = 1240; //"tattoo_universal_blue";
- break;
-
- default:
- llassert(0);
- return FALSE;
- }
-
- return TRUE;
+ switch( te )
+ {
+ case TEX_UPPER_SHIRT:
+ param_name[0] = 803; //"shirt_red";
+ param_name[1] = 804; //"shirt_green";
+ param_name[2] = 805; //"shirt_blue";
+ break;
+
+ case TEX_LOWER_PANTS:
+ param_name[0] = 806; //"pants_red";
+ param_name[1] = 807; //"pants_green";
+ param_name[2] = 808; //"pants_blue";
+ break;
+
+ case TEX_LOWER_SHOES:
+ param_name[0] = 812; //"shoes_red";
+ param_name[1] = 813; //"shoes_green";
+ param_name[2] = 817; //"shoes_blue";
+ break;
+
+ case TEX_LOWER_SOCKS:
+ param_name[0] = 818; //"socks_red";
+ param_name[1] = 819; //"socks_green";
+ param_name[2] = 820; //"socks_blue";
+ break;
+
+ case TEX_UPPER_JACKET:
+ case TEX_LOWER_JACKET:
+ param_name[0] = 834; //"jacket_red";
+ param_name[1] = 835; //"jacket_green";
+ param_name[2] = 836; //"jacket_blue";
+ break;
+
+ case TEX_UPPER_GLOVES:
+ param_name[0] = 827; //"gloves_red";
+ param_name[1] = 829; //"gloves_green";
+ param_name[2] = 830; //"gloves_blue";
+ break;
+
+ case TEX_UPPER_UNDERSHIRT:
+ param_name[0] = 821; //"undershirt_red";
+ param_name[1] = 822; //"undershirt_green";
+ param_name[2] = 823; //"undershirt_blue";
+ break;
+
+ case TEX_LOWER_UNDERPANTS:
+ param_name[0] = 824; //"underpants_red";
+ param_name[1] = 825; //"underpants_green";
+ param_name[2] = 826; //"underpants_blue";
+ break;
+
+ case TEX_SKIRT:
+ param_name[0] = 921; //"skirt_red";
+ param_name[1] = 922; //"skirt_green";
+ param_name[2] = 923; //"skirt_blue";
+ break;
+
+ case TEX_HEAD_TATTOO:
+ case TEX_LOWER_TATTOO:
+ case TEX_UPPER_TATTOO:
+ param_name[0] = 1071; //"tattoo_red";
+ param_name[1] = 1072; //"tattoo_green";
+ param_name[2] = 1073; //"tattoo_blue";
+ break;
+ case TEX_HEAD_UNIVERSAL_TATTOO:
+ case TEX_UPPER_UNIVERSAL_TATTOO:
+ case TEX_LOWER_UNIVERSAL_TATTOO:
+ case TEX_SKIRT_TATTOO:
+ case TEX_HAIR_TATTOO:
+ case TEX_EYES_TATTOO:
+ case TEX_LEFT_ARM_TATTOO:
+ case TEX_LEFT_LEG_TATTOO:
+ case TEX_AUX1_TATTOO:
+ case TEX_AUX2_TATTOO:
+ case TEX_AUX3_TATTOO:
+ param_name[0] = 1238; //"tattoo_universal_red";
+ param_name[1] = 1239; //"tattoo_universal_green";
+ param_name[2] = 1240; //"tattoo_universal_blue";
+ break;
+
+ default:
+ llassert(0);
+ return FALSE;
+ }
+
+ return TRUE;
}
void LLAvatarAppearance::setClothesColor( ETextureIndex te, const LLColor4& new_color)
{
- U32 param_name[3];
- if( teToColorParams( te, param_name ) )
- {
- setVisualParamWeight( param_name[0], new_color.mV[VX]);
- setVisualParamWeight( param_name[1], new_color.mV[VY]);
- setVisualParamWeight( param_name[2], new_color.mV[VZ]);
- }
+ U32 param_name[3];
+ if( teToColorParams( te, param_name ) )
+ {
+ setVisualParamWeight( param_name[0], new_color.mV[VX]);
+ setVisualParamWeight( param_name[1], new_color.mV[VY]);
+ setVisualParamWeight( param_name[2], new_color.mV[VZ]);
+ }
}
LLColor4 LLAvatarAppearance::getClothesColor( ETextureIndex te )
{
- LLColor4 color;
- U32 param_name[3];
- if( teToColorParams( te, param_name ) )
- {
- color.mV[VX] = getVisualParamWeight( param_name[0] );
- color.mV[VY] = getVisualParamWeight( param_name[1] );
- color.mV[VZ] = getVisualParamWeight( param_name[2] );
- }
- return color;
+ LLColor4 color;
+ U32 param_name[3];
+ if( teToColorParams( te, param_name ) )
+ {
+ color.mV[VX] = getVisualParamWeight( param_name[0] );
+ color.mV[VY] = getVisualParamWeight( param_name[1] );
+ color.mV[VZ] = getVisualParamWeight( param_name[2] );
+ }
+ return color;
}
// static
LLColor4 LLAvatarAppearance::getDummyColor()
{
- return DUMMY_COLOR;
+ return DUMMY_COLOR;
}
LLColor4 LLAvatarAppearance::getGlobalColor( const std::string& color_name ) const
{
- if (color_name=="skin_color" && mTexSkinColor)
- {
- return mTexSkinColor->getColor();
- }
- else if(color_name=="hair_color" && mTexHairColor)
- {
- return mTexHairColor->getColor();
- }
- if(color_name=="eye_color" && mTexEyeColor)
- {
- return mTexEyeColor->getColor();
- }
- else
- {
-// return LLColor4( .5f, .5f, .5f, .5f );
- return LLColor4( 0.f, 1.f, 1.f, 1.f ); // good debugging color
- }
+ if (color_name=="skin_color" && mTexSkinColor)
+ {
+ return mTexSkinColor->getColor();
+ }
+ else if(color_name=="hair_color" && mTexHairColor)
+ {
+ return mTexHairColor->getColor();
+ }
+ if(color_name=="eye_color" && mTexEyeColor)
+ {
+ return mTexEyeColor->getColor();
+ }
+ else
+ {
+// return LLColor4( .5f, .5f, .5f, .5f );
+ return LLColor4( 0.f, 1.f, 1.f, 1.f ); // good debugging color
+ }
}
// Unlike most wearable functions, this works for both self and other.
// virtual
BOOL LLAvatarAppearance::isWearingWearableType(LLWearableType::EType type) const
{
- return mWearableData->getWearableCount(type) > 0;
+ return mWearableData->getWearableCount(type) > 0;
}
LLTexLayerSet* LLAvatarAppearance::getAvatarLayerSet(EBakedTextureIndex baked_index) const
{
- /* switch(index)
- case TEX_HEAD_BAKED:
- case TEX_HEAD_BODYPAINT:
- return mHeadLayerSet; */
- return mBakedTextureDatas[baked_index].mTexLayerSet;
+ /* switch(index)
+ case TEX_HEAD_BAKED:
+ case TEX_HEAD_BODYPAINT:
+ return mHeadLayerSet; */
+ return mBakedTextureDatas[baked_index].mTexLayerSet;
}
//-----------------------------------------------------------------------------
@@ -1537,10 +1512,10 @@ BOOL LLAvatarAppearance::allocateCollisionVolumes( U32 num )
LL_WARNS() << "Failed to allocate collision volumes" << LL_ENDL;
return FALSE;
}
-
+
mNumCollisionVolumes = num;
}
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -1548,92 +1523,92 @@ BOOL LLAvatarAppearance::allocateCollisionVolumes( U32 num )
//-----------------------------------------------------------------------------
BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
{
- if (node->hasName("bone"))
- {
- mIsJoint = TRUE;
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- if (!node->getFastAttributeString(name_string, mName))
- {
- LL_WARNS() << "Bone without name" << LL_ENDL;
- return FALSE;
- }
-
+ if (node->hasName("bone"))
+ {
+ mIsJoint = TRUE;
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ if (!node->getFastAttributeString(name_string, mName))
+ {
+ LL_WARNS() << "Bone without name" << LL_ENDL;
+ return FALSE;
+ }
+
static LLStdStringHandle aliases_string = LLXmlTree::addAttributeString("aliases");
node->getFastAttributeString(aliases_string, mAliases ); //Aliases are not required.
- }
- else if (node->hasName("collision_volume"))
- {
- mIsJoint = FALSE;
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- if (!node->getFastAttributeString(name_string, mName))
- {
- mName = "Collision Volume";
- }
- }
- else
- {
- LL_WARNS() << "Invalid node " << node->getName() << LL_ENDL;
- return FALSE;
- }
-
- static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos");
- if (!node->getFastAttributeVector3(pos_string, mPos))
- {
- LL_WARNS() << "Bone without position" << LL_ENDL;
- return FALSE;
- }
-
- static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot");
- if (!node->getFastAttributeVector3(rot_string, mRot))
- {
- LL_WARNS() << "Bone without rotation" << LL_ENDL;
- return FALSE;
- }
-
- static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
- if (!node->getFastAttributeVector3(scale_string, mScale))
- {
- LL_WARNS() << "Bone without scale" << LL_ENDL;
- return FALSE;
- }
-
- static LLStdStringHandle end_string = LLXmlTree::addAttributeString("end");
- if (!node->getFastAttributeVector3(end_string, mEnd))
- {
- LL_WARNS() << "Bone without end " << mName << LL_ENDL;
+ }
+ else if (node->hasName("collision_volume"))
+ {
+ mIsJoint = FALSE;
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ if (!node->getFastAttributeString(name_string, mName))
+ {
+ mName = "Collision Volume";
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Invalid node " << node->getName() << LL_ENDL;
+ return FALSE;
+ }
+
+ static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos");
+ if (!node->getFastAttributeVector3(pos_string, mPos))
+ {
+ LL_WARNS() << "Bone without position" << LL_ENDL;
+ return FALSE;
+ }
+
+ static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot");
+ if (!node->getFastAttributeVector3(rot_string, mRot))
+ {
+ LL_WARNS() << "Bone without rotation" << LL_ENDL;
+ return FALSE;
+ }
+
+ static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
+ if (!node->getFastAttributeVector3(scale_string, mScale))
+ {
+ LL_WARNS() << "Bone without scale" << LL_ENDL;
+ return FALSE;
+ }
+
+ static LLStdStringHandle end_string = LLXmlTree::addAttributeString("end");
+ if (!node->getFastAttributeVector3(end_string, mEnd))
+ {
+ LL_WARNS() << "Bone without end " << mName << LL_ENDL;
mEnd = LLVector3(0.0f, 0.0f, 0.0f);
- }
+ }
- static LLStdStringHandle support_string = LLXmlTree::addAttributeString("support");
+ static LLStdStringHandle support_string = LLXmlTree::addAttributeString("support");
if (!node->getFastAttributeString(support_string,mSupport))
{
LL_WARNS() << "Bone without support " << mName << LL_ENDL;
mSupport = "base";
}
- if (mIsJoint)
- {
- static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot");
- if (!node->getFastAttributeVector3(pivot_string, mPivot))
- {
- LL_WARNS() << "Bone without pivot" << LL_ENDL;
- return FALSE;
- }
- }
-
- // parse children
- LLXmlTreeNode* child;
- for( child = node->getFirstChild(); child; child = node->getNextChild() )
- {
- LLAvatarBoneInfo *child_info = new LLAvatarBoneInfo;
- if (!child_info->parseXml(child))
- {
- delete child_info;
- return FALSE;
- }
- mChildren.push_back(child_info);
- }
- return TRUE;
+ if (mIsJoint)
+ {
+ static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot");
+ if (!node->getFastAttributeVector3(pivot_string, mPivot))
+ {
+ LL_WARNS() << "Bone without pivot" << LL_ENDL;
+ return FALSE;
+ }
+ }
+
+ // parse children
+ LLXmlTreeNode* child;
+ for( child = node->getFirstChild(); child; child = node->getNextChild() )
+ {
+ LLAvatarBoneInfo *child_info = new LLAvatarBoneInfo;
+ if (!child_info->parseXml(child))
+ {
+ delete child_info;
+ return FALSE;
+ }
+ mChildren.push_back(child_info);
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -1641,29 +1616,29 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
//-----------------------------------------------------------------------------
BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node)
{
- static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones");
- if (!node->getFastAttributeS32(num_bones_string, mNumBones))
- {
- LL_WARNS() << "Couldn't find number of bones." << LL_ENDL;
- return FALSE;
- }
-
- static LLStdStringHandle num_collision_volumes_string = LLXmlTree::addAttributeString("num_collision_volumes");
- node->getFastAttributeS32(num_collision_volumes_string, mNumCollisionVolumes);
-
- LLXmlTreeNode* child;
- for( child = node->getFirstChild(); child; child = node->getNextChild() )
- {
- LLAvatarBoneInfo *info = new LLAvatarBoneInfo;
- if (!info->parseXml(child))
- {
- delete info;
- LL_WARNS() << "Error parsing bone in skeleton file" << LL_ENDL;
- return FALSE;
- }
- mBoneInfoList.push_back(info);
- }
- return TRUE;
+ static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones");
+ if (!node->getFastAttributeS32(num_bones_string, mNumBones))
+ {
+ LL_WARNS() << "Couldn't find number of bones." << LL_ENDL;
+ return FALSE;
+ }
+
+ static LLStdStringHandle num_collision_volumes_string = LLXmlTree::addAttributeString("num_collision_volumes");
+ node->getFastAttributeS32(num_collision_volumes_string, mNumCollisionVolumes);
+
+ LLXmlTreeNode* child;
+ for( child = node->getFirstChild(); child; child = node->getNextChild() )
+ {
+ LLAvatarBoneInfo *info = new LLAvatarBoneInfo;
+ if (!info->parseXml(child))
+ {
+ delete info;
+ LL_WARNS() << "Error parsing bone in skeleton file" << LL_ENDL;
+ return FALSE;
+ }
+ mBoneInfoList.push_back(info);
+ }
+ return TRUE;
}
//Make aliases for joint and push to map.
@@ -1673,12 +1648,12 @@ void LLAvatarAppearance::makeJointAliases(LLAvatarBoneInfo *bone_info)
{
return;
}
-
+
std::string bone_name = bone_info->mName;
mJointAliasMap[bone_name] = bone_name; //Actual name is a valid alias.
-
+
std::string aliases = bone_info->mAliases;
-
+
boost::char_separator<char> sep(" ");
boost::tokenizer<boost::char_separator<char> > tok(aliases, sep);
for(const std::string& i : tok)
@@ -1701,7 +1676,7 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases
LLAvatarAppearance::joint_alias_map_t alias_map;
if (mJointAliasMap.empty())
{
-
+
for (LLAvatarBoneInfo* bone_info : sAvatarSkeletonInfo->mBoneInfoList)
{
//LLAvatarBoneInfo *bone_info = *iter;
@@ -1711,7 +1686,7 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases
for (LLAvatarXmlInfo::LLAvatarAttachmentInfo* info : sAvatarXmlInfo->mAttachmentInfoList)
{
std::string bone_name = info->mName;
-
+
// Also accept the name with spaces substituted with
// underscores. This gives a mechanism for referencing such joints
// in daes, which don't allow spaces.
@@ -1725,7 +1700,7 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases
}
return mJointAliasMap;
-}
+}
//-----------------------------------------------------------------------------
@@ -1733,105 +1708,105 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root)
{
- LLXmlTreeNode* node = root->getChildByName( "skeleton" );
- if( !node )
- {
- LL_WARNS() << "avatar file: missing <skeleton>" << LL_ENDL;
- return FALSE;
- }
-
- LLXmlTreeNode* child;
-
- // SKELETON DISTORTIONS
- for (child = node->getChildByName( "param" );
- child;
- child = node->getNextNamedChild())
- {
- if (!child->getChildByName("param_skeleton"))
- {
- if (child->getChildByName("param_morph"))
- {
- LL_WARNS() << "Can't specify morph param in skeleton definition." << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "Unknown param type." << LL_ENDL;
- }
+ LLXmlTreeNode* node = root->getChildByName( "skeleton" );
+ if( !node )
+ {
+ LL_WARNS() << "avatar file: missing <skeleton>" << LL_ENDL;
+ return FALSE;
+ }
+
+ LLXmlTreeNode* child;
+
+ // SKELETON DISTORTIONS
+ for (child = node->getChildByName( "param" );
+ child;
+ child = node->getNextNamedChild())
+ {
+ if (!child->getChildByName("param_skeleton"))
+ {
+ if (child->getChildByName("param_morph"))
+ {
+ LL_WARNS() << "Can't specify morph param in skeleton definition." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "Unknown param type." << LL_ENDL;
+ }
+ return FALSE;
+ }
+
+ LLPolySkeletalDistortionInfo *info = new LLPolySkeletalDistortionInfo;
+ if (!info->parseXml(child))
+ {
+ delete info;
return FALSE;
- }
-
- LLPolySkeletalDistortionInfo *info = new LLPolySkeletalDistortionInfo;
- if (!info->parseXml(child))
- {
- delete info;
- return FALSE;
- }
-
- mSkeletalDistortionInfoList.push_back(info);
- }
-
- // ATTACHMENT POINTS
- for (child = node->getChildByName( "attachment_point" );
- child;
- child = node->getNextNamedChild())
- {
- LLAvatarAttachmentInfo* info = new LLAvatarAttachmentInfo();
-
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- if (!child->getFastAttributeString(name_string, info->mName))
- {
- LL_WARNS() << "No name supplied for attachment point." << LL_ENDL;
- delete info;
+ }
+
+ mSkeletalDistortionInfoList.push_back(info);
+ }
+
+ // ATTACHMENT POINTS
+ for (child = node->getChildByName( "attachment_point" );
+ child;
+ child = node->getNextNamedChild())
+ {
+ LLAvatarAttachmentInfo* info = new LLAvatarAttachmentInfo();
+
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ if (!child->getFastAttributeString(name_string, info->mName))
+ {
+ LL_WARNS() << "No name supplied for attachment point." << LL_ENDL;
+ delete info;
return FALSE;
- }
+ }
- static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint");
- if (!child->getFastAttributeString(joint_string, info->mJointName))
- {
- LL_WARNS() << "No bone declared in attachment point " << info->mName << LL_ENDL;
- delete info;
+ static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint");
+ if (!child->getFastAttributeString(joint_string, info->mJointName))
+ {
+ LL_WARNS() << "No bone declared in attachment point " << info->mName << LL_ENDL;
+ delete info;
return FALSE;
- }
-
- static LLStdStringHandle position_string = LLXmlTree::addAttributeString("position");
- if (child->getFastAttributeVector3(position_string, info->mPosition))
- {
- info->mHasPosition = TRUE;
- }
-
- static LLStdStringHandle rotation_string = LLXmlTree::addAttributeString("rotation");
- if (child->getFastAttributeVector3(rotation_string, info->mRotationEuler))
- {
- info->mHasRotation = TRUE;
- }
- static LLStdStringHandle group_string = LLXmlTree::addAttributeString("group");
- if (child->getFastAttributeS32(group_string, info->mGroup))
- {
- if (info->mGroup == -1)
- info->mGroup = -1111; // -1 = none parsed, < -1 = bad value
- }
-
- static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id");
- if (!child->getFastAttributeS32(id_string, info->mAttachmentID))
- {
- LL_WARNS() << "No id supplied for attachment point " << info->mName << LL_ENDL;
- delete info;
+ }
+
+ static LLStdStringHandle position_string = LLXmlTree::addAttributeString("position");
+ if (child->getFastAttributeVector3(position_string, info->mPosition))
+ {
+ info->mHasPosition = TRUE;
+ }
+
+ static LLStdStringHandle rotation_string = LLXmlTree::addAttributeString("rotation");
+ if (child->getFastAttributeVector3(rotation_string, info->mRotationEuler))
+ {
+ info->mHasRotation = TRUE;
+ }
+ static LLStdStringHandle group_string = LLXmlTree::addAttributeString("group");
+ if (child->getFastAttributeS32(group_string, info->mGroup))
+ {
+ if (info->mGroup == -1)
+ info->mGroup = -1111; // -1 = none parsed, < -1 = bad value
+ }
+
+ static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id");
+ if (!child->getFastAttributeS32(id_string, info->mAttachmentID))
+ {
+ LL_WARNS() << "No id supplied for attachment point " << info->mName << LL_ENDL;
+ delete info;
return FALSE;
- }
+ }
+
+ static LLStdStringHandle slot_string = LLXmlTree::addAttributeString("pie_slice");
+ child->getFastAttributeS32(slot_string, info->mPieMenuSlice);
- static LLStdStringHandle slot_string = LLXmlTree::addAttributeString("pie_slice");
- child->getFastAttributeS32(slot_string, info->mPieMenuSlice);
-
- static LLStdStringHandle visible_in_first_person_string = LLXmlTree::addAttributeString("visible_in_first_person");
- child->getFastAttributeBOOL(visible_in_first_person_string, info->mVisibleFirstPerson);
+ static LLStdStringHandle visible_in_first_person_string = LLXmlTree::addAttributeString("visible_in_first_person");
+ child->getFastAttributeBOOL(visible_in_first_person_string, info->mVisibleFirstPerson);
- static LLStdStringHandle hud_attachment_string = LLXmlTree::addAttributeString("hud");
- child->getFastAttributeBOOL(hud_attachment_string, info->mIsHUDAttachment);
+ static LLStdStringHandle hud_attachment_string = LLXmlTree::addAttributeString("hud");
+ child->getFastAttributeBOOL(hud_attachment_string, info->mIsHUDAttachment);
- mAttachmentInfoList.push_back(info);
- }
+ mAttachmentInfoList.push_back(info);
+ }
- return TRUE;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -1839,89 +1814,89 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
{
- for (LLXmlTreeNode* node = root->getChildByName( "mesh" );
- node;
- node = root->getNextNamedChild())
- {
- LLAvatarMeshInfo *info = new LLAvatarMeshInfo;
-
- // attribute: type
- static LLStdStringHandle type_string = LLXmlTree::addAttributeString("type");
- if( !node->getFastAttributeString( type_string, info->mType ) )
- {
- LL_WARNS() << "Avatar file: <mesh> is missing type attribute. Ignoring element. " << LL_ENDL;
- delete info;
- return FALSE; // Ignore this element
- }
-
- static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod");
- if (!node->getFastAttributeS32( lod_string, info->mLOD ))
- {
- LL_WARNS() << "Avatar file: <mesh> is missing lod attribute. Ignoring element. " << LL_ENDL;
- delete info;
- return FALSE; // Ignore this element
- }
-
- static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name");
- if( !node->getFastAttributeString( file_name_string, info->mMeshFileName ) )
- {
- LL_WARNS() << "Avatar file: <mesh> is missing file_name attribute. Ignoring: " << info->mType << LL_ENDL;
- delete info;
- return FALSE; // Ignore this element
- }
-
- static LLStdStringHandle reference_string = LLXmlTree::addAttributeString("reference");
- node->getFastAttributeString( reference_string, info->mReferenceMeshName );
-
- // attribute: min_pixel_area
- static LLStdStringHandle min_pixel_area_string = LLXmlTree::addAttributeString("min_pixel_area");
- static LLStdStringHandle min_pixel_width_string = LLXmlTree::addAttributeString("min_pixel_width");
- if (!node->getFastAttributeF32( min_pixel_area_string, info->mMinPixelArea ))
- {
- F32 min_pixel_area = 0.1f;
- if (node->getFastAttributeF32( min_pixel_width_string, min_pixel_area ))
- {
- // this is square root of pixel area (sensible to use linear space in defining lods)
- min_pixel_area = min_pixel_area * min_pixel_area;
- }
- info->mMinPixelArea = min_pixel_area;
- }
-
- // Parse visual params for this node only if we haven't already
- for (LLXmlTreeNode* child = node->getChildByName( "param" );
- child;
- child = node->getNextNamedChild())
- {
- if (!child->getChildByName("param_morph"))
- {
- if (child->getChildByName("param_skeleton"))
- {
- LL_WARNS() << "Can't specify skeleton param in a mesh definition." << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "Unknown param type." << LL_ENDL;
- }
+ for (LLXmlTreeNode* node = root->getChildByName( "mesh" );
+ node;
+ node = root->getNextNamedChild())
+ {
+ LLAvatarMeshInfo *info = new LLAvatarMeshInfo;
+
+ // attribute: type
+ static LLStdStringHandle type_string = LLXmlTree::addAttributeString("type");
+ if( !node->getFastAttributeString( type_string, info->mType ) )
+ {
+ LL_WARNS() << "Avatar file: <mesh> is missing type attribute. Ignoring element. " << LL_ENDL;
+ delete info;
+ return FALSE; // Ignore this element
+ }
+
+ static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod");
+ if (!node->getFastAttributeS32( lod_string, info->mLOD ))
+ {
+ LL_WARNS() << "Avatar file: <mesh> is missing lod attribute. Ignoring element. " << LL_ENDL;
+ delete info;
+ return FALSE; // Ignore this element
+ }
+
+ static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name");
+ if( !node->getFastAttributeString( file_name_string, info->mMeshFileName ) )
+ {
+ LL_WARNS() << "Avatar file: <mesh> is missing file_name attribute. Ignoring: " << info->mType << LL_ENDL;
+ delete info;
+ return FALSE; // Ignore this element
+ }
+
+ static LLStdStringHandle reference_string = LLXmlTree::addAttributeString("reference");
+ node->getFastAttributeString( reference_string, info->mReferenceMeshName );
+
+ // attribute: min_pixel_area
+ static LLStdStringHandle min_pixel_area_string = LLXmlTree::addAttributeString("min_pixel_area");
+ static LLStdStringHandle min_pixel_width_string = LLXmlTree::addAttributeString("min_pixel_width");
+ if (!node->getFastAttributeF32( min_pixel_area_string, info->mMinPixelArea ))
+ {
+ F32 min_pixel_area = 0.1f;
+ if (node->getFastAttributeF32( min_pixel_width_string, min_pixel_area ))
+ {
+ // this is square root of pixel area (sensible to use linear space in defining lods)
+ min_pixel_area = min_pixel_area * min_pixel_area;
+ }
+ info->mMinPixelArea = min_pixel_area;
+ }
+
+ // Parse visual params for this node only if we haven't already
+ for (LLXmlTreeNode* child = node->getChildByName( "param" );
+ child;
+ child = node->getNextNamedChild())
+ {
+ if (!child->getChildByName("param_morph"))
+ {
+ if (child->getChildByName("param_skeleton"))
+ {
+ LL_WARNS() << "Can't specify skeleton param in a mesh definition." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "Unknown param type." << LL_ENDL;
+ }
return FALSE;
- }
-
- LLPolyMorphTargetInfo *morphinfo = new LLPolyMorphTargetInfo();
- if (!morphinfo->parseXml(child))
- {
- delete morphinfo;
- delete info;
- return -1;
- }
- BOOL shared = FALSE;
- static LLStdStringHandle shared_string = LLXmlTree::addAttributeString("shared");
- child->getFastAttributeBOOL(shared_string, shared);
-
- info->mPolyMorphTargetInfoList.push_back(LLAvatarMeshInfo::morph_info_pair_t(morphinfo, shared));
- }
-
- mMeshInfoList.push_back(info);
- }
- return TRUE;
+ }
+
+ LLPolyMorphTargetInfo *morphinfo = new LLPolyMorphTargetInfo();
+ if (!morphinfo->parseXml(child))
+ {
+ delete morphinfo;
+ delete info;
+ return -1;
+ }
+ BOOL shared = FALSE;
+ static LLStdStringHandle shared_string = LLXmlTree::addAttributeString("shared");
+ child->getFastAttributeBOOL(shared_string, shared);
+
+ info->mPolyMorphTargetInfoList.push_back(LLAvatarMeshInfo::morph_info_pair_t(morphinfo, shared));
+ }
+
+ mMeshInfoList.push_back(info);
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -1929,61 +1904,61 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root)
{
- for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" );
- color_node;
- color_node = root->getNextNamedChild())
- {
- std::string global_color_name;
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- if (color_node->getFastAttributeString( name_string, global_color_name ) )
- {
- if( global_color_name == "skin_color" )
- {
- if (mTexSkinColorInfo)
- {
- LL_WARNS() << "avatar file: multiple instances of skin_color" << LL_ENDL;
- return FALSE;
- }
- mTexSkinColorInfo = new LLTexGlobalColorInfo;
- if( !mTexSkinColorInfo->parseXml( color_node ) )
- {
- delete_and_clear(mTexSkinColorInfo);
- LL_WARNS() << "avatar file: mTexSkinColor->parseXml() failed" << LL_ENDL;
- return FALSE;
- }
- }
- else if( global_color_name == "hair_color" )
- {
- if (mTexHairColorInfo)
- {
- LL_WARNS() << "avatar file: multiple instances of hair_color" << LL_ENDL;
- return FALSE;
- }
- mTexHairColorInfo = new LLTexGlobalColorInfo;
- if( !mTexHairColorInfo->parseXml( color_node ) )
- {
- delete_and_clear(mTexHairColorInfo);
- LL_WARNS() << "avatar file: mTexHairColor->parseXml() failed" << LL_ENDL;
- return FALSE;
- }
- }
- else if( global_color_name == "eye_color" )
- {
- if (mTexEyeColorInfo)
- {
- LL_WARNS() << "avatar file: multiple instances of eye_color" << LL_ENDL;
- return FALSE;
- }
- mTexEyeColorInfo = new LLTexGlobalColorInfo;
- if( !mTexEyeColorInfo->parseXml( color_node ) )
- {
- LL_WARNS() << "avatar file: mTexEyeColor->parseXml() failed" << LL_ENDL;
- return FALSE;
- }
- }
- }
- }
- return TRUE;
+ for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" );
+ color_node;
+ color_node = root->getNextNamedChild())
+ {
+ std::string global_color_name;
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ if (color_node->getFastAttributeString( name_string, global_color_name ) )
+ {
+ if( global_color_name == "skin_color" )
+ {
+ if (mTexSkinColorInfo)
+ {
+ LL_WARNS() << "avatar file: multiple instances of skin_color" << LL_ENDL;
+ return FALSE;
+ }
+ mTexSkinColorInfo = new LLTexGlobalColorInfo;
+ if( !mTexSkinColorInfo->parseXml( color_node ) )
+ {
+ delete_and_clear(mTexSkinColorInfo);
+ LL_WARNS() << "avatar file: mTexSkinColor->parseXml() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else if( global_color_name == "hair_color" )
+ {
+ if (mTexHairColorInfo)
+ {
+ LL_WARNS() << "avatar file: multiple instances of hair_color" << LL_ENDL;
+ return FALSE;
+ }
+ mTexHairColorInfo = new LLTexGlobalColorInfo;
+ if( !mTexHairColorInfo->parseXml( color_node ) )
+ {
+ delete_and_clear(mTexHairColorInfo);
+ LL_WARNS() << "avatar file: mTexHairColor->parseXml() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else if( global_color_name == "eye_color" )
+ {
+ if (mTexEyeColorInfo)
+ {
+ LL_WARNS() << "avatar file: multiple instances of eye_color" << LL_ENDL;
+ return FALSE;
+ }
+ mTexEyeColorInfo = new LLTexGlobalColorInfo;
+ if( !mTexEyeColorInfo->parseXml( color_node ) )
+ {
+ LL_WARNS() << "avatar file: mTexEyeColor->parseXml() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -1991,23 +1966,23 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root)
{
- for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" );
- layer_node;
- layer_node = root->getNextNamedChild())
- {
- LLTexLayerSetInfo* layer_info = new LLTexLayerSetInfo();
- if( layer_info->parseXml( layer_node ) )
- {
- mLayerInfoList.push_back(layer_info);
- }
- else
- {
- delete layer_info;
- LL_WARNS() << "avatar file: layer_set->parseXml() failed" << LL_ENDL;
- return FALSE;
- }
- }
- return TRUE;
+ for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" );
+ layer_node;
+ layer_node = root->getNextNamedChild())
+ {
+ LLTexLayerSetInfo* layer_info = new LLTexLayerSetInfo();
+ if( layer_info->parseXml( layer_node ) )
+ {
+ mLayerInfoList.push_back(layer_info);
+ }
+ else
+ {
+ delete layer_info;
+ LL_WARNS() << "avatar file: layer_set->parseXml() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -2015,30 +1990,30 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root)
{
- LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" );
- if( driver )
- {
- for (LLXmlTreeNode* grand_child = driver->getChildByName( "param" );
- grand_child;
- grand_child = driver->getNextNamedChild())
- {
- if( grand_child->getChildByName( "param_driver" ) )
- {
- LLDriverParamInfo* driver_info = new LLDriverParamInfo();
- if( driver_info->parseXml( grand_child ) )
- {
- mDriverInfoList.push_back(driver_info);
- }
- else
- {
- delete driver_info;
- LL_WARNS() << "avatar file: driver_param->parseXml() failed" << LL_ENDL;
- return FALSE;
- }
- }
- }
- }
- return TRUE;
+ LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" );
+ if( driver )
+ {
+ for (LLXmlTreeNode* grand_child = driver->getChildByName( "param" );
+ grand_child;
+ grand_child = driver->getNextNamedChild())
+ {
+ if( grand_child->getChildByName( "param_driver" ) )
+ {
+ LLDriverParamInfo* driver_info = new LLDriverParamInfo();
+ if( driver_info->parseXml( grand_child ) )
+ {
+ mDriverInfoList.push_back(driver_info);
+ }
+ else
+ {
+ delete driver_info;
+ LL_WARNS() << "avatar file: driver_param->parseXml() failed" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ }
+ }
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -2046,61 +2021,61 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* roo
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root)
{
- LLXmlTreeNode* masks = root->getChildByName( "morph_masks" );
- if( !masks )
- {
- return FALSE;
- }
-
- for (LLXmlTreeNode* grand_child = masks->getChildByName( "mask" );
- grand_child;
- grand_child = masks->getNextNamedChild())
- {
- LLAvatarMorphInfo* info = new LLAvatarMorphInfo();
-
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name");
- if (!grand_child->getFastAttributeString(name_string, info->mName))
- {
- LL_WARNS() << "No name supplied for morph mask." << LL_ENDL;
- delete info;
+ LLXmlTreeNode* masks = root->getChildByName( "morph_masks" );
+ if( !masks )
+ {
+ return FALSE;
+ }
+
+ for (LLXmlTreeNode* grand_child = masks->getChildByName( "mask" );
+ grand_child;
+ grand_child = masks->getNextNamedChild())
+ {
+ LLAvatarMorphInfo* info = new LLAvatarMorphInfo();
+
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name");
+ if (!grand_child->getFastAttributeString(name_string, info->mName))
+ {
+ LL_WARNS() << "No name supplied for morph mask." << LL_ENDL;
+ delete info;
return FALSE;
- }
+ }
- static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region");
- if (!grand_child->getFastAttributeString(region_string, info->mRegion))
- {
- LL_WARNS() << "No region supplied for morph mask." << LL_ENDL;
- delete info;
+ static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region");
+ if (!grand_child->getFastAttributeString(region_string, info->mRegion))
+ {
+ LL_WARNS() << "No region supplied for morph mask." << LL_ENDL;
+ delete info;
return FALSE;
- }
+ }
- static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer");
- if (!grand_child->getFastAttributeString(layer_string, info->mLayer))
- {
- LL_WARNS() << "No layer supplied for morph mask." << LL_ENDL;
- delete info;
+ static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer");
+ if (!grand_child->getFastAttributeString(layer_string, info->mLayer))
+ {
+ LL_WARNS() << "No layer supplied for morph mask." << LL_ENDL;
+ delete info;
return FALSE;
- }
+ }
- // optional parameter. don't throw a warning if not present.
- static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert");
- grand_child->getFastAttributeBOOL(invert_string, info->mInvert);
+ // optional parameter. don't throw a warning if not present.
+ static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert");
+ grand_child->getFastAttributeBOOL(invert_string, info->mInvert);
- mMorphMaskInfoList.push_back(info);
- }
+ mMorphMaskInfoList.push_back(info);
+ }
- return TRUE;
+ return TRUE;
}
-//virtual
+//virtual
LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer) :
- mMorphTarget(morph_target),
- mInvert(invert),
- mLayer(layer)
+ mMorphTarget(morph_target),
+ mInvert(invert),
+ mLayer(layer)
{
- LLPolyMorphTarget *target = dynamic_cast<LLPolyMorphTarget*>(morph_target);
- if (target)
- {
- target->addPendingMorphMask();
- }
+ LLPolyMorphTarget *target = dynamic_cast<LLPolyMorphTarget*>(morph_target);
+ if (target)
+ {
+ target->addPendingMorphMask();
+ }
}
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index e3444efcf6..9dd1ddffad 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,36 +44,36 @@ class LLAvatarSkeletonInfo;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLAvatarAppearance
-//
+//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLAvatarAppearance : public LLCharacter
{
- LOG_CLASS(LLAvatarAppearance);
+ LOG_CLASS(LLAvatarAppearance);
protected:
- struct LLAvatarXmlInfo;
+ struct LLAvatarXmlInfo;
/********************************************************************************
** **
** INITIALIZATION
**/
private:
- // Hide default constructor.
- LLAvatarAppearance() {}
+ // Hide default constructor.
+ LLAvatarAppearance() {}
public:
- LLAvatarAppearance(LLWearableData* wearable_data);
- virtual ~LLAvatarAppearance();
+ LLAvatarAppearance(LLWearableData* wearable_data);
+ virtual ~LLAvatarAppearance();
- static void initClass(const std::string& avatar_file_name, const std::string& skeleton_file_name); // initializes static members
- static void initClass();
- static void cleanupClass(); // Cleanup data that's only init'd once per class.
- virtual void initInstance(); // Called after construction to initialize the instance.
- S32 mInitFlags;
- virtual BOOL loadSkeletonNode();
- BOOL loadMeshNodes();
- BOOL loadLayersets();
+ static void initClass(const std::string& avatar_file_name, const std::string& skeleton_file_name); // initializes static members
+ static void initClass();
+ static void cleanupClass(); // Cleanup data that's only init'd once per class.
+ virtual void initInstance(); // Called after construction to initialize the instance.
+ S32 mInitFlags;
+ virtual BOOL loadSkeletonNode();
+ BOOL loadMeshNodes();
+ BOOL loadLayersets();
/** Initialization
@@ -85,18 +85,18 @@ public:
** INHERITED
**/
- //--------------------------------------------------------------------
- // LLCharacter interface and related
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // LLCharacter interface and related
+ //--------------------------------------------------------------------
public:
- /*virtual*/ LLJoint* getCharacterJoint(U32 num);
+ /*virtual*/ LLJoint* getCharacterJoint(U32 num);
- /*virtual*/ const char* getAnimationPrefix() { return "avatar"; }
- /*virtual*/ LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset);
- /*virtual*/ LLJoint* findCollisionVolume(S32 volume_id);
- /*virtual*/ S32 getCollisionVolumeID(std::string &name);
- /*virtual*/ LLPolyMesh* getHeadMesh();
- /*virtual*/ LLPolyMesh* getUpperBodyMesh();
+ /*virtual*/ const char* getAnimationPrefix() { return "avatar"; }
+ /*virtual*/ LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset);
+ /*virtual*/ LLJoint* findCollisionVolume(S32 volume_id);
+ /*virtual*/ S32 getCollisionVolumeID(std::string &name);
+ /*virtual*/ LLPolyMesh* getHeadMesh();
+ /*virtual*/ LLPolyMesh* getUpperBodyMesh();
/** Inherited
** **
@@ -107,14 +107,14 @@ public:
** STATE
**/
public:
- virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
- virtual BOOL isValid() const;
- virtual BOOL isUsingLocalAppearance() const = 0;
- virtual BOOL isEditingAppearance() const = 0;
+ virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
+ virtual BOOL isValid() const;
+ virtual BOOL isUsingLocalAppearance() const = 0;
+ virtual BOOL isEditingAppearance() const = 0;
+
+ bool isBuilt() const { return mIsBuilt; }
- bool isBuilt() const { return mIsBuilt; }
-
/** State
** **
*******************************************************************************/
@@ -125,94 +125,96 @@ public:
**/
protected:
- virtual LLAvatarJoint* createAvatarJoint() = 0;
+ virtual LLAvatarJoint* createAvatarJoint() = 0;
virtual LLAvatarJoint* createAvatarJoint(S32 joint_num) = 0;
- virtual LLAvatarJointMesh* createAvatarJointMesh() = 0;
+ virtual LLAvatarJointMesh* createAvatarJointMesh() = 0;
void makeJointAliases(LLAvatarBoneInfo *bone_info);
public:
- F32 getPelvisToFoot() const { return mPelvisToFoot; }
- /*virtual*/ LLJoint* getRootJoint() { return mRoot; }
+ F32 getPelvisToFoot() const { return mPelvisToFoot; }
+ /*virtual*/ LLJoint* getRootJoint() { return mRoot; }
- LLVector3 mHeadOffset; // current head position
- LLAvatarJoint *mRoot;
+ LLVector3 mHeadOffset; // current head position
+ LLAvatarJoint *mRoot;
- typedef std::map<std::string, LLJoint*> joint_map_t;
- joint_map_t mJointMap;
+ typedef std::map<std::string, LLJoint*> joint_map_t;
+ joint_map_t mJointMap;
typedef std::map<std::string, LLVector3> joint_state_map_t;
joint_state_map_t mLastBodySizeState;
joint_state_map_t mCurrBodySizeState;
void compareJointStateMaps(joint_state_map_t& last_state,
joint_state_map_t& curr_state);
- void computeBodySize();
+ void computeBodySize();
+ F32 computeBodyHeight();
+ F32 computePelvisToFoot();
public:
- typedef std::vector<LLAvatarJoint*> avatar_joint_list_t;
+ typedef std::vector<LLAvatarJoint*> avatar_joint_list_t;
const avatar_joint_list_t& getSkeleton() { return mSkeleton; }
typedef std::map<std::string, std::string> joint_alias_map_t;
const joint_alias_map_t& getJointAliases();
protected:
- static BOOL parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree);
- virtual void buildCharacter();
- virtual BOOL loadAvatar();
-
- BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &current_volume_num, S32 &current_joint_num);
- BOOL allocateCharacterJoints(U32 num);
- BOOL buildSkeleton(const LLAvatarSkeletonInfo *info);
-
- void clearSkeleton();
- BOOL mIsBuilt; // state of deferred character building
- avatar_joint_list_t mSkeleton;
- LLVector3OverrideMap mPelvisFixups;
+ static BOOL parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree);
+ virtual void buildCharacter();
+ virtual BOOL loadAvatar();
+
+ BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &current_volume_num, S32 &current_joint_num);
+ BOOL allocateCharacterJoints(U32 num);
+ BOOL buildSkeleton(const LLAvatarSkeletonInfo *info);
+
+ void clearSkeleton();
+ BOOL mIsBuilt; // state of deferred character building
+ avatar_joint_list_t mSkeleton;
+ LLVector3OverrideMap mPelvisFixups;
joint_alias_map_t mJointAliasMap;
- //--------------------------------------------------------------------
- // Pelvis height adjustment members.
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Pelvis height adjustment members.
+ //--------------------------------------------------------------------
public:
- void addPelvisFixup( F32 fixup, const LLUUID& mesh_id );
- void removePelvisFixup( const LLUUID& mesh_id );
- bool hasPelvisFixup( F32& fixup, LLUUID& mesh_id ) const;
- bool hasPelvisFixup( F32& fixup ) const;
-
- LLVector3 mBodySize;
- LLVector3 mAvatarOffset;
+ void addPelvisFixup( F32 fixup, const LLUUID& mesh_id );
+ void removePelvisFixup( const LLUUID& mesh_id );
+ bool hasPelvisFixup( F32& fixup, LLUUID& mesh_id ) const;
+ bool hasPelvisFixup( F32& fixup ) const;
+
+ LLVector3 mBodySize;
+ LLVector3 mAvatarOffset;
protected:
- F32 mPelvisToFoot;
+ F32 mPelvisToFoot;
- //--------------------------------------------------------------------
- // Cached pointers to well known joints
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Cached pointers to well known joints
+ //--------------------------------------------------------------------
public:
- LLJoint* mPelvisp;
- LLJoint* mTorsop;
- LLJoint* mChestp;
- LLJoint* mNeckp;
- LLJoint* mHeadp;
- LLJoint* mSkullp;
- LLJoint* mEyeLeftp;
- LLJoint* mEyeRightp;
- LLJoint* mHipLeftp;
- LLJoint* mHipRightp;
- LLJoint* mKneeLeftp;
- LLJoint* mKneeRightp;
- LLJoint* mAnkleLeftp;
- LLJoint* mAnkleRightp;
- LLJoint* mFootLeftp;
- LLJoint* mFootRightp;
- LLJoint* mWristLeftp;
- LLJoint* mWristRightp;
-
- //--------------------------------------------------------------------
- // XML parse tree
- //--------------------------------------------------------------------
+ LLJoint* mPelvisp;
+ LLJoint* mTorsop;
+ LLJoint* mChestp;
+ LLJoint* mNeckp;
+ LLJoint* mHeadp;
+ LLJoint* mSkullp;
+ LLJoint* mEyeLeftp;
+ LLJoint* mEyeRightp;
+ LLJoint* mHipLeftp;
+ LLJoint* mHipRightp;
+ LLJoint* mKneeLeftp;
+ LLJoint* mKneeRightp;
+ LLJoint* mAnkleLeftp;
+ LLJoint* mAnkleRightp;
+ LLJoint* mFootLeftp;
+ LLJoint* mFootRightp;
+ LLJoint* mWristLeftp;
+ LLJoint* mWristRightp;
+
+ //--------------------------------------------------------------------
+ // XML parse tree
+ //--------------------------------------------------------------------
protected:
- static LLAvatarSkeletonInfo* sAvatarSkeletonInfo;
- static LLAvatarXmlInfo* sAvatarXmlInfo;
+ static LLAvatarSkeletonInfo* sAvatarSkeletonInfo;
+ static LLAvatarXmlInfo* sAvatarXmlInfo;
/** Skeleton
@@ -225,24 +227,24 @@ protected:
** RENDERING
**/
public:
- BOOL mIsDummy; // for special views and animated object controllers; local to viewer
+ BOOL mIsDummy; // for special views and animated object controllers; local to viewer
- //--------------------------------------------------------------------
- // Morph masks
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Morph masks
+ //--------------------------------------------------------------------
public:
- void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLVisualParam* morph_target, BOOL invert, std::string layer);
- virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES) = 0;
+ void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLVisualParam* morph_target, BOOL invert, std::string layer);
+ virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES) = 0;
/** Rendering
** **
*******************************************************************************/
- //--------------------------------------------------------------------
- // Composites
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Composites
+ //--------------------------------------------------------------------
public:
- virtual void invalidateComposite(LLTexLayerSet* layerset) = 0;
+ virtual void invalidateComposite(LLTexLayerSet* layerset) = 0;
/********************************************************************************
** **
@@ -250,16 +252,16 @@ public:
**/
public:
- virtual void updateMeshTextures() = 0;
- virtual void dirtyMesh() = 0; // Dirty the avatar mesh
- static const LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary *getDictionary() { return sAvatarDictionary; }
+ virtual void updateMeshTextures() = 0;
+ virtual void dirtyMesh() = 0; // Dirty the avatar mesh
+ static const LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary *getDictionary() { return sAvatarDictionary; }
protected:
- virtual void dirtyMesh(S32 priority) = 0; // Dirty the avatar mesh, with priority
+ virtual void dirtyMesh(S32 priority) = 0; // Dirty the avatar mesh, with priority
protected:
- typedef std::multimap<std::string, LLPolyMesh*> polymesh_map_t;
- polymesh_map_t mPolyMeshes;
- avatar_joint_list_t mMeshLOD;
+ typedef std::multimap<std::string, LLPolyMesh*> polymesh_map_t;
+ polymesh_map_t mPolyMeshes;
+ avatar_joint_list_t mMeshLOD;
// mesh entries and backed textures
static LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* sAvatarDictionary;
@@ -273,30 +275,30 @@ protected:
** APPEARANCE
**/
- //--------------------------------------------------------------------
- // Clothing colors (convenience functions to access visual parameters)
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Clothing colors (convenience functions to access visual parameters)
+ //--------------------------------------------------------------------
public:
- void setClothesColor(LLAvatarAppearanceDefines::ETextureIndex te, const LLColor4& new_color);
- LLColor4 getClothesColor(LLAvatarAppearanceDefines::ETextureIndex te);
- static BOOL teToColorParams(LLAvatarAppearanceDefines::ETextureIndex te, U32 *param_name);
+ void setClothesColor(LLAvatarAppearanceDefines::ETextureIndex te, const LLColor4& new_color);
+ LLColor4 getClothesColor(LLAvatarAppearanceDefines::ETextureIndex te);
+ static BOOL teToColorParams(LLAvatarAppearanceDefines::ETextureIndex te, U32 *param_name);
- //--------------------------------------------------------------------
- // Global colors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Global colors
+ //--------------------------------------------------------------------
public:
- LLColor4 getGlobalColor(const std::string& color_name ) const;
- virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color) = 0;
+ LLColor4 getGlobalColor(const std::string& color_name ) const;
+ virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color) = 0;
protected:
- LLTexGlobalColor* mTexSkinColor;
- LLTexGlobalColor* mTexHairColor;
- LLTexGlobalColor* mTexEyeColor;
+ LLTexGlobalColor* mTexSkinColor;
+ LLTexGlobalColor* mTexHairColor;
+ LLTexGlobalColor* mTexEyeColor;
- //--------------------------------------------------------------------
- // Visibility
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Visibility
+ //--------------------------------------------------------------------
public:
- static LLColor4 getDummyColor();
+ static LLColor4 getDummyColor();
/** Appearance
** **
*******************************************************************************/
@@ -307,56 +309,56 @@ public:
**/
public:
- LLWearableData* getWearableData() { return mWearableData; }
- const LLWearableData* getWearableData() const { return mWearableData; }
- virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index = 0 ) const = 0;
- virtual BOOL isWearingWearableType(LLWearableType::EType type ) const;
+ LLWearableData* getWearableData() { return mWearableData; }
+ const LLWearableData* getWearableData() const { return mWearableData; }
+ virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index = 0 ) const = 0;
+ virtual BOOL isWearingWearableType(LLWearableType::EType type ) const;
private:
- LLWearableData* mWearableData;
+ LLWearableData* mWearableData;
/********************************************************************************
** **
** BAKED TEXTURES
**/
public:
- LLTexLayerSet* getAvatarLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
+ LLTexLayerSet* getAvatarLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
protected:
- virtual LLTexLayerSet* createTexLayerSet() = 0;
+ virtual LLTexLayerSet* createTexLayerSet() = 0;
protected:
- class LLMaskedMorph;
- typedef std::deque<LLMaskedMorph *> morph_list_t;
- struct BakedTextureData
- {
- LLUUID mLastTextureID;
- LLTexLayerSet* mTexLayerSet; // Only exists for self
- bool mIsLoaded;
- bool mIsUsed;
- LLAvatarAppearanceDefines::ETextureIndex mTextureIndex;
- U32 mMaskTexName;
- // Stores pointers to the joint meshes that this baked texture deals with
- avatar_joint_mesh_list_t mJointMeshes;
- morph_list_t mMaskedMorphs;
- };
- typedef std::vector<BakedTextureData> bakedtexturedata_vec_t;
- bakedtexturedata_vec_t mBakedTextureDatas;
+ class LLMaskedMorph;
+ typedef std::deque<LLMaskedMorph *> morph_list_t;
+ struct BakedTextureData
+ {
+ LLUUID mLastTextureID;
+ LLTexLayerSet* mTexLayerSet; // Only exists for self
+ bool mIsLoaded;
+ bool mIsUsed;
+ LLAvatarAppearanceDefines::ETextureIndex mTextureIndex;
+ U32 mMaskTexName;
+ // Stores pointers to the joint meshes that this baked texture deals with
+ avatar_joint_mesh_list_t mJointMeshes;
+ morph_list_t mMaskedMorphs;
+ };
+ typedef std::vector<BakedTextureData> bakedtexturedata_vec_t;
+ bakedtexturedata_vec_t mBakedTextureDatas;
/********************************************************************************
** **
** PHYSICS
**/
- //--------------------------------------------------------------------
- // Collision volumes
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Collision volumes
+ //--------------------------------------------------------------------
public:
- S32 mNumBones;
- S32 mNumCollisionVolumes;
- LLAvatarJointCollisionVolume* mCollisionVolumes;
+ S32 mNumBones;
+ S32 mNumCollisionVolumes;
+ LLAvatarJointCollisionVolume* mCollisionVolumes;
protected:
- BOOL allocateCollisionVolumes(U32 num);
+ BOOL allocateCollisionVolumes(U32 num);
/** Physics
** **
@@ -367,100 +369,100 @@ protected:
** SUPPORT CLASSES
**/
- struct LLAvatarXmlInfo
- {
- LLAvatarXmlInfo();
- ~LLAvatarXmlInfo();
-
- BOOL parseXmlSkeletonNode(LLXmlTreeNode* root);
- BOOL parseXmlMeshNodes(LLXmlTreeNode* root);
- BOOL parseXmlColorNodes(LLXmlTreeNode* root);
- BOOL parseXmlLayerNodes(LLXmlTreeNode* root);
- BOOL parseXmlDriverNodes(LLXmlTreeNode* root);
- BOOL parseXmlMorphNodes(LLXmlTreeNode* root);
-
- struct LLAvatarMeshInfo
- {
- typedef std::pair<LLViewerVisualParamInfo*,BOOL> morph_info_pair_t; // LLPolyMorphTargetInfo stored here
- typedef std::vector<morph_info_pair_t> morph_info_list_t;
-
- LLAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {}
- ~LLAvatarMeshInfo()
- {
- for (morph_info_list_t::value_type& pair : mPolyMorphTargetInfoList)
- {
- delete pair.first;
- }
- mPolyMorphTargetInfoList.clear();
- }
-
- std::string mType;
- S32 mLOD;
- std::string mMeshFileName;
- std::string mReferenceMeshName;
- F32 mMinPixelArea;
- morph_info_list_t mPolyMorphTargetInfoList;
- };
- typedef std::vector<LLAvatarMeshInfo*> mesh_info_list_t;
- mesh_info_list_t mMeshInfoList;
-
- typedef std::vector<LLViewerVisualParamInfo*> skeletal_distortion_info_list_t; // LLPolySkeletalDistortionInfo stored here
- skeletal_distortion_info_list_t mSkeletalDistortionInfoList;
-
- struct LLAvatarAttachmentInfo
- {
- LLAvatarAttachmentInfo()
- : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE),
- mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {}
- std::string mName;
- std::string mJointName;
- LLVector3 mPosition;
- LLVector3 mRotationEuler;
- S32 mGroup;
- S32 mAttachmentID;
- S32 mPieMenuSlice;
- BOOL mVisibleFirstPerson;
- BOOL mIsHUDAttachment;
- BOOL mHasPosition;
- BOOL mHasRotation;
- };
- typedef std::vector<LLAvatarAttachmentInfo*> attachment_info_list_t;
- attachment_info_list_t mAttachmentInfoList;
-
- LLTexGlobalColorInfo *mTexSkinColorInfo;
- LLTexGlobalColorInfo *mTexHairColorInfo;
- LLTexGlobalColorInfo *mTexEyeColorInfo;
-
- typedef std::vector<LLTexLayerSetInfo*> layer_info_list_t;
- layer_info_list_t mLayerInfoList;
-
- typedef std::vector<LLDriverParamInfo*> driver_info_list_t;
- driver_info_list_t mDriverInfoList;
-
- struct LLAvatarMorphInfo
- {
- LLAvatarMorphInfo()
- : mInvert(FALSE) {}
- std::string mName;
- std::string mRegion;
- std::string mLayer;
- BOOL mInvert;
- };
-
- typedef std::vector<LLAvatarMorphInfo*> morph_info_list_t;
- morph_info_list_t mMorphMaskInfoList;
- };
-
-
- class LLMaskedMorph
- {
- public:
- LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer);
-
- LLVisualParam *mMorphTarget;
- BOOL mInvert;
- std::string mLayer;
- };
+ struct LLAvatarXmlInfo
+ {
+ LLAvatarXmlInfo();
+ ~LLAvatarXmlInfo();
+
+ BOOL parseXmlSkeletonNode(LLXmlTreeNode* root);
+ BOOL parseXmlMeshNodes(LLXmlTreeNode* root);
+ BOOL parseXmlColorNodes(LLXmlTreeNode* root);
+ BOOL parseXmlLayerNodes(LLXmlTreeNode* root);
+ BOOL parseXmlDriverNodes(LLXmlTreeNode* root);
+ BOOL parseXmlMorphNodes(LLXmlTreeNode* root);
+
+ struct LLAvatarMeshInfo
+ {
+ typedef std::pair<LLViewerVisualParamInfo*,BOOL> morph_info_pair_t; // LLPolyMorphTargetInfo stored here
+ typedef std::vector<morph_info_pair_t> morph_info_list_t;
+
+ LLAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {}
+ ~LLAvatarMeshInfo()
+ {
+ for (morph_info_list_t::value_type& pair : mPolyMorphTargetInfoList)
+ {
+ delete pair.first;
+ }
+ mPolyMorphTargetInfoList.clear();
+ }
+
+ std::string mType;
+ S32 mLOD;
+ std::string mMeshFileName;
+ std::string mReferenceMeshName;
+ F32 mMinPixelArea;
+ morph_info_list_t mPolyMorphTargetInfoList;
+ };
+ typedef std::vector<LLAvatarMeshInfo*> mesh_info_list_t;
+ mesh_info_list_t mMeshInfoList;
+
+ typedef std::vector<LLViewerVisualParamInfo*> skeletal_distortion_info_list_t; // LLPolySkeletalDistortionInfo stored here
+ skeletal_distortion_info_list_t mSkeletalDistortionInfoList;
+
+ struct LLAvatarAttachmentInfo
+ {
+ LLAvatarAttachmentInfo()
+ : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE),
+ mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {}
+ std::string mName;
+ std::string mJointName;
+ LLVector3 mPosition;
+ LLVector3 mRotationEuler;
+ S32 mGroup;
+ S32 mAttachmentID;
+ S32 mPieMenuSlice;
+ BOOL mVisibleFirstPerson;
+ BOOL mIsHUDAttachment;
+ BOOL mHasPosition;
+ BOOL mHasRotation;
+ };
+ typedef std::vector<LLAvatarAttachmentInfo*> attachment_info_list_t;
+ attachment_info_list_t mAttachmentInfoList;
+
+ LLTexGlobalColorInfo *mTexSkinColorInfo;
+ LLTexGlobalColorInfo *mTexHairColorInfo;
+ LLTexGlobalColorInfo *mTexEyeColorInfo;
+
+ typedef std::vector<LLTexLayerSetInfo*> layer_info_list_t;
+ layer_info_list_t mLayerInfoList;
+
+ typedef std::vector<LLDriverParamInfo*> driver_info_list_t;
+ driver_info_list_t mDriverInfoList;
+
+ struct LLAvatarMorphInfo
+ {
+ LLAvatarMorphInfo()
+ : mInvert(FALSE) {}
+ std::string mName;
+ std::string mRegion;
+ std::string mLayer;
+ BOOL mInvert;
+ };
+
+ typedef std::vector<LLAvatarMorphInfo*> morph_info_list_t;
+ morph_info_list_t mMorphMaskInfoList;
+ };
+
+
+ class LLMaskedMorph
+ {
+ public:
+ LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer);
+
+ LLVisualParam *mMorphTarget;
+ BOOL mInvert;
+ std::string mLayer;
+ };
/** Support Classes
** **
*******************************************************************************/
diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp
index 8759c387e8..0e51fd459e 100644
--- a/indra/llappearance/llavatarappearancedefines.cpp
+++ b/indra/llappearance/llavatarappearancedefines.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarappearancedefines.cpp
- * @brief Implementation of LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary
+ * @brief Implementation of LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,130 +39,130 @@ using namespace LLAvatarAppearanceDefines;
LLAvatarAppearanceDictionary::Textures::Textures()
{
- addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
- addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT));
- addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", LLWearableType::WT_PANTS));
- addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", LLWearableType::WT_EYES));
- addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", LLWearableType::WT_HAIR));
- addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
- addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
- addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", LLWearableType::WT_SHOES));
- addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", LLWearableType::WT_SOCKS));
- addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET));
- addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET));
- addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", LLWearableType::WT_GLOVES));
- addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERSHIRT));
- addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERPANTS));
- addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", LLWearableType::WT_SKIRT));
-
- addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
- addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
- addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
- addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
- addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
-
- addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
- addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
- addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
-
- addEntry(TEX_HEAD_UNIVERSAL_TATTOO, new TextureEntry("head_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_UPPER_UNIVERSAL_TATTOO, new TextureEntry("upper_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_LOWER_UNIVERSAL_TATTOO, new TextureEntry("lower_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_SKIRT_TATTOO, new TextureEntry("skirt_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_HAIR_TATTOO, new TextureEntry("hair_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_EYES_TATTOO, new TextureEntry("eyes_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_LEFT_ARM_TATTOO, new TextureEntry("leftarm_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_LEFT_LEG_TATTOO, new TextureEntry("leftleg_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_AUX1_TATTOO, new TextureEntry("aux1_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_AUX2_TATTOO, new TextureEntry("aux2_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
- addEntry(TEX_AUX3_TATTOO, new TextureEntry("aux3_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
-
-
- addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD, "head"));
- addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER, "upper"));
- addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER, "lower"));
- addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES, "eyes"));
- addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR, "hair"));
- addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt"));
- addEntry(TEX_LEFT_ARM_BAKED, new TextureEntry("leftarm-baked", FALSE, BAKED_LEFT_ARM, "leftarm"));
- addEntry(TEX_LEFT_LEG_BAKED, new TextureEntry("leftleg-baked", FALSE, BAKED_LEFT_LEG, "leftleg"));
- addEntry(TEX_AUX1_BAKED, new TextureEntry("aux1-baked", FALSE, BAKED_AUX1, "aux1"));
- addEntry(TEX_AUX2_BAKED, new TextureEntry("aux2-baked", FALSE, BAKED_AUX2, "aux2"));
- addEntry(TEX_AUX3_BAKED, new TextureEntry("aux3-baked", FALSE, BAKED_AUX3, "aux3"));
+ addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
+ addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT));
+ addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", LLWearableType::WT_PANTS));
+ addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", LLWearableType::WT_EYES));
+ addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", LLWearableType::WT_HAIR));
+ addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
+ addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
+ addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", LLWearableType::WT_SHOES));
+ addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", LLWearableType::WT_SOCKS));
+ addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET));
+ addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET));
+ addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", LLWearableType::WT_GLOVES));
+ addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERSHIRT));
+ addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERPANTS));
+ addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", LLWearableType::WT_SKIRT));
+
+ addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+ addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+ addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+ addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+ addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
+
+ addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
+ addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
+ addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
+
+ addEntry(TEX_HEAD_UNIVERSAL_TATTOO, new TextureEntry("head_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_UPPER_UNIVERSAL_TATTOO, new TextureEntry("upper_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_LOWER_UNIVERSAL_TATTOO, new TextureEntry("lower_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_SKIRT_TATTOO, new TextureEntry("skirt_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_HAIR_TATTOO, new TextureEntry("hair_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_EYES_TATTOO, new TextureEntry("eyes_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_LEFT_ARM_TATTOO, new TextureEntry("leftarm_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_LEFT_LEG_TATTOO, new TextureEntry("leftleg_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_AUX1_TATTOO, new TextureEntry("aux1_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_AUX2_TATTOO, new TextureEntry("aux2_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+ addEntry(TEX_AUX3_TATTOO, new TextureEntry("aux3_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
+
+
+ addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD, "head"));
+ addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER, "upper"));
+ addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER, "lower"));
+ addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES, "eyes"));
+ addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR, "hair"));
+ addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt"));
+ addEntry(TEX_LEFT_ARM_BAKED, new TextureEntry("leftarm-baked", FALSE, BAKED_LEFT_ARM, "leftarm"));
+ addEntry(TEX_LEFT_LEG_BAKED, new TextureEntry("leftleg-baked", FALSE, BAKED_LEFT_LEG, "leftleg"));
+ addEntry(TEX_AUX1_BAKED, new TextureEntry("aux1-baked", FALSE, BAKED_AUX1, "aux1"));
+ addEntry(TEX_AUX2_BAKED, new TextureEntry("aux2-baked", FALSE, BAKED_AUX2, "aux2"));
+ addEntry(TEX_AUX3_BAKED, new TextureEntry("aux3-baked", FALSE, BAKED_AUX3, "aux3"));
}
LLAvatarAppearanceDictionary::BakedTextures::BakedTextures()
{
- // Baked textures
- addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
- "head", "a4b9dc38-e13b-4df9-b284-751efb0566ff",
- 4, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA, TEX_HEAD_UNIVERSAL_TATTOO,
- 6, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_HAIR, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
-
- addEntry(BAKED_UPPER, new BakedEntry(TEX_UPPER_BAKED,
- "upper_body", "5943ff64-d26c-4a90-a8c0-d61f56bd98d4",
- 8, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET,
- TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA, TEX_UPPER_UNIVERSAL_TATTOO,
- 9, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_SHIRT, LLWearableType::WT_JACKET, LLWearableType::WT_GLOVES, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
-
- addEntry(BAKED_LOWER, new BakedEntry(TEX_LOWER_BAKED,
- "lower_body", "2944ee70-90a7-425d-a5fb-d749c782ed7d",
- 9, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS,
- TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA, TEX_LOWER_UNIVERSAL_TATTOO,
- 10, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_PANTS, LLWearableType::WT_SHOES, LLWearableType::WT_SOCKS, LLWearableType::WT_JACKET, LLWearableType::WT_UNDERPANTS, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
-
- addEntry(BAKED_EYES, new BakedEntry(TEX_EYES_BAKED,
- "eyes", "27b1bc0f-979f-4b13-95fe-b981c2ba9788",
- 3, TEX_EYES_IRIS, TEX_EYES_TATTOO, TEX_EYES_ALPHA,
- 3, LLWearableType::WT_EYES, LLWearableType::WT_UNIVERSAL, LLWearableType::WT_ALPHA));
-
- addEntry(BAKED_SKIRT, new BakedEntry(TEX_SKIRT_BAKED,
- "skirt", "03e7e8cb-1368-483b-b6f3-74850838ba63",
- 2, TEX_SKIRT, TEX_SKIRT_TATTOO,
- 2, LLWearableType::WT_SKIRT, LLWearableType::WT_UNIVERSAL ));
-
- addEntry(BAKED_HAIR, new BakedEntry(TEX_HAIR_BAKED,
- "hair", "a60e85a9-74e8-48d8-8a2d-8129f28d9b61",
- 3, TEX_HAIR, TEX_HAIR_TATTOO, TEX_HAIR_ALPHA,
- 3, LLWearableType::WT_HAIR, LLWearableType::WT_UNIVERSAL, LLWearableType::WT_ALPHA));
-
- addEntry(BAKED_LEFT_ARM, new BakedEntry(TEX_LEFT_ARM_BAKED,
- "leftarm", "9f39febf-22d7-0087-79d1-e9e8c6c9ed19",
- 1, TEX_LEFT_ARM_TATTOO,
- 1, LLWearableType::WT_UNIVERSAL));
-
- addEntry(BAKED_LEFT_LEG, new BakedEntry(TEX_LEFT_LEG_BAKED,
- "leftleg", "054a7a58-8ed5-6386-0add-3b636fb28b78",
- 1, TEX_LEFT_LEG_TATTOO,
- 1, LLWearableType::WT_UNIVERSAL));
-
- addEntry(BAKED_AUX1, new BakedEntry(TEX_AUX1_BAKED,
- "aux1", "790c11be-b25c-c17e-b4d2-6a4ad786b752",
- 1, TEX_AUX1_TATTOO,
- 1, LLWearableType::WT_UNIVERSAL));
-
- addEntry(BAKED_AUX2, new BakedEntry(TEX_AUX2_BAKED,
- "aux2", "d78c478f-48c7-5928-5864-8d99fb1f521e",
- 1, TEX_AUX2_TATTOO,
- 1, LLWearableType::WT_UNIVERSAL));
-
- addEntry(BAKED_AUX3, new BakedEntry(TEX_AUX3_BAKED,
- "aux3", "6a95dd53-edd9-aac8-f6d3-27ed99f3c3eb",
- 1, TEX_AUX3_TATTOO,
- 1, LLWearableType::WT_UNIVERSAL));
+ // Baked textures
+ addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
+ "head", "a4b9dc38-e13b-4df9-b284-751efb0566ff",
+ 4, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA, TEX_HEAD_UNIVERSAL_TATTOO,
+ 6, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_HAIR, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
+
+ addEntry(BAKED_UPPER, new BakedEntry(TEX_UPPER_BAKED,
+ "upper_body", "5943ff64-d26c-4a90-a8c0-d61f56bd98d4",
+ 8, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET,
+ TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA, TEX_UPPER_UNIVERSAL_TATTOO,
+ 9, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_SHIRT, LLWearableType::WT_JACKET, LLWearableType::WT_GLOVES, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
+
+ addEntry(BAKED_LOWER, new BakedEntry(TEX_LOWER_BAKED,
+ "lower_body", "2944ee70-90a7-425d-a5fb-d749c782ed7d",
+ 9, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS,
+ TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA, TEX_LOWER_UNIVERSAL_TATTOO,
+ 10, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_PANTS, LLWearableType::WT_SHOES, LLWearableType::WT_SOCKS, LLWearableType::WT_JACKET, LLWearableType::WT_UNDERPANTS, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
+
+ addEntry(BAKED_EYES, new BakedEntry(TEX_EYES_BAKED,
+ "eyes", "27b1bc0f-979f-4b13-95fe-b981c2ba9788",
+ 3, TEX_EYES_IRIS, TEX_EYES_TATTOO, TEX_EYES_ALPHA,
+ 3, LLWearableType::WT_EYES, LLWearableType::WT_UNIVERSAL, LLWearableType::WT_ALPHA));
+
+ addEntry(BAKED_SKIRT, new BakedEntry(TEX_SKIRT_BAKED,
+ "skirt", "03e7e8cb-1368-483b-b6f3-74850838ba63",
+ 2, TEX_SKIRT, TEX_SKIRT_TATTOO,
+ 2, LLWearableType::WT_SKIRT, LLWearableType::WT_UNIVERSAL ));
+
+ addEntry(BAKED_HAIR, new BakedEntry(TEX_HAIR_BAKED,
+ "hair", "a60e85a9-74e8-48d8-8a2d-8129f28d9b61",
+ 3, TEX_HAIR, TEX_HAIR_TATTOO, TEX_HAIR_ALPHA,
+ 3, LLWearableType::WT_HAIR, LLWearableType::WT_UNIVERSAL, LLWearableType::WT_ALPHA));
+
+ addEntry(BAKED_LEFT_ARM, new BakedEntry(TEX_LEFT_ARM_BAKED,
+ "leftarm", "9f39febf-22d7-0087-79d1-e9e8c6c9ed19",
+ 1, TEX_LEFT_ARM_TATTOO,
+ 1, LLWearableType::WT_UNIVERSAL));
+
+ addEntry(BAKED_LEFT_LEG, new BakedEntry(TEX_LEFT_LEG_BAKED,
+ "leftleg", "054a7a58-8ed5-6386-0add-3b636fb28b78",
+ 1, TEX_LEFT_LEG_TATTOO,
+ 1, LLWearableType::WT_UNIVERSAL));
+
+ addEntry(BAKED_AUX1, new BakedEntry(TEX_AUX1_BAKED,
+ "aux1", "790c11be-b25c-c17e-b4d2-6a4ad786b752",
+ 1, TEX_AUX1_TATTOO,
+ 1, LLWearableType::WT_UNIVERSAL));
+
+ addEntry(BAKED_AUX2, new BakedEntry(TEX_AUX2_BAKED,
+ "aux2", "d78c478f-48c7-5928-5864-8d99fb1f521e",
+ 1, TEX_AUX2_TATTOO,
+ 1, LLWearableType::WT_UNIVERSAL));
+
+ addEntry(BAKED_AUX3, new BakedEntry(TEX_AUX3_BAKED,
+ "aux3", "6a95dd53-edd9-aac8-f6d3-27ed99f3c3eb",
+ 1, TEX_AUX3_TATTOO,
+ 1, LLWearableType::WT_UNIVERSAL));
}
LLAvatarAppearanceDictionary::MeshEntries::MeshEntries()
{
- // MeshEntries
- addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, PN_4));
- addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, PN_5));
- addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, PN_0)); // no baked mesh associated currently
- addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, PN_1));
- addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, PN_2));
- addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, PN_3));
- addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, PN_3));
- addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, PN_5));
+ // MeshEntries
+ addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, PN_4));
+ addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, PN_5));
+ addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, PN_0)); // no baked mesh associated currently
+ addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, PN_1));
+ addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, PN_2));
+ addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, PN_3));
+ addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, PN_3));
+ addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, PN_5));
}
/*
@@ -171,10 +171,10 @@ LLAvatarAppearanceDictionary::MeshEntries::MeshEntries()
LLAvatarAppearanceDictionary::LLAvatarAppearanceDictionary()
{
- createAssociations();
+ createAssociations();
}
-//virtual
+//virtual
LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary()
{
}
@@ -183,231 +183,231 @@ LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary()
// map it to the baked texture.
void LLAvatarAppearanceDictionary::createAssociations()
{
- for (BakedTextures::value_type& baked_pair : mBakedTextures)
- {
- const EBakedTextureIndex baked_index = baked_pair.first;
- const BakedEntry *dict = baked_pair.second;
-
- // For each texture that this baked texture index affects, associate those textures
- // with this baked texture index.
- for (const ETextureIndex local_texture_index : dict->mLocalTextures)
- {
- mTextures[local_texture_index]->mIsUsedByBakedTexture = true;
- mTextures[local_texture_index]->mBakedTextureIndex = baked_index;
- }
- }
-
+ for (BakedTextures::value_type& baked_pair : mBakedTextures)
+ {
+ const EBakedTextureIndex baked_index = baked_pair.first;
+ const BakedEntry *dict = baked_pair.second;
+
+ // For each texture that this baked texture index affects, associate those textures
+ // with this baked texture index.
+ for (const ETextureIndex local_texture_index : dict->mLocalTextures)
+ {
+ mTextures[local_texture_index]->mIsUsedByBakedTexture = true;
+ mTextures[local_texture_index]->mBakedTextureIndex = baked_index;
+ }
+ }
+
}
LLAvatarAppearanceDictionary::TextureEntry::TextureEntry(const std::string &name,
- bool is_local_texture,
- EBakedTextureIndex baked_texture_index,
- const std::string &default_image_name,
- LLWearableType::EType wearable_type) :
- LLDictionaryEntry(name),
- mIsLocalTexture(is_local_texture),
- mIsBakedTexture(!is_local_texture),
- mIsUsedByBakedTexture(baked_texture_index != BAKED_NUM_INDICES),
- mBakedTextureIndex(baked_texture_index),
- mDefaultImageName(default_image_name),
- mWearableType(wearable_type)
+ bool is_local_texture,
+ EBakedTextureIndex baked_texture_index,
+ const std::string &default_image_name,
+ LLWearableType::EType wearable_type) :
+ LLDictionaryEntry(name),
+ mIsLocalTexture(is_local_texture),
+ mIsBakedTexture(!is_local_texture),
+ mIsUsedByBakedTexture(baked_texture_index != BAKED_NUM_INDICES),
+ mBakedTextureIndex(baked_texture_index),
+ mDefaultImageName(default_image_name),
+ mWearableType(wearable_type)
{
}
-LLAvatarAppearanceDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
- const std::string &name,
- U8 level,
- LLJointPickName pick) :
- LLDictionaryEntry(name),
- mBakedID(baked_index),
- mLOD(level),
- mPickName(pick)
+LLAvatarAppearanceDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
+ const std::string &name,
+ U8 level,
+ LLJointPickName pick) :
+ LLDictionaryEntry(name),
+ mBakedID(baked_index),
+ mLOD(level),
+ mPickName(pick)
{
}
-LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
- const std::string &name,
- const std::string &hash_name,
- U32 num_local_textures,
- ... ) :
- LLDictionaryEntry(name),
- mWearablesHashID(LLUUID(hash_name)),
- mTextureIndex(tex_index)
+LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
+ const std::string &name,
+ const std::string &hash_name,
+ U32 num_local_textures,
+ ... ) :
+ LLDictionaryEntry(name),
+ mWearablesHashID(LLUUID(hash_name)),
+ mTextureIndex(tex_index)
{
- va_list argp;
-
- va_start(argp, num_local_textures);
-
- // Read in local textures
- for (U8 i=0; i < num_local_textures; i++)
- {
- ETextureIndex t = (ETextureIndex)va_arg(argp,int);
- mLocalTextures.push_back(t);
- }
-
- // Read in number of wearables
- const U32 num_wearables = (U32)va_arg(argp,int);
- // Read in wearables
- for (U8 i=0; i < num_wearables; i++)
- {
- LLWearableType::EType t = (LLWearableType::EType)va_arg(argp,int);
- mWearables.push_back(t);
- }
+ va_list argp;
+
+ va_start(argp, num_local_textures);
+
+ // Read in local textures
+ for (U8 i=0; i < num_local_textures; i++)
+ {
+ ETextureIndex t = (ETextureIndex)va_arg(argp,int);
+ mLocalTextures.push_back(t);
+ }
+
+ // Read in number of wearables
+ const U32 num_wearables = (U32)va_arg(argp,int);
+ // Read in wearables
+ for (U8 i=0; i < num_wearables; i++)
+ {
+ LLWearableType::EType t = (LLWearableType::EType)va_arg(argp,int);
+ mWearables.push_back(t);
+ }
}
ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index) const
{
- return getBakedTexture(index)->mTextureIndex;
+ return getBakedTexture(index)->mTextureIndex;
}
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::string name)
{
- U8 index = 0;
- while (index < BAKED_NUM_INDICES)
- {
- const BakedEntry *be = getBakedTexture((EBakedTextureIndex) index);
- if (be && be->mName.compare(name) == 0)
- {
- // baked texture found
- return (EBakedTextureIndex) index;
- }
- index++;
- }
- // baked texture could not be found
- return BAKED_NUM_INDICES;
+ U8 index = 0;
+ while (index < BAKED_NUM_INDICES)
+ {
+ const BakedEntry *be = getBakedTexture((EBakedTextureIndex) index);
+ if (be && be->mName.compare(name) == 0)
+ {
+ // baked texture found
+ return (EBakedTextureIndex) index;
+ }
+ index++;
+ }
+ // baked texture could not be found
+ return BAKED_NUM_INDICES;
}
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(std::string name)
{
- U8 index = 0;
- while (index < BAKED_NUM_INDICES)
- {
- const BakedEntry *be = getBakedTexture((EBakedTextureIndex) index);
- if (be)
- {
- const TextureEntry *te = getTexture(be->mTextureIndex);
- if (te && te->mDefaultImageName.compare(name) == 0)
- {
- // baked texture found
- return (EBakedTextureIndex) index;
- }
- }
- index++;
- }
- // baked texture could not be found
- return BAKED_NUM_INDICES;
+ U8 index = 0;
+ while (index < BAKED_NUM_INDICES)
+ {
+ const BakedEntry *be = getBakedTexture((EBakedTextureIndex) index);
+ if (be)
+ {
+ const TextureEntry *te = getTexture(be->mTextureIndex);
+ if (te && te->mDefaultImageName.compare(name) == 0)
+ {
+ // baked texture found
+ return (EBakedTextureIndex) index;
+ }
+ }
+ index++;
+ }
+ // baked texture could not be found
+ return BAKED_NUM_INDICES;
}
LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIndex index ) const
{
- return getTexture(index)->mWearableType;
+ return getTexture(index)->mWearableType;
}
// static
BOOL LLAvatarAppearanceDictionary::isBakedImageId(const LLUUID& id)
{
- if ((id == IMG_USE_BAKED_EYES) || (id == IMG_USE_BAKED_HAIR) || (id == IMG_USE_BAKED_HEAD) || (id == IMG_USE_BAKED_LOWER) || (id == IMG_USE_BAKED_SKIRT) || (id == IMG_USE_BAKED_UPPER)
- || (id == IMG_USE_BAKED_LEFTARM) || (id == IMG_USE_BAKED_LEFTLEG) || (id == IMG_USE_BAKED_AUX1) || (id == IMG_USE_BAKED_AUX2) || (id == IMG_USE_BAKED_AUX3) )
- {
- return TRUE;
- }
+ if ((id == IMG_USE_BAKED_EYES) || (id == IMG_USE_BAKED_HAIR) || (id == IMG_USE_BAKED_HEAD) || (id == IMG_USE_BAKED_LOWER) || (id == IMG_USE_BAKED_SKIRT) || (id == IMG_USE_BAKED_UPPER)
+ || (id == IMG_USE_BAKED_LEFTARM) || (id == IMG_USE_BAKED_LEFTLEG) || (id == IMG_USE_BAKED_AUX1) || (id == IMG_USE_BAKED_AUX2) || (id == IMG_USE_BAKED_AUX3) )
+ {
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
-// static
+// static
EBakedTextureIndex LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(const LLUUID& id)
{
- if (id == IMG_USE_BAKED_EYES)
- {
- return BAKED_EYES;
- }
- else if (id == IMG_USE_BAKED_HAIR)
- {
- return BAKED_HAIR;
- }
- else if (id == IMG_USE_BAKED_HEAD)
- {
- return BAKED_HEAD;
- }
- else if (id == IMG_USE_BAKED_LOWER)
- {
- return BAKED_LOWER;
- }
- else if (id == IMG_USE_BAKED_SKIRT)
- {
- return BAKED_SKIRT;
- }
- else if (id == IMG_USE_BAKED_UPPER)
- {
- return BAKED_UPPER;
- }
- else if (id == IMG_USE_BAKED_LEFTARM)
- {
- return BAKED_LEFT_ARM;
- }
- else if (id == IMG_USE_BAKED_LEFTLEG)
- {
- return BAKED_LEFT_LEG;
- }
- else if (id == IMG_USE_BAKED_AUX1)
- {
- return BAKED_AUX1;
- }
- else if (id == IMG_USE_BAKED_AUX2)
- {
- return BAKED_AUX2;
- }
- else if (id == IMG_USE_BAKED_AUX3)
- {
- return BAKED_AUX3;
- }
-
- return BAKED_NUM_INDICES;
+ if (id == IMG_USE_BAKED_EYES)
+ {
+ return BAKED_EYES;
+ }
+ else if (id == IMG_USE_BAKED_HAIR)
+ {
+ return BAKED_HAIR;
+ }
+ else if (id == IMG_USE_BAKED_HEAD)
+ {
+ return BAKED_HEAD;
+ }
+ else if (id == IMG_USE_BAKED_LOWER)
+ {
+ return BAKED_LOWER;
+ }
+ else if (id == IMG_USE_BAKED_SKIRT)
+ {
+ return BAKED_SKIRT;
+ }
+ else if (id == IMG_USE_BAKED_UPPER)
+ {
+ return BAKED_UPPER;
+ }
+ else if (id == IMG_USE_BAKED_LEFTARM)
+ {
+ return BAKED_LEFT_ARM;
+ }
+ else if (id == IMG_USE_BAKED_LEFTLEG)
+ {
+ return BAKED_LEFT_LEG;
+ }
+ else if (id == IMG_USE_BAKED_AUX1)
+ {
+ return BAKED_AUX1;
+ }
+ else if (id == IMG_USE_BAKED_AUX2)
+ {
+ return BAKED_AUX2;
+ }
+ else if (id == IMG_USE_BAKED_AUX3)
+ {
+ return BAKED_AUX3;
+ }
+
+ return BAKED_NUM_INDICES;
}
//static
LLUUID LLAvatarAppearanceDictionary::localTextureIndexToMagicId(ETextureIndex t)
{
- LLUUID id = LLUUID::null;
-
- switch (t)
- {
- case LLAvatarAppearanceDefines::TEX_HEAD_BAKED:
- id = IMG_USE_BAKED_HEAD;
- break;
- case LLAvatarAppearanceDefines::TEX_UPPER_BAKED:
- id = IMG_USE_BAKED_UPPER;
- break;
- case LLAvatarAppearanceDefines::TEX_LOWER_BAKED:
- id = IMG_USE_BAKED_LOWER;
- break;
- case LLAvatarAppearanceDefines::TEX_EYES_BAKED:
- id = IMG_USE_BAKED_EYES;
- break;
- case LLAvatarAppearanceDefines::TEX_SKIRT_BAKED:
- id = IMG_USE_BAKED_SKIRT;
- break;
- case LLAvatarAppearanceDefines::TEX_HAIR_BAKED:
- id = IMG_USE_BAKED_HAIR;
- break;
- case LLAvatarAppearanceDefines::TEX_LEFT_ARM_BAKED:
- id = IMG_USE_BAKED_LEFTARM;
- break;
- case LLAvatarAppearanceDefines::TEX_LEFT_LEG_BAKED:
- id = IMG_USE_BAKED_LEFTLEG;
- break;
- case LLAvatarAppearanceDefines::TEX_AUX1_BAKED:
- id = IMG_USE_BAKED_AUX1;
- break;
- case LLAvatarAppearanceDefines::TEX_AUX2_BAKED:
- id = IMG_USE_BAKED_AUX2;
- break;
- case LLAvatarAppearanceDefines::TEX_AUX3_BAKED:
- id = IMG_USE_BAKED_AUX3;
- break;
- default:
- break;
- }
-
- return id;
+ LLUUID id = LLUUID::null;
+
+ switch (t)
+ {
+ case LLAvatarAppearanceDefines::TEX_HEAD_BAKED:
+ id = IMG_USE_BAKED_HEAD;
+ break;
+ case LLAvatarAppearanceDefines::TEX_UPPER_BAKED:
+ id = IMG_USE_BAKED_UPPER;
+ break;
+ case LLAvatarAppearanceDefines::TEX_LOWER_BAKED:
+ id = IMG_USE_BAKED_LOWER;
+ break;
+ case LLAvatarAppearanceDefines::TEX_EYES_BAKED:
+ id = IMG_USE_BAKED_EYES;
+ break;
+ case LLAvatarAppearanceDefines::TEX_SKIRT_BAKED:
+ id = IMG_USE_BAKED_SKIRT;
+ break;
+ case LLAvatarAppearanceDefines::TEX_HAIR_BAKED:
+ id = IMG_USE_BAKED_HAIR;
+ break;
+ case LLAvatarAppearanceDefines::TEX_LEFT_ARM_BAKED:
+ id = IMG_USE_BAKED_LEFTARM;
+ break;
+ case LLAvatarAppearanceDefines::TEX_LEFT_LEG_BAKED:
+ id = IMG_USE_BAKED_LEFTLEG;
+ break;
+ case LLAvatarAppearanceDefines::TEX_AUX1_BAKED:
+ id = IMG_USE_BAKED_AUX1;
+ break;
+ case LLAvatarAppearanceDefines::TEX_AUX2_BAKED:
+ id = IMG_USE_BAKED_AUX2;
+ break;
+ case LLAvatarAppearanceDefines::TEX_AUX3_BAKED:
+ id = IMG_USE_BAKED_AUX3;
+ break;
+ default:
+ break;
+ }
+
+ return id;
}
diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h
index 49dfbebeea..414bf8bbc1 100644
--- a/indra/llappearance/llavatarappearancedefines.h
+++ b/indra/llappearance/llavatarappearancedefines.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file llavatarappearancedefines.h
* @brief Various LLAvatarAppearance related definitions
* LLViewerObject
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,83 +47,83 @@ static const U32 AVATAR_HOVER = 11001;
//--------------------------------------------------------------------
enum ETextureIndex
{
- TEX_INVALID = -1,
- TEX_HEAD_BODYPAINT = 0,
- TEX_UPPER_SHIRT,
- TEX_LOWER_PANTS,
- TEX_EYES_IRIS,
- TEX_HAIR,
- TEX_UPPER_BODYPAINT,
- TEX_LOWER_BODYPAINT,
- TEX_LOWER_SHOES,
- TEX_HEAD_BAKED, // Pre-composited
- TEX_UPPER_BAKED, // Pre-composited
- TEX_LOWER_BAKED, // Pre-composited
- TEX_EYES_BAKED, // Pre-composited
- TEX_LOWER_SOCKS,
- TEX_UPPER_JACKET,
- TEX_LOWER_JACKET,
- TEX_UPPER_GLOVES,
- TEX_UPPER_UNDERSHIRT,
- TEX_LOWER_UNDERPANTS,
- TEX_SKIRT,
- TEX_SKIRT_BAKED, // Pre-composited
- TEX_HAIR_BAKED, // Pre-composited
- TEX_LOWER_ALPHA,
- TEX_UPPER_ALPHA,
- TEX_HEAD_ALPHA,
- TEX_EYES_ALPHA,
- TEX_HAIR_ALPHA,
- TEX_HEAD_TATTOO,
- TEX_UPPER_TATTOO,
- TEX_LOWER_TATTOO,
- TEX_HEAD_UNIVERSAL_TATTOO,
- TEX_UPPER_UNIVERSAL_TATTOO,
- TEX_LOWER_UNIVERSAL_TATTOO,
- TEX_SKIRT_TATTOO,
- TEX_HAIR_TATTOO,
- TEX_EYES_TATTOO,
- TEX_LEFT_ARM_TATTOO,
- TEX_LEFT_LEG_TATTOO,
- TEX_AUX1_TATTOO,
- TEX_AUX2_TATTOO,
- TEX_AUX3_TATTOO,
- TEX_LEFT_ARM_BAKED, // Pre-composited
- TEX_LEFT_LEG_BAKED, // Pre-composited
- TEX_AUX1_BAKED, // Pre-composited
- TEX_AUX2_BAKED, // Pre-composited
- TEX_AUX3_BAKED, // Pre-composited
- TEX_NUM_INDICES
-};
+ TEX_INVALID = -1,
+ TEX_HEAD_BODYPAINT = 0,
+ TEX_UPPER_SHIRT,
+ TEX_LOWER_PANTS,
+ TEX_EYES_IRIS,
+ TEX_HAIR,
+ TEX_UPPER_BODYPAINT,
+ TEX_LOWER_BODYPAINT,
+ TEX_LOWER_SHOES,
+ TEX_HEAD_BAKED, // Pre-composited
+ TEX_UPPER_BAKED, // Pre-composited
+ TEX_LOWER_BAKED, // Pre-composited
+ TEX_EYES_BAKED, // Pre-composited
+ TEX_LOWER_SOCKS,
+ TEX_UPPER_JACKET,
+ TEX_LOWER_JACKET,
+ TEX_UPPER_GLOVES,
+ TEX_UPPER_UNDERSHIRT,
+ TEX_LOWER_UNDERPANTS,
+ TEX_SKIRT,
+ TEX_SKIRT_BAKED, // Pre-composited
+ TEX_HAIR_BAKED, // Pre-composited
+ TEX_LOWER_ALPHA,
+ TEX_UPPER_ALPHA,
+ TEX_HEAD_ALPHA,
+ TEX_EYES_ALPHA,
+ TEX_HAIR_ALPHA,
+ TEX_HEAD_TATTOO,
+ TEX_UPPER_TATTOO,
+ TEX_LOWER_TATTOO,
+ TEX_HEAD_UNIVERSAL_TATTOO,
+ TEX_UPPER_UNIVERSAL_TATTOO,
+ TEX_LOWER_UNIVERSAL_TATTOO,
+ TEX_SKIRT_TATTOO,
+ TEX_HAIR_TATTOO,
+ TEX_EYES_TATTOO,
+ TEX_LEFT_ARM_TATTOO,
+ TEX_LEFT_LEG_TATTOO,
+ TEX_AUX1_TATTOO,
+ TEX_AUX2_TATTOO,
+ TEX_AUX3_TATTOO,
+ TEX_LEFT_ARM_BAKED, // Pre-composited
+ TEX_LEFT_LEG_BAKED, // Pre-composited
+ TEX_AUX1_BAKED, // Pre-composited
+ TEX_AUX2_BAKED, // Pre-composited
+ TEX_AUX3_BAKED, // Pre-composited
+ TEX_NUM_INDICES
+};
enum EBakedTextureIndex
{
- BAKED_HEAD = 0,
- BAKED_UPPER,
- BAKED_LOWER,
- BAKED_EYES,
- BAKED_SKIRT,
- BAKED_HAIR,
- BAKED_LEFT_ARM,
- BAKED_LEFT_LEG,
- BAKED_AUX1,
- BAKED_AUX2,
- BAKED_AUX3,
- BAKED_NUM_INDICES
+ BAKED_HEAD = 0,
+ BAKED_UPPER,
+ BAKED_LOWER,
+ BAKED_EYES,
+ BAKED_SKIRT,
+ BAKED_HAIR,
+ BAKED_LEFT_ARM,
+ BAKED_LEFT_LEG,
+ BAKED_AUX1,
+ BAKED_AUX2,
+ BAKED_AUX3,
+ BAKED_NUM_INDICES
};
// Reference IDs for each mesh. Used as indices for vector of joints
enum EMeshIndex
{
- MESH_ID_HAIR = 0,
- MESH_ID_HEAD,
- MESH_ID_EYELASH,
- MESH_ID_UPPER_BODY,
- MESH_ID_LOWER_BODY,
- MESH_ID_EYEBALL_LEFT,
- MESH_ID_EYEBALL_RIGHT,
- MESH_ID_SKIRT,
- MESH_ID_NUM_INDICES
+ MESH_ID_HAIR = 0,
+ MESH_ID_HEAD,
+ MESH_ID_EYELASH,
+ MESH_ID_UPPER_BODY,
+ MESH_ID_LOWER_BODY,
+ MESH_ID_EYEBALL_LEFT,
+ MESH_ID_EYEBALL_RIGHT,
+ MESH_ID_SKIRT,
+ MESH_ID_NUM_INDICES
};
//--------------------------------------------------------------------
@@ -136,117 +136,117 @@ typedef std::vector<LLWearableType::EType> wearables_vec_t;
//------------------------------------------------------------------------
// LLAvatarAppearanceDictionary
-//
+//
// Holds dictionary static entries for textures, baked textures, meshes, etc.; i.e.
// information that is common to all avatars.
-//
+//
// This holds const data - it is initialized once and the contents never change after that.
//------------------------------------------------------------------------
class LLAvatarAppearanceDictionary
{
- //--------------------------------------------------------------------
- // Constructors and Destructors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constructors and Destructors
+ //--------------------------------------------------------------------
public:
- LLAvatarAppearanceDictionary();
- ~LLAvatarAppearanceDictionary();
+ LLAvatarAppearanceDictionary();
+ ~LLAvatarAppearanceDictionary();
private:
- void createAssociations();
-
- //--------------------------------------------------------------------
- // Local and baked textures
- //--------------------------------------------------------------------
+ void createAssociations();
+
+ //--------------------------------------------------------------------
+ // Local and baked textures
+ //--------------------------------------------------------------------
public:
- struct TextureEntry : public LLDictionaryEntry
- {
- TextureEntry(const std::string &name, // this must match the xml name used by LLTexLayerInfo::parseXml
- bool is_local_texture,
- EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES,
- const std::string& default_image_name = "",
- LLWearableType::EType wearable_type = LLWearableType::WT_INVALID);
- const std::string mDefaultImageName;
- const LLWearableType::EType mWearableType;
- // It's either a local texture xor baked
- BOOL mIsLocalTexture;
- BOOL mIsBakedTexture;
- // If it's a local texture, it may be used by a baked texture
- BOOL mIsUsedByBakedTexture;
- EBakedTextureIndex mBakedTextureIndex;
- };
-
- struct Textures : public LLDictionary<ETextureIndex, TextureEntry>
- {
- Textures();
- } mTextures;
- const TextureEntry* getTexture(ETextureIndex index) const { return mTextures.lookup(index); }
- const Textures& getTextures() const { return mTextures; }
-
- //--------------------------------------------------------------------
- // Meshes
- //--------------------------------------------------------------------
+ struct TextureEntry : public LLDictionaryEntry
+ {
+ TextureEntry(const std::string &name, // this must match the xml name used by LLTexLayerInfo::parseXml
+ bool is_local_texture,
+ EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES,
+ const std::string& default_image_name = "",
+ LLWearableType::EType wearable_type = LLWearableType::WT_INVALID);
+ const std::string mDefaultImageName;
+ const LLWearableType::EType mWearableType;
+ // It's either a local texture xor baked
+ BOOL mIsLocalTexture;
+ BOOL mIsBakedTexture;
+ // If it's a local texture, it may be used by a baked texture
+ BOOL mIsUsedByBakedTexture;
+ EBakedTextureIndex mBakedTextureIndex;
+ };
+
+ struct Textures : public LLDictionary<ETextureIndex, TextureEntry>
+ {
+ Textures();
+ } mTextures;
+ const TextureEntry* getTexture(ETextureIndex index) const { return mTextures.lookup(index); }
+ const Textures& getTextures() const { return mTextures; }
+
+ //--------------------------------------------------------------------
+ // Meshes
+ //--------------------------------------------------------------------
public:
- struct MeshEntry : public LLDictionaryEntry
- {
- MeshEntry(EBakedTextureIndex baked_index,
- const std::string &name, // names of mesh types as they are used in avatar_lad.xml
- U8 level,
- LLJointPickName pick);
- // Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml
+ struct MeshEntry : public LLDictionaryEntry
+ {
+ MeshEntry(EBakedTextureIndex baked_index,
+ const std::string &name, // names of mesh types as they are used in avatar_lad.xml
+ U8 level,
+ LLJointPickName pick);
+ // Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml
// Otherwise meshes will be unable to be found, or levels of detail will be ignored
- const U8 mLOD;
- const EBakedTextureIndex mBakedID;
- const LLJointPickName mPickName;
- };
-
- struct MeshEntries : public LLDictionary<EMeshIndex, MeshEntry>
- {
- MeshEntries();
- } mMeshEntries;
- const MeshEntry* getMeshEntry(EMeshIndex index) const { return mMeshEntries.lookup(index); }
- const MeshEntries& getMeshEntries() const { return mMeshEntries; }
-
- //--------------------------------------------------------------------
- // Baked Textures
- //--------------------------------------------------------------------
+ const U8 mLOD;
+ const EBakedTextureIndex mBakedID;
+ const LLJointPickName mPickName;
+ };
+
+ struct MeshEntries : public LLDictionary<EMeshIndex, MeshEntry>
+ {
+ MeshEntries();
+ } mMeshEntries;
+ const MeshEntry* getMeshEntry(EMeshIndex index) const { return mMeshEntries.lookup(index); }
+ const MeshEntries& getMeshEntries() const { return mMeshEntries; }
+
+ //--------------------------------------------------------------------
+ // Baked Textures
+ //--------------------------------------------------------------------
public:
- struct BakedEntry : public LLDictionaryEntry
- {
- BakedEntry(ETextureIndex tex_index,
- const std::string &name, // unused, but necessary for templating.
- const std::string &hash_name,
- U32 num_local_textures, ... ); // # local textures, local texture list, # wearables, wearable list
- // Local Textures
- const ETextureIndex mTextureIndex;
- texture_vec_t mLocalTextures;
- // Wearables
- const LLUUID mWearablesHashID;
- wearables_vec_t mWearables;
- };
-
- struct BakedTextures: public LLDictionary<EBakedTextureIndex, BakedEntry>
- {
- BakedTextures();
- } mBakedTextures;
- const BakedEntry* getBakedTexture(EBakedTextureIndex index) const { return mBakedTextures.lookup(index); }
- const BakedTextures& getBakedTextures() const { return mBakedTextures; }
-
- //--------------------------------------------------------------------
- // Convenience Functions
- //--------------------------------------------------------------------
+ struct BakedEntry : public LLDictionaryEntry
+ {
+ BakedEntry(ETextureIndex tex_index,
+ const std::string &name, // unused, but necessary for templating.
+ const std::string &hash_name,
+ U32 num_local_textures, ... ); // # local textures, local texture list, # wearables, wearable list
+ // Local Textures
+ const ETextureIndex mTextureIndex;
+ texture_vec_t mLocalTextures;
+ // Wearables
+ const LLUUID mWearablesHashID;
+ wearables_vec_t mWearables;
+ };
+
+ struct BakedTextures: public LLDictionary<EBakedTextureIndex, BakedEntry>
+ {
+ BakedTextures();
+ } mBakedTextures;
+ const BakedEntry* getBakedTexture(EBakedTextureIndex index) const { return mBakedTextures.lookup(index); }
+ const BakedTextures& getBakedTextures() const { return mBakedTextures; }
+
+ //--------------------------------------------------------------------
+ // Convenience Functions
+ //--------------------------------------------------------------------
public:
- // Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED
- ETextureIndex bakedToLocalTextureIndex(EBakedTextureIndex t) const;
+ // Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED
+ ETextureIndex bakedToLocalTextureIndex(EBakedTextureIndex t) const;
- // find a baked texture index based on its name
- EBakedTextureIndex findBakedByRegionName(std::string name);
- EBakedTextureIndex findBakedByImageName(std::string name);
+ // find a baked texture index based on its name
+ EBakedTextureIndex findBakedByRegionName(std::string name);
+ EBakedTextureIndex findBakedByImageName(std::string name);
- // Given a texture entry, determine which wearable type owns it.
- LLWearableType::EType getTEWearableType(ETextureIndex index) const;
+ // Given a texture entry, determine which wearable type owns it.
+ LLWearableType::EType getTEWearableType(ETextureIndex index) const;
- static BOOL isBakedImageId(const LLUUID& id);
- static EBakedTextureIndex assetIdToBakedTextureIndex(const LLUUID& id);
- static LLUUID localTextureIndexToMagicId(ETextureIndex t);
+ static BOOL isBakedImageId(const LLUUID& id);
+ static EBakedTextureIndex assetIdToBakedTextureIndex(const LLUUID& id);
+ static LLUUID localTextureIndexToMagicId(ETextureIndex t);
}; // End LLAvatarAppearanceDictionary
diff --git a/indra/llappearance/llavatarjoint.cpp b/indra/llappearance/llavatarjoint.cpp
index 9300b08b7b..5dae4c86cb 100644
--- a/indra/llappearance/llavatarjoint.cpp
+++ b/indra/llappearance/llavatarjoint.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarjoint.cpp
* @brief Implementation of LLAvatarJoint class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,16 +40,16 @@ const F32 DEFAULT_AVATAR_JOINT_LOD = 0.0f;
//-----------------------------------------------------------------------------
// Static Data
//-----------------------------------------------------------------------------
-BOOL LLAvatarJoint::sDisableLOD = FALSE;
+BOOL LLAvatarJoint::sDisableLOD = FALSE;
//-----------------------------------------------------------------------------
// LLAvatarJoint()
// Class Constructors
//-----------------------------------------------------------------------------
LLAvatarJoint::LLAvatarJoint() :
- LLJoint()
+ LLJoint()
{
- init();
+ init();
}
LLAvatarJoint::LLAvatarJoint(S32 joint_num) :
@@ -57,22 +57,22 @@ LLAvatarJoint::LLAvatarJoint(S32 joint_num) :
{
init();
}
-
+
LLAvatarJoint::LLAvatarJoint(const std::string &name, LLJoint *parent) :
- LLJoint(name, parent)
+ LLJoint(name, parent)
{
- init();
+ init();
}
void LLAvatarJoint::init()
{
- mValid = FALSE;
- mComponents = SC_JOINT | SC_BONE | SC_AXES;
- mMinPixelArea = DEFAULT_AVATAR_JOINT_LOD;
- mPickName = PN_DEFAULT;
- mVisible = TRUE;
- mMeshID = 0;
- mIsTransparent = FALSE;
+ mValid = FALSE;
+ mComponents = SC_JOINT | SC_BONE | SC_AXES;
+ mMinPixelArea = DEFAULT_AVATAR_JOINT_LOD;
+ mPickName = PN_DEFAULT;
+ mVisible = TRUE;
+ mMeshID = 0;
+ mIsTransparent = FALSE;
}
@@ -90,22 +90,22 @@ LLAvatarJoint::~LLAvatarJoint()
//--------------------------------------------------------------------
void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )
{
- //----------------------------------------------------------------
- // set visibility for this joint
- //----------------------------------------------------------------
- mValid = valid;
-
- //----------------------------------------------------------------
- // set visibility for children
- //----------------------------------------------------------------
- if (recursive)
- {
- for (LLJoint* child : mChildren)
- {
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
- joint->setValid(valid, TRUE);
- }
- }
+ //----------------------------------------------------------------
+ // set visibility for this joint
+ //----------------------------------------------------------------
+ mValid = valid;
+
+ //----------------------------------------------------------------
+ // set visibility for children
+ //----------------------------------------------------------------
+ if (recursive)
+ {
+ for (LLJoint* child : mChildren)
+ {
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
+ joint->setValid(valid, TRUE);
+ }
+ }
}
@@ -114,107 +114,107 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )
//--------------------------------------------------------------------
void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive )
{
- mComponents = comp;
- if (recursive)
- {
- for (auto child : mChildren)
- {
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
- joint->setSkeletonComponents(comp, recursive);
- }
- }
+ mComponents = comp;
+ if (recursive)
+ {
+ for (auto child : mChildren)
+ {
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
+ joint->setSkeletonComponents(comp, recursive);
+ }
+ }
}
void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
{
- mVisible = visible;
-
- if (recursive)
- {
- for (LLJoint* child : mChildren)
- {
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
- joint->setVisible(visible, recursive);
- }
- }
+ mVisible = visible;
+
+ if (recursive)
+ {
+ for (LLJoint* child : mChildren)
+ {
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
+ joint->setVisible(visible, recursive);
+ }
+ }
}
void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
{
- for (LLJoint* child : mChildren)
- {
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
- joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
- }
+ for (LLJoint* child : mChildren)
+ {
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
+ joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
+ }
}
void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update)
{
- for (LLJoint* child : mChildren)
- {
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
- joint->updateFaceData(face, pixel_area, damp_wind, terse_update);
- }
+ for (LLJoint* child : mChildren)
+ {
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
+ joint->updateFaceData(face, pixel_area, damp_wind, terse_update);
+ }
}
void LLAvatarJoint::updateJointGeometry()
{
- for (LLJoint* child : mChildren)
- {
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
- joint->updateJointGeometry();
- }
+ for (LLJoint* child : mChildren)
+ {
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
+ joint->updateJointGeometry();
+ }
}
BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
{
- BOOL lod_changed = FALSE;
- BOOL found_lod = FALSE;
-
- for (LLJoint* child : mChildren)
- {
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
- F32 jointLOD = joint->getLOD();
-
- if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD)
- {
- // we've already found a joint to enable, so enable the rest as alternatives
- lod_changed |= joint->updateLOD(pixel_area, TRUE);
- }
- else
- {
- if (pixel_area >= jointLOD || sDisableLOD)
- {
- lod_changed |= joint->updateLOD(pixel_area, TRUE);
- found_lod = TRUE;
- }
- else
- {
- lod_changed |= joint->updateLOD(pixel_area, FALSE);
- }
- }
- }
- return lod_changed;
+ BOOL lod_changed = FALSE;
+ BOOL found_lod = FALSE;
+
+ for (LLJoint* child : mChildren)
+ {
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
+ F32 jointLOD = joint->getLOD();
+
+ if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD)
+ {
+ // we've already found a joint to enable, so enable the rest as alternatives
+ lod_changed |= joint->updateLOD(pixel_area, TRUE);
+ }
+ else
+ {
+ if (pixel_area >= jointLOD || sDisableLOD)
+ {
+ lod_changed |= joint->updateLOD(pixel_area, TRUE);
+ found_lod = TRUE;
+ }
+ else
+ {
+ lod_changed |= joint->updateLOD(pixel_area, FALSE);
+ }
+ }
+ }
+ return lod_changed;
}
void LLAvatarJoint::dump()
{
- for (LLJoint* child : mChildren)
- {
- LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
- joint->dump();
- }
+ for (LLJoint* child : mChildren)
+ {
+ LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child);
+ joint->dump();
+ }
}
void LLAvatarJoint::setMeshesToChildren()
{
- removeAllChildren();
- for (LLAvatarJointMesh* mesh : mMeshParts)
- {
- addChild(mesh);
- }
+ removeAllChildren();
+ for (LLAvatarJointMesh* mesh : mMeshParts)
+ {
+ addChild(mesh);
+ }
}
//-----------------------------------------------------------------------------
// LLAvatarJointCollisionVolume()
@@ -222,94 +222,94 @@ void LLAvatarJoint::setMeshesToChildren()
LLAvatarJointCollisionVolume::LLAvatarJointCollisionVolume()
{
- mUpdateXform = FALSE;
+ mUpdateXform = FALSE;
}
/*virtual*/
U32 LLAvatarJointCollisionVolume::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
{
- LL_ERRS() << "Cannot call render() on LLAvatarJointCollisionVolume" << LL_ENDL;
- return 0;
+ LL_ERRS() << "Cannot call render() on LLAvatarJointCollisionVolume" << LL_ENDL;
+ return 0;
}
LLVector3 LLAvatarJointCollisionVolume::getVolumePos(LLVector3 &offset)
{
- mUpdateXform = TRUE;
-
- LLVector3 result = offset;
- result.scaleVec(getScale());
- result.rotVec(getWorldRotation());
- result += getWorldPosition();
-
- return result;
+ mUpdateXform = TRUE;
+
+ LLVector3 result = offset;
+ result.scaleVec(getScale());
+ result.rotVec(getWorldRotation());
+ result += getWorldPosition();
+
+ return result;
}
void LLAvatarJointCollisionVolume::renderCollision()
{
- updateWorldMatrix();
-
- gGL.pushMatrix();
- gGL.multMatrix( &mXform.getWorldMatrix().mMatrix[0][0] );
+ updateWorldMatrix();
+
+ gGL.pushMatrix();
+ gGL.multMatrix( &mXform.getWorldMatrix().mMatrix[0][0] );
+
+ gGL.diffuseColor3f( 0.f, 0.f, 1.f );
+
+ gGL.begin(LLRender::LINES);
- gGL.diffuseColor3f( 0.f, 0.f, 1.f );
-
- gGL.begin(LLRender::LINES);
-
- LLVector3 v[] =
- {
- LLVector3(1,0,0),
- LLVector3(-1,0,0),
- LLVector3(0,1,0),
- LLVector3(0,-1,0),
+ LLVector3 v[] =
+ {
+ LLVector3(1,0,0),
+ LLVector3(-1,0,0),
+ LLVector3(0,1,0),
+ LLVector3(0,-1,0),
- LLVector3(0,0,-1),
- LLVector3(0,0,1),
- };
+ LLVector3(0,0,-1),
+ LLVector3(0,0,1),
+ };
- //sides
- gGL.vertex3fv(v[0].mV);
- gGL.vertex3fv(v[2].mV);
+ //sides
+ gGL.vertex3fv(v[0].mV);
+ gGL.vertex3fv(v[2].mV);
- gGL.vertex3fv(v[0].mV);
- gGL.vertex3fv(v[3].mV);
+ gGL.vertex3fv(v[0].mV);
+ gGL.vertex3fv(v[3].mV);
- gGL.vertex3fv(v[1].mV);
- gGL.vertex3fv(v[2].mV);
+ gGL.vertex3fv(v[1].mV);
+ gGL.vertex3fv(v[2].mV);
- gGL.vertex3fv(v[1].mV);
- gGL.vertex3fv(v[3].mV);
+ gGL.vertex3fv(v[1].mV);
+ gGL.vertex3fv(v[3].mV);
- //top
- gGL.vertex3fv(v[0].mV);
- gGL.vertex3fv(v[4].mV);
+ //top
+ gGL.vertex3fv(v[0].mV);
+ gGL.vertex3fv(v[4].mV);
- gGL.vertex3fv(v[1].mV);
- gGL.vertex3fv(v[4].mV);
+ gGL.vertex3fv(v[1].mV);
+ gGL.vertex3fv(v[4].mV);
- gGL.vertex3fv(v[2].mV);
- gGL.vertex3fv(v[4].mV);
+ gGL.vertex3fv(v[2].mV);
+ gGL.vertex3fv(v[4].mV);
- gGL.vertex3fv(v[3].mV);
- gGL.vertex3fv(v[4].mV);
+ gGL.vertex3fv(v[3].mV);
+ gGL.vertex3fv(v[4].mV);
- //bottom
- gGL.vertex3fv(v[0].mV);
- gGL.vertex3fv(v[5].mV);
+ //bottom
+ gGL.vertex3fv(v[0].mV);
+ gGL.vertex3fv(v[5].mV);
- gGL.vertex3fv(v[1].mV);
- gGL.vertex3fv(v[5].mV);
+ gGL.vertex3fv(v[1].mV);
+ gGL.vertex3fv(v[5].mV);
- gGL.vertex3fv(v[2].mV);
- gGL.vertex3fv(v[5].mV);
+ gGL.vertex3fv(v[2].mV);
+ gGL.vertex3fv(v[5].mV);
- gGL.vertex3fv(v[3].mV);
- gGL.vertex3fv(v[5].mV);
+ gGL.vertex3fv(v[3].mV);
+ gGL.vertex3fv(v[5].mV);
- gGL.end();
+ gGL.end();
- gGL.popMatrix();
+ gGL.popMatrix();
}
diff --git a/indra/llappearance/llavatarjoint.h b/indra/llappearance/llavatarjoint.h
index fec91503c7..bc7c932955 100644
--- a/indra/llappearance/llavatarjoint.h
+++ b/indra/llappearance/llavatarjoint.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarjoint.h
* @brief Implementation of LLAvatarJoint class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -42,97 +42,97 @@ extern const F32 DEFAULT_AVATAR_JOINT_LOD;
// class LLViewerJoint
//-----------------------------------------------------------------------------
class LLAvatarJoint :
- public LLJoint
+ public LLJoint
{
public:
- LLAvatarJoint();
- LLAvatarJoint(S32 joint_num);
- // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
- LLAvatarJoint(const std::string &name, LLJoint *parent = NULL);
- virtual ~LLAvatarJoint();
-
- // Gets the validity of this joint
- BOOL getValid() { return mValid; }
-
- // Sets the validity of this joint
- virtual void setValid( BOOL valid, BOOL recursive=FALSE );
-
- // Returns true if this object is transparent.
- // This is used to determine in which order to draw objects.
- virtual BOOL isTransparent() { return mIsTransparent; }
-
- // Returns true if this object should inherit scale modifiers from its immediate parent
- virtual BOOL inheritScale() { return FALSE; }
-
- enum Components
- {
- SC_BONE = 1,
- SC_JOINT = 2,
- SC_AXES = 4
- };
-
- // Selects which skeleton components to draw
- void setSkeletonComponents( U32 comp, BOOL recursive = TRUE );
-
- // Returns which skeleton components are enables for drawing
- U32 getSkeletonComponents() { return mComponents; }
-
- // Sets the level of detail for this node as a minimum
- // pixel area threshold. If the current pixel area for this
- // object is less than the specified threshold, the node is
- // not traversed. In addition, if a value is specified (not
- // default of 0.0), and the pixel area is larger than the
- // specified minimum, the node is rendered, but no other siblings
- // of this node under the same parent will be.
- F32 getLOD() { return mMinPixelArea; }
- void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; }
-
- void setPickName(LLJointPickName name) { mPickName = name; }
- LLJointPickName getPickName() { return mPickName; }
-
- void setVisible( BOOL visible, BOOL recursive );
-
- // Takes meshes in mMeshParts and sets each one as a child joint
- void setMeshesToChildren();
-
- // LLViewerJoint interface
- virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) = 0;
- virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
- virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
- virtual BOOL updateLOD(F32 pixel_area, BOOL activate);
- virtual void updateJointGeometry();
- virtual void dump();
-
+ LLAvatarJoint();
+ LLAvatarJoint(S32 joint_num);
+ // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
+ LLAvatarJoint(const std::string &name, LLJoint *parent = NULL);
+ virtual ~LLAvatarJoint();
+
+ // Gets the validity of this joint
+ BOOL getValid() { return mValid; }
+
+ // Sets the validity of this joint
+ virtual void setValid( BOOL valid, BOOL recursive=FALSE );
+
+ // Returns true if this object is transparent.
+ // This is used to determine in which order to draw objects.
+ virtual BOOL isTransparent() { return mIsTransparent; }
+
+ // Returns true if this object should inherit scale modifiers from its immediate parent
+ virtual BOOL inheritScale() { return FALSE; }
+
+ enum Components
+ {
+ SC_BONE = 1,
+ SC_JOINT = 2,
+ SC_AXES = 4
+ };
+
+ // Selects which skeleton components to draw
+ void setSkeletonComponents( U32 comp, BOOL recursive = TRUE );
+
+ // Returns which skeleton components are enables for drawing
+ U32 getSkeletonComponents() { return mComponents; }
+
+ // Sets the level of detail for this node as a minimum
+ // pixel area threshold. If the current pixel area for this
+ // object is less than the specified threshold, the node is
+ // not traversed. In addition, if a value is specified (not
+ // default of 0.0), and the pixel area is larger than the
+ // specified minimum, the node is rendered, but no other siblings
+ // of this node under the same parent will be.
+ F32 getLOD() { return mMinPixelArea; }
+ void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; }
+
+ void setPickName(LLJointPickName name) { mPickName = name; }
+ LLJointPickName getPickName() { return mPickName; }
+
+ void setVisible( BOOL visible, BOOL recursive );
+
+ // Takes meshes in mMeshParts and sets each one as a child joint
+ void setMeshesToChildren();
+
+ // LLViewerJoint interface
+ virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) = 0;
+ virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
+ virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
+ virtual BOOL updateLOD(F32 pixel_area, BOOL activate);
+ virtual void updateJointGeometry();
+ virtual void dump();
+
public:
- static BOOL sDisableLOD;
- avatar_joint_mesh_list_t mMeshParts; //LLViewerJointMesh*
- void setMeshID( S32 id ) {mMeshID = id;}
+ static BOOL sDisableLOD;
+ avatar_joint_mesh_list_t mMeshParts; //LLViewerJointMesh*
+ void setMeshID( S32 id ) {mMeshID = id;}
protected:
- void init();
-
- BOOL mValid;
- BOOL mIsTransparent;
- U32 mComponents;
- F32 mMinPixelArea;
- LLJointPickName mPickName;
- BOOL mVisible;
- S32 mMeshID;
+ void init();
+
+ BOOL mValid;
+ BOOL mIsTransparent;
+ U32 mComponents;
+ F32 mMinPixelArea;
+ LLJointPickName mPickName;
+ BOOL mVisible;
+ S32 mMeshID;
};
class LLAvatarJointCollisionVolume : public LLAvatarJoint
{
public:
- LLAvatarJointCollisionVolume();
- virtual ~LLAvatarJointCollisionVolume() {};
+ LLAvatarJointCollisionVolume();
+ virtual ~LLAvatarJointCollisionVolume() {};
- /*virtual*/ BOOL inheritScale() { return TRUE; }
- /*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
+ /*virtual*/ BOOL inheritScale() { return TRUE; }
+ /*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
- void renderCollision();
+ void renderCollision();
- LLVector3 getVolumePos(LLVector3 &offset);
+ LLVector3 getVolumePos(LLVector3 &offset);
};
#endif // LL_LLAVATARJOINT_H
diff --git a/indra/llappearance/llavatarjointmesh.cpp b/indra/llappearance/llavatarjointmesh.cpp
index ed39f78d28..aeac33b601 100644
--- a/indra/llappearance/llavatarjointmesh.cpp
+++ b/indra/llappearance/llavatarjointmesh.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file LLAvatarJointMesh.cpp
* @brief Implementation of LLAvatarJointMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -67,11 +67,11 @@ LLVector3 totalSkinOffset(LLAvatarJoint *joint)
LLVector3 totalOffset;
while (joint)
{
- if (joint->getSupport() == LLJoint::SUPPORT_BASE)
- {
- totalOffset += joint->getSkinOffset();
- }
- joint = (LLAvatarJoint*)joint->getParent();
+ if (joint->getSupport() == LLJoint::SUPPORT_BASE)
+ {
+ totalOffset += joint->getSkinOffset();
+ }
+ joint = (LLAvatarJoint*)joint->getParent();
}
return totalOffset;
}
@@ -87,7 +87,7 @@ LLVector3 totalSkinOffset(LLAvatarJoint *joint)
//-----------------------------------------------------------------------------
LLSkinJoint::LLSkinJoint()
{
- mJoint = NULL;
+ mJoint = NULL;
}
//-----------------------------------------------------------------------------
@@ -95,7 +95,7 @@ LLSkinJoint::LLSkinJoint()
//-----------------------------------------------------------------------------
LLSkinJoint::~LLSkinJoint()
{
- mJoint = NULL;
+ mJoint = NULL;
}
@@ -104,22 +104,22 @@ LLSkinJoint::~LLSkinJoint()
//-----------------------------------------------------------------------------
BOOL LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint)
{
- // find the named joint
- mJoint = joint;
- if ( !mJoint )
- {
- LL_INFOS() << "Can't find joint" << LL_ENDL;
- }
-
- // compute the inverse root skin matrix
- mRootToJointSkinOffset = totalSkinOffset(joint);
+ // find the named joint
+ mJoint = joint;
+ if ( !mJoint )
+ {
+ LL_INFOS() << "Can't find joint" << LL_ENDL;
+ }
+
+ // compute the inverse root skin matrix
+ mRootToJointSkinOffset = totalSkinOffset(joint);
mRootToJointSkinOffset = -mRootToJointSkinOffset;
- //mRootToParentJointSkinOffset = totalSkinOffset((LLAvatarJoint*)joint->getParent());
- mRootToParentJointSkinOffset = totalSkinOffset(getBaseSkeletonAncestor(joint));
- mRootToParentJointSkinOffset = -mRootToParentJointSkinOffset;
+ //mRootToParentJointSkinOffset = totalSkinOffset((LLAvatarJoint*)joint->getParent());
+ mRootToParentJointSkinOffset = totalSkinOffset(getBaseSkeletonAncestor(joint));
+ mRootToParentJointSkinOffset = -mRootToParentJointSkinOffset;
- return TRUE;
+ return TRUE;
}
@@ -137,33 +137,33 @@ LLColor4 LLAvatarJointMesh::sClothingInnerColor;
// LLAvatarJointMesh()
//-----------------------------------------------------------------------------
LLAvatarJointMesh::LLAvatarJointMesh()
- :
- mTexture( NULL ),
- mLayerSet( NULL ),
- mTestImageName( 0 ),
- mFaceIndexCount(0)
+ :
+ mTexture( NULL ),
+ mLayerSet( NULL ),
+ mTestImageName( 0 ),
+ mFaceIndexCount(0)
{
- mColor[0] = 1.0f;
- mColor[1] = 1.0f;
- mColor[2] = 1.0f;
- mColor[3] = 1.0f;
- mShiny = 0.0f;
- mCullBackFaces = TRUE;
+ mColor[0] = 1.0f;
+ mColor[1] = 1.0f;
+ mColor[2] = 1.0f;
+ mColor[3] = 1.0f;
+ mShiny = 0.0f;
+ mCullBackFaces = TRUE;
- mMesh = NULL;
+ mMesh = NULL;
- mNumSkinJoints = 0;
- mSkinJoints = NULL;
+ mNumSkinJoints = 0;
+ mSkinJoints = NULL;
- mFace = NULL;
+ mFace = NULL;
- mMeshID = 0;
- mUpdateXform = FALSE;
+ mMeshID = 0;
+ mUpdateXform = FALSE;
- mValid = FALSE;
+ mValid = FALSE;
- mIsTransparent = FALSE;
+ mIsTransparent = FALSE;
}
@@ -173,9 +173,9 @@ LLAvatarJointMesh::LLAvatarJointMesh()
//-----------------------------------------------------------------------------
LLAvatarJointMesh::~LLAvatarJointMesh()
{
- mMesh = NULL;
- mTexture = NULL;
- freeSkinData();
+ mMesh = NULL;
+ mTexture = NULL;
+ freeSkinData();
}
@@ -184,9 +184,9 @@ LLAvatarJointMesh::~LLAvatarJointMesh()
//-----------------------------------------------------------------------------
BOOL LLAvatarJointMesh::allocateSkinData( U32 numSkinJoints )
{
- mSkinJoints = new LLSkinJoint[ numSkinJoints ];
- mNumSkinJoints = numSkinJoints;
- return TRUE;
+ mSkinJoints = new LLSkinJoint[ numSkinJoints ];
+ mNumSkinJoints = numSkinJoints;
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -194,9 +194,9 @@ BOOL LLAvatarJointMesh::allocateSkinData( U32 numSkinJoints )
//-----------------------------------------------------------------------------
void LLAvatarJointMesh::freeSkinData()
{
- mNumSkinJoints = 0;
- delete [] mSkinJoints;
- mSkinJoints = NULL;
+ mNumSkinJoints = 0;
+ delete [] mSkinJoints;
+ mSkinJoints = NULL;
}
//--------------------------------------------------------------------
@@ -204,10 +204,10 @@ void LLAvatarJointMesh::freeSkinData()
//--------------------------------------------------------------------
void LLAvatarJointMesh::getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha )
{
- *red = mColor[0];
- *green = mColor[1];
- *blue = mColor[2];
- *alpha = mColor[3];
+ *red = mColor[0];
+ *green = mColor[1];
+ *blue = mColor[2];
+ *alpha = mColor[3];
}
//--------------------------------------------------------------------
@@ -215,15 +215,15 @@ void LLAvatarJointMesh::getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha )
//--------------------------------------------------------------------
void LLAvatarJointMesh::setColor( F32 red, F32 green, F32 blue, F32 alpha )
{
- mColor[0] = red;
- mColor[1] = green;
- mColor[2] = blue;
- mColor[3] = alpha;
+ mColor[0] = red;
+ mColor[1] = green;
+ mColor[2] = blue;
+ mColor[3] = alpha;
}
void LLAvatarJointMesh::setColor( const LLColor4& color )
{
- mColor = color;
+ mColor = color;
}
@@ -232,7 +232,7 @@ void LLAvatarJointMesh::setColor( const LLColor4& color )
//--------------------------------------------------------------------
//LLViewerTexture *LLAvatarJointMesh::getTexture()
//{
-// return mTexture;
+// return mTexture;
//}
//--------------------------------------------------------------------
@@ -240,21 +240,21 @@ void LLAvatarJointMesh::setColor( const LLColor4& color )
//--------------------------------------------------------------------
void LLAvatarJointMesh::setTexture( LLGLTexture *texture )
{
- mTexture = texture;
-
- // texture and dynamic_texture are mutually exclusive
- if( texture )
- {
- mLayerSet = NULL;
- //texture->bindTexture(0);
- //texture->setClamp(TRUE, TRUE);
- }
+ mTexture = texture;
+
+ // texture and dynamic_texture are mutually exclusive
+ if( texture )
+ {
+ mLayerSet = NULL;
+ //texture->bindTexture(0);
+ //texture->setClamp(TRUE, TRUE);
+ }
}
BOOL LLAvatarJointMesh::hasGLTexture() const
{
- return mTexture.notNull() && mTexture->hasGLTexture();
+ return mTexture.notNull() && mTexture->hasGLTexture();
}
//--------------------------------------------------------------------
@@ -263,18 +263,18 @@ BOOL LLAvatarJointMesh::hasGLTexture() const
//--------------------------------------------------------------------
void LLAvatarJointMesh::setLayerSet( LLTexLayerSet* layer_set )
{
- mLayerSet = layer_set;
-
- // texture and dynamic_texture are mutually exclusive
- if( layer_set )
- {
- mTexture = NULL;
- }
+ mLayerSet = layer_set;
+
+ // texture and dynamic_texture are mutually exclusive
+ if( layer_set )
+ {
+ mTexture = NULL;
+ }
}
BOOL LLAvatarJointMesh::hasComposite() const
{
- return (mLayerSet && mLayerSet->hasComposite());
+ return (mLayerSet && mLayerSet->hasComposite());
}
@@ -283,7 +283,7 @@ BOOL LLAvatarJointMesh::hasComposite() const
//--------------------------------------------------------------------
LLPolyMesh *LLAvatarJointMesh::getMesh()
{
- return mMesh;
+ return mMesh;
}
//-----------------------------------------------------------------------------
@@ -291,46 +291,46 @@ LLPolyMesh *LLAvatarJointMesh::getMesh()
//-----------------------------------------------------------------------------
void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
{
- // set the mesh pointer
- mMesh = mesh;
+ // set the mesh pointer
+ mMesh = mesh;
- // release any existing skin joints
- freeSkinData();
+ // release any existing skin joints
+ freeSkinData();
- if ( mMesh == NULL )
- {
- return;
- }
+ if ( mMesh == NULL )
+ {
+ return;
+ }
- // acquire the transform from the mesh object
+ // acquire the transform from the mesh object
// SL-315
- setPosition( mMesh->getPosition() );
- setRotation( mMesh->getRotation() );
- setScale( mMesh->getScale() );
-
- // create skin joints if necessary
- if ( mMesh->hasWeights() && !mMesh->isLOD())
- {
- U32 numJointNames = mMesh->getNumJointNames();
-
- allocateSkinData( numJointNames );
- std::string *jointNames = mMesh->getJointNames();
-
- U32 jn;
- for (jn = 0; jn < numJointNames; jn++)
- {
- //LL_INFOS() << "Setting up joint " << jointNames[jn] << LL_ENDL;
- LLAvatarJoint* joint = (LLAvatarJoint*)(getRoot()->findJoint(jointNames[jn]) );
- mSkinJoints[jn].setupSkinJoint( joint );
- }
- }
-
- // setup joint array
- if (!mMesh->isLOD())
- {
- setupJoint((LLAvatarJoint*)getRoot());
+ setPosition( mMesh->getPosition() );
+ setRotation( mMesh->getRotation() );
+ setScale( mMesh->getScale() );
+
+ // create skin joints if necessary
+ if ( mMesh->hasWeights() && !mMesh->isLOD())
+ {
+ U32 numJointNames = mMesh->getNumJointNames();
+
+ allocateSkinData( numJointNames );
+ std::string *jointNames = mMesh->getJointNames();
+
+ U32 jn;
+ for (jn = 0; jn < numJointNames; jn++)
+ {
+ //LL_INFOS() << "Setting up joint " << jointNames[jn] << LL_ENDL;
+ LLAvatarJoint* joint = (LLAvatarJoint*)(getRoot()->findJoint(jointNames[jn]) );
+ mSkinJoints[jn].setupSkinJoint( joint );
+ }
+ }
+
+ // setup joint array
+ if (!mMesh->isLOD())
+ {
+ setupJoint((LLAvatarJoint*)getRoot());
LL_DEBUGS("Avatar") << getName() << " joint render entries: " << mMesh->mJointRenderData.size() << LL_ENDL;
- }
+ }
}
@@ -339,51 +339,51 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
//-----------------------------------------------------------------------------
void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
{
- U32 sj;
+ U32 sj;
- for (sj=0; sj<mNumSkinJoints; sj++)
- {
- LLSkinJoint &js = mSkinJoints[sj];
+ for (sj=0; sj<mNumSkinJoints; sj++)
+ {
+ LLSkinJoint &js = mSkinJoints[sj];
- if (js.mJoint != current_joint)
- {
- continue;
- }
+ if (js.mJoint != current_joint)
+ {
+ continue;
+ }
- // we've found a skinjoint for this joint..
+ // we've found a skinjoint for this joint..
LL_DEBUGS("Avatar") << "Mesh: " << getName() << " joint " << current_joint->getName() << " matches skinjoint " << sj << LL_ENDL;
- // is the last joint in the array our parent?
+ // is the last joint in the array our parent?
- std::vector<LLJointRenderData*> &jrd = mMesh->mJointRenderData;
+ std::vector<LLJointRenderData*> &jrd = mMesh->mJointRenderData;
// SL-287 - need to update this so the results are the same if
// additional extended-skeleton joints lie between this joint
// and the original parent.
LLJoint *ancestor = getBaseSkeletonAncestor(current_joint);
- if(jrd.size() && jrd.back()->mWorldMatrix == &ancestor->getWorldMatrix())
- {
- // ...then just add ourselves
- LLAvatarJoint* jointp = js.mJoint;
- jrd.push_back(new LLJointRenderData(&jointp->getWorldMatrix(), &js));
- LL_DEBUGS("Avatar") << "add joint[" << (jrd.size()-1) << "] = " << js.mJoint->getName() << LL_ENDL;
- }
- // otherwise add our ancestor and ourselves
- else
- {
- jrd.push_back(new LLJointRenderData(&ancestor->getWorldMatrix(), NULL));
- LL_DEBUGS("Avatar") << "add2 ancestor joint[" << (jrd.size()-1) << "] = " << ancestor->getName() << LL_ENDL;
- jrd.push_back(new LLJointRenderData(&current_joint->getWorldMatrix(), &js));
+ if(jrd.size() && jrd.back()->mWorldMatrix == &ancestor->getWorldMatrix())
+ {
+ // ...then just add ourselves
+ LLAvatarJoint* jointp = js.mJoint;
+ jrd.push_back(new LLJointRenderData(&jointp->getWorldMatrix(), &js));
+ LL_DEBUGS("Avatar") << "add joint[" << (jrd.size()-1) << "] = " << js.mJoint->getName() << LL_ENDL;
+ }
+ // otherwise add our ancestor and ourselves
+ else
+ {
+ jrd.push_back(new LLJointRenderData(&ancestor->getWorldMatrix(), NULL));
+ LL_DEBUGS("Avatar") << "add2 ancestor joint[" << (jrd.size()-1) << "] = " << ancestor->getName() << LL_ENDL;
+ jrd.push_back(new LLJointRenderData(&current_joint->getWorldMatrix(), &js));
LL_DEBUGS("Avatar") << "add2 joint[" << (jrd.size()-1) << "] = " << current_joint->getName() << LL_ENDL;
- }
- }
-
- // depth-first traversal
- for (LLJoint* joint : current_joint->mChildren)
- {
- LLAvatarJoint* child_joint = (LLAvatarJoint*)joint;
- setupJoint(child_joint);
- }
+ }
+ }
+
+ // depth-first traversal
+ for (LLJoint* joint : current_joint->mChildren)
+ {
+ LLAvatarJoint* child_joint = (LLAvatarJoint*)joint;
+ setupJoint(child_joint);
+ }
}
diff --git a/indra/llappearance/llavatarjointmesh.h b/indra/llappearance/llavatarjointmesh.h
index 5980b29b46..80db7f6f15 100644
--- a/indra/llappearance/llavatarjointmesh.h
+++ b/indra/llappearance/llavatarjointmesh.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llavatarjointmesh.h
* @brief Declaration of LLAvatarJointMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,21 +39,21 @@ class LLTexLayerSet;
typedef enum e_avatar_render_pass
{
- AVATAR_RENDER_PASS_SINGLE,
- AVATAR_RENDER_PASS_CLOTHING_INNER,
- AVATAR_RENDER_PASS_CLOTHING_OUTER
+ AVATAR_RENDER_PASS_SINGLE,
+ AVATAR_RENDER_PASS_CLOTHING_INNER,
+ AVATAR_RENDER_PASS_CLOTHING_OUTER
} EAvatarRenderPass;
class LLSkinJoint
{
public:
- LLSkinJoint();
- ~LLSkinJoint();
- BOOL setupSkinJoint( LLAvatarJoint *joint);
+ LLSkinJoint();
+ ~LLSkinJoint();
+ BOOL setupSkinJoint( LLAvatarJoint *joint);
- LLAvatarJoint *mJoint;
- LLVector3 mRootToJointSkinOffset;
- LLVector3 mRootToParentJointSkinOffset;
+ LLAvatarJoint *mJoint;
+ LLVector3 mRootToJointSkinOffset;
+ LLVector3 mRootToParentJointSkinOffset;
};
//-----------------------------------------------------------------------------
@@ -62,83 +62,83 @@ public:
class LLAvatarJointMesh : public virtual LLAvatarJoint
{
protected:
- LLColor4 mColor; // color value
-// LLColor4 mSpecular; // specular color (always white for now)
- F32 mShiny; // shiny value
- LLPointer<LLGLTexture> mTexture; // ptr to a global texture
- LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar
- U32 mTestImageName; // handle to a temporary texture for previewing uploads
- LLPolyMesh* mMesh; // ptr to a global polymesh
- BOOL mCullBackFaces; // true by default
- LLFace* mFace; // ptr to a face w/ AGP copy of mesh
-
- U32 mFaceIndexCount;
-
- U32 mNumSkinJoints;
- LLSkinJoint* mSkinJoints;
- S32 mMeshID;
+ LLColor4 mColor; // color value
+// LLColor4 mSpecular; // specular color (always white for now)
+ F32 mShiny; // shiny value
+ LLPointer<LLGLTexture> mTexture; // ptr to a global texture
+ LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar
+ U32 mTestImageName; // handle to a temporary texture for previewing uploads
+ LLPolyMesh* mMesh; // ptr to a global polymesh
+ BOOL mCullBackFaces; // true by default
+ LLFace* mFace; // ptr to a face w/ AGP copy of mesh
+
+ U32 mFaceIndexCount;
+
+ U32 mNumSkinJoints;
+ LLSkinJoint* mSkinJoints;
+ S32 mMeshID;
public:
- static BOOL sPipelineRender;
- //RN: this is here for testing purposes
- static U32 sClothingMaskImageName;
- static LLColor4 sClothingInnerColor;
+ static BOOL sPipelineRender;
+ //RN: this is here for testing purposes
+ static U32 sClothingMaskImageName;
+ static LLColor4 sClothingInnerColor;
public:
- // Constructor
- LLAvatarJointMesh();
+ // Constructor
+ LLAvatarJointMesh();
- // Destructor
- virtual ~LLAvatarJointMesh();
+ // Destructor
+ virtual ~LLAvatarJointMesh();
- // Gets the shape color
- void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha );
+ // Gets the shape color
+ void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha );
- // Sets the shape color
- void setColor( F32 red, F32 green, F32 blue, F32 alpha );
- void setColor( const LLColor4& color );
+ // Sets the shape color
+ void setColor( F32 red, F32 green, F32 blue, F32 alpha );
+ void setColor( const LLColor4& color );
- // Sets the shininess
- void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; };
+ // Sets the shininess
+ void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; };
- // Sets the shape texture
- void setTexture( LLGLTexture *texture );
+ // Sets the shape texture
+ void setTexture( LLGLTexture *texture );
- BOOL hasGLTexture() const;
+ BOOL hasGLTexture() const;
- void setTestTexture( U32 name ) { mTestImageName = name; }
+ void setTestTexture( U32 name ) { mTestImageName = name; }
- // Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture)
- void setLayerSet( LLTexLayerSet* layer_set );
+ // Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture)
+ void setLayerSet( LLTexLayerSet* layer_set );
- BOOL hasComposite() const;
+ BOOL hasComposite() const;
- // Gets the poly mesh
- LLPolyMesh *getMesh();
+ // Gets the poly mesh
+ LLPolyMesh *getMesh();
- // Sets the poly mesh
- void setMesh( LLPolyMesh *mesh );
+ // Sets the poly mesh
+ void setMesh( LLPolyMesh *mesh );
- // Sets up joint matrix data for rendering
- void setupJoint(LLAvatarJoint* current_joint);
+ // Sets up joint matrix data for rendering
+ void setupJoint(LLAvatarJoint* current_joint);
- // Render time method to upload batches of joint matrices
- void uploadJointMatrices();
+ // Render time method to upload batches of joint matrices
+ void uploadJointMatrices();
- // Sets ID for picking
- void setMeshID( S32 id ) {mMeshID = id;}
+ // Sets ID for picking
+ void setMeshID( S32 id ) {mMeshID = id;}
- // Gets ID for picking
- S32 getMeshID() { return mMeshID; }
+ // Gets ID for picking
+ S32 getMeshID() { return mMeshID; }
- void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
+ void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
private:
- // Allocate skin data
- BOOL allocateSkinData( U32 numSkinJoints );
+ // Allocate skin data
+ BOOL allocateSkinData( U32 numSkinJoints );
- // Free skin data
- void freeSkinData();
+ // Free skin data
+ void freeSkinData();
};
#endif // LL_LLAVATARJOINTMESH_H
diff --git a/indra/llappearance/lldriverparam.cpp b/indra/llappearance/lldriverparam.cpp
index f46d0324a5..4a2db2aefb 100644
--- a/indra/llappearance/lldriverparam.cpp
+++ b/indra/llappearance/lldriverparam.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldriverparam.cpp
* @brief A visual parameter that drives (controls) other visual parameters.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,121 +37,121 @@
//-----------------------------------------------------------------------------
LLDriverParamInfo::LLDriverParamInfo() :
- mDriverParam(NULL)
+ mDriverParam(NULL)
{
}
BOOL LLDriverParamInfo::parseXml(LLXmlTreeNode* node)
{
- llassert( node->hasName( "param" ) && node->getChildByName( "param_driver" ) );
-
- if( !LLViewerVisualParamInfo::parseXml( node ))
- return FALSE;
-
- LLXmlTreeNode* param_driver_node = node->getChildByName( "param_driver" );
- if( !param_driver_node )
- return FALSE;
-
- for (LLXmlTreeNode* child = param_driver_node->getChildByName( "driven" );
- child;
- child = param_driver_node->getNextNamedChild())
- {
- S32 driven_id;
- static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id");
- if( child->getFastAttributeS32( id_string, driven_id ) )
- {
- F32 min1 = mMinWeight;
- F32 max1 = mMaxWeight;
- F32 max2 = max1;
- F32 min2 = max1;
-
- // driven ________ //
- // ^ /| |\ //
- // | / | | \ //
- // | / | | \ //
- // | / | | \ //
- // | / | | \ //
- //-------|----|-------|----|-------> driver //
- // | min1 max1 max2 min2
-
- static LLStdStringHandle min1_string = LLXmlTree::addAttributeString("min1");
- child->getFastAttributeF32( min1_string, min1 ); // optional
- static LLStdStringHandle max1_string = LLXmlTree::addAttributeString("max1");
- child->getFastAttributeF32( max1_string, max1 ); // optional
- static LLStdStringHandle max2_string = LLXmlTree::addAttributeString("max2");
- child->getFastAttributeF32( max2_string, max2 ); // optional
- static LLStdStringHandle min2_string = LLXmlTree::addAttributeString("min2");
- child->getFastAttributeF32( min2_string, min2 ); // optional
-
- // Push these on the front of the deque, so that we can construct
- // them in order later (faster)
- mDrivenInfoList.push_front( LLDrivenEntryInfo( driven_id, min1, max1, max2, min2 ) );
- }
- else
- {
- LL_ERRS() << "<driven> Unable to resolve driven parameter: " << driven_id << LL_ENDL;
- return FALSE;
- }
- }
- return TRUE;
+ llassert( node->hasName( "param" ) && node->getChildByName( "param_driver" ) );
+
+ if( !LLViewerVisualParamInfo::parseXml( node ))
+ return FALSE;
+
+ LLXmlTreeNode* param_driver_node = node->getChildByName( "param_driver" );
+ if( !param_driver_node )
+ return FALSE;
+
+ for (LLXmlTreeNode* child = param_driver_node->getChildByName( "driven" );
+ child;
+ child = param_driver_node->getNextNamedChild())
+ {
+ S32 driven_id;
+ static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id");
+ if( child->getFastAttributeS32( id_string, driven_id ) )
+ {
+ F32 min1 = mMinWeight;
+ F32 max1 = mMaxWeight;
+ F32 max2 = max1;
+ F32 min2 = max1;
+
+ // driven ________ //
+ // ^ /| |\ //
+ // | / | | \ //
+ // | / | | \ //
+ // | / | | \ //
+ // | / | | \ //
+ //-------|----|-------|----|-------> driver //
+ // | min1 max1 max2 min2
+
+ static LLStdStringHandle min1_string = LLXmlTree::addAttributeString("min1");
+ child->getFastAttributeF32( min1_string, min1 ); // optional
+ static LLStdStringHandle max1_string = LLXmlTree::addAttributeString("max1");
+ child->getFastAttributeF32( max1_string, max1 ); // optional
+ static LLStdStringHandle max2_string = LLXmlTree::addAttributeString("max2");
+ child->getFastAttributeF32( max2_string, max2 ); // optional
+ static LLStdStringHandle min2_string = LLXmlTree::addAttributeString("min2");
+ child->getFastAttributeF32( min2_string, min2 ); // optional
+
+ // Push these on the front of the deque, so that we can construct
+ // them in order later (faster)
+ mDrivenInfoList.push_front( LLDrivenEntryInfo( driven_id, min1, max1, max2, min2 ) );
+ }
+ else
+ {
+ LL_ERRS() << "<driven> Unable to resolve driven parameter: " << driven_id << LL_ENDL;
+ return FALSE;
+ }
+ }
+ return TRUE;
}
-//virtual
+//virtual
void LLDriverParamInfo::toStream(std::ostream &out)
{
- LLViewerVisualParamInfo::toStream(out);
- out << "driver" << "\t";
- out << mDrivenInfoList.size() << "\t";
- for (LLDrivenEntryInfo& driven : mDrivenInfoList)
- {
- out << driven.mDrivenID << "\t";
- }
-
- out << std::endl;
-
- // FIXME - this mDriverParam backlink makes no sense, because the
- // LLDriverParamInfos are static objects - there's only one copy
- // for each param type, so the backlink will just reference the
- // corresponding param in the most recently created
- // avatar. Apparently these toStream() methods are not currently
- // used anywhere, so it's not an urgent problem.
+ LLViewerVisualParamInfo::toStream(out);
+ out << "driver" << "\t";
+ out << mDrivenInfoList.size() << "\t";
+ for (LLDrivenEntryInfo& driven : mDrivenInfoList)
+ {
+ out << driven.mDrivenID << "\t";
+ }
+
+ out << std::endl;
+
+ // FIXME - this mDriverParam backlink makes no sense, because the
+ // LLDriverParamInfos are static objects - there's only one copy
+ // for each param type, so the backlink will just reference the
+ // corresponding param in the most recently created
+ // avatar. Apparently these toStream() methods are not currently
+ // used anywhere, so it's not an urgent problem.
LL_WARNS_ONCE() << "Invalid usage of mDriverParam." << LL_ENDL;
-
- if(mDriverParam && mDriverParam->getAvatarAppearance()->isSelf() &&
- mDriverParam->getAvatarAppearance()->isValid())
- {
- for (LLDrivenEntryInfo& driven : mDrivenInfoList)
- {
- LLViewerVisualParam *param =
- (LLViewerVisualParam*)mDriverParam->getAvatarAppearance()->getVisualParam(driven.mDrivenID);
- if (param)
- {
- param->getInfo()->toStream(out);
- if (param->getWearableType() != mWearableType)
- {
- if(param->getCrossWearable())
- {
- out << "cross-wearable" << "\t";
- }
- else
- {
- out << "ERROR!" << "\t";
- }
- }
- else
- {
- out << "valid" << "\t";
- }
- }
- else
- {
- LL_WARNS() << "could not get parameter " << driven.mDrivenID << " from avatar "
- << mDriverParam->getAvatarAppearance()
- << " for driver parameter " << getID() << LL_ENDL;
- }
- out << std::endl;
- }
- }
+
+ if(mDriverParam && mDriverParam->getAvatarAppearance()->isSelf() &&
+ mDriverParam->getAvatarAppearance()->isValid())
+ {
+ for (LLDrivenEntryInfo& driven : mDrivenInfoList)
+ {
+ LLViewerVisualParam *param =
+ (LLViewerVisualParam*)mDriverParam->getAvatarAppearance()->getVisualParam(driven.mDrivenID);
+ if (param)
+ {
+ param->getInfo()->toStream(out);
+ if (param->getWearableType() != mWearableType)
+ {
+ if(param->getCrossWearable())
+ {
+ out << "cross-wearable" << "\t";
+ }
+ else
+ {
+ out << "ERROR!" << "\t";
+ }
+ }
+ else
+ {
+ out << "valid" << "\t";
+ }
+ }
+ else
+ {
+ LL_WARNS() << "could not get parameter " << driven.mDrivenID << " from avatar "
+ << mDriverParam->getAvatarAppearance()
+ << " for driver parameter " << getID() << LL_ENDL;
+ }
+ out << std::endl;
+ }
+ }
}
//-----------------------------------------------------------------------------
@@ -159,28 +159,28 @@ void LLDriverParamInfo::toStream(std::ostream &out)
//-----------------------------------------------------------------------------
LLDriverParam::LLDriverParam(LLAvatarAppearance *appearance, LLWearable* wearable /* = NULL */)
- : LLViewerVisualParam(),
- mDefaultVec(),
- mDriven(),
- mCurrentDistortionParam( NULL ),
- mAvatarAppearance(appearance),
- mWearablep(wearable)
+ : LLViewerVisualParam(),
+ mDefaultVec(),
+ mDriven(),
+ mCurrentDistortionParam( NULL ),
+ mAvatarAppearance(appearance),
+ mWearablep(wearable)
{
- llassert(mAvatarAppearance);
- llassert((mWearablep == NULL) || mAvatarAppearance->isSelf());
- mDefaultVec.clear();
+ llassert(mAvatarAppearance);
+ llassert((mWearablep == NULL) || mAvatarAppearance->isSelf());
+ mDefaultVec.clear();
}
LLDriverParam::LLDriverParam(const LLDriverParam& pOther)
- : LLViewerVisualParam(pOther),
- mDefaultVec(pOther.mDefaultVec),
- mDriven(pOther.mDriven),
- mCurrentDistortionParam(pOther.mCurrentDistortionParam),
- mAvatarAppearance(pOther.mAvatarAppearance),
- mWearablep(pOther.mWearablep)
+ : LLViewerVisualParam(pOther),
+ mDefaultVec(pOther.mDefaultVec),
+ mDriven(pOther.mDriven),
+ mCurrentDistortionParam(pOther.mCurrentDistortionParam),
+ mAvatarAppearance(pOther.mAvatarAppearance),
+ mWearablep(pOther.mWearablep)
{
- llassert(mAvatarAppearance);
- llassert((mWearablep == NULL) || mAvatarAppearance->isSelf());
+ llassert(mAvatarAppearance);
+ llassert((mWearablep == NULL) || mAvatarAppearance->isSelf());
}
LLDriverParam::~LLDriverParam()
@@ -189,249 +189,249 @@ LLDriverParam::~LLDriverParam()
BOOL LLDriverParam::setInfo(LLDriverParamInfo *info)
{
- llassert(mInfo == NULL);
- if (info->mID < 0)
- return FALSE;
- mInfo = info;
- mID = info->mID;
- info->mDriverParam = this;
+ llassert(mInfo == NULL);
+ if (info->mID < 0)
+ return FALSE;
+ mInfo = info;
+ mID = info->mID;
+ info->mDriverParam = this;
- setWeight(getDefaultWeight());
+ setWeight(getDefaultWeight());
- return TRUE;
+ return TRUE;
}
/*virtual*/ LLViewerVisualParam* LLDriverParam::cloneParam(LLWearable* wearable) const
{
- llassert(wearable);
- return new LLDriverParam(*this);
+ llassert(wearable);
+ return new LLDriverParam(*this);
}
void LLDriverParam::setWeight(F32 weight)
{
- F32 min_weight = getMinWeight();
- F32 max_weight = getMaxWeight();
- if (mIsAnimating)
- {
- // allow overshoot when animating
- mCurWeight = weight;
- }
- else
- {
- mCurWeight = llclamp(weight, min_weight, max_weight);
- }
-
- // driven ________
- // ^ /| |\ ^
- // | / | | \ |
- // | / | | \ |
- // | / | | \ |
- // | / | | \ |
- //-------|----|-------|----|-------> driver
- // | min1 max1 max2 min2
-
- for(LLDrivenEntry& driven : mDriven)
- {
- LLDrivenEntry* drivenp = &driven;
- LLDrivenEntryInfo* info = drivenp->mInfo;
-
- F32 driven_weight = 0.f;
- F32 driven_min = drivenp->mParam->getMinWeight();
- F32 driven_max = drivenp->mParam->getMaxWeight();
-
- if (mIsAnimating)
- {
- // driven param doesn't interpolate (textures, for example)
- if (!drivenp->mParam->getAnimating())
- {
- continue;
- }
- if( mCurWeight < info->mMin1 )
- {
- if (info->mMin1 == min_weight)
- {
- if (info->mMin1 == info->mMax1)
- {
- driven_weight = driven_max;
- }
- else
- {
- //up slope extrapolation
- F32 t = (mCurWeight - info->mMin1) / (info->mMax1 - info->mMin1 );
- driven_weight = driven_min + t * (driven_max - driven_min);
- }
- }
- else
- {
- driven_weight = driven_min;
- }
-
- setDrivenWeight(drivenp,driven_weight);
- continue;
- }
- else
- if ( mCurWeight > info->mMin2 )
- {
- if (info->mMin2 == max_weight)
- {
- if (info->mMin2 == info->mMax2)
- {
- driven_weight = driven_max;
- }
- else
- {
- //down slope extrapolation
- F32 t = (mCurWeight - info->mMax2) / (info->mMin2 - info->mMax2 );
- driven_weight = driven_max + t * (driven_min - driven_max);
- }
- }
- else
- {
- driven_weight = driven_min;
- }
-
- setDrivenWeight(drivenp,driven_weight);
- continue;
- }
- }
-
- driven_weight = getDrivenWeight(drivenp, mCurWeight);
- setDrivenWeight(drivenp,driven_weight);
- }
+ F32 min_weight = getMinWeight();
+ F32 max_weight = getMaxWeight();
+ if (mIsAnimating)
+ {
+ // allow overshoot when animating
+ mCurWeight = weight;
+ }
+ else
+ {
+ mCurWeight = llclamp(weight, min_weight, max_weight);
+ }
+
+ // driven ________
+ // ^ /| |\ ^
+ // | / | | \ |
+ // | / | | \ |
+ // | / | | \ |
+ // | / | | \ |
+ //-------|----|-------|----|-------> driver
+ // | min1 max1 max2 min2
+
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ LLDrivenEntry* drivenp = &driven;
+ LLDrivenEntryInfo* info = drivenp->mInfo;
+
+ F32 driven_weight = 0.f;
+ F32 driven_min = drivenp->mParam->getMinWeight();
+ F32 driven_max = drivenp->mParam->getMaxWeight();
+
+ if (mIsAnimating)
+ {
+ // driven param doesn't interpolate (textures, for example)
+ if (!drivenp->mParam->getAnimating())
+ {
+ continue;
+ }
+ if( mCurWeight < info->mMin1 )
+ {
+ if (info->mMin1 == min_weight)
+ {
+ if (info->mMin1 == info->mMax1)
+ {
+ driven_weight = driven_max;
+ }
+ else
+ {
+ //up slope extrapolation
+ F32 t = (mCurWeight - info->mMin1) / (info->mMax1 - info->mMin1 );
+ driven_weight = driven_min + t * (driven_max - driven_min);
+ }
+ }
+ else
+ {
+ driven_weight = driven_min;
+ }
+
+ setDrivenWeight(drivenp,driven_weight);
+ continue;
+ }
+ else
+ if ( mCurWeight > info->mMin2 )
+ {
+ if (info->mMin2 == max_weight)
+ {
+ if (info->mMin2 == info->mMax2)
+ {
+ driven_weight = driven_max;
+ }
+ else
+ {
+ //down slope extrapolation
+ F32 t = (mCurWeight - info->mMax2) / (info->mMin2 - info->mMax2 );
+ driven_weight = driven_max + t * (driven_min - driven_max);
+ }
+ }
+ else
+ {
+ driven_weight = driven_min;
+ }
+
+ setDrivenWeight(drivenp,driven_weight);
+ continue;
+ }
+ }
+
+ driven_weight = getDrivenWeight(drivenp, mCurWeight);
+ setDrivenWeight(drivenp,driven_weight);
+ }
}
-F32 LLDriverParam::getTotalDistortion()
+F32 LLDriverParam::getTotalDistortion()
{
- F32 sum = 0.f;
- for(LLDrivenEntry& driven : mDriven)
- {
- sum += driven.mParam->getTotalDistortion();
- }
+ F32 sum = 0.f;
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ sum += driven.mParam->getTotalDistortion();
+ }
- return sum;
+ return sum;
}
-const LLVector4a &LLDriverParam::getAvgDistortion()
+const LLVector4a &LLDriverParam::getAvgDistortion()
{
- // It's not actually correct to take the average of averages, but it good enough here.
- LLVector4a sum;
- sum.clear();
- S32 count = 0;
- for(LLDrivenEntry& driven : mDriven)
- {
- sum.add(driven.mParam->getAvgDistortion());
- count++;
- }
- sum.mul( 1.f/(F32)count);
-
- mDefaultVec = sum;
- return mDefaultVec;
+ // It's not actually correct to take the average of averages, but it good enough here.
+ LLVector4a sum;
+ sum.clear();
+ S32 count = 0;
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ sum.add(driven.mParam->getAvgDistortion());
+ count++;
+ }
+ sum.mul( 1.f/(F32)count);
+
+ mDefaultVec = sum;
+ return mDefaultVec;
}
-F32 LLDriverParam::getMaxDistortion()
+F32 LLDriverParam::getMaxDistortion()
{
- F32 max = 0.f;
- for(LLDrivenEntry& driven : mDriven)
- {
- F32 param_max = driven.mParam->getMaxDistortion();
- if( param_max > max )
- {
- max = param_max;
- }
- }
-
- return max;
+ F32 max = 0.f;
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ F32 param_max = driven.mParam->getMaxDistortion();
+ if( param_max > max )
+ {
+ max = param_max;
+ }
+ }
+
+ return max;
}
-LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)
+LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)
{
- LLVector4a sum;
- sum.clear();
- for(LLDrivenEntry& driven : mDriven)
- {
- sum.add(driven.mParam->getVertexDistortion(index, poly_mesh));
- }
- return sum;
+ LLVector4a sum;
+ sum.clear();
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ sum.add(driven.mParam->getVertexDistortion(index, poly_mesh));
+ }
+ return sum;
}
-const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)
+const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)
{
- mCurrentDistortionParam = NULL;
- const LLVector4a* v = NULL;
- for(LLDrivenEntry& driven : mDriven)
- {
- v = driven.mParam->getFirstDistortion(index, poly_mesh);
- if( v )
- {
- mCurrentDistortionParam = driven.mParam;
- break;
- }
- }
-
- return v;
+ mCurrentDistortionParam = NULL;
+ const LLVector4a* v = NULL;
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ v = driven.mParam->getFirstDistortion(index, poly_mesh);
+ if( v )
+ {
+ mCurrentDistortionParam = driven.mParam;
+ break;
+ }
+ }
+
+ return v;
};
-const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)
+const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)
{
- llassert( mCurrentDistortionParam );
- if( !mCurrentDistortionParam )
- {
- return NULL;
- }
-
- LLDrivenEntry* driven = NULL;
- entry_list_t::iterator iter;
-
- // Set mDriven iteration to the right point
- for( iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- driven = &(*iter);
- if( driven->mParam == mCurrentDistortionParam )
- {
- break;
- }
- }
-
- llassert(driven);
- if (!driven)
- {
- return NULL; // shouldn't happen, but...
- }
-
- // We're already in the middle of a param's distortions, so get the next one.
- const LLVector4a* v = driven->mParam->getNextDistortion( index, poly_mesh );
- if( (!v) && (iter != mDriven.end()) )
- {
- // This param is finished, so start the next param. It might not have any
- // distortions, though, so we have to loop to find the next param that does.
- for( iter++; iter != mDriven.end(); iter++ )
- {
- driven = &(*iter);
- v = driven->mParam->getFirstDistortion(index, poly_mesh);
- if( v )
- {
- mCurrentDistortionParam = driven->mParam;
- break;
- }
- }
- }
-
- return v;
+ llassert( mCurrentDistortionParam );
+ if( !mCurrentDistortionParam )
+ {
+ return NULL;
+ }
+
+ LLDrivenEntry* driven = NULL;
+ entry_list_t::iterator iter;
+
+ // Set mDriven iteration to the right point
+ for( iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ {
+ driven = &(*iter);
+ if( driven->mParam == mCurrentDistortionParam )
+ {
+ break;
+ }
+ }
+
+ llassert(driven);
+ if (!driven)
+ {
+ return NULL; // shouldn't happen, but...
+ }
+
+ // We're already in the middle of a param's distortions, so get the next one.
+ const LLVector4a* v = driven->mParam->getNextDistortion( index, poly_mesh );
+ if( (!v) && (iter != mDriven.end()) )
+ {
+ // This param is finished, so start the next param. It might not have any
+ // distortions, though, so we have to loop to find the next param that does.
+ for( iter++; iter != mDriven.end(); iter++ )
+ {
+ driven = &(*iter);
+ v = driven->mParam->getFirstDistortion(index, poly_mesh);
+ if( v )
+ {
+ mCurrentDistortionParam = driven->mParam;
+ break;
+ }
+ }
+ }
+
+ return v;
};
S32 LLDriverParam::getDrivenParamsCount() const
{
- return mDriven.size();
+ return mDriven.size();
}
const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const
{
- if (0 > index || index >= mDriven.size())
- {
- return NULL;
- }
- return mDriven[index].mParam;
+ if (0 > index || index >= mDriven.size())
+ {
+ return NULL;
+ }
+ return mDriven[index].mParam;
}
//-----------------------------------------------------------------------------
@@ -439,17 +439,17 @@ const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const
//-----------------------------------------------------------------------------
void LLDriverParam::setAnimationTarget( F32 target_value)
{
- LLVisualParam::setAnimationTarget(target_value);
+ LLVisualParam::setAnimationTarget(target_value);
- for(LLDrivenEntry& driven : mDriven)
- {
- LLDrivenEntry* drivenp = &driven;
- F32 driven_weight = getDrivenWeight(drivenp, mTargetWeight);
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ LLDrivenEntry* drivenp = &driven;
+ F32 driven_weight = getDrivenWeight(drivenp, mTargetWeight);
- // this isn't normally necessary, as driver params handle interpolation of their driven params
- // but texture params need to know to assume their final value at beginning of interpolation
- drivenp->mParam->setAnimationTarget(driven_weight);
- }
+ // this isn't normally necessary, as driver params handle interpolation of their driven params
+ // but texture params need to know to assume their final value at beginning of interpolation
+ drivenp->mParam->setAnimationTarget(driven_weight);
+ }
}
//-----------------------------------------------------------------------------
@@ -457,85 +457,85 @@ void LLDriverParam::setAnimationTarget( F32 target_value)
//-----------------------------------------------------------------------------
void LLDriverParam::stopAnimating()
{
- LLVisualParam::stopAnimating();
+ LLVisualParam::stopAnimating();
- for(LLDrivenEntry& driven : mDriven)
- {
- driven.mParam->setAnimating(FALSE);
- }
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ driven.mParam->setAnimating(FALSE);
+ }
}
-/*virtual*/
+/*virtual*/
BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params)
{
- BOOL success = TRUE;
- for (LLDrivenEntryInfo& driven_info : getInfo()->mDrivenInfoList)
- {
- S32 driven_id = driven_info.mDrivenID;
-
- // check for already existing links. Do not overwrite.
- BOOL found = FALSE;
- for (auto& driven : mDriven)
- {
- if (driven.mInfo->mDrivenID == driven_id)
- {
- found = TRUE;
- }
- }
-
- if (!found)
- {
- LLViewerVisualParam* param = (LLViewerVisualParam*)mapper(driven_id);
- if (param) param->setParamLocation(this->getParamLocation());
- bool push = param && (!only_cross_params || param->getCrossWearable());
- if (push)
- {
- mDriven.push_back(LLDrivenEntry( param, &driven_info ));
- }
- else
- {
- success = FALSE;
- }
- }
- }
-
- return success;
+ BOOL success = TRUE;
+ for (LLDrivenEntryInfo& driven_info : getInfo()->mDrivenInfoList)
+ {
+ S32 driven_id = driven_info.mDrivenID;
+
+ // check for already existing links. Do not overwrite.
+ BOOL found = FALSE;
+ for (auto& driven : mDriven)
+ {
+ if (driven.mInfo->mDrivenID == driven_id)
+ {
+ found = TRUE;
+ }
+ }
+
+ if (!found)
+ {
+ LLViewerVisualParam* param = (LLViewerVisualParam*)mapper(driven_id);
+ if (param) param->setParamLocation(this->getParamLocation());
+ bool push = param && (!only_cross_params || param->getCrossWearable());
+ if (push)
+ {
+ mDriven.push_back(LLDrivenEntry( param, &driven_info ));
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+ }
+
+ return success;
}
void LLDriverParam::resetDrivenParams()
{
- mDriven.clear();
- mDriven.reserve(getInfo()->mDrivenInfoList.size());
+ mDriven.clear();
+ mDriven.reserve(getInfo()->mDrivenInfoList.size());
}
void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
{
- bool needs_update = (getWearableType()==driven_type);
-
- // if the driver has a driven entry for the passed-in wearable type, we need to refresh the value
- for(LLDrivenEntry& driven : mDriven)
- {
- if (driven.mParam && driven.mParam->getCrossWearable() && driven.mParam->getWearableType() == driven_type)
- {
- needs_update = true;
- }
- }
-
-
- if (needs_update)
- {
- LLWearableType::EType driver_type = (LLWearableType::EType)getWearableType();
-
- // If we've gotten here, we've added a new wearable of type "type"
- // Thus this wearable needs to get updates from the driver wearable.
- // The call to setVisualParamWeight seems redundant, but is necessary
- // as the number of driven wearables has changed since the last update. -Nyx
- LLWearable *wearable = mAvatarAppearance->getWearableData()->getTopWearable(driver_type);
- if (wearable)
- {
- wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID));
- }
- }
+ bool needs_update = (getWearableType()==driven_type);
+
+ // if the driver has a driven entry for the passed-in wearable type, we need to refresh the value
+ for(LLDrivenEntry& driven : mDriven)
+ {
+ if (driven.mParam && driven.mParam->getCrossWearable() && driven.mParam->getWearableType() == driven_type)
+ {
+ needs_update = true;
+ }
+ }
+
+
+ if (needs_update)
+ {
+ LLWearableType::EType driver_type = (LLWearableType::EType)getWearableType();
+
+ // If we've gotten here, we've added a new wearable of type "type"
+ // Thus this wearable needs to get updates from the driver wearable.
+ // The call to setVisualParamWeight seems redundant, but is necessary
+ // as the number of driven wearables has changed since the last update. -Nyx
+ LLWearable *wearable = mAvatarAppearance->getWearableData()->getTopWearable(driver_type);
+ if (wearable)
+ {
+ wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID));
+ }
+ }
}
@@ -544,79 +544,79 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
//-----------------------------------------------------------------------------
F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight)
{
- F32 min_weight = getMinWeight();
- F32 max_weight = getMaxWeight();
- const LLDrivenEntryInfo* info = driven->mInfo;
-
- F32 driven_weight = 0.f;
- F32 driven_min = driven->mParam->getMinWeight();
- F32 driven_max = driven->mParam->getMaxWeight();
-
- if( input_weight <= info->mMin1 )
- {
- if( info->mMin1 == info->mMax1 &&
- info->mMin1 <= min_weight)
- {
- driven_weight = driven_max;
- }
- else
- {
- driven_weight = driven_min;
- }
- }
- else
- if( input_weight <= info->mMax1 )
- {
- F32 t = (input_weight - info->mMin1) / (info->mMax1 - info->mMin1 );
- driven_weight = driven_min + t * (driven_max - driven_min);
- }
- else
- if( input_weight <= info->mMax2 )
- {
- driven_weight = driven_max;
- }
- else
- if( input_weight <= info->mMin2 )
- {
- F32 t = (input_weight - info->mMax2) / (info->mMin2 - info->mMax2 );
- driven_weight = driven_max + t * (driven_min - driven_max);
- }
- else
- {
- if (info->mMax2 >= max_weight)
- {
- driven_weight = driven_max;
- }
- else
- {
- driven_weight = driven_min;
- }
- }
-
- return driven_weight;
+ F32 min_weight = getMinWeight();
+ F32 max_weight = getMaxWeight();
+ const LLDrivenEntryInfo* info = driven->mInfo;
+
+ F32 driven_weight = 0.f;
+ F32 driven_min = driven->mParam->getMinWeight();
+ F32 driven_max = driven->mParam->getMaxWeight();
+
+ if( input_weight <= info->mMin1 )
+ {
+ if( info->mMin1 == info->mMax1 &&
+ info->mMin1 <= min_weight)
+ {
+ driven_weight = driven_max;
+ }
+ else
+ {
+ driven_weight = driven_min;
+ }
+ }
+ else
+ if( input_weight <= info->mMax1 )
+ {
+ F32 t = (input_weight - info->mMin1) / (info->mMax1 - info->mMin1 );
+ driven_weight = driven_min + t * (driven_max - driven_min);
+ }
+ else
+ if( input_weight <= info->mMax2 )
+ {
+ driven_weight = driven_max;
+ }
+ else
+ if( input_weight <= info->mMin2 )
+ {
+ F32 t = (input_weight - info->mMax2) / (info->mMin2 - info->mMax2 );
+ driven_weight = driven_max + t * (driven_min - driven_max);
+ }
+ else
+ {
+ if (info->mMax2 >= max_weight)
+ {
+ driven_weight = driven_max;
+ }
+ else
+ {
+ driven_weight = driven_min;
+ }
+ }
+
+ return driven_weight;
}
void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight)
{
- bool use_self = false;
- if(mWearablep &&
- mAvatarAppearance->isValid() &&
- driven->mParam->getCrossWearable())
- {
- LLWearable* wearable = mWearablep;
- if (mAvatarAppearance->getWearableData()->isOnTop(wearable))
- {
- use_self = true;
- }
- }
-
- if (use_self)
- {
- // call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
- mAvatarAppearance->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight);
- }
- else
- {
- driven->mParam->setWeight( driven_weight);
- }
+ bool use_self = false;
+ if(mWearablep &&
+ mAvatarAppearance->isValid() &&
+ driven->mParam->getCrossWearable())
+ {
+ LLWearable* wearable = mWearablep;
+ if (mAvatarAppearance->getWearableData()->isOnTop(wearable))
+ {
+ use_self = true;
+ }
+ }
+
+ if (use_self)
+ {
+ // call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
+ mAvatarAppearance->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight);
+ }
+ else
+ {
+ driven->mParam->setWeight( driven_weight);
+ }
}
diff --git a/indra/llappearance/lldriverparam.h b/indra/llappearance/lldriverparam.h
index a6261b507b..f93660dba3 100644
--- a/indra/llappearance/lldriverparam.h
+++ b/indra/llappearance/lldriverparam.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lldriverparam.h
* @brief A visual parameter that drives (controls) other visual parameters.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,40 +39,40 @@ class LLWearable;
struct LLDrivenEntryInfo
{
- LLDrivenEntryInfo( S32 id, F32 min1, F32 max1, F32 max2, F32 min2 )
- : mDrivenID( id ), mMin1( min1 ), mMax1( max1 ), mMax2( max2 ), mMin2( min2 ) {}
- S32 mDrivenID;
- F32 mMin1;
- F32 mMax1;
- F32 mMax2;
- F32 mMin2;
+ LLDrivenEntryInfo( S32 id, F32 min1, F32 max1, F32 max2, F32 min2 )
+ : mDrivenID( id ), mMin1( min1 ), mMax1( max1 ), mMax2( max2 ), mMin2( min2 ) {}
+ S32 mDrivenID;
+ F32 mMin1;
+ F32 mMax1;
+ F32 mMax2;
+ F32 mMin2;
};
struct LLDrivenEntry
{
- LLDrivenEntry( LLViewerVisualParam* param, LLDrivenEntryInfo *info )
- : mParam( param ), mInfo( info ) {}
- LLViewerVisualParam* mParam;
- LLDrivenEntryInfo* mInfo;
+ LLDrivenEntry( LLViewerVisualParam* param, LLDrivenEntryInfo *info )
+ : mParam( param ), mInfo( info ) {}
+ LLViewerVisualParam* mParam;
+ LLDrivenEntryInfo* mInfo;
};
//-----------------------------------------------------------------------------
class LLDriverParamInfo : public LLViewerVisualParamInfo
{
- friend class LLDriverParam;
+ friend class LLDriverParam;
public:
- LLDriverParamInfo();
- /*virtual*/ ~LLDriverParamInfo() {};
-
- /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
+ LLDriverParamInfo();
+ /*virtual*/ ~LLDriverParamInfo() {};
+
+ /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
- /*virtual*/ void toStream(std::ostream &out);
+ /*virtual*/ void toStream(std::ostream &out);
protected:
- typedef std::deque<LLDrivenEntryInfo> entry_info_list_t;
- entry_info_list_t mDrivenInfoList;
- LLDriverParam* mDriverParam; // backpointer
+ typedef std::deque<LLDrivenEntryInfo> entry_info_list_t;
+ entry_info_list_t mDrivenInfoList;
+ LLDriverParam* mDriverParam; // backpointer
};
//-----------------------------------------------------------------------------
@@ -90,32 +90,32 @@ public:
// Special: These functions are overridden by child classes
LLDriverParamInfo* getInfo() const { return (LLDriverParamInfo*)mInfo; }
// This sets mInfo and calls initialization functions
- BOOL setInfo(LLDriverParamInfo* info);
+ BOOL setInfo(LLDriverParamInfo* info);
LLAvatarAppearance* getAvatarAppearance() { return mAvatarAppearance; }
const LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
- void updateCrossDrivenParams(LLWearableType::EType driven_type);
+ void updateCrossDrivenParams(LLWearableType::EType driven_type);
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
// LLVisualParam Virtual functions
- /*virtual*/ void apply(ESex sex) {} // apply is called separately for each driven param.
- /*virtual*/ void setWeight(F32 weight);
- /*virtual*/ void setAnimationTarget(F32 target_value);
- /*virtual*/ void stopAnimating();
- /*virtual*/ BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params);
- /*virtual*/ void resetDrivenParams();
+ /*virtual*/ void apply(ESex sex) {} // apply is called separately for each driven param.
+ /*virtual*/ void setWeight(F32 weight);
+ /*virtual*/ void setAnimationTarget(F32 target_value);
+ /*virtual*/ void stopAnimating();
+ /*virtual*/ BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params);
+ /*virtual*/ void resetDrivenParams();
// LLViewerVisualParam Virtual functions
- /*virtual*/ F32 getTotalDistortion();
+ /*virtual*/ F32 getTotalDistortion();
/*virtual*/ const LLVector4a& getAvgDistortion();
- /*virtual*/ F32 getMaxDistortion();
- /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh* poly_mesh);
+ /*virtual*/ F32 getMaxDistortion();
+ /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh* poly_mesh);
/*virtual*/ const LLVector4a* getFirstDistortion(U32* index, LLPolyMesh** poly_mesh);
/*virtual*/ const LLVector4a* getNextDistortion(U32* index, LLPolyMesh** poly_mesh);
- S32 getDrivenParamsCount() const;
+ S32 getDrivenParamsCount() const;
const LLViewerVisualParam* getDrivenParam(S32 index) const;
typedef std::vector<LLDrivenEntry> entry_list_t;
@@ -128,7 +128,7 @@ protected:
void setDrivenWeight(LLDrivenEntry* driven, F32 driven_weight);
- LL_ALIGN_16(LLVector4a mDefaultVec); // temp holder
+ LL_ALIGN_16(LLVector4a mDefaultVec); // temp holder
entry_list_t mDriven;
LLViewerVisualParam* mCurrentDistortionParam;
// Backlink only; don't make this an LLPointer.
diff --git a/indra/llappearance/lljointpickname.h b/indra/llappearance/lljointpickname.h
index 1d41a761fc..93c827ac21 100644
--- a/indra/llappearance/lljointpickname.h
+++ b/indra/llappearance/lljointpickname.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lljointpickname.h
* @brief Defines OpenGL seleciton stack names
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,13 +35,13 @@ class LLAvatarJointMesh;
// should be pushed/popped.
enum LLJointPickName
{
- PN_DEFAULT = -1,
- PN_0 = 0,
- PN_1 = 1,
- PN_2 = 2,
- PN_3 = 3,
- PN_4 = 4,
- PN_5 = 5
+ PN_DEFAULT = -1,
+ PN_0 = 0,
+ PN_1 = 1,
+ PN_2 = 2,
+ PN_3 = 3,
+ PN_4 = 4,
+ PN_5 = 5
};
typedef std::vector<LLAvatarJointMesh*> avatar_joint_mesh_list_t;
diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp
index ab50db3a5a..dfc61382ea 100644
--- a/indra/llappearance/lllocaltextureobject.cpp
+++ b/indra/llappearance/lllocaltextureobject.cpp
@@ -1,24 +1,24 @@
-/**
+/**
* @file lllocaltextureobject.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,177 +36,177 @@
LLLocalTextureObject::LLLocalTextureObject() :
- mIsBakedReady(FALSE),
- mDiscard(MAX_DISCARD_LEVEL+1)
+ mIsBakedReady(FALSE),
+ mDiscard(MAX_DISCARD_LEVEL+1)
{
- mImage = NULL;
+ mImage = NULL;
}
LLLocalTextureObject::LLLocalTextureObject(LLGLTexture* image, const LLUUID& id) :
- mIsBakedReady(FALSE),
- mDiscard(MAX_DISCARD_LEVEL+1)
+ mIsBakedReady(FALSE),
+ mDiscard(MAX_DISCARD_LEVEL+1)
{
- mImage = image;
- gGL.getTexUnit(0)->bind(mImage);
- mID = id;
+ mImage = image;
+ gGL.getTexUnit(0)->bind(mImage);
+ mID = id;
}
LLLocalTextureObject::LLLocalTextureObject(const LLLocalTextureObject& lto) :
- mImage(lto.mImage),
- mID(lto.mID),
- mIsBakedReady(lto.mIsBakedReady),
- mDiscard(lto.mDiscard)
-{
- U32 num_layers = lto.getNumTexLayers();
- mTexLayers.reserve(num_layers);
- for (U32 index = 0; index < num_layers; index++)
- {
- LLTexLayer* original_layer = lto.getTexLayer(index);
- if (!original_layer)
- {
- LL_ERRS() << "could not clone Local Texture Object: unable to extract texlayer!" << LL_ENDL;
- continue;
- }
-
- LLTexLayer* new_layer = new LLTexLayer(*original_layer);
- new_layer->setLTO(this);
- mTexLayers.push_back(new_layer);
- }
+ mImage(lto.mImage),
+ mID(lto.mID),
+ mIsBakedReady(lto.mIsBakedReady),
+ mDiscard(lto.mDiscard)
+{
+ U32 num_layers = lto.getNumTexLayers();
+ mTexLayers.reserve(num_layers);
+ for (U32 index = 0; index < num_layers; index++)
+ {
+ LLTexLayer* original_layer = lto.getTexLayer(index);
+ if (!original_layer)
+ {
+ LL_ERRS() << "could not clone Local Texture Object: unable to extract texlayer!" << LL_ENDL;
+ continue;
+ }
+
+ LLTexLayer* new_layer = new LLTexLayer(*original_layer);
+ new_layer->setLTO(this);
+ mTexLayers.push_back(new_layer);
+ }
}
LLLocalTextureObject::~LLLocalTextureObject()
{
- delete_and_clear(mTexLayers);
+ delete_and_clear(mTexLayers);
}
LLGLTexture* LLLocalTextureObject::getImage() const
{
- return mImage;
+ return mImage;
}
LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const
{
- if (index >= getNumTexLayers())
- {
- return NULL;
- }
+ if (index >= getNumTexLayers())
+ {
+ return NULL;
+ }
- return mTexLayers[index];
+ return mTexLayers[index];
}
LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name)
{
- for(LLTexLayer* layer : mTexLayers)
- {
- if (layer->getName().compare(name) == 0)
- {
- return layer;
- }
- }
+ for(LLTexLayer* layer : mTexLayers)
+ {
+ if (layer->getName().compare(name) == 0)
+ {
+ return layer;
+ }
+ }
- return NULL;
+ return NULL;
}
U32 LLLocalTextureObject::getNumTexLayers() const
{
- return mTexLayers.size();
+ return mTexLayers.size();
}
LLUUID LLLocalTextureObject::getID() const
{
- return mID;
+ return mID;
}
S32 LLLocalTextureObject::getDiscard() const
{
- return mDiscard;
+ return mDiscard;
}
BOOL LLLocalTextureObject::getBakedReady() const
{
- return mIsBakedReady;
+ return mIsBakedReady;
}
void LLLocalTextureObject::setImage(LLGLTexture* new_image)
{
- mImage = new_image;
+ mImage = new_image;
}
BOOL LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index)
{
- if (index >= getNumTexLayers() )
- {
- return FALSE;
- }
+ if (index >= getNumTexLayers() )
+ {
+ return FALSE;
+ }
- if (new_tex_layer == NULL)
- {
- return removeTexLayer(index);
- }
+ if (new_tex_layer == NULL)
+ {
+ return removeTexLayer(index);
+ }
- LLTexLayer *layer = new LLTexLayer(*new_tex_layer);
- layer->setLTO(this);
+ LLTexLayer *layer = new LLTexLayer(*new_tex_layer);
+ layer->setLTO(this);
- if (mTexLayers[index])
- {
- delete mTexLayers[index];
- }
- mTexLayers[index] = layer;
+ if (mTexLayers[index])
+ {
+ delete mTexLayers[index];
+ }
+ mTexLayers[index] = layer;
- return TRUE;
+ return TRUE;
}
BOOL LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable)
{
- if (new_tex_layer == NULL)
- {
- return FALSE;
- }
+ if (new_tex_layer == NULL)
+ {
+ return FALSE;
+ }
- LLTexLayer *layer = new LLTexLayer(*new_tex_layer, wearable);
- layer->setLTO(this);
- mTexLayers.push_back(layer);
- return TRUE;
+ LLTexLayer *layer = new LLTexLayer(*new_tex_layer, wearable);
+ layer->setLTO(this);
+ mTexLayers.push_back(layer);
+ return TRUE;
}
BOOL LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable)
{
- if (new_tex_layer == NULL)
- {
- return FALSE;
- }
+ if (new_tex_layer == NULL)
+ {
+ return FALSE;
+ }
- LLTexLayer *layer = new LLTexLayer(*new_tex_layer, this, wearable);
- layer->setLTO(this);
- mTexLayers.push_back(layer);
- return TRUE;
+ LLTexLayer *layer = new LLTexLayer(*new_tex_layer, this, wearable);
+ layer->setLTO(this);
+ mTexLayers.push_back(layer);
+ return TRUE;
}
BOOL LLLocalTextureObject::removeTexLayer(U32 index)
{
- if (index >= getNumTexLayers())
- {
- return FALSE;
- }
- tex_layer_vec_t::iterator iter = mTexLayers.begin();
- iter += index;
+ if (index >= getNumTexLayers())
+ {
+ return FALSE;
+ }
+ tex_layer_vec_t::iterator iter = mTexLayers.begin();
+ iter += index;
- delete *iter;
- mTexLayers.erase(iter);
- return TRUE;
+ delete *iter;
+ mTexLayers.erase(iter);
+ return TRUE;
}
void LLLocalTextureObject::setID(LLUUID new_id)
{
- mID = new_id;
+ mID = new_id;
}
void LLLocalTextureObject::setDiscard(S32 new_discard)
{
- mDiscard = new_discard;
+ mDiscard = new_discard;
}
void LLLocalTextureObject::setBakedReady(BOOL ready)
{
- mIsBakedReady = ready;
+ mIsBakedReady = ready;
}
diff --git a/indra/llappearance/lllocaltextureobject.h b/indra/llappearance/lllocaltextureobject.h
index 9b9f41fd19..f981e73789 100644
--- a/indra/llappearance/lllocaltextureobject.h
+++ b/indra/llappearance/lllocaltextureobject.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lllocaltextureobject.h
* @brief LLLocalTextureObject class header file
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,50 +36,50 @@ class LLTexLayer;
class LLTexLayerTemplate;
class LLWearable;
-// Stores all relevant information for a single texture
-// assumed to have ownership of all objects referred to -
+// Stores all relevant information for a single texture
+// assumed to have ownership of all objects referred to -
// will delete objects when being replaced or if object is destroyed.
class LLLocalTextureObject
{
public:
- LLLocalTextureObject();
- LLLocalTextureObject(LLGLTexture* image, const LLUUID& id);
- LLLocalTextureObject(const LLLocalTextureObject& lto);
- ~LLLocalTextureObject();
+ LLLocalTextureObject();
+ LLLocalTextureObject(LLGLTexture* image, const LLUUID& id);
+ LLLocalTextureObject(const LLLocalTextureObject& lto);
+ ~LLLocalTextureObject();
- LLGLTexture* getImage() const;
- LLTexLayer* getTexLayer(U32 index) const;
- LLTexLayer* getTexLayer(const std::string &name);
- U32 getNumTexLayers() const;
- LLUUID getID() const;
- S32 getDiscard() const;
- BOOL getBakedReady() const;
+ LLGLTexture* getImage() const;
+ LLTexLayer* getTexLayer(U32 index) const;
+ LLTexLayer* getTexLayer(const std::string &name);
+ U32 getNumTexLayers() const;
+ LLUUID getID() const;
+ S32 getDiscard() const;
+ BOOL getBakedReady() const;
- void setImage(LLGLTexture* new_image);
- BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index);
- BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable);
- BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable);
- BOOL removeTexLayer(U32 index);
+ void setImage(LLGLTexture* new_image);
+ BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index);
+ BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable);
+ BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable);
+ BOOL removeTexLayer(U32 index);
- void setID(LLUUID new_id);
- void setDiscard(S32 new_discard);
- void setBakedReady(BOOL ready);
+ void setID(LLUUID new_id);
+ void setDiscard(S32 new_discard);
+ void setBakedReady(BOOL ready);
protected:
private:
- LLPointer<LLGLTexture> mImage;
- // NOTE: LLLocalTextureObject should be the exclusive owner of mTexEntry and mTexLayer
- // using shared pointers here only for smart assignment & cleanup
- // do NOT create new shared pointers to these objects, or keep pointers to them around
- typedef std::vector<LLTexLayer*> tex_layer_vec_t;
- tex_layer_vec_t mTexLayers;
+ LLPointer<LLGLTexture> mImage;
+ // NOTE: LLLocalTextureObject should be the exclusive owner of mTexEntry and mTexLayer
+ // using shared pointers here only for smart assignment & cleanup
+ // do NOT create new shared pointers to these objects, or keep pointers to them around
+ typedef std::vector<LLTexLayer*> tex_layer_vec_t;
+ tex_layer_vec_t mTexLayers;
- LLUUID mID;
+ LLUUID mID;
- BOOL mIsBakedReady;
- S32 mDiscard;
+ BOOL mIsBakedReady;
+ S32 mDiscard;
};
#endif // LL_LOCALTEXTUREOBJECT_H
diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp
index dab14851c8..75d5d23260 100644
--- a/indra/llappearance/llpolymesh.cpp
+++ b/indra/llappearance/llpolymesh.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpolymesh.cpp
* @brief Implementation of LLPolyMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,10 +47,10 @@
//extern LLControlGroup gSavedSettings; // read only
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
- const std::string &name);
+ const std::string &name);
LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data,
- const LLVector3 &direction,
- const std::string &name);
+ const LLVector3 &direction,
+ const std::string &name);
LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,
F32 scale,
const std::string &name);
@@ -236,10 +236,10 @@ BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )
mWeights = (F32*) ll_aligned_malloc_16(numVertices*sizeof(F32));
for (i = 0; i < numVertices; i++)
{
- mBaseCoords[i].clear();
- mBaseNormals[i].clear();
- mBaseBinormals[i].clear();
- mTexCoords[i].clear();
+ mBaseCoords[i].clear();
+ mBaseNormals[i].clear();
+ mBaseBinormals[i].clear();
+ mTexCoords[i].clear();
mWeights[i] = 0.f;
}
mNumVertices = numVertices;
@@ -409,49 +409,49 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
return FALSE;
}
- allocateVertexData( numVertices );
-
- for (U16 i = 0; i < numVertices; ++i)
- {
- //----------------------------------------------------------------
- // Coords
- //----------------------------------------------------------------
- numRead = fread(&mBaseCoords[i], sizeof(float), 3, fp);
- llendianswizzle(&mBaseCoords[i], sizeof(float), 3);
- if (numRead != 3)
- {
- LL_ERRS() << "can't read Coordinates from " << fileName << LL_ENDL;
- return FALSE;
- }
- }
-
- for (U16 i = 0; i < numVertices; ++i)
- {
- //----------------------------------------------------------------
- // Normals
- //----------------------------------------------------------------
- numRead = fread(&mBaseNormals[i], sizeof(float), 3, fp);
- llendianswizzle(&mBaseNormals[i], sizeof(float), 3);
- if (numRead != 3)
- {
- LL_ERRS() << " can't read Normals from " << fileName << LL_ENDL;
- return FALSE;
- }
- }
-
- for (U16 i = 0; i < numVertices; ++i)
- {
- //----------------------------------------------------------------
- // Binormals
- //----------------------------------------------------------------
- numRead = fread(&mBaseBinormals[i], sizeof(float), 3, fp);
- llendianswizzle(&mBaseBinormals[i], sizeof(float), 3);
- if (numRead != 3)
- {
- LL_ERRS() << " can't read Binormals from " << fileName << LL_ENDL;
- return FALSE;
- }
- }
+ allocateVertexData( numVertices );
+
+ for (U16 i = 0; i < numVertices; ++i)
+ {
+ //----------------------------------------------------------------
+ // Coords
+ //----------------------------------------------------------------
+ numRead = fread(&mBaseCoords[i], sizeof(float), 3, fp);
+ llendianswizzle(&mBaseCoords[i], sizeof(float), 3);
+ if (numRead != 3)
+ {
+ LL_ERRS() << "can't read Coordinates from " << fileName << LL_ENDL;
+ return FALSE;
+ }
+ }
+
+ for (U16 i = 0; i < numVertices; ++i)
+ {
+ //----------------------------------------------------------------
+ // Normals
+ //----------------------------------------------------------------
+ numRead = fread(&mBaseNormals[i], sizeof(float), 3, fp);
+ llendianswizzle(&mBaseNormals[i], sizeof(float), 3);
+ if (numRead != 3)
+ {
+ LL_ERRS() << " can't read Normals from " << fileName << LL_ENDL;
+ return FALSE;
+ }
+ }
+
+ for (U16 i = 0; i < numVertices; ++i)
+ {
+ //----------------------------------------------------------------
+ // Binormals
+ //----------------------------------------------------------------
+ numRead = fread(&mBaseBinormals[i], sizeof(float), 3, fp);
+ llendianswizzle(&mBaseBinormals[i], sizeof(float), 3);
+ if (numRead != 3)
+ {
+ LL_ERRS() << " can't read Binormals from " << fileName << LL_ENDL;
+ return FALSE;
+ }
+ }
//----------------------------------------------------------------
// TexCoords
@@ -528,7 +528,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
llassert(face[1] < mReferenceData->mNumVertices);
llassert(face[2] < mReferenceData->mNumVertices);
}
-
+
if (isLOD())
{
// store largest index in case of LODs
@@ -559,7 +559,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
numTris++;
}
- LL_DEBUGS() << "verts: " << numVertices
+ LL_DEBUGS() << "verts: " << numVertices
<< ", faces: " << numFaces
<< ", tris: " << numTris
<< LL_ENDL;
@@ -636,46 +636,46 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
if (!strcmp(morphName, "Breast_Female_Cleavage"))
{
mMorphData.insert(clone_morph_param_duplicate(morph_data,
- "Breast_Physics_InOut_Driven"));
+ "Breast_Physics_InOut_Driven"));
}
if (!strcmp(morphName, "Breast_Gravity"))
{
mMorphData.insert(clone_morph_param_duplicate(morph_data,
- "Breast_Physics_UpDown_Driven"));
+ "Breast_Physics_UpDown_Driven"));
}
if (!strcmp(morphName, "Big_Belly_Torso"))
{
mMorphData.insert(clone_morph_param_direction(morph_data,
- LLVector3(0,0,0.05f),
- "Belly_Physics_Torso_UpDown_Driven"));
+ LLVector3(0,0,0.05f),
+ "Belly_Physics_Torso_UpDown_Driven"));
}
if (!strcmp(morphName, "Big_Belly_Legs"))
{
mMorphData.insert(clone_morph_param_direction(morph_data,
- LLVector3(0,0,0.05f),
- "Belly_Physics_Legs_UpDown_Driven"));
+ LLVector3(0,0,0.05f),
+ "Belly_Physics_Legs_UpDown_Driven"));
}
if (!strcmp(morphName, "skirt_belly"))
{
mMorphData.insert(clone_morph_param_direction(morph_data,
- LLVector3(0,0,0.05f),
- "Belly_Physics_Skirt_UpDown_Driven"));
+ LLVector3(0,0,0.05f),
+ "Belly_Physics_Skirt_UpDown_Driven"));
}
if (!strcmp(morphName, "Small_Butt"))
{
mMorphData.insert(clone_morph_param_direction(morph_data,
- LLVector3(0,0,0.05f),
- "Butt_Physics_UpDown_Driven"));
+ LLVector3(0,0,0.05f),
+ "Butt_Physics_UpDown_Driven"));
}
if (!strcmp(morphName, "Small_Butt"))
{
mMorphData.insert(clone_morph_param_direction(morph_data,
- LLVector3(0,0.03f,0),
- "Butt_Physics_LeftRight_Driven"));
+ LLVector3(0,0.03f,0),
+ "Butt_Physics_LeftRight_Driven"));
}
}
@@ -750,58 +750,58 @@ const LLVector2 &LLPolyMeshSharedData::getUVs(U32 index)
// LLPolyMesh()
//-----------------------------------------------------------------------------
LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_mesh)
-{
- llassert(shared_data);
-
- mSharedData = shared_data;
- mReferenceMesh = reference_mesh;
- mAvatarp = NULL;
- mVertexData = NULL;
-
- mCurVertexCount = 0;
- mFaceIndexCount = 0;
- mFaceIndexOffset = 0;
- mFaceVertexCount = 0;
- mFaceVertexOffset = 0;
-
- if (shared_data->isLOD() && reference_mesh)
- {
- mCoords = reference_mesh->mCoords;
- mNormals = reference_mesh->mNormals;
- mScaledNormals = reference_mesh->mScaledNormals;
- mBinormals = reference_mesh->mBinormals;
- mScaledBinormals = reference_mesh->mScaledBinormals;
- mTexCoords = reference_mesh->mTexCoords;
- mClothingWeights = reference_mesh->mClothingWeights;
- }
- else
- {
- // Allocate memory without initializing every vector
- // NOTE: This makes asusmptions about the size of LLVector[234]
- S32 nverts = mSharedData->mNumVertices;
- //make sure it's an even number of verts for alignment
- nverts += nverts%2;
- S32 nfloats = nverts * (
- 4 + //coords
- 4 + //normals
- 4 + //weights
- 2 + //coords
- 4 + //scaled normals
- 4 + //binormals
- 4); //scaled binormals
-
- //use 16 byte aligned vertex data to make LLPolyMesh SSE friendly
- mVertexData = (F32*) ll_aligned_malloc_16(nfloats*4);
- S32 offset = 0;
- mCoords = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
- mNormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
- mClothingWeights = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
- mTexCoords = (LLVector2*)(mVertexData + offset); offset += 2*nverts;
- mScaledNormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
- mBinormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
- mScaledBinormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
- initializeForMorph();
- }
+{
+ llassert(shared_data);
+
+ mSharedData = shared_data;
+ mReferenceMesh = reference_mesh;
+ mAvatarp = NULL;
+ mVertexData = NULL;
+
+ mCurVertexCount = 0;
+ mFaceIndexCount = 0;
+ mFaceIndexOffset = 0;
+ mFaceVertexCount = 0;
+ mFaceVertexOffset = 0;
+
+ if (shared_data->isLOD() && reference_mesh)
+ {
+ mCoords = reference_mesh->mCoords;
+ mNormals = reference_mesh->mNormals;
+ mScaledNormals = reference_mesh->mScaledNormals;
+ mBinormals = reference_mesh->mBinormals;
+ mScaledBinormals = reference_mesh->mScaledBinormals;
+ mTexCoords = reference_mesh->mTexCoords;
+ mClothingWeights = reference_mesh->mClothingWeights;
+ }
+ else
+ {
+ // Allocate memory without initializing every vector
+ // NOTE: This makes asusmptions about the size of LLVector[234]
+ S32 nverts = mSharedData->mNumVertices;
+ //make sure it's an even number of verts for alignment
+ nverts += nverts%2;
+ S32 nfloats = nverts * (
+ 4 + //coords
+ 4 + //normals
+ 4 + //weights
+ 2 + //coords
+ 4 + //scaled normals
+ 4 + //binormals
+ 4); //scaled binormals
+
+ //use 16 byte aligned vertex data to make LLPolyMesh SSE friendly
+ mVertexData = (F32*) ll_aligned_malloc_16(nfloats*4);
+ S32 offset = 0;
+ mCoords = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
+ mNormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
+ mClothingWeights = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
+ mTexCoords = (LLVector2*)(mVertexData + offset); offset += 2*nverts;
+ mScaledNormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
+ mBinormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
+ mScaledBinormals = (LLVector4a*)(mVertexData + offset); offset += 4*nverts;
+ initializeForMorph();
+ }
}
@@ -810,8 +810,8 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_
//-----------------------------------------------------------------------------
LLPolyMesh::~LLPolyMesh()
{
- delete_and_clear(mJointRenderData);
- ll_aligned_free_16(mVertexData);
+ delete_and_clear(mJointRenderData);
+ ll_aligned_free_16(mVertexData);
}
@@ -977,16 +977,16 @@ LLVector4a *LLPolyMesh::getScaledBinormals()
void LLPolyMesh::initializeForMorph()
{
LLVector4a::memcpyNonAliased16((F32*) mCoords, (F32*) mSharedData->mBaseCoords, sizeof(LLVector4a) * mSharedData->mNumVertices);
- LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
- LLVector4a::memcpyNonAliased16((F32*) mScaledNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
- LLVector4a::memcpyNonAliased16((F32*) mBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
- LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
- LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2));
-
- for (U32 i = 0; i < mSharedData->mNumVertices; ++i)
- {
- mClothingWeights[i].clear();
- }
+ LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
+ LLVector4a::memcpyNonAliased16((F32*) mScaledNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
+ LLVector4a::memcpyNonAliased16((F32*) mBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
+ LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
+ LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2));
+
+ for (U32 i = 0; i < mSharedData->mNumVertices; ++i)
+ {
+ mClothingWeights[i].clear();
+ }
}
//-----------------------------------------------------------------------------
diff --git a/indra/llappearance/llpolymesh.h b/indra/llappearance/llpolymesh.h
index 83659d9514..b8906e378f 100644
--- a/indra/llappearance/llpolymesh.h
+++ b/indra/llappearance/llpolymesh.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpolymesh.h
* @brief Implementation of LLPolyMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,7 +41,7 @@ class LLSkinJoint;
class LLAvatarAppearance;
class LLWearable;
-//#define USE_STRIPS // Use tri-strips for rendering.
+//#define USE_STRIPS // Use tri-strips for rendering.
//-----------------------------------------------------------------------------
// LLPolyFace
@@ -63,305 +63,305 @@ class LLPolyMorphTarget;
class LLPolyMeshSharedData
{
- friend class LLPolyMesh;
+ friend class LLPolyMesh;
private:
- // transform data
- LLVector3 mPosition;
- LLQuaternion mRotation;
- LLVector3 mScale;
-
- // vertex data
- S32 mNumVertices;
- LLVector4a *mBaseCoords;
- LLVector4a *mBaseNormals;
- LLVector4a *mBaseBinormals;
- LLVector2 *mTexCoords;
- LLVector2 *mDetailTexCoords;
- F32 *mWeights;
-
- BOOL mHasWeights;
- BOOL mHasDetailTexCoords;
-
- // face data
- S32 mNumFaces;
- LLPolyFace *mFaces;
-
- // face set data
- U32 mNumJointNames;
- std::string* mJointNames;
-
- // morph targets
- typedef std::set<LLPolyMorphData*> morphdata_list_t;
- morphdata_list_t mMorphData;
-
- std::map<S32, S32> mSharedVerts;
-
- LLPolyMeshSharedData* mReferenceData;
- S32 mLastIndexOffset;
+ // transform data
+ LLVector3 mPosition;
+ LLQuaternion mRotation;
+ LLVector3 mScale;
+
+ // vertex data
+ S32 mNumVertices;
+ LLVector4a *mBaseCoords;
+ LLVector4a *mBaseNormals;
+ LLVector4a *mBaseBinormals;
+ LLVector2 *mTexCoords;
+ LLVector2 *mDetailTexCoords;
+ F32 *mWeights;
+
+ BOOL mHasWeights;
+ BOOL mHasDetailTexCoords;
+
+ // face data
+ S32 mNumFaces;
+ LLPolyFace *mFaces;
+
+ // face set data
+ U32 mNumJointNames;
+ std::string* mJointNames;
+
+ // morph targets
+ typedef std::set<LLPolyMorphData*> morphdata_list_t;
+ morphdata_list_t mMorphData;
+
+ std::map<S32, S32> mSharedVerts;
+
+ LLPolyMeshSharedData* mReferenceData;
+ S32 mLastIndexOffset;
public:
- // Temporarily...
- // Triangle indices
- U32 mNumTriangleIndices;
- U32 *mTriangleIndices;
+ // Temporarily...
+ // Triangle indices
+ U32 mNumTriangleIndices;
+ U32 *mTriangleIndices;
public:
- LLPolyMeshSharedData();
- ~LLPolyMeshSharedData();
+ LLPolyMeshSharedData();
+ ~LLPolyMeshSharedData();
private:
- void setupLOD(LLPolyMeshSharedData* reference_data);
+ void setupLOD(LLPolyMeshSharedData* reference_data);
- // Frees all mesh memory resources
- void freeMeshData();
+ // Frees all mesh memory resources
+ void freeMeshData();
- void setPosition( const LLVector3 &pos ) { mPosition = pos; }
- void setRotation( const LLQuaternion &rot ) { mRotation = rot; }
- void setScale( const LLVector3 &scale ) { mScale = scale; }
+ void setPosition( const LLVector3 &pos ) { mPosition = pos; }
+ void setRotation( const LLQuaternion &rot ) { mRotation = rot; }
+ void setScale( const LLVector3 &scale ) { mScale = scale; }
- BOOL allocateVertexData( U32 numVertices );
+ BOOL allocateVertexData( U32 numVertices );
- BOOL allocateFaceData( U32 numFaces );
+ BOOL allocateFaceData( U32 numFaces );
- BOOL allocateJointNames( U32 numJointNames );
+ BOOL allocateJointNames( U32 numJointNames );
- // Retrieve the number of KB of memory used by this instance
- U32 getNumKB();
+ // Retrieve the number of KB of memory used by this instance
+ U32 getNumKB();
- // Load mesh data from file
- BOOL loadMesh( const std::string& fileName );
+ // Load mesh data from file
+ BOOL loadMesh( const std::string& fileName );
public:
- void genIndices(S32 offset);
+ void genIndices(S32 offset);
- const LLVector2 &getUVs(U32 index);
+ const LLVector2 &getUVs(U32 index);
- const S32 *getSharedVert(S32 vert);
+ const S32 *getSharedVert(S32 vert);
- BOOL isLOD() { return (mReferenceData != NULL); }
+ BOOL isLOD() { return (mReferenceData != NULL); }
};
class LLJointRenderData
{
public:
- LLJointRenderData(const LLMatrix4* world_matrix, LLSkinJoint* skin_joint) : mWorldMatrix(world_matrix), mSkinJoint(skin_joint) {}
- ~LLJointRenderData(){}
+ LLJointRenderData(const LLMatrix4* world_matrix, LLSkinJoint* skin_joint) : mWorldMatrix(world_matrix), mSkinJoint(skin_joint) {}
+ ~LLJointRenderData(){}
- const LLMatrix4* mWorldMatrix;
- LLSkinJoint* mSkinJoint;
+ const LLMatrix4* mWorldMatrix;
+ LLSkinJoint* mSkinJoint;
};
class LLPolyMesh
{
public:
-
- // Constructor
- LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_mesh);
-
- // Destructor
- ~LLPolyMesh();
-
- // Requests a mesh by name.
- // If the mesh already exists in the global mesh table, it is returned,
- // otherwise it is loaded from file, added to the table, and returned.
- static LLPolyMesh *getMesh( const std::string &name, LLPolyMesh* reference_mesh = NULL);
-
- // Frees all loaded meshes.
- // This should only be called once you know there are no outstanding
- // references to these objects. Generally, upon exit of the application.
- static void freeAllMeshes();
-
- //--------------------------------------------------------------------
- // Transform Data Access
- //--------------------------------------------------------------------
- // Get position
- const LLVector3 &getPosition() {
- llassert (mSharedData);
- return mSharedData->mPosition;
- }
-
- // Get rotation
- const LLQuaternion &getRotation() {
- llassert (mSharedData);
- return mSharedData->mRotation;
- }
-
- // Get scale
- const LLVector3 &getScale() {
- llassert (mSharedData);
- return mSharedData->mScale;
- }
-
- //--------------------------------------------------------------------
- // Vertex Data Access
- //--------------------------------------------------------------------
- // Get number of vertices
- U32 getNumVertices() {
- llassert (mSharedData);
- return mSharedData->mNumVertices;
- }
-
- // Returns whether or not the mesh has detail texture coords
- BOOL hasDetailTexCoords() {
- llassert (mSharedData);
- return mSharedData->mHasDetailTexCoords;
- }
-
- // Returns whether or not the mesh has vertex weights
- BOOL hasWeights() const{
- llassert (mSharedData);
- return mSharedData->mHasWeights;
- }
-
- // Get coords
- const LLVector4a *getCoords() const{
- return mCoords;
- }
-
- // non const version
- LLVector4a *getWritableCoords();
-
- // Get normals
- const LLVector4a *getNormals() const{
- return mNormals;
- }
-
- // Get normals
- const LLVector4a *getBinormals() const{
- return mBinormals;
- }
-
- // Get base mesh normals
- const LLVector4a *getBaseNormals() const{
- llassert(mSharedData);
- return mSharedData->mBaseNormals;
- }
-
- // Get base mesh normals
- const LLVector4a *getBaseBinormals() const{
- llassert(mSharedData);
- return mSharedData->mBaseBinormals;
- }
-
- // intermediate morphed normals and output normals
- LLVector4a *getWritableNormals();
- LLVector4a *getScaledNormals();
-
- LLVector4a *getWritableBinormals();
- LLVector4a *getScaledBinormals();
-
- // Get texCoords
- const LLVector2 *getTexCoords() const {
- return mTexCoords;
- }
-
- // non const version
- LLVector2 *getWritableTexCoords();
-
- // Get detailTexCoords
- const LLVector2 *getDetailTexCoords() const {
- llassert (mSharedData);
- return mSharedData->mDetailTexCoords;
- }
-
- // Get weights
- const F32 *getWeights() const {
- llassert (mSharedData);
- return mSharedData->mWeights;
- }
-
- F32 *getWritableWeights() const;
-
- LLVector4a *getWritableClothingWeights();
-
- const LLVector4a *getClothingWeights()
- {
- return mClothingWeights;
- }
-
- //--------------------------------------------------------------------
- // Face Data Access
- //--------------------------------------------------------------------
- // Get number of faces
- S32 getNumFaces() {
- llassert (mSharedData);
- return mSharedData->mNumFaces;
- }
-
- // Get faces
- LLPolyFace *getFaces() {
- llassert (mSharedData);
- return mSharedData->mFaces;
- }
-
- U32 getNumJointNames() {
- llassert (mSharedData);
- return mSharedData->mNumJointNames;
- }
-
- std::string *getJointNames() {
- llassert (mSharedData);
- return mSharedData->mJointNames;
- }
-
- LLPolyMorphData* getMorphData(const std::string& morph_name);
-// void removeMorphData(LLPolyMorphData *morph_target);
-// void deleteAllMorphData();
-
- LLPolyMeshSharedData *getSharedData() const;
- LLPolyMesh *getReferenceMesh() { return mReferenceMesh ? mReferenceMesh : this; }
-
- // Get indices
- U32* getIndices() { return mSharedData ? mSharedData->mTriangleIndices : NULL; }
-
- BOOL isLOD() { return mSharedData && mSharedData->isLOD(); }
-
- void setAvatar(LLAvatarAppearance* avatarp) { mAvatarp = avatarp; }
- LLAvatarAppearance* getAvatar() { return mAvatarp; }
-
- std::vector<LLJointRenderData*> mJointRenderData;
-
- U32 mFaceVertexOffset;
- U32 mFaceVertexCount;
- U32 mFaceIndexOffset;
- U32 mFaceIndexCount;
- U32 mCurVertexCount;
+
+ // Constructor
+ LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_mesh);
+
+ // Destructor
+ ~LLPolyMesh();
+
+ // Requests a mesh by name.
+ // If the mesh already exists in the global mesh table, it is returned,
+ // otherwise it is loaded from file, added to the table, and returned.
+ static LLPolyMesh *getMesh( const std::string &name, LLPolyMesh* reference_mesh = NULL);
+
+ // Frees all loaded meshes.
+ // This should only be called once you know there are no outstanding
+ // references to these objects. Generally, upon exit of the application.
+ static void freeAllMeshes();
+
+ //--------------------------------------------------------------------
+ // Transform Data Access
+ //--------------------------------------------------------------------
+ // Get position
+ const LLVector3 &getPosition() {
+ llassert (mSharedData);
+ return mSharedData->mPosition;
+ }
+
+ // Get rotation
+ const LLQuaternion &getRotation() {
+ llassert (mSharedData);
+ return mSharedData->mRotation;
+ }
+
+ // Get scale
+ const LLVector3 &getScale() {
+ llassert (mSharedData);
+ return mSharedData->mScale;
+ }
+
+ //--------------------------------------------------------------------
+ // Vertex Data Access
+ //--------------------------------------------------------------------
+ // Get number of vertices
+ U32 getNumVertices() {
+ llassert (mSharedData);
+ return mSharedData->mNumVertices;
+ }
+
+ // Returns whether or not the mesh has detail texture coords
+ BOOL hasDetailTexCoords() {
+ llassert (mSharedData);
+ return mSharedData->mHasDetailTexCoords;
+ }
+
+ // Returns whether or not the mesh has vertex weights
+ BOOL hasWeights() const{
+ llassert (mSharedData);
+ return mSharedData->mHasWeights;
+ }
+
+ // Get coords
+ const LLVector4a *getCoords() const{
+ return mCoords;
+ }
+
+ // non const version
+ LLVector4a *getWritableCoords();
+
+ // Get normals
+ const LLVector4a *getNormals() const{
+ return mNormals;
+ }
+
+ // Get normals
+ const LLVector4a *getBinormals() const{
+ return mBinormals;
+ }
+
+ // Get base mesh normals
+ const LLVector4a *getBaseNormals() const{
+ llassert(mSharedData);
+ return mSharedData->mBaseNormals;
+ }
+
+ // Get base mesh normals
+ const LLVector4a *getBaseBinormals() const{
+ llassert(mSharedData);
+ return mSharedData->mBaseBinormals;
+ }
+
+ // intermediate morphed normals and output normals
+ LLVector4a *getWritableNormals();
+ LLVector4a *getScaledNormals();
+
+ LLVector4a *getWritableBinormals();
+ LLVector4a *getScaledBinormals();
+
+ // Get texCoords
+ const LLVector2 *getTexCoords() const {
+ return mTexCoords;
+ }
+
+ // non const version
+ LLVector2 *getWritableTexCoords();
+
+ // Get detailTexCoords
+ const LLVector2 *getDetailTexCoords() const {
+ llassert (mSharedData);
+ return mSharedData->mDetailTexCoords;
+ }
+
+ // Get weights
+ const F32 *getWeights() const {
+ llassert (mSharedData);
+ return mSharedData->mWeights;
+ }
+
+ F32 *getWritableWeights() const;
+
+ LLVector4a *getWritableClothingWeights();
+
+ const LLVector4a *getClothingWeights()
+ {
+ return mClothingWeights;
+ }
+
+ //--------------------------------------------------------------------
+ // Face Data Access
+ //--------------------------------------------------------------------
+ // Get number of faces
+ S32 getNumFaces() {
+ llassert (mSharedData);
+ return mSharedData->mNumFaces;
+ }
+
+ // Get faces
+ LLPolyFace *getFaces() {
+ llassert (mSharedData);
+ return mSharedData->mFaces;
+ }
+
+ U32 getNumJointNames() {
+ llassert (mSharedData);
+ return mSharedData->mNumJointNames;
+ }
+
+ std::string *getJointNames() {
+ llassert (mSharedData);
+ return mSharedData->mJointNames;
+ }
+
+ LLPolyMorphData* getMorphData(const std::string& morph_name);
+// void removeMorphData(LLPolyMorphData *morph_target);
+// void deleteAllMorphData();
+
+ LLPolyMeshSharedData *getSharedData() const;
+ LLPolyMesh *getReferenceMesh() { return mReferenceMesh ? mReferenceMesh : this; }
+
+ // Get indices
+ U32* getIndices() { return mSharedData ? mSharedData->mTriangleIndices : NULL; }
+
+ BOOL isLOD() { return mSharedData && mSharedData->isLOD(); }
+
+ void setAvatar(LLAvatarAppearance* avatarp) { mAvatarp = avatarp; }
+ LLAvatarAppearance* getAvatar() { return mAvatarp; }
+
+ std::vector<LLJointRenderData*> mJointRenderData;
+
+ U32 mFaceVertexOffset;
+ U32 mFaceVertexCount;
+ U32 mFaceIndexOffset;
+ U32 mFaceIndexCount;
+ U32 mCurVertexCount;
private:
- void initializeForMorph();
+ void initializeForMorph();
- // Dumps diagnostic information about the global mesh table
- static void dumpDiagInfo();
+ // Dumps diagnostic information about the global mesh table
+ static void dumpDiagInfo();
protected:
- // mesh data shared across all instances of a given mesh
- LLPolyMeshSharedData *mSharedData;
- // Single array of floats for allocation / deletion
- F32 *mVertexData;
- // deformed vertices (resulting from application of morph targets)
- LLVector4a *mCoords;
- // deformed normals (resulting from application of morph targets)
- LLVector4a *mScaledNormals;
- // output normals (after normalization)
- LLVector4a *mNormals;
- // deformed binormals (resulting from application of morph targets)
- LLVector4a *mScaledBinormals;
- // output binormals (after normalization)
- LLVector4a *mBinormals;
- // weight values that mark verts as clothing/skin
- LLVector4a *mClothingWeights;
- // output texture coordinates
- LLVector2 *mTexCoords;
-
- LLPolyMesh *mReferenceMesh;
-
- // global mesh list
- typedef std::map<std::string, LLPolyMeshSharedData*> LLPolyMeshSharedDataTable;
- static LLPolyMeshSharedDataTable sGlobalSharedMeshList;
-
- // Backlink only; don't make this an LLPointer.
- LLAvatarAppearance* mAvatarp;
+ // mesh data shared across all instances of a given mesh
+ LLPolyMeshSharedData *mSharedData;
+ // Single array of floats for allocation / deletion
+ F32 *mVertexData;
+ // deformed vertices (resulting from application of morph targets)
+ LLVector4a *mCoords;
+ // deformed normals (resulting from application of morph targets)
+ LLVector4a *mScaledNormals;
+ // output normals (after normalization)
+ LLVector4a *mNormals;
+ // deformed binormals (resulting from application of morph targets)
+ LLVector4a *mScaledBinormals;
+ // output binormals (after normalization)
+ LLVector4a *mBinormals;
+ // weight values that mark verts as clothing/skin
+ LLVector4a *mClothingWeights;
+ // output texture coordinates
+ LLVector2 *mTexCoords;
+
+ LLPolyMesh *mReferenceMesh;
+
+ // global mesh list
+ typedef std::map<std::string, LLPolyMeshSharedData*> LLPolyMeshSharedDataTable;
+ static LLPolyMeshSharedDataTable sGlobalSharedMeshList;
+
+ // Backlink only; don't make this an LLPointer.
+ LLAvatarAppearance* mAvatarp;
};
#endif // LL_LLPOLYMESHINTERFACE_H
diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp
index 965b999bd4..c780778c7b 100644
--- a/indra/llappearance/llpolymorph.cpp
+++ b/indra/llappearance/llpolymorph.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpolymorph.cpp
* @brief Implementation of LLPolyMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,52 +45,52 @@ const F32 NORMAL_SOFTEN_FACTOR = 0.65f;
// LLPolyMorphData()
//-----------------------------------------------------------------------------
LLPolyMorphData::LLPolyMorphData(const std::string& morph_name)
- : mName(morph_name)
+ : mName(morph_name)
{
- mNumIndices = 0;
- mCurrentIndex = 0;
- mTotalDistortion = 0.f;
- mAvgDistortion.clear();
- mMaxDistortion = 0.f;
- mVertexIndices = NULL;
- mCoords = NULL;
- mNormals = NULL;
- mBinormals = NULL;
- mTexCoords = NULL;
-
- mMesh = NULL;
+ mNumIndices = 0;
+ mCurrentIndex = 0;
+ mTotalDistortion = 0.f;
+ mAvgDistortion.clear();
+ mMaxDistortion = 0.f;
+ mVertexIndices = NULL;
+ mCoords = NULL;
+ mNormals = NULL;
+ mBinormals = NULL;
+ mTexCoords = NULL;
+
+ mMesh = NULL;
}
LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
- mName(rhs.mName),
- mNumIndices(rhs.mNumIndices),
- mTotalDistortion(rhs.mTotalDistortion),
- mAvgDistortion(rhs.mAvgDistortion),
- mMaxDistortion(rhs.mMaxDistortion),
- mVertexIndices(NULL),
- mCoords(NULL),
- mNormals(NULL),
- mBinormals(NULL),
- mTexCoords(NULL)
+ mName(rhs.mName),
+ mNumIndices(rhs.mNumIndices),
+ mTotalDistortion(rhs.mTotalDistortion),
+ mAvgDistortion(rhs.mAvgDistortion),
+ mMaxDistortion(rhs.mMaxDistortion),
+ mVertexIndices(NULL),
+ mCoords(NULL),
+ mNormals(NULL),
+ mBinormals(NULL),
+ mTexCoords(NULL)
{
- const S32 numVertices = mNumIndices;
-
- U32 size = sizeof(LLVector4a)*numVertices;
-
- mCoords = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
- mNormals = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
- mBinormals = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
- mTexCoords = new LLVector2[numVertices];
- mVertexIndices = new U32[numVertices];
-
- for (S32 v=0; v < numVertices; v++)
- {
- mCoords[v] = rhs.mCoords[v];
- mNormals[v] = rhs.mNormals[v];
- mBinormals[v] = rhs.mBinormals[v];
- mTexCoords[v] = rhs.mTexCoords[v];
- mVertexIndices[v] = rhs.mVertexIndices[v];
- }
+ const S32 numVertices = mNumIndices;
+
+ U32 size = sizeof(LLVector4a)*numVertices;
+
+ mCoords = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
+ mNormals = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
+ mBinormals = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
+ mTexCoords = new LLVector2[numVertices];
+ mVertexIndices = new U32[numVertices];
+
+ for (S32 v=0; v < numVertices; v++)
+ {
+ mCoords[v] = rhs.mCoords[v];
+ mNormals[v] = rhs.mNormals[v];
+ mBinormals[v] = rhs.mBinormals[v];
+ mTexCoords[v] = rhs.mTexCoords[v];
+ mVertexIndices[v] = rhs.mVertexIndices[v];
+ }
}
//-----------------------------------------------------------------------------
@@ -98,7 +98,7 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
//-----------------------------------------------------------------------------
LLPolyMorphData::~LLPolyMorphData()
{
- freeData();
+ freeData();
}
//-----------------------------------------------------------------------------
@@ -106,114 +106,114 @@ LLPolyMorphData::~LLPolyMorphData()
//-----------------------------------------------------------------------------
BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
{
- S32 numVertices;
- S32 numRead;
-
- numRead = fread(&numVertices, sizeof(S32), 1, fp);
- llendianswizzle(&numVertices, sizeof(S32), 1);
- if (numRead != 1)
- {
- LL_WARNS() << "Can't read number of morph target vertices" << LL_ENDL;
- return FALSE;
- }
-
- //-------------------------------------------------------------------------
- // free any existing data
- //-------------------------------------------------------------------------
- freeData();
-
- //-------------------------------------------------------------------------
- // allocate vertices
- //-------------------------------------------------------------------------
-
- U32 size = sizeof(LLVector4a)*numVertices;
-
- mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
- mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
- mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
-
- mTexCoords = new LLVector2[numVertices];
- // Actually, we are allocating more space than we need for the skiplist
- mVertexIndices = new U32[numVertices];
- mNumIndices = 0;
- mTotalDistortion = 0.f;
- mMaxDistortion = 0.f;
- mAvgDistortion.clear();
- mMesh = mesh;
-
- //-------------------------------------------------------------------------
- // read vertices
- //-------------------------------------------------------------------------
- for(S32 v = 0; v < numVertices; v++)
- {
- numRead = fread(&mVertexIndices[v], sizeof(U32), 1, fp);
- llendianswizzle(&mVertexIndices[v], sizeof(U32), 1);
- if (numRead != 1)
- {
- LL_WARNS() << "Can't read morph target vertex number" << LL_ENDL;
- return FALSE;
- }
-
- if (mVertexIndices[v] > 10000)
- {
+ S32 numVertices;
+ S32 numRead;
+
+ numRead = fread(&numVertices, sizeof(S32), 1, fp);
+ llendianswizzle(&numVertices, sizeof(S32), 1);
+ if (numRead != 1)
+ {
+ LL_WARNS() << "Can't read number of morph target vertices" << LL_ENDL;
+ return FALSE;
+ }
+
+ //-------------------------------------------------------------------------
+ // free any existing data
+ //-------------------------------------------------------------------------
+ freeData();
+
+ //-------------------------------------------------------------------------
+ // allocate vertices
+ //-------------------------------------------------------------------------
+
+ U32 size = sizeof(LLVector4a)*numVertices;
+
+ mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
+ mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
+ mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
+
+ mTexCoords = new LLVector2[numVertices];
+ // Actually, we are allocating more space than we need for the skiplist
+ mVertexIndices = new U32[numVertices];
+ mNumIndices = 0;
+ mTotalDistortion = 0.f;
+ mMaxDistortion = 0.f;
+ mAvgDistortion.clear();
+ mMesh = mesh;
+
+ //-------------------------------------------------------------------------
+ // read vertices
+ //-------------------------------------------------------------------------
+ for(S32 v = 0; v < numVertices; v++)
+ {
+ numRead = fread(&mVertexIndices[v], sizeof(U32), 1, fp);
+ llendianswizzle(&mVertexIndices[v], sizeof(U32), 1);
+ if (numRead != 1)
+ {
+ LL_WARNS() << "Can't read morph target vertex number" << LL_ENDL;
+ return FALSE;
+ }
+
+ if (mVertexIndices[v] > 10000)
+ {
// Bad install? These are usually .llm files from 'character' fodler
- LL_WARNS() << "Bad morph index " << v << ": " << mVertexIndices[v] << LL_ENDL;
+ LL_WARNS() << "Bad morph index " << v << ": " << mVertexIndices[v] << LL_ENDL;
return FALSE;
- }
-
-
- numRead = fread(&mCoords[v], sizeof(F32), 3, fp);
- llendianswizzle(&mCoords[v], sizeof(F32), 3);
- if (numRead != 3)
- {
- LL_WARNS() << "Can't read morph target vertex coordinates" << LL_ENDL;
- return FALSE;
- }
-
- F32 magnitude = mCoords[v].getLength3().getF32();
-
- mTotalDistortion += magnitude;
- LLVector4a t;
- t.setAbs(mCoords[v]);
- mAvgDistortion.add(t);
-
- if (magnitude > mMaxDistortion)
- {
- mMaxDistortion = magnitude;
- }
-
- numRead = fread(&mNormals[v], sizeof(F32), 3, fp);
- llendianswizzle(&mNormals[v], sizeof(F32), 3);
- if (numRead != 3)
- {
- LL_WARNS() << "Can't read morph target normal" << LL_ENDL;
- return FALSE;
- }
-
- numRead = fread(&mBinormals[v], sizeof(F32), 3, fp);
- llendianswizzle(&mBinormals[v], sizeof(F32), 3);
- if (numRead != 3)
- {
- LL_WARNS() << "Can't read morph target binormal" << LL_ENDL;
- return FALSE;
- }
-
-
- numRead = fread(&mTexCoords[v].mV, sizeof(F32), 2, fp);
- llendianswizzle(&mTexCoords[v].mV, sizeof(F32), 2);
- if (numRead != 2)
- {
- LL_WARNS() << "Can't read morph target uv" << LL_ENDL;
- return FALSE;
- }
-
- mNumIndices++;
- }
-
- mAvgDistortion.mul(1.f/(F32)mNumIndices);
- mAvgDistortion.normalize3fast();
-
- return TRUE;
+ }
+
+
+ numRead = fread(&mCoords[v], sizeof(F32), 3, fp);
+ llendianswizzle(&mCoords[v], sizeof(F32), 3);
+ if (numRead != 3)
+ {
+ LL_WARNS() << "Can't read morph target vertex coordinates" << LL_ENDL;
+ return FALSE;
+ }
+
+ F32 magnitude = mCoords[v].getLength3().getF32();
+
+ mTotalDistortion += magnitude;
+ LLVector4a t;
+ t.setAbs(mCoords[v]);
+ mAvgDistortion.add(t);
+
+ if (magnitude > mMaxDistortion)
+ {
+ mMaxDistortion = magnitude;
+ }
+
+ numRead = fread(&mNormals[v], sizeof(F32), 3, fp);
+ llendianswizzle(&mNormals[v], sizeof(F32), 3);
+ if (numRead != 3)
+ {
+ LL_WARNS() << "Can't read morph target normal" << LL_ENDL;
+ return FALSE;
+ }
+
+ numRead = fread(&mBinormals[v], sizeof(F32), 3, fp);
+ llendianswizzle(&mBinormals[v], sizeof(F32), 3);
+ if (numRead != 3)
+ {
+ LL_WARNS() << "Can't read morph target binormal" << LL_ENDL;
+ return FALSE;
+ }
+
+
+ numRead = fread(&mTexCoords[v].mV, sizeof(F32), 2, fp);
+ llendianswizzle(&mTexCoords[v].mV, sizeof(F32), 2);
+ if (numRead != 2)
+ {
+ LL_WARNS() << "Can't read morph target uv" << LL_ENDL;
+ return FALSE;
+ }
+
+ mNumIndices++;
+ }
+
+ mAvgDistortion.mul(1.f/(F32)mNumIndices);
+ mAvgDistortion.normalize3fast();
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
@@ -221,64 +221,64 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
//-----------------------------------------------------------------------------
void LLPolyMorphData::freeData()
{
- if (mCoords != NULL)
- {
- ll_aligned_free_16(mCoords);
- mCoords = NULL;
- }
-
- if (mNormals != NULL)
- {
- ll_aligned_free_16(mNormals);
- mNormals = NULL;
- }
-
- if (mBinormals != NULL)
- {
- ll_aligned_free_16(mBinormals);
- mBinormals = NULL;
- }
-
- if (mTexCoords != NULL)
- {
- delete [] mTexCoords;
- mTexCoords = NULL;
- }
-
- if (mVertexIndices != NULL)
- {
- delete [] mVertexIndices;
- mVertexIndices = NULL;
- }
+ if (mCoords != NULL)
+ {
+ ll_aligned_free_16(mCoords);
+ mCoords = NULL;
+ }
+
+ if (mNormals != NULL)
+ {
+ ll_aligned_free_16(mNormals);
+ mNormals = NULL;
+ }
+
+ if (mBinormals != NULL)
+ {
+ ll_aligned_free_16(mBinormals);
+ mBinormals = NULL;
+ }
+
+ if (mTexCoords != NULL)
+ {
+ delete [] mTexCoords;
+ mTexCoords = NULL;
+ }
+
+ if (mVertexIndices != NULL)
+ {
+ delete [] mVertexIndices;
+ mVertexIndices = NULL;
+ }
}
//-----------------------------------------------------------------------------
// LLPolyMorphTargetInfo()
//-----------------------------------------------------------------------------
LLPolyMorphTargetInfo::LLPolyMorphTargetInfo()
- : mIsClothingMorph(FALSE)
+ : mIsClothingMorph(FALSE)
{
}
BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node)
{
- llassert( node->hasName( "param" ) && node->getChildByName( "param_morph" ) );
+ llassert( node->hasName( "param" ) && node->getChildByName( "param_morph" ) );
- if (!LLViewerVisualParamInfo::parseXml(node))
- return FALSE;
+ if (!LLViewerVisualParamInfo::parseXml(node))
+ return FALSE;
- // Get mixed-case name
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- if( !node->getFastAttributeString( name_string, mMorphName ) )
- {
- LL_WARNS() << "Avatar file: <param> is missing name attribute" << LL_ENDL;
- return FALSE; // Continue, ignoring this tag
- }
+ // Get mixed-case name
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ if( !node->getFastAttributeString( name_string, mMorphName ) )
+ {
+ LL_WARNS() << "Avatar file: <param> is missing name attribute" << LL_ENDL;
+ return FALSE; // Continue, ignoring this tag
+ }
- static LLStdStringHandle clothing_morph_string = LLXmlTree::addAttributeString("clothing_morph");
- node->getFastAttributeBOOL(clothing_morph_string, mIsClothingMorph);
+ static LLStdStringHandle clothing_morph_string = LLXmlTree::addAttributeString("clothing_morph");
+ node->getFastAttributeBOOL(clothing_morph_string, mIsClothingMorph);
- LLXmlTreeNode *paramNode = node->getChildByName("param_morph");
+ LLXmlTreeNode *paramNode = node->getChildByName("param_morph");
if (NULL == paramNode)
{
@@ -287,43 +287,43 @@ BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node)
return FALSE;
}
- for (LLXmlTreeNode* child_node = paramNode->getFirstChild();
- child_node;
- child_node = paramNode->getNextChild())
- {
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- if (child_node->hasName("volume_morph"))
- {
- std::string volume_name;
- if (child_node->getFastAttributeString(name_string, volume_name))
- {
- LLVector3 scale;
- static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
- child_node->getFastAttributeVector3(scale_string, scale);
-
- LLVector3 pos;
- static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos");
- child_node->getFastAttributeVector3(pos_string, pos);
-
- mVolumeInfoList.push_back(LLPolyVolumeMorphInfo(volume_name,scale,pos));
- }
- }
- }
-
- return TRUE;
+ for (LLXmlTreeNode* child_node = paramNode->getFirstChild();
+ child_node;
+ child_node = paramNode->getNextChild())
+ {
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ if (child_node->hasName("volume_morph"))
+ {
+ std::string volume_name;
+ if (child_node->getFastAttributeString(name_string, volume_name))
+ {
+ LLVector3 scale;
+ static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
+ child_node->getFastAttributeVector3(scale_string, scale);
+
+ LLVector3 pos;
+ static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos");
+ child_node->getFastAttributeVector3(pos_string, pos);
+
+ mVolumeInfoList.push_back(LLPolyVolumeMorphInfo(volume_name,scale,pos));
+ }
+ }
+ }
+
+ return TRUE;
}
//-----------------------------------------------------------------------------
// LLPolyMorphTarget()
//-----------------------------------------------------------------------------
LLPolyMorphTarget::LLPolyMorphTarget(LLPolyMesh *poly_mesh)
- : LLViewerVisualParam(),
- mMorphData(NULL),
- mMesh(poly_mesh),
- mVertMask(NULL),
- mLastSex(SEX_FEMALE),
- mNumMorphMasksPending(0),
- mVolumeMorphs()
+ : LLViewerVisualParam(),
+ mMorphData(NULL),
+ mMesh(poly_mesh),
+ mVertMask(NULL),
+ mLastSex(SEX_FEMALE),
+ mNumMorphMasksPending(0),
+ mVolumeMorphs()
{
}
@@ -331,13 +331,13 @@ LLPolyMorphTarget::LLPolyMorphTarget(LLPolyMesh *poly_mesh)
// LLPolyMorphTarget()
//-----------------------------------------------------------------------------
LLPolyMorphTarget::LLPolyMorphTarget(const LLPolyMorphTarget& pOther)
- : LLViewerVisualParam(pOther),
- mMorphData(pOther.mMorphData),
- mMesh(pOther.mMesh),
- mVertMask(pOther.mVertMask == NULL ? NULL : new LLPolyVertexMask(*pOther.mVertMask)),
- mLastSex(pOther.mLastSex),
- mNumMorphMasksPending(pOther.mNumMorphMasksPending),
- mVolumeMorphs(pOther.mVolumeMorphs)
+ : LLViewerVisualParam(pOther),
+ mMorphData(pOther.mMorphData),
+ mMesh(pOther.mMesh),
+ mVertMask(pOther.mVertMask == NULL ? NULL : new LLPolyVertexMask(*pOther.mVertMask)),
+ mLastSex(pOther.mLastSex),
+ mNumMorphMasksPending(pOther.mNumMorphMasksPending),
+ mVolumeMorphs(pOther.mVolumeMorphs)
{
}
@@ -346,8 +346,8 @@ LLPolyMorphTarget::LLPolyMorphTarget(const LLPolyMorphTarget& pOther)
//-----------------------------------------------------------------------------
LLPolyMorphTarget::~LLPolyMorphTarget()
{
- delete mVertMask;
- mVertMask = NULL;
+ delete mVertMask;
+ mVertMask = NULL;
}
//-----------------------------------------------------------------------------
@@ -355,53 +355,53 @@ LLPolyMorphTarget::~LLPolyMorphTarget()
//-----------------------------------------------------------------------------
BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
{
- llassert(mInfo == NULL);
- if (info->mID < 0)
- return FALSE;
- mInfo = info;
- mID = info->mID;
- setWeight(getDefaultWeight());
-
- LLAvatarAppearance* avatarp = mMesh->getAvatar();
- for (LLPolyVolumeMorphInfo& volume_info : getInfo()->mVolumeInfoList)
- {
- for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++)
- {
- if (avatarp->mCollisionVolumes[i].getName() == volume_info.mName)
- {
- mVolumeMorphs.push_back(
- LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i],
- volume_info.mScale,
- volume_info.mPos));
- break;
- }
- }
- }
-
- std::string morph_param_name = getInfo()->mMorphName;
-
- mMorphData = mMesh->getMorphData(morph_param_name);
- if (!mMorphData)
- {
- const std::string driven_tag = "_Driven";
- U32 pos = morph_param_name.find(driven_tag);
- if (pos > 0)
- {
- morph_param_name = morph_param_name.substr(0,pos);
- mMorphData = mMesh->getMorphData(morph_param_name);
- }
- }
- if (!mMorphData)
- {
- LL_WARNS() << "No morph target named " << morph_param_name << " found in mesh." << LL_ENDL;
- return FALSE; // Continue, ignoring this tag
- }
- return TRUE;
+ llassert(mInfo == NULL);
+ if (info->mID < 0)
+ return FALSE;
+ mInfo = info;
+ mID = info->mID;
+ setWeight(getDefaultWeight());
+
+ LLAvatarAppearance* avatarp = mMesh->getAvatar();
+ for (LLPolyVolumeMorphInfo& volume_info : getInfo()->mVolumeInfoList)
+ {
+ for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++)
+ {
+ if (avatarp->mCollisionVolumes[i].getName() == volume_info.mName)
+ {
+ mVolumeMorphs.push_back(
+ LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i],
+ volume_info.mScale,
+ volume_info.mPos));
+ break;
+ }
+ }
+ }
+
+ std::string morph_param_name = getInfo()->mMorphName;
+
+ mMorphData = mMesh->getMorphData(morph_param_name);
+ if (!mMorphData)
+ {
+ const std::string driven_tag = "_Driven";
+ U32 pos = morph_param_name.find(driven_tag);
+ if (pos > 0)
+ {
+ morph_param_name = morph_param_name.substr(0,pos);
+ mMorphData = mMesh->getMorphData(morph_param_name);
+ }
+ }
+ if (!mMorphData)
+ {
+ LL_WARNS() << "No morph target named " << morph_param_name << " found in mesh." << LL_ENDL;
+ return FALSE; // Continue, ignoring this tag
+ }
+ return TRUE;
}
/*virtual*/ LLViewerVisualParam* LLPolyMorphTarget::cloneParam(LLWearable* wearable) const
{
- return new LLPolyMorphTarget(*this);
+ return new LLPolyMorphTarget(*this);
}
#if 0 // obsolete
@@ -410,15 +410,15 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
//-----------------------------------------------------------------------------
BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node)
{
- LLPolyMorphTargetInfo* info = new LLPolyMorphTargetInfo;
-
- info->parseXml(node);
- if (!setInfo(info))
- {
- delete info;
- return FALSE;
- }
- return TRUE;
+ LLPolyMorphTargetInfo* info = new LLPolyMorphTargetInfo;
+
+ info->parseXml(node);
+ if (!setInfo(info))
+ {
+ delete info;
+ return FALSE;
+ }
+ return TRUE;
}
#endif
@@ -427,17 +427,17 @@ BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node)
//-----------------------------------------------------------------------------
LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh)
{
- if (!mMorphData || mMesh != mesh) return LLVector4a::getZero();
+ if (!mMorphData || mMesh != mesh) return LLVector4a::getZero();
- for(U32 index = 0; index < mMorphData->mNumIndices; index++)
- {
- if (mMorphData->mVertexIndices[index] == (U32)requested_index)
- {
- return mMorphData->mCoords[index];
- }
- }
+ for(U32 index = 0; index < mMorphData->mNumIndices; index++)
+ {
+ if (mMorphData->mVertexIndices[index] == (U32)requested_index)
+ {
+ return mMorphData->mCoords[index];
+ }
+ }
- return LLVector4a::getZero();
+ return LLVector4a::getZero();
}
//-----------------------------------------------------------------------------
@@ -445,25 +445,25 @@ LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMes
//-----------------------------------------------------------------------------
const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)
{
- if (!mMorphData) return &LLVector4a::getZero();
-
- LLVector4a* resultVec;
- mMorphData->mCurrentIndex = 0;
- if (mMorphData->mNumIndices)
- {
- resultVec = &mMorphData->mCoords[mMorphData->mCurrentIndex];
- if (index != NULL)
- {
- *index = mMorphData->mVertexIndices[mMorphData->mCurrentIndex];
- }
- if (poly_mesh != NULL)
- {
- *poly_mesh = mMesh;
- }
-
- return resultVec;
- }
- return NULL;
+ if (!mMorphData) return &LLVector4a::getZero();
+
+ LLVector4a* resultVec;
+ mMorphData->mCurrentIndex = 0;
+ if (mMorphData->mNumIndices)
+ {
+ resultVec = &mMorphData->mCoords[mMorphData->mCurrentIndex];
+ if (index != NULL)
+ {
+ *index = mMorphData->mVertexIndices[mMorphData->mCurrentIndex];
+ }
+ if (poly_mesh != NULL)
+ {
+ *poly_mesh = mMesh;
+ }
+
+ return resultVec;
+ }
+ return NULL;
}
//-----------------------------------------------------------------------------
@@ -471,69 +471,69 @@ const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh *
//-----------------------------------------------------------------------------
const LLVector4a *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)
{
- if (!mMorphData) return &LLVector4a::getZero();
-
- LLVector4a* resultVec;
- mMorphData->mCurrentIndex++;
- if (mMorphData->mCurrentIndex < mMorphData->mNumIndices)
- {
- resultVec = &mMorphData->mCoords[mMorphData->mCurrentIndex];
- if (index != NULL)
- {
- *index = mMorphData->mVertexIndices[mMorphData->mCurrentIndex];
- }
- if (poly_mesh != NULL)
- {
- *poly_mesh = mMesh;
- }
- return resultVec;
- }
- return NULL;
+ if (!mMorphData) return &LLVector4a::getZero();
+
+ LLVector4a* resultVec;
+ mMorphData->mCurrentIndex++;
+ if (mMorphData->mCurrentIndex < mMorphData->mNumIndices)
+ {
+ resultVec = &mMorphData->mCoords[mMorphData->mCurrentIndex];
+ if (index != NULL)
+ {
+ *index = mMorphData->mVertexIndices[mMorphData->mCurrentIndex];
+ }
+ if (poly_mesh != NULL)
+ {
+ *poly_mesh = mMesh;
+ }
+ return resultVec;
+ }
+ return NULL;
}
//-----------------------------------------------------------------------------
// getTotalDistortion()
//-----------------------------------------------------------------------------
-F32 LLPolyMorphTarget::getTotalDistortion()
-{
- if (mMorphData)
- {
- return mMorphData->mTotalDistortion;
- }
- else
- {
- return 0.f;
- }
+F32 LLPolyMorphTarget::getTotalDistortion()
+{
+ if (mMorphData)
+ {
+ return mMorphData->mTotalDistortion;
+ }
+ else
+ {
+ return 0.f;
+ }
}
//-----------------------------------------------------------------------------
// getAvgDistortion()
//-----------------------------------------------------------------------------
-const LLVector4a& LLPolyMorphTarget::getAvgDistortion()
+const LLVector4a& LLPolyMorphTarget::getAvgDistortion()
{
- if (mMorphData)
- {
- return mMorphData->mAvgDistortion;
- }
- else
- {
- return LLVector4a::getZero();
- }
+ if (mMorphData)
+ {
+ return mMorphData->mAvgDistortion;
+ }
+ else
+ {
+ return LLVector4a::getZero();
+ }
}
//-----------------------------------------------------------------------------
// getMaxDistortion()
//-----------------------------------------------------------------------------
-F32 LLPolyMorphTarget::getMaxDistortion()
+F32 LLPolyMorphTarget::getMaxDistortion()
{
- if (mMorphData)
- {
- return mMorphData->mMaxDistortion;
- }
- else
- {
- return 0.f;
- }
+ if (mMorphData)
+ {
+ return mMorphData->mMaxDistortion;
+ }
+ else
+ {
+ return 0.f;
+ }
}
//-----------------------------------------------------------------------------
@@ -541,192 +541,192 @@ F32 LLPolyMorphTarget::getMaxDistortion()
//-----------------------------------------------------------------------------
void LLPolyMorphTarget::apply( ESex avatar_sex )
{
- if (!mMorphData || mNumMorphMasksPending > 0)
- {
- return;
- }
+ if (!mMorphData || mNumMorphMasksPending > 0)
+ {
+ return;
+ }
LL_PROFILE_ZONE_SCOPED;
- mLastSex = avatar_sex;
-
- // Check for NaN condition (NaN is detected if a variable doesn't equal itself.
- if (mCurWeight != mCurWeight)
- {
- mCurWeight = 0.0;
- }
- if (mLastWeight != mLastWeight)
- {
- mLastWeight = mCurWeight+.001;
- }
-
- // perform differential update of morph
- F32 delta_weight = ( getSex() & avatar_sex ) ? (mCurWeight - mLastWeight) : (getDefaultWeight() - mLastWeight);
- // store last weight
- mLastWeight += delta_weight;
-
- if (delta_weight != 0.f)
- {
- llassert(!mMesh->isLOD());
- LLVector4a *coords = mMesh->getWritableCoords();
-
- LLVector4a *scaled_normals = mMesh->getScaledNormals();
- LLVector4a *normals = mMesh->getWritableNormals();
-
- LLVector4a *scaled_binormals = mMesh->getScaledBinormals();
- LLVector4a *binormals = mMesh->getWritableBinormals();
-
- LLVector4a *clothing_weights = mMesh->getWritableClothingWeights();
- LLVector2 *tex_coords = mMesh->getWritableTexCoords();
-
- F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL;
-
- for(U32 vert_index_morph = 0; vert_index_morph < mMorphData->mNumIndices; vert_index_morph++)
- {
- S32 vert_index_mesh = mMorphData->mVertexIndices[vert_index_morph];
-
- F32 maskWeight = 1.f;
- if (maskWeightArray)
- {
- maskWeight = maskWeightArray[vert_index_morph];
- }
-
-
- LLVector4a pos = mMorphData->mCoords[vert_index_morph];
- pos.mul(delta_weight*maskWeight);
- coords[vert_index_mesh].add(pos);
-
- if (getInfo()->mIsClothingMorph && clothing_weights)
- {
- LLVector4a clothing_offset = mMorphData->mCoords[vert_index_morph];
- clothing_offset.mul(delta_weight * maskWeight);
- LLVector4a* clothing_weight = &clothing_weights[vert_index_mesh];
- clothing_weight->add(clothing_offset);
- clothing_weight->getF32ptr()[VW] = maskWeight;
- }
-
- // calculate new normals based on half angles
- LLVector4a norm = mMorphData->mNormals[vert_index_morph];
- norm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR);
- scaled_normals[vert_index_mesh].add(norm);
- norm = scaled_normals[vert_index_mesh];
-
- // guard against degenerate input data before we create NaNs below!
- //
- norm.normalize3fast();
- normals[vert_index_mesh] = norm;
-
- // calculate new binormals
- LLVector4a binorm = mMorphData->mBinormals[vert_index_morph];
-
- // guard against degenerate input data before we create NaNs below!
- //
- if (!binorm.isFinite3() || (binorm.dot3(binorm).getF32() <= F_APPROXIMATELY_ZERO))
- {
- binorm.set(1,0,0,1);
- }
-
- binorm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR);
- scaled_binormals[vert_index_mesh].add(binorm);
- LLVector4a tangent;
- tangent.setCross3(scaled_binormals[vert_index_mesh], norm);
- LLVector4a& normalized_binormal = binormals[vert_index_mesh];
-
- normalized_binormal.setCross3(norm, tangent);
- normalized_binormal.normalize3fast();
-
- tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight;
- }
-
- // now apply volume changes
- for(LLPolyVolumeMorph& volume_morph : mVolumeMorphs)
- {
- LLVector3 scale_delta = volume_morph.mScale * delta_weight;
- LLVector3 pos_delta = volume_morph.mPos * delta_weight;
-
- volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta);
+ mLastSex = avatar_sex;
+
+ // Check for NaN condition (NaN is detected if a variable doesn't equal itself.
+ if (mCurWeight != mCurWeight)
+ {
+ mCurWeight = 0.0;
+ }
+ if (mLastWeight != mLastWeight)
+ {
+ mLastWeight = mCurWeight+.001;
+ }
+
+ // perform differential update of morph
+ F32 delta_weight = ( getSex() & avatar_sex ) ? (mCurWeight - mLastWeight) : (getDefaultWeight() - mLastWeight);
+ // store last weight
+ mLastWeight += delta_weight;
+
+ if (delta_weight != 0.f)
+ {
+ llassert(!mMesh->isLOD());
+ LLVector4a *coords = mMesh->getWritableCoords();
+
+ LLVector4a *scaled_normals = mMesh->getScaledNormals();
+ LLVector4a *normals = mMesh->getWritableNormals();
+
+ LLVector4a *scaled_binormals = mMesh->getScaledBinormals();
+ LLVector4a *binormals = mMesh->getWritableBinormals();
+
+ LLVector4a *clothing_weights = mMesh->getWritableClothingWeights();
+ LLVector2 *tex_coords = mMesh->getWritableTexCoords();
+
+ F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL;
+
+ for(U32 vert_index_morph = 0; vert_index_morph < mMorphData->mNumIndices; vert_index_morph++)
+ {
+ S32 vert_index_mesh = mMorphData->mVertexIndices[vert_index_morph];
+
+ F32 maskWeight = 1.f;
+ if (maskWeightArray)
+ {
+ maskWeight = maskWeightArray[vert_index_morph];
+ }
+
+
+ LLVector4a pos = mMorphData->mCoords[vert_index_morph];
+ pos.mul(delta_weight*maskWeight);
+ coords[vert_index_mesh].add(pos);
+
+ if (getInfo()->mIsClothingMorph && clothing_weights)
+ {
+ LLVector4a clothing_offset = mMorphData->mCoords[vert_index_morph];
+ clothing_offset.mul(delta_weight * maskWeight);
+ LLVector4a* clothing_weight = &clothing_weights[vert_index_mesh];
+ clothing_weight->add(clothing_offset);
+ clothing_weight->getF32ptr()[VW] = maskWeight;
+ }
+
+ // calculate new normals based on half angles
+ LLVector4a norm = mMorphData->mNormals[vert_index_morph];
+ norm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR);
+ scaled_normals[vert_index_mesh].add(norm);
+ norm = scaled_normals[vert_index_mesh];
+
+ // guard against degenerate input data before we create NaNs below!
+ //
+ norm.normalize3fast();
+ normals[vert_index_mesh] = norm;
+
+ // calculate new binormals
+ LLVector4a binorm = mMorphData->mBinormals[vert_index_morph];
+
+ // guard against degenerate input data before we create NaNs below!
+ //
+ if (!binorm.isFinite3() || (binorm.dot3(binorm).getF32() <= F_APPROXIMATELY_ZERO))
+ {
+ binorm.set(1,0,0,1);
+ }
+
+ binorm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR);
+ scaled_binormals[vert_index_mesh].add(binorm);
+ LLVector4a tangent;
+ tangent.setCross3(scaled_binormals[vert_index_mesh], norm);
+ LLVector4a& normalized_binormal = binormals[vert_index_mesh];
+
+ normalized_binormal.setCross3(norm, tangent);
+ normalized_binormal.normalize3fast();
+
+ tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight;
+ }
+
+ // now apply volume changes
+ for(LLPolyVolumeMorph& volume_morph : mVolumeMorphs)
+ {
+ LLVector3 scale_delta = volume_morph.mScale * delta_weight;
+ LLVector3 pos_delta = volume_morph.mPos * delta_weight;
+
+ volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta);
// SL-315
- volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta);
- }
- }
-
- if (mNext)
- {
- mNext->apply(avatar_sex);
- }
+ volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta);
+ }
+ }
+
+ if (mNext)
+ {
+ mNext->apply(avatar_sex);
+ }
}
//-----------------------------------------------------------------------------
// applyMask()
//-----------------------------------------------------------------------------
-void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert)
+void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert)
{
- LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL;
-
- if (!mVertMask)
- {
- mVertMask = new LLPolyVertexMask(mMorphData);
- mNumMorphMasksPending--;
- }
- else
- {
- // remove effect of previous mask
- F32 *maskWeights = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL;
-
- if (maskWeights)
- {
- LLVector4a *coords = mMesh->getWritableCoords();
- LLVector4a *scaled_normals = mMesh->getScaledNormals();
- LLVector4a *scaled_binormals = mMesh->getScaledBinormals();
- LLVector2 *tex_coords = mMesh->getWritableTexCoords();
-
- LLVector4Logical clothing_mask;
- clothing_mask.clear();
- clothing_mask.setElement<0>();
- clothing_mask.setElement<1>();
- clothing_mask.setElement<2>();
-
-
- for(U32 vert = 0; vert < mMorphData->mNumIndices; vert++)
- {
- F32 lastMaskWeight = mLastWeight * maskWeights[vert];
- S32 out_vert = mMorphData->mVertexIndices[vert];
-
- // remove effect of existing masked morph
- LLVector4a t;
- t = mMorphData->mCoords[vert];
- t.mul(lastMaskWeight);
- coords[out_vert].sub(t);
-
- t = mMorphData->mNormals[vert];
- t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR);
- scaled_normals[out_vert].sub(t);
-
- t = mMorphData->mBinormals[vert];
- t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR);
- scaled_binormals[out_vert].sub(t);
-
- tex_coords[out_vert] -= mMorphData->mTexCoords[vert] * lastMaskWeight;
-
- if (clothing_weights)
- {
- LLVector4a clothing_offset = mMorphData->mCoords[vert];
- clothing_offset.mul(lastMaskWeight);
- LLVector4a* clothing_weight = &clothing_weights[out_vert];
- LLVector4a t;
- t.setSub(*clothing_weight, clothing_offset);
- clothing_weight->setSelectWithMask(clothing_mask, t, *clothing_weight);
- }
- }
- }
- }
-
- // set last weight to 0, since we've removed the effect of this morph
- mLastWeight = 0.f;
-
- mVertMask->generateMask(maskTextureData, width, height, num_components, invert, clothing_weights);
-
- apply(mLastSex);
+ LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL;
+
+ if (!mVertMask)
+ {
+ mVertMask = new LLPolyVertexMask(mMorphData);
+ mNumMorphMasksPending--;
+ }
+ else
+ {
+ // remove effect of previous mask
+ F32 *maskWeights = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL;
+
+ if (maskWeights)
+ {
+ LLVector4a *coords = mMesh->getWritableCoords();
+ LLVector4a *scaled_normals = mMesh->getScaledNormals();
+ LLVector4a *scaled_binormals = mMesh->getScaledBinormals();
+ LLVector2 *tex_coords = mMesh->getWritableTexCoords();
+
+ LLVector4Logical clothing_mask;
+ clothing_mask.clear();
+ clothing_mask.setElement<0>();
+ clothing_mask.setElement<1>();
+ clothing_mask.setElement<2>();
+
+
+ for(U32 vert = 0; vert < mMorphData->mNumIndices; vert++)
+ {
+ F32 lastMaskWeight = mLastWeight * maskWeights[vert];
+ S32 out_vert = mMorphData->mVertexIndices[vert];
+
+ // remove effect of existing masked morph
+ LLVector4a t;
+ t = mMorphData->mCoords[vert];
+ t.mul(lastMaskWeight);
+ coords[out_vert].sub(t);
+
+ t = mMorphData->mNormals[vert];
+ t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR);
+ scaled_normals[out_vert].sub(t);
+
+ t = mMorphData->mBinormals[vert];
+ t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR);
+ scaled_binormals[out_vert].sub(t);
+
+ tex_coords[out_vert] -= mMorphData->mTexCoords[vert] * lastMaskWeight;
+
+ if (clothing_weights)
+ {
+ LLVector4a clothing_offset = mMorphData->mCoords[vert];
+ clothing_offset.mul(lastMaskWeight);
+ LLVector4a* clothing_weight = &clothing_weights[out_vert];
+ LLVector4a t;
+ t.setSub(*clothing_weight, clothing_offset);
+ clothing_weight->setSelectWithMask(clothing_mask, t, *clothing_weight);
+ }
+ }
+ }
+ }
+
+ // set last weight to 0, since we've removed the effect of this morph
+ mLastWeight = 0.f;
+
+ mVertMask->generateMask(maskTextureData, width, height, num_components, invert, clothing_weights);
+
+ apply(mLastSex);
}
void LLPolyMorphTarget::applyVolumeChanges(F32 delta_weight)
@@ -736,7 +736,7 @@ void LLPolyMorphTarget::applyVolumeChanges(F32 delta_weight)
{
LLVector3 scale_delta = volume_morph.mScale * delta_weight;
LLVector3 pos_delta = volume_morph.mPos * delta_weight;
-
+
volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta);
// SL-315
volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta);
@@ -747,25 +747,25 @@ void LLPolyMorphTarget::applyVolumeChanges(F32 delta_weight)
// LLPolyVertexMask()
//-----------------------------------------------------------------------------
LLPolyVertexMask::LLPolyVertexMask(LLPolyMorphData* morph_data)
- : mWeights(new F32[morph_data->mNumIndices]),
- mMorphData(morph_data),
- mWeightsGenerated(FALSE)
+ : mWeights(new F32[morph_data->mNumIndices]),
+ mMorphData(morph_data),
+ mWeightsGenerated(FALSE)
{
- llassert(mMorphData != NULL);
- llassert(mMorphData->mNumIndices > 0);
+ llassert(mMorphData != NULL);
+ llassert(mMorphData->mNumIndices > 0);
}
//-----------------------------------------------------------------------------
// LLPolyVertexMask()
//-----------------------------------------------------------------------------
LLPolyVertexMask::LLPolyVertexMask(const LLPolyVertexMask& pOther)
- : mWeights(new F32[pOther.mMorphData->mNumIndices]),
- mMorphData(pOther.mMorphData),
- mWeightsGenerated(pOther.mWeightsGenerated)
+ : mWeights(new F32[pOther.mMorphData->mNumIndices]),
+ mMorphData(pOther.mMorphData),
+ mWeightsGenerated(pOther.mWeightsGenerated)
{
- llassert(mMorphData != NULL);
- llassert(mMorphData->mNumIndices > 0);
- memcpy(mWeights, pOther.mWeights, sizeof(F32) * mMorphData->mNumIndices);
+ llassert(mMorphData != NULL);
+ llassert(mMorphData->mNumIndices > 0);
+ memcpy(mWeights, pOther.mWeights, sizeof(F32) * mMorphData->mNumIndices);
}
//-----------------------------------------------------------------------------
@@ -773,8 +773,8 @@ LLPolyVertexMask::LLPolyVertexMask(const LLPolyVertexMask& pOther)
//-----------------------------------------------------------------------------
LLPolyVertexMask::~LLPolyVertexMask()
{
- delete [] mWeights;
- mWeights = NULL;
+ delete [] mWeights;
+ mWeights = NULL;
}
//-----------------------------------------------------------------------------
@@ -783,51 +783,51 @@ LLPolyVertexMask::~LLPolyVertexMask()
void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights)
{
// RN debug output that uses Image Debugger (http://www.cs.unc.edu/~baxter/projects/imdebug/)
-// BOOL debugImg = FALSE;
-// if (debugImg)
-// {
-// if (invert)
-// {
-// imdebug("lum rbga=rgba b=8 w=%d h=%d *-1 %p", width, height, maskTextureData);
-// }
-// else
-// {
-// imdebug("lum rbga=rgba b=8 w=%d h=%d %p", width, height, maskTextureData);
-// }
-// }
- for (U32 index = 0; index < mMorphData->mNumIndices; index++)
- {
- S32 vertIndex = mMorphData->mVertexIndices[index];
- const S32 *sharedVertIndex = mMorphData->mMesh->getSharedVert(vertIndex);
- LLVector2 uvCoords;
-
- if (sharedVertIndex)
- {
- uvCoords = mMorphData->mMesh->getUVs(*sharedVertIndex);
- }
- else
- {
- uvCoords = mMorphData->mMesh->getUVs(vertIndex);
- }
- U32 s = llclamp((U32)(uvCoords.mV[VX] * (F32)(width - 1)), (U32)0, (U32)width - 1);
- U32 t = llclamp((U32)(uvCoords.mV[VY] * (F32)(height - 1)), (U32)0, (U32)height - 1);
-
- mWeights[index] = maskTextureData ? ((F32) maskTextureData[((t * width + s) * num_components) + (num_components - 1)]) / 255.f : 0.0f;
-
- if (invert)
- {
- mWeights[index] = 1.f - mWeights[index];
- }
-
- // now apply step function
- // mWeights[index] = mWeights[index] > 0.95f ? 1.f : 0.f;
-
- if (clothing_weights)
- {
- clothing_weights[vertIndex].getF32ptr()[VW] = mWeights[index];
- }
- }
- mWeightsGenerated = TRUE;
+// BOOL debugImg = FALSE;
+// if (debugImg)
+// {
+// if (invert)
+// {
+// imdebug("lum rbga=rgba b=8 w=%d h=%d *-1 %p", width, height, maskTextureData);
+// }
+// else
+// {
+// imdebug("lum rbga=rgba b=8 w=%d h=%d %p", width, height, maskTextureData);
+// }
+// }
+ for (U32 index = 0; index < mMorphData->mNumIndices; index++)
+ {
+ S32 vertIndex = mMorphData->mVertexIndices[index];
+ const S32 *sharedVertIndex = mMorphData->mMesh->getSharedVert(vertIndex);
+ LLVector2 uvCoords;
+
+ if (sharedVertIndex)
+ {
+ uvCoords = mMorphData->mMesh->getUVs(*sharedVertIndex);
+ }
+ else
+ {
+ uvCoords = mMorphData->mMesh->getUVs(vertIndex);
+ }
+ U32 s = llclamp((U32)(uvCoords.mV[VX] * (F32)(width - 1)), (U32)0, (U32)width - 1);
+ U32 t = llclamp((U32)(uvCoords.mV[VY] * (F32)(height - 1)), (U32)0, (U32)height - 1);
+
+ mWeights[index] = maskTextureData ? ((F32) maskTextureData[((t * width + s) * num_components) + (num_components - 1)]) / 255.f : 0.0f;
+
+ if (invert)
+ {
+ mWeights[index] = 1.f - mWeights[index];
+ }
+
+ // now apply step function
+ // mWeights[index] = mWeights[index] > 0.95f ? 1.f : 0.f;
+
+ if (clothing_weights)
+ {
+ clothing_weights[vertIndex].getF32ptr()[VW] = mWeights[index];
+ }
+ }
+ mWeightsGenerated = TRUE;
}
//-----------------------------------------------------------------------------
@@ -835,10 +835,10 @@ void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height,
//-----------------------------------------------------------------------------
F32* LLPolyVertexMask::getMorphMaskWeights()
{
- if (!mWeightsGenerated)
- {
- return NULL;
- }
-
- return mWeights;
+ if (!mWeightsGenerated)
+ {
+ return NULL;
+ }
+
+ return mWeights;
}
diff --git a/indra/llappearance/llpolymorph.h b/indra/llappearance/llpolymorph.h
index 29cd373636..5235e83097 100644
--- a/indra/llappearance/llpolymorph.h
+++ b/indra/llappearance/llpolymorph.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpolymorph.h
* @brief Implementation of LLPolyMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -45,32 +45,32 @@ class alignas(16) LLPolyMorphData
{
LL_ALIGN_NEW
public:
- LLPolyMorphData(const std::string& morph_name);
- ~LLPolyMorphData();
- LLPolyMorphData(const LLPolyMorphData &rhs);
+ LLPolyMorphData(const std::string& morph_name);
+ ~LLPolyMorphData();
+ LLPolyMorphData(const LLPolyMorphData &rhs);
- BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh);
- const std::string& getName() { return mName; }
+ BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh);
+ const std::string& getName() { return mName; }
public:
- std::string mName;
-
- // morphology
- U32 mNumIndices;
- U32* mVertexIndices;
- U32 mCurrentIndex;
- LLVector4a* mCoords;
- LLVector4a* mNormals;
- LLVector4a* mBinormals;
- LLVector2* mTexCoords;
-
- F32 mTotalDistortion; // vertex distortion summed over entire morph
- F32 mMaxDistortion; // maximum single vertex distortion in a given morph
- LLVector4a mAvgDistortion; // average vertex distortion, to infer directionality of the morph
- LLPolyMeshSharedData* mMesh;
+ std::string mName;
+
+ // morphology
+ U32 mNumIndices;
+ U32* mVertexIndices;
+ U32 mCurrentIndex;
+ LLVector4a* mCoords;
+ LLVector4a* mNormals;
+ LLVector4a* mBinormals;
+ LLVector2* mTexCoords;
+
+ F32 mTotalDistortion; // vertex distortion summed over entire morph
+ F32 mMaxDistortion; // maximum single vertex distortion in a given morph
+ LLVector4a mAvgDistortion; // average vertex distortion, to infer directionality of the morph
+ LLPolyMeshSharedData* mMesh;
private:
- void freeData();
+ void freeData();
} LL_ALIGN_POSTFIX(16);
@@ -80,18 +80,18 @@ private:
class LLPolyVertexMask
{
public:
- LLPolyVertexMask(LLPolyMorphData* morph_data);
- LLPolyVertexMask(const LLPolyVertexMask& pOther);
- ~LLPolyVertexMask();
+ LLPolyVertexMask(LLPolyMorphData* morph_data);
+ LLPolyVertexMask(const LLPolyVertexMask& pOther);
+ ~LLPolyVertexMask();
- void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights);
- F32* getMorphMaskWeights();
+ void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights);
+ F32* getMorphMaskWeights();
protected:
- F32* mWeights;
- LLPolyMorphData *mMorphData;
- BOOL mWeightsGenerated;
+ F32* mWeights;
+ LLPolyMorphData *mMorphData;
+ BOOL mWeightsGenerated;
};
@@ -100,22 +100,22 @@ protected:
//-----------------------------------------------------------------------------
struct LLPolyVolumeMorphInfo
{
- LLPolyVolumeMorphInfo(std::string &name, LLVector3 &scale, LLVector3 &pos)
- : mName(name), mScale(scale), mPos(pos) {};
+ LLPolyVolumeMorphInfo(std::string &name, LLVector3 &scale, LLVector3 &pos)
+ : mName(name), mScale(scale), mPos(pos) {};
- std::string mName;
- LLVector3 mScale;
- LLVector3 mPos;
+ std::string mName;
+ LLVector3 mScale;
+ LLVector3 mPos;
};
struct LLPolyVolumeMorph
{
- LLPolyVolumeMorph(LLAvatarJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos)
- : mVolume(volume), mScale(scale), mPos(pos) {};
+ LLPolyVolumeMorph(LLAvatarJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos)
+ : mVolume(volume), mScale(scale), mPos(pos) {};
- LLAvatarJointCollisionVolume* mVolume;
- LLVector3 mScale;
- LLVector3 mPos;
+ LLAvatarJointCollisionVolume* mVolume;
+ LLVector3 mScale;
+ LLVector3 mPos;
};
//-----------------------------------------------------------------------------
@@ -124,18 +124,18 @@ struct LLPolyVolumeMorph
//-----------------------------------------------------------------------------
class LLPolyMorphTargetInfo : public LLViewerVisualParamInfo
{
- friend class LLPolyMorphTarget;
+ friend class LLPolyMorphTarget;
public:
- LLPolyMorphTargetInfo();
- /*virtual*/ ~LLPolyMorphTargetInfo() {};
-
- /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
+ LLPolyMorphTargetInfo();
+ /*virtual*/ ~LLPolyMorphTargetInfo() {};
+
+ /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
protected:
- std::string mMorphName;
- BOOL mIsClothingMorph;
- typedef std::vector<LLPolyVolumeMorphInfo> volume_info_list_t;
- volume_info_list_t mVolumeInfoList;
+ std::string mMorphName;
+ BOOL mIsClothingMorph;
+ typedef std::vector<LLPolyVolumeMorphInfo> volume_info_list_t;
+ volume_info_list_t mVolumeInfoList;
};
//-----------------------------------------------------------------------------
@@ -148,45 +148,45 @@ class alignas(16) LLPolyMorphTarget : public LLViewerVisualParam
{
LL_ALIGN_NEW
public:
- LLPolyMorphTarget(LLPolyMesh *poly_mesh);
- ~LLPolyMorphTarget();
-
- // Special: These functions are overridden by child classes
- LLPolyMorphTargetInfo* getInfo() const { return (LLPolyMorphTargetInfo*)mInfo; }
- // This sets mInfo and calls initialization functions
- BOOL setInfo(LLPolyMorphTargetInfo *info);
-
- /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
-
- // LLVisualParam Virtual functions
- ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
- /*virtual*/ void apply( ESex sex );
-
- // LLViewerVisualParam Virtual functions
- /*virtual*/ F32 getTotalDistortion();
- /*virtual*/ const LLVector4a& getAvgDistortion();
- /*virtual*/ F32 getMaxDistortion();
- /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh);
- /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
- /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
-
- void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert);
- void addPendingMorphMask() { mNumMorphMasksPending++; }
+ LLPolyMorphTarget(LLPolyMesh *poly_mesh);
+ ~LLPolyMorphTarget();
+
+ // Special: These functions are overridden by child classes
+ LLPolyMorphTargetInfo* getInfo() const { return (LLPolyMorphTargetInfo*)mInfo; }
+ // This sets mInfo and calls initialization functions
+ BOOL setInfo(LLPolyMorphTargetInfo *info);
+
+ /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
+
+ // LLVisualParam Virtual functions
+ ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
+ /*virtual*/ void apply( ESex sex );
+
+ // LLViewerVisualParam Virtual functions
+ /*virtual*/ F32 getTotalDistortion();
+ /*virtual*/ const LLVector4a& getAvgDistortion();
+ /*virtual*/ F32 getMaxDistortion();
+ /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh);
+ /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
+ /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
+
+ void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert);
+ void addPendingMorphMask() { mNumMorphMasksPending++; }
void applyVolumeChanges(F32 delta_weight); // SL-315 - for resetSkeleton()
protected:
- LLPolyMorphTarget(const LLPolyMorphTarget& pOther);
+ LLPolyMorphTarget(const LLPolyMorphTarget& pOther);
- LLPolyMorphData* mMorphData;
- LLPolyMesh* mMesh;
- LLPolyVertexMask * mVertMask;
- ESex mLastSex;
- // number of morph masks that haven't been generated, must be 0 before this morph is applied
- BOOL mNumMorphMasksPending;
+ LLPolyMorphData* mMorphData;
+ LLPolyMesh* mMesh;
+ LLPolyVertexMask * mVertMask;
+ ESex mLastSex;
+ // number of morph masks that haven't been generated, must be 0 before this morph is applied
+ BOOL mNumMorphMasksPending;
- typedef std::vector<LLPolyVolumeMorph> volume_list_t;
- volume_list_t mVolumeMorphs;
+ typedef std::vector<LLPolyVolumeMorph> volume_list_t;
+ volume_list_t mVolumeMorphs;
};
diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp
index 586e631ded..1d2ff6ef4f 100644
--- a/indra/llappearance/llpolyskeletaldistortion.cpp
+++ b/indra/llappearance/llpolyskeletaldistortion.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpolyskeletaldistortion.cpp
* @brief Implementation of LLPolySkeletalDistortion classes
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,7 +48,7 @@ LLPolySkeletalDistortionInfo::LLPolySkeletalDistortionInfo()
BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
{
llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) );
-
+
if (!LLViewerVisualParamInfo::parseXml(node))
return FALSE;
@@ -69,7 +69,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
LLVector3 scale;
LLVector3 pos;
BOOL haspos = FALSE;
-
+
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
if (!bone->getFastAttributeString(name_string, name))
{
@@ -105,24 +105,24 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
// LLPolySkeletalDistortion()
//-----------------------------------------------------------------------------
LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLAvatarAppearance *avatarp)
- : LLViewerVisualParam(),
- mDefaultVec(),
- mJointScales(),
- mJointOffsets(),
- mAvatar(avatarp)
+ : LLViewerVisualParam(),
+ mDefaultVec(),
+ mJointScales(),
+ mJointOffsets(),
+ mAvatar(avatarp)
{
- mDefaultVec.splat(0.001f);
+ mDefaultVec.splat(0.001f);
}
//-----------------------------------------------------------------------------
// LLPolySkeletalDistortion()
//-----------------------------------------------------------------------------
LLPolySkeletalDistortion::LLPolySkeletalDistortion(const LLPolySkeletalDistortion &pOther)
- : LLViewerVisualParam(pOther),
- mDefaultVec(pOther.mDefaultVec),
- mJointScales(pOther.mJointScales),
- mJointOffsets(pOther.mJointOffsets),
- mAvatar(pOther.mAvatar)
+ : LLViewerVisualParam(pOther),
+ mDefaultVec(pOther.mDefaultVec),
+ mJointScales(pOther.mJointScales),
+ mJointOffsets(pOther.mJointOffsets),
+ mAvatar(pOther.mAvatar)
{
}
@@ -151,7 +151,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
// There's no point continuing after this error - means
// that either the skeleton or lad file is broken.
LL_WARNS() << "Joint " << bone_info.mBoneName << " not found." << LL_ENDL;
- return FALSE;
+ return FALSE;
}
// store it
@@ -179,7 +179,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
/*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const
{
- return new LLPolySkeletalDistortion(*this);
+ return new LLPolySkeletalDistortion(*this);
}
//-----------------------------------------------------------------------------
@@ -201,8 +201,8 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
LLVector3 offset = (effective_weight - mLastWeight) * scaleDelta;
newScale = newScale + offset;
//An aspect of attached mesh objects (which contain joint offsets) that need to be cleaned up when detached
- // needed?
- // joint->storeScaleForReset( newScale );
+ // needed?
+ // joint->storeScaleForReset( newScale );
// BENTO for detailed stack tracing of params.
std::stringstream ostr;
@@ -217,7 +217,7 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
joint = offset_pair.first;
LLVector3 newPosition = joint->getPosition();
LLVector3 positionDelta = offset_pair.second;
- newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
+ newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
// SL-315
bool allow_attachment_pos_overrides = true;
joint->setPosition(newPosition, allow_attachment_pos_overrides);
@@ -232,7 +232,7 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
- const std::string &name)
+ const std::string &name)
{
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
cloned_morph_data->mName = name;
@@ -246,13 +246,13 @@ LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
}
LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data,
- const LLVector3 &direction,
- const std::string &name)
+ const LLVector3 &direction,
+ const std::string &name)
{
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
cloned_morph_data->mName = name;
- LLVector4a dir;
- dir.load3(direction.mV);
+ LLVector4a dir;
+ dir.load3(direction.mV);
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
{
@@ -270,26 +270,26 @@ LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
cloned_morph_data->mName = name;
- LLVector4a sc;
- sc.splat(scale);
+ LLVector4a sc;
+ sc.splat(scale);
- LLVector4a nsc;
- nsc.set(scale, -scale, scale, scale);
+ LLVector4a nsc;
+ nsc.set(scale, -scale, scale, scale);
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
{
if (cloned_morph_data->mCoords[v][1] < 0)
{
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc);
- cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc);
- cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc);
- }
- else
- {
- cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc);
- cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc);
- cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc);
- }
+ cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc);
+ cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc);
+ }
+ else
+ {
+ cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc);
+ cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc);
+ cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc);
+ }
}
return cloned_morph_data;
}
diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h
index 585d85f055..818c363c39 100644
--- a/indra/llappearance/llpolyskeletaldistortion.h
+++ b/indra/llappearance/llpolyskeletaldistortion.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llpolyskeletaldistortion.h
* @brief Implementation of LLPolyMesh class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -43,7 +43,7 @@
//class LLSkinJoint;
class LLAvatarAppearance;
-//#define USE_STRIPS // Use tri-strips for rendering.
+//#define USE_STRIPS // Use tri-strips for rendering.
//-----------------------------------------------------------------------------
// LLPolySkeletalDeformationInfo
@@ -51,31 +51,31 @@ class LLAvatarAppearance;
//-----------------------------------------------------------------------------
struct LLPolySkeletalBoneInfo
{
- LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos)
- : mBoneName(name),
- mScaleDeformation(scale),
- mPositionDeformation(pos),
- mHasPositionDeformation(haspos) {}
- std::string mBoneName;
- LLVector3 mScaleDeformation;
- LLVector3 mPositionDeformation;
- BOOL mHasPositionDeformation;
+ LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos)
+ : mBoneName(name),
+ mScaleDeformation(scale),
+ mPositionDeformation(pos),
+ mHasPositionDeformation(haspos) {}
+ std::string mBoneName;
+ LLVector3 mScaleDeformation;
+ LLVector3 mPositionDeformation;
+ BOOL mHasPositionDeformation;
};
class alignas(16) LLPolySkeletalDistortionInfo : public LLViewerVisualParamInfo
{
LL_ALIGN_NEW
- friend class LLPolySkeletalDistortion;
+ friend class LLPolySkeletalDistortion;
public:
-
- LLPolySkeletalDistortionInfo();
- /*virtual*/ ~LLPolySkeletalDistortionInfo() {};
-
- /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
+
+ LLPolySkeletalDistortionInfo();
+ /*virtual*/ ~LLPolySkeletalDistortionInfo() {};
+
+ /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
protected:
- typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t;
- bone_info_list_t mBoneInfoList;
+ typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t;
+ bone_info_list_t mBoneInfoList;
};
//-----------------------------------------------------------------------------
@@ -86,37 +86,37 @@ class alignas(16) LLPolySkeletalDistortion : public LLViewerVisualParam
{
LL_ALIGN_NEW
public:
- LLPolySkeletalDistortion(LLAvatarAppearance *avatarp);
- ~LLPolySkeletalDistortion();
-
- // Special: These functions are overridden by child classes
- LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
- // This sets mInfo and calls initialization functions
- BOOL setInfo(LLPolySkeletalDistortionInfo *info);
-
- /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
-
- // LLVisualParam Virtual functions
- ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
- /*virtual*/ void apply( ESex sex );
-
- // LLViewerVisualParam Virtual functions
- /*virtual*/ F32 getTotalDistortion() { return 0.1f; }
- /*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; }
- /*virtual*/ F32 getMaxDistortion() { return 0.1f; }
- /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);}
- /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;};
- /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};
+ LLPolySkeletalDistortion(LLAvatarAppearance *avatarp);
+ ~LLPolySkeletalDistortion();
+
+ // Special: These functions are overridden by child classes
+ LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
+ // This sets mInfo and calls initialization functions
+ BOOL setInfo(LLPolySkeletalDistortionInfo *info);
+
+ /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
+
+ // LLVisualParam Virtual functions
+ ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
+ /*virtual*/ void apply( ESex sex );
+
+ // LLViewerVisualParam Virtual functions
+ /*virtual*/ F32 getTotalDistortion() { return 0.1f; }
+ /*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; }
+ /*virtual*/ F32 getMaxDistortion() { return 0.1f; }
+ /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);}
+ /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;};
+ /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};
protected:
- LLPolySkeletalDistortion(const LLPolySkeletalDistortion& pOther);
-
- LL_ALIGN_16(LLVector4a mDefaultVec);
- typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
- joint_vec_map_t mJointScales;
- joint_vec_map_t mJointOffsets;
- // Backlink only; don't make this an LLPointer.
- LLAvatarAppearance *mAvatar;
+ LLPolySkeletalDistortion(const LLPolySkeletalDistortion& pOther);
+
+ LL_ALIGN_16(LLVector4a mDefaultVec);
+ typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
+ joint_vec_map_t mJointScales;
+ joint_vec_map_t mJointOffsets;
+ // Backlink only; don't make this an LLPointer.
+ LLAvatarAppearance *mAvatar;
} LL_ALIGN_POSTFIX(16);
#endif // LL_LLPOLYSKELETALDISTORTION_H
diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp
index 75815482c9..a90e159820 100644
--- a/indra/llappearance/lltexglobalcolor.cpp
+++ b/indra/llappearance/lltexglobalcolor.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexlayerglobalcolor.cpp
* @brief Color for texture layers.
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,61 +36,61 @@ class LLWearable;
//-----------------------------------------------------------------------------
LLTexGlobalColor::LLTexGlobalColor(LLAvatarAppearance* appearance)
- :
- mAvatarAppearance(appearance),
- mInfo(NULL)
+ :
+ mAvatarAppearance(appearance),
+ mInfo(NULL)
{
}
LLTexGlobalColor::~LLTexGlobalColor()
{
- // mParamColorList are LLViewerVisualParam's and get deleted with ~LLCharacter()
- //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
+ // mParamColorList are LLViewerVisualParam's and get deleted with ~LLCharacter()
+ //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
}
BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info)
{
- llassert(mInfo == NULL);
- mInfo = info;
- //mID = info->mID; // No ID
-
- mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size());
- for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList)
- {
- LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this);
- if (!param_color->setInfo(color_info, TRUE))
- {
- mInfo = NULL;
- return FALSE;
- }
- mParamGlobalColorList.push_back(param_color);
- }
-
- return TRUE;
+ llassert(mInfo == NULL);
+ mInfo = info;
+ //mID = info->mID; // No ID
+
+ mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size());
+ for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList)
+ {
+ LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this);
+ if (!param_color->setInfo(color_info, TRUE))
+ {
+ mInfo = NULL;
+ return FALSE;
+ }
+ mParamGlobalColorList.push_back(param_color);
+ }
+
+ return TRUE;
}
LLColor4 LLTexGlobalColor::getColor() const
{
- // Sum of color params
- if (mParamGlobalColorList.empty())
- return LLColor4(1.f, 1.f, 1.f, 1.f);
+ // Sum of color params
+ if (mParamGlobalColorList.empty())
+ return LLColor4(1.f, 1.f, 1.f, 1.f);
- LLColor4 net_color(0.f, 0.f, 0.f, 0.f);
- LLTexLayer::calculateTexLayerColor(mParamGlobalColorList, net_color);
- return net_color;
+ LLColor4 net_color(0.f, 0.f, 0.f, 0.f);
+ LLTexLayer::calculateTexLayerColor(mParamGlobalColorList, net_color);
+ return net_color;
}
const std::string& LLTexGlobalColor::getName() const
-{
- return mInfo->mName;
+{
+ return mInfo->mName;
}
//-----------------------------------------------------------------------------
// LLTexParamGlobalColor
//-----------------------------------------------------------------------------
LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color)
- : LLTexLayerParamColor(tex_global_color->getAvatarAppearance()),
- mTexGlobalColor(tex_global_color)
+ : LLTexLayerParamColor(tex_global_color->getAvatarAppearance()),
+ mTexGlobalColor(tex_global_color)
{
}
@@ -98,8 +98,8 @@ LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color)
// LLTexParamGlobalColor
//-----------------------------------------------------------------------------
LLTexParamGlobalColor::LLTexParamGlobalColor(const LLTexParamGlobalColor& pOther)
- : LLTexLayerParamColor(pOther),
- mTexGlobalColor(pOther.mTexGlobalColor)
+ : LLTexLayerParamColor(pOther),
+ mTexGlobalColor(pOther.mTexGlobalColor)
{
}
@@ -112,12 +112,12 @@ LLTexParamGlobalColor::~LLTexParamGlobalColor()
/*virtual*/ LLViewerVisualParam* LLTexParamGlobalColor::cloneParam(LLWearable* wearable) const
{
- return new LLTexParamGlobalColor(*this);
+ return new LLTexParamGlobalColor(*this);
}
void LLTexParamGlobalColor::onGlobalColorChanged()
{
- mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor);
+ mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor);
}
//-----------------------------------------------------------------------------
@@ -131,35 +131,35 @@ LLTexGlobalColorInfo::LLTexGlobalColorInfo()
LLTexGlobalColorInfo::~LLTexGlobalColorInfo()
{
- for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer());
- mParamColorInfoList.clear();
+ for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer());
+ mParamColorInfoList.clear();
}
BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node)
{
- // name attribute
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- if (!node->getFastAttributeString(name_string, mName))
- {
- LL_WARNS() << "<global_color> element is missing name attribute." << LL_ENDL;
- return FALSE;
- }
- // <param> sub-element
- for (LLXmlTreeNode* child = node->getChildByName("param");
- child;
- child = node->getNextNamedChild())
- {
- if (child->getChildByName("param_color"))
- {
- // <param><param_color/></param>
- LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo();
- if (!info->parseXml(child))
- {
- delete info;
- return FALSE;
- }
- mParamColorInfoList.push_back(info);
- }
- }
- return TRUE;
+ // name attribute
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ if (!node->getFastAttributeString(name_string, mName))
+ {
+ LL_WARNS() << "<global_color> element is missing name attribute." << LL_ENDL;
+ return FALSE;
+ }
+ // <param> sub-element
+ for (LLXmlTreeNode* child = node->getChildByName("param");
+ child;
+ child = node->getNextNamedChild())
+ {
+ if (child->getChildByName("param_color"))
+ {
+ // <param><param_color/></param>
+ LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo();
+ if (!info->parseXml(child))
+ {
+ delete info;
+ return FALSE;
+ }
+ mParamColorInfoList.push_back(info);
+ }
+ }
+ return TRUE;
}
diff --git a/indra/llappearance/lltexglobalcolor.h b/indra/llappearance/lltexglobalcolor.h
index 3b426053de..183eb47a4a 100644
--- a/indra/llappearance/lltexglobalcolor.h
+++ b/indra/llappearance/lltexglobalcolor.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexglobalcolor.h
* @brief This is global texture color info used by llavatarappearance.
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,49 +37,49 @@ class LLTexGlobalColorInfo;
class LLTexGlobalColor
{
public:
- LLTexGlobalColor( LLAvatarAppearance* appearance );
- ~LLTexGlobalColor();
+ LLTexGlobalColor( LLAvatarAppearance* appearance );
+ ~LLTexGlobalColor();
+
+ LLTexGlobalColorInfo* getInfo() const { return mInfo; }
+ // This sets mInfo and calls initialization functions
+ BOOL setInfo(LLTexGlobalColorInfo *info);
- LLTexGlobalColorInfo* getInfo() const { return mInfo; }
- // This sets mInfo and calls initialization functions
- BOOL setInfo(LLTexGlobalColorInfo *info);
-
- LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
- LLColor4 getColor() const;
- const std::string& getName() const;
+ LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
+ LLColor4 getColor() const;
+ const std::string& getName() const;
private:
- param_color_list_t mParamGlobalColorList;
- LLAvatarAppearance* mAvatarAppearance; // just backlink, don't LLPointer
- LLTexGlobalColorInfo *mInfo;
+ param_color_list_t mParamGlobalColorList;
+ LLAvatarAppearance* mAvatarAppearance; // just backlink, don't LLPointer
+ LLTexGlobalColorInfo *mInfo;
};
// Used by llavatarappearance to determine skin/eye/hair color.
class LLTexGlobalColorInfo
{
- friend class LLTexGlobalColor;
+ friend class LLTexGlobalColor;
public:
- LLTexGlobalColorInfo();
- ~LLTexGlobalColorInfo();
+ LLTexGlobalColorInfo();
+ ~LLTexGlobalColorInfo();
- BOOL parseXml(LLXmlTreeNode* node);
+ BOOL parseXml(LLXmlTreeNode* node);
private:
- param_color_info_list_t mParamColorInfoList;
- std::string mName;
+ param_color_info_list_t mParamColorInfoList;
+ std::string mName;
};
class LLTexParamGlobalColor : public LLTexLayerParamColor
{
public:
- LLTexParamGlobalColor(LLTexGlobalColor *tex_color);
- virtual ~LLTexParamGlobalColor();
- /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
+ LLTexParamGlobalColor(LLTexGlobalColor *tex_color);
+ virtual ~LLTexParamGlobalColor();
+ /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
protected:
- LLTexParamGlobalColor(const LLTexParamGlobalColor& pOther);
- /*virtual*/ void onGlobalColorChanged();
+ LLTexParamGlobalColor(const LLTexParamGlobalColor& pOther);
+ /*virtual*/ void onGlobalColorChanged();
private:
- LLTexGlobalColor* mTexGlobalColor;
+ LLTexGlobalColor* mTexGlobalColor;
};
#endif
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index f9c7cb191d..4fc9ada15e 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexlayer.cpp
* @brief A texture layer. Used for avatars.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -52,39 +52,39 @@ extern std::string self_av_string();
class LLTexLayerInfo
{
- friend class LLTexLayer;
- friend class LLTexLayerTemplate;
- friend class LLTexLayerInterface;
+ friend class LLTexLayer;
+ friend class LLTexLayerTemplate;
+ friend class LLTexLayerInterface;
public:
- LLTexLayerInfo();
- ~LLTexLayerInfo();
+ LLTexLayerInfo();
+ ~LLTexLayerInfo();
- BOOL parseXml(LLXmlTreeNode* node);
- BOOL createVisualParams(LLAvatarAppearance *appearance);
- BOOL isUserSettable() { return mLocalTexture != -1; }
- S32 getLocalTexture() const { return mLocalTexture; }
- BOOL getOnlyAlpha() const { return mUseLocalTextureAlphaOnly; }
- std::string getName() const { return mName; }
+ BOOL parseXml(LLXmlTreeNode* node);
+ BOOL createVisualParams(LLAvatarAppearance *appearance);
+ BOOL isUserSettable() { return mLocalTexture != -1; }
+ S32 getLocalTexture() const { return mLocalTexture; }
+ BOOL getOnlyAlpha() const { return mUseLocalTextureAlphaOnly; }
+ std::string getName() const { return mName; }
private:
- std::string mName;
-
- BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer,
- LLTexLayerInterface::ERenderPass mRenderPass;
-
- std::string mGlobalColor;
- LLColor4 mFixedColor;
-
- S32 mLocalTexture;
- std::string mStaticImageFileName;
- BOOL mStaticImageIsMask;
- BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask
- BOOL mIsVisibilityMask;
-
- typedef std::vector< std::pair< std::string,BOOL > > morph_name_list_t;
- morph_name_list_t mMorphNameList;
- param_color_info_list_t mParamColorInfoList;
- param_alpha_info_list_t mParamAlphaInfoList;
+ std::string mName;
+
+ BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer,
+ LLTexLayerInterface::ERenderPass mRenderPass;
+
+ std::string mGlobalColor;
+ LLColor4 mFixedColor;
+
+ S32 mLocalTexture;
+ std::string mStaticImageFileName;
+ BOOL mStaticImageIsMask;
+ BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask
+ BOOL mIsVisibilityMask;
+
+ typedef std::vector< std::pair< std::string,BOOL > > morph_name_list_t;
+ morph_name_list_t mMorphNameList;
+ param_color_info_list_t mParamColorInfoList;
+ param_alpha_info_list_t mParamAlphaInfoList;
};
//-----------------------------------------------------------------------------
@@ -93,7 +93,7 @@ private:
//-----------------------------------------------------------------------------
LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* const owner) :
- mTexLayerSet(owner)
+ mTexLayerSet(owner)
{
}
@@ -103,67 +103,67 @@ LLTexLayerSetBuffer::~LLTexLayerSetBuffer()
void LLTexLayerSetBuffer::pushProjection() const
{
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.ortho(0.0f, getCompositeWidth(), 0.0f, getCompositeHeight(), -1.0f, 1.0f);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, getCompositeWidth(), 0.0f, getCompositeHeight(), -1.0f, 1.0f);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
}
void LLTexLayerSetBuffer::popProjection() const
{
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
}
// virtual
void LLTexLayerSetBuffer::preRenderTexLayerSet()
{
- // Set up an ortho projection
- pushProjection();
+ // Set up an ortho projection
+ pushProjection();
}
// virtual
void LLTexLayerSetBuffer::postRenderTexLayerSet(BOOL success)
{
- popProjection();
+ popProjection();
}
BOOL LLTexLayerSetBuffer::renderTexLayerSet(LLRenderTarget* bound_target)
{
- // Default color mask for tex layer render
- gGL.setColorMask(true, true);
+ // Default color mask for tex layer render
+ gGL.setColorMask(true, true);
+
+ BOOL success = TRUE;
- BOOL success = TRUE;
-
- gAlphaMaskProgram.bind();
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ gAlphaMaskProgram.bind();
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
- // Composite the color data
- LLGLSUIDefault gls_ui;
- success &= mTexLayerSet->render( getCompositeOriginX(), getCompositeOriginY(),
- getCompositeWidth(), getCompositeHeight(), bound_target );
- gGL.flush();
+ // Composite the color data
+ LLGLSUIDefault gls_ui;
+ success &= mTexLayerSet->render( getCompositeOriginX(), getCompositeOriginY(),
+ getCompositeWidth(), getCompositeHeight(), bound_target );
+ gGL.flush();
- midRenderTexLayerSet(success);
+ midRenderTexLayerSet(success);
- gAlphaMaskProgram.unbind();
+ gAlphaMaskProgram.unbind();
- LLVertexBuffer::unbind();
-
- // reset GL state
- gGL.setColorMask(true, true);
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ LLVertexBuffer::unbind();
- return success;
+ // reset GL state
+ gGL.setColorMask(true, true);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
+ return success;
}
//-----------------------------------------------------------------------------
@@ -172,79 +172,79 @@ BOOL LLTexLayerSetBuffer::renderTexLayerSet(LLRenderTarget* bound_target)
//-----------------------------------------------------------------------------
LLTexLayerSetInfo::LLTexLayerSetInfo() :
- mBodyRegion( "" ),
- mWidth( 512 ),
- mHeight( 512 ),
- mClearAlpha( TRUE )
+ mBodyRegion( "" ),
+ mWidth( 512 ),
+ mHeight( 512 ),
+ mClearAlpha( TRUE )
{
}
LLTexLayerSetInfo::~LLTexLayerSetInfo( )
{
- std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());
- mLayerInfoList.clear();
+ std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());
+ mLayerInfoList.clear();
}
BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node)
{
- llassert( node->hasName( "layer_set" ) );
- if( !node->hasName( "layer_set" ) )
- {
- return FALSE;
- }
-
- // body_region
- static LLStdStringHandle body_region_string = LLXmlTree::addAttributeString("body_region");
- if( !node->getFastAttributeString( body_region_string, mBodyRegion ) )
- {
- LL_WARNS() << "<layer_set> is missing body_region attribute" << LL_ENDL;
- return FALSE;
- }
-
- // width, height
- static LLStdStringHandle width_string = LLXmlTree::addAttributeString("width");
- if( !node->getFastAttributeS32( width_string, mWidth ) )
- {
- return FALSE;
- }
-
- static LLStdStringHandle height_string = LLXmlTree::addAttributeString("height");
- if( !node->getFastAttributeS32( height_string, mHeight ) )
- {
- return FALSE;
- }
-
- // Optional alpha component to apply after all compositing is complete.
- static LLStdStringHandle alpha_tga_file_string = LLXmlTree::addAttributeString("alpha_tga_file");
- node->getFastAttributeString( alpha_tga_file_string, mStaticAlphaFileName );
-
- static LLStdStringHandle clear_alpha_string = LLXmlTree::addAttributeString("clear_alpha");
- node->getFastAttributeBOOL( clear_alpha_string, mClearAlpha );
-
- // <layer>
- for (LLXmlTreeNode* child = node->getChildByName( "layer" );
- child;
- child = node->getNextNamedChild())
- {
- LLTexLayerInfo* info = new LLTexLayerInfo();
- if( !info->parseXml( child ))
- {
- delete info;
- return FALSE;
- }
- mLayerInfoList.push_back( info );
- }
- return TRUE;
+ llassert( node->hasName( "layer_set" ) );
+ if( !node->hasName( "layer_set" ) )
+ {
+ return FALSE;
+ }
+
+ // body_region
+ static LLStdStringHandle body_region_string = LLXmlTree::addAttributeString("body_region");
+ if( !node->getFastAttributeString( body_region_string, mBodyRegion ) )
+ {
+ LL_WARNS() << "<layer_set> is missing body_region attribute" << LL_ENDL;
+ return FALSE;
+ }
+
+ // width, height
+ static LLStdStringHandle width_string = LLXmlTree::addAttributeString("width");
+ if( !node->getFastAttributeS32( width_string, mWidth ) )
+ {
+ return FALSE;
+ }
+
+ static LLStdStringHandle height_string = LLXmlTree::addAttributeString("height");
+ if( !node->getFastAttributeS32( height_string, mHeight ) )
+ {
+ return FALSE;
+ }
+
+ // Optional alpha component to apply after all compositing is complete.
+ static LLStdStringHandle alpha_tga_file_string = LLXmlTree::addAttributeString("alpha_tga_file");
+ node->getFastAttributeString( alpha_tga_file_string, mStaticAlphaFileName );
+
+ static LLStdStringHandle clear_alpha_string = LLXmlTree::addAttributeString("clear_alpha");
+ node->getFastAttributeBOOL( clear_alpha_string, mClearAlpha );
+
+ // <layer>
+ for (LLXmlTreeNode* child = node->getChildByName( "layer" );
+ child;
+ child = node->getNextNamedChild())
+ {
+ LLTexLayerInfo* info = new LLTexLayerInfo();
+ if( !info->parseXml( child ))
+ {
+ delete info;
+ return FALSE;
+ }
+ mLayerInfoList.push_back( info );
+ }
+ return TRUE;
}
// creates visual params without generating layersets or layers
void LLTexLayerSetInfo::createVisualParams(LLAvatarAppearance *appearance)
{
- //layer_info_list_t mLayerInfoList;
- for (LLTexLayerInfo* layer_info : mLayerInfoList)
- {
- layer_info->createVisualParams(appearance);
- }
+ //layer_info_list_t mLayerInfoList;
+ for (LLTexLayerInfo* layer_info : mLayerInfoList)
+ {
+ layer_info->createVisualParams(appearance);
+ }
}
//-----------------------------------------------------------------------------
@@ -255,22 +255,22 @@ void LLTexLayerSetInfo::createVisualParams(LLAvatarAppearance *appearance)
BOOL LLTexLayerSet::sHasCaches = FALSE;
LLTexLayerSet::LLTexLayerSet(LLAvatarAppearance* const appearance) :
- mAvatarAppearance( appearance ),
- mIsVisible( TRUE ),
- mBakedTexIndex(LLAvatarAppearanceDefines::BAKED_HEAD),
- mInfo( NULL )
+ mAvatarAppearance( appearance ),
+ mIsVisible( TRUE ),
+ mBakedTexIndex(LLAvatarAppearanceDefines::BAKED_HEAD),
+ mInfo( NULL )
{
}
// virtual
LLTexLayerSet::~LLTexLayerSet()
{
- deleteCaches();
- std::for_each(mLayerList.begin(), mLayerList.end(), DeletePointer());
- mLayerList.clear();
+ deleteCaches();
+ std::for_each(mLayerList.begin(), mLayerList.end(), DeletePointer());
+ mLayerList.clear();
- std::for_each(mMaskLayerList.begin(), mMaskLayerList.end(), DeletePointer());
- mMaskLayerList.clear();
+ std::for_each(mMaskLayerList.begin(), mMaskLayerList.end(), DeletePointer());
+ mMaskLayerList.clear();
}
//-----------------------------------------------------------------------------
@@ -279,43 +279,43 @@ LLTexLayerSet::~LLTexLayerSet()
BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info)
{
- llassert(mInfo == NULL);
- mInfo = info;
- //mID = info->mID; // No ID
-
- mLayerList.reserve(info->mLayerInfoList.size());
- for (LLTexLayerInfo* layer_info : info->mLayerInfoList)
- {
- LLTexLayerInterface *layer = NULL;
- if (layer_info->isUserSettable())
- {
- layer = new LLTexLayerTemplate( this, getAvatarAppearance() );
- }
- else
- {
- layer = new LLTexLayer(this);
- }
- // this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar appearance
- if (!layer->setInfo(layer_info, NULL))
- {
- mInfo = NULL;
- return FALSE;
- }
- if (!layer->isVisibilityMask())
- {
- mLayerList.push_back( layer );
- }
- else
- {
- mMaskLayerList.push_back(layer);
- }
- }
-
- requestUpdate();
-
- stop_glerror();
-
- return TRUE;
+ llassert(mInfo == NULL);
+ mInfo = info;
+ //mID = info->mID; // No ID
+
+ mLayerList.reserve(info->mLayerInfoList.size());
+ for (LLTexLayerInfo* layer_info : info->mLayerInfoList)
+ {
+ LLTexLayerInterface *layer = NULL;
+ if (layer_info->isUserSettable())
+ {
+ layer = new LLTexLayerTemplate( this, getAvatarAppearance() );
+ }
+ else
+ {
+ layer = new LLTexLayer(this);
+ }
+ // this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar appearance
+ if (!layer->setInfo(layer_info, NULL))
+ {
+ mInfo = NULL;
+ return FALSE;
+ }
+ if (!layer->isVisibilityMask())
+ {
+ mLayerList.push_back( layer );
+ }
+ else
+ {
+ mMaskLayerList.push_back(layer);
+ }
+ }
+
+ requestUpdate();
+
+ stop_glerror();
+
+ return TRUE;
}
#if 0 // obsolete
@@ -325,235 +325,235 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info)
BOOL LLTexLayerSet::parseData(LLXmlTreeNode* node)
{
- LLTexLayerSetInfo *info = new LLTexLayerSetInfo;
+ LLTexLayerSetInfo *info = new LLTexLayerSetInfo;
- if (!info->parseXml(node))
- {
- delete info;
- return FALSE;
- }
- if (!setInfo(info))
- {
- delete info;
- return FALSE;
- }
- return TRUE;
+ if (!info->parseXml(node))
+ {
+ delete info;
+ return FALSE;
+ }
+ if (!setInfo(info))
+ {
+ delete info;
+ return FALSE;
+ }
+ return TRUE;
}
#endif
void LLTexLayerSet::deleteCaches()
{
- for(LLTexLayerInterface* layer : mLayerList)
- {
- layer->deleteCaches();
- }
- for (LLTexLayerInterface* layer : mMaskLayerList)
- {
- layer->deleteCaches();
- }
+ for(LLTexLayerInterface* layer : mLayerList)
+ {
+ layer->deleteCaches();
+ }
+ for (LLTexLayerInterface* layer : mMaskLayerList)
+ {
+ layer->deleteCaches();
+ }
}
BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target )
{
- BOOL success = TRUE;
- mIsVisible = TRUE;
-
- if (mMaskLayerList.size() > 0)
- {
- for (LLTexLayerInterface* layer : mMaskLayerList)
- {
- if (layer->isInvisibleAlphaMask())
- {
- mIsVisible = FALSE;
- }
- }
- }
-
- LLGLSUIDefault gls_ui;
- LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE);
- gGL.setColorMask(true, true);
-
- // clear buffer area to ensure we don't pick up UI elements
- {
- gGL.flush();
- gAlphaMaskProgram.setMinimumAlpha(0.0f);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4f( 0.f, 0.f, 0.f, 1.f );
-
- gl_rect_2d_simple( width, height );
-
- gGL.flush();
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
-
- if (mIsVisible)
- {
- // composite color layers
- for(LLTexLayerInterface* layer : mLayerList)
- {
- if (layer->getRenderPass() == LLTexLayer::RP_COLOR)
- {
- gGL.flush();
- success &= layer->render(x, y, width, height, bound_target);
- gGL.flush();
- }
- }
-
- renderAlphaMaskTextures(x, y, width, height, bound_target, false);
-
- stop_glerror();
- }
- else
- {
- gGL.flush();
-
- gGL.setSceneBlendType(LLRender::BT_REPLACE);
- gAlphaMaskProgram.setMinimumAlpha(0.f);
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4f( 0.f, 0.f, 0.f, 0.f );
-
- gl_rect_2d_simple( width, height );
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
-
- gGL.flush();
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
-
- return success;
-}
-
-
-BOOL LLTexLayerSet::isBodyRegion(const std::string& region) const
-{
- return mInfo->mBodyRegion == region;
-}
-
-const std::string LLTexLayerSet::getBodyRegionName() const
-{
- return mInfo->mBodyRegion;
+ BOOL success = TRUE;
+ mIsVisible = TRUE;
+
+ if (mMaskLayerList.size() > 0)
+ {
+ for (LLTexLayerInterface* layer : mMaskLayerList)
+ {
+ if (layer->isInvisibleAlphaMask())
+ {
+ mIsVisible = FALSE;
+ }
+ }
+ }
+
+ LLGLSUIDefault gls_ui;
+ LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE);
+ gGL.setColorMask(true, true);
+
+ // clear buffer area to ensure we don't pick up UI elements
+ {
+ gGL.flush();
+ gAlphaMaskProgram.setMinimumAlpha(0.0f);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4f( 0.f, 0.f, 0.f, 1.f );
+
+ gl_rect_2d_simple( width, height );
+
+ gGL.flush();
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+
+ if (mIsVisible)
+ {
+ // composite color layers
+ for(LLTexLayerInterface* layer : mLayerList)
+ {
+ if (layer->getRenderPass() == LLTexLayer::RP_COLOR)
+ {
+ gGL.flush();
+ success &= layer->render(x, y, width, height, bound_target);
+ gGL.flush();
+ }
+ }
+
+ renderAlphaMaskTextures(x, y, width, height, bound_target, false);
+
+ stop_glerror();
+ }
+ else
+ {
+ gGL.flush();
+
+ gGL.setSceneBlendType(LLRender::BT_REPLACE);
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4f( 0.f, 0.f, 0.f, 0.f );
+
+ gl_rect_2d_simple( width, height );
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
+ gGL.flush();
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+
+ return success;
+}
+
+
+BOOL LLTexLayerSet::isBodyRegion(const std::string& region) const
+{
+ return mInfo->mBodyRegion == region;
+}
+
+const std::string LLTexLayerSet::getBodyRegionName() const
+{
+ return mInfo->mBodyRegion;
}
void LLTexLayerSet::destroyComposite()
{
- if( mComposite )
- {
- mComposite = NULL;
- }
+ if( mComposite )
+ {
+ mComposite = NULL;
+ }
}
LLTexLayerSetBuffer* LLTexLayerSet::getComposite()
{
- if (!mComposite)
- {
- createComposite();
- }
- return mComposite;
+ if (!mComposite)
+ {
+ createComposite();
+ }
+ return mComposite;
}
const LLTexLayerSetBuffer* LLTexLayerSet::getComposite() const
{
- return mComposite;
+ return mComposite;
}
void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height, LLRenderTarget* bound_target)
{
LL_PROFILE_ZONE_SCOPED;
- memset(data, 255, width * height);
+ memset(data, 255, width * height);
- for(LLTexLayerInterface* layer : mLayerList)
- {
- layer->gatherAlphaMasks(data, origin_x, origin_y, width, height, bound_target);
- }
-
- // Set alpha back to that of our alpha masks.
- renderAlphaMaskTextures(origin_x, origin_y, width, height, bound_target, true);
+ for(LLTexLayerInterface* layer : mLayerList)
+ {
+ layer->gatherAlphaMasks(data, origin_x, origin_y, width, height, bound_target);
+ }
+
+ // Set alpha back to that of our alpha masks.
+ renderAlphaMaskTextures(origin_x, origin_y, width, height, bound_target, true);
}
void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target, bool forceClear)
{
LL_PROFILE_ZONE_SCOPED;
- const LLTexLayerSetInfo *info = getInfo();
-
- gGL.setColorMask(false, true);
- gGL.setSceneBlendType(LLRender::BT_REPLACE);
-
- // (Optionally) replace alpha with a single component image from a tga file.
- if (!info->mStaticAlphaFileName.empty())
- {
- gGL.flush();
- {
- LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(info->mStaticAlphaFileName, TRUE);
- if( tex )
- {
- LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->bind(tex);
- gl_rect_2d_simple_tex( width, height );
- }
- }
- gGL.flush();
- }
- else if (forceClear || info->mClearAlpha || (mMaskLayerList.size() > 0))
- {
- // Set the alpha channel to one (clean up after previous blending)
- gGL.flush();
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4f( 0.f, 0.f, 0.f, 1.f );
-
- gl_rect_2d_simple( width, height );
-
- gGL.flush();
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
-
- // (Optional) Mask out part of the baked texture with alpha masks
- // will still have an effect even if mClearAlpha is set or the alpha component was replaced
- if (mMaskLayerList.size() > 0)
- {
- gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA);
- for (LLTexLayerInterface* layer : mMaskLayerList)
- {
- gGL.flush();
- layer->blendAlphaTexture(x,y,width, height);
- gGL.flush();
- }
-
- }
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- gGL.setColorMask(true, true);
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ const LLTexLayerSetInfo *info = getInfo();
+
+ gGL.setColorMask(false, true);
+ gGL.setSceneBlendType(LLRender::BT_REPLACE);
+
+ // (Optionally) replace alpha with a single component image from a tga file.
+ if (!info->mStaticAlphaFileName.empty())
+ {
+ gGL.flush();
+ {
+ LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(info->mStaticAlphaFileName, TRUE);
+ if( tex )
+ {
+ LLGLSUIDefault gls_ui;
+ gGL.getTexUnit(0)->bind(tex);
+ gl_rect_2d_simple_tex( width, height );
+ }
+ }
+ gGL.flush();
+ }
+ else if (forceClear || info->mClearAlpha || (mMaskLayerList.size() > 0))
+ {
+ // Set the alpha channel to one (clean up after previous blending)
+ gGL.flush();
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4f( 0.f, 0.f, 0.f, 1.f );
+
+ gl_rect_2d_simple( width, height );
+
+ gGL.flush();
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+
+ // (Optional) Mask out part of the baked texture with alpha masks
+ // will still have an effect even if mClearAlpha is set or the alpha component was replaced
+ if (mMaskLayerList.size() > 0)
+ {
+ gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA);
+ for (LLTexLayerInterface* layer : mMaskLayerList)
+ {
+ gGL.flush();
+ layer->blendAlphaTexture(x,y,width, height);
+ gGL.flush();
+ }
+
+ }
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ gGL.setColorMask(true, true);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components)
{
- mAvatarAppearance->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex);
+ mAvatarAppearance->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex);
}
BOOL LLTexLayerSet::isMorphValid() const
{
- for(const LLTexLayerInterface* layer : mLayerList)
- {
- if (layer && !layer->isMorphValid())
- {
- return FALSE;
- }
- }
- return TRUE;
+ for(const LLTexLayerInterface* layer : mLayerList)
+ {
+ if (layer && !layer->isMorphValid())
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
}
void LLTexLayerSet::invalidateMorphMasks()
{
- for(LLTexLayerInterface* layer : mLayerList)
- {
- if (layer)
- {
- layer->invalidateMorphMasks();
- }
- }
+ for(LLTexLayerInterface* layer : mLayerList)
+ {
+ if (layer)
+ {
+ layer->invalidateMorphMasks();
+ }
+ }
}
@@ -561,419 +561,419 @@ void LLTexLayerSet::invalidateMorphMasks()
// LLTexLayerInfo
//-----------------------------------------------------------------------------
LLTexLayerInfo::LLTexLayerInfo() :
- mWriteAllChannels( FALSE ),
- mRenderPass(LLTexLayer::RP_COLOR),
- mFixedColor( 0.f, 0.f, 0.f, 0.f ),
- mLocalTexture( -1 ),
- mStaticImageIsMask( FALSE ),
- mUseLocalTextureAlphaOnly(FALSE),
- mIsVisibilityMask(FALSE)
+ mWriteAllChannels( FALSE ),
+ mRenderPass(LLTexLayer::RP_COLOR),
+ mFixedColor( 0.f, 0.f, 0.f, 0.f ),
+ mLocalTexture( -1 ),
+ mStaticImageIsMask( FALSE ),
+ mUseLocalTextureAlphaOnly(FALSE),
+ mIsVisibilityMask(FALSE)
{
}
LLTexLayerInfo::~LLTexLayerInfo( )
{
- std::for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer());
- mParamColorInfoList.clear();
- std::for_each(mParamAlphaInfoList.begin(), mParamAlphaInfoList.end(), DeletePointer());
- mParamAlphaInfoList.clear();
+ std::for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer());
+ mParamColorInfoList.clear();
+ std::for_each(mParamAlphaInfoList.begin(), mParamAlphaInfoList.end(), DeletePointer());
+ mParamAlphaInfoList.clear();
}
BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
{
- llassert( node->hasName( "layer" ) );
-
- // name attribute
- static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
- if( !node->getFastAttributeString( name_string, mName ) )
- {
- return FALSE;
- }
-
- static LLStdStringHandle write_all_channels_string = LLXmlTree::addAttributeString("write_all_channels");
- node->getFastAttributeBOOL( write_all_channels_string, mWriteAllChannels );
-
- std::string render_pass_name;
- static LLStdStringHandle render_pass_string = LLXmlTree::addAttributeString("render_pass");
- if( node->getFastAttributeString( render_pass_string, render_pass_name ) )
- {
- if( render_pass_name == "bump" )
- {
- mRenderPass = LLTexLayer::RP_BUMP;
- }
- }
-
- // Note: layers can have either a "global_color" attrib, a "fixed_color" attrib, or a <param_color> child.
- // global color attribute (optional)
- static LLStdStringHandle global_color_string = LLXmlTree::addAttributeString("global_color");
- node->getFastAttributeString( global_color_string, mGlobalColor );
-
- // Visibility mask (optional)
- BOOL is_visibility;
- static LLStdStringHandle visibility_mask_string = LLXmlTree::addAttributeString("visibility_mask");
- if (node->getFastAttributeBOOL(visibility_mask_string, is_visibility))
- {
- mIsVisibilityMask = is_visibility;
- }
-
- // color attribute (optional)
- LLColor4U color4u;
- static LLStdStringHandle fixed_color_string = LLXmlTree::addAttributeString("fixed_color");
- if( node->getFastAttributeColor4U( fixed_color_string, color4u ) )
- {
- mFixedColor.setVec( color4u );
- }
-
- // <texture> optional sub-element
- for (LLXmlTreeNode* texture_node = node->getChildByName( "texture" );
- texture_node;
- texture_node = node->getNextNamedChild())
- {
- std::string local_texture_name;
- static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file");
- static LLStdStringHandle local_texture_string = LLXmlTree::addAttributeString("local_texture");
- static LLStdStringHandle file_is_mask_string = LLXmlTree::addAttributeString("file_is_mask");
- static LLStdStringHandle local_texture_alpha_only_string = LLXmlTree::addAttributeString("local_texture_alpha_only");
- if( texture_node->getFastAttributeString( tga_file_string, mStaticImageFileName ) )
- {
- texture_node->getFastAttributeBOOL( file_is_mask_string, mStaticImageIsMask );
- }
- else if (texture_node->getFastAttributeString(local_texture_string, local_texture_name))
- {
- texture_node->getFastAttributeBOOL( local_texture_alpha_only_string, mUseLocalTextureAlphaOnly );
-
- /* if ("upper_shirt" == local_texture_name)
- mLocalTexture = TEX_UPPER_SHIRT; */
- mLocalTexture = TEX_NUM_INDICES;
- for (const LLAvatarAppearanceDictionary::Textures::value_type& dict_pair : LLAvatarAppearance::getDictionary()->getTextures())
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = dict_pair.second;
- if (local_texture_name == texture_dict->mName)
- {
- mLocalTexture = dict_pair.first;
- break;
- }
- }
- if (mLocalTexture == TEX_NUM_INDICES)
- {
- LL_WARNS() << "<texture> element has invalid local_texture attribute: " << mName << " " << local_texture_name << LL_ENDL;
- return FALSE;
- }
- }
- else
- {
- LL_WARNS() << "<texture> element is missing a required attribute. " << mName << LL_ENDL;
- return FALSE;
- }
- }
-
- for (LLXmlTreeNode* maskNode = node->getChildByName( "morph_mask" );
- maskNode;
- maskNode = node->getNextNamedChild())
- {
- std::string morph_name;
- static LLStdStringHandle morph_name_string = LLXmlTree::addAttributeString("morph_name");
- if (maskNode->getFastAttributeString(morph_name_string, morph_name))
- {
- BOOL invert = FALSE;
- static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert");
- maskNode->getFastAttributeBOOL(invert_string, invert);
- mMorphNameList.push_back(std::pair<std::string,BOOL>(morph_name,invert));
- }
- }
-
- // <param> optional sub-element (color or alpha params)
- for (LLXmlTreeNode* child = node->getChildByName( "param" );
- child;
- child = node->getNextNamedChild())
- {
- if( child->getChildByName( "param_color" ) )
- {
- // <param><param_color/></param>
- LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo();
- if (!info->parseXml(child))
- {
- delete info;
- return FALSE;
- }
- mParamColorInfoList.push_back(info);
- }
- else if( child->getChildByName( "param_alpha" ) )
- {
- // <param><param_alpha/></param>
- LLTexLayerParamAlphaInfo* info = new LLTexLayerParamAlphaInfo( );
- if (!info->parseXml(child))
- {
- delete info;
- return FALSE;
- }
- mParamAlphaInfoList.push_back(info);
- }
- }
-
- return TRUE;
+ llassert( node->hasName( "layer" ) );
+
+ // name attribute
+ static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+ if( !node->getFastAttributeString( name_string, mName ) )
+ {
+ return FALSE;
+ }
+
+ static LLStdStringHandle write_all_channels_string = LLXmlTree::addAttributeString("write_all_channels");
+ node->getFastAttributeBOOL( write_all_channels_string, mWriteAllChannels );
+
+ std::string render_pass_name;
+ static LLStdStringHandle render_pass_string = LLXmlTree::addAttributeString("render_pass");
+ if( node->getFastAttributeString( render_pass_string, render_pass_name ) )
+ {
+ if( render_pass_name == "bump" )
+ {
+ mRenderPass = LLTexLayer::RP_BUMP;
+ }
+ }
+
+ // Note: layers can have either a "global_color" attrib, a "fixed_color" attrib, or a <param_color> child.
+ // global color attribute (optional)
+ static LLStdStringHandle global_color_string = LLXmlTree::addAttributeString("global_color");
+ node->getFastAttributeString( global_color_string, mGlobalColor );
+
+ // Visibility mask (optional)
+ BOOL is_visibility;
+ static LLStdStringHandle visibility_mask_string = LLXmlTree::addAttributeString("visibility_mask");
+ if (node->getFastAttributeBOOL(visibility_mask_string, is_visibility))
+ {
+ mIsVisibilityMask = is_visibility;
+ }
+
+ // color attribute (optional)
+ LLColor4U color4u;
+ static LLStdStringHandle fixed_color_string = LLXmlTree::addAttributeString("fixed_color");
+ if( node->getFastAttributeColor4U( fixed_color_string, color4u ) )
+ {
+ mFixedColor.setVec( color4u );
+ }
+
+ // <texture> optional sub-element
+ for (LLXmlTreeNode* texture_node = node->getChildByName( "texture" );
+ texture_node;
+ texture_node = node->getNextNamedChild())
+ {
+ std::string local_texture_name;
+ static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file");
+ static LLStdStringHandle local_texture_string = LLXmlTree::addAttributeString("local_texture");
+ static LLStdStringHandle file_is_mask_string = LLXmlTree::addAttributeString("file_is_mask");
+ static LLStdStringHandle local_texture_alpha_only_string = LLXmlTree::addAttributeString("local_texture_alpha_only");
+ if( texture_node->getFastAttributeString( tga_file_string, mStaticImageFileName ) )
+ {
+ texture_node->getFastAttributeBOOL( file_is_mask_string, mStaticImageIsMask );
+ }
+ else if (texture_node->getFastAttributeString(local_texture_string, local_texture_name))
+ {
+ texture_node->getFastAttributeBOOL( local_texture_alpha_only_string, mUseLocalTextureAlphaOnly );
+
+ /* if ("upper_shirt" == local_texture_name)
+ mLocalTexture = TEX_UPPER_SHIRT; */
+ mLocalTexture = TEX_NUM_INDICES;
+ for (const LLAvatarAppearanceDictionary::Textures::value_type& dict_pair : LLAvatarAppearance::getDictionary()->getTextures())
+ {
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = dict_pair.second;
+ if (local_texture_name == texture_dict->mName)
+ {
+ mLocalTexture = dict_pair.first;
+ break;
+ }
+ }
+ if (mLocalTexture == TEX_NUM_INDICES)
+ {
+ LL_WARNS() << "<texture> element has invalid local_texture attribute: " << mName << " " << local_texture_name << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "<texture> element is missing a required attribute. " << mName << LL_ENDL;
+ return FALSE;
+ }
+ }
+
+ for (LLXmlTreeNode* maskNode = node->getChildByName( "morph_mask" );
+ maskNode;
+ maskNode = node->getNextNamedChild())
+ {
+ std::string morph_name;
+ static LLStdStringHandle morph_name_string = LLXmlTree::addAttributeString("morph_name");
+ if (maskNode->getFastAttributeString(morph_name_string, morph_name))
+ {
+ BOOL invert = FALSE;
+ static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert");
+ maskNode->getFastAttributeBOOL(invert_string, invert);
+ mMorphNameList.push_back(std::pair<std::string,BOOL>(morph_name,invert));
+ }
+ }
+
+ // <param> optional sub-element (color or alpha params)
+ for (LLXmlTreeNode* child = node->getChildByName( "param" );
+ child;
+ child = node->getNextNamedChild())
+ {
+ if( child->getChildByName( "param_color" ) )
+ {
+ // <param><param_color/></param>
+ LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo();
+ if (!info->parseXml(child))
+ {
+ delete info;
+ return FALSE;
+ }
+ mParamColorInfoList.push_back(info);
+ }
+ else if( child->getChildByName( "param_alpha" ) )
+ {
+ // <param><param_alpha/></param>
+ LLTexLayerParamAlphaInfo* info = new LLTexLayerParamAlphaInfo( );
+ if (!info->parseXml(child))
+ {
+ delete info;
+ return FALSE;
+ }
+ mParamAlphaInfoList.push_back(info);
+ }
+ }
+
+ return TRUE;
}
BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance)
{
- BOOL success = TRUE;
- for (LLTexLayerParamColorInfo* color_info : mParamColorInfoList)
- {
- LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance);
- if (!param_color->setInfo(color_info, TRUE))
- {
- LL_WARNS() << "NULL TexLayer Color Param could not be added to visual param list. Deleting." << LL_ENDL;
- delete param_color;
- success = FALSE;
- }
- }
-
- for (LLTexLayerParamAlphaInfo* alpha_info : mParamAlphaInfoList)
- {
- LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance);
- if (!param_alpha->setInfo(alpha_info, TRUE))
- {
- LL_WARNS() << "NULL TexLayer Alpha Param could not be added to visual param list. Deleting." << LL_ENDL;
- delete param_alpha;
- success = FALSE;
- }
- }
-
- return success;
+ BOOL success = TRUE;
+ for (LLTexLayerParamColorInfo* color_info : mParamColorInfoList)
+ {
+ LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance);
+ if (!param_color->setInfo(color_info, TRUE))
+ {
+ LL_WARNS() << "NULL TexLayer Color Param could not be added to visual param list. Deleting." << LL_ENDL;
+ delete param_color;
+ success = FALSE;
+ }
+ }
+
+ for (LLTexLayerParamAlphaInfo* alpha_info : mParamAlphaInfoList)
+ {
+ LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance);
+ if (!param_alpha->setInfo(alpha_info, TRUE))
+ {
+ LL_WARNS() << "NULL TexLayer Alpha Param could not be added to visual param list. Deleting." << LL_ENDL;
+ delete param_alpha;
+ success = FALSE;
+ }
+ }
+
+ return success;
}
LLTexLayerInterface::LLTexLayerInterface(LLTexLayerSet* const layer_set):
- mTexLayerSet( layer_set ),
- mMorphMasksValid( FALSE ),
- mInfo(NULL),
- mHasMorph(FALSE)
+ mTexLayerSet( layer_set ),
+ mMorphMasksValid( FALSE ),
+ mInfo(NULL),
+ mHasMorph(FALSE)
{
}
LLTexLayerInterface::LLTexLayerInterface(const LLTexLayerInterface &layer, LLWearable *wearable):
- mTexLayerSet( layer.mTexLayerSet ),
- mInfo(NULL)
+ mTexLayerSet( layer.mTexLayerSet ),
+ mInfo(NULL)
{
- // don't add visual params for cloned layers
- setInfo(layer.getInfo(), wearable);
+ // don't add visual params for cloned layers
+ setInfo(layer.getInfo(), wearable);
- mHasMorph = layer.mHasMorph;
+ mHasMorph = layer.mHasMorph;
}
BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearable ) // This sets mInfo and calls initialization functions
{
- // setInfo should only be called once. Code is not robust enough to handle redefinition of a texlayer.
- // Not a critical warning, but could be useful for debugging later issues. -Nyx
- if (mInfo != NULL)
- {
- LL_WARNS() << "mInfo != NULL" << LL_ENDL;
- }
- mInfo = info;
- //mID = info->mID; // No ID
-
- mParamColorList.reserve(mInfo->mParamColorInfoList.size());
- for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList)
- {
- LLTexLayerParamColor* param_color;
- if (!wearable)
- {
- param_color = new LLTexLayerParamColor(this);
- if (!param_color->setInfo(color_info, TRUE))
- {
- mInfo = NULL;
- return FALSE;
- }
- }
- else
- {
- param_color = (LLTexLayerParamColor*)wearable->getVisualParam(color_info->getID());
- if (!param_color)
- {
- mInfo = NULL;
- return FALSE;
- }
- }
- mParamColorList.push_back( param_color );
- }
-
- mParamAlphaList.reserve(mInfo->mParamAlphaInfoList.size());
- for (LLTexLayerParamAlphaInfo* alpha_info : mInfo->mParamAlphaInfoList)
- {
- LLTexLayerParamAlpha* param_alpha;
- if (!wearable)
- {
- param_alpha = new LLTexLayerParamAlpha( this );
- if (!param_alpha->setInfo(alpha_info, TRUE))
- {
- mInfo = NULL;
- return FALSE;
- }
- }
- else
- {
- param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam(alpha_info->getID());
- if (!param_alpha)
- {
- mInfo = NULL;
- return FALSE;
- }
- }
- mParamAlphaList.push_back( param_alpha );
- }
-
- return TRUE;
+ // setInfo should only be called once. Code is not robust enough to handle redefinition of a texlayer.
+ // Not a critical warning, but could be useful for debugging later issues. -Nyx
+ if (mInfo != NULL)
+ {
+ LL_WARNS() << "mInfo != NULL" << LL_ENDL;
+ }
+ mInfo = info;
+ //mID = info->mID; // No ID
+
+ mParamColorList.reserve(mInfo->mParamColorInfoList.size());
+ for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList)
+ {
+ LLTexLayerParamColor* param_color;
+ if (!wearable)
+ {
+ param_color = new LLTexLayerParamColor(this);
+ if (!param_color->setInfo(color_info, TRUE))
+ {
+ mInfo = NULL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ param_color = (LLTexLayerParamColor*)wearable->getVisualParam(color_info->getID());
+ if (!param_color)
+ {
+ mInfo = NULL;
+ return FALSE;
+ }
+ }
+ mParamColorList.push_back( param_color );
+ }
+
+ mParamAlphaList.reserve(mInfo->mParamAlphaInfoList.size());
+ for (LLTexLayerParamAlphaInfo* alpha_info : mInfo->mParamAlphaInfoList)
+ {
+ LLTexLayerParamAlpha* param_alpha;
+ if (!wearable)
+ {
+ param_alpha = new LLTexLayerParamAlpha( this );
+ if (!param_alpha->setInfo(alpha_info, TRUE))
+ {
+ mInfo = NULL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam(alpha_info->getID());
+ if (!param_alpha)
+ {
+ mInfo = NULL;
+ return FALSE;
+ }
+ }
+ mParamAlphaList.push_back( param_alpha );
+ }
+
+ return TRUE;
}
/*virtual*/ void LLTexLayerInterface::requestUpdate()
{
- mTexLayerSet->requestUpdate();
+ mTexLayerSet->requestUpdate();
}
const std::string& LLTexLayerInterface::getName() const
{
- return mInfo->mName;
+ return mInfo->mName;
}
ETextureIndex LLTexLayerInterface::getLocalTextureIndex() const
{
- return (ETextureIndex) mInfo->mLocalTexture;
+ return (ETextureIndex) mInfo->mLocalTexture;
}
LLWearableType::EType LLTexLayerInterface::getWearableType() const
{
- ETextureIndex te = getLocalTextureIndex();
- if (TEX_INVALID == te)
- {
- LLWearableType::EType type = LLWearableType::WT_INVALID;
-
- for (LLTexLayerParamColor* param : mParamColorList)
- {
- if (param)
- {
- LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType();
- if (new_type != LLWearableType::WT_INVALID && new_type != type)
- {
- if (type != LLWearableType::WT_INVALID)
- {
- return LLWearableType::WT_INVALID;
- }
- type = new_type;
- }
- }
- }
-
- for (LLTexLayerParamAlpha* param : mParamAlphaList)
- {
- if (param)
- {
- LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType();
- if (new_type != LLWearableType::WT_INVALID && new_type != type)
- {
- if (type != LLWearableType::WT_INVALID)
- {
- return LLWearableType::WT_INVALID;
- }
- type = new_type;
- }
- }
- }
-
- return type;
- }
- return LLAvatarAppearance::getDictionary()->getTEWearableType(te);
+ ETextureIndex te = getLocalTextureIndex();
+ if (TEX_INVALID == te)
+ {
+ LLWearableType::EType type = LLWearableType::WT_INVALID;
+
+ for (LLTexLayerParamColor* param : mParamColorList)
+ {
+ if (param)
+ {
+ LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType();
+ if (new_type != LLWearableType::WT_INVALID && new_type != type)
+ {
+ if (type != LLWearableType::WT_INVALID)
+ {
+ return LLWearableType::WT_INVALID;
+ }
+ type = new_type;
+ }
+ }
+ }
+
+ for (LLTexLayerParamAlpha* param : mParamAlphaList)
+ {
+ if (param)
+ {
+ LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType();
+ if (new_type != LLWearableType::WT_INVALID && new_type != type)
+ {
+ if (type != LLWearableType::WT_INVALID)
+ {
+ return LLWearableType::WT_INVALID;
+ }
+ type = new_type;
+ }
+ }
+ }
+
+ return type;
+ }
+ return LLAvatarAppearance::getDictionary()->getTEWearableType(te);
}
LLTexLayerInterface::ERenderPass LLTexLayerInterface::getRenderPass() const
{
- return mInfo->mRenderPass;
+ return mInfo->mRenderPass;
}
const std::string& LLTexLayerInterface::getGlobalColor() const
{
- return mInfo->mGlobalColor;
+ return mInfo->mGlobalColor;
}
BOOL LLTexLayerInterface::isVisibilityMask() const
{
- return mInfo->mIsVisibilityMask;
+ return mInfo->mIsVisibilityMask;
}
void LLTexLayerInterface::invalidateMorphMasks()
{
- mMorphMasksValid = FALSE;
+ mMorphMasksValid = FALSE;
}
LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const
{
- LLViewerVisualParam *result = NULL;
- for (LLTexLayerParamColor* param : mParamColorList)
- {
- if (param->getID() == index)
- {
- result = param;
- }
- }
- for (LLTexLayerParamAlpha* param : mParamAlphaList)
- {
- if (param->getID() == index)
- {
- result = param;
- }
- }
-
- return result;
+ LLViewerVisualParam *result = NULL;
+ for (LLTexLayerParamColor* param : mParamColorList)
+ {
+ if (param->getID() == index)
+ {
+ result = param;
+ }
+ }
+ for (LLTexLayerParamAlpha* param : mParamAlphaList)
+ {
+ if (param->getID() == index)
+ {
+ result = param;
+ }
+ }
+
+ return result;
}
//-----------------------------------------------------------------------------
// LLTexLayer
// A single texture layer, consisting of:
-// * color, consisting of either
-// * one or more color parameters (weighted colors)
-// * a reference to a global color
-// * a fixed color with non-zero alpha
-// * opaque white (the default)
-// * (optional) a texture defined by either
-// * a GUID
-// * a texture entry index (TE)
-// * (optional) one or more alpha parameters (weighted alpha textures)
+// * color, consisting of either
+// * one or more color parameters (weighted colors)
+// * a reference to a global color
+// * a fixed color with non-zero alpha
+// * opaque white (the default)
+// * (optional) a texture defined by either
+// * a GUID
+// * a texture entry index (TE)
+// * (optional) one or more alpha parameters (weighted alpha textures)
//-----------------------------------------------------------------------------
LLTexLayer::LLTexLayer(LLTexLayerSet* const layer_set) :
- LLTexLayerInterface( layer_set ),
- mLocalTextureObject(NULL)
+ LLTexLayerInterface( layer_set ),
+ mLocalTextureObject(NULL)
{
}
LLTexLayer::LLTexLayer(const LLTexLayer &layer, LLWearable *wearable) :
- LLTexLayerInterface( layer, wearable ),
- mLocalTextureObject(NULL)
+ LLTexLayerInterface( layer, wearable ),
+ mLocalTextureObject(NULL)
{
}
LLTexLayer::LLTexLayer(const LLTexLayerTemplate &layer_template, LLLocalTextureObject *lto, LLWearable *wearable) :
- LLTexLayerInterface( layer_template, wearable ),
- mLocalTextureObject(lto)
+ LLTexLayerInterface( layer_template, wearable ),
+ mLocalTextureObject(lto)
{
}
LLTexLayer::~LLTexLayer()
{
- // mParamAlphaList and mParamColorList are LLViewerVisualParam's and get
- // deleted with ~LLCharacter()
- //std::for_each(mParamAlphaList.begin(), mParamAlphaList.end(), DeletePointer());
- //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
-
- for (alpha_cache_t::value_type& alpha_pair : mAlphaCache)
- {
- U8* alpha_data = alpha_pair.second;
- ll_aligned_free_32(alpha_data);
- }
+ // mParamAlphaList and mParamColorList are LLViewerVisualParam's and get
+ // deleted with ~LLCharacter()
+ //std::for_each(mParamAlphaList.begin(), mParamAlphaList.end(), DeletePointer());
+ //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
+
+ for (alpha_cache_t::value_type& alpha_pair : mAlphaCache)
+ {
+ U8* alpha_data = alpha_pair.second;
+ ll_aligned_free_32(alpha_data);
+ }
}
void LLTexLayer::asLLSD(LLSD& sd) const
{
- // *TODO: Finish
- sd["id"] = getUUID();
+ // *TODO: Finish
+ sd["id"] = getUUID();
}
//-----------------------------------------------------------------------------
@@ -982,439 +982,439 @@ void LLTexLayer::asLLSD(LLSD& sd) const
BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable )
{
- return LLTexLayerInterface::setInfo(info, wearable);
+ return LLTexLayerInterface::setInfo(info, wearable);
}
-//static
+//static
void LLTexLayer::calculateTexLayerColor(const param_color_list_t &param_list, LLColor4 &net_color)
{
- for (const LLTexLayerParamColor* param : param_list)
- {
- LLColor4 param_net = param->getNetColor();
- const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)param->getInfo();
- switch(info->getOperation())
- {
- case LLTexLayerParamColor::OP_ADD:
- net_color += param_net;
- break;
- case LLTexLayerParamColor::OP_MULTIPLY:
- net_color = net_color * param_net;
- break;
- case LLTexLayerParamColor::OP_BLEND:
- net_color = lerp(net_color, param_net, param->getWeight());
- break;
- default:
- llassert(0);
- break;
- }
- }
- net_color.clamp();
+ for (const LLTexLayerParamColor* param : param_list)
+ {
+ LLColor4 param_net = param->getNetColor();
+ const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)param->getInfo();
+ switch(info->getOperation())
+ {
+ case LLTexLayerParamColor::OP_ADD:
+ net_color += param_net;
+ break;
+ case LLTexLayerParamColor::OP_MULTIPLY:
+ net_color = net_color * param_net;
+ break;
+ case LLTexLayerParamColor::OP_BLEND:
+ net_color = lerp(net_color, param_net, param->getWeight());
+ break;
+ default:
+ llassert(0);
+ break;
+ }
+ }
+ net_color.clamp();
}
/*virtual*/ void LLTexLayer::deleteCaches()
{
- // Only need to delete caches for alpha params. Color params don't hold extra memory
- for (LLTexLayerParamAlpha* param : mParamAlphaList)
- {
- param->deleteCaches();
- }
+ // Only need to delete caches for alpha params. Color params don't hold extra memory
+ for (LLTexLayerParamAlpha* param : mParamAlphaList)
+ {
+ param->deleteCaches();
+ }
}
BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target)
{
- // *TODO: Is this correct?
- //gPipeline.disableLights();
- stop_glerror();
-
- LLColor4 net_color;
- BOOL color_specified = findNetColor(&net_color);
-
- if (mTexLayerSet->getAvatarAppearance()->mIsDummy)
- {
- color_specified = true;
- net_color = LLAvatarAppearance::getDummyColor();
- }
-
- BOOL success = TRUE;
-
- // If you can't see the layer, don't render it.
- if( is_approx_zero( net_color.mV[VW] ) )
- {
- return success;
- }
-
- BOOL alpha_mask_specified = FALSE;
- param_alpha_list_t::const_iterator iter = mParamAlphaList.begin();
- if( iter != mParamAlphaList.end() )
- {
- // If we have alpha masks, but we're skipping all of them, skip the whole layer.
- // However, we can't do this optimization if we have morph masks that need updating.
-/* if (!mHasMorph)
- {
- BOOL skip_layer = TRUE;
-
- while( iter != mParamAlphaList.end() )
- {
- const LLTexLayerParamAlpha* param = *iter;
-
- if( !param->getSkip() )
- {
- skip_layer = FALSE;
- break;
- }
-
- iter++;
- }
-
- if( skip_layer )
- {
- return success;
- }
- }//*/
-
- const bool force_render = true;
- renderMorphMasks(x, y, width, height, net_color, bound_target, force_render);
- alpha_mask_specified = TRUE;
- gGL.flush();
- gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ONE_MINUS_DEST_ALPHA);
- }
-
- gGL.color4fv( net_color.mV);
-
- if( getInfo()->mWriteAllChannels )
- {
- gGL.flush();
- gGL.setSceneBlendType(LLRender::BT_REPLACE);
- }
-
- if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly )
- {
- {
- LLGLTexture* tex = NULL;
- if (mLocalTextureObject && mLocalTextureObject->getImage())
- {
- tex = mLocalTextureObject->getImage();
- if (mLocalTextureObject->getID() == IMG_DEFAULT_AVATAR)
- {
- tex = NULL;
- }
- }
- else
- {
- LL_INFOS() << "lto not defined or image not defined: " << getInfo()->getLocalTexture() << " lto: " << mLocalTextureObject << LL_ENDL;
- }
-// if( mTexLayerSet->getAvatarAppearance()->getLocalTextureGL((ETextureIndex)getInfo()->mLocalTexture, &image_gl ) )
- {
- if( tex )
- {
- bool no_alpha_test = getInfo()->mWriteAllChannels;
- if (no_alpha_test)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- }
-
- LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
-
- gGL.getTexUnit(0)->bind(tex, TRUE);
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
-
- gl_rect_2d_simple_tex( width, height );
-
- gGL.getTexUnit(0)->setTextureAddressMode(old_mode);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- if (no_alpha_test)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
- }
- }
-// else
-// {
-// success = FALSE;
-// }
- }
- }
-
- if( !getInfo()->mStaticImageFileName.empty() )
- {
- {
- LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
- if( tex )
- {
- gGL.getTexUnit(0)->bind(tex, TRUE);
- gl_rect_2d_simple_tex( width, height );
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- }
- else
- {
- success = FALSE;
- }
- }
- }
-
- if(((-1 == getInfo()->mLocalTexture) ||
- getInfo()->mUseLocalTextureAlphaOnly) &&
- getInfo()->mStaticImageFileName.empty() &&
- color_specified )
- {
- gAlphaMaskProgram.setMinimumAlpha(0.000f);
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4fv( net_color.mV );
- gl_rect_2d_simple( width, height );
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
-
- if( alpha_mask_specified || getInfo()->mWriteAllChannels )
- {
- // Restore standard blend func value
- gGL.flush();
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
- stop_glerror();
- }
-
- if( !success )
- {
- LL_INFOS() << "LLTexLayer::render() partial: " << getInfo()->mName << LL_ENDL;
- }
- return success;
-}
-
-const U8* LLTexLayer::getAlphaData() const
-{
- LLCRC alpha_mask_crc;
- const LLUUID& uuid = getUUID();
- alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
-
- for (const LLTexLayerParamAlpha* param : mParamAlphaList)
- {
- // MULTI-WEARABLE: verify visual parameters used here
- F32 param_weight = param->getWeight();
- alpha_mask_crc.update((U8*)&param_weight, sizeof(F32));
- }
-
- U32 cache_index = alpha_mask_crc.getCRC();
-
- alpha_cache_t::const_iterator iter2 = mAlphaCache.find(cache_index);
- return (iter2 == mAlphaCache.end()) ? 0 : iter2->second;
+ // *TODO: Is this correct?
+ //gPipeline.disableLights();
+ stop_glerror();
+
+ LLColor4 net_color;
+ BOOL color_specified = findNetColor(&net_color);
+
+ if (mTexLayerSet->getAvatarAppearance()->mIsDummy)
+ {
+ color_specified = true;
+ net_color = LLAvatarAppearance::getDummyColor();
+ }
+
+ BOOL success = TRUE;
+
+ // If you can't see the layer, don't render it.
+ if( is_approx_zero( net_color.mV[VW] ) )
+ {
+ return success;
+ }
+
+ BOOL alpha_mask_specified = FALSE;
+ param_alpha_list_t::const_iterator iter = mParamAlphaList.begin();
+ if( iter != mParamAlphaList.end() )
+ {
+ // If we have alpha masks, but we're skipping all of them, skip the whole layer.
+ // However, we can't do this optimization if we have morph masks that need updating.
+/* if (!mHasMorph)
+ {
+ BOOL skip_layer = TRUE;
+
+ while( iter != mParamAlphaList.end() )
+ {
+ const LLTexLayerParamAlpha* param = *iter;
+
+ if( !param->getSkip() )
+ {
+ skip_layer = FALSE;
+ break;
+ }
+
+ iter++;
+ }
+
+ if( skip_layer )
+ {
+ return success;
+ }
+ }//*/
+
+ const bool force_render = true;
+ renderMorphMasks(x, y, width, height, net_color, bound_target, force_render);
+ alpha_mask_specified = TRUE;
+ gGL.flush();
+ gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ONE_MINUS_DEST_ALPHA);
+ }
+
+ gGL.color4fv( net_color.mV);
+
+ if( getInfo()->mWriteAllChannels )
+ {
+ gGL.flush();
+ gGL.setSceneBlendType(LLRender::BT_REPLACE);
+ }
+
+ if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly )
+ {
+ {
+ LLGLTexture* tex = NULL;
+ if (mLocalTextureObject && mLocalTextureObject->getImage())
+ {
+ tex = mLocalTextureObject->getImage();
+ if (mLocalTextureObject->getID() == IMG_DEFAULT_AVATAR)
+ {
+ tex = NULL;
+ }
+ }
+ else
+ {
+ LL_INFOS() << "lto not defined or image not defined: " << getInfo()->getLocalTexture() << " lto: " << mLocalTextureObject << LL_ENDL;
+ }
+// if( mTexLayerSet->getAvatarAppearance()->getLocalTextureGL((ETextureIndex)getInfo()->mLocalTexture, &image_gl ) )
+ {
+ if( tex )
+ {
+ bool no_alpha_test = getInfo()->mWriteAllChannels;
+ if (no_alpha_test)
+ {
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
+ }
+
+ LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
+
+ gGL.getTexUnit(0)->bind(tex, TRUE);
+ gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
+
+ gl_rect_2d_simple_tex( width, height );
+
+ gGL.getTexUnit(0)->setTextureAddressMode(old_mode);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ if (no_alpha_test)
+ {
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+ }
+ }
+// else
+// {
+// success = FALSE;
+// }
+ }
+ }
+
+ if( !getInfo()->mStaticImageFileName.empty() )
+ {
+ {
+ LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
+ if( tex )
+ {
+ gGL.getTexUnit(0)->bind(tex, TRUE);
+ gl_rect_2d_simple_tex( width, height );
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+ }
+
+ if(((-1 == getInfo()->mLocalTexture) ||
+ getInfo()->mUseLocalTextureAlphaOnly) &&
+ getInfo()->mStaticImageFileName.empty() &&
+ color_specified )
+ {
+ gAlphaMaskProgram.setMinimumAlpha(0.000f);
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4fv( net_color.mV );
+ gl_rect_2d_simple( width, height );
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+
+ if( alpha_mask_specified || getInfo()->mWriteAllChannels )
+ {
+ // Restore standard blend func value
+ gGL.flush();
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ stop_glerror();
+ }
+
+ if( !success )
+ {
+ LL_INFOS() << "LLTexLayer::render() partial: " << getInfo()->mName << LL_ENDL;
+ }
+ return success;
+}
+
+const U8* LLTexLayer::getAlphaData() const
+{
+ LLCRC alpha_mask_crc;
+ const LLUUID& uuid = getUUID();
+ alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
+
+ for (const LLTexLayerParamAlpha* param : mParamAlphaList)
+ {
+ // MULTI-WEARABLE: verify visual parameters used here
+ F32 param_weight = param->getWeight();
+ alpha_mask_crc.update((U8*)&param_weight, sizeof(F32));
+ }
+
+ U32 cache_index = alpha_mask_crc.getCRC();
+
+ alpha_cache_t::const_iterator iter2 = mAlphaCache.find(cache_index);
+ return (iter2 == mAlphaCache.end()) ? 0 : iter2->second;
}
BOOL LLTexLayer::findNetColor(LLColor4* net_color) const
{
- // Color is either:
- // * one or more color parameters (weighted colors) (which may make use of a global color or fixed color)
- // * a reference to a global color
- // * a fixed color with non-zero alpha
- // * opaque white (the default)
-
- if( !mParamColorList.empty() )
- {
- if( !getGlobalColor().empty() )
- {
- net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getInfo()->mGlobalColor ) );
- }
- else if (getInfo()->mFixedColor.mV[VW])
- {
- net_color->setVec( getInfo()->mFixedColor );
- }
- else
- {
- net_color->setVec( 0.f, 0.f, 0.f, 0.f );
- }
-
- calculateTexLayerColor(mParamColorList, *net_color);
- return TRUE;
- }
-
- if( !getGlobalColor().empty() )
- {
- net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getGlobalColor() ) );
- return TRUE;
- }
-
- if( getInfo()->mFixedColor.mV[VW] )
- {
- net_color->setVec( getInfo()->mFixedColor );
- return TRUE;
- }
-
- net_color->setToWhite();
-
- return FALSE; // No need to draw a separate colored polygon
+ // Color is either:
+ // * one or more color parameters (weighted colors) (which may make use of a global color or fixed color)
+ // * a reference to a global color
+ // * a fixed color with non-zero alpha
+ // * opaque white (the default)
+
+ if( !mParamColorList.empty() )
+ {
+ if( !getGlobalColor().empty() )
+ {
+ net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getInfo()->mGlobalColor ) );
+ }
+ else if (getInfo()->mFixedColor.mV[VW])
+ {
+ net_color->setVec( getInfo()->mFixedColor );
+ }
+ else
+ {
+ net_color->setVec( 0.f, 0.f, 0.f, 0.f );
+ }
+
+ calculateTexLayerColor(mParamColorList, *net_color);
+ return TRUE;
+ }
+
+ if( !getGlobalColor().empty() )
+ {
+ net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getGlobalColor() ) );
+ return TRUE;
+ }
+
+ if( getInfo()->mFixedColor.mV[VW] )
+ {
+ net_color->setVec( getInfo()->mFixedColor );
+ return TRUE;
+ }
+
+ net_color->setToWhite();
+
+ return FALSE; // No need to draw a separate colored polygon
}
BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
- BOOL success = TRUE;
-
- gGL.flush();
-
- if( !getInfo()->mStaticImageFileName.empty() )
- {
- LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask );
- if( tex )
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- gGL.getTexUnit(0)->bind(tex, TRUE);
- gl_rect_2d_simple_tex( width, height );
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
- else
- {
- success = FALSE;
- }
- }
- else
- {
- if (getInfo()->mLocalTexture >=0 && getInfo()->mLocalTexture < TEX_NUM_INDICES)
- {
- LLGLTexture* tex = mLocalTextureObject->getImage();
- if (tex)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- gGL.getTexUnit(0)->bind(tex);
- gl_rect_2d_simple_tex( width, height );
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
- }
- }
-
- return success;
+ BOOL success = TRUE;
+
+ gGL.flush();
+
+ if( !getInfo()->mStaticImageFileName.empty() )
+ {
+ LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask );
+ if( tex )
+ {
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
+ gGL.getTexUnit(0)->bind(tex, TRUE);
+ gl_rect_2d_simple_tex( width, height );
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ if (getInfo()->mLocalTexture >=0 && getInfo()->mLocalTexture < TEX_NUM_INDICES)
+ {
+ LLGLTexture* tex = mLocalTextureObject->getImage();
+ if (tex)
+ {
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
+ gGL.getTexUnit(0)->bind(tex);
+ gl_rect_2d_simple_tex( width, height );
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+ }
+ }
+
+ return success;
}
/*virtual*/ void LLTexLayer::gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target)
{
- addAlphaMask(data, originX, originY, width, height, bound_target);
+ addAlphaMask(data, originX, originY, width, height, bound_target);
}
void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, LLRenderTarget* bound_target, bool force_render)
{
- if (!force_render && !hasMorph())
- {
- LL_DEBUGS() << "skipping renderMorphMasks for " << getUUID() << LL_ENDL;
- return;
- }
+ if (!force_render && !hasMorph())
+ {
+ LL_DEBUGS() << "skipping renderMorphMasks for " << getUUID() << LL_ENDL;
+ return;
+ }
LL_PROFILE_ZONE_SCOPED;
- BOOL success = TRUE;
-
- llassert( !mParamAlphaList.empty() );
-
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- gGL.setColorMask(false, true);
-
- LLTexLayerParamAlpha* first_param = *mParamAlphaList.begin();
- // Note: if the first param is a mulitply, multiply against the current buffer's alpha
- if( !first_param || !first_param->getMultiplyBlend() )
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- // Clear the alpha
- gGL.flush();
- gGL.setSceneBlendType(LLRender::BT_REPLACE);
-
- gGL.color4f( 0.f, 0.f, 0.f, 0.f );
- gl_rect_2d_simple( width, height );
- }
-
- // Accumulate alphas
- gGL.color4f( 1.f, 1.f, 1.f, 1.f );
- for (LLTexLayerParamAlpha* param : mParamAlphaList)
- {
- success &= param->render( x, y, width, height );
- if (!success && !force_render)
- {
- LL_DEBUGS() << "Failed to render param " << param->getID() << " ; skipping morph mask." << LL_ENDL;
- return;
- }
- }
-
- // Approximates a min() function
- gGL.flush();
- gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA);
-
- // Accumulate the alpha component of the texture
- if( getInfo()->mLocalTexture != -1 )
- {
- LLGLTexture* tex = mLocalTextureObject->getImage();
- if( tex && (tex->getComponents() == 4) )
- {
- LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
-
- gGL.getTexUnit(0)->bind(tex, TRUE);
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
-
- gl_rect_2d_simple_tex( width, height );
-
- gGL.getTexUnit(0)->setTextureAddressMode(old_mode);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- }
- }
-
- if( !getInfo()->mStaticImageFileName.empty() && getInfo()->mStaticImageIsMask )
- {
- LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
- if( tex )
- {
- if( (tex->getComponents() == 4) || (tex->getComponents() == 1) )
- {
- gGL.getTexUnit(0)->bind(tex, TRUE);
- gl_rect_2d_simple_tex( width, height );
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- }
- else
- {
- LL_WARNS() << "Skipping rendering of " << getInfo()->mStaticImageFileName
- << "; expected 1 or 4 components." << LL_ENDL;
- }
- }
- }
-
- // Draw a rectangle with the layer color to multiply the alpha by that color's alpha.
- // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO );
- if ( !is_approx_equal(layer_color.mV[VW], 1.f) )
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4fv(layer_color.mV);
- gl_rect_2d_simple( width, height );
- }
-
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
-
- LLGLSUIDefault gls_ui;
-
- gGL.setColorMask(true, true);
-
- if (hasMorph() && success)
- {
- LLCRC alpha_mask_crc;
- const LLUUID& uuid = getUUID();
- alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
-
- for (const LLTexLayerParamAlpha* param : mParamAlphaList)
- {
- F32 param_weight = param->getWeight();
- alpha_mask_crc.update((U8*)&param_weight, sizeof(F32));
- }
-
- U32 cache_index = alpha_mask_crc.getCRC();
- U8* alpha_data = NULL;
+ BOOL success = TRUE;
+
+ llassert( !mParamAlphaList.empty() );
+
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
+ gGL.setColorMask(false, true);
+
+ LLTexLayerParamAlpha* first_param = *mParamAlphaList.begin();
+ // Note: if the first param is a mulitply, multiply against the current buffer's alpha
+ if( !first_param || !first_param->getMultiplyBlend() )
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ // Clear the alpha
+ gGL.flush();
+ gGL.setSceneBlendType(LLRender::BT_REPLACE);
+
+ gGL.color4f( 0.f, 0.f, 0.f, 0.f );
+ gl_rect_2d_simple( width, height );
+ }
+
+ // Accumulate alphas
+ gGL.color4f( 1.f, 1.f, 1.f, 1.f );
+ for (LLTexLayerParamAlpha* param : mParamAlphaList)
+ {
+ success &= param->render( x, y, width, height );
+ if (!success && !force_render)
+ {
+ LL_DEBUGS() << "Failed to render param " << param->getID() << " ; skipping morph mask." << LL_ENDL;
+ return;
+ }
+ }
+
+ // Approximates a min() function
+ gGL.flush();
+ gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA);
+
+ // Accumulate the alpha component of the texture
+ if( getInfo()->mLocalTexture != -1 )
+ {
+ LLGLTexture* tex = mLocalTextureObject->getImage();
+ if( tex && (tex->getComponents() == 4) )
+ {
+ LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
+
+ gGL.getTexUnit(0)->bind(tex, TRUE);
+ gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
+
+ gl_rect_2d_simple_tex( width, height );
+
+ gGL.getTexUnit(0)->setTextureAddressMode(old_mode);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ }
+
+ if( !getInfo()->mStaticImageFileName.empty() && getInfo()->mStaticImageIsMask )
+ {
+ LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
+ if( tex )
+ {
+ if( (tex->getComponents() == 4) || (tex->getComponents() == 1) )
+ {
+ gGL.getTexUnit(0)->bind(tex, TRUE);
+ gl_rect_2d_simple_tex( width, height );
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ else
+ {
+ LL_WARNS() << "Skipping rendering of " << getInfo()->mStaticImageFileName
+ << "; expected 1 or 4 components." << LL_ENDL;
+ }
+ }
+ }
+
+ // Draw a rectangle with the layer color to multiply the alpha by that color's alpha.
+ // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO );
+ if ( !is_approx_equal(layer_color.mV[VW], 1.f) )
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4fv(layer_color.mV);
+ gl_rect_2d_simple( width, height );
+ }
+
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+
+ LLGLSUIDefault gls_ui;
+
+ gGL.setColorMask(true, true);
+
+ if (hasMorph() && success)
+ {
+ LLCRC alpha_mask_crc;
+ const LLUUID& uuid = getUUID();
+ alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
+
+ for (const LLTexLayerParamAlpha* param : mParamAlphaList)
+ {
+ F32 param_weight = param->getWeight();
+ alpha_mask_crc.update((U8*)&param_weight, sizeof(F32));
+ }
+
+ U32 cache_index = alpha_mask_crc.getCRC();
+ U8* alpha_data = NULL;
// We believe we need to generate morph masks, do not assume that the cached version is accurate.
// We can get bad morph masks during login, on minimize, and occasional gl errors.
// We should only be doing this when we believe something has changed with respect to the user's appearance.
- {
+ {
LL_DEBUGS("Avatar") << "gl alpha cache of morph mask not found, doing readback: " << getName() << LL_ENDL;
// clear out a slot if we have filled our cache
- S32 max_cache_entries = getTexLayerSet()->getAvatarAppearance()->isSelf() ? 4 : 1;
- while ((S32)mAlphaCache.size() >= max_cache_entries)
- {
- alpha_cache_t::iterator iter2 = mAlphaCache.begin(); // arbitrarily grab the first entry
- alpha_data = iter2->second;
+ S32 max_cache_entries = getTexLayerSet()->getAvatarAppearance()->isSelf() ? 4 : 1;
+ while ((S32)mAlphaCache.size() >= max_cache_entries)
+ {
+ alpha_cache_t::iterator iter2 = mAlphaCache.begin(); // arbitrarily grab the first entry
+ alpha_data = iter2->second;
ll_aligned_free_32(alpha_data);
- mAlphaCache.erase(iter2);
- }
-
+ mAlphaCache.erase(iter2);
+ }
+
// GPUs tend to be very uptight about memory alignment as the DMA used to convey
// said data to the card works better when well-aligned so plain old default-aligned heap mem is a no-no
//new U8[width * height];
@@ -1427,11 +1427,11 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
bool skip_readback = LLRender::sNsightDebugSupport; // nSight doesn't support use of glReadPixels
- if (!skip_readback)
- {
+ if (!skip_readback)
+ {
if (gGLManager.mIsIntel)
{ // work-around for broken intel drivers which cannot do glReadPixels on an RGBA FBO
- // returning only the alpha portion without locking up downstream
+ // returning only the alpha portion without locking up downstream
U8* temp = (U8*)ll_aligned_malloc_32(mem_size << 2); // allocate same size, but RGBA
if (bound_target)
@@ -1470,7 +1470,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
}
ll_aligned_free_32(temp_data);
}
- }
+ }
else
{
ll_aligned_free_32(alpha_data);
@@ -1478,101 +1478,101 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
}
mAlphaCache[cache_index] = alpha_data;
- }
-
- getTexLayerSet()->getAvatarAppearance()->dirtyMesh();
+ }
+
+ getTexLayerSet()->getAvatarAppearance()->dirtyMesh();
- mMorphMasksValid = TRUE;
- getTexLayerSet()->applyMorphMask(alpha_data, width, height, 1);
- }
+ mMorphMasksValid = TRUE;
+ getTexLayerSet()->applyMorphMask(alpha_data, width, height, 1);
+ }
}
void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target)
{
LL_PROFILE_ZONE_SCOPED;
- S32 size = width * height;
- const U8* alphaData = getAlphaData();
- if (!alphaData && hasAlphaParams())
- {
- LLColor4 net_color;
- findNetColor( &net_color );
- // TODO: eliminate need for layer morph mask valid flag
- invalidateMorphMasks();
- const bool force_render = false;
- renderMorphMasks(originX, originY, width, height, net_color, bound_target, force_render);
- alphaData = getAlphaData();
- }
- if (alphaData)
- {
- for( S32 i = 0; i < size; i++ )
- {
- U8 curAlpha = data[i];
- U16 resultAlpha = curAlpha;
- resultAlpha *= ( ((U16)alphaData[i]) + 1);
- resultAlpha = resultAlpha >> 8;
- data[i] = (U8)resultAlpha;
- }
- }
+ S32 size = width * height;
+ const U8* alphaData = getAlphaData();
+ if (!alphaData && hasAlphaParams())
+ {
+ LLColor4 net_color;
+ findNetColor( &net_color );
+ // TODO: eliminate need for layer morph mask valid flag
+ invalidateMorphMasks();
+ const bool force_render = false;
+ renderMorphMasks(originX, originY, width, height, net_color, bound_target, force_render);
+ alphaData = getAlphaData();
+ }
+ if (alphaData)
+ {
+ for( S32 i = 0; i < size; i++ )
+ {
+ U8 curAlpha = data[i];
+ U16 resultAlpha = curAlpha;
+ resultAlpha *= ( ((U16)alphaData[i]) + 1);
+ resultAlpha = resultAlpha >> 8;
+ data[i] = (U8)resultAlpha;
+ }
+ }
}
/*virtual*/ BOOL LLTexLayer::isInvisibleAlphaMask() const
{
- if (mLocalTextureObject)
- {
- if (mLocalTextureObject->getID() == IMG_INVISIBLE)
- {
- return TRUE;
- }
- }
+ if (mLocalTextureObject)
+ {
+ if (mLocalTextureObject->getID() == IMG_INVISIBLE)
+ {
+ return TRUE;
+ }
+ }
- return FALSE;
+ return FALSE;
}
LLUUID LLTexLayer::getUUID() const
{
- LLUUID uuid;
- if( getInfo()->mLocalTexture != -1 )
- {
- LLGLTexture* tex = mLocalTextureObject->getImage();
- if (tex)
- {
- uuid = mLocalTextureObject->getID();
- }
- }
- if( !getInfo()->mStaticImageFileName.empty() )
- {
- LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
- if( tex )
- {
- uuid = tex->getID();
- }
- }
- return uuid;
+ LLUUID uuid;
+ if( getInfo()->mLocalTexture != -1 )
+ {
+ LLGLTexture* tex = mLocalTextureObject->getImage();
+ if (tex)
+ {
+ uuid = mLocalTextureObject->getID();
+ }
+ }
+ if( !getInfo()->mStaticImageFileName.empty() )
+ {
+ LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
+ if( tex )
+ {
+ uuid = tex->getID();
+ }
+ }
+ return uuid;
}
//-----------------------------------------------------------------------------
// LLTexLayerTemplate
// A single texture layer, consisting of:
-// * color, consisting of either
-// * one or more color parameters (weighted colors)
-// * a reference to a global color
-// * a fixed color with non-zero alpha
-// * opaque white (the default)
-// * (optional) a texture defined by either
-// * a GUID
-// * a texture entry index (TE)
-// * (optional) one or more alpha parameters (weighted alpha textures)
+// * color, consisting of either
+// * one or more color parameters (weighted colors)
+// * a reference to a global color
+// * a fixed color with non-zero alpha
+// * opaque white (the default)
+// * (optional) a texture defined by either
+// * a GUID
+// * a texture entry index (TE)
+// * (optional) one or more alpha parameters (weighted alpha textures)
//-----------------------------------------------------------------------------
LLTexLayerTemplate::LLTexLayerTemplate(LLTexLayerSet* layer_set, LLAvatarAppearance* const appearance) :
- LLTexLayerInterface(layer_set),
- mAvatarAppearance( appearance )
+ LLTexLayerInterface(layer_set),
+ mAvatarAppearance( appearance )
{
}
LLTexLayerTemplate::LLTexLayerTemplate(const LLTexLayerTemplate &layer) :
- LLTexLayerInterface(layer),
- mAvatarAppearance(layer.getAvatarAppearance())
+ LLTexLayerInterface(layer),
+ mAvatarAppearance(layer.getAvatarAppearance())
{
}
@@ -1586,154 +1586,154 @@ LLTexLayerTemplate::~LLTexLayerTemplate()
/*virtual*/ BOOL LLTexLayerTemplate::setInfo(const LLTexLayerInfo* info, LLWearable* wearable )
{
- return LLTexLayerInterface::setInfo(info, wearable);
+ return LLTexLayerInterface::setInfo(info, wearable);
}
U32 LLTexLayerTemplate::updateWearableCache() const
{
- mWearableCache.clear();
-
- LLWearableType::EType wearable_type = getWearableType();
- if (LLWearableType::WT_INVALID == wearable_type)
- {
- //this isn't a cloneable layer
- return 0;
- }
- U32 num_wearables = getAvatarAppearance()->getWearableData()->getWearableCount(wearable_type);
- U32 added = 0;
- for (U32 i = 0; i < num_wearables; i++)
- {
- LLWearable* wearable = getAvatarAppearance()->getWearableData()->getWearable(wearable_type, i);
- if (!wearable)
- {
- continue;
- }
- mWearableCache.push_back(wearable);
- added++;
- }
- return added;
+ mWearableCache.clear();
+
+ LLWearableType::EType wearable_type = getWearableType();
+ if (LLWearableType::WT_INVALID == wearable_type)
+ {
+ //this isn't a cloneable layer
+ return 0;
+ }
+ U32 num_wearables = getAvatarAppearance()->getWearableData()->getWearableCount(wearable_type);
+ U32 added = 0;
+ for (U32 i = 0; i < num_wearables; i++)
+ {
+ LLWearable* wearable = getAvatarAppearance()->getWearableData()->getWearable(wearable_type, i);
+ if (!wearable)
+ {
+ continue;
+ }
+ mWearableCache.push_back(wearable);
+ added++;
+ }
+ return added;
}
LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
{
- if (mWearableCache.size() <= i)
- {
- return NULL;
- }
- LLWearable *wearable = mWearableCache[i];
- LLLocalTextureObject *lto = NULL;
- LLTexLayer *layer = NULL;
- if (wearable)
- {
- lto = wearable->getLocalTextureObject(mInfo->mLocalTexture);
- }
- if (lto)
- {
- layer = lto->getTexLayer(getName());
- }
- return layer;
+ if (mWearableCache.size() <= i)
+ {
+ return NULL;
+ }
+ LLWearable *wearable = mWearableCache[i];
+ LLLocalTextureObject *lto = NULL;
+ LLTexLayer *layer = NULL;
+ if (wearable)
+ {
+ lto = wearable->getLocalTextureObject(mInfo->mLocalTexture);
+ }
+ if (lto)
+ {
+ layer = lto->getTexLayer(getName());
+ }
+ return layer;
}
/*virtual*/ BOOL LLTexLayerTemplate::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target)
{
- if(!mInfo)
- {
- return FALSE ;
- }
-
- BOOL success = TRUE;
- updateWearableCache();
- for (LLWearable* wearable : mWearableCache)
- {
- LLLocalTextureObject *lto = NULL;
- LLTexLayer *layer = NULL;
- if (wearable)
- {
- lto = wearable->getLocalTextureObject(mInfo->mLocalTexture);
- }
- if (lto)
- {
- layer = lto->getTexLayer(getName());
- }
- if (layer)
- {
- wearable->writeToAvatar(mAvatarAppearance);
- layer->setLTO(lto);
- success &= layer->render(x, y, width, height, bound_target);
- }
- }
-
- return success;
+ if(!mInfo)
+ {
+ return FALSE ;
+ }
+
+ BOOL success = TRUE;
+ updateWearableCache();
+ for (LLWearable* wearable : mWearableCache)
+ {
+ LLLocalTextureObject *lto = NULL;
+ LLTexLayer *layer = NULL;
+ if (wearable)
+ {
+ lto = wearable->getLocalTextureObject(mInfo->mLocalTexture);
+ }
+ if (lto)
+ {
+ layer = lto->getTexLayer(getName());
+ }
+ if (layer)
+ {
+ wearable->writeToAvatar(mAvatarAppearance);
+ layer->setLTO(lto);
+ success &= layer->render(x, y, width, height, bound_target);
+ }
+ }
+
+ return success;
}
/*virtual*/ BOOL LLTexLayerTemplate::blendAlphaTexture( S32 x, S32 y, S32 width, S32 height) // Multiplies a single alpha texture against the frame buffer
{
- BOOL success = TRUE;
- U32 num_wearables = updateWearableCache();
- for (U32 i = 0; i < num_wearables; i++)
- {
- LLTexLayer *layer = getLayer(i);
- if (layer)
- {
- success &= layer->blendAlphaTexture(x,y,width,height);
- }
- }
- return success;
+ BOOL success = TRUE;
+ U32 num_wearables = updateWearableCache();
+ for (U32 i = 0; i < num_wearables; i++)
+ {
+ LLTexLayer *layer = getLayer(i);
+ if (layer)
+ {
+ success &= layer->blendAlphaTexture(x,y,width,height);
+ }
+ }
+ return success;
}
/*virtual*/ void LLTexLayerTemplate::gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target)
{
- U32 num_wearables = updateWearableCache();
- U32 i = num_wearables - 1; // For rendering morph masks, we only want to use the top wearable
- LLTexLayer *layer = getLayer(i);
- if (layer)
- {
- layer->addAlphaMask(data, originX, originY, width, height, bound_target);
- }
+ U32 num_wearables = updateWearableCache();
+ U32 i = num_wearables - 1; // For rendering morph masks, we only want to use the top wearable
+ LLTexLayer *layer = getLayer(i);
+ if (layer)
+ {
+ layer->addAlphaMask(data, originX, originY, width, height, bound_target);
+ }
}
/*virtual*/ void LLTexLayerTemplate::setHasMorph(BOOL newval)
-{
- mHasMorph = newval;
- U32 num_wearables = updateWearableCache();
- for (U32 i = 0; i < num_wearables; i++)
- {
- LLTexLayer *layer = getLayer(i);
- if (layer)
- {
- layer->setHasMorph(newval);
- }
- }
+{
+ mHasMorph = newval;
+ U32 num_wearables = updateWearableCache();
+ for (U32 i = 0; i < num_wearables; i++)
+ {
+ LLTexLayer *layer = getLayer(i);
+ if (layer)
+ {
+ layer->setHasMorph(newval);
+ }
+ }
}
/*virtual*/ void LLTexLayerTemplate::deleteCaches()
{
- U32 num_wearables = updateWearableCache();
- for (U32 i = 0; i < num_wearables; i++)
- {
- LLTexLayer *layer = getLayer(i);
- if (layer)
- {
- layer->deleteCaches();
- }
- }
+ U32 num_wearables = updateWearableCache();
+ for (U32 i = 0; i < num_wearables; i++)
+ {
+ LLTexLayer *layer = getLayer(i);
+ if (layer)
+ {
+ layer->deleteCaches();
+ }
+ }
}
/*virtual*/ BOOL LLTexLayerTemplate::isInvisibleAlphaMask() const
{
- U32 num_wearables = updateWearableCache();
- for (U32 i = 0; i < num_wearables; i++)
- {
- LLTexLayer *layer = getLayer(i);
- if (layer)
- {
- if (layer->isInvisibleAlphaMask())
- {
- return TRUE;
- }
- }
- }
+ U32 num_wearables = updateWearableCache();
+ for (U32 i = 0; i < num_wearables; i++)
+ {
+ LLTexLayer *layer = getLayer(i);
+ if (layer)
+ {
+ if (layer->isInvisibleAlphaMask())
+ {
+ return TRUE;
+ }
+ }
+ }
- return FALSE;
+ return FALSE;
}
@@ -1742,82 +1742,82 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
//-----------------------------------------------------------------------------
LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
{
- for (LLTexLayerInterface* layer : mLayerList)
- {
- if (layer->getName() == name)
- {
- return layer;
- }
- }
- for (LLTexLayerInterface* layer : mMaskLayerList)
- {
- if (layer->getName() == name)
- {
- return layer;
- }
- }
- return NULL;
+ for (LLTexLayerInterface* layer : mLayerList)
+ {
+ if (layer->getName() == name)
+ {
+ return layer;
+ }
+ }
+ for (LLTexLayerInterface* layer : mMaskLayerList)
+ {
+ if (layer->getName() == name)
+ {
+ return layer;
+ }
+ }
+ return NULL;
}
void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable *wearable)
{
- // initialize all texlayers with this texture type for this LTO
- for(LLTexLayerInterface* layer : mLayerList)
- {
- LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer;
- if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index)
- {
- lto->addTexLayer(layer_template, wearable);
- }
- }
- for(LLTexLayerInterface* layer : mMaskLayerList)
- {
- LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer;
- if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index)
- {
- lto->addTexLayer(layer_template, wearable);
- }
- }
+ // initialize all texlayers with this texture type for this LTO
+ for(LLTexLayerInterface* layer : mLayerList)
+ {
+ LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer;
+ if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index)
+ {
+ lto->addTexLayer(layer_template, wearable);
+ }
+ }
+ for(LLTexLayerInterface* layer : mMaskLayerList)
+ {
+ LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer;
+ if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index)
+ {
+ lto->addTexLayer(layer_template, wearable);
+ }
+ }
}
//-----------------------------------------------------------------------------
// LLTexLayerStaticImageList
//-----------------------------------------------------------------------------
LLTexLayerStaticImageList::LLTexLayerStaticImageList() :
- mGLBytes(0),
- mTGABytes(0),
- mImageNames(16384)
+ mGLBytes(0),
+ mTGABytes(0),
+ mImageNames(16384)
{
}
LLTexLayerStaticImageList::~LLTexLayerStaticImageList()
{
- deleteCachedImages();
+ deleteCachedImages();
}
void LLTexLayerStaticImageList::dumpByteCount() const
{
- LL_INFOS() << "Avatar Static Textures " <<
- "KB GL:" << (mGLBytes / 1024) <<
- "KB TGA:" << (mTGABytes / 1024) << "KB" << LL_ENDL;
+ LL_INFOS() << "Avatar Static Textures " <<
+ "KB GL:" << (mGLBytes / 1024) <<
+ "KB TGA:" << (mTGABytes / 1024) << "KB" << LL_ENDL;
}
void LLTexLayerStaticImageList::deleteCachedImages()
{
- if( mGLBytes || mTGABytes )
- {
- LL_INFOS() << "Clearing Static Textures " <<
- "KB GL:" << (mGLBytes / 1024) <<
- "KB TGA:" << (mTGABytes / 1024) << "KB" << LL_ENDL;
+ if( mGLBytes || mTGABytes )
+ {
+ LL_INFOS() << "Clearing Static Textures " <<
+ "KB GL:" << (mGLBytes / 1024) <<
+ "KB TGA:" << (mTGABytes / 1024) << "KB" << LL_ENDL;
+
+ //mStaticImageLists uses LLPointers, clear() will cause deletion
- //mStaticImageLists uses LLPointers, clear() will cause deletion
-
- mStaticImageListTGA.clear();
- mStaticImageList.clear();
-
- mGLBytes = 0;
- mTGABytes = 0;
- }
+ mStaticImageListTGA.clear();
+ mStaticImageList.clear();
+
+ mGLBytes = 0;
+ mTGABytes = 0;
+ }
}
// Note: in general, for a given image image we'll call either getImageTga() or getTexture().
@@ -1829,28 +1829,28 @@ void LLTexLayerStaticImageList::deleteCachedImages()
LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name)
{
LL_PROFILE_ZONE_SCOPED;
- const char *namekey = mImageNames.addString(file_name);
- image_tga_map_t::const_iterator iter = mStaticImageListTGA.find(namekey);
- if( iter != mStaticImageListTGA.end() )
- {
- return iter->second;
- }
- else
- {
- std::string path;
- path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name);
- LLPointer<LLImageTGA> image_tga = new LLImageTGA( path );
- if( image_tga->getDataSize() > 0 )
- {
- mStaticImageListTGA[ namekey ] = image_tga;
- mTGABytes += image_tga->getDataSize();
- return image_tga;
- }
- else
- {
- return NULL;
- }
- }
+ const char *namekey = mImageNames.addString(file_name);
+ image_tga_map_t::const_iterator iter = mStaticImageListTGA.find(namekey);
+ if( iter != mStaticImageListTGA.end() )
+ {
+ return iter->second;
+ }
+ else
+ {
+ std::string path;
+ path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name);
+ LLPointer<LLImageTGA> image_tga = new LLImageTGA( path );
+ if( image_tga->getDataSize() > 0 )
+ {
+ mStaticImageListTGA[ namekey ] = image_tga;
+ mTGABytes += image_tga->getDataSize();
+ return image_tga;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
}
// Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name.
@@ -1858,48 +1858,48 @@ LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name)
LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, BOOL is_mask)
{
LL_PROFILE_ZONE_SCOPED;
- LLPointer<LLGLTexture> tex;
- const char *namekey = mImageNames.addString(file_name);
-
- texture_map_t::const_iterator iter = mStaticImageList.find(namekey);
- if( iter != mStaticImageList.end() )
- {
- tex = iter->second;
- }
- else
- {
- llassert(gTextureManagerBridgep);
- tex = gTextureManagerBridgep->getLocalTexture( FALSE );
- LLPointer<LLImageRaw> image_raw = new LLImageRaw;
- if( loadImageRaw( file_name, image_raw ) )
- {
- if( (image_raw->getComponents() == 1) && is_mask )
- {
- // Convert grayscale alpha masks from single channel into RGBA.
- // Fill RGB with black to allow fixed function gl calls
- // to match shader implementation.
- LLPointer<LLImageRaw> alpha_image_raw = image_raw;
- image_raw = new LLImageRaw(image_raw->getWidth(),
- image_raw->getHeight(),
- 4);
-
- image_raw->copyUnscaledAlphaMask(alpha_image_raw, LLColor4U::black);
- }
- tex->createGLTexture(0, image_raw, 0, TRUE, LLGLTexture::LOCAL);
-
- gGL.getTexUnit(0)->bind(tex);
- tex->setAddressMode(LLTexUnit::TAM_CLAMP);
-
- mStaticImageList [ namekey ] = tex;
- mGLBytes += (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
- }
- else
- {
- tex = NULL;
- }
- }
-
- return tex;
+ LLPointer<LLGLTexture> tex;
+ const char *namekey = mImageNames.addString(file_name);
+
+ texture_map_t::const_iterator iter = mStaticImageList.find(namekey);
+ if( iter != mStaticImageList.end() )
+ {
+ tex = iter->second;
+ }
+ else
+ {
+ llassert(gTextureManagerBridgep);
+ tex = gTextureManagerBridgep->getLocalTexture( FALSE );
+ LLPointer<LLImageRaw> image_raw = new LLImageRaw;
+ if( loadImageRaw( file_name, image_raw ) )
+ {
+ if( (image_raw->getComponents() == 1) && is_mask )
+ {
+ // Convert grayscale alpha masks from single channel into RGBA.
+ // Fill RGB with black to allow fixed function gl calls
+ // to match shader implementation.
+ LLPointer<LLImageRaw> alpha_image_raw = image_raw;
+ image_raw = new LLImageRaw(image_raw->getWidth(),
+ image_raw->getHeight(),
+ 4);
+
+ image_raw->copyUnscaledAlphaMask(alpha_image_raw, LLColor4U::black);
+ }
+ tex->createGLTexture(0, image_raw, 0, TRUE, LLGLTexture::LOCAL);
+
+ gGL.getTexUnit(0)->bind(tex);
+ tex->setAddressMode(LLTexUnit::TAM_CLAMP);
+
+ mStaticImageList [ namekey ] = tex;
+ mGLBytes += (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
+ }
+ else
+ {
+ tex = NULL;
+ }
+ }
+
+ return tex;
}
// Reads a .tga file, decodes it, and puts the decoded data in image_raw.
@@ -1907,16 +1907,16 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name,
BOOL LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLImageRaw* image_raw)
{
LL_PROFILE_ZONE_SCOPED;
- BOOL success = FALSE;
- std::string path;
- path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name);
- LLPointer<LLImageTGA> image_tga = new LLImageTGA( path );
- if( image_tga->getDataSize() > 0 )
- {
- // Copy data from tga to raw.
- success = image_tga->decode( image_raw );
- }
-
- return success;
+ BOOL success = FALSE;
+ std::string path;
+ path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name);
+ LLPointer<LLImageTGA> image_tga = new LLImageTGA( path );
+ if( image_tga->getDataSize() > 0 )
+ {
+ // Copy data from tga to raw.
+ success = image_tga->decode( image_raw );
+ }
+
+ return success;
}
diff --git a/indra/llappearance/lltexlayer.h b/indra/llappearance/lltexlayer.h
index 74b421d3ee..2b9913f883 100644
--- a/indra/llappearance/lltexlayer.h
+++ b/indra/llappearance/lltexlayer.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexlayer.h
* @brief Texture layer classes. Used for avatars.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,66 +48,66 @@ class LLViewerVisualParam;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerInterface
//
-// Interface class to generalize functionality shared by LLTexLayer
+// Interface class to generalize functionality shared by LLTexLayer
// and LLTexLayerTemplate.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLTexLayerInterface
+class LLTexLayerInterface
{
public:
- enum ERenderPass
- {
- RP_COLOR,
- RP_BUMP,
- RP_SHINE
- };
+ enum ERenderPass
+ {
+ RP_COLOR,
+ RP_BUMP,
+ RP_SHINE
+ };
- LLTexLayerInterface(LLTexLayerSet* const layer_set);
- LLTexLayerInterface(const LLTexLayerInterface &layer, LLWearable *wearable);
- virtual ~LLTexLayerInterface() {}
+ LLTexLayerInterface(LLTexLayerSet* const layer_set);
+ LLTexLayerInterface(const LLTexLayerInterface &layer, LLWearable *wearable);
+ virtual ~LLTexLayerInterface() {}
- virtual BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) = 0;
- virtual void deleteCaches() = 0;
- virtual BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) = 0;
- virtual BOOL isInvisibleAlphaMask() const = 0;
+ virtual BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) = 0;
+ virtual void deleteCaches() = 0;
+ virtual BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) = 0;
+ virtual BOOL isInvisibleAlphaMask() const = 0;
- const LLTexLayerInfo* getInfo() const { return mInfo; }
- virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions
- LLWearableType::EType getWearableType() const;
- LLAvatarAppearanceDefines::ETextureIndex getLocalTextureIndex() const;
+ const LLTexLayerInfo* getInfo() const { return mInfo; }
+ virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions
+ LLWearableType::EType getWearableType() const;
+ LLAvatarAppearanceDefines::ETextureIndex getLocalTextureIndex() const;
- const std::string& getName() const;
- const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
- LLTexLayerSet* const getTexLayerSet() { return mTexLayerSet; }
+ const std::string& getName() const;
+ const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
+ LLTexLayerSet* const getTexLayerSet() { return mTexLayerSet; }
- void invalidateMorphMasks();
- virtual void setHasMorph(BOOL newval) { mHasMorph = newval; }
- BOOL hasMorph() const { return mHasMorph; }
- BOOL isMorphValid() const { return mMorphMasksValid; }
+ void invalidateMorphMasks();
+ virtual void setHasMorph(BOOL newval) { mHasMorph = newval; }
+ BOOL hasMorph() const { return mHasMorph; }
+ BOOL isMorphValid() const { return mMorphMasksValid; }
- void requestUpdate();
- virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target) = 0;
- BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); }
+ void requestUpdate();
+ virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target) = 0;
+ BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); }
- ERenderPass getRenderPass() const;
- BOOL isVisibilityMask() const;
+ ERenderPass getRenderPass() const;
+ BOOL isVisibilityMask() const;
- virtual void asLLSD(LLSD& sd) const {}
+ virtual void asLLSD(LLSD& sd) const {}
protected:
- const std::string& getGlobalColor() const;
- LLViewerVisualParam* getVisualParamPtr(S32 index) const;
+ const std::string& getGlobalColor() const;
+ LLViewerVisualParam* getVisualParamPtr(S32 index) const;
protected:
- LLTexLayerSet* const mTexLayerSet;
- const LLTexLayerInfo* mInfo;
- BOOL mMorphMasksValid;
- BOOL mHasMorph;
-
- // Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order.
- param_color_list_t mParamColorList;
- param_alpha_list_t mParamAlphaList;
- // mGlobalColor name stored in mInfo
- // mFixedColor value stored in mInfo
+ LLTexLayerSet* const mTexLayerSet;
+ const LLTexLayerInfo* mInfo;
+ BOOL mMorphMasksValid;
+ BOOL mHasMorph;
+
+ // Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order.
+ param_color_list_t mParamColorList;
+ param_alpha_list_t mParamAlphaList;
+ // mGlobalColor name stored in mInfo
+ // mFixedColor value stored in mInfo
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -118,24 +118,24 @@ protected:
class LLTexLayerTemplate : public LLTexLayerInterface
{
public:
- LLTexLayerTemplate(LLTexLayerSet* const layer_set, LLAvatarAppearance* const appearance);
- LLTexLayerTemplate(const LLTexLayerTemplate &layer);
- /*virtual*/ ~LLTexLayerTemplate();
- /*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target);
- /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions
- /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
- /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target);
- /*virtual*/ void setHasMorph(BOOL newval);
- /*virtual*/ void deleteCaches();
- /*virtual*/ BOOL isInvisibleAlphaMask() const;
+ LLTexLayerTemplate(LLTexLayerSet* const layer_set, LLAvatarAppearance* const appearance);
+ LLTexLayerTemplate(const LLTexLayerTemplate &layer);
+ /*virtual*/ ~LLTexLayerTemplate();
+ /*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target);
+ /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions
+ /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
+ /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target);
+ /*virtual*/ void setHasMorph(BOOL newval);
+ /*virtual*/ void deleteCaches();
+ /*virtual*/ BOOL isInvisibleAlphaMask() const;
protected:
- U32 updateWearableCache() const;
- LLTexLayer* getLayer(U32 i) const;
- LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
+ U32 updateWearableCache() const;
+ LLTexLayer* getLayer(U32 i) const;
+ LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
private:
- LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
- typedef std::vector<LLWearable*> wearable_cache_t;
- mutable wearable_cache_t mWearableCache; // mutable b/c most get- require updating this cache
+ LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
+ typedef std::vector<LLWearable*> wearable_cache_t;
+ mutable wearable_cache_t mWearableCache; // mutable b/c most get- require updating this cache
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -146,35 +146,35 @@ private:
class LLTexLayer : public LLTexLayerInterface
{
public:
- LLTexLayer(LLTexLayerSet* const layer_set);
- LLTexLayer(const LLTexLayer &layer, LLWearable *wearable);
- LLTexLayer(const LLTexLayerTemplate &layer_template, LLLocalTextureObject *lto, LLWearable *wearable);
- /*virtual*/ ~LLTexLayer();
+ LLTexLayer(LLTexLayerSet* const layer_set);
+ LLTexLayer(const LLTexLayer &layer, LLWearable *wearable);
+ LLTexLayer(const LLTexLayerTemplate &layer_template, LLLocalTextureObject *lto, LLWearable *wearable);
+ /*virtual*/ ~LLTexLayer();
- /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions
- /*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target);
+ /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions
+ /*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target);
- /*virtual*/ void deleteCaches();
- const U8* getAlphaData() const;
+ /*virtual*/ void deleteCaches();
+ const U8* getAlphaData() const;
- BOOL findNetColor(LLColor4* color) const;
- /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
- /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target);
- void renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, LLRenderTarget* bound_target, bool force_render);
- void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target);
- /*virtual*/ BOOL isInvisibleAlphaMask() const;
+ BOOL findNetColor(LLColor4* color) const;
+ /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
+ /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target);
+ void renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, LLRenderTarget* bound_target, bool force_render);
+ void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height, LLRenderTarget* bound_target);
+ /*virtual*/ BOOL isInvisibleAlphaMask() const;
- void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; }
- LLLocalTextureObject* getLTO() { return mLocalTextureObject; }
+ void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; }
+ LLLocalTextureObject* getLTO() { return mLocalTextureObject; }
- /*virtual*/ void asLLSD(LLSD& sd) const;
+ /*virtual*/ void asLLSD(LLSD& sd) const;
- static void calculateTexLayerColor(const param_color_list_t &param_list, LLColor4 &net_color);
+ static void calculateTexLayerColor(const param_color_list_t &param_list, LLColor4 &net_color);
protected:
- LLUUID getUUID() const;
- typedef std::map<U32, U8*> alpha_cache_t;
- alpha_cache_t mAlphaCache;
- LLLocalTextureObject* mLocalTextureObject;
+ LLUUID getUUID() const;
+ typedef std::map<U32, U8*> alpha_cache_t;
+ alpha_cache_t mAlphaCache;
+ LLLocalTextureObject* mLocalTextureObject;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -185,51 +185,51 @@ protected:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSet
{
- friend class LLTexLayerSetBuffer;
+ friend class LLTexLayerSetBuffer;
public:
- LLTexLayerSet(LLAvatarAppearance* const appearance);
- virtual ~LLTexLayerSet();
-
- LLTexLayerSetBuffer* getComposite();
- const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
- virtual void createComposite() = 0;
- void destroyComposite();
- void gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height, LLRenderTarget* bound_target);
-
- const LLTexLayerSetInfo* getInfo() const { return mInfo; }
- BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
-
- BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target = nullptr);
- void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target = nullptr, bool forceClear = false);
-
- BOOL isBodyRegion(const std::string& region) const;
- void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
- BOOL isMorphValid() const;
- virtual void requestUpdate() = 0;
- void invalidateMorphMasks();
- void deleteCaches();
- LLTexLayerInterface* findLayerByName(const std::string& name);
- void cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable* wearable);
-
- LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
- const std::string getBodyRegionName() const;
- BOOL hasComposite() const { return (mComposite.notNull()); }
- LLAvatarAppearanceDefines::EBakedTextureIndex getBakedTexIndex() const { return mBakedTexIndex; }
- void setBakedTexIndex(LLAvatarAppearanceDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
- BOOL isVisible() const { return mIsVisible; }
-
- static BOOL sHasCaches;
+ LLTexLayerSet(LLAvatarAppearance* const appearance);
+ virtual ~LLTexLayerSet();
+
+ LLTexLayerSetBuffer* getComposite();
+ const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
+ virtual void createComposite() = 0;
+ void destroyComposite();
+ void gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height, LLRenderTarget* bound_target);
+
+ const LLTexLayerSetInfo* getInfo() const { return mInfo; }
+ BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
+
+ BOOL render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target = nullptr);
+ void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target = nullptr, bool forceClear = false);
+
+ BOOL isBodyRegion(const std::string& region) const;
+ void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
+ BOOL isMorphValid() const;
+ virtual void requestUpdate() = 0;
+ void invalidateMorphMasks();
+ void deleteCaches();
+ LLTexLayerInterface* findLayerByName(const std::string& name);
+ void cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable* wearable);
+
+ LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
+ const std::string getBodyRegionName() const;
+ BOOL hasComposite() const { return (mComposite.notNull()); }
+ LLAvatarAppearanceDefines::EBakedTextureIndex getBakedTexIndex() const { return mBakedTexIndex; }
+ void setBakedTexIndex(LLAvatarAppearanceDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
+ BOOL isVisible() const { return mIsVisible; }
+
+ static BOOL sHasCaches;
protected:
- typedef std::vector<LLTexLayerInterface *> layer_list_t;
- layer_list_t mLayerList;
- layer_list_t mMaskLayerList;
- LLPointer<LLTexLayerSetBuffer> mComposite;
- LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
- BOOL mIsVisible;
-
- LLAvatarAppearanceDefines::EBakedTextureIndex mBakedTexIndex;
- const LLTexLayerSetInfo* mInfo;
+ typedef std::vector<LLTexLayerInterface *> layer_list_t;
+ layer_list_t mLayerList;
+ layer_list_t mMaskLayerList;
+ LLPointer<LLTexLayerSetBuffer> mComposite;
+ LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
+ BOOL mIsVisible;
+
+ LLAvatarAppearanceDefines::EBakedTextureIndex mBakedTexIndex;
+ const LLTexLayerSetInfo* mInfo;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -239,22 +239,22 @@ protected:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSetInfo
{
- friend class LLTexLayerSet;
+ friend class LLTexLayerSet;
public:
- LLTexLayerSetInfo();
- ~LLTexLayerSetInfo();
- BOOL parseXml(LLXmlTreeNode* node);
- void createVisualParams(LLAvatarAppearance *appearance);
- S32 getWidth() const { return mWidth; }
- S32 getHeight() const { return mHeight; }
+ LLTexLayerSetInfo();
+ ~LLTexLayerSetInfo();
+ BOOL parseXml(LLXmlTreeNode* node);
+ void createVisualParams(LLAvatarAppearance *appearance);
+ S32 getWidth() const { return mWidth; }
+ S32 getHeight() const { return mHeight; }
protected:
- std::string mBodyRegion;
- S32 mWidth;
- S32 mHeight;
- std::string mStaticAlphaFileName;
- BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName)
- typedef std::vector<LLTexLayerInfo*> layer_info_list_t;
- layer_info_list_t mLayerInfoList;
+ std::string mBodyRegion;
+ S32 mWidth;
+ S32 mHeight;
+ std::string mStaticAlphaFileName;
+ BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName)
+ typedef std::vector<LLTexLayerInfo*> layer_info_list_t;
+ layer_info_list_t mLayerInfoList;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -264,25 +264,25 @@ protected:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSetBuffer : public virtual LLRefCount
{
- LOG_CLASS(LLTexLayerSetBuffer);
+ LOG_CLASS(LLTexLayerSetBuffer);
public:
- LLTexLayerSetBuffer(LLTexLayerSet* const owner);
- virtual ~LLTexLayerSetBuffer();
+ LLTexLayerSetBuffer(LLTexLayerSet* const owner);
+ virtual ~LLTexLayerSetBuffer();
protected:
- void pushProjection() const;
- void popProjection() const;
- virtual void preRenderTexLayerSet();
- virtual void midRenderTexLayerSet(BOOL success) {}
- virtual void postRenderTexLayerSet(BOOL success);
- virtual S32 getCompositeOriginX() const = 0;
- virtual S32 getCompositeOriginY() const = 0;
- virtual S32 getCompositeWidth() const = 0;
- virtual S32 getCompositeHeight() const = 0;
- BOOL renderTexLayerSet(LLRenderTarget* bound_target);
-
- LLTexLayerSet* const mTexLayerSet;
+ void pushProjection() const;
+ void popProjection() const;
+ virtual void preRenderTexLayerSet();
+ virtual void midRenderTexLayerSet(BOOL success) {}
+ virtual void postRenderTexLayerSet(BOOL success);
+ virtual S32 getCompositeOriginX() const = 0;
+ virtual S32 getCompositeOriginY() const = 0;
+ virtual S32 getCompositeWidth() const = 0;
+ virtual S32 getCompositeHeight() const = 0;
+ BOOL renderTexLayerSet(LLRenderTarget* bound_target);
+
+ LLTexLayerSet* const mTexLayerSet;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -291,23 +291,23 @@ protected:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList>
{
- LLSINGLETON(LLTexLayerStaticImageList);
- ~LLTexLayerStaticImageList();
+ LLSINGLETON(LLTexLayerStaticImageList);
+ ~LLTexLayerStaticImageList();
public:
- LLGLTexture* getTexture(const std::string& file_name, BOOL is_mask);
- LLImageTGA* getImageTGA(const std::string& file_name);
- void deleteCachedImages();
- void dumpByteCount() const;
+ LLGLTexture* getTexture(const std::string& file_name, BOOL is_mask);
+ LLImageTGA* getImageTGA(const std::string& file_name);
+ void deleteCachedImages();
+ void dumpByteCount() const;
protected:
- BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
+ BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
private:
- LLStringTable mImageNames;
- typedef std::map<const char*, LLPointer<LLGLTexture> > texture_map_t;
- texture_map_t mStaticImageList;
- typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
- image_tga_map_t mStaticImageListTGA;
- S32 mGLBytes;
- S32 mTGABytes;
+ LLStringTable mImageNames;
+ typedef std::map<const char*, LLPointer<LLGLTexture> > texture_map_t;
+ texture_map_t mStaticImageList;
+ typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
+ image_tga_map_t mStaticImageListTGA;
+ S32 mGLBytes;
+ S32 mTGABytes;
};
#endif // LL_LLTEXLAYER_H
diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp
index 604e0124cb..2e7495b55f 100644
--- a/indra/llappearance/lltexlayerparams.cpp
+++ b/indra/llappearance/lltexlayerparams.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexlayerparams.cpp
* @brief Texture layer parameters
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,45 +41,45 @@
// LLTexLayerParam
//-----------------------------------------------------------------------------
LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer)
- : LLViewerVisualParam(),
- mTexLayer(layer),
- mAvatarAppearance(NULL)
+ : LLViewerVisualParam(),
+ mTexLayer(layer),
+ mAvatarAppearance(NULL)
{
- if (mTexLayer != NULL)
- {
- mAvatarAppearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
- }
- else
- {
- LL_ERRS() << "LLTexLayerParam constructor passed with NULL reference for layer!" << LL_ENDL;
- }
+ if (mTexLayer != NULL)
+ {
+ mAvatarAppearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
+ }
+ else
+ {
+ LL_ERRS() << "LLTexLayerParam constructor passed with NULL reference for layer!" << LL_ENDL;
+ }
}
LLTexLayerParam::LLTexLayerParam(LLAvatarAppearance *appearance)
- : LLViewerVisualParam(),
- mTexLayer(NULL),
- mAvatarAppearance(appearance)
+ : LLViewerVisualParam(),
+ mTexLayer(NULL),
+ mAvatarAppearance(appearance)
{
}
LLTexLayerParam::LLTexLayerParam(const LLTexLayerParam& pOther)
- : LLViewerVisualParam(pOther),
- mTexLayer(pOther.mTexLayer),
- mAvatarAppearance(pOther.mAvatarAppearance)
+ : LLViewerVisualParam(pOther),
+ mTexLayer(pOther.mTexLayer),
+ mAvatarAppearance(pOther.mAvatarAppearance)
{
}
BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance)
{
- LLViewerVisualParam::setInfo(info);
+ LLViewerVisualParam::setInfo(info);
- if (add_to_appearance)
- {
- mAvatarAppearance->addVisualParam( this);
- this->setParamLocation(mAvatarAppearance->isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
- }
+ if (add_to_appearance)
+ {
+ mAvatarAppearance->addVisualParam( this);
+ this->setParamLocation(mAvatarAppearance->isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
+ }
- return TRUE;
+ return TRUE;
}
@@ -87,350 +87,350 @@ BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appeara
// LLTexLayerParamAlpha
//-----------------------------------------------------------------------------
-// static
+// static
LLTexLayerParamAlpha::param_alpha_ptr_list_t LLTexLayerParamAlpha::sInstances;
-// static
+// static
void LLTexLayerParamAlpha::dumpCacheByteCount()
{
- S32 gl_bytes = 0;
- getCacheByteCount( &gl_bytes);
- LL_INFOS() << "Processed Alpha Texture Cache GL:" << (gl_bytes/1024) << "KB" << LL_ENDL;
+ S32 gl_bytes = 0;
+ getCacheByteCount( &gl_bytes);
+ LL_INFOS() << "Processed Alpha Texture Cache GL:" << (gl_bytes/1024) << "KB" << LL_ENDL;
}
-// static
+// static
void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes)
{
- *gl_bytes = 0;
-
- for (LLTexLayerParamAlpha* instance : sInstances)
- {
- LLGLTexture* tex = instance->mCachedProcessedTexture;
- if (tex)
- {
- S32 bytes = (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
-
- if (tex->hasGLTexture())
- {
- *gl_bytes += bytes;
- }
- }
- }
+ *gl_bytes = 0;
+
+ for (LLTexLayerParamAlpha* instance : sInstances)
+ {
+ LLGLTexture* tex = instance->mCachedProcessedTexture;
+ if (tex)
+ {
+ S32 bytes = (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
+
+ if (tex->hasGLTexture())
+ {
+ *gl_bytes += bytes;
+ }
+ }
+ }
}
LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer)
- : LLTexLayerParam(layer),
- mCachedProcessedTexture(NULL),
- mStaticImageTGA(),
- mStaticImageRaw(),
- mNeedsCreateTexture(FALSE),
- mStaticImageInvalid(FALSE),
- mAvgDistortionVec(1.f, 1.f, 1.f),
- mCachedEffectiveWeight(0.f)
+ : LLTexLayerParam(layer),
+ mCachedProcessedTexture(NULL),
+ mStaticImageTGA(),
+ mStaticImageRaw(),
+ mNeedsCreateTexture(FALSE),
+ mStaticImageInvalid(FALSE),
+ mAvgDistortionVec(1.f, 1.f, 1.f),
+ mCachedEffectiveWeight(0.f)
{
- sInstances.push_front(this);
+ sInstances.push_front(this);
}
LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLAvatarAppearance* appearance)
- : LLTexLayerParam(appearance),
- mCachedProcessedTexture(NULL),
- mStaticImageTGA(),
- mStaticImageRaw(),
- mNeedsCreateTexture(FALSE),
- mStaticImageInvalid(FALSE),
- mAvgDistortionVec(1.f, 1.f, 1.f),
- mCachedEffectiveWeight(0.f)
+ : LLTexLayerParam(appearance),
+ mCachedProcessedTexture(NULL),
+ mStaticImageTGA(),
+ mStaticImageRaw(),
+ mNeedsCreateTexture(FALSE),
+ mStaticImageInvalid(FALSE),
+ mAvgDistortionVec(1.f, 1.f, 1.f),
+ mCachedEffectiveWeight(0.f)
{
- sInstances.push_front(this);
+ sInstances.push_front(this);
}
LLTexLayerParamAlpha::LLTexLayerParamAlpha(const LLTexLayerParamAlpha& pOther)
- : LLTexLayerParam(pOther),
- mCachedProcessedTexture(pOther.mCachedProcessedTexture),
- mStaticImageTGA(pOther.mStaticImageTGA),
- mStaticImageRaw(pOther.mStaticImageRaw),
- mNeedsCreateTexture(pOther.mNeedsCreateTexture.load()),
- mStaticImageInvalid(pOther.mStaticImageInvalid),
- mAvgDistortionVec(pOther.mAvgDistortionVec),
- mCachedEffectiveWeight(pOther.mCachedEffectiveWeight)
+ : LLTexLayerParam(pOther),
+ mCachedProcessedTexture(pOther.mCachedProcessedTexture),
+ mStaticImageTGA(pOther.mStaticImageTGA),
+ mStaticImageRaw(pOther.mStaticImageRaw),
+ mNeedsCreateTexture(pOther.mNeedsCreateTexture.load()),
+ mStaticImageInvalid(pOther.mStaticImageInvalid),
+ mAvgDistortionVec(pOther.mAvgDistortionVec),
+ mCachedEffectiveWeight(pOther.mCachedEffectiveWeight)
{
- sInstances.push_front(this);
+ sInstances.push_front(this);
}
LLTexLayerParamAlpha::~LLTexLayerParamAlpha()
{
- deleteCaches();
- sInstances.remove(this);
+ deleteCaches();
+ sInstances.remove(this);
}
/*virtual*/ LLViewerVisualParam* LLTexLayerParamAlpha::cloneParam(LLWearable* wearable) const
{
- return new LLTexLayerParamAlpha(*this);
+ return new LLTexLayerParamAlpha(*this);
}
void LLTexLayerParamAlpha::deleteCaches()
{
- mStaticImageTGA = NULL; // deletes image
- mCachedProcessedTexture = NULL;
- mStaticImageRaw = NULL;
- mNeedsCreateTexture = FALSE;
+ mStaticImageTGA = NULL; // deletes image
+ mCachedProcessedTexture = NULL;
+ mStaticImageRaw = NULL;
+ mNeedsCreateTexture = FALSE;
}
BOOL LLTexLayerParamAlpha::getMultiplyBlend() const
{
- return ((LLTexLayerParamAlphaInfo *)getInfo())->mMultiplyBlend;
+ return ((LLTexLayerParamAlphaInfo *)getInfo())->mMultiplyBlend;
}
void LLTexLayerParamAlpha::setWeight(F32 weight)
{
- if (mIsAnimating || mTexLayer == NULL)
- {
- return;
- }
- F32 min_weight = getMinWeight();
- F32 max_weight = getMaxWeight();
- F32 new_weight = llclamp(weight, min_weight, max_weight);
- U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight);
- U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight);
- if (cur_u8 != new_u8)
- {
- mCurWeight = new_weight;
-
- if ((mAvatarAppearance->getSex() & getSex()) &&
- (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
- {
- mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet());
- mTexLayer->invalidateMorphMasks();
- }
- }
+ if (mIsAnimating || mTexLayer == NULL)
+ {
+ return;
+ }
+ F32 min_weight = getMinWeight();
+ F32 max_weight = getMaxWeight();
+ F32 new_weight = llclamp(weight, min_weight, max_weight);
+ U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight);
+ U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight);
+ if (cur_u8 != new_u8)
+ {
+ mCurWeight = new_weight;
+
+ if ((mAvatarAppearance->getSex() & getSex()) &&
+ (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
+ {
+ mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet());
+ mTexLayer->invalidateMorphMasks();
+ }
+ }
}
void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value)
-{
- // do not animate dummy parameters
- if (mIsDummy)
- {
- setWeight(target_value);
- return;
- }
-
- mTargetWeight = target_value;
- setWeight(target_value);
- mIsAnimating = TRUE;
- if (mNext)
- {
- mNext->setAnimationTarget(target_value);
- }
+{
+ // do not animate dummy parameters
+ if (mIsDummy)
+ {
+ setWeight(target_value);
+ return;
+ }
+
+ mTargetWeight = target_value;
+ setWeight(target_value);
+ mIsAnimating = TRUE;
+ if (mNext)
+ {
+ mNext->setAnimationTarget(target_value);
+ }
}
void LLTexLayerParamAlpha::animate(F32 delta)
{
- if (mNext)
- {
- mNext->animate(delta);
- }
+ if (mNext)
+ {
+ mNext->animate(delta);
+ }
}
BOOL LLTexLayerParamAlpha::getSkip() const
{
- if (!mTexLayer)
- {
- return TRUE;
- }
-
- const LLAvatarAppearance *appearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
-
- if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight)
- {
- F32 effective_weight = (appearance->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
- if (is_approx_zero(effective_weight))
- {
- return TRUE;
- }
- }
-
- LLWearableType::EType type = (LLWearableType::EType)getWearableType();
- if ((type != LLWearableType::WT_INVALID) && !appearance->isWearingWearableType(type))
- {
- return TRUE;
- }
-
- return FALSE;
+ if (!mTexLayer)
+ {
+ return TRUE;
+ }
+
+ const LLAvatarAppearance *appearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
+
+ if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight)
+ {
+ F32 effective_weight = (appearance->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
+ if (is_approx_zero(effective_weight))
+ {
+ return TRUE;
+ }
+ }
+
+ LLWearableType::EType type = (LLWearableType::EType)getWearableType();
+ if ((type != LLWearableType::WT_INVALID) && !appearance->isWearingWearableType(type))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
}
BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
{
LL_PROFILE_ZONE_SCOPED;
- BOOL success = TRUE;
-
- if (!mTexLayer)
- {
- return success;
- }
-
- F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatarAppearance()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
- BOOL weight_changed = effective_weight != mCachedEffectiveWeight;
- if (getSkip())
- {
- return success;
- }
-
- LLTexLayerParamAlphaInfo *info = (LLTexLayerParamAlphaInfo *)getInfo();
- gGL.flush();
- if (info->mMultiplyBlend)
- {
- gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); // Multiplication: approximates a min() function
- }
- else
- {
- gGL.setSceneBlendType(LLRender::BT_ADD); // Addition: approximates a max() function
- }
-
- if (!info->mStaticImageFileName.empty() && !mStaticImageInvalid)
- {
- if (mStaticImageTGA.isNull())
- {
- // Don't load the image file until we actually need it the first time. Like now.
- mStaticImageTGA = LLTexLayerStaticImageList::getInstance()->getImageTGA(info->mStaticImageFileName);
- // We now have something in one of our caches
- LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull() ? TRUE : FALSE;
-
- if (mStaticImageTGA.isNull())
- {
- LL_WARNS() << "Unable to load static file: " << info->mStaticImageFileName << LL_ENDL;
- mStaticImageInvalid = TRUE; // don't try again.
- return FALSE;
- }
- }
-
- const S32 image_tga_width = mStaticImageTGA->getWidth();
- const S32 image_tga_height = mStaticImageTGA->getHeight();
- if (!mCachedProcessedTexture ||
- (mCachedProcessedTexture->getWidth() != image_tga_width) ||
- (mCachedProcessedTexture->getHeight() != image_tga_height) ||
- (weight_changed))
- {
- mCachedEffectiveWeight = effective_weight;
-
- if (!mCachedProcessedTexture)
- {
- llassert(gTextureManagerBridgep);
- mCachedProcessedTexture = gTextureManagerBridgep->getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
-
- // We now have something in one of our caches
- LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE;
-
- mCachedProcessedTexture->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
- }
-
- // Applies domain and effective weight to data as it is decoded. Also resizes the raw image if needed.
- mStaticImageRaw = NULL;
- mStaticImageRaw = new LLImageRaw;
- mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight);
- mNeedsCreateTexture = TRUE;
- LL_DEBUGS() << "Built Cached Alpha: " << info->mStaticImageFileName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << "Domain: " << info->mDomain << " Weight: " << effective_weight << LL_ENDL;
- }
-
- if (mCachedProcessedTexture)
- {
- {
- // Create the GL texture, and then hang onto it for future use.
- if (mNeedsCreateTexture)
- {
- mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw);
- mNeedsCreateTexture = FALSE;
- gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
- mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
- }
-
- gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
- gl_rect_2d_simple_tex(width, height);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- stop_glerror();
- }
- }
-
- // Don't keep the cache for other people's avatars
- // (It's not really a "cache" in that case, but the logic is the same)
- if (!mAvatarAppearance->isSelf())
- {
- mCachedProcessedTexture = NULL;
- }
- }
- else
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4f(0.f, 0.f, 0.f, effective_weight);
- gl_rect_2d_simple(width, height);
- }
-
- return success;
+ BOOL success = TRUE;
+
+ if (!mTexLayer)
+ {
+ return success;
+ }
+
+ F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatarAppearance()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
+ BOOL weight_changed = effective_weight != mCachedEffectiveWeight;
+ if (getSkip())
+ {
+ return success;
+ }
+
+ LLTexLayerParamAlphaInfo *info = (LLTexLayerParamAlphaInfo *)getInfo();
+ gGL.flush();
+ if (info->mMultiplyBlend)
+ {
+ gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); // Multiplication: approximates a min() function
+ }
+ else
+ {
+ gGL.setSceneBlendType(LLRender::BT_ADD); // Addition: approximates a max() function
+ }
+
+ if (!info->mStaticImageFileName.empty() && !mStaticImageInvalid)
+ {
+ if (mStaticImageTGA.isNull())
+ {
+ // Don't load the image file until we actually need it the first time. Like now.
+ mStaticImageTGA = LLTexLayerStaticImageList::getInstance()->getImageTGA(info->mStaticImageFileName);
+ // We now have something in one of our caches
+ LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull() ? TRUE : FALSE;
+
+ if (mStaticImageTGA.isNull())
+ {
+ LL_WARNS() << "Unable to load static file: " << info->mStaticImageFileName << LL_ENDL;
+ mStaticImageInvalid = TRUE; // don't try again.
+ return FALSE;
+ }
+ }
+
+ const S32 image_tga_width = mStaticImageTGA->getWidth();
+ const S32 image_tga_height = mStaticImageTGA->getHeight();
+ if (!mCachedProcessedTexture ||
+ (mCachedProcessedTexture->getWidth() != image_tga_width) ||
+ (mCachedProcessedTexture->getHeight() != image_tga_height) ||
+ (weight_changed))
+ {
+ mCachedEffectiveWeight = effective_weight;
+
+ if (!mCachedProcessedTexture)
+ {
+ llassert(gTextureManagerBridgep);
+ mCachedProcessedTexture = gTextureManagerBridgep->getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
+
+ // We now have something in one of our caches
+ LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE;
+
+ mCachedProcessedTexture->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
+ }
+
+ // Applies domain and effective weight to data as it is decoded. Also resizes the raw image if needed.
+ mStaticImageRaw = NULL;
+ mStaticImageRaw = new LLImageRaw;
+ mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight);
+ mNeedsCreateTexture = TRUE;
+ LL_DEBUGS() << "Built Cached Alpha: " << info->mStaticImageFileName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << "Domain: " << info->mDomain << " Weight: " << effective_weight << LL_ENDL;
+ }
+
+ if (mCachedProcessedTexture)
+ {
+ {
+ // Create the GL texture, and then hang onto it for future use.
+ if (mNeedsCreateTexture)
+ {
+ mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw);
+ mNeedsCreateTexture = FALSE;
+ gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
+ mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
+
+ gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
+ gl_rect_2d_simple_tex(width, height);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ stop_glerror();
+ }
+ }
+
+ // Don't keep the cache for other people's avatars
+ // (It's not really a "cache" in that case, but the logic is the same)
+ if (!mAvatarAppearance->isSelf())
+ {
+ mCachedProcessedTexture = NULL;
+ }
+ }
+ else
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.color4f(0.f, 0.f, 0.f, effective_weight);
+ gl_rect_2d_simple(width, height);
+ }
+
+ return success;
}
//-----------------------------------------------------------------------------
// LLTexLayerParamAlphaInfo
//-----------------------------------------------------------------------------
LLTexLayerParamAlphaInfo::LLTexLayerParamAlphaInfo() :
- mMultiplyBlend(FALSE),
- mSkipIfZeroWeight(FALSE),
- mDomain(0.f)
+ mMultiplyBlend(FALSE),
+ mSkipIfZeroWeight(FALSE),
+ mDomain(0.f)
{
}
BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node)
{
- llassert(node->hasName("param") && node->getChildByName("param_alpha"));
-
- if (!LLViewerVisualParamInfo::parseXml(node))
- return FALSE;
-
- LLXmlTreeNode* param_alpha_node = node->getChildByName("param_alpha");
- if (!param_alpha_node)
- {
- return FALSE;
- }
-
- static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file");
- if (param_alpha_node->getFastAttributeString(tga_file_string, mStaticImageFileName))
- {
- // Don't load the image file until it's actually needed.
- }
-// else
-// {
-// LL_WARNS() << "<param_alpha> element is missing tga_file attribute." << LL_ENDL;
-// }
-
- static LLStdStringHandle multiply_blend_string = LLXmlTree::addAttributeString("multiply_blend");
- param_alpha_node->getFastAttributeBOOL(multiply_blend_string, mMultiplyBlend);
-
- static LLStdStringHandle skip_if_zero_string = LLXmlTree::addAttributeString("skip_if_zero");
- param_alpha_node->getFastAttributeBOOL(skip_if_zero_string, mSkipIfZeroWeight);
-
- static LLStdStringHandle domain_string = LLXmlTree::addAttributeString("domain");
- param_alpha_node->getFastAttributeF32(domain_string, mDomain);
-
- return TRUE;
+ llassert(node->hasName("param") && node->getChildByName("param_alpha"));
+
+ if (!LLViewerVisualParamInfo::parseXml(node))
+ return FALSE;
+
+ LLXmlTreeNode* param_alpha_node = node->getChildByName("param_alpha");
+ if (!param_alpha_node)
+ {
+ return FALSE;
+ }
+
+ static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file");
+ if (param_alpha_node->getFastAttributeString(tga_file_string, mStaticImageFileName))
+ {
+ // Don't load the image file until it's actually needed.
+ }
+// else
+// {
+// LL_WARNS() << "<param_alpha> element is missing tga_file attribute." << LL_ENDL;
+// }
+
+ static LLStdStringHandle multiply_blend_string = LLXmlTree::addAttributeString("multiply_blend");
+ param_alpha_node->getFastAttributeBOOL(multiply_blend_string, mMultiplyBlend);
+
+ static LLStdStringHandle skip_if_zero_string = LLXmlTree::addAttributeString("skip_if_zero");
+ param_alpha_node->getFastAttributeBOOL(skip_if_zero_string, mSkipIfZeroWeight);
+
+ static LLStdStringHandle domain_string = LLXmlTree::addAttributeString("domain");
+ param_alpha_node->getFastAttributeF32(domain_string, mDomain);
+
+ return TRUE;
}
LLTexLayerParamColor::LLTexLayerParamColor(LLTexLayerInterface* layer)
- : LLTexLayerParam(layer),
- mAvgDistortionVec(1.f, 1.f, 1.f)
+ : LLTexLayerParam(layer),
+ mAvgDistortionVec(1.f, 1.f, 1.f)
{
}
LLTexLayerParamColor::LLTexLayerParamColor(LLAvatarAppearance *appearance)
- : LLTexLayerParam(appearance),
- mAvgDistortionVec(1.f, 1.f, 1.f)
+ : LLTexLayerParam(appearance),
+ mAvgDistortionVec(1.f, 1.f, 1.f)
{
}
LLTexLayerParamColor::LLTexLayerParamColor(const LLTexLayerParamColor& pOther)
- : LLTexLayerParam(pOther),
- mAvgDistortionVec(pOther.mAvgDistortionVec)
+ : LLTexLayerParam(pOther),
+ mAvgDistortionVec(pOther.mAvgDistortionVec)
{
}
@@ -440,155 +440,155 @@ LLTexLayerParamColor::~LLTexLayerParamColor()
/*virtual*/ LLViewerVisualParam* LLTexLayerParamColor::cloneParam(LLWearable* wearable) const
{
- return new LLTexLayerParamColor(*this);
+ return new LLTexLayerParamColor(*this);
}
LLColor4 LLTexLayerParamColor::getNetColor() const
{
- const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo();
-
- llassert(info->mNumColors >= 1);
-
- F32 effective_weight = (mAvatarAppearance && (mAvatarAppearance->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
-
- S32 index_last = info->mNumColors - 1;
- F32 scaled_weight = effective_weight * index_last;
- S32 index_start = (S32) scaled_weight;
- S32 index_end = index_start + 1;
- if (index_start == index_last)
- {
- return info->mColors[index_last];
- }
- else
- {
- F32 weight = scaled_weight - index_start;
- const LLColor4 *start = &info->mColors[ index_start ];
- const LLColor4 *end = &info->mColors[ index_end ];
- return LLColor4((1.f - weight) * start->mV[VX] + weight * end->mV[VX],
- (1.f - weight) * start->mV[VY] + weight * end->mV[VY],
- (1.f - weight) * start->mV[VZ] + weight * end->mV[VZ],
- (1.f - weight) * start->mV[VW] + weight * end->mV[VW]);
- }
+ const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo();
+
+ llassert(info->mNumColors >= 1);
+
+ F32 effective_weight = (mAvatarAppearance && (mAvatarAppearance->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
+
+ S32 index_last = info->mNumColors - 1;
+ F32 scaled_weight = effective_weight * index_last;
+ S32 index_start = (S32) scaled_weight;
+ S32 index_end = index_start + 1;
+ if (index_start == index_last)
+ {
+ return info->mColors[index_last];
+ }
+ else
+ {
+ F32 weight = scaled_weight - index_start;
+ const LLColor4 *start = &info->mColors[ index_start ];
+ const LLColor4 *end = &info->mColors[ index_end ];
+ return LLColor4((1.f - weight) * start->mV[VX] + weight * end->mV[VX],
+ (1.f - weight) * start->mV[VY] + weight * end->mV[VY],
+ (1.f - weight) * start->mV[VZ] + weight * end->mV[VZ],
+ (1.f - weight) * start->mV[VW] + weight * end->mV[VW]);
+ }
}
void LLTexLayerParamColor::setWeight(F32 weight)
{
- if (mIsAnimating)
- {
- return;
- }
-
- F32 min_weight = getMinWeight();
- F32 max_weight = getMaxWeight();
- F32 new_weight = llclamp(weight, min_weight, max_weight);
- U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight);
- U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight);
- if (cur_u8 != new_u8)
- {
- mCurWeight = new_weight;
+ if (mIsAnimating)
+ {
+ return;
+ }
+
+ F32 min_weight = getMinWeight();
+ F32 max_weight = getMaxWeight();
+ F32 new_weight = llclamp(weight, min_weight, max_weight);
+ U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight);
+ U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight);
+ if (cur_u8 != new_u8)
+ {
+ mCurWeight = new_weight;
const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo();
- if (info->mNumColors <= 0)
- {
- // This will happen when we set the default weight the first time.
- return;
- }
-
- if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
- {
- onGlobalColorChanged();
- if (mTexLayer)
- {
- mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet());
- }
- }
-
-// LL_INFOS() << "param " << mName << " = " << new_weight << LL_ENDL;
- }
+ if (info->mNumColors <= 0)
+ {
+ // This will happen when we set the default weight the first time.
+ return;
+ }
+
+ if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
+ {
+ onGlobalColorChanged();
+ if (mTexLayer)
+ {
+ mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet());
+ }
+ }
+
+// LL_INFOS() << "param " << mName << " = " << new_weight << LL_ENDL;
+ }
}
void LLTexLayerParamColor::setAnimationTarget(F32 target_value)
-{
- // set value first then set interpolating flag to ignore further updates
- mTargetWeight = target_value;
- setWeight(target_value);
- mIsAnimating = TRUE;
- if (mNext)
- {
- mNext->setAnimationTarget(target_value);
- }
+{
+ // set value first then set interpolating flag to ignore further updates
+ mTargetWeight = target_value;
+ setWeight(target_value);
+ mIsAnimating = TRUE;
+ if (mNext)
+ {
+ mNext->setAnimationTarget(target_value);
+ }
}
void LLTexLayerParamColor::animate(F32 delta)
{
- if (mNext)
- {
- mNext->animate(delta);
- }
+ if (mNext)
+ {
+ mNext->animate(delta);
+ }
}
//-----------------------------------------------------------------------------
// LLTexLayerParamColorInfo
//-----------------------------------------------------------------------------
LLTexLayerParamColorInfo::LLTexLayerParamColorInfo() :
- mOperation(LLTexLayerParamColor::OP_ADD),
- mNumColors(0)
+ mOperation(LLTexLayerParamColor::OP_ADD),
+ mNumColors(0)
{
}
BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node)
{
- llassert(node->hasName("param") && node->getChildByName("param_color"));
-
- if (!LLViewerVisualParamInfo::parseXml(node))
- return FALSE;
-
- LLXmlTreeNode* param_color_node = node->getChildByName("param_color");
- if (!param_color_node)
- {
- return FALSE;
- }
-
- std::string op_string;
- static LLStdStringHandle operation_string = LLXmlTree::addAttributeString("operation");
- if (param_color_node->getFastAttributeString(operation_string, op_string))
- {
- LLStringUtil::toLower(op_string);
- if (op_string == "add") mOperation = LLTexLayerParamColor::OP_ADD;
- else if (op_string == "multiply") mOperation = LLTexLayerParamColor::OP_MULTIPLY;
- else if (op_string == "blend") mOperation = LLTexLayerParamColor::OP_BLEND;
- }
-
- mNumColors = 0;
-
- LLColor4U color4u;
- for (LLXmlTreeNode* child = param_color_node->getChildByName("value");
- child;
- child = param_color_node->getNextNamedChild())
- {
- if ((mNumColors < MAX_COLOR_VALUES))
- {
- static LLStdStringHandle color_string = LLXmlTree::addAttributeString("color");
- if (child->getFastAttributeColor4U(color_string, color4u))
- {
- mColors[ mNumColors ].setVec(color4u);
- mNumColors++;
- }
- }
- }
- if (!mNumColors)
- {
- LL_WARNS() << "<param_color> is missing <value> sub-elements" << LL_ENDL;
- return FALSE;
- }
-
- if ((mOperation == LLTexLayerParamColor::OP_BLEND) && (mNumColors != 1))
- {
- LL_WARNS() << "<param_color> with operation\"blend\" must have exactly one <value>" << LL_ENDL;
- return FALSE;
- }
-
- return TRUE;
+ llassert(node->hasName("param") && node->getChildByName("param_color"));
+
+ if (!LLViewerVisualParamInfo::parseXml(node))
+ return FALSE;
+
+ LLXmlTreeNode* param_color_node = node->getChildByName("param_color");
+ if (!param_color_node)
+ {
+ return FALSE;
+ }
+
+ std::string op_string;
+ static LLStdStringHandle operation_string = LLXmlTree::addAttributeString("operation");
+ if (param_color_node->getFastAttributeString(operation_string, op_string))
+ {
+ LLStringUtil::toLower(op_string);
+ if (op_string == "add") mOperation = LLTexLayerParamColor::OP_ADD;
+ else if (op_string == "multiply") mOperation = LLTexLayerParamColor::OP_MULTIPLY;
+ else if (op_string == "blend") mOperation = LLTexLayerParamColor::OP_BLEND;
+ }
+
+ mNumColors = 0;
+
+ LLColor4U color4u;
+ for (LLXmlTreeNode* child = param_color_node->getChildByName("value");
+ child;
+ child = param_color_node->getNextNamedChild())
+ {
+ if ((mNumColors < MAX_COLOR_VALUES))
+ {
+ static LLStdStringHandle color_string = LLXmlTree::addAttributeString("color");
+ if (child->getFastAttributeColor4U(color_string, color4u))
+ {
+ mColors[ mNumColors ].setVec(color4u);
+ mNumColors++;
+ }
+ }
+ }
+ if (!mNumColors)
+ {
+ LL_WARNS() << "<param_color> is missing <value> sub-elements" << LL_ENDL;
+ return FALSE;
+ }
+
+ if ((mOperation == LLTexLayerParamColor::OP_BLEND) && (mNumColors != 1))
+ {
+ LL_WARNS() << "<param_color> with operation\"blend\" must have exactly one <value>" << LL_ENDL;
+ return FALSE;
+ }
+
+ return TRUE;
}
diff --git a/indra/llappearance/lltexlayerparams.h b/indra/llappearance/lltexlayerparams.h
index 000f55685e..54264c119a 100644
--- a/indra/llappearance/lltexlayerparams.h
+++ b/indra/llappearance/lltexlayerparams.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltexlayerparams.h
* @brief Texture layer parameters, used by lltexlayer.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,92 +41,92 @@ class LLWearable;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerParam
-//
+//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerParam : public LLViewerVisualParam
{
-public:
- LLTexLayerParam(LLTexLayerInterface *layer);
- LLTexLayerParam(LLAvatarAppearance *appearance);
- /*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance);
- /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0;
+public:
+ LLTexLayerParam(LLTexLayerInterface *layer);
+ LLTexLayerParam(LLAvatarAppearance *appearance);
+ /*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance);
+ /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0;
protected:
- LLTexLayerParam(const LLTexLayerParam& pOther);
+ LLTexLayerParam(const LLTexLayerParam& pOther);
- LLTexLayerInterface* mTexLayer;
- LLAvatarAppearance* mAvatarAppearance;
+ LLTexLayerInterface* mTexLayer;
+ LLAvatarAppearance* mAvatarAppearance;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerParamAlpha
-//
+//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL_ALIGN_PREFIX(16)
class alignas(16) LLTexLayerParamAlpha : public LLTexLayerParam
{
LL_ALIGN_NEW
public:
- LLTexLayerParamAlpha( LLTexLayerInterface* layer );
- LLTexLayerParamAlpha( LLAvatarAppearance* appearance );
- /*virtual*/ ~LLTexLayerParamAlpha();
-
- /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
-
- // LLVisualParam Virtual functions
- ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
- /*virtual*/ void apply( ESex avatar_sex ) {}
- /*virtual*/ void setWeight(F32 weight);
- /*virtual*/ void setAnimationTarget(F32 target_value);
- /*virtual*/ void animate(F32 delta);
-
- // LLViewerVisualParam Virtual functions
- /*virtual*/ F32 getTotalDistortion() { return 1.f; }
- /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; }
- /*virtual*/ F32 getMaxDistortion() { return 3.f; }
- /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f);}
- /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
- /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
-
- // New functions
- BOOL render( S32 x, S32 y, S32 width, S32 height );
- BOOL getSkip() const;
- void deleteCaches();
- BOOL getMultiplyBlend() const;
+ LLTexLayerParamAlpha( LLTexLayerInterface* layer );
+ LLTexLayerParamAlpha( LLAvatarAppearance* appearance );
+ /*virtual*/ ~LLTexLayerParamAlpha();
+
+ /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
+
+ // LLVisualParam Virtual functions
+ ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
+ /*virtual*/ void apply( ESex avatar_sex ) {}
+ /*virtual*/ void setWeight(F32 weight);
+ /*virtual*/ void setAnimationTarget(F32 target_value);
+ /*virtual*/ void animate(F32 delta);
+
+ // LLViewerVisualParam Virtual functions
+ /*virtual*/ F32 getTotalDistortion() { return 1.f; }
+ /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; }
+ /*virtual*/ F32 getMaxDistortion() { return 3.f; }
+ /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f);}
+ /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
+ /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
+
+ // New functions
+ BOOL render( S32 x, S32 y, S32 width, S32 height );
+ BOOL getSkip() const;
+ void deleteCaches();
+ BOOL getMultiplyBlend() const;
private:
- LLTexLayerParamAlpha(const LLTexLayerParamAlpha& pOther);
+ LLTexLayerParamAlpha(const LLTexLayerParamAlpha& pOther);
- LLPointer<LLGLTexture> mCachedProcessedTexture;
- LLPointer<LLImageTGA> mStaticImageTGA;
- LLPointer<LLImageRaw> mStaticImageRaw;
- std::atomic<BOOL> mNeedsCreateTexture;
- BOOL mStaticImageInvalid;
- LL_ALIGN_16(LLVector4a mAvgDistortionVec);
- F32 mCachedEffectiveWeight;
+ LLPointer<LLGLTexture> mCachedProcessedTexture;
+ LLPointer<LLImageTGA> mStaticImageTGA;
+ LLPointer<LLImageRaw> mStaticImageRaw;
+ std::atomic<BOOL> mNeedsCreateTexture;
+ BOOL mStaticImageInvalid;
+ LL_ALIGN_16(LLVector4a mAvgDistortionVec);
+ F32 mCachedEffectiveWeight;
public:
- // Global list of instances for gathering statistics
- static void dumpCacheByteCount();
- static void getCacheByteCount( S32* gl_bytes );
+ // Global list of instances for gathering statistics
+ static void dumpCacheByteCount();
+ static void getCacheByteCount( S32* gl_bytes );
- typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t;
- static param_alpha_ptr_list_t sInstances;
+ typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t;
+ static param_alpha_ptr_list_t sInstances;
} LL_ALIGN_POSTFIX(16);
class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo
{
- friend class LLTexLayerParamAlpha;
+ friend class LLTexLayerParamAlpha;
public:
- LLTexLayerParamAlphaInfo();
- /*virtual*/ ~LLTexLayerParamAlphaInfo() {};
+ LLTexLayerParamAlphaInfo();
+ /*virtual*/ ~LLTexLayerParamAlphaInfo() {};
- /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
+ /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
private:
- std::string mStaticImageFileName;
- BOOL mMultiplyBlend;
- BOOL mSkipIfZeroWeight;
- F32 mDomain;
+ std::string mStaticImageFileName;
+ BOOL mMultiplyBlend;
+ BOOL mSkipIfZeroWeight;
+ F32 mDomain;
};
//
// LLTexLayerParamAlpha
@@ -141,61 +141,61 @@ class alignas(16) LLTexLayerParamColor : public LLTexLayerParam
{
LL_ALIGN_NEW
public:
- enum EColorOperation
- {
- OP_ADD = 0,
- OP_MULTIPLY = 1,
- OP_BLEND = 2,
- OP_COUNT = 3 // Number of operations
- };
-
- LLTexLayerParamColor( LLTexLayerInterface* layer );
- LLTexLayerParamColor( LLAvatarAppearance* appearance );
-
- /* virtual */ ~LLTexLayerParamColor();
-
- /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
-
- // LLVisualParam Virtual functions
- ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
- /*virtual*/ void apply( ESex avatar_sex ) {}
- /*virtual*/ void setWeight(F32 weight);
- /*virtual*/ void setAnimationTarget(F32 target_value);
- /*virtual*/ void animate(F32 delta);
-
-
- // LLViewerVisualParam Virtual functions
- /*virtual*/ F32 getTotalDistortion() { return 1.f; }
- /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; }
- /*virtual*/ F32 getMaxDistortion() { return 3.f; }
- /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f); }
- /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
- /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
-
- // New functions
- LLColor4 getNetColor() const;
+ enum EColorOperation
+ {
+ OP_ADD = 0,
+ OP_MULTIPLY = 1,
+ OP_BLEND = 2,
+ OP_COUNT = 3 // Number of operations
+ };
+
+ LLTexLayerParamColor( LLTexLayerInterface* layer );
+ LLTexLayerParamColor( LLAvatarAppearance* appearance );
+
+ /* virtual */ ~LLTexLayerParamColor();
+
+ /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
+
+ // LLVisualParam Virtual functions
+ ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
+ /*virtual*/ void apply( ESex avatar_sex ) {}
+ /*virtual*/ void setWeight(F32 weight);
+ /*virtual*/ void setAnimationTarget(F32 target_value);
+ /*virtual*/ void animate(F32 delta);
+
+
+ // LLViewerVisualParam Virtual functions
+ /*virtual*/ F32 getTotalDistortion() { return 1.f; }
+ /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; }
+ /*virtual*/ F32 getMaxDistortion() { return 3.f; }
+ /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f); }
+ /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
+ /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
+
+ // New functions
+ LLColor4 getNetColor() const;
protected:
- LLTexLayerParamColor(const LLTexLayerParamColor& pOther);
+ LLTexLayerParamColor(const LLTexLayerParamColor& pOther);
- virtual void onGlobalColorChanged() {}
+ virtual void onGlobalColorChanged() {}
private:
- LLVector4a mAvgDistortionVec;
+ LLVector4a mAvgDistortionVec;
};
class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo
{
- friend class LLTexLayerParamColor;
+ friend class LLTexLayerParamColor;
public:
- LLTexLayerParamColorInfo();
- virtual ~LLTexLayerParamColorInfo() {};
- BOOL parseXml( LLXmlTreeNode* node );
- LLTexLayerParamColor::EColorOperation getOperation() const { return mOperation; }
+ LLTexLayerParamColorInfo();
+ virtual ~LLTexLayerParamColorInfo() {};
+ BOOL parseXml( LLXmlTreeNode* node );
+ LLTexLayerParamColor::EColorOperation getOperation() const { return mOperation; }
private:
- enum { MAX_COLOR_VALUES = 20 };
- LLTexLayerParamColor::EColorOperation mOperation;
- LLColor4 mColors[MAX_COLOR_VALUES];
- S32 mNumColors;
+ enum { MAX_COLOR_VALUES = 20 };
+ LLTexLayerParamColor::EColorOperation mOperation;
+ LLColor4 mColors[MAX_COLOR_VALUES];
+ S32 mNumColors;
};
typedef std::vector<LLTexLayerParamColor *> param_color_list_t;
diff --git a/indra/llappearance/llviewervisualparam.cpp b/indra/llappearance/llviewervisualparam.cpp
index fb0d12f0af..2cc072fd13 100644
--- a/indra/llappearance/llviewervisualparam.cpp
+++ b/indra/llappearance/llviewervisualparam.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewervisualparam.cpp
* @brief Implementation of LLViewerVisualParam class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,16 +37,16 @@
// LLViewerVisualParamInfo()
//-----------------------------------------------------------------------------
LLViewerVisualParamInfo::LLViewerVisualParamInfo()
- :
- mWearableType( LLWearableType::WT_INVALID ),
- mCrossWearable(FALSE),
- mCamDist( 0.5f ),
- mCamAngle( 0.f ),
- mCamElevation( 0.f ),
- mEditGroupDisplayOrder( 0 ),
- mShowSimple(FALSE),
- mSimpleMin(0.f),
- mSimpleMax(100.f)
+ :
+ mWearableType( LLWearableType::WT_INVALID ),
+ mCrossWearable(FALSE),
+ mCamDist( 0.5f ),
+ mCamAngle( 0.f ),
+ mCamElevation( 0.f ),
+ mEditGroupDisplayOrder( 0 ),
+ mShowSimple(FALSE),
+ mSimpleMin(0.f),
+ mSimpleMax(100.f)
{
}
@@ -59,71 +59,71 @@ LLViewerVisualParamInfo::~LLViewerVisualParamInfo()
//-----------------------------------------------------------------------------
BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node)
{
- llassert( node->hasName( "param" ) );
-
- if (!LLVisualParamInfo::parseXml(node))
- return FALSE;
-
- // VIEWER SPECIFIC PARAMS
-
- std::string wearable;
- static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable");
- if( node->getFastAttributeString( wearable_string, wearable) )
- {
- mWearableType = LLWearableType::getInstance()->typeNameToType( wearable );
- }
-
- static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group");
- if (!node->getFastAttributeString( edit_group_string, mEditGroup))
- {
- mEditGroup = "";
- }
-
- static LLStdStringHandle cross_wearable_string = LLXmlTree::addAttributeString("cross_wearable");
- if (!node->getFastAttributeBOOL(cross_wearable_string, mCrossWearable))
- {
- mCrossWearable = FALSE;
- }
-
- // Optional camera offsets from the current joint center. Used for generating "hints" (thumbnails).
- static LLStdStringHandle camera_distance_string = LLXmlTree::addAttributeString("camera_distance");
- node->getFastAttributeF32( camera_distance_string, mCamDist );
- static LLStdStringHandle camera_angle_string = LLXmlTree::addAttributeString("camera_angle");
- node->getFastAttributeF32( camera_angle_string, mCamAngle ); // in degrees
- static LLStdStringHandle camera_elevation_string = LLXmlTree::addAttributeString("camera_elevation");
- node->getFastAttributeF32( camera_elevation_string, mCamElevation );
-
- mCamAngle += 180;
-
- static S32 params_loaded = 0;
-
- // By default, parameters are displayed in the order in which they appear in the xml file.
- // "edit_group_order" overriddes.
- static LLStdStringHandle edit_group_order_string = LLXmlTree::addAttributeString("edit_group_order");
- if( !node->getFastAttributeF32( edit_group_order_string, mEditGroupDisplayOrder ) )
- {
- mEditGroupDisplayOrder = (F32)params_loaded;
- }
-
- params_loaded++;
-
- return TRUE;
+ llassert( node->hasName( "param" ) );
+
+ if (!LLVisualParamInfo::parseXml(node))
+ return FALSE;
+
+ // VIEWER SPECIFIC PARAMS
+
+ std::string wearable;
+ static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable");
+ if( node->getFastAttributeString( wearable_string, wearable) )
+ {
+ mWearableType = LLWearableType::getInstance()->typeNameToType( wearable );
+ }
+
+ static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group");
+ if (!node->getFastAttributeString( edit_group_string, mEditGroup))
+ {
+ mEditGroup = "";
+ }
+
+ static LLStdStringHandle cross_wearable_string = LLXmlTree::addAttributeString("cross_wearable");
+ if (!node->getFastAttributeBOOL(cross_wearable_string, mCrossWearable))
+ {
+ mCrossWearable = FALSE;
+ }
+
+ // Optional camera offsets from the current joint center. Used for generating "hints" (thumbnails).
+ static LLStdStringHandle camera_distance_string = LLXmlTree::addAttributeString("camera_distance");
+ node->getFastAttributeF32( camera_distance_string, mCamDist );
+ static LLStdStringHandle camera_angle_string = LLXmlTree::addAttributeString("camera_angle");
+ node->getFastAttributeF32( camera_angle_string, mCamAngle ); // in degrees
+ static LLStdStringHandle camera_elevation_string = LLXmlTree::addAttributeString("camera_elevation");
+ node->getFastAttributeF32( camera_elevation_string, mCamElevation );
+
+ mCamAngle += 180;
+
+ static S32 params_loaded = 0;
+
+ // By default, parameters are displayed in the order in which they appear in the xml file.
+ // "edit_group_order" overriddes.
+ static LLStdStringHandle edit_group_order_string = LLXmlTree::addAttributeString("edit_group_order");
+ if( !node->getFastAttributeF32( edit_group_order_string, mEditGroupDisplayOrder ) )
+ {
+ mEditGroupDisplayOrder = (F32)params_loaded;
+ }
+
+ params_loaded++;
+
+ return TRUE;
}
/*virtual*/ void LLViewerVisualParamInfo::toStream(std::ostream &out)
{
- LLVisualParamInfo::toStream(out);
+ LLVisualParamInfo::toStream(out);
- out << mWearableType << "\t";
- out << mEditGroup << "\t";
- out << mEditGroupDisplayOrder << "\t";
+ out << mWearableType << "\t";
+ out << mEditGroup << "\t";
+ out << mEditGroupDisplayOrder << "\t";
}
//-----------------------------------------------------------------------------
// LLViewerVisualParam()
//-----------------------------------------------------------------------------
LLViewerVisualParam::LLViewerVisualParam()
- : LLVisualParam()
+ : LLVisualParam()
{
}
@@ -131,7 +131,7 @@ LLViewerVisualParam::LLViewerVisualParam()
// LLViewerVisualParam()
//-----------------------------------------------------------------------------
LLViewerVisualParam::LLViewerVisualParam(const LLViewerVisualParam& pOther)
- : LLVisualParam(pOther)
+ : LLVisualParam(pOther)
{
}
@@ -148,13 +148,13 @@ LLViewerVisualParam::~LLViewerVisualParam()
BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info)
{
- llassert(mInfo == NULL);
- if (info->mID < 0)
- return FALSE;
- mInfo = info;
- mID = info->mID;
- setWeight(getDefaultWeight());
- return TRUE;
+ llassert(mInfo == NULL);
+ if (info->mID < 0)
+ return FALSE;
+ mInfo = info;
+ mID = info->mID;
+ setWeight(getDefaultWeight());
+ return TRUE;
}
/*
@@ -168,12 +168,12 @@ BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info)
//-----------------------------------------------------------------------------
BOOL LLViewerVisualParam::parseData(LLXmlTreeNode *node)
{
- LLViewerVisualParamInfo* info = new LLViewerVisualParamInfo;
+ LLViewerVisualParamInfo* info = new LLViewerVisualParamInfo;
+
+ info->parseXml(node);
+ if (!setInfo(info))
+ return FALSE;
- info->parseXml(node);
- if (!setInfo(info))
- return FALSE;
-
- return TRUE;
+ return TRUE;
}
*/
diff --git a/indra/llappearance/llviewervisualparam.h b/indra/llappearance/llviewervisualparam.h
index 1a710c0ca6..7e332875f5 100644
--- a/indra/llappearance/llviewervisualparam.h
+++ b/indra/llappearance/llviewervisualparam.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llviewervisualparam.h
* @brief viewer side visual params (with data file parsing)
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,26 +38,26 @@ class LLWearable;
//-----------------------------------------------------------------------------
class LLViewerVisualParamInfo : public LLVisualParamInfo
{
- friend class LLViewerVisualParam;
+ friend class LLViewerVisualParam;
public:
- LLViewerVisualParamInfo();
- /*virtual*/ ~LLViewerVisualParamInfo();
-
- /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
+ LLViewerVisualParamInfo();
+ /*virtual*/ ~LLViewerVisualParamInfo();
- /*virtual*/ void toStream(std::ostream &out);
+ /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
+
+ /*virtual*/ void toStream(std::ostream &out);
protected:
- S32 mWearableType;
- BOOL mCrossWearable;
- std::string mEditGroup;
- F32 mCamDist;
- F32 mCamAngle; // degrees
- F32 mCamElevation;
- F32 mEditGroupDisplayOrder;
- BOOL mShowSimple; // show edit controls when in "simple ui" mode?
- F32 mSimpleMin; // when in simple UI, apply this minimum, range 0.f to 100.f
- F32 mSimpleMax; // when in simple UI, apply this maximum, range 0.f to 100.f
+ S32 mWearableType;
+ BOOL mCrossWearable;
+ std::string mEditGroup;
+ F32 mCamDist;
+ F32 mCamAngle; // degrees
+ F32 mCamElevation;
+ F32 mEditGroupDisplayOrder;
+ BOOL mShowSimple; // show edit controls when in "simple ui" mode?
+ F32 mSimpleMin; // when in simple UI, apply this minimum, range 0.f to 100.f
+ F32 mSimpleMax; // when in simple UI, apply this maximum, range 0.f to 100.f
};
//-----------------------------------------------------------------------------
@@ -69,44 +69,44 @@ LL_ALIGN_PREFIX(16)
class LLViewerVisualParam : public LLVisualParam
{
public:
- LLViewerVisualParam();
- virtual ~LLViewerVisualParam();
-
- // Special: These functions are overridden by child classes
- LLViewerVisualParamInfo *getInfo() const { return (LLViewerVisualParamInfo*)mInfo; };
- // This sets mInfo and calls initialization functions
- BOOL setInfo(LLViewerVisualParamInfo *info);
-
- virtual LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0;
-
- // LLVisualParam Virtual functions
- ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
-
- // New Virtual functions
- virtual F32 getTotalDistortion() = 0;
- virtual const LLVector4a& getAvgDistortion() = 0;
- virtual F32 getMaxDistortion() = 0;
- virtual LLVector4a getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0;
- virtual const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0;
- virtual const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0;
-
- // interface methods
- F32 getDisplayOrder() const { return getInfo()->mEditGroupDisplayOrder; }
- S32 getWearableType() const { return getInfo()->mWearableType; }
- const std::string& getEditGroup() const { return getInfo()->mEditGroup; }
-
- F32 getCameraDistance() const { return getInfo()->mCamDist; }
- F32 getCameraAngle() const { return getInfo()->mCamAngle; } // degrees
- F32 getCameraElevation() const { return getInfo()->mCamElevation; }
-
- BOOL getShowSimple() const { return getInfo()->mShowSimple; }
- F32 getSimpleMin() const { return getInfo()->mSimpleMin; }
- F32 getSimpleMax() const { return getInfo()->mSimpleMax; }
-
- BOOL getCrossWearable() const { return getInfo()->mCrossWearable; }
+ LLViewerVisualParam();
+ virtual ~LLViewerVisualParam();
+
+ // Special: These functions are overridden by child classes
+ LLViewerVisualParamInfo *getInfo() const { return (LLViewerVisualParamInfo*)mInfo; };
+ // This sets mInfo and calls initialization functions
+ BOOL setInfo(LLViewerVisualParamInfo *info);
+
+ virtual LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0;
+
+ // LLVisualParam Virtual functions
+ ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
+
+ // New Virtual functions
+ virtual F32 getTotalDistortion() = 0;
+ virtual const LLVector4a& getAvgDistortion() = 0;
+ virtual F32 getMaxDistortion() = 0;
+ virtual LLVector4a getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0;
+ virtual const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0;
+ virtual const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0;
+
+ // interface methods
+ F32 getDisplayOrder() const { return getInfo()->mEditGroupDisplayOrder; }
+ S32 getWearableType() const { return getInfo()->mWearableType; }
+ const std::string& getEditGroup() const { return getInfo()->mEditGroup; }
+
+ F32 getCameraDistance() const { return getInfo()->mCamDist; }
+ F32 getCameraAngle() const { return getInfo()->mCamAngle; } // degrees
+ F32 getCameraElevation() const { return getInfo()->mCamElevation; }
+
+ BOOL getShowSimple() const { return getInfo()->mShowSimple; }
+ F32 getSimpleMin() const { return getInfo()->mSimpleMin; }
+ F32 getSimpleMax() const { return getInfo()->mSimpleMax; }
+
+ BOOL getCrossWearable() const { return getInfo()->mCrossWearable; }
protected:
- LLViewerVisualParam(const LLViewerVisualParam& pOther);
+ LLViewerVisualParam(const LLViewerVisualParam& pOther);
} LL_ALIGN_POSTFIX(16);
#endif // LL_LLViewerVisualParam_H
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index 10d668d0af..f04bae3d62 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwearable.cpp
* @brief LLWearable class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,730 +44,730 @@ S32 LLWearable::sCurrentDefinitionVersion = 1;
static std::string terse_F32_to_string(F32 f);
LLWearable::LLWearable()
- : mDefinitionVersion(-1),
- mName(),
- mDescription(),
- mPermissions(),
- mSaleInfo(),
- mType(LLWearableType::WT_NONE),
- mSavedVisualParamMap(),
- mVisualParamIndexMap(),
- mTEMap(),
- mSavedTEMap()
+ : mDefinitionVersion(-1),
+ mName(),
+ mDescription(),
+ mPermissions(),
+ mSaleInfo(),
+ mType(LLWearableType::WT_NONE),
+ mSavedVisualParamMap(),
+ mVisualParamIndexMap(),
+ mTEMap(),
+ mSavedTEMap()
{
}
// virtual
LLWearable::~LLWearable()
{
- for (visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
- {
- LLVisualParam* vp = vp_pair.second;
- vp->clearNextParam();
- delete vp;
- vp_pair.second = NULL;
- }
-
- destroyTextures();
+ for (visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
+ {
+ LLVisualParam* vp = vp_pair.second;
+ vp->clearNextParam();
+ delete vp;
+ vp_pair.second = NULL;
+ }
+
+ destroyTextures();
}
const std::string& LLWearable::getTypeLabel() const
{
- return LLWearableType::getInstance()->getTypeLabel(mType);
+ return LLWearableType::getInstance()->getTypeLabel(mType);
}
const std::string& LLWearable::getTypeName() const
{
- return LLWearableType::getInstance()->getTypeName(mType);
+ return LLWearableType::getInstance()->getTypeName(mType);
}
LLAssetType::EType LLWearable::getAssetType() const
{
- return LLWearableType::getInstance()->getAssetType(mType);
+ return LLWearableType::getInstance()->getAssetType(mType);
}
BOOL LLWearable::exportFile(const std::string& filename) const
{
- llofstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
- return ofs.is_open() && exportStream(ofs);
+ llofstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
+ return ofs.is_open() && exportStream(ofs);
}
// virtual
BOOL LLWearable::exportStream( std::ostream& output_stream ) const
{
- if (!output_stream.good()) return FALSE;
-
- // header and version
- output_stream << "LLWearable version " << mDefinitionVersion << "\n";
- // name
- output_stream << mName << "\n";
- // description
- output_stream << mDescription << "\n";
-
- // permissions
- if( !mPermissions.exportLegacyStream( output_stream ) )
- {
- return FALSE;
- }
-
- // sale info
- if( !mSaleInfo.exportLegacyStream( output_stream ) )
- {
- return FALSE;
- }
-
- // wearable type
- output_stream << "type " << (S32) getType() << "\n";
-
- // parameters
- output_stream << "parameters " << mVisualParamIndexMap.size() << "\n";
-
- for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
- {
- S32 param_id = vp_pair.first;
- const LLVisualParam* param = vp_pair.second;
- F32 param_weight = param->getWeight();
- output_stream << param_id << " " << terse_F32_to_string( param_weight ) << "\n";
- }
-
- // texture entries
- output_stream << "textures " << mTEMap.size() << "\n";
-
- for (const te_map_t::value_type& te_pair : mTEMap)
- {
- S32 te = te_pair.first;
- const LLUUID& image_id = te_pair.second->getID();
- output_stream << te << " " << image_id << "\n";
- }
- return TRUE;
+ if (!output_stream.good()) return FALSE;
+
+ // header and version
+ output_stream << "LLWearable version " << mDefinitionVersion << "\n";
+ // name
+ output_stream << mName << "\n";
+ // description
+ output_stream << mDescription << "\n";
+
+ // permissions
+ if( !mPermissions.exportLegacyStream( output_stream ) )
+ {
+ return FALSE;
+ }
+
+ // sale info
+ if( !mSaleInfo.exportLegacyStream( output_stream ) )
+ {
+ return FALSE;
+ }
+
+ // wearable type
+ output_stream << "type " << (S32) getType() << "\n";
+
+ // parameters
+ output_stream << "parameters " << mVisualParamIndexMap.size() << "\n";
+
+ for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
+ {
+ S32 param_id = vp_pair.first;
+ const LLVisualParam* param = vp_pair.second;
+ F32 param_weight = param->getWeight();
+ output_stream << param_id << " " << terse_F32_to_string( param_weight ) << "\n";
+ }
+
+ // texture entries
+ output_stream << "textures " << mTEMap.size() << "\n";
+
+ for (const te_map_t::value_type& te_pair : mTEMap)
+ {
+ S32 te = te_pair.first;
+ const LLUUID& image_id = te_pair.second->getID();
+ output_stream << te << " " << image_id << "\n";
+ }
+ return TRUE;
}
void LLWearable::createVisualParams(LLAvatarAppearance *avatarp)
{
- for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*) avatarp->getNextVisualParam())
- {
- if (param->getWearableType() == mType)
- {
- LLVisualParam *clone_param = param->cloneParam(this);
- clone_param->setParamLocation(LOC_UNKNOWN);
- clone_param->setParamLocation(LOC_WEARABLE);
- addVisualParam(clone_param);
- }
- }
-
- // resync driver parameters to point to the newly cloned driven parameters
- for (visual_param_index_map_t::value_type& param_pair : mVisualParamIndexMap)
- {
- LLVisualParam* param = param_pair.second;
- LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
- // need this line to disambiguate between versions of LLCharacter::getVisualParam()
- LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
- param->resetDrivenParams();
- if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
- {
- if( !param->linkDrivenParams(boost::bind(param_function,avatarp,_1 ), true))
- {
- LL_DEBUGS("Avatar") << "could not link driven params for wearable " << getName() << " id: " << param->getID() << LL_ENDL;
- continue;
- }
- }
- }
+ for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam();
+ param;
+ param = (LLViewerVisualParam*) avatarp->getNextVisualParam())
+ {
+ if (param->getWearableType() == mType)
+ {
+ LLVisualParam *clone_param = param->cloneParam(this);
+ clone_param->setParamLocation(LOC_UNKNOWN);
+ clone_param->setParamLocation(LOC_WEARABLE);
+ addVisualParam(clone_param);
+ }
+ }
+
+ // resync driver parameters to point to the newly cloned driven parameters
+ for (visual_param_index_map_t::value_type& param_pair : mVisualParamIndexMap)
+ {
+ LLVisualParam* param = param_pair.second;
+ LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
+ // need this line to disambiguate between versions of LLCharacter::getVisualParam()
+ LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
+ param->resetDrivenParams();
+ if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
+ {
+ if( !param->linkDrivenParams(boost::bind(param_function,avatarp,_1 ), true))
+ {
+ LL_DEBUGS("Avatar") << "could not link driven params for wearable " << getName() << " id: " << param->getID() << LL_ENDL;
+ continue;
+ }
+ }
+ }
}
void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
{
- LLTexLayerSet *layer_set = NULL;
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)te);
- if (texture_dict && texture_dict->mIsUsedByBakedTexture)
- {
- const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
-
- layer_set = avatarp->getAvatarLayerSet(baked_index);
- }
-
- if (layer_set)
- {
- layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
- }
- else
- {
- LL_WARNS() << "could not find layerset for LTO in wearable!" << LL_ENDL;
- }
+ LLTexLayerSet *layer_set = NULL;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)te);
+ if (texture_dict && texture_dict->mIsUsedByBakedTexture)
+ {
+ const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+
+ layer_set = avatarp->getAvatarLayerSet(baked_index);
+ }
+
+ if (layer_set)
+ {
+ layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
+ }
+ else
+ {
+ LL_WARNS() << "could not find layerset for LTO in wearable!" << LL_ENDL;
+ }
}
LLWearable::EImportResult LLWearable::importFile(const std::string& filename,
- LLAvatarAppearance* avatarp )
+ LLAvatarAppearance* avatarp )
{
- llifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary);
- return (! ifs.is_open())? FAILURE : importStream(ifs, avatarp);
+ llifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary);
+ return (! ifs.is_open())? FAILURE : importStream(ifs, avatarp);
}
// virtual
LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, LLAvatarAppearance* avatarp )
{
- // *NOTE: changing the type or size of this buffer will require
- // changes in the fscanf() code below.
- // We are using a local max buffer size here to avoid issues
- // if MAX_STRING size changes.
- const U32 PARSE_BUFFER_SIZE = 2048;
- char buffer[PARSE_BUFFER_SIZE]; /* Flawfinder: ignore */
- char uuid_buffer[37]; /* Flawfinder: ignore */
-
- // This data is being generated on the viewer.
- // Impose some sane limits on parameter and texture counts.
- const S32 MAX_WEARABLE_ASSET_TEXTURES = 100;
- const S32 MAX_WEARABLE_ASSET_PARAMETERS = 1000;
-
- if(!avatarp)
- {
- return LLWearable::FAILURE;
- }
-
- // read header and version
- if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
- {
- LL_WARNS() << "Failed to read wearable asset input stream." << LL_ENDL;
- return LLWearable::FAILURE;
- }
- if ( 1 != sscanf( /* Flawfinder: ignore */
- buffer,
- "LLWearable version %d\n",
- &mDefinitionVersion ) )
- {
- return LLWearable::BAD_HEADER;
- }
-
- // Hack to allow wearables with definition version 24 to still load.
- // This should only affect lindens and NDA'd testers who have saved wearables in 2.0
- // the extra check for version == 24 can be removed before release, once internal testers
- // have loaded these wearables again. See hack pt 2 at bottom of function to ensure that
- // these wearables get re-saved with version definition 22.
- if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion && mDefinitionVersion != 24 )
- {
- LL_WARNS() << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << LL_ENDL;
- return LLWearable::FAILURE;
- }
-
- // name may be empty
+ // *NOTE: changing the type or size of this buffer will require
+ // changes in the fscanf() code below.
+ // We are using a local max buffer size here to avoid issues
+ // if MAX_STRING size changes.
+ const U32 PARSE_BUFFER_SIZE = 2048;
+ char buffer[PARSE_BUFFER_SIZE]; /* Flawfinder: ignore */
+ char uuid_buffer[37]; /* Flawfinder: ignore */
+
+ // This data is being generated on the viewer.
+ // Impose some sane limits on parameter and texture counts.
+ const S32 MAX_WEARABLE_ASSET_TEXTURES = 100;
+ const S32 MAX_WEARABLE_ASSET_PARAMETERS = 1000;
+
+ if(!avatarp)
+ {
+ return LLWearable::FAILURE;
+ }
+
+ // read header and version
+ if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
+ {
+ LL_WARNS() << "Failed to read wearable asset input stream." << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ if ( 1 != sscanf( /* Flawfinder: ignore */
+ buffer,
+ "LLWearable version %d\n",
+ &mDefinitionVersion ) )
+ {
+ return LLWearable::BAD_HEADER;
+ }
+
+ // Hack to allow wearables with definition version 24 to still load.
+ // This should only affect lindens and NDA'd testers who have saved wearables in 2.0
+ // the extra check for version == 24 can be removed before release, once internal testers
+ // have loaded these wearables again. See hack pt 2 at bottom of function to ensure that
+ // these wearables get re-saved with version definition 22.
+ if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion && mDefinitionVersion != 24 )
+ {
+ LL_WARNS() << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+
+ // name may be empty
+ if (!input_stream.good())
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading name" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ input_stream.getline(buffer, PARSE_BUFFER_SIZE);
+ mName = buffer;
+
+ // description may be empty
if (!input_stream.good())
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading name" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- input_stream.getline(buffer, PARSE_BUFFER_SIZE);
- mName = buffer;
-
- // description may be empty
- if (!input_stream.good())
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading description" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- input_stream.getline(buffer, PARSE_BUFFER_SIZE);
- mDescription = buffer;
-
- // permissions may have extra empty lines before the correct line
- if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading permissions" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- S32 perm_version = -1;
- if ( 1 != sscanf( buffer, " permissions %d\n", &perm_version ) ||
- perm_version != 0 )
- {
- LL_WARNS() << "Bad Wearable asset: missing valid permissions" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- if( !mPermissions.importLegacyStream( input_stream ) )
- {
- return LLWearable::FAILURE;
- }
-
- // sale info
- if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading sale info" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- S32 sale_info_version = -1;
- if ( 1 != sscanf( buffer, " sale_info %d\n", &sale_info_version ) ||
- sale_info_version != 0 )
- {
- LL_WARNS() << "Bad Wearable asset: missing valid sale_info" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- // Sale info used to contain next owner perm. It is now in the
- // permissions. Thus, we read that out, and fix legacy
- // objects. It's possible this op would fail, but it should pick
- // up the vast majority of the tasks.
- BOOL has_perm_mask = FALSE;
- U32 perm_mask = 0;
- if( !mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask) )
- {
- return LLWearable::FAILURE;
- }
- if(has_perm_mask)
- {
- // fair use fix.
- if(!(perm_mask & PERM_COPY))
- {
- perm_mask |= PERM_TRANSFER;
- }
- mPermissions.setMaskNext(perm_mask);
- }
-
- // wearable type
- if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading type" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- S32 type = -1;
- if ( 1 != sscanf( buffer, "type %d\n", &type ) )
- {
- LL_WARNS() << "Bad Wearable asset: bad type" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- if( 0 <= type && type < LLWearableType::WT_COUNT )
- {
- setType((LLWearableType::EType)type, avatarp);
- }
- else
- {
- mType = LLWearableType::WT_COUNT;
- LL_WARNS() << "Bad Wearable asset: bad type #" << type << LL_ENDL;
- return LLWearable::FAILURE;
- }
-
- // parameters header
- if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading parameters header" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- S32 num_parameters = -1;
- if ( 1 != sscanf( buffer, "parameters %d\n", &num_parameters ) )
- {
- LL_WARNS() << "Bad Wearable asset: missing parameters block" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- if ( num_parameters > MAX_WEARABLE_ASSET_PARAMETERS )
- {
- LL_WARNS() << "Bad Wearable asset: too many parameters, "
- << num_parameters << LL_ENDL;
- return LLWearable::FAILURE;
- }
- if( num_parameters != mVisualParamIndexMap.size() )
- {
- LL_WARNS() << "Wearable parameter mismatch. Reading in "
- << num_parameters << " from file, but created "
- << mVisualParamIndexMap.size()
- << " from avatar parameters. type: "
- << getType() << LL_ENDL;
- }
-
- // parameters
- S32 i;
- for( i = 0; i < num_parameters; i++ )
- {
- if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading parameter #" << i << LL_ENDL;
- return LLWearable::FAILURE;
- }
- S32 param_id = 0;
- F32 param_weight = 0.f;
- if ( 2 != sscanf( buffer, "%d %f\n", &param_id, &param_weight ) )
- {
- LL_WARNS() << "Bad Wearable asset: bad parameter, #" << i << LL_ENDL;
- return LLWearable::FAILURE;
- }
- mSavedVisualParamMap[param_id] = param_weight;
- }
-
- // textures header
- if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading textures header" << i << LL_ENDL;
- return LLWearable::FAILURE;
- }
- S32 num_textures = -1;
- if ( 1 != sscanf( buffer, "textures %d\n", &num_textures) )
- {
- LL_WARNS() << "Bad Wearable asset: missing textures block" << LL_ENDL;
- return LLWearable::FAILURE;
- }
- if ( num_textures > MAX_WEARABLE_ASSET_TEXTURES )
- {
- LL_WARNS() << "Bad Wearable asset: too many textures, "
- << num_textures << LL_ENDL;
- return LLWearable::FAILURE;
- }
-
- // textures
- for( i = 0; i < num_textures; i++ )
- {
- if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
- {
- LL_WARNS() << "Bad Wearable asset: early end of input stream "
- << "while reading textures #" << i << LL_ENDL;
- return LLWearable::FAILURE;
- }
- S32 te = 0;
- if ( 2 != sscanf( /* Flawfinder: ignore */
- buffer,
- "%d %36s\n",
- &te, uuid_buffer) )
- {
- LL_WARNS() << "Bad Wearable asset: bad texture, #" << i << LL_ENDL;
- return LLWearable::FAILURE;
- }
-
- if (te >= ETextureIndex::TEX_NUM_INDICES) //createLayers() converts to ETextureIndex
- {
- LL_WARNS() << "Bad Wearable asset: bad texture index: " << te << LL_ENDL;
- return LLWearable::FAILURE;
- }
-
- if( !LLUUID::validate( uuid_buffer ) )
- {
- LL_WARNS() << "Bad Wearable asset: bad texture uuid: "
- << uuid_buffer << LL_ENDL;
- return LLWearable::FAILURE;
- }
- LLUUID id = LLUUID(uuid_buffer);
- LLGLTexture* image = gTextureManagerBridgep->getFetchedTexture( id );
- if( mTEMap.find(te) != mTEMap.end() )
- {
- delete mTEMap[te];
- }
- if( mSavedTEMap.find(te) != mSavedTEMap.end() )
- {
- delete mSavedTEMap[te];
- }
-
- LLUUID textureid(uuid_buffer);
- mTEMap[te] = new LLLocalTextureObject(image, textureid);
- mSavedTEMap[te] = new LLLocalTextureObject(image, textureid);
- createLayers(te, avatarp);
- }
-
- // copy all saved param values to working params
- revertValues();
-
- return LLWearable::SUCCESS;
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading description" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ input_stream.getline(buffer, PARSE_BUFFER_SIZE);
+ mDescription = buffer;
+
+ // permissions may have extra empty lines before the correct line
+ if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading permissions" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ S32 perm_version = -1;
+ if ( 1 != sscanf( buffer, " permissions %d\n", &perm_version ) ||
+ perm_version != 0 )
+ {
+ LL_WARNS() << "Bad Wearable asset: missing valid permissions" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ if( !mPermissions.importLegacyStream( input_stream ) )
+ {
+ return LLWearable::FAILURE;
+ }
+
+ // sale info
+ if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading sale info" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ S32 sale_info_version = -1;
+ if ( 1 != sscanf( buffer, " sale_info %d\n", &sale_info_version ) ||
+ sale_info_version != 0 )
+ {
+ LL_WARNS() << "Bad Wearable asset: missing valid sale_info" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ // Sale info used to contain next owner perm. It is now in the
+ // permissions. Thus, we read that out, and fix legacy
+ // objects. It's possible this op would fail, but it should pick
+ // up the vast majority of the tasks.
+ BOOL has_perm_mask = FALSE;
+ U32 perm_mask = 0;
+ if( !mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask) )
+ {
+ return LLWearable::FAILURE;
+ }
+ if(has_perm_mask)
+ {
+ // fair use fix.
+ if(!(perm_mask & PERM_COPY))
+ {
+ perm_mask |= PERM_TRANSFER;
+ }
+ mPermissions.setMaskNext(perm_mask);
+ }
+
+ // wearable type
+ if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading type" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ S32 type = -1;
+ if ( 1 != sscanf( buffer, "type %d\n", &type ) )
+ {
+ LL_WARNS() << "Bad Wearable asset: bad type" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ if( 0 <= type && type < LLWearableType::WT_COUNT )
+ {
+ setType((LLWearableType::EType)type, avatarp);
+ }
+ else
+ {
+ mType = LLWearableType::WT_COUNT;
+ LL_WARNS() << "Bad Wearable asset: bad type #" << type << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+
+ // parameters header
+ if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading parameters header" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ S32 num_parameters = -1;
+ if ( 1 != sscanf( buffer, "parameters %d\n", &num_parameters ) )
+ {
+ LL_WARNS() << "Bad Wearable asset: missing parameters block" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ if ( num_parameters > MAX_WEARABLE_ASSET_PARAMETERS )
+ {
+ LL_WARNS() << "Bad Wearable asset: too many parameters, "
+ << num_parameters << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ if( num_parameters != mVisualParamIndexMap.size() )
+ {
+ LL_WARNS() << "Wearable parameter mismatch. Reading in "
+ << num_parameters << " from file, but created "
+ << mVisualParamIndexMap.size()
+ << " from avatar parameters. type: "
+ << getType() << LL_ENDL;
+ }
+
+ // parameters
+ S32 i;
+ for( i = 0; i < num_parameters; i++ )
+ {
+ if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading parameter #" << i << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ S32 param_id = 0;
+ F32 param_weight = 0.f;
+ if ( 2 != sscanf( buffer, "%d %f\n", &param_id, &param_weight ) )
+ {
+ LL_WARNS() << "Bad Wearable asset: bad parameter, #" << i << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ mSavedVisualParamMap[param_id] = param_weight;
+ }
+
+ // textures header
+ if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading textures header" << i << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ S32 num_textures = -1;
+ if ( 1 != sscanf( buffer, "textures %d\n", &num_textures) )
+ {
+ LL_WARNS() << "Bad Wearable asset: missing textures block" << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ if ( num_textures > MAX_WEARABLE_ASSET_TEXTURES )
+ {
+ LL_WARNS() << "Bad Wearable asset: too many textures, "
+ << num_textures << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+
+ // textures
+ for( i = 0; i < num_textures; i++ )
+ {
+ if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
+ {
+ LL_WARNS() << "Bad Wearable asset: early end of input stream "
+ << "while reading textures #" << i << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ S32 te = 0;
+ if ( 2 != sscanf( /* Flawfinder: ignore */
+ buffer,
+ "%d %36s\n",
+ &te, uuid_buffer) )
+ {
+ LL_WARNS() << "Bad Wearable asset: bad texture, #" << i << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+
+ if (te >= ETextureIndex::TEX_NUM_INDICES) //createLayers() converts to ETextureIndex
+ {
+ LL_WARNS() << "Bad Wearable asset: bad texture index: " << te << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+
+ if( !LLUUID::validate( uuid_buffer ) )
+ {
+ LL_WARNS() << "Bad Wearable asset: bad texture uuid: "
+ << uuid_buffer << LL_ENDL;
+ return LLWearable::FAILURE;
+ }
+ LLUUID id = LLUUID(uuid_buffer);
+ LLGLTexture* image = gTextureManagerBridgep->getFetchedTexture( id );
+ if( mTEMap.find(te) != mTEMap.end() )
+ {
+ delete mTEMap[te];
+ }
+ if( mSavedTEMap.find(te) != mSavedTEMap.end() )
+ {
+ delete mSavedTEMap[te];
+ }
+
+ LLUUID textureid(uuid_buffer);
+ mTEMap[te] = new LLLocalTextureObject(image, textureid);
+ mSavedTEMap[te] = new LLLocalTextureObject(image, textureid);
+ createLayers(te, avatarp);
+ }
+
+ // copy all saved param values to working params
+ revertValues();
+
+ return LLWearable::SUCCESS;
}
BOOL LLWearable::getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size)
{
- if (!input_stream.good())
- {
- return FALSE;
- }
-
- do
- {
- input_stream.getline(buffer, buffer_size);
- }
- while (input_stream.good() && buffer[0]=='\0');
-
- return (buffer[0] != '\0');
+ if (!input_stream.good())
+ {
+ return FALSE;
+ }
+
+ do
+ {
+ input_stream.getline(buffer, buffer_size);
+ }
+ while (input_stream.good() && buffer[0]=='\0');
+
+ return (buffer[0] != '\0');
}
-void LLWearable::setType(LLWearableType::EType type, LLAvatarAppearance *avatarp)
-{
- mType = type;
- createVisualParams(avatarp);
+void LLWearable::setType(LLWearableType::EType type, LLAvatarAppearance *avatarp)
+{
+ mType = type;
+ createVisualParams(avatarp);
}
LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index)
{
- te_map_t::iterator iter = mTEMap.find(index);
- if( iter != mTEMap.end() )
- {
- LLLocalTextureObject* lto = iter->second;
- return lto;
- }
- return NULL;
+ te_map_t::iterator iter = mTEMap.find(index);
+ if( iter != mTEMap.end() )
+ {
+ LLLocalTextureObject* lto = iter->second;
+ return lto;
+ }
+ return NULL;
}
const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const
{
- te_map_t::const_iterator iter = mTEMap.find(index);
- if( iter != mTEMap.end() )
- {
- const LLLocalTextureObject* lto = iter->second;
- return lto;
- }
- return NULL;
+ te_map_t::const_iterator iter = mTEMap.find(index);
+ if( iter != mTEMap.end() )
+ {
+ const LLLocalTextureObject* lto = iter->second;
+ return lto;
+ }
+ return NULL;
}
std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
{
- std::vector<LLLocalTextureObject*> result;
+ std::vector<LLLocalTextureObject*> result;
- for(te_map_t::value_type& te_pair : mTEMap)
- {
- LLLocalTextureObject* lto = te_pair.second;
- result.push_back(lto);
- }
+ for(te_map_t::value_type& te_pair : mTEMap)
+ {
+ LLLocalTextureObject* lto = te_pair.second;
+ result.push_back(lto);
+ }
- return result;
+ return result;
}
void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject &lto)
{
- if( mTEMap.find(index) != mTEMap.end() )
- {
- mTEMap.erase(index);
- }
- mTEMap[index] = new LLLocalTextureObject(lto);
+ if( mTEMap.find(index) != mTEMap.end() )
+ {
+ mTEMap.erase(index);
+ }
+ mTEMap[index] = new LLLocalTextureObject(lto);
}
void LLWearable::revertValues()
{
- // FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance.
-
- //update saved settings so wearable is no longer dirty
- // One loop should be necessary here
- for (param_map_t::value_type& vp_pair : mSavedVisualParamMap)
- {
- S32 id = vp_pair.first;
- LLVisualParam *param = getVisualParam(id);
- if(param)
- {
- F32 value = vp_pair.second;
- setVisualParamWeight(id, value);
- mSavedVisualParamMap[id] = param->getWeight();
- }
- }
-
- syncImages(mSavedTEMap, mTEMap);
+ // FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance.
+
+ //update saved settings so wearable is no longer dirty
+ // One loop should be necessary here
+ for (param_map_t::value_type& vp_pair : mSavedVisualParamMap)
+ {
+ S32 id = vp_pair.first;
+ LLVisualParam *param = getVisualParam(id);
+ if(param)
+ {
+ F32 value = vp_pair.second;
+ param->setWeight(value);
+ mSavedVisualParamMap[id] = param->getWeight();
+ }
+ }
+
+ syncImages(mSavedTEMap, mTEMap);
}
void LLWearable::saveValues()
{
- //update saved settings so wearable is no longer dirty
- mSavedVisualParamMap.clear();
- for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
- {
- S32 id = vp_pair.first;
- LLVisualParam *wearable_param = vp_pair.second;
- F32 value = wearable_param->getWeight();
- mSavedVisualParamMap[id] = value;
- }
-
- // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
- syncImages(mTEMap, mSavedTEMap);
+ //update saved settings so wearable is no longer dirty
+ mSavedVisualParamMap.clear();
+ for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
+ {
+ S32 id = vp_pair.first;
+ LLVisualParam *wearable_param = vp_pair.second;
+ F32 value = wearable_param->getWeight();
+ mSavedVisualParamMap[id] = value;
+ }
+
+ // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
+ syncImages(mTEMap, mSavedTEMap);
}
void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
{
- // Deep copy of src (copies only those tes that are current, filling in defaults where needed)
- for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
- {
- if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
- {
- te_map_t::const_iterator iter = src.find(te);
- LLUUID image_id;
- LLGLTexture *image = NULL;
- LLLocalTextureObject *lto = NULL;
- if(iter != src.end())
- {
- // there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map.
- lto = iter->second;
- image = lto->getImage();
- image_id = lto->getID();
- }
- else
- {
- // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map.
- image_id = getDefaultTextureImageID((ETextureIndex) te);
- image = gTextureManagerBridgep->getFetchedTexture( image_id );
- }
-
- if( dst.find(te) != dst.end() )
- {
- // there's already an entry in the destination map for the texture. Just update its values.
- dst[te]->setImage(image);
- dst[te]->setID(image_id);
- }
- else
- {
- // no entry found in the destination map, we need to create a new Local Texture Object
- dst[te] = new LLLocalTextureObject(image, image_id);
- }
-
- if( lto )
- {
- // If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map.
- dst[te]->setBakedReady(lto->getBakedReady());
- dst[te]->setDiscard(lto->getDiscard());
- }
- }
- }
+ // Deep copy of src (copies only those tes that are current, filling in defaults where needed)
+ for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
+ {
+ if (LLAvatarAppearance::getDictionary()->getTEWearableType((ETextureIndex) te) == mType)
+ {
+ te_map_t::const_iterator iter = src.find(te);
+ LLUUID image_id;
+ LLGLTexture *image = NULL;
+ LLLocalTextureObject *lto = NULL;
+ if(iter != src.end())
+ {
+ // there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map.
+ lto = iter->second;
+ image = lto->getImage();
+ image_id = lto->getID();
+ }
+ else
+ {
+ // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map.
+ image_id = getDefaultTextureImageID((ETextureIndex) te);
+ image = gTextureManagerBridgep->getFetchedTexture( image_id );
+ }
+
+ if( dst.find(te) != dst.end() )
+ {
+ // there's already an entry in the destination map for the texture. Just update its values.
+ dst[te]->setImage(image);
+ dst[te]->setID(image_id);
+ }
+ else
+ {
+ // no entry found in the destination map, we need to create a new Local Texture Object
+ dst[te] = new LLLocalTextureObject(image, image_id);
+ }
+
+ if( lto )
+ {
+ // If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map.
+ dst[te]->setBakedReady(lto->getBakedReady());
+ dst[te]->setDiscard(lto->getDiscard());
+ }
+ }
+ }
}
void LLWearable::destroyTextures()
{
- std::for_each(mTEMap.begin(), mTEMap.end(), DeletePairedPointer());
- mTEMap.clear();
+ std::for_each(mTEMap.begin(), mTEMap.end(), DeletePairedPointer());
+ mTEMap.clear();
- std::for_each(mSavedTEMap.begin(), mSavedTEMap.end(), DeletePairedPointer());
- mSavedTEMap.clear();
+ std::for_each(mSavedTEMap.begin(), mSavedTEMap.end(), DeletePairedPointer());
+ mSavedTEMap.clear();
}
void LLWearable::addVisualParam(LLVisualParam *param)
{
- if( mVisualParamIndexMap[param->getID()] )
- {
- delete mVisualParamIndexMap[param->getID()];
- }
- param->setIsDummy(FALSE);
- param->setParamLocation(LOC_WEARABLE);
- mVisualParamIndexMap[param->getID()] = param;
- mSavedVisualParamMap[param->getID()] = param->getDefaultWeight();
+ if( mVisualParamIndexMap[param->getID()] )
+ {
+ delete mVisualParamIndexMap[param->getID()];
+ }
+ param->setIsDummy(FALSE);
+ param->setParamLocation(LOC_WEARABLE);
+ mVisualParamIndexMap[param->getID()] = param;
+ mSavedVisualParamMap[param->getID()] = param->getDefaultWeight();
}
void LLWearable::setVisualParamWeight(S32 param_index, F32 value)
{
- if( is_in_map(mVisualParamIndexMap, param_index ) )
- {
- LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
- wearable_param->setWeight(value);
- }
- else
- {
- LL_ERRS() << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << LL_ENDL;
- }
+ if( is_in_map(mVisualParamIndexMap, param_index ) )
+ {
+ LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
+ wearable_param->setWeight(value);
+ }
+ else
+ {
+ LL_ERRS() << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << LL_ENDL;
+ }
}
F32 LLWearable::getVisualParamWeight(S32 param_index) const
{
- if( is_in_map(mVisualParamIndexMap, param_index ) )
- {
- const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second;
- return wearable_param->getWeight();
- }
- else
- {
- LL_WARNS() << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << LL_ENDL;
- }
- return (F32)-1.0;
+ if( is_in_map(mVisualParamIndexMap, param_index ) )
+ {
+ const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second;
+ return wearable_param->getWeight();
+ }
+ else
+ {
+ LL_WARNS() << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << LL_ENDL;
+ }
+ return (F32)-1.0;
}
LLVisualParam* LLWearable::getVisualParam(S32 index) const
{
- visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(index);
- return (iter == mVisualParamIndexMap.end()) ? NULL : iter->second;
+ visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(index);
+ return (iter == mVisualParamIndexMap.end()) ? NULL : iter->second;
}
void LLWearable::getVisualParams(visual_param_vec_t &list)
{
- // add all visual params to the passed-in vector
- for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
- {
- list.push_back(vp_pair.second);
- }
+ // add all visual params to the passed-in vector
+ for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
+ {
+ list.push_back(vp_pair.second);
+ }
}
void LLWearable::animateParams(F32 delta)
{
- for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
- {
- LLVisualParam *param = (LLVisualParam*)vp_pair.second;
- param->animate(delta);
- }
+ for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
+ {
+ LLVisualParam *param = (LLVisualParam*)vp_pair.second;
+ param->animate(delta);
+ }
}
LLColor4 LLWearable::getClothesColor(S32 te) const
{
- LLColor4 color;
- U32 param_name[3];
- if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
- {
- for( U8 index = 0; index < 3; index++ )
- {
- color.mV[index] = getVisualParamWeight(param_name[index]);
- }
- }
- return color;
+ LLColor4 color;
+ U32 param_name[3];
+ if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
+ {
+ for( U8 index = 0; index < 3; index++ )
+ {
+ color.mV[index] = getVisualParamWeight(param_name[index]);
+ }
+ }
+ return color;
}
void LLWearable::setClothesColor( S32 te, const LLColor4& new_color)
{
- U32 param_name[3];
- if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
- {
- for( U8 index = 0; index < 3; index++ )
- {
- setVisualParamWeight(param_name[index], new_color.mV[index]);
- }
- }
+ U32 param_name[3];
+ if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
+ {
+ for( U8 index = 0; index < 3; index++ )
+ {
+ setVisualParamWeight(param_name[index], new_color.mV[index]);
+ }
+ }
}
void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
{
- if (!avatarp) return;
-
- // Pull params
- for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
- {
- // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
- // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
- if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
- {
- S32 param_id = param->getID();
- F32 weight = getVisualParamWeight(param_id);
-
- avatarp->setVisualParamWeight( param_id, weight);
- }
- }
+ if (!avatarp) return;
+
+ // Pull params
+ for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
+ {
+ // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
+ // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
+ if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
+ {
+ S32 param_id = param->getID();
+ F32 weight = getVisualParamWeight(param_id);
+
+ avatarp->setVisualParamWeight( param_id, weight);
+ }
+ }
}
std::string terse_F32_to_string(F32 f)
{
- std::string r = llformat("%.2f", f);
- S32 len = r.length();
+ std::string r = llformat("%.2f", f);
+ S32 len = r.length();
// "1.20" -> "1.2"
// "24.00" -> "24."
- while (len > 0 && ('0' == r[len - 1]))
- {
- r.erase(len-1, 1);
- len--;
- }
- if ('.' == r[len - 1])
- {
- // "24." -> "24"
- r.erase(len-1, 1);
- }
- else if (('-' == r[0]) && ('0' == r[1]))
- {
- // "-0.59" -> "-.59"
- r.erase(1, 1);
- }
- else if ('0' == r[0])
- {
- // "0.59" -> ".59"
- r.erase(0, 1);
- }
- return r;
+ while (len > 0 && ('0' == r[len - 1]))
+ {
+ r.erase(len-1, 1);
+ len--;
+ }
+ if ('.' == r[len - 1])
+ {
+ // "24." -> "24"
+ r.erase(len-1, 1);
+ }
+ else if (('-' == r[0]) && ('0' == r[1]))
+ {
+ // "-0.59" -> "-.59"
+ r.erase(1, 1);
+ }
+ else if ('0' == r[0])
+ {
+ // "0.59" -> ".59"
+ r.erase(0, 1);
+ }
+ return r;
}
diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h
index d86db236a3..22075e9d9b 100644
--- a/indra/llappearance/llwearable.h
+++ b/indra/llappearance/llwearable.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwearable.h
* @brief LLWearable class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,98 +41,98 @@ class LLAvatarAppearance;
// Abstract class.
class LLWearable
{
- //--------------------------------------------------------------------
- // Constructors and destructors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constructors and destructors
+ //--------------------------------------------------------------------
public:
- LLWearable();
- virtual ~LLWearable();
+ LLWearable();
+ virtual ~LLWearable();
- //--------------------------------------------------------------------
- // Accessors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Accessors
+ //--------------------------------------------------------------------
public:
- LLWearableType::EType getType() const { return mType; }
- void setType(LLWearableType::EType type, LLAvatarAppearance *avatarp);
- const std::string& getName() const { return mName; }
- void setName(const std::string& name) { mName = name; }
- const std::string& getDescription() const { return mDescription; }
- void setDescription(const std::string& desc) { mDescription = desc; }
- const LLPermissions& getPermissions() const { return mPermissions; }
- void setPermissions(const LLPermissions& p) { mPermissions = p; }
- const LLSaleInfo& getSaleInfo() const { return mSaleInfo; }
- void setSaleInfo(const LLSaleInfo& info) { mSaleInfo = info; }
- const std::string& getTypeLabel() const;
- const std::string& getTypeName() const;
- LLAssetType::EType getAssetType() const;
- S32 getDefinitionVersion() const { return mDefinitionVersion; }
- void setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; }
- static S32 getCurrentDefinitionVersion() { return LLWearable::sCurrentDefinitionVersion; }
+ LLWearableType::EType getType() const { return mType; }
+ void setType(LLWearableType::EType type, LLAvatarAppearance *avatarp);
+ const std::string& getName() const { return mName; }
+ void setName(const std::string& name) { mName = name; }
+ const std::string& getDescription() const { return mDescription; }
+ void setDescription(const std::string& desc) { mDescription = desc; }
+ const LLPermissions& getPermissions() const { return mPermissions; }
+ void setPermissions(const LLPermissions& p) { mPermissions = p; }
+ const LLSaleInfo& getSaleInfo() const { return mSaleInfo; }
+ void setSaleInfo(const LLSaleInfo& info) { mSaleInfo = info; }
+ const std::string& getTypeLabel() const;
+ const std::string& getTypeName() const;
+ LLAssetType::EType getAssetType() const;
+ S32 getDefinitionVersion() const { return mDefinitionVersion; }
+ void setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; }
+ static S32 getCurrentDefinitionVersion() { return LLWearable::sCurrentDefinitionVersion; }
public:
- typedef std::vector<LLVisualParam*> visual_param_vec_t;
+ typedef std::vector<LLVisualParam*> visual_param_vec_t;
- virtual void writeToAvatar(LLAvatarAppearance* avatarp);
+ virtual void writeToAvatar(LLAvatarAppearance* avatarp);
- enum EImportResult
- {
- FAILURE = 0,
- SUCCESS,
- BAD_HEADER
- };
- BOOL exportFile(const std::string& filename) const;
- EImportResult importFile(const std::string& filename, LLAvatarAppearance* avatarp );
- virtual BOOL exportStream( std::ostream& output_stream ) const;
- virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp );
+ enum EImportResult
+ {
+ FAILURE = 0,
+ SUCCESS,
+ BAD_HEADER
+ };
+ BOOL exportFile(const std::string& filename) const;
+ EImportResult importFile(const std::string& filename, LLAvatarAppearance* avatarp );
+ virtual BOOL exportStream( std::ostream& output_stream ) const;
+ virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp );
- static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; }
- virtual LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const = 0;
+ static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; }
+ virtual LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const = 0;
- LLLocalTextureObject* getLocalTextureObject(S32 index);
- const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
- std::vector<LLLocalTextureObject*> getLocalTextureListSeq();
+ LLLocalTextureObject* getLocalTextureObject(S32 index);
+ const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
+ std::vector<LLLocalTextureObject*> getLocalTextureListSeq();
- void setLocalTextureObject(S32 index, LLLocalTextureObject &lto);
- void addVisualParam(LLVisualParam *param);
- void setVisualParamWeight(S32 index, F32 value);
- F32 getVisualParamWeight(S32 index) const;
- LLVisualParam* getVisualParam(S32 index) const;
- void getVisualParams(visual_param_vec_t &list);
- void animateParams(F32 delta);
+ void setLocalTextureObject(S32 index, LLLocalTextureObject &lto);
+ void addVisualParam(LLVisualParam *param);
+ void setVisualParamWeight(S32 index, F32 value);
+ F32 getVisualParamWeight(S32 index) const;
+ LLVisualParam* getVisualParam(S32 index) const;
+ void getVisualParams(visual_param_vec_t &list);
+ void animateParams(F32 delta);
- LLColor4 getClothesColor(S32 te) const;
- void setClothesColor( S32 te, const LLColor4& new_color);
+ LLColor4 getClothesColor(S32 te) const;
+ void setClothesColor( S32 te, const LLColor4& new_color);
- virtual void revertValues();
- virtual void saveValues();
+ virtual void revertValues();
+ virtual void saveValues();
- // Something happened that requires the wearable to be updated (e.g. worn/unworn).
- virtual void setUpdated() const = 0;
+ // Something happened that requires the wearable to be updated (e.g. worn/unworn).
+ virtual void setUpdated() const = 0;
- typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;
- visual_param_index_map_t mVisualParamIndexMap;
+ typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;
+ visual_param_index_map_t mVisualParamIndexMap;
protected:
- typedef std::map<S32, LLLocalTextureObject*> te_map_t;
- void syncImages(te_map_t &src, te_map_t &dst);
- void destroyTextures();
- void createVisualParams(LLAvatarAppearance *avatarp);
- void createLayers(S32 te, LLAvatarAppearance *avatarp);
- BOOL getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size);
-
- static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
- S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
- std::string mName;
- std::string mDescription;
- LLPermissions mPermissions;
- LLSaleInfo mSaleInfo;
- LLWearableType::EType mType;
-
- typedef std::map<S32, F32> param_map_t;
- param_map_t mSavedVisualParamMap; // last saved version of visual params
-
- te_map_t mTEMap; // maps TE to LocalTextureObject
- te_map_t mSavedTEMap; // last saved version of TEMap
+ typedef std::map<S32, LLLocalTextureObject*> te_map_t;
+ void syncImages(te_map_t &src, te_map_t &dst);
+ void destroyTextures();
+ void createVisualParams(LLAvatarAppearance *avatarp);
+ void createLayers(S32 te, LLAvatarAppearance *avatarp);
+ BOOL getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size);
+
+ static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
+ S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
+ std::string mName;
+ std::string mDescription;
+ LLPermissions mPermissions;
+ LLSaleInfo mSaleInfo;
+ LLWearableType::EType mType;
+
+ typedef std::map<S32, F32> param_map_t;
+ param_map_t mSavedVisualParamMap; // last saved version of visual params
+
+ te_map_t mTEMap; // maps TE to LocalTextureObject
+ te_map_t mSavedTEMap; // last saved version of TEMap
};
#endif // LL_LLWEARABLE_H
diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp
index 9fbbc57c87..55f8db8bda 100644
--- a/indra/llappearance/llwearabledata.cpp
+++ b/indra/llappearance/llwearabledata.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwearabledata.cpp
* @brief LLWearableData class implementation
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +33,7 @@
#include "lldriverparam.h"
LLWearableData::LLWearableData() :
- mAvatarAppearance(NULL)
+ mAvatarAppearance(NULL)
{
}
@@ -46,299 +46,299 @@ using namespace LLAvatarAppearanceDefines;
LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, U32 index)
{
- wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- return NULL;
- }
- wearableentry_vec_t& wearable_vec = wearable_iter->second;
- if (index>=wearable_vec.size())
- {
- return NULL;
- }
- else
- {
- return wearable_vec[index];
- }
+ wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
+ {
+ return NULL;
+ }
+ wearableentry_vec_t& wearable_vec = wearable_iter->second;
+ if (index>=wearable_vec.size())
+ {
+ return NULL;
+ }
+ else
+ {
+ return wearable_vec[index];
+ }
}
void LLWearableData::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
{
- LLWearable *old_wearable = getWearable(type,index);
- if (!old_wearable)
- {
- pushWearable(type,wearable);
- return;
- }
-
- wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- LL_WARNS() << "invalid type, type " << type << " index " << index << LL_ENDL;
- return;
- }
- wearableentry_vec_t& wearable_vec = wearable_iter->second;
- if (index>=wearable_vec.size())
- {
- LL_WARNS() << "invalid index, type " << type << " index " << index << LL_ENDL;
- }
- else
- {
- wearable_vec[index] = wearable;
- old_wearable->setUpdated();
- const BOOL removed = FALSE;
- wearableUpdated(wearable, removed);
- }
+ LLWearable *old_wearable = getWearable(type,index);
+ if (!old_wearable)
+ {
+ pushWearable(type,wearable);
+ return;
+ }
+
+ wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
+ {
+ LL_WARNS() << "invalid type, type " << type << " index " << index << LL_ENDL;
+ return;
+ }
+ wearableentry_vec_t& wearable_vec = wearable_iter->second;
+ if (index>=wearable_vec.size())
+ {
+ LL_WARNS() << "invalid index, type " << type << " index " << index << LL_ENDL;
+ }
+ else
+ {
+ wearable_vec[index] = wearable;
+ old_wearable->setUpdated();
+ const BOOL removed = FALSE;
+ wearableUpdated(wearable, removed);
+ }
}
-void LLWearableData::pushWearable(const LLWearableType::EType type,
- LLWearable *wearable,
- bool trigger_updated /* = true */)
+void LLWearableData::pushWearable(const LLWearableType::EType type,
+ LLWearable *wearable,
+ bool trigger_updated /* = true */)
{
- if (wearable == NULL)
- {
- // no null wearables please!
- LL_WARNS() << "Null wearable sent for type " << type << LL_ENDL;
- }
- if (canAddWearable(type))
- {
- mWearableDatas[type].push_back(wearable);
- if (trigger_updated)
- {
- const BOOL removed = FALSE;
- wearableUpdated(wearable, removed);
- }
- }
+ if (wearable == NULL)
+ {
+ // no null wearables please!
+ LL_WARNS() << "Null wearable sent for type " << type << LL_ENDL;
+ }
+ if (canAddWearable(type))
+ {
+ mWearableDatas[type].push_back(wearable);
+ if (trigger_updated)
+ {
+ const BOOL removed = FALSE;
+ wearableUpdated(wearable, removed);
+ }
+ }
}
// virtual
void LLWearableData::wearableUpdated(LLWearable *wearable, BOOL removed)
{
- wearable->setUpdated();
- if (!removed)
- {
- pullCrossWearableValues(wearable->getType());
- }
+ wearable->setUpdated();
+ if (!removed)
+ {
+ pullCrossWearableValues(wearable->getType());
+ }
}
void LLWearableData::eraseWearable(LLWearable *wearable)
{
- if (wearable == NULL)
- {
- // nothing to do here. move along.
- return;
- }
-
- const LLWearableType::EType type = wearable->getType();
-
- U32 index;
- if (getWearableIndex(wearable,index))
- {
- eraseWearable(type, index);
- }
+ if (wearable == NULL)
+ {
+ // nothing to do here. move along.
+ return;
+ }
+
+ const LLWearableType::EType type = wearable->getType();
+
+ U32 index;
+ if (getWearableIndex(wearable,index))
+ {
+ eraseWearable(type, index);
+ }
}
void LLWearableData::eraseWearable(const LLWearableType::EType type, U32 index)
{
- LLWearable *wearable = getWearable(type, index);
- if (wearable)
- {
- mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
- const BOOL removed = TRUE;
- wearableUpdated(wearable, removed);
- }
+ LLWearable *wearable = getWearable(type, index);
+ if (wearable)
+ {
+ mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
+ const BOOL removed = TRUE;
+ wearableUpdated(wearable, removed);
+ }
}
void LLWearableData::clearWearableType(const LLWearableType::EType type)
{
- wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- return;
- }
- wearableentry_vec_t& wearable_vec = wearable_iter->second;
- wearable_vec.clear();
+ wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
+ {
+ return;
+ }
+ wearableentry_vec_t& wearable_vec = wearable_iter->second;
+ wearable_vec.clear();
}
bool LLWearableData::swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b)
{
- wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- return false;
- }
-
- wearableentry_vec_t& wearable_vec = wearable_iter->second;
- // removed 0 > index_a and index_b comparisions - can never be true
- if (index_a >= wearable_vec.size()) return false;
- if (index_b >= wearable_vec.size()) return false;
-
- LLWearable* wearable = wearable_vec[index_a];
- wearable_vec[index_a] = wearable_vec[index_b];
- wearable_vec[index_b] = wearable;
- return true;
+ wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
+ {
+ return false;
+ }
+
+ wearableentry_vec_t& wearable_vec = wearable_iter->second;
+ // removed 0 > index_a and index_b comparisions - can never be true
+ if (index_a >= wearable_vec.size()) return false;
+ if (index_b >= wearable_vec.size()) return false;
+
+ LLWearable* wearable = wearable_vec[index_a];
+ wearable_vec[index_a] = wearable_vec[index_b];
+ wearable_vec[index_b] = wearable;
+ return true;
}
void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type)
{
- llassert(mAvatarAppearance);
- // scan through all of the avatar's visual parameters
- for (LLViewerVisualParam* param = (LLViewerVisualParam*) mAvatarAppearance->getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*) mAvatarAppearance->getNextVisualParam())
- {
- if( param )
- {
- LLDriverParam *driver_param = dynamic_cast<LLDriverParam*>(param);
- if(driver_param)
- {
- // parameter is a driver parameter, have it update its cross-driven params
- driver_param->updateCrossDrivenParams(type);
- }
- }
- }
+ llassert(mAvatarAppearance);
+ // scan through all of the avatar's visual parameters
+ for (LLViewerVisualParam* param = (LLViewerVisualParam*) mAvatarAppearance->getFirstVisualParam();
+ param;
+ param = (LLViewerVisualParam*) mAvatarAppearance->getNextVisualParam())
+ {
+ if( param )
+ {
+ LLDriverParam *driver_param = dynamic_cast<LLDriverParam*>(param);
+ if(driver_param)
+ {
+ // parameter is a driver parameter, have it update its cross-driven params
+ driver_param->updateCrossDrivenParams(type);
+ }
+ }
+ }
}
BOOL LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_found) const
{
- if (wearable == NULL)
- {
- return FALSE;
- }
-
- const LLWearableType::EType type = wearable->getType();
- wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- LL_WARNS() << "tried to get wearable index with an invalid type!" << LL_ENDL;
- return FALSE;
- }
- const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- for(U32 index = 0; index < wearable_vec.size(); index++)
- {
- if (wearable_vec[index] == wearable)
- {
- index_found = index;
- return TRUE;
- }
- }
-
- return FALSE;
+ if (wearable == NULL)
+ {
+ return FALSE;
+ }
+
+ const LLWearableType::EType type = wearable->getType();
+ wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
+ {
+ LL_WARNS() << "tried to get wearable index with an invalid type!" << LL_ENDL;
+ return FALSE;
+ }
+ const wearableentry_vec_t& wearable_vec = wearable_iter->second;
+ for(U32 index = 0; index < wearable_vec.size(); index++)
+ {
+ if (wearable_vec[index] == wearable)
+ {
+ index_found = index;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
}
U32 LLWearableData::getClothingLayerCount() const
{
- U32 count = 0;
+ U32 count = 0;
LLWearableType *wr_inst = LLWearableType::getInstance();
- for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
- {
- LLWearableType::EType type = (LLWearableType::EType)i;
- if (wr_inst->getAssetType(type)==LLAssetType::AT_CLOTHING)
- {
- count += getWearableCount(type);
- }
- }
- return count;
+ for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
+ {
+ LLWearableType::EType type = (LLWearableType::EType)i;
+ if (wr_inst->getAssetType(type)==LLAssetType::AT_CLOTHING)
+ {
+ count += getWearableCount(type);
+ }
+ }
+ return count;
}
BOOL LLWearableData::canAddWearable(const LLWearableType::EType type) const
{
LLAssetType::EType a_type = LLWearableType::getInstance()->getAssetType(type);
- if (a_type==LLAssetType::AT_CLOTHING)
- {
- return (getClothingLayerCount() < MAX_CLOTHING_LAYERS);
- }
- else if (a_type==LLAssetType::AT_BODYPART)
- {
- return (getWearableCount(type) < 1);
- }
- else
- {
- return FALSE;
- }
+ if (a_type==LLAssetType::AT_CLOTHING)
+ {
+ return (getClothingLayerCount() < MAX_CLOTHING_LAYERS);
+ }
+ else if (a_type==LLAssetType::AT_BODYPART)
+ {
+ return (getWearableCount(type) < 1);
+ }
+ else
+ {
+ return FALSE;
+ }
}
BOOL LLWearableData::isOnTop(LLWearable* wearable) const
{
- if (!wearable) return FALSE;
- const LLWearableType::EType type = wearable->getType();
- return ( getTopWearable(type) == wearable );
+ if (!wearable) return FALSE;
+ const LLWearableType::EType type = wearable->getType();
+ return ( getTopWearable(type) == wearable );
}
const LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, U32 index) const
{
- wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- return NULL;
- }
- const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- if (index>=wearable_vec.size())
- {
- return NULL;
- }
- else
- {
- return wearable_vec[index];
- }
+ wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
+ {
+ return NULL;
+ }
+ const wearableentry_vec_t& wearable_vec = wearable_iter->second;
+ if (index>=wearable_vec.size())
+ {
+ return NULL;
+ }
+ else
+ {
+ return wearable_vec[index];
+ }
}
LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type)
{
- U32 count = getWearableCount(type);
- if ( count == 0)
- {
- return NULL;
- }
+ U32 count = getWearableCount(type);
+ if ( count == 0)
+ {
+ return NULL;
+ }
- return getWearable(type, count-1);
+ return getWearable(type, count-1);
}
const LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type) const
{
- U32 count = getWearableCount(type);
- if ( count == 0)
- {
- return NULL;
- }
+ U32 count = getWearableCount(type);
+ if ( count == 0)
+ {
+ return NULL;
+ }
- return getWearable(type, count-1);
+ return getWearable(type, count-1);
}
LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type)
{
- if (getWearableCount(type) == 0)
- {
- return NULL;
- }
+ if (getWearableCount(type) == 0)
+ {
+ return NULL;
+ }
- return getWearable(type, 0);
+ return getWearable(type, 0);
}
const LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type) const
{
- if (getWearableCount(type) == 0)
- {
- return NULL;
- }
+ if (getWearableCount(type) == 0)
+ {
+ return NULL;
+ }
- return getWearable(type, 0);
+ return getWearable(type, 0);
}
U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const
{
- wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- return 0;
- }
- const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- return wearable_vec.size();
+ wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
+ {
+ return 0;
+ }
+ const wearableentry_vec_t& wearable_vec = wearable_iter->second;
+ return wearable_vec.size();
}
U32 LLWearableData::getWearableCount(const U32 tex_index) const
{
- const LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
- return getWearableCount(wearable_type);
+ const LLWearableType::EType wearable_type = LLAvatarAppearance::getDictionary()->getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
+ return getWearableCount(wearable_type);
}
diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h
index b8e0bf8bd1..4276335bd6 100644
--- a/indra/llappearance/llwearabledata.h
+++ b/indra/llappearance/llwearabledata.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwearabledata.h
* @brief LLWearableData class header file
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,64 +35,64 @@ class LLAvatarAppearance;
class LLWearableData
{
- // *TODO: Figure out why this is causing compile error.
- //LOG_CLASS(LLWearableData);
+ // *TODO: Figure out why this is causing compile error.
+ //LOG_CLASS(LLWearableData);
- //--------------------------------------------------------------------
- // Constructors / destructors / Initializers
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Constructors / destructors / Initializers
+ //--------------------------------------------------------------------
public:
- LLWearableData();
- virtual ~LLWearableData();
+ LLWearableData();
+ virtual ~LLWearableData();
- void setAvatarAppearance(LLAvatarAppearance* appearance) { mAvatarAppearance = appearance; }
+ void setAvatarAppearance(LLAvatarAppearance* appearance) { mAvatarAppearance = appearance; }
protected:
- //--------------------------------------------------------------------
- // Accessors
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Accessors
+ //--------------------------------------------------------------------
public:
- LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
- const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
- LLWearable* getTopWearable(const LLWearableType::EType type);
- const LLWearable* getTopWearable(const LLWearableType::EType type) const;
- LLWearable* getBottomWearable(const LLWearableType::EType type);
- const LLWearable* getBottomWearable(const LLWearableType::EType type) const;
- U32 getWearableCount(const LLWearableType::EType type) const;
- U32 getWearableCount(const U32 tex_index) const;
- BOOL getWearableIndex(const LLWearable *wearable, U32& index) const;
- U32 getClothingLayerCount() const;
- BOOL canAddWearable(const LLWearableType::EType type) const;
-
- BOOL isOnTop(LLWearable* wearable) const;
-
- static const U32 MAX_CLOTHING_LAYERS = 60;
-
- //--------------------------------------------------------------------
- // Setters
- //--------------------------------------------------------------------
+ LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
+ const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
+ LLWearable* getTopWearable(const LLWearableType::EType type);
+ const LLWearable* getTopWearable(const LLWearableType::EType type) const;
+ LLWearable* getBottomWearable(const LLWearableType::EType type);
+ const LLWearable* getBottomWearable(const LLWearableType::EType type) const;
+ U32 getWearableCount(const LLWearableType::EType type) const;
+ U32 getWearableCount(const U32 tex_index) const;
+ BOOL getWearableIndex(const LLWearable *wearable, U32& index) const;
+ U32 getClothingLayerCount() const;
+ BOOL canAddWearable(const LLWearableType::EType type) const;
+
+ BOOL isOnTop(LLWearable* wearable) const;
+
+ static const U32 MAX_CLOTHING_LAYERS = 60;
+
+ //--------------------------------------------------------------------
+ // Setters
+ //--------------------------------------------------------------------
protected:
- // Low-level data structure setter - public access is via setWearableItem, etc.
- void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
- void pushWearable(const LLWearableType::EType type, LLWearable *wearable,
- bool trigger_updated = true);
- virtual void wearableUpdated(LLWearable *wearable, BOOL removed);
- void eraseWearable(LLWearable *wearable);
- void eraseWearable(const LLWearableType::EType type, U32 index);
- void clearWearableType(const LLWearableType::EType type);
- bool swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b);
+ // Low-level data structure setter - public access is via setWearableItem, etc.
+ void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
+ void pushWearable(const LLWearableType::EType type, LLWearable *wearable,
+ bool trigger_updated = true);
+ virtual void wearableUpdated(LLWearable *wearable, BOOL removed);
+ void eraseWearable(LLWearable *wearable);
+ void eraseWearable(const LLWearableType::EType type, U32 index);
+ void clearWearableType(const LLWearableType::EType type);
+ bool swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b);
private:
- void pullCrossWearableValues(const LLWearableType::EType type);
+ void pullCrossWearableValues(const LLWearableType::EType type);
- //--------------------------------------------------------------------
- // Member variables
- //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Member variables
+ //--------------------------------------------------------------------
protected:
- LLAvatarAppearance* mAvatarAppearance;
- typedef std::vector<LLWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
- typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
- wearableentry_map_t mWearableDatas;
+ LLAvatarAppearance* mAvatarAppearance;
+ typedef std::vector<LLWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
+ typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
+ wearableentry_map_t mWearableDatas;
};
diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp
index 4ac611b1de..3a6b3969f6 100644
--- a/indra/llappearance/llwearabletype.cpp
+++ b/indra/llappearance/llwearabletype.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwearabletype.cpp
* @brief LLWearableType class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -32,27 +32,27 @@
LLWearableType::LLWearableDictionary::LLWearableDictionary(LLTranslationBridge::ptr_t& trans)
{
- addEntry(LLWearableType::WT_SHAPE, new WearableEntry(trans, "shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SHAPE, FALSE, FALSE));
- addEntry(LLWearableType::WT_SKIN, new WearableEntry(trans, "skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SKIN, FALSE, FALSE));
- addEntry(LLWearableType::WT_HAIR, new WearableEntry(trans, "hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_HAIR, FALSE, FALSE));
- addEntry(LLWearableType::WT_EYES, new WearableEntry(trans, "eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_EYES, FALSE, FALSE));
- addEntry(LLWearableType::WT_SHIRT, new WearableEntry(trans, "shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHIRT, FALSE, TRUE));
- addEntry(LLWearableType::WT_PANTS, new WearableEntry(trans, "pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PANTS, FALSE, TRUE));
- addEntry(LLWearableType::WT_SHOES, new WearableEntry(trans, "shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHOES, FALSE, TRUE));
- addEntry(LLWearableType::WT_SOCKS, new WearableEntry(trans, "socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SOCKS, FALSE, TRUE));
- addEntry(LLWearableType::WT_JACKET, new WearableEntry(trans, "jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_JACKET, FALSE, TRUE));
- addEntry(LLWearableType::WT_GLOVES, new WearableEntry(trans, "gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_GLOVES, FALSE, TRUE));
- addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry(trans, "undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, FALSE, TRUE));
- addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry(trans, "underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, FALSE, TRUE));
- addEntry(LLWearableType::WT_SKIRT, new WearableEntry(trans, "skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE));
- addEntry(LLWearableType::WT_ALPHA, new WearableEntry(trans, "alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE));
- addEntry(LLWearableType::WT_TATTOO, new WearableEntry(trans, "tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE));
- addEntry(LLWearableType::WT_UNIVERSAL, new WearableEntry(trans, "universal", "New Universal", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNIVERSAL, FALSE, TRUE));
-
- addEntry(LLWearableType::WT_PHYSICS, new WearableEntry(trans, "physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE));
-
- addEntry(LLWearableType::WT_INVALID, new WearableEntry(trans, "invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_UNKNOWN, FALSE, FALSE));
- addEntry(LLWearableType::WT_NONE, new WearableEntry(trans, "none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
+ addEntry(LLWearableType::WT_SHAPE, new WearableEntry(trans, "shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SHAPE, FALSE, FALSE));
+ addEntry(LLWearableType::WT_SKIN, new WearableEntry(trans, "skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SKIN, FALSE, FALSE));
+ addEntry(LLWearableType::WT_HAIR, new WearableEntry(trans, "hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_HAIR, FALSE, FALSE));
+ addEntry(LLWearableType::WT_EYES, new WearableEntry(trans, "eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_EYES, FALSE, FALSE));
+ addEntry(LLWearableType::WT_SHIRT, new WearableEntry(trans, "shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHIRT, FALSE, TRUE));
+ addEntry(LLWearableType::WT_PANTS, new WearableEntry(trans, "pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PANTS, FALSE, TRUE));
+ addEntry(LLWearableType::WT_SHOES, new WearableEntry(trans, "shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHOES, FALSE, TRUE));
+ addEntry(LLWearableType::WT_SOCKS, new WearableEntry(trans, "socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SOCKS, FALSE, TRUE));
+ addEntry(LLWearableType::WT_JACKET, new WearableEntry(trans, "jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_JACKET, FALSE, TRUE));
+ addEntry(LLWearableType::WT_GLOVES, new WearableEntry(trans, "gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_GLOVES, FALSE, TRUE));
+ addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry(trans, "undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, FALSE, TRUE));
+ addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry(trans, "underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, FALSE, TRUE));
+ addEntry(LLWearableType::WT_SKIRT, new WearableEntry(trans, "skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE));
+ addEntry(LLWearableType::WT_ALPHA, new WearableEntry(trans, "alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE));
+ addEntry(LLWearableType::WT_TATTOO, new WearableEntry(trans, "tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE));
+ addEntry(LLWearableType::WT_UNIVERSAL, new WearableEntry(trans, "universal", "New Universal", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNIVERSAL, FALSE, TRUE));
+
+ addEntry(LLWearableType::WT_PHYSICS, new WearableEntry(trans, "physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE));
+
+ addEntry(LLWearableType::WT_INVALID, new WearableEntry(trans, "invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_UNKNOWN, FALSE, FALSE));
+ addEntry(LLWearableType::WT_NONE, new WearableEntry(trans, "none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
}
@@ -73,57 +73,57 @@ void LLWearableType::initSingleton()
LLWearableType::EType LLWearableType::typeNameToType(const std::string& type_name)
{
- const LLWearableType::EType wearable = mDictionary.lookup(type_name);
- return wearable;
+ const LLWearableType::EType wearable = mDictionary.lookup(type_name);
+ return wearable;
}
const std::string& LLWearableType::getTypeName(LLWearableType::EType type)
-{
- const WearableEntry *entry = mDictionary.lookup(type);
- if (!entry) return getTypeName(WT_INVALID);
- return entry->mName;
+{
+ const WearableEntry *entry = mDictionary.lookup(type);
+ if (!entry) return getTypeName(WT_INVALID);
+ return entry->mName;
}
const std::string& LLWearableType::getTypeDefaultNewName(LLWearableType::EType type)
-{
- const WearableEntry *entry = mDictionary.lookup(type);
- if (!entry) return getTypeDefaultNewName(WT_INVALID);
- return entry->mDefaultNewName;
+{
+ const WearableEntry *entry = mDictionary.lookup(type);
+ if (!entry) return getTypeDefaultNewName(WT_INVALID);
+ return entry->mDefaultNewName;
}
const std::string& LLWearableType::getTypeLabel(LLWearableType::EType type)
-{
- const WearableEntry *entry = mDictionary.lookup(type);
- if (!entry) return getTypeLabel(WT_INVALID);
- return entry->mLabel;
+{
+ const WearableEntry *entry = mDictionary.lookup(type);
+ if (!entry) return getTypeLabel(WT_INVALID);
+ return entry->mLabel;
}
LLAssetType::EType LLWearableType::getAssetType(LLWearableType::EType type)
{
- const WearableEntry *entry = mDictionary.lookup(type);
- if (!entry) return getAssetType(WT_INVALID);
- return entry->mAssetType;
+ const WearableEntry *entry = mDictionary.lookup(type);
+ if (!entry) return getAssetType(WT_INVALID);
+ return entry->mAssetType;
}
LLInventoryType::EIconName LLWearableType::getIconName(LLWearableType::EType type)
{
- const WearableEntry *entry = mDictionary.lookup(type);
- if (!entry) return getIconName(WT_INVALID);
- return entry->mIconName;
-}
+ const WearableEntry *entry = mDictionary.lookup(type);
+ if (!entry) return getIconName(WT_INVALID);
+ return entry->mIconName;
+}
BOOL LLWearableType::getDisableCameraSwitch(LLWearableType::EType type)
{
- const WearableEntry *entry = mDictionary.lookup(type);
- if (!entry) return FALSE;
- return entry->mDisableCameraSwitch;
+ const WearableEntry *entry = mDictionary.lookup(type);
+ if (!entry) return FALSE;
+ return entry->mDisableCameraSwitch;
}
BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type)
{
- const WearableEntry *entry = mDictionary.lookup(type);
- if (!entry) return FALSE;
- return entry->mAllowMultiwear;
+ const WearableEntry *entry = mDictionary.lookup(type);
+ if (!entry) return FALSE;
+ return entry->mAllowMultiwear;
}
// static
diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h
index 1fbe19ddd1..99846586dc 100644
--- a/indra/llappearance/llwearabletype.h
+++ b/indra/llappearance/llwearabletype.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file llwearabletype.h
* @brief LLWearableType class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,47 +35,47 @@
class LLWearableType : public LLParamSingleton<LLWearableType>
{
- LLSINGLETON(LLWearableType, LLTranslationBridge::ptr_t &trans);
- ~LLWearableType();
- void initSingleton() override;
-public:
- enum EType
- {
- WT_SHAPE = 0,
- WT_SKIN = 1,
- WT_HAIR = 2,
- WT_EYES = 3,
- WT_SHIRT = 4,
- WT_PANTS = 5,
- WT_SHOES = 6,
- WT_SOCKS = 7,
- WT_JACKET = 8,
- WT_GLOVES = 9,
- WT_UNDERSHIRT = 10,
- WT_UNDERPANTS = 11,
- WT_SKIRT = 12,
- WT_ALPHA = 13,
- WT_TATTOO = 14,
- WT_PHYSICS = 15,
- WT_UNIVERSAL = 16,
- WT_COUNT = 17,
+ LLSINGLETON(LLWearableType, LLTranslationBridge::ptr_t &trans);
+ ~LLWearableType();
+ void initSingleton() override;
+public:
+ enum EType
+ {
+ WT_SHAPE = 0,
+ WT_SKIN = 1,
+ WT_HAIR = 2,
+ WT_EYES = 3,
+ WT_SHIRT = 4,
+ WT_PANTS = 5,
+ WT_SHOES = 6,
+ WT_SOCKS = 7,
+ WT_JACKET = 8,
+ WT_GLOVES = 9,
+ WT_UNDERSHIRT = 10,
+ WT_UNDERPANTS = 11,
+ WT_SKIRT = 12,
+ WT_ALPHA = 13,
+ WT_TATTOO = 14,
+ WT_PHYSICS = 15,
+ WT_UNIVERSAL = 16,
+ WT_COUNT = 17,
- WT_INVALID = 255,
- WT_NONE = -1,
- };
+ WT_INVALID = 255,
+ WT_NONE = -1,
+ };
- // Most methods are wrappers for dictionary, but if LLWearableType is not initialized,
- // they will crash. Whole LLWearableType is just wrapper for convinient calls.
- const std::string& getTypeName(EType type);
- const std::string& getTypeDefaultNewName(EType type);
- const std::string& getTypeLabel(EType type);
- LLAssetType::EType getAssetType(EType type);
- EType typeNameToType(const std::string& type_name);
- LLInventoryType::EIconName getIconName(EType type);
- BOOL getDisableCameraSwitch(EType type);
- BOOL getAllowMultiwear(EType type);
+ // Most methods are wrappers for dictionary, but if LLWearableType is not initialized,
+ // they will crash. Whole LLWearableType is just wrapper for convinient calls.
+ const std::string& getTypeName(EType type);
+ const std::string& getTypeDefaultNewName(EType type);
+ const std::string& getTypeLabel(EType type);
+ LLAssetType::EType getAssetType(EType type);
+ EType typeNameToType(const std::string& type_name);
+ LLInventoryType::EIconName getIconName(EType type);
+ BOOL getDisableCameraSwitch(EType type);
+ BOOL getAllowMultiwear(EType type);
- static EType inventoryFlagsToWearableType(U32 flags);
+ static EType inventoryFlagsToWearableType(U32 flags);
private:
struct WearableEntry : public LLDictionaryEntry