Commit e61f485a authored by unknown's avatar unknown
Browse files

Merge branch 'master' of https://bitbucket.org/lindenlab/viewer into DRTVWR-519

parents d2656791 00c47d07
......@@ -30,7 +30,6 @@
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 1024;
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 1024;
const S32 LLAvatarAppearanceDefines::IMPOSTOR_PERIOD = 2;
using namespace LLAvatarAppearanceDefines;
......
......@@ -39,7 +39,6 @@ namespace LLAvatarAppearanceDefines
extern const S32 SCRATCH_TEX_WIDTH;
extern const S32 SCRATCH_TEX_HEIGHT;
extern const S32 IMPOSTOR_PERIOD;
static const U32 AVATAR_HOVER = 11001;
......
......@@ -78,6 +78,24 @@ void LLControlAvatar::initInstance()
mInitFlags |= 1<<4;
}
const LLVOAvatar *LLControlAvatar::getAttachedAvatar() const
{
if (mRootVolp && mRootVolp->isAttachment())
{
return mRootVolp->getAvatarAncestor();
}
return NULL;
}
LLVOAvatar *LLControlAvatar::getAttachedAvatar()
{
if (mRootVolp && mRootVolp->isAttachment())
{
return mRootVolp->getAvatarAncestor();
}
return NULL;
}
void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const
{
......@@ -165,7 +183,7 @@ void LLControlAvatar::matchVolumeTransform()
if (mRootVolp->isAttachment())
{
LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor();
LLVOAvatar *attached_av = getAttachedAvatar();
if (attached_av)
{
LLViewerJointAttachment *attach = attached_av->getTargetAttachmentPoint(mRootVolp);
......@@ -360,7 +378,34 @@ void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time)
}
}
BOOL LLControlAvatar::updateCharacter(LLAgent &agent)
bool LLControlAvatar::computeNeedsUpdate()
{
computeUpdatePeriod();
// Animesh attachments are a special case. Should have the same update cadence as their attached parent avatar.
LLVOAvatar *attached_av = getAttachedAvatar();
if (attached_av)
{
// Have to run computeNeedsUpdate() for attached av in
// case it hasn't run updateCharacter() already this
// frame. Note this means that the attached av will
// run computeNeedsUpdate() multiple times per frame
// if it has animesh attachments. Results will be
// consistent except for the corner case of exceeding
// MAX_IMPOSTOR_INTERVAL in one call but not another,
// which should be rare.
attached_av->computeNeedsUpdate();
mNeedsImpostorUpdate = attached_av->mNeedsImpostorUpdate;
if (mNeedsImpostorUpdate)
{
mLastImpostorUpdateReason = 12;
}
return mNeedsImpostorUpdate;
}
return LLVOAvatar::computeNeedsUpdate();
}
bool LLControlAvatar::updateCharacter(LLAgent &agent)
{
return LLVOAvatar::updateCharacter(agent);
}
......@@ -634,29 +679,23 @@ std::string LLControlAvatar::getFullname() const
// virtual
bool LLControlAvatar::shouldRenderRigged() const
{
if (mRootVolp && mRootVolp->isAttachment())
{
LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor();
if (attached_av)
{
return attached_av->shouldRenderRigged();
}
}
const LLVOAvatar *attached_av = getAttachedAvatar();
if (attached_av)
{
return attached_av->shouldRenderRigged();
}
return true;
}
// virtual
BOOL LLControlAvatar::isImpostor()
{
if (mRootVolp && mRootVolp->isAttachment())
{
// Attached animated objects should match state of their attached av.
LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor();
if (attached_av)
{
return attached_av->isImpostor();
}
}
// Attached animated objects should match state of their attached av.
LLVOAvatar *attached_av = getAttachedAvatar();
if (attached_av)
{
return attached_av->isImpostor();
}
return LLVOAvatar::isImpostor();
}
......
......@@ -40,6 +40,10 @@ class LLControlAvatar:
virtual void initInstance(); // Called after construction to initialize the class.
virtual ~LLControlAvatar();
// If this is an attachment, return the avatar it is attached to. Otherwise NULL.
virtual const LLVOAvatar *getAttachedAvatar() const;
virtual LLVOAvatar *getAttachedAvatar();
void getNewConstraintFixups(LLVector3& new_pos_constraint, F32& new_scale_constraint) const;
void matchVolumeTransform();
void updateVolumeGeom();
......@@ -53,7 +57,8 @@ class LLControlAvatar:
void markForDeath();
virtual void idleUpdate(LLAgent &agent, const F64 &time);
virtual BOOL updateCharacter(LLAgent &agent);
virtual bool computeNeedsUpdate();
virtual bool updateCharacter(LLAgent &agent);
void getAnimatedVolumes(std::vector<LLVOVolume*>& volumes);
void updateAnimations();
......
......@@ -1485,7 +1485,7 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>*
LLVOAvatar* avatarp = (LLVOAvatar*) objparent;
if (avatarp->isVisible())
{
impostor = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isImpostor();
impostor = objparent->isAvatar() && !LLPipeline::sImpostorRender && ((LLVOAvatar*) objparent)->isImpostor();
loaded = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isFullyLoaded();
}
else
......@@ -1569,7 +1569,8 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)
if (mDrawable->getVObj())
{
if (mDrawable->getVObj()->isAttachment())
// Don't update if we are part of impostor, unles it's an impostor pass
if (!LLPipeline::sImpostorRender && mDrawable->getVObj()->isAttachment())
{
LLDrawable* parent = mDrawable->getParent();
if (parent && parent->getVObj())
......
......@@ -572,12 +572,12 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
{
return;
}
BOOL impostor = avatarp->isImpostor();
if (impostor
&& LLVOAvatar::AV_DO_NOT_RENDER != avatarp->getVisualMuteSettings()
&& LLVOAvatar::AV_ALWAYS_RENDER != avatarp->getVisualMuteSettings())
LLVOAvatar::AvatarOverallAppearance oa = avatarp->getOverallAppearance();
BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor();
if (oa == LLVOAvatar::AOA_INVISIBLE ||
(impostor && oa == LLVOAvatar::AOA_JELLYDOLL))
{
// No shadows for jellydolled or invisible avs.
return;
}
......@@ -1464,7 +1464,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
LLVOAvatar *avatarp;
LLVOAvatar *avatarp = NULL;
if (single_avatar)
{
......@@ -1510,11 +1510,12 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
BOOL impostor = avatarp->isImpostor() && !single_avatar;
BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor() && !single_avatar;
if (( avatarp->isInMuteList()
|| impostor
|| (LLVOAvatar::AV_DO_NOT_RENDER == avatarp->getVisualMuteSettings() && !avatarp->needsImpostorUpdate()) ) && pass != 0)
|| (LLVOAvatar::AOA_NORMAL != avatarp->getOverallAppearance() && !avatarp->needsImpostorUpdate()) ) && pass != 0)
// || (LLVOAvatar::AV_DO_NOT_RENDER == avatarp->getVisualMuteSettings() && !avatarp->needsImpostorUpdate()) ) && pass != 0)
{ //don't draw anything but the impostor for impostored avatars
return;
}
......@@ -1524,6 +1525,13 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
LLVOAvatar *attached_av = avatarp->getAttachedAvatar();
if (attached_av && LLVOAvatar::AOA_NORMAL != attached_av->getOverallAppearance())
{
// Animesh attachment of a jellydolled or invisible parent - don't show
return;
}
if (pass == 0)
{
if (!LLPipeline::sReflectionRender)
......@@ -1531,7 +1539,8 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
LLVOAvatar::sNumVisibleAvatars++;
}
if (impostor || (LLVOAvatar::AV_DO_NOT_RENDER == avatarp->getVisualMuteSettings() && !avatarp->needsImpostorUpdate()))
// if (impostor || (LLVOAvatar::AV_DO_NOT_RENDER == avatarp->getVisualMuteSettings() && !avatarp->needsImpostorUpdate()))
if (impostor || (LLVOAvatar::AOA_NORMAL != avatarp->getOverallAppearance() && !avatarp->needsImpostorUpdate()))
{
if (LLPipeline::sRenderDeferred && !LLPipeline::sReflectionRender && avatarp->mImpostor.isComplete())
{
......
......@@ -1479,7 +1479,7 @@ void LLAvatarComplexityControls::setIndirectMaxNonImpostors()
{
U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors");
// for this one, we just need to make zero, which means off, the max value of the slider
U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::IMPOSTORS_OFF : max_non_impostors;
U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER : max_non_impostors;
gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors);
}
......@@ -1979,7 +1979,7 @@ void LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors()
LLSliderCtrl* ctrl = getChild<LLSliderCtrl>("IndirectMaxNonImpostors",true);
U32 value = ctrl->getValue().asInteger();
if (0 == value || LLVOAvatar::IMPOSTORS_OFF <= value)
if (0 == value || LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER <= value)
{
value=0;
}
......
......@@ -3184,6 +3184,7 @@ class LLObjectMute : public view_listener_t
if (avatar)
{
avatar->mNeedsImpostorUpdate = TRUE;
avatar->mLastImpostorUpdateReason = 9;
id = avatar->getID();
......
......@@ -136,7 +136,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
{
mOwnerAvatarp = find_avatar(mOwnerUUID);
}
if (mOwnerAvatarp.notNull() && LLVOAvatar::AV_DO_NOT_RENDER == mOwnerAvatarp->getVisualMuteSettings())
if (mOwnerAvatarp.notNull() && LLVOAvatar::AOA_NORMAL != mOwnerAvatarp->getOverallAppearance())
{
return;
}
......
This diff is collapsed.
......@@ -91,6 +91,7 @@ class LLVOAvatar :
public:
friend class LLVOAvatarSelf;
friend class LLAvatarCheckImpostorMode;
/********************************************************************************
** **
......@@ -131,6 +132,7 @@ class LLVOAvatar :
public:
/*virtual*/ void updateGL();
/*virtual*/ LLVOAvatar* asAvatar();
virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
void **user_data,
U32 block_num,
......@@ -252,6 +254,11 @@ class LLVOAvatar :
virtual bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user)
virtual bool isUIAvatar() const { return mIsUIAvatar; } // True if this avatar is a supplemental av used in some UI views (no associated user)
// If this is an attachment, return the avatar it is attached to. Otherwise NULL.
virtual const LLVOAvatar *getAttachedAvatar() const { return NULL; }
virtual LLVOAvatar *getAttachedAvatar() { return NULL; }
private: //aligned members
LL_ALIGN_16(LLVector4a mImpostorExtents[2]);
......@@ -262,7 +269,8 @@ class LLVOAvatar :
void updateAppearanceMessageDebugText();
void updateAnimationDebugText();
virtual void updateDebugText();
virtual BOOL updateCharacter(LLAgent &agent);
virtual bool computeNeedsUpdate();
virtual bool updateCharacter(LLAgent &agent);
void updateFootstepSounds();
void computeUpdatePeriod();
void updateOrientation(LLAgent &agent, F32 speed, F32 delta_time);
......@@ -314,12 +322,12 @@ class LLVOAvatar :
public:
static S32 sRenderName;
static BOOL sRenderGroupTitles;
static const U32 IMPOSTORS_OFF; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
* slider in panel_preferences_graphics1.xml */
static U32 sMaxNonImpostors; //(affected by control "RenderAvatarMaxNonImpostors")
static F32 sRenderDistance; //distance at which avatars will render.
static const U32 NON_IMPOSTORS_MAX_SLIDER; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
* slider in panel_preferences_graphics1.xml */
static U32 sMaxNonImpostors; // affected by control "RenderAvatarMaxNonImpostors"
static bool sLimitNonImpostors; // use impostors for far away avatars
static F32 sRenderDistance; // distance at which avatars will render.
static BOOL sShowAnimationDebug; // show animation debug info
static bool sUseImpostors; //use impostors for far away avatars
static BOOL sShowFootPlane; // show foot collision plane reported by server
static BOOL sShowCollisionVolumes; // show skeletal collision volumes
static BOOL sVisibleInFirstPerson;
......@@ -407,6 +415,7 @@ class LLVOAvatar :
void initAttachmentPoints(bool ignore_hud_joints = false);
/*virtual*/ void buildCharacter();
void resetVisualParams();
void applyDefaultParams();
void resetSkeleton(bool reset_animations);
LLVector3 mCurRootToHeadOffset;
......@@ -427,9 +436,12 @@ class LLVOAvatar :
public:
U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0);
bool isVisuallyMuted();
bool isInMuteList();
bool isInMuteList() const;
void forceUpdateVisualMuteSettings();
// Visual Mute Setting is an input. Does not necessarily determine
// what the avatar looks like, because it interacts with other
// settings like muting, complexity threshold. Should be private or protected.
enum VisualMuteSettings
{
AV_RENDER_NORMALLY = 0,
......@@ -437,8 +449,36 @@ class LLVOAvatar :
AV_ALWAYS_RENDER = 2
};
void setVisualMuteSettings(VisualMuteSettings set);
protected:
// If you think you need to access this outside LLVOAvatar, you probably want getOverallAppearance()
VisualMuteSettings getVisualMuteSettings() { return mVisuallyMuteSetting; };
public:
// Overall Appearance is an output. Depending on whether the
// avatar is blocked/muted, whether it exceeds the complexity
// threshold, etc, avatar will want to be displayed in one of
// these ways. Rendering code that wants to know how to display an
// avatar should be looking at this value, NOT the visual mute
// settings
enum AvatarOverallAppearance
{
AOA_NORMAL,
AOA_JELLYDOLL,
AOA_INVISIBLE
};
AvatarOverallAppearance getOverallAppearance() const;
void setOverallAppearanceNormal();
void setOverallAppearanceJellyDoll();
void setOverallAppearanceInvisible();
void updateOverallAppearance();
void updateOverallAppearanceAnimations();
std::set<LLUUID> mJellyAnims;
U32 renderRigid();
U32 renderSkinned();
F32 getLastSkinTime() { return mLastSkinTime; }
......@@ -451,7 +491,8 @@ class LLVOAvatar :
static void restoreGL();
S32 mSpecialRenderMode; // special lighting
private:
private:
AvatarOverallAppearance mOverallAppearance;
F32 mAttachmentSurfaceArea; //estimated surface area of attachments
U32 mAttachmentVisibleTriangleCount;
F32 mAttachmentEstTriangleCount;
......@@ -468,8 +509,8 @@ class LLVOAvatar :
mutable bool mVisualComplexityStale;
U32 mReportedVisualComplexity; // from other viewers through the simulator
bool mCachedInMuteList;
F64 mCachedMuteListUpdateTime;
mutable bool mCachedInMuteList;
mutable F64 mCachedMuteListUpdateTime;
VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV
......@@ -520,7 +561,7 @@ class LLVOAvatar :
//--------------------------------------------------------------------
public:
virtual BOOL isImpostor();
BOOL shouldImpostor(const U32 rank_factor = 1) const;
BOOL shouldImpostor(const F32 rank_factor = 1.0);
BOOL needsImpostorUpdate() const;
const LLVector3& getImpostorOffset() const;
const LLVector2& getImpostorDim() const;
......@@ -531,6 +572,7 @@ class LLVOAvatar :
static void updateImpostors();
LLRenderTarget mImpostor;
BOOL mNeedsImpostorUpdate;
S32 mLastImpostorUpdateReason;
F32SecondsImplicit mLastImpostorUpdateFrameTime;
const LLVector3* getLastAnimExtents() const { return mLastAnimExtents; }
void setNeedsExtentUpdate(bool val) { mNeedsExtentUpdate = val; }
......
......@@ -668,7 +668,7 @@ LLVOAvatarSelf::~LLVOAvatarSelf()
*********************************************************************************/
// virtual
BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent)
bool LLVOAvatarSelf::updateCharacter(LLAgent &agent)
{
// update screen joint size
if (mScreenp)
......
......@@ -116,7 +116,7 @@ class LLVOAvatarSelf :
// Updates
//--------------------------------------------------------------------
public:
/*virtual*/ BOOL updateCharacter(LLAgent &agent);
/*virtual*/ bool updateCharacter(LLAgent &agent);
/*virtual*/ void idleUpdateTractorBeam();
bool checkStuckAppearance();
......
......@@ -3083,9 +3083,10 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
if (vobj) // this test may not be needed, see above
{
LLVOAvatar* av = vobj->asAvatar();
if (av && (av->isImpostor()
|| av->isInMuteList()
|| (LLVOAvatar::AV_DO_NOT_RENDER == av->getVisualMuteSettings() && !av->needsImpostorUpdate()) ))
if (av &&
((!sImpostorRender && av->isImpostor()) //ignore impostor flag during impostor pass
|| av->isInMuteList()
|| (LLVOAvatar::AOA_JELLYDOLL == av->getOverallAppearance() && !av->needsImpostorUpdate()) ))
{
return;
}
......@@ -10953,7 +10954,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
{
LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_MARK_VISIBLE);
markVisible(avatar->mDrawable, *viewer_camera);
LLVOAvatar::sUseImpostors = false; // @TODO ???
LLVOAvatar::attachment_map_t::iterator iter;
for (iter = avatar->mAttachmentPoints.begin();
......@@ -11193,7 +11193,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
avatar->setImpostorDim(tdim);
LLVOAvatar::sUseImpostors = (0 != LLVOAvatar::sMaxNonImpostors);
sUseOcclusion = occlusion;
sReflectionRender = false;
sImpostorRender = false;
......
......@@ -79,15 +79,32 @@ def compare_trees(file_trees):
print "Summary:"
print summary
def dump_appearance_params(tree):
vals = []
for e in tree.getroot().iter():
if e.tag == "param":
g = int(e.get("group"))
if g in [0,3]:
vals.append("{" + e.get("id") + "," +e.get("u8") + "}")
#print e.get("id"), e.get("name"), e.get("group"), e.get("u8")
if len(vals)==253:
print ", ".join(vals)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="compare avatar XML archetype files")
parser.add_argument("--verbose", help="verbose flag", action="store_true")
parser.add_argument("--compare", help="compare flag", action="store_true")
parser.add_argument("--appearance_params", help="compare flag", action="store_true")
parser.add_argument("files", nargs="+", help="name of one or more archtype files")
args = parser.parse_args()
print "files",args.files
file_trees = [etree.parse(filename) for filename in args.files]
compare_trees(file_trees)
print args
if args.compare:
compare_trees(file_trees)
if args.appearance_params:
dump_appearance_params(file_trees[0])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment