Fixed crashes on login. Moved most of the remaining character/skeleton generation code into llappearance. Moved non-rendering related LLViewerJoint functionality into LLAvatarJoint.

master
Don Kjer 2012-09-09 12:12:19 +00:00
parent b77e2eff48
commit e1580128ab
22 changed files with 508 additions and 776 deletions

View File

@ -24,8 +24,13 @@
* $/LicenseInfo$
*/
#include "linden_common.h"
#if LL_MSVC
// disable warning about boost::lexical_cast returning uninitialized data
// when it fails to parse the string
#pragma warning (disable:4701)
#endif
#include "linden_common.h"
#include "llavatarappearance.h"
#include "llavatarappearancedefines.h"
@ -36,9 +41,20 @@
#include "llpolymorph.h"
#include "llpolymesh.h"
#include "llpolyskeletaldistortion.h"
#include "llstl.h"
#include "lltexglobalcolor.h"
#include "llwearabledata.h"
#if LL_MSVC
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
#endif
#include <boost/lexical_cast.hpp>
using namespace LLAvatarAppearanceDefines;
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
@ -153,7 +169,9 @@ LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
mWearableData(wearable_data)
{
llassert(mWearableData);
LLMemType mt(LLMemType::MTYPE_AVATAR);
llassert_always(mWearableData);
mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
for (U32 i = 0; i < mBakedTextureDatas.size(); i++ )
{
@ -167,13 +185,85 @@ LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
mIsBuilt = FALSE;
mNumJoints = 0;
mSkeleton = NULL;
mNumCollisionVolumes = 0;
mCollisionVolumes = NULL;
}
mRoot = new LLAvatarJoint();
// virtual
void LLAvatarAppearance::initInstance()
{
//-------------------------------------------------------------------------
// initialize joint, mesh and shape members
//-------------------------------------------------------------------------
mRoot = createAvatarJoint();
mRoot->setName( "mRoot" );
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().begin();
iter != LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().end();
++iter)
{
const EMeshIndex mesh_index = iter->first;
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->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 + boost::lexical_cast<std::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((int)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 (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().begin();
iter != LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().end();
++iter)
{
const EMeshIndex mesh_index = iter->first;
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->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 (avatar_joint_mesh_list_t::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin();
iter != mMeshLOD[mesh_index]->mMeshParts.end();
++iter)
{
LLAvatarJointMesh* mesh = (*iter);
mBakedTextureDatas[(int)baked_texture_index].mJointMeshes.push_back(mesh);
}
}
buildCharacter();
}
@ -187,7 +277,7 @@ LLAvatarAppearance::~LLAvatarAppearance()
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
deleteAndClear(mBakedTextureDatas[i].mTexLayerSet);
mBakedTextureDatas[i].mMeshes.clear();
mBakedTextureDatas[i].mJointMeshes.clear();
for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin();
iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++)
@ -200,23 +290,21 @@ LLAvatarAppearance::~LLAvatarAppearance()
mRoot->removeAllChildren();
mJointMap.clear();
deleteAndClearArray(mSkeleton);
clearSkeleton();
deleteAndClearArray(mCollisionVolumes);
mNumJoints = 0;
deleteAndClear(mTexSkinColor);
deleteAndClear(mTexHairColor);
deleteAndClear(mTexEyeColor);
std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer());
mMeshes.clear();
std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer());
mPolyMeshes.clear();
for (std::vector<LLAvatarJoint*>::iterator jointIter = mMeshLOD.begin();
for (avatar_joint_list_t::iterator jointIter = mMeshLOD.begin();
jointIter != mMeshLOD.end();
++jointIter)
{
LLAvatarJoint* joint = (LLAvatarJoint *) *jointIter;
LLAvatarJoint* joint = *jointIter;
std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer());
joint->mMeshParts.clear();
}
@ -504,6 +592,22 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
return TRUE;
}
//-----------------------------------------------------------------------------
// allocateCharacterJoints()
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::allocateCharacterJoints( U32 num )
{
clearSkeleton();
for(S32 joint_num = 0; joint_num < (S32)num; joint_num++)
{
mSkeleton.push_back(createAvatarJoint(joint_num));
}
return TRUE;
}
//-----------------------------------------------------------------------------
// buildSkeleton()
//-----------------------------------------------------------------------------
@ -548,6 +652,15 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
return TRUE;
}
//-----------------------------------------------------------------------------
// clearSkeleton()
//-----------------------------------------------------------------------------
void LLAvatarAppearance::clearSkeleton()
{
std::for_each(mSkeleton.begin(), mSkeleton.end(), DeletePointer());
mSkeleton.clear();
}
//-----------------------------------------------------------------------------
// LLAvatarAppearance::buildCharacter()
// Deferred initialization and rebuild of the avatar.
@ -569,6 +682,21 @@ void LLAvatarAppearance::buildCharacter()
mJointMap.clear();
mIsBuilt = FALSE;
//-------------------------------------------------------------------------
// clear mesh data
//-------------------------------------------------------------------------
for (avatar_joint_list_t::iterator jointIter = mMeshLOD.begin();
jointIter != mMeshLOD.end(); ++jointIter)
{
LLAvatarJoint* joint = *jointIter;
for (avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin();
meshIter != joint->mMeshParts.end(); ++meshIter)
{
LLAvatarJointMesh * mesh = *meshIter;
mesh->setMesh(NULL);
}
}
//-------------------------------------------------------------------------
// (re)load our skeleton and meshes
//-------------------------------------------------------------------------
@ -755,7 +883,7 @@ BOOL LLAvatarAppearance::loadAvatar()
}
loadLayersets();
loadLayersets();
// avatar_lad.xml : <driver_parameters>
for (LLAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin();
@ -791,7 +919,17 @@ BOOL LLAvatarAppearance::loadAvatar()
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::loadSkeletonNode ()
{
mRoot->addChild( &mSkeleton[0] );
mRoot->addChild( mSkeleton[0] );
// make meshes children before calling parent version of the function
for (avatar_joint_list_t::iterator iter = mMeshLOD.begin();
iter != mMeshLOD.end();
++iter)
{
LLAvatarJoint *joint = *iter;
joint->mUpdateXform = FALSE;
joint->setMeshesToChildren();
}
mRoot->addChild(mMeshLOD[MESH_ID_HEAD]);
mRoot->addChild(mMeshLOD[MESH_ID_EYELASH]);
@ -864,8 +1002,8 @@ BOOL LLAvatarAppearance::loadMeshNodes()
switch(lod)
case 0:
mesh = &mHairMesh0; */
for (LLAvatarAppearanceDictionary::Meshes::const_iterator mesh_iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin();
mesh_iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end();
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator mesh_iter = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().begin();
mesh_iter != LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().end();
++mesh_iter)
{
const EMeshIndex mesh_index = mesh_iter->first;
@ -906,8 +1044,8 @@ BOOL LLAvatarAppearance::loadMeshNodes()
if (!info->mReferenceMeshName.empty())
{
polymesh_map_t::const_iterator polymesh_iter = mMeshes.find(info->mReferenceMeshName);
if (polymesh_iter != mMeshes.end())
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);
@ -931,7 +1069,7 @@ BOOL LLAvatarAppearance::loadMeshNodes()
}
// Multimap insert
mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh));
mPolyMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh));
mesh->setMesh( poly_mesh );
mesh->setLOD( info->mMinPixelArea );
@ -974,15 +1112,72 @@ BOOL LLAvatarAppearance::loadLayersets()
layerset_iter != sAvatarXmlInfo->mLayerInfoList.end();
++layerset_iter)
{
// Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
LLTexLayerSetInfo *layerset_info = *layerset_iter;
layerset_info->createVisualParams(this);
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;
llwarns << "avatar file: layer_set->setInfo() failed" << llendl;
return FALSE;
}
// scan baked textures and associate the layerset with the appropriate one
EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
if (layer_set->isBodyRegion(baked_dict->mName))
{
baked_index = baked_iter->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)
{
llwarns << "<layer_set> has invalid body_region attribute" << llendl;
delete layer_set;
return FALSE;
}
// scan morph masks and let any affected layers know they have an associated morph
for (LLAvatarAppearance::morph_list_t::const_iterator morph_iter = mBakedTextureDatas[baked_index].mMaskedMorphs.begin();
morph_iter != mBakedTextureDatas[baked_index].mMaskedMorphs.end();
++morph_iter)
{
LLMaskedMorph *morph = *morph_iter;
LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer);
if (layer)
{
layer->setHasMorph(TRUE);
}
else
{
llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << llendl;
success = FALSE;
}
}
}
else // !isSelf()
{
// Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
LLTexLayerSetInfo *layerset_info = *layerset_iter;
layerset_info->createVisualParams(this);
}
}
return success;
}
// virtual
BOOL LLAvatarAppearance::isValid() const
{

View File

@ -28,9 +28,8 @@
#define LL_AVATAR_APPEARANCE_H
#include "llcharacter.h"
//#include "llframetimer.h"
#include "llavatarappearancedefines.h"
#include "llavatarjoint.h"
#include "llavatarjointmesh.h"
#include "lldriverparam.h"
#include "lltexlayer.h"
#include "llviewervisualparam.h"
@ -67,9 +66,10 @@ public:
virtual ~LLAvatarAppearance();
static void initClass(); // initializes static members
virtual void initInstance(); // Called after construction to initialize the instance.
virtual BOOL loadSkeletonNode();
virtual BOOL loadMeshNodes();
virtual BOOL loadLayersets();
BOOL loadMeshNodes();
BOOL loadLayersets();
/** Initialization
@ -97,8 +97,13 @@ public:
** SKELETON
**/
protected:
virtual LLAvatarJoint* createAvatarJoint() = 0;
virtual LLAvatarJoint* createAvatarJoint(S32 joint_num) = 0;
virtual LLAvatarJointMesh* createAvatarJointMesh() = 0;
public:
F32 getPelvisToFoot() const { return mPelvisToFoot; }
/*virtual*/ LLJoint* getRootJoint() { return mRoot; }
LLVector3 mHeadOffset; // current head position
LLAvatarJoint *mRoot;
@ -114,11 +119,13 @@ protected:
void computeBodySize();
BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &current_volume_num, S32 &current_joint_num);
BOOL allocateCharacterJoints(U32 num);
BOOL buildSkeleton(const LLAvatarSkeletonInfo *info);
protected:
void clearSkeleton();
BOOL mIsBuilt; // state of deferred character building
S32 mNumJoints;
LLJoint* mSkeleton;
typedef std::vector<LLAvatarJoint*> avatar_joint_list_t;
avatar_joint_list_t mSkeleton;
//--------------------------------------------------------------------
// Pelvis height adjustment members.
@ -204,8 +211,8 @@ protected:
protected:
typedef std::multimap<std::string, LLPolyMesh*> polymesh_map_t;
polymesh_map_t mMeshes;
std::vector<LLAvatarJoint *> mMeshLOD;
polymesh_map_t mPolyMeshes;
avatar_joint_list_t mMeshLOD;
/** Meshes
** **
@ -262,6 +269,8 @@ private:
** **
** BAKED TEXTURES
**/
protected:
virtual LLTexLayerSet* createTexLayerSet() = 0;
protected:
struct LLMaskedMorph;
typedef std::deque<LLMaskedMorph *> morph_list_t;
@ -274,7 +283,7 @@ protected:
LLAvatarAppearanceDefines::ETextureIndex mTextureIndex;
U32 mMaskTexName;
// Stores pointers to the joint meshes that this baked texture deals with
std::vector< LLJoint* > mMeshes; // std::vector<LLViewerJointMesh> mJoints[i]->mMeshParts
avatar_joint_mesh_list_t mJointMeshes;
morph_list_t mMaskedMorphs;
};
typedef std::vector<BakedTextureData> bakedtexturedata_vec_t;

View File

@ -109,9 +109,9 @@ LLAvatarAppearanceDictionary::BakedTextures::BakedTextures()
2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA));
}
LLAvatarAppearanceDictionary::Meshes::Meshes()
LLAvatarAppearanceDictionary::MeshEntries::MeshEntries()
{
// Meshes
// 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

View File

@ -174,12 +174,12 @@ public:
const LLJointPickName mPickName;
};
struct Meshes : public LLDictionary<EMeshIndex, MeshEntry>
struct MeshEntries : public LLDictionary<EMeshIndex, MeshEntry>
{
Meshes();
} mMeshes;
const MeshEntry* getMesh(EMeshIndex index) const { return mMeshes.lookup(index); }
const Meshes& getMeshes() const { return mMeshes; }
MeshEntries();
} mMeshEntries;
const MeshEntry* getMeshEntry(EMeshIndex index) const { return mMeshEntries.lookup(index); }
const MeshEntries& getMeshEntries() const { return mMeshEntries; }
//--------------------------------------------------------------------
// Baked Textures

View File

@ -33,13 +33,9 @@
#include "llrender.h"
#include "llmath.h"
#include "llglheaders.h"
#include "llrendersphere.h"
#include "llavatarappearance.h"
//#include "pipeline.h"
#define DEFAULT_LOD 0.0f
const S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64;
const F32 DEFAULT_AVATAR_JOINT_LOD = 0.0f;
//-----------------------------------------------------------------------------
// Static Data
@ -48,21 +44,22 @@ BOOL LLAvatarJoint::sDisableLOD = FALSE;
//-----------------------------------------------------------------------------
// LLAvatarJoint()
// Class Constructor
// Class Constructors
//-----------------------------------------------------------------------------
LLAvatarJoint::LLAvatarJoint()
: LLJoint()
LLAvatarJoint::LLAvatarJoint() :
LLJoint()
{
init();
}
LLAvatarJoint::LLAvatarJoint(const std::string &name, LLJoint *parent) :
LLJoint(name, parent)
{
init();
}
//-----------------------------------------------------------------------------
// LLAvatarJoint()
// Class Constructor
//-----------------------------------------------------------------------------
LLAvatarJoint::LLAvatarJoint(const std::string &name, LLJoint *parent)
: LLJoint(name, parent)
LLAvatarJoint::LLAvatarJoint(S32 joint_num) :
LLJoint(joint_num)
{
init();
}
@ -72,7 +69,7 @@ void LLAvatarJoint::init()
{
mValid = FALSE;
mComponents = SC_JOINT | SC_BONE | SC_AXES;
mMinPixelArea = DEFAULT_LOD;
mMinPixelArea = DEFAULT_AVATAR_JOINT_LOD;
mPickName = PN_DEFAULT;
mVisible = TRUE;
mMeshID = 0;
@ -113,14 +110,6 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )
}
//--------------------------------------------------------------------
// isTransparent()
//--------------------------------------------------------------------
BOOL LLAvatarJoint::isTransparent()
{
return FALSE;
}
//--------------------------------------------------------------------
// setSkeletonComponents()
//--------------------------------------------------------------------
@ -132,7 +121,7 @@ void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive )
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLAvatarJoint* joint = (LLAvatarJoint*)(*iter);
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
joint->setSkeletonComponents(comp, recursive);
}
}
@ -153,14 +142,87 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
}
}
void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
}
}
void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update)
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
joint->updateFaceData(face, pixel_area, damp_wind, terse_update);
}
}
void LLAvatarJoint::updateJointGeometry()
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
joint->updateJointGeometry();
}
}
BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
{
BOOL lod_changed = FALSE;
BOOL found_lod = FALSE;
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
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 (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
joint->dump();
}
}
void LLAvatarJoint::setMeshesToChildren()
{
removeAllChildren();
for (std::vector<LLAvatarJointMesh*>::iterator iter = mMeshParts.begin();
for (avatar_joint_mesh_list_t::iterator iter = mMeshParts.begin();
iter != mMeshParts.end(); iter++)
{
addChild((LLAvatarJoint*) *iter);
addChild((*iter));
}
}
//-----------------------------------------------------------------------------
@ -172,9 +234,11 @@ LLAvatarJointCollisionVolume::LLAvatarJointCollisionVolume()
mUpdateXform = FALSE;
}
LLAvatarJointCollisionVolume::LLAvatarJointCollisionVolume(const std::string &name, LLJoint *parent) : LLAvatarJoint(name, parent)
/*virtual*/
U32 LLAvatarJointCollisionVolume::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
{
llerrs << "Cannot call render() on LLAvatarJointCollisionVolume" << llendl;
return 0;
}
LLVector3 LLAvatarJointCollisionVolume::getVolumePos(LLVector3 &offset)

View File

@ -36,6 +36,8 @@
class LLFace;
class LLAvatarJointMesh;
extern const F32 DEFAULT_AVATAR_JOINT_LOD;
//-----------------------------------------------------------------------------
// class LLViewerJoint
//-----------------------------------------------------------------------------
@ -44,6 +46,8 @@ class LLAvatarJoint :
{
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();
@ -55,12 +59,11 @@ public:
// Returns true if this object is transparent.
// This is used to determine in which order to draw objects.
virtual BOOL isTransparent();
virtual BOOL isTransparent() { return FALSE; }
// Returns true if this object should inherit scale modifiers from its immediate parent
virtual BOOL inheritScale() { return FALSE; }
enum Components
{
SC_BONE = 1,
@ -83,7 +86,7 @@ public:
// 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; }
@ -92,9 +95,18 @@ public:
// 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;
std::vector<LLAvatarJointMesh*> mMeshParts; //LLViewerJointMesh*
avatar_joint_mesh_list_t mMeshParts; //LLViewerJointMesh*
void setMeshID( S32 id ) {mMeshID = id;}
protected:
@ -112,10 +124,10 @@ class LLAvatarJointCollisionVolume : public LLAvatarJoint
{
public:
LLAvatarJointCollisionVolume();
LLAvatarJointCollisionVolume(const std::string &name, LLJoint *parent = NULL);
virtual ~LLAvatarJointCollisionVolume() {};
virtual BOOL inheritScale() { return TRUE; }
/*virtual*/ BOOL inheritScale() { return TRUE; }
/*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
void renderCollision();

View File

@ -233,6 +233,12 @@ void LLAvatarJointMesh::setTexture( LLGLTexture *texture )
}
}
BOOL LLAvatarJointMesh::hasGLTexture() const
{
return mTexture.notNull() && mTexture->hasGLTexture();
}
//--------------------------------------------------------------------
// LLAvatarJointMesh::setLayerSet()
// Sets the shape texture (takes precedence over normal texture)
@ -248,6 +254,10 @@ void LLAvatarJointMesh::setLayerSet( LLTexLayerSet* layer_set )
}
}
BOOL LLAvatarJointMesh::hasComposite() const
{
return (mLayerSet && mLayerSet->hasComposite());
}
//--------------------------------------------------------------------

View File

@ -59,9 +59,8 @@ public:
//-----------------------------------------------------------------------------
// class LLViewerJointMesh
//-----------------------------------------------------------------------------
class LLAvatarJointMesh : public LLAvatarJoint
class LLAvatarJointMesh : public virtual LLAvatarJoint
{
friend class LLAvatarAppearance;
protected:
LLColor4 mColor; // color value
// LLColor4 mSpecular; // specular color (always white for now)
@ -94,6 +93,9 @@ public:
// Destructor
virtual ~LLAvatarJointMesh();
// overloaded from base class
/*virtual*/ BOOL isTransparent() { return mIsTransparent; }
// Gets the shape color
void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha );
@ -106,11 +108,15 @@ public:
// Sets the shape texture
void setTexture( LLGLTexture *texture );
BOOL hasGLTexture() const;
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 );
BOOL hasComposite() const;
// Gets the poly mesh
LLPolyMesh *getMesh();
@ -129,6 +135,8 @@ public:
// Gets ID for picking
S32 getMeshID() { return mMeshID; }
void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
private:
// Allocate skin data
BOOL allocateSkinData( U32 numSkinJoints );

View File

@ -28,6 +28,7 @@
#ifndef LL_LLJOINTPICKNAME_H
#define LL_LLJOINTPICKNAME_H
class LLAvatarJointMesh;
// Sets the OpenGL selection stack name that is pushed and popped
// with this joint state. The default value indicates that no name
@ -43,4 +44,6 @@ enum LLJointPickName
PN_5 = 5
};
typedef std::vector<LLAvatarJointMesh*> avatar_joint_mesh_list_t;
#endif // LL_LLJOINTPICKNAME_H

View File

@ -93,13 +93,6 @@ public:
// get the height & normal of the ground under a point
virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm) = 0;
// allocate an array of joints for the character skeleton
// this must be overloaded to support joint subclasses,
// and is called implicitly from buildSkeleton().
// Note this must handle reallocation as it will be called
// each time buildSkeleton() is called.
virtual BOOL allocateCharacterJoints( U32 num ) = 0;
// skeleton joint accessor to support joint subclasses
virtual LLJoint *getCharacterJoint( U32 i ) = 0;

View File

@ -40,7 +40,9 @@ S32 LLJoint::sNumTouches = 0;
// LLJoint()
// Class Constructor
//-----------------------------------------------------------------------------
LLJoint::LLJoint()
void LLJoint::init()
{
mName = "unnamed";
mParent = NULL;
@ -48,7 +50,20 @@ LLJoint::LLJoint()
mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;
mUpdateXform = TRUE;
mJointNum = -1;
}
LLJoint::LLJoint() :
mJointNum(-1)
{
init();
touch();
mResetAfterRestoreOldXform = false;
}
LLJoint::LLJoint(S32 joint_num) :
mJointNum(joint_num)
{
init();
touch();
mResetAfterRestoreOldXform = false;
}
@ -58,15 +73,12 @@ LLJoint::LLJoint()
// LLJoint()
// Class Constructor
//-----------------------------------------------------------------------------
LLJoint::LLJoint(const std::string &name, LLJoint *parent)
LLJoint::LLJoint(const std::string &name, LLJoint *parent) :
mJointNum(0)
{
mName = "unnamed";
mParent = NULL;
mXform.setScaleChildOffset(TRUE);
mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;
init();
mUpdateXform = FALSE;
mJointNum = 0;
// *TODO: mResetAfterRestoreOldXform is not initialized!!!
setName(name);
if (parent)

View File

@ -105,10 +105,15 @@ public:
public:
LLJoint();
LLJoint(S32 joint_num);
// *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
LLJoint( const std::string &name, LLJoint *parent=NULL );
virtual ~LLJoint();
private:
void init();
public:
// set name and parent
void setup( const std::string &name, LLJoint *parent=NULL );
@ -178,7 +183,6 @@ public:
virtual BOOL isAnimatable() const { return TRUE; }
S32 getJointNum() const { return mJointNum; }
void setJointNum(S32 joint_num) { mJointNum = joint_num; }
void restoreOldXform( void );
void restoreToDefaultXform( void );

View File

@ -150,11 +150,11 @@ namespace tut
template<> template<>
void lljoint_object::test<11>()
{
LLJoint lljoint("parent");
S32 joint_num = 12;
lljoint.setJointNum(joint_num);
LLJoint lljoint(joint_num);
lljoint.setName("parent");
S32 jointNum = lljoint.getJointNum();
ensure("setJointNum()/getJointNum failed ", (jointNum == joint_num));
ensure("getJointNum failed ", (jointNum == joint_num));
}
template<> template<>

View File

@ -614,7 +614,7 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const
}
mDummyAvatar->mRoot->setVisible(FALSE, TRUE);
mTargetMesh = (LLViewerJointMesh*)mDummyAvatar->mRoot->findJoint(mesh_name);
mTargetMesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
mTargetMesh->setTestTexture(mTextureName);
mTargetMesh->setVisible(TRUE, FALSE);
mCameraDistance = distance;
@ -631,7 +631,7 @@ void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name)
{
if (mDummyAvatar)
{
LLViewerJointMesh *mesh = (LLViewerJointMesh*)mDummyAvatar->mRoot->findJoint(mesh_name);
LLViewerJointMesh *mesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
// clear out existing test mesh
if (mesh)
{

View File

@ -35,50 +35,26 @@
#include "llrender.h"
#include "llmath.h"
#include "llglheaders.h"
#include "llrendersphere.h"
#include "llvoavatar.h"
#include "pipeline.h"
#define DEFAULT_LOD 0.0f
const S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64;
//-----------------------------------------------------------------------------
// Static Data
//-----------------------------------------------------------------------------
BOOL LLViewerJoint::sDisableLOD = FALSE;
static const S32 MIN_PIXEL_AREA_3PASS_HAIR = 64*64;
//-----------------------------------------------------------------------------
// LLViewerJoint()
// Class Constructor
// Class Constructors
//-----------------------------------------------------------------------------
LLViewerJoint::LLViewerJoint()
: LLAvatarJoint()
{
init();
}
LLViewerJoint::LLViewerJoint() :
LLAvatarJoint()
{ }
LLViewerJoint::LLViewerJoint(const std::string &name, LLJoint *parent) :
LLAvatarJoint(name, parent)
{ }
//-----------------------------------------------------------------------------
// LLViewerJoint()
// Class Constructor
//-----------------------------------------------------------------------------
LLViewerJoint::LLViewerJoint(const std::string &name, LLJoint *parent)
: LLAvatarJoint(name, parent)
{
init();
}
void LLViewerJoint::init()
{
mValid = FALSE;
mComponents = SC_JOINT | SC_BONE | SC_AXES;
mMinPixelArea = DEFAULT_LOD;
mPickName = PN_DEFAULT;
mVisible = TRUE;
mMeshID = 0;
}
LLViewerJoint::LLViewerJoint(S32 joint_num) :
LLAvatarJoint(joint_num)
{ }
//-----------------------------------------------------------------------------
@ -89,129 +65,6 @@ LLViewerJoint::~LLViewerJoint()
{
}
//--------------------------------------------------------------------
// renderSkeleton()
// DEBUG (UNUSED)
//--------------------------------------------------------------------
// void LLViewerJoint::renderSkeleton(BOOL recursive)
// {
// F32 nc = 0.57735f;
// //----------------------------------------------------------------
// // push matrix stack
// //----------------------------------------------------------------
// gGL.pushMatrix();
// //----------------------------------------------------------------
// // render the bone to my parent
// //----------------------------------------------------------------
// if (mComponents & SC_BONE)
// {
// drawBone();
// }
// //----------------------------------------------------------------
// // offset to joint position and
// // rotate to our orientation
// //----------------------------------------------------------------
// gGL.loadIdentity();
// gGL.multMatrix( &getWorldMatrix().mMatrix[0][0] );
// //----------------------------------------------------------------
// // render joint axes
// //----------------------------------------------------------------
// if (mComponents & SC_AXES)
// {
// gGL.begin(LLRender::LINES);
// gGL.color3f( 1.0f, 0.0f, 0.0f );
// gGL.vertex3f( 0.0f, 0.0f, 0.0f );
// gGL.vertex3f( 0.1f, 0.0f, 0.0f );
// gGL.color3f( 0.0f, 1.0f, 0.0f );
// gGL.vertex3f( 0.0f, 0.0f, 0.0f );
// gGL.vertex3f( 0.0f, 0.1f, 0.0f );
// gGL.color3f( 0.0f, 0.0f, 1.0f );
// gGL.vertex3f( 0.0f, 0.0f, 0.0f );
// gGL.vertex3f( 0.0f, 0.0f, 0.1f );
// gGL.end();
// }
// //----------------------------------------------------------------
// // render the joint graphic
// //----------------------------------------------------------------
// if (mComponents & SC_JOINT)
// {
// gGL.color3f( 1.0f, 1.0f, 0.0f );
// gGL.begin(LLRender::TRIANGLES);
// // joint top half
// glNormal3f(nc, nc, nc);
// gGL.vertex3f(0.0f, 0.0f, 0.05f);
// gGL.vertex3f(0.05f, 0.0f, 0.0f);
// gGL.vertex3f(0.0f, 0.05f, 0.0f);
// glNormal3f(-nc, nc, nc);
// gGL.vertex3f(0.0f, 0.0f, 0.05f);
// gGL.vertex3f(0.0f, 0.05f, 0.0f);
// gGL.vertex3f(-0.05f, 0.0f, 0.0f);
// glNormal3f(-nc, -nc, nc);
// gGL.vertex3f(0.0f, 0.0f, 0.05f);
// gGL.vertex3f(-0.05f, 0.0f, 0.0f);
// gGL.vertex3f(0.0f, -0.05f, 0.0f);
// glNormal3f(nc, -nc, nc);
// gGL.vertex3f(0.0f, 0.0f, 0.05f);
// gGL.vertex3f(0.0f, -0.05f, 0.0f);
// gGL.vertex3f(0.05f, 0.0f, 0.0f);
// // joint bottom half
// glNormal3f(nc, nc, -nc);
// gGL.vertex3f(0.0f, 0.0f, -0.05f);
// gGL.vertex3f(0.0f, 0.05f, 0.0f);
// gGL.vertex3f(0.05f, 0.0f, 0.0f);
// glNormal3f(-nc, nc, -nc);
// gGL.vertex3f(0.0f, 0.0f, -0.05f);
// gGL.vertex3f(-0.05f, 0.0f, 0.0f);
// gGL.vertex3f(0.0f, 0.05f, 0.0f);
// glNormal3f(-nc, -nc, -nc);
// gGL.vertex3f(0.0f, 0.0f, -0.05f);
// gGL.vertex3f(0.0f, -0.05f, 0.0f);
// gGL.vertex3f(-0.05f, 0.0f, 0.0f);
// glNormal3f(nc, -nc, -nc);
// gGL.vertex3f(0.0f, 0.0f, -0.05f);
// gGL.vertex3f(0.05f, 0.0f, 0.0f);
// gGL.vertex3f(0.0f, -0.05f, 0.0f);
// gGL.end();
// }
// //----------------------------------------------------------------
// // render children
// //----------------------------------------------------------------
// if (recursive)
// {
// for (child_list_t::iterator iter = mChildren.begin();
// iter != mChildren.end(); ++iter)
// {
// LLViewerJoint* joint = (LLViewerJoint*)(*iter);
// joint->renderSkeleton();
// }
// }
// //----------------------------------------------------------------
// // pop matrix stack
// //----------------------------------------------------------------
// gGL.popMatrix();
// }
//--------------------------------------------------------------------
// render()
//--------------------------------------------------------------------
@ -292,13 +145,13 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLViewerJoint* joint = (LLViewerJoint*)(*iter);
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
F32 jointLOD = joint->getLOD();
if (pixelArea >= jointLOD || sDisableLOD)
{
triangle_count += joint->render( pixelArea, TRUE, is_dummy );
if (jointLOD != DEFAULT_LOD)
if (jointLOD != DEFAULT_AVATAR_JOINT_LOD)
{
break;
}
@ -308,72 +161,6 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
return triangle_count;
}
//--------------------------------------------------------------------
// drawBone()
// DEBUG (UNUSED)
//--------------------------------------------------------------------
// void LLViewerJoint::drawBone()
// {
// if ( mParent == NULL )
// return;
// F32 boneSize = 0.02f;
// // rotate to point to child (bone direction)
// gGL.pushMatrix();
// LLVector3 boneX = getPosition();
// F32 length = boneX.normVec();
// LLVector3 boneZ(1.0f, 0.0f, 1.0f);
// LLVector3 boneY = boneZ % boneX;
// boneY.normVec();
// boneZ = boneX % boneY;
// LLMatrix4 rotateMat;
// rotateMat.setFwdRow( boneX );
// rotateMat.setLeftRow( boneY );
// rotateMat.setUpRow( boneZ );
// gGL.multMatrix( &rotateMat.mMatrix[0][0] );
// // render the bone
// gGL.color3f( 0.5f, 0.5f, 0.0f );
// gGL.begin(LLRender::TRIANGLES);
// gGL.vertex3f( length, 0.0f, 0.0f);
// gGL.vertex3f( 0.0f, boneSize, 0.0f);
// gGL.vertex3f( 0.0f, 0.0f, boneSize);
// gGL.vertex3f( length, 0.0f, 0.0f);
// gGL.vertex3f( 0.0f, 0.0f, -boneSize);
// gGL.vertex3f( 0.0f, boneSize, 0.0f);
// gGL.vertex3f( length, 0.0f, 0.0f);
// gGL.vertex3f( 0.0f, -boneSize, 0.0f);
// gGL.vertex3f( 0.0f, 0.0f, -boneSize);
// gGL.vertex3f( length, 0.0f, 0.0f);
// gGL.vertex3f( 0.0f, 0.0f, boneSize);
// gGL.vertex3f( 0.0f, -boneSize, 0.0f);
// gGL.end();
// // restore matrix
// gGL.popMatrix();
// }
//--------------------------------------------------------------------
// isTransparent()
//--------------------------------------------------------------------
BOOL LLViewerJoint::isTransparent()
{
return FALSE;
}
//--------------------------------------------------------------------
// drawShape()
//--------------------------------------------------------------------
@ -382,121 +169,4 @@ U32 LLViewerJoint::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
return 0;
}
//--------------------------------------------------------------------
// setSkeletonComponents()
//--------------------------------------------------------------------
void LLViewerJoint::setSkeletonComponents( U32 comp, BOOL recursive )
{
mComponents = comp;
if (recursive)
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLViewerJoint* joint = (LLViewerJoint*)(*iter);
joint->setSkeletonComponents(comp, recursive);
}
}
}
void LLViewerJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLViewerJoint* joint = (LLViewerJoint*)(*iter);
joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
}
}
void LLViewerJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update)
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLViewerJoint* joint = (LLViewerJoint*)(*iter);
joint->updateFaceData(face, pixel_area, damp_wind, terse_update);
}
}
void LLViewerJoint::updateJointGeometry()
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLViewerJoint* joint = (LLViewerJoint*)(*iter);
joint->updateJointGeometry();
}
}
BOOL LLViewerJoint::updateLOD(F32 pixel_area, BOOL activate)
{
BOOL lod_changed = FALSE;
BOOL found_lod = FALSE;
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLViewerJoint* joint = (LLViewerJoint*)(*iter);
F32 jointLOD = joint->getLOD();
if (found_lod || jointLOD == DEFAULT_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 LLViewerJoint::dump()
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLViewerJoint* joint = (LLViewerJoint*)(*iter);
joint->dump();
}
}
void LLViewerJoint::setVisible(BOOL visible, BOOL recursive)
{
mVisible = visible;
if (recursive)
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLViewerJoint* joint = (LLViewerJoint*)(*iter);
joint->setVisible(visible, recursive);
}
}
}
void LLViewerJoint::setMeshesToChildren()
{
removeAllChildren();
for (std::vector<LLViewerJointMesh*>::iterator iter = mMeshParts.begin();
iter != mMeshParts.end(); iter++)
{
addChild((LLViewerJointMesh *) *iter);
}
}
// End

View File

@ -40,95 +40,25 @@ class LLViewerJointMesh;
// class LLViewerJoint
//-----------------------------------------------------------------------------
class LLViewerJoint :
public LLAvatarJoint
public virtual LLAvatarJoint
{
public:
LLViewerJoint();
LLViewerJoint(S32 joint_num);
// *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
LLViewerJoint(const std::string &name, LLJoint *parent = NULL);
virtual ~LLViewerJoint();
// Gets the validity of this joint
BOOL getValid() { return mValid; }
// Primarily for debugging and character setup
// Derived classes may add text/graphic output.
// Draw skeleton graphic for debugging and character setup
void renderSkeleton(BOOL recursive=TRUE); // debug only (unused)
// Draws a bone graphic to the parent joint.
// Derived classes may add text/graphic output.
// Called by renderSkeleton().
void drawBone(); // debug only (unused)
// Render character hierarchy.
// Traverses the entire joint hierarchy, setting up
// transforms and calling the drawShape().
// Derived classes may add text/graphic output.
virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); // Returns triangle count
// Returns true if this object is transparent.
// This is used to determine in which order to draw objects.
virtual BOOL isTransparent();
// Returns true if this object should inherit scale modifiers from its immediate parent
virtual BOOL inheritScale() { return FALSE; }
// Draws the shape attached to a joint.
// Called by render().
virtual U32 drawShape( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
virtual void drawNormals() {}
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; }
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();
void setVisible( BOOL visible, BOOL recursive );
// Takes meshes in mMeshParts and sets each one as a child joint
void setMeshesToChildren();
public:
static BOOL sDisableLOD;
std::vector<LLViewerJointMesh*> mMeshParts;
void setMeshID( S32 id ) {mMeshID = id;}
protected:
void init();
BOOL mValid;
U32 mComponents;
F32 mMinPixelArea;
LLJointPickName mPickName;
BOOL mVisible;
S32 mMeshID;
};
#endif // LL_LLVIEWERJOINT_H

View File

@ -200,21 +200,6 @@ void LLViewerJointMesh::uploadJointMatrices()
}
}
//--------------------------------------------------------------------
// LLViewerJointMesh::drawBone()
//--------------------------------------------------------------------
void LLViewerJointMesh::drawBone()
{
}
//--------------------------------------------------------------------
// LLViewerJointMesh::isTransparent()
//--------------------------------------------------------------------
BOOL LLViewerJointMesh::isTransparent()
{
return mIsTransparent;
}
//--------------------------------------------------------------------
// DrawElementsBLEND and utility code
//--------------------------------------------------------------------

View File

@ -41,9 +41,8 @@ class LLViewerTexLayerSet;
//-----------------------------------------------------------------------------
// class LLViewerJointMesh
//-----------------------------------------------------------------------------
class LLViewerJointMesh : public LLAvatarJointMesh
class LLViewerJointMesh : public LLAvatarJointMesh, public LLViewerJoint
{
friend class LLVOAvatar;
public:
// Constructor
LLViewerJointMesh();
@ -55,8 +54,6 @@ public:
void uploadJointMatrices();
// overloaded from base class
/*virtual*/ void drawBone();
/*virtual*/ BOOL isTransparent();
/*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy );
/*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
@ -65,8 +62,6 @@ public:
/*virtual*/ void updateJointGeometry();
/*virtual*/ void dump();
void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
/*virtual*/ BOOL isAnimatable() const { return FALSE; }
private:

View File

@ -24,12 +24,6 @@
* $/LicenseInfo$
*/
#if LL_MSVC
// disable warning about boost::lexical_cast returning uninitialized data
// when it fails to parse the string
#pragma warning (disable:4701)
#endif
#include "llviewerprecompiledheaders.h"
#include "llvoavatar.h"
@ -109,12 +103,6 @@ extern F32 SPEED_ADJUST_MAX_SEC;
extern F32 ANIM_SPEED_MAX;
extern F32 ANIM_SPEED_MIN;
#if LL_MSVC
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
#endif
#include <boost/lexical_cast.hpp>
// #define OUTPUT_BREAST_DATA
@ -783,7 +771,7 @@ BOOL LLVOAvatar::isFullyTextured() const
{
for (S32 i = 0; i < mMeshLOD.size(); i++)
{
LLViewerJoint* joint = (LLViewerJoint*) mMeshLOD[i];
LLAvatarJoint* joint = mMeshLOD[i];
if (i==MESH_ID_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT))
{
continue; // don't care about skirt textures if we're not wearing one.
@ -792,19 +780,19 @@ BOOL LLVOAvatar::isFullyTextured() const
{
continue; // nonexistent LOD OK.
}
std::vector<LLViewerJointMesh*>::iterator meshIter = joint->mMeshParts.begin();
avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin();
if (meshIter != joint->mMeshParts.end())
{
LLViewerJointMesh *mesh = (LLViewerJointMesh *) *meshIter;
LLAvatarJointMesh *mesh = (*meshIter);
if (!mesh)
{
continue; // nonexistent mesh OK
}
if (mesh->mTexture.notNull() && mesh->mTexture->hasGLTexture())
if (mesh->hasGLTexture())
{
continue; // Mesh exists and has a baked texture.
}
if (mesh->mLayerSet && mesh->mLayerSet->hasComposite())
if (mesh->hasComposite())
{
continue; // Mesh exists and has a composite texture.
}
@ -1056,84 +1044,9 @@ void LLVOAvatar::cleanupClass()
sXMLTree.cleanup();
}
// virtual
void LLVOAvatar::initInstance(void)
{
//-------------------------------------------------------------------------
// initialize joint, mesh and shape members
//-------------------------------------------------------------------------
if (mRoot)
{
delete mRoot;
}
mRoot = new LLViewerJoint();
mRoot->setName( "mRoot" );
for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin();
iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end();
++iter)
{
const EMeshIndex mesh_index = iter->first;
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second;
LLViewerJoint* joint = new LLViewerJoint();
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++)
{
LLViewerJointMesh* mesh = new LLViewerJointMesh();
std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast<std::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((int)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 (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin();
iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end();
++iter)
{
const EMeshIndex mesh_index = iter->first;
const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->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 (std::vector<LLAvatarJointMesh* >::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin();
iter != mMeshLOD[mesh_index]->mMeshParts.end();
++iter)
{
LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter;
mBakedTextureDatas[(int)baked_texture_index].mMeshes.push_back(mesh);
}
}
//-------------------------------------------------------------------------
// register motions
//-------------------------------------------------------------------------
@ -1192,10 +1105,9 @@ void LLVOAvatar::initInstance(void)
registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create );
registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create );
registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create );
}
buildCharacter();
LLAvatarAppearance::initInstance();
// preload specific motions here
createMotion( ANIM_AGENT_CUSTOMIZE);
@ -1204,7 +1116,30 @@ void LLVOAvatar::initInstance(void)
//VTPause(); // VTune
mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) );
}
// virtual
LLAvatarJoint* LLVOAvatar::createAvatarJoint()
{
return new LLViewerJoint();
}
// virtual
LLAvatarJoint* LLVOAvatar::createAvatarJoint(S32 joint_num)
{
return new LLViewerJoint(joint_num);
}
// virtual
LLAvatarJointMesh* LLVOAvatar::createAvatarJointMesh()
{
return new LLViewerJointMesh();
}
// virtual
LLTexLayerSet* LLVOAvatar::createTexLayerSet()
{
return new LLViewerTexLayerSet(this);
}
const LLVector3 LLVOAvatar::getRenderPosition() const
@ -1279,7 +1214,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
float max_attachment_span = get_default_max_prim_scale() * 5.0f;
//stretch bounding box by joint positions
for (polymesh_map_t::iterator i = mMeshes.begin(); i != mMeshes.end(); ++i)
for (polymesh_map_t::iterator i = mPolyMeshes.begin(); i != mPolyMeshes.end(); ++i)
{
LLPolyMesh* mesh = i->second;
for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++)
@ -1551,23 +1486,11 @@ void LLVOAvatar::startDefaultMotions()
// virtual
void LLVOAvatar::buildCharacter()
{
//-------------------------------------------------------------------------
// clear mesh data
//-------------------------------------------------------------------------
for (std::vector<LLAvatarJoint*>::iterator jointIter = mMeshLOD.begin();
jointIter != mMeshLOD.end(); ++jointIter)
{
LLViewerJoint* joint = (LLViewerJoint*) *jointIter;
for (std::vector<LLViewerJointMesh*>::iterator meshIter = joint->mMeshParts.begin();
meshIter != joint->mMeshParts.end(); ++meshIter)
{
LLViewerJointMesh * mesh = (LLViewerJointMesh *) *meshIter;
mesh->setMesh(NULL);
}
}
LLAvatarAppearance::buildCharacter();
// Not done building yet; more to do.
mIsBuilt = FALSE;
//-------------------------------------------------------------------------
// set head offset from pelvis
//-------------------------------------------------------------------------
@ -1600,6 +1523,9 @@ void LLVOAvatar::buildCharacter()
//-------------------------------------------------------------------------
processAnimationStateChanges();
mIsBuilt = TRUE;
stop_glerror();
mMeshValid = TRUE;
}
@ -1619,11 +1545,11 @@ void LLVOAvatar::releaseMeshData()
//llinfos << "Releasing" << llendl;
// cleanup mesh data
for (std::vector<LLAvatarJoint*>::iterator iter = mMeshLOD.begin();
for (avatar_joint_list_t::iterator iter = mMeshLOD.begin();
iter != mMeshLOD.end();
++iter)
{
LLViewerJoint* joint = (LLViewerJoint*) *iter;
LLAvatarJoint* joint = (*iter);
joint->setValid(FALSE, TRUE);
}
@ -4718,10 +4644,12 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name )
//-----------------------------------------------------------------------------
void LLVOAvatar::resetJointPositions( void )
{
for(S32 i = 0; i < (S32)mNumJoints; ++i)
avatar_joint_list_t::iterator iter = mSkeleton.begin();
avatar_joint_list_t::iterator end = mSkeleton.end();
for (; iter != end; ++iter)
{
mSkeleton[i].restoreOldXform();
mSkeleton[i].setId( LLUUID::null );
(*iter)->restoreOldXform();
(*iter)->setId( LLUUID::null );
}
mHasPelvisOffset = false;
mPelvisFixup = mLastPelvisFixup;
@ -4753,16 +4681,17 @@ void LLVOAvatar::resetSpecificJointPosition( const std::string& name )
//-----------------------------------------------------------------------------
void LLVOAvatar::resetJointPositionsToDefault( void )
{
//Subsequent joints are relative to pelvis
for( S32 i = 0; i < (S32)mNumJoints; ++i )
avatar_joint_list_t::iterator iter = mSkeleton.begin();
avatar_joint_list_t::iterator end = mSkeleton.end();
for (; iter != end; ++iter)
{
LLJoint* pJoint = (LLJoint*)&mSkeleton[i];
LLJoint* pJoint = (*iter);
if ( pJoint->doesJointNeedToBeReset() )
{
pJoint->setId( LLUUID::null );
//restore joints to default positions, however skip over the pelvis
// *TODO: How does this pointer check skip over pelvis?
if ( pJoint )
{
pJoint->restoreOldXform();
@ -4895,43 +4824,18 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position)
return gAgent.getPosAgentFromGlobal(position);
}
//-----------------------------------------------------------------------------
// allocateCharacterJoints()
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::allocateCharacterJoints( U32 num )
{
deleteAndClearArray(mSkeleton);
mNumJoints = 0;
mSkeleton = new LLViewerJoint[num];
for(S32 joint_num = 0; joint_num < (S32)num; joint_num++)
{
mSkeleton[joint_num].setJointNum(joint_num);
}
if (!mSkeleton)
{
return FALSE;
}
mNumJoints = num;
return TRUE;
}
//-----------------------------------------------------------------------------
// getCharacterJoint()
//-----------------------------------------------------------------------------
LLJoint *LLVOAvatar::getCharacterJoint( U32 num )
{
if ((S32)num >= mNumJoints
if ((S32)num >= mSkeleton.size()
|| (S32)num < 0)
{
return NULL;
}
return (LLJoint*)&mSkeleton[num];
return mSkeleton[num];
}
//-----------------------------------------------------------------------------
@ -4949,16 +4853,6 @@ void LLVOAvatar::requestStopMotion( LLMotion* motion )
//virtual
BOOL LLVOAvatar::loadSkeletonNode ()
{
// make meshes children before calling parent version of the function
for (std::vector<LLAvatarJoint *>::iterator iter = mMeshLOD.begin();
iter != mMeshLOD.end();
++iter)
{
LLViewerJoint *joint = (LLViewerJoint *) *iter;
joint->mUpdateXform = FALSE;
joint->setMeshesToChildren();
}
if (!LLAvatarAppearance::loadSkeletonNode())
{
return FALSE;
@ -5695,9 +5589,11 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL
if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex))
{
LLColor4 color = mTexHairColor->getColor();
for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++)
avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin();
avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end();
for (; iter != end; ++iter)
{
LLViewerJointMesh* mesh = dynamic_cast<LLViewerJointMesh*>(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]);
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
{
mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] );
@ -5962,9 +5858,11 @@ void LLVOAvatar::updateMeshTextures()
}
mBakedTextureDatas[i].mIsUsed = TRUE;
for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++)
avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
for (; iter != end; ++iter)
{
LLViewerJointMesh* mesh = dynamic_cast<LLViewerJointMesh*>(mBakedTextureDatas[i].mMeshes[k]);
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
{
mesh->setTexture( baked_img );
@ -5996,9 +5894,11 @@ void LLVOAvatar::updateMeshTextures()
layerset->createComposite();
layerset->setUpdatesEnabled( TRUE );
mBakedTextureDatas[i].mIsUsed = FALSE;
for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++)
avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
for (; iter != end; ++iter)
{
LLViewerJointMesh* mesh = dynamic_cast<LLViewerJointMesh*>(mBakedTextureDatas[i].mMeshes[k]);
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
{
mesh->setLayerSet( layerset );
@ -6014,9 +5914,11 @@ void LLVOAvatar::updateMeshTextures()
{
const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1);
LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 );
for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++)
avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin();
avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end();
for (; iter != end; ++iter)
{
LLViewerJointMesh* mesh = dynamic_cast<LLViewerJointMesh*>(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]);
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
{
mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] );
@ -6778,9 +6680,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
mBakedTextureDatas[i].mIsLoaded = true;
mBakedTextureDatas[i].mLastTextureIndex = id;
mBakedTextureDatas[i].mIsUsed = true;
for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++)
avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
for (; iter != end; ++iter)
{
LLViewerJointMesh* mesh = dynamic_cast<LLViewerJointMesh*>(mBakedTextureDatas[i].mMeshes[k]);
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
{
mesh->setTexture( image_baked );
@ -6803,9 +6707,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
// This is paired with similar code in updateMeshTextures that sets hair mesh color.
if (i == BAKED_HAIR)
{
for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++)
avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end();
for (; iter != end; ++iter)
{
LLViewerJointMesh* mesh = dynamic_cast<LLViewerJointMesh*>(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]);
LLAvatarJointMesh* mesh = (*iter);
if (mesh)
{
mesh->setColor( 1.f, 1.f, 1.f, 1.f );

View File

@ -172,7 +172,6 @@ public:
virtual LLVector3 getCharacterVelocity();
virtual LLVector3 getCharacterAngularVelocity();
virtual LLJoint* getCharacterJoint(U32 num);
virtual BOOL allocateCharacterJoints(U32 num);
virtual LLUUID remapMotionID(const LLUUID& id);
virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
@ -184,7 +183,6 @@ public:
void dumpAnimationState();
virtual LLJoint* getJoint(const std::string &name);
virtual LLJoint* getRootJoint() { return mRoot; }
void resetJointPositions( void );
void resetJointPositionsToDefault( void );
@ -341,6 +339,10 @@ protected:
** SKELETON
**/
protected:
/*virtual*/ LLAvatarJoint* createAvatarJoint(); // Returns LLViewerJoint
/*virtual*/ LLAvatarJoint* createAvatarJoint(S32 joint_num); // Returns LLViewerJoint
/*virtual*/ LLAvatarJointMesh* createAvatarJointMesh(); // Returns LLViewerJointMesh
public:
void updateHeadOffset();
void setPelvisOffset( bool hasOffset, const LLVector3& translation, F32 offset ) ;
@ -521,6 +523,7 @@ public:
// Baked textures
//--------------------------------------------------------------------
public:
/*virtual*/ LLTexLayerSet* createTexLayerSet(); // Return LLViewerTexLayerSet
void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY !
protected:
static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);

View File

@ -249,8 +249,6 @@ BOOL LLVOAvatarSelf::loadAvatarSelf()
llwarns << "avatar file: buildSkeleton() failed" << llendl;
return FALSE;
}
// TODO: make loadLayersets() called only by self.
//success &= loadLayersets();
return success;
}
@ -585,70 +583,6 @@ LLVOAvatarSelf::~LLVOAvatarSelf()
** **
*********************************************************************************/
//virtual
BOOL LLVOAvatarSelf::loadLayersets()
{
BOOL success = TRUE;
for (LLAvatarXmlInfo::layer_info_list_t::const_iterator iter = sAvatarXmlInfo->mLayerInfoList.begin();
iter != sAvatarXmlInfo->mLayerInfoList.end();
++iter)
{
// Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
const LLTexLayerSetInfo *info = *iter;
LLViewerTexLayerSet* layer_set = new LLViewerTexLayerSet( this );
if (!layer_set->setInfo(info))
{
stop_glerror();
delete layer_set;
llwarns << "avatar file: layer_set->parseData() failed" << llendl;
return FALSE;
}
// scan baked textures and associate the layerset with the appropriate one
EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
if (layer_set->isBodyRegion(baked_dict->mName))
{
baked_index = baked_iter->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)
{
llwarns << "<layer_set> has invalid body_region attribute" << llendl;
delete layer_set;
return FALSE;
}
// scan morph masks and let any affected layers know they have an associated morph
for (LLVOAvatar::morph_list_t::const_iterator morph_iter = mBakedTextureDatas[baked_index].mMaskedMorphs.begin();
morph_iter != mBakedTextureDatas[baked_index].mMaskedMorphs.end();
++morph_iter)
{
LLMaskedMorph *morph = *morph_iter;
LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer);
if (layer)
{
layer->setHasMorph(TRUE);
}
else
{
llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << llendl;
success = FALSE;
}
}
}
return success;
}
// virtual
BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent)
{

View File

@ -69,7 +69,6 @@ protected:
BOOL loadAvatarSelf();
BOOL buildSkeletonSelf(const LLAvatarSkeletonInfo *info);
BOOL buildMenus();
/*virtual*/ BOOL loadLayersets();
/** Initialization
** **