Skip to content
Snippets Groups Projects
Commit 4b663c9c authored by Drake Arconis's avatar Drake Arconis
Browse files

Some form of baking. It scares me.

parent 8b3b7b20
No related branches found
No related tags found
No related merge requests found
Showing
with 439 additions and 92 deletions
......@@ -491,6 +491,7 @@ void LLAvatarAppearance::computeBodySize()
if (new_body_size != mBodySize || old_offset != mAvatarOffset.mV[VZ])
{
mBodySize = new_body_size;
bodySizeChanged();
}
}
......@@ -1394,14 +1395,14 @@ BOOL LLAvatarAppearance::teToColorParams( ETextureIndex te, U32 *param_name )
return TRUE;
}
void LLAvatarAppearance::setClothesColor( ETextureIndex te, const LLColor4& new_color)
void LLAvatarAppearance::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL upload_bake )
{
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]);
setVisualParamWeight( param_name[0], new_color.mV[VX], upload_bake );
setVisualParamWeight( param_name[1], new_color.mV[VY], upload_bake );
setVisualParamWeight( param_name[2], new_color.mV[VZ], upload_bake );
}
}
......
......@@ -109,6 +109,7 @@ public:
public:
virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
virtual BOOL isValid() const;
virtual BOOL isUsingServerBakes() const = 0;
virtual BOOL isUsingLocalAppearance() const = 0;
virtual BOOL isEditingAppearance() const = 0;
......@@ -145,6 +146,7 @@ protected:
static BOOL parseSkeletonFile(const std::string& filename);
virtual void buildCharacter();
virtual BOOL loadAvatar();
virtual void bodySizeChanged() = 0;
BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &current_volume_num, S32 &current_joint_num);
BOOL allocateCharacterJoints(U32 num);
......@@ -231,7 +233,7 @@ public:
// Composites
//--------------------------------------------------------------------
public:
virtual void invalidateComposite(LLTexLayerSet* layerset) = 0;
virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result) = 0;
/********************************************************************************
** **
......@@ -262,7 +264,7 @@ protected:
// Clothing colors (convenience functions to access visual parameters)
//--------------------------------------------------------------------
public:
void setClothesColor(LLAvatarAppearanceDefines::ETextureIndex te, const LLColor4& new_color);
void setClothesColor(LLAvatarAppearanceDefines::ETextureIndex te, const LLColor4& new_color, BOOL upload_bake);
LLColor4 getClothesColor(LLAvatarAppearanceDefines::ETextureIndex te);
static BOOL teToColorParams(LLAvatarAppearanceDefines::ETextureIndex te, U32 *param_name);
......@@ -271,7 +273,7 @@ public:
//--------------------------------------------------------------------
public:
LLColor4 getGlobalColor(const std::string& color_name ) const;
virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color) = 0;
virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake) = 0;
protected:
LLTexGlobalColor* mTexSkinColor;
LLTexGlobalColor* mTexHairColor;
......
......@@ -190,7 +190,7 @@ BOOL LLDriverParam::setInfo(LLDriverParamInfo *info)
mID = info->mID;
info->mDriverParam = this;
setWeight(getDefaultWeight());
setWeight(getDefaultWeight(), FALSE );
return TRUE;
}
......@@ -201,7 +201,7 @@ BOOL LLDriverParam::setInfo(LLDriverParamInfo *info)
return new LLDriverParam(*this);
}
void LLDriverParam::setWeight(F32 weight)
void LLDriverParam::setWeight(F32 weight, BOOL upload_bake)
{
F32 min_weight = getMinWeight();
F32 max_weight = getMaxWeight();
......@@ -260,7 +260,7 @@ void LLDriverParam::setWeight(F32 weight)
driven_weight = driven_min;
}
setDrivenWeight(driven,driven_weight);
setDrivenWeight(driven,driven_weight,upload_bake);
continue;
}
else
......@@ -284,13 +284,13 @@ void LLDriverParam::setWeight(F32 weight)
driven_weight = driven_min;
}
setDrivenWeight(driven,driven_weight);
setDrivenWeight(driven,driven_weight,upload_bake);
continue;
}
}
driven_weight = getDrivenWeight(driven, mCurWeight);
setDrivenWeight(driven,driven_weight);
setDrivenWeight(driven,driven_weight, upload_bake);
}
}
......@@ -436,9 +436,9 @@ const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const
//-----------------------------------------------------------------------------
// setAnimationTarget()
//-----------------------------------------------------------------------------
void LLDriverParam::setAnimationTarget( F32 target_value)
void LLDriverParam::setAnimationTarget( F32 target_value, BOOL upload_bake )
{
LLVisualParam::setAnimationTarget(target_value);
LLVisualParam::setAnimationTarget(target_value, upload_bake);
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
{
......@@ -447,16 +447,16 @@ void LLDriverParam::setAnimationTarget( F32 target_value)
// 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
driven->mParam->setAnimationTarget(driven_weight);
driven->mParam->setAnimationTarget(driven_weight, upload_bake);
}
}
//-----------------------------------------------------------------------------
// stopAnimating()
//-----------------------------------------------------------------------------
void LLDriverParam::stopAnimating()
void LLDriverParam::stopAnimating(BOOL upload_bake)
{
LLVisualParam::stopAnimating();
LLVisualParam::stopAnimating(upload_bake);
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
{
......@@ -536,7 +536,7 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
LLWearable *wearable = mAvatarAppearance->getWearableData()->getTopWearable(driver_type);
if (wearable)
{
wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID));
wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID), false);
}
}
}
......@@ -599,7 +599,7 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight
return driven_weight;
}
void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight)
void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
{
bool use_self = false;
if(mWearablep &&
......@@ -616,10 +616,10 @@ void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight)
if (use_self)
{
// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
mAvatarAppearance->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight);
mAvatarAppearance->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake);
}
else
{
driven->mParam->setWeight( driven_weight);
driven->mParam->setWeight( driven_weight, upload_bake);
}
}
......@@ -111,9 +111,9 @@ public:
// 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*/ void setWeight(F32 weight, BOOL upload_bake) override;
/*virtual*/ void setAnimationTarget( F32 target_value, BOOL upload_bake) override;
/*virtual*/ void stopAnimating(BOOL upload_bake) override;
/*virtual*/ BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params);
/*virtual*/ void resetDrivenParams();
......@@ -131,7 +131,7 @@ public:
protected:
LLDriverParam(const LLDriverParam& pOther);
F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);
void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight);
void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
LL_ALIGN_16(LLVector4a mDefaultVec); // temp holder
......
......@@ -358,7 +358,7 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
return FALSE;
mInfo = info;
mID = info->mID;
setWeight(getDefaultWeight());
setWeight(getDefaultWeight(), FALSE);
LLAvatarAppearance* avatarp = mMesh->getAvatar();
LLPolyMorphTargetInfo::volume_info_list_t::iterator iter;
......
......@@ -139,7 +139,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
return FALSE;
mInfo = info;
mID = info->mID;
setWeight(getDefaultWeight());
setWeight(getDefaultWeight(), FALSE);
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
......
......@@ -117,9 +117,9 @@ LLTexParamGlobalColor::~LLTexParamGlobalColor()
return new LLTexParamGlobalColor(*this);
}
void LLTexParamGlobalColor::onGlobalColorChanged()
void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake)
{
mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor);
mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor, upload_bake);
}
//-----------------------------------------------------------------------------
......
......@@ -77,7 +77,7 @@ public:
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
protected:
LLTexParamGlobalColor(const LLTexParamGlobalColor& pOther);
/*virtual*/ void onGlobalColorChanged();
/*virtual*/ void onGlobalColorChanged(bool upload_bake) override;
private:
LLTexGlobalColor* mTexGlobalColor;
};
......
......@@ -183,7 +183,7 @@ BOOL LLTexLayerParamAlpha::getMultiplyBlend() const
return ((LLTexLayerParamAlphaInfo *)getInfo())->mMultiplyBlend;
}
void LLTexLayerParamAlpha::setWeight(F32 weight)
void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
{
if (mIsAnimating || mTexLayer == NULL)
{
......@@ -201,35 +201,36 @@ void LLTexLayerParamAlpha::setWeight(F32 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());
mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
mTexLayer->invalidateMorphMasks();
}
}
}
void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value)
void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value, BOOL upload_bake)
{
// do not animate dummy parameters
if (mIsDummy)
{
setWeight(target_value);
setWeight(target_value, upload_bake);
return;
}
mTargetWeight = target_value;
setWeight(target_value);
setWeight(target_value, upload_bake);
mIsAnimating = TRUE;
if (mNext)
{
mNext->setAnimationTarget(target_value);
mNext->setAnimationTarget(target_value, upload_bake);
}
}
void LLTexLayerParamAlpha::animate(F32 delta)
void LLTexLayerParamAlpha::animate(F32 delta, BOOL upload_bake)
{
if (mNext)
{
mNext->animate(delta);
mNext->animate(delta, upload_bake);
}
}
......@@ -477,7 +478,7 @@ LLColor4 LLTexLayerParamColor::getNetColor() const
}
void LLTexLayerParamColor::setWeight(F32 weight)
void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake)
{
if (mIsAnimating)
{
......@@ -503,10 +504,10 @@ void LLTexLayerParamColor::setWeight(F32 weight)
if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
{
onGlobalColorChanged();
onGlobalColorChanged(upload_bake);
if (mTexLayer)
{
mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet());
mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
}
}
......@@ -514,23 +515,23 @@ void LLTexLayerParamColor::setWeight(F32 weight)
}
}
void LLTexLayerParamColor::setAnimationTarget(F32 target_value)
void LLTexLayerParamColor::setAnimationTarget(F32 target_value, BOOL upload_bake)
{
// set value first then set interpolating flag to ignore further updates
mTargetWeight = target_value;
setWeight(target_value);
setWeight(target_value, upload_bake);
mIsAnimating = TRUE;
if (mNext)
{
mNext->setAnimationTarget(target_value);
mNext->setAnimationTarget(target_value, upload_bake);
}
}
void LLTexLayerParamColor::animate(F32 delta)
void LLTexLayerParamColor::animate(F32 delta, BOOL upload_bake)
{
if (mNext)
{
mNext->animate(delta);
mNext->animate(delta, upload_bake);
}
}
......
......@@ -85,10 +85,9 @@ public:
// 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);
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake) override;
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake) override;
/*virtual*/ void animate(F32 delta, BOOL upload_bake) override;
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
/*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; }
......@@ -178,9 +177,9 @@ public:
// 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);
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake) override;
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake) override;
/*virtual*/ void animate(F32 delta, BOOL upload_bake) override;
// LLViewerVisualParam Virtual functions
......@@ -196,7 +195,7 @@ public:
protected:
LLTexLayerParamColor(const LLTexLayerParamColor& pOther);
virtual void onGlobalColorChanged() {}
virtual void onGlobalColorChanged(bool upload_bake) {}
private:
LL_ALIGN_16(LLVector4a mAvgDistortionVec);
} LL_ALIGN_POSTFIX(16);
......
......@@ -153,7 +153,7 @@ BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info)
return FALSE;
mInfo = info;
mID = info->mID;
setWeight(getDefaultWeight());
setWeight(getDefaultWeight(), FALSE);
return TRUE;
}
......
......@@ -549,7 +549,7 @@ void LLWearable::revertValues()
LLVisualParam *param = getVisualParam(id);
if(param && !dynamic_cast<LLDriverParam*>(param) )
{
setVisualParamWeight(id, value);
setVisualParamWeight(id, value, TRUE);
}
}
......@@ -561,7 +561,7 @@ void LLWearable::revertValues()
LLVisualParam *param = getVisualParam(id);
if(param && dynamic_cast<LLDriverParam*>(param) )
{
setVisualParamWeight(id, value);
setVisualParamWeight(id, value, TRUE);
}
}
......@@ -664,12 +664,12 @@ void LLWearable::addVisualParam(LLVisualParam *param)
}
void LLWearable::setVisualParamWeight(S32 param_index, F32 value)
void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL upload_bake)
{
if( is_in_map(mVisualParamIndexMap, param_index ) )
{
LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
wearable_param->setWeight(value);
wearable_param->setWeight(value, upload_bake);
}
else
{
......@@ -713,14 +713,14 @@ void LLWearable::getVisualParams(visual_param_vec_t &list)
}
}
void LLWearable::animateParams(F32 delta)
void LLWearable::animateParams(F32 delta, BOOL upload_bake)
{
for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
iter != mVisualParamIndexMap.end();
++iter)
{
LLVisualParam *param = (LLVisualParam*) iter->second;
param->animate(delta);
param->animate(delta, upload_bake);
}
}
......@@ -738,14 +738,14 @@ LLColor4 LLWearable::getClothesColor(S32 te) const
return color;
}
void LLWearable::setClothesColor( S32 te, const LLColor4& new_color)
void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake)
{
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]);
setVisualParamWeight(param_name[index], new_color.mV[index], upload_bake);
}
}
}
......@@ -764,7 +764,7 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
S32 param_id = param->getID();
F32 weight = getVisualParamWeight(param_id);
avatarp->setVisualParamWeight( param_id, weight);
avatarp->setVisualParamWeight( param_id, weight, FALSE);
}
}
#else
......@@ -772,7 +772,7 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
{
LLVisualParam* param = it->second;
if(!((LLViewerVisualParam*)param)->getCrossWearable())
avatarp->setVisualParamWeight( param->getID(), param->getWeight() );
avatarp->setVisualParamWeight( param->getID(), param->getWeight(), FALSE );
}
#endif
}
......
......@@ -96,14 +96,13 @@ public:
void setLocalTextureObject(S32 index, LLLocalTextureObject &lto);
void addVisualParam(LLVisualParam *param);
void setVisualParamWeight(S32 index, F32 value);
void setVisualParamWeight(S32 index, F32 value, BOOL upload_bake);
F32 getVisualParamWeight(S32 index) const;
LLVisualParam* getVisualParam(S32 index) const;
void getVisualParams(visual_param_vec_t &list);
void animateParams(F32 delta);
void animateParams(F32 delta, BOOL upload_bake);
LLColor4 getClothesColor(S32 te) const;
void setClothesColor( S32 te, const LLColor4& new_color);
void setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake);
virtual void revertValues();
virtual void saveValues();
......
......@@ -287,13 +287,13 @@ void LLCharacter::removeAnimationData(std::string name)
//-----------------------------------------------------------------------------
// setVisualParamWeight()
//-----------------------------------------------------------------------------
BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight)
BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight, BOOL upload_bake)
{
S32 index = which_param->getID();
visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index);
if (index_iter != mVisualParamIndexMap.end())
{
index_iter->second->setWeight(weight);
index_iter->second->setWeight(weight, upload_bake);
return TRUE;
}
return FALSE;
......@@ -302,7 +302,7 @@ BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 wei
//-----------------------------------------------------------------------------
// setVisualParamWeight()
//-----------------------------------------------------------------------------
BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight)
BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake)
{
std::string tname(param_name);
LLStringUtil::toLower(tname);
......@@ -310,7 +310,7 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight)
visual_param_name_map_t::iterator name_iter = mVisualParamNameMap.find(tableptr);
if (name_iter != mVisualParamNameMap.end())
{
name_iter->second->setWeight(weight);
name_iter->second->setWeight(weight, upload_bake);
return TRUE;
}
LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << LL_ENDL;
......@@ -320,12 +320,12 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight)
//-----------------------------------------------------------------------------
// setVisualParamWeight()
//-----------------------------------------------------------------------------
BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight)
BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake)
{
visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index);
if (index_iter != mVisualParamIndexMap.end())
{
index_iter->second->setWeight(weight);
index_iter->second->setWeight(weight, upload_bake);
return TRUE;
}
LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << LL_ENDL;
......@@ -395,7 +395,7 @@ void LLCharacter::clearVisualParamWeights()
{
if (param->isTweakable())
{
param->setWeight( param->getDefaultWeight());
param->setWeight( param->getDefaultWeight(), FALSE);
}
}
}
......
......@@ -194,9 +194,10 @@ public:
void addVisualParam(LLVisualParam *param);
void addSharedVisualParam(LLVisualParam *param);
virtual BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight);
virtual BOOL setVisualParamWeight(const char* param_name, F32 weight);
virtual BOOL setVisualParamWeight(S32 index, F32 weight);
virtual BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
virtual BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE );
virtual BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE );
// get visual param weight by param or name
F32 getVisualParamWeight(LLVisualParam *distortion);
......
......@@ -236,7 +236,7 @@ BOOL LLVisualParam::parseData(LLXmlTreeNode *node)
//-----------------------------------------------------------------------------
// setWeight()
//-----------------------------------------------------------------------------
void LLVisualParam::setWeight(F32 weight)
void LLVisualParam::setWeight(F32 weight, BOOL upload_bake)
{
if (mIsAnimating)
{
......@@ -254,19 +254,19 @@ void LLVisualParam::setWeight(F32 weight)
if (mNext)
{
mNext->setWeight(weight);
mNext->setWeight(weight, upload_bake);
}
}
//-----------------------------------------------------------------------------
// setAnimationTarget()
//-----------------------------------------------------------------------------
void LLVisualParam::setAnimationTarget(F32 target_value)
void LLVisualParam::setAnimationTarget(F32 target_value, BOOL upload_bake)
{
// don't animate dummy parameters
if (mIsDummy)
{
setWeight(target_value);
setWeight(target_value, upload_bake);
mTargetWeight = mCurWeight;
return;
}
......@@ -286,7 +286,7 @@ void LLVisualParam::setAnimationTarget(F32 target_value)
if (mNext)
{
mNext->setAnimationTarget(target_value);
mNext->setAnimationTarget(target_value, upload_bake);
}
}
......@@ -311,24 +311,24 @@ void LLVisualParam::clearNextParam()
//-----------------------------------------------------------------------------
// animate()
//-----------------------------------------------------------------------------
void LLVisualParam::animate( F32 delta)
void LLVisualParam::animate( F32 delta, BOOL upload_bake)
{
if (mIsAnimating)
{
F32 new_weight = ((mTargetWeight - mCurWeight) * delta) + mCurWeight;
setWeight(new_weight);
setWeight(new_weight, upload_bake);
}
}
//-----------------------------------------------------------------------------
// stopAnimating()
//-----------------------------------------------------------------------------
void LLVisualParam::stopAnimating()
void LLVisualParam::stopAnimating(BOOL upload_bake)
{
if (mIsAnimating && isTweakable())
{
mIsAnimating = FALSE;
setWeight(mTargetWeight);
setWeight(mTargetWeight, upload_bake);
}
}
......
......@@ -132,10 +132,10 @@ public:
//virtual BOOL parseData( LLXmlTreeNode *node ) = 0;
virtual void apply( ESex avatar_sex ) = 0;
// Default functions
virtual void setWeight(F32 weight);
virtual void setAnimationTarget( F32 target_value);
virtual void animate(F32 delta);
virtual void stopAnimating();
virtual void setWeight(F32 weight, BOOL upload_bake);
virtual void setAnimationTarget( F32 target_value, BOOL upload_bake);
virtual void animate(F32 delta, BOOL upload_bake);
virtual void stopAnimating(BOOL upload_bake);
virtual BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params);
virtual void resetDrivenParams();
......
......@@ -133,6 +133,7 @@ set(viewer_SOURCE_FILES
llagentpilot.cpp
llagentui.cpp
llagentwearables.cpp
llagentwearablesfetch.cpp
llaisapi.cpp
llanimstatelabels.cpp
llappcorehttp.cpp
......@@ -772,6 +773,7 @@ set(viewer_HEADER_FILES
llagentpilot.h
llagentui.h
llagentwearables.h
llagentwearablesfetch.h
llaisapi.h
llanimstatelabels.h
llappcorehttp.h
......
......@@ -429,6 +429,7 @@ LLAgent::LLAgent() :
mVoiceConnected(false),
mAppearanceSerialNum(0),
mMouselookModeInSignal(NULL),
mMouselookModeOutSignal(NULL)
{
......@@ -834,6 +835,29 @@ void LLAgent::standUp()
setControlFlags(AGENT_CONTROL_STAND_UP);
}
void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id)
{
LL_INFOS() << "called" << LL_ENDL;
// Old-style appearance entering a server-bake region.
if (isAgentAvatarValid() &&
!gAgentAvatarp->isUsingServerBakes() &&
(mRegionp->getCentralBakeVersion()>0))
{
LL_INFOS() << "update requested due to region transition" << LL_ENDL;
LLAppearanceMgr::instance().requestServerAppearanceUpdate();
}
// new-style appearance entering a non-bake region,
// need to check for existence of the baking service.
else if (isAgentAvatarValid() &&
gAgentAvatarp->isUsingServerBakes() &&
mRegionp->getCentralBakeVersion()==0)
{
gAgentAvatarp->checkForUnsupportedServerBakeAppearance();
}
}
void LLAgent::changeParcels()
{
LL_DEBUGS("AgentLocation") << "Calling ParcelChanged callbacks" << LL_ENDL;
......@@ -929,6 +953,19 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
LLFloaterMove::sUpdateFlyingStatus();
// If the newly entered region is using server bakes, and our
// current appearance is non-baked, request appearance update from
// server.
if (mRegionp->capabilitiesReceived())
{
handleServerBakeRegionTransition(mRegionp->getRegionID());
}
else
{
// Need to handle via callback after caps arrive.
mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::handleServerBakeRegionTransition,this,_1));
}
LL_DEBUGS("AgentLocation") << "Calling RegionChanged callbacks" << LL_ENDL;
mRegionChangedSignal();
}
......@@ -3707,6 +3744,82 @@ void LLAgent::processControlRelease(LLMessageSystem *msg, void **)
}
*/
//static
void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void **user_data)
{
gAgentQueryManager.mNumPendingQueries--;
if (gAgentQueryManager.mNumPendingQueries == 0)
{
selfStopPhase("fetch_texture_cache_entries");
}
if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
{
LL_WARNS() << "No avatar for user in cached texture update!" << LL_ENDL;
return;
}
if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance())
{
// ignore baked textures when in customize mode
return;
}
S32 query_id;
mesgsys->getS32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, query_id);
S32 num_texture_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_WearableData);
S32 num_results = 0;
for (S32 texture_block = 0; texture_block < num_texture_blocks; texture_block++)
{
LLUUID texture_id;
U8 texture_index;
mesgsys->getUUIDFast(_PREHASH_WearableData, _PREHASH_TextureID, texture_id, texture_block);
mesgsys->getU8Fast(_PREHASH_WearableData, _PREHASH_TextureIndex, texture_index, texture_block);
if ((S32)texture_index < TEX_NUM_INDICES )
{
const LLAvatarAppearanceDictionary::TextureEntry *texture_entry = LLAvatarAppearanceDictionary::instance().getTexture((ETextureIndex)texture_index);
if (texture_entry)
{
EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
if (gAgentQueryManager.mActiveCacheQueries[baked_index] == query_id)
{
if (texture_id.notNull())
{
//LL_INFOS() << "Received cached texture " << (U32)texture_index << ": " << texture_id << LL_ENDL;
gAgentAvatarp->setCachedBakedTexture((ETextureIndex)texture_index, texture_id);
//gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
gAgentQueryManager.mActiveCacheQueries[baked_index] = 0;
num_results++;
}
else
{
// no cache of this bake. request upload.
gAgentAvatarp->invalidateComposite(gAgentAvatarp->getLayerSet(baked_index),TRUE);
}
}
}
}
}
LL_INFOS() << "Received cached texture response for " << num_results << " textures." << LL_ENDL;
gAgentAvatarp->outputRezTiming("Fetched agent wearables textures from cache. Will now load them");
gAgentAvatarp->updateMeshTextures();
if (gAgentQueryManager.mNumPendingQueries == 0)
{
// RN: not sure why composites are disabled at this point
gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
gAgent.sendAgentSetAppearance();
}
}
BOOL LLAgent::anyControlGrabbed() const
{
for (U32 i = 0; i < TOTAL_CONTROLS; i++)
......@@ -4326,6 +4439,193 @@ void LLAgent::requestLeaveGodMode()
sendReliableMessage();
}
// For debugging, trace agent state at times appearance message are sent out.
void LLAgent::dumpSentAppearance(const std::string& dump_prefix)
{
std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml");
LLAPRFile outfile;
std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
outfile.open(fullpath, LL_APR_WB );
apr_file_t* file = outfile.getFileHandle();
if (!file)
{
return;
}
else
{
LL_DEBUGS("Avatar") << "dumping sent appearance message to " << fullpath << LL_ENDL;
}
LLVisualParam* appearance_version_param = gAgentAvatarp->getVisualParam(11000);
if (appearance_version_param)
{
F32 value = appearance_version_param->getWeight();
dump_visual_param(file, appearance_version_param, value);
}
for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (texture_dict->mIsBakedTexture)
{
LLTextureEntry* entry = gAgentAvatarp->getTE((U8) index);
const LLUUID& uuid = entry->getID();
apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", index, uuid.asString().c_str());
}
}
}
//-----------------------------------------------------------------------------
// sendAgentSetAppearance()
//-----------------------------------------------------------------------------
void LLAgent::sendAgentSetAppearance()
{
if (gAgentQueryManager.mNumPendingQueries > 0)
{
return;
}
if (!isAgentAvatarValid() || gAgentAvatarp->isEditingAppearance() || (getRegion() && getRegion()->getCentralBakeVersion())) return;
// At this point we have a complete appearance to send and are in a non-baking region.
// DRANO FIXME
//gAgentAvatarp->setIsUsingServerBakes(FALSE);
S32 sb_count, host_count, both_count, neither_count;
gAgentAvatarp->bakedTextureOriginCounts(sb_count, host_count, both_count, neither_count);
if (both_count != 0 || neither_count != 0)
{
LL_WARNS() << "bad bake texture state " << sb_count << "," << host_count << "," << both_count << "," << neither_count << LL_ENDL;
}
if (sb_count != 0 && host_count == 0)
{
gAgentAvatarp->setIsUsingServerBakes(true);
}
else if (sb_count == 0 && host_count != 0)
{
gAgentAvatarp->setIsUsingServerBakes(false);
}
else if (sb_count + host_count > 0)
{
LL_WARNS() << "unclear baked texture state, not sending appearance" << LL_ENDL;
return;
}
LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << LL_ENDL;
//dumpAvatarTEs( "sendAgentSetAppearance()" );
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_AgentSetAppearance);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, getID());
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
// correct for the collision tolerance (to make it look like the
// agent is actually walking on the ground/object)
// NOTE -- when we start correcting all of the other Havok geometry
// to compensate for the COLLISION_TOLERANCE ugliness we will have
// to tweak this number again
const LLVector3 body_size = gAgentAvatarp->mBodySize + gAgentAvatarp->mAvatarOffset;
msg->addVector3Fast(_PREHASH_Size, body_size);
// To guard against out of order packets
// Note: always start by sending 1. This resets the server's count. 0 on the server means "uninitialized"
mAppearanceSerialNum++;
msg->addU32Fast(_PREHASH_SerialNum, mAppearanceSerialNum );
// is texture data current relative to wearables?
// KLW - TAT this will probably need to check the local queue.
BOOL textures_current = gAgentAvatarp->areTexturesCurrent();
for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
{
const ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
// if we're not wearing a skirt, we don't need the texture to be baked
if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
{
continue;
}
// IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures
if (!gAgentAvatarp->isTextureDefined(texture_index, 0))
{
LL_DEBUGS("Avatar") << "texture not current for baked " << (S32)baked_index << " local " << (S32)texture_index << LL_ENDL;
textures_current = FALSE;
break;
}
}
// only update cache entries if we have all our baked textures
// FIXME DRANO need additional check for not in appearance editing
// mode, if still using local composites need to set using local
// composites to false, and update mesh textures.
if (textures_current)
{
bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage");
std::string dump_prefix = gAgentAvatarp->getFullname() + "_sent_appearance";
if (enable_verbose_dumps)
{
dumpSentAppearance(dump_prefix);
}
LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sending cached texture data" << LL_ENDL;
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
BOOL generate_valid_hash = TRUE;
if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLAvatarAppearanceDefines::EBakedTextureIndex)baked_index))
{
generate_valid_hash = FALSE;
LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Not caching baked texture upload for " << (U32)baked_index << " due to being uploaded at low resolution." << LL_ENDL;
}
const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash);
if (hash.notNull())
{
ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
msg->nextBlockFast(_PREHASH_WearableData);
msg->addUUIDFast(_PREHASH_CacheID, hash);
msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
}
}
msg->nextBlockFast(_PREHASH_ObjectData);
gAgentAvatarp->sendAppearanceMessage( gMessageSystem );
}
else
{
// If the textures aren't baked, send NULL for texture IDs
// This means the baked texture IDs on the server will be untouched.
// Once all textures are baked, another AvatarAppearance message will be sent to update the TEs
msg->nextBlockFast(_PREHASH_ObjectData);
gMessageSystem->addBinaryDataFast(_PREHASH_TextureEntry, NULL, 0);
}
S32 transmitted_params = 0;
for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*)gAgentAvatarp->getNextVisualParam())
{
if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ||
param->getGroup() == VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE) // do not transmit params of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
{
msg->nextBlockFast(_PREHASH_VisualParam );
// We don't send the param ids. Instead, we assume that the receiver has the same params in the same sequence.
const F32 param_value = param->getWeight();
const U8 new_weight = F32_to_U8(param_value, param->getMinWeight(), param->getMaxWeight());
msg->addU8Fast(_PREHASH_ParamValue, new_weight );
transmitted_params++;
}
}
LL_INFOS() << "Avatar XML num VisualParams transmitted = " << transmitted_params << LL_ENDL;
sendReliableMessage();
}
void LLAgent::sendAgentDataUpdateRequest()
{
gMessageSystem->newMessageFast(_PREHASH_AgentDataUpdateRequest);
......@@ -4468,6 +4768,23 @@ void LLAgent::renderAutoPilotTarget()
/********************************************************************************/
LLAgentQueryManager gAgentQueryManager;
LLAgentQueryManager::LLAgentQueryManager() :
mWearablesCacheQueryID(0),
mNumPendingQueries(0),
mUpdateSerialNum(0)
{
for (U32 i = 0; i < BAKED_NUM_INDICES; i++)
{
mActiveCacheQueries[i] = 0;
}
}
LLAgentQueryManager::~LLAgentQueryManager()
{
}
//-----------------------------------------------------------------------------
// LLTeleportRequest
//-----------------------------------------------------------------------------
......
......@@ -672,6 +672,7 @@ private:
void handleTeleportFinished();
void handleTeleportFailed();
void handleServerBakeRegionTransition(const LLUUID& region_id);
//--------------------------------------------------------------------
// Teleport State
......@@ -806,6 +807,7 @@ public:
private:
BOOL mShowAvatar; // Should we render the avatar?
U32 mAppearanceSerialNum;
//--------------------------------------------------------------------
// Rendering state bitmap helpers
......@@ -906,6 +908,8 @@ private:
public:
void sendMessage(); // Send message to this agent's region
void sendReliableMessage();
void dumpSentAppearance(const std::string& dump_prefix);
void sendAgentSetAppearance();
void sendAgentDataUpdateRequest();
void sendAgentUserInfoRequest();
// IM to Email and Online visibility
......@@ -919,6 +923,7 @@ public:
static void processAgentGroupDataUpdate(LLMessageSystem *msg, void **);
static void processAgentDropGroup(LLMessageSystem *msg, void **);
static void processScriptControlChange(LLMessageSystem *msg, void **);
static void processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void **user_data);
/** Messaging
** **
......@@ -947,4 +952,24 @@ inline bool operator==(const LLGroupData &a, const LLGroupData &b)
return (a.mID == b.mID);
}
class LLAgentQueryManager
{
friend class LLAgent;
friend class LLAgentWearables;
public:
LLAgentQueryManager();
virtual ~LLAgentQueryManager();
BOOL hasNoPendingQueries() const { return getNumPendingQueries() == 0; }
S32 getNumPendingQueries() const { return mNumPendingQueries; }
private:
S32 mNumPendingQueries;
S32 mWearablesCacheQueryID;
U32 mUpdateSerialNum;
S32 mActiveCacheQueries[LLAvatarAppearanceDefines::BAKED_NUM_INDICES];
};
extern LLAgentQueryManager gAgentQueryManager;
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment