Harmless Alchemy sync
CachedControls, autos, cleaner loops, remove overkill dynamic cast, and override and final
This commit is contained in:
@@ -47,8 +47,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer
|
||||
LLVOAvatar(id, pcode, regionp),
|
||||
mPlaying(false),
|
||||
mGlobalScale(1.0f),
|
||||
mRootVolp(NULL),
|
||||
mMarkedForDeath(false),
|
||||
mRootVolp(NULL),
|
||||
mScaleConstraintFixup(1.0),
|
||||
mRegionChanged(false)
|
||||
{
|
||||
@@ -60,6 +60,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer
|
||||
// virtual
|
||||
LLControlAvatar::~LLControlAvatar()
|
||||
{
|
||||
// Should already have been unlinked before destruction
|
||||
llassert(!mRootVolp);
|
||||
}
|
||||
|
||||
// virtual
|
||||
@@ -82,18 +84,12 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
|
||||
{
|
||||
|
||||
F32 max_legal_offset = MAX_LEGAL_OFFSET;
|
||||
if (gSavedSettings.getControl("AnimatedObjectsMaxLegalOffset"))
|
||||
{
|
||||
max_legal_offset = gSavedSettings.getF32("AnimatedObjectsMaxLegalOffset");
|
||||
}
|
||||
max_legal_offset = llmax(max_legal_offset,0.f);
|
||||
static LLCachedControl<F32> animated_object_max_legal_offset(gSavedSettings, "AnimatedObjectsMaxLegalOffset");
|
||||
max_legal_offset = llmax(animated_object_max_legal_offset(),0.f);
|
||||
|
||||
F32 max_legal_size = MAX_LEGAL_SIZE;
|
||||
if (gSavedSettings.getControl("AnimatedObjectsMaxLegalSize"))
|
||||
{
|
||||
max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize");
|
||||
}
|
||||
max_legal_size = llmax(max_legal_size, 1.f);
|
||||
static LLCachedControl<F32> animated_object_max_legal_size(gSavedSettings, "AnimatedObjectsMaxLegalSize");
|
||||
max_legal_size = llmax(animated_object_max_legal_size(), 1.f);
|
||||
|
||||
new_pos_fixup = LLVector3();
|
||||
new_scale_fixup = 1.0f;
|
||||
@@ -124,22 +120,23 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
|
||||
F32 target_dist = (offset_dist - max_legal_offset);
|
||||
new_pos_fixup = (target_dist/offset_dist)*pos_box_offset;
|
||||
}
|
||||
if (new_pos_fixup != mPositionConstraintFixup)
|
||||
{
|
||||
LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup "
|
||||
<< new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
|
||||
LL_DEBUGS("ConstraintFix") << "vol_pos " << vol_pos << LL_ENDL;
|
||||
LL_DEBUGS("ConstraintFix") << "extents " << extents[0] << " " << extents[1] << LL_ENDL;
|
||||
LL_DEBUGS("ConstraintFix") << "unshift_extents " << unshift_extents[0] << " " << unshift_extents[1] << LL_ENDL;
|
||||
|
||||
//if (new_pos_fixup != mPositionConstraintFixup)
|
||||
//{
|
||||
// LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup "
|
||||
// << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
|
||||
// LL_DEBUGS("ConstraintFix") << "vol_pos " << vol_pos << LL_ENDL;
|
||||
// LL_DEBUGS("ConstraintFix") << "extents " << extents[0] << " " << extents[1] << LL_ENDL;
|
||||
// LL_DEBUGS("ConstraintFix") << "unshift_extents " << unshift_extents[0] << " " << unshift_extents[1] << LL_ENDL;
|
||||
//
|
||||
//}
|
||||
}
|
||||
}
|
||||
/*if (box_size/mScaleConstraintFixup > max_legal_size)
|
||||
{
|
||||
new_scale_fixup = mScaleConstraintFixup*max_legal_size/box_size;
|
||||
LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup "
|
||||
<< mScaleConstraintFixup << " max legal " << max_legal_size
|
||||
<< " -> new scale " << new_scale_fixup << LL_ENDL;
|
||||
//LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup "
|
||||
// << mScaleConstraintFixup << " max legal " << max_legal_size
|
||||
// << " -> new scale " << new_scale_fixup << LL_ENDL;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -163,6 +160,8 @@ void LLControlAvatar::matchVolumeTransform()
|
||||
mPositionConstraintFixup = new_pos_fixup;
|
||||
mScaleConstraintFixup = new_scale_fixup;
|
||||
|
||||
static LLCachedControl<F32> global_scale(gSavedSettings, "AnimatedObjectsGlobalScale", 1.f);
|
||||
|
||||
if (mRootVolp->isAttachment())
|
||||
{
|
||||
LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor();
|
||||
@@ -174,13 +173,12 @@ void LLControlAvatar::matchVolumeTransform()
|
||||
LLVector3 joint_pos = attach->getWorldPosition();
|
||||
LLQuaternion joint_rot = attach->getWorldRotation();
|
||||
LLVector3 obj_pos = mRootVolp->mDrawable->getPosition();
|
||||
LLQuaternion obj_rot = mRootVolp->mDrawable->getRotation();
|
||||
const LLQuaternion& obj_rot = mRootVolp->mDrawable->getRotation();
|
||||
obj_pos.rotVec(joint_rot);
|
||||
mRoot->setWorldPosition(obj_pos + joint_pos);
|
||||
mRoot->setWorldRotation(obj_rot * joint_rot);
|
||||
setRotation(mRoot->getRotation());
|
||||
|
||||
F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale");
|
||||
setGlobalScale(global_scale * mScaleConstraintFixup);
|
||||
}
|
||||
else
|
||||
@@ -200,17 +198,7 @@ void LLControlAvatar::matchVolumeTransform()
|
||||
// complexity info and such line up better. Should defer
|
||||
// this until avatars also get fixed.
|
||||
|
||||
LLQuaternion obj_rot;
|
||||
if (mRootVolp->mDrawable)
|
||||
{
|
||||
obj_rot = mRootVolp->mDrawable->getRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_rot = mRootVolp->getRotation();
|
||||
}
|
||||
|
||||
LLMatrix3 bind_mat;
|
||||
const LLQuaternion& obj_rot = mRootVolp->mDrawable ? mRootVolp->mDrawable->getRotation() : mRootVolp->getRotation();
|
||||
|
||||
LLQuaternion bind_rot;
|
||||
#define MATCH_BIND_SHAPE
|
||||
@@ -219,7 +207,7 @@ void LLControlAvatar::matchVolumeTransform()
|
||||
const LLMeshSkinInfo* skin_info = mRootVolp->getSkinInfo();
|
||||
if (skin_info)
|
||||
{
|
||||
LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL;
|
||||
//LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL;
|
||||
bind_rot = LLSkinningUtil::getUnscaledQuaternion(skin_info->mBindShapeMatrix);
|
||||
}
|
||||
#endif
|
||||
@@ -228,7 +216,6 @@ void LLControlAvatar::matchVolumeTransform()
|
||||
setPositionAgent(vol_pos);
|
||||
mRoot->setPosition(vol_pos + mPositionConstraintFixup);
|
||||
|
||||
F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale");
|
||||
setGlobalScale(global_scale * mScaleConstraintFixup);
|
||||
}
|
||||
}
|
||||
@@ -236,7 +223,7 @@ void LLControlAvatar::matchVolumeTransform()
|
||||
|
||||
void LLControlAvatar::setGlobalScale(F32 scale)
|
||||
{
|
||||
if (scale <= 0.0)
|
||||
if (scale <= 0.0f)
|
||||
{
|
||||
LL_WARNS() << "invalid global scale " << scale << LL_ENDL;
|
||||
return;
|
||||
@@ -255,10 +242,8 @@ void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor)
|
||||
{
|
||||
joint->setScale(factor * joint->getScale());
|
||||
|
||||
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
|
||||
iter != joint->mChildren.end(); ++iter)
|
||||
for (auto child : joint->mChildren)
|
||||
{
|
||||
LLJoint* child = *iter;
|
||||
recursiveScaleJoint(child, factor);
|
||||
}
|
||||
}
|
||||
@@ -278,10 +263,9 @@ void LLControlAvatar::updateVolumeGeom()
|
||||
mRootVolp->mDrawable->setState(LLDrawable::USE_BACKLIGHT);
|
||||
|
||||
LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren();
|
||||
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
|
||||
iter != child_list.end(); ++iter)
|
||||
for (const auto& iter : child_list)
|
||||
{
|
||||
LLViewerObject* childp = *iter;
|
||||
LLViewerObject* childp = iter;
|
||||
if (childp && childp->mDrawable.notNull())
|
||||
{
|
||||
childp->mDrawable->setState(LLDrawable::USE_BACKLIGHT);
|
||||
@@ -363,7 +347,8 @@ BOOL LLControlAvatar::updateCharacter(LLAgent &agent)
|
||||
//virtual
|
||||
void LLControlAvatar::updateDebugText()
|
||||
{
|
||||
/*if (gSavedSettings.getBOOL("DebugAnimatedObjects"))
|
||||
/*static LLCachedControl<bool> debug_animated_objects(gSavedSettings, "DebugAnimatedObjects");
|
||||
if (debug_animated_objects)
|
||||
{
|
||||
S32 total_linkset_count = 0;
|
||||
if (mRootVolp)
|
||||
@@ -386,10 +371,8 @@ void LLControlAvatar::updateDebugText()
|
||||
S32 cam_dist_count = 0;
|
||||
F32 lod_radius = mRootVolp->mLODRadius;
|
||||
|
||||
for (std::vector<LLVOVolume*>::iterator it = volumes.begin();
|
||||
it != volumes.end(); ++it)
|
||||
for (auto volp : volumes)
|
||||
{
|
||||
LLVOVolume *volp = *it;
|
||||
S32 verts = 0;
|
||||
total_tris += volp->getTriangleCount(&verts);
|
||||
total_verts += verts;
|
||||
@@ -492,10 +475,9 @@ void LLControlAvatar::getAnimatedVolumes(std::vector<LLVOVolume*>& volumes)
|
||||
volumes.push_back(mRootVolp);
|
||||
|
||||
LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren();
|
||||
for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
|
||||
iter != child_list.end(); ++iter)
|
||||
for (const auto& iter : child_list)
|
||||
{
|
||||
LLViewerObject* childp = *iter;
|
||||
LLViewerObject* childp = iter;
|
||||
LLVOVolume *child_volp = dynamic_cast<LLVOVolume*>(childp);
|
||||
if (child_volp && child_volp->isAnimatedObject())
|
||||
{
|
||||
@@ -520,16 +502,16 @@ void LLControlAvatar::updateAnimations()
|
||||
|
||||
// Rebuild mSignaledAnimations from the associated volumes.
|
||||
std::map<LLUUID, S32> anims;
|
||||
for (std::vector<LLVOVolume*>::iterator vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it)
|
||||
for (auto vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it)
|
||||
{
|
||||
LLVOVolume *volp = *vol_it;
|
||||
//LL_INFOS("AnimatedObjects") << "updating anim for vol " << volp->getID() << " root " << mRootVolp->getID() << LL_ENDL;
|
||||
signaled_animation_map_t& signaled_animations = LLObjectSignaledAnimationMap::instance().getMap()[volp->getID()];
|
||||
for (std::map<LLUUID,S32>::iterator anim_it = signaled_animations.begin();
|
||||
for (auto anim_it = signaled_animations.begin();
|
||||
anim_it != signaled_animations.end();
|
||||
++anim_it)
|
||||
{
|
||||
std::map<LLUUID,S32>::iterator found_anim_it = anims.find(anim_it->first);
|
||||
auto found_anim_it = anims.find(anim_it->first);
|
||||
if (found_anim_it != anims.end())
|
||||
{
|
||||
// Animation already present, use the larger sequence id
|
||||
@@ -540,7 +522,9 @@ void LLControlAvatar::updateAnimations()
|
||||
// Animation not already present, use this sequence id.
|
||||
anims[anim_it->first] = anim_it->second;
|
||||
}
|
||||
#if LL_DEBUG
|
||||
LL_DEBUGS("AnimatedObjectsNotify") << "found anim for vol " << volp->getID() << " anim " << anim_it->first << " root " << mRootVolp->getID() << LL_ENDL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (!mPlaying)
|
||||
@@ -568,15 +552,18 @@ LLViewerObject* LLControlAvatar::lineSegmentIntersectRiggedAttachments(const LLV
|
||||
LLVector4a* normal,
|
||||
LLVector4a* tangent)
|
||||
{
|
||||
if (!mRootVolp)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LLViewerObject* hit = NULL;
|
||||
|
||||
if (lineSegmentBoundingBox(start, end))
|
||||
{
|
||||
LLVector4a local_end = end;
|
||||
LLVector4a local_intersection;
|
||||
|
||||
if (mRootVolp &&
|
||||
mRootVolp->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, face_hit, &local_intersection, tex_coord, normal, tangent))
|
||||
if (mRootVolp->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, face_hit, &local_intersection, tex_coord, normal, tangent))
|
||||
{
|
||||
local_end = local_intersection;
|
||||
if (intersection)
|
||||
@@ -639,8 +626,11 @@ void LLControlAvatar::onRegionChanged()
|
||||
std::vector<LLCharacter*>::iterator it = LLCharacter::sInstances.begin();
|
||||
for ( ; it != LLCharacter::sInstances.end(); ++it)
|
||||
{
|
||||
LLControlAvatar* cav = dynamic_cast<LLControlAvatar*>(*it);
|
||||
if (!cav) continue;
|
||||
cav->mRegionChanged = true;
|
||||
auto avatar = static_cast<LLVOAvatar*>(*it);
|
||||
if (!avatar->isDead() && avatar->isControlAvatar())
|
||||
{
|
||||
LLControlAvatar* cav = static_cast<LLControlAvatar*>(avatar);
|
||||
cav->mRegionChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
#include "llvoavatar.h"
|
||||
#include "llvovolume.h"
|
||||
|
||||
class LLControlAvatar:
|
||||
class LLControlAvatar final:
|
||||
public LLVOAvatar
|
||||
{
|
||||
LOG_CLASS(LLControlAvatar);
|
||||
|
||||
public:
|
||||
LLControlAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
|
||||
virtual void initInstance(); // Called after construction to initialize the class.
|
||||
void initInstance() override; // Called after construction to initialize the class.
|
||||
virtual ~LLControlAvatar();
|
||||
virtual LLControlAvatar* asControlAvatar() { return this; }
|
||||
LLControlAvatar* asControlAvatar() override { return this; }
|
||||
|
||||
void getNewConstraintFixups(LLVector3& new_pos_constraint, F32& new_scale_constraint) const;
|
||||
void matchVolumeTransform();
|
||||
@@ -53,13 +53,13 @@ public:
|
||||
// markDead() inside other graphics pipeline operations.
|
||||
void markForDeath();
|
||||
|
||||
virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
|
||||
virtual BOOL updateCharacter(LLAgent &agent);
|
||||
void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) override;
|
||||
BOOL updateCharacter(LLAgent &agent) override;
|
||||
|
||||
void getAnimatedVolumes(std::vector<LLVOVolume*>& volumes);
|
||||
void updateAnimations();
|
||||
|
||||
virtual LLViewerObject* lineSegmentIntersectRiggedAttachments(
|
||||
LLViewerObject* lineSegmentIntersectRiggedAttachments(
|
||||
const LLVector4a& start, const LLVector4a& end,
|
||||
S32 face = -1, // which face to check, -1 = ALL_SIDES
|
||||
BOOL pick_transparent = FALSE,
|
||||
@@ -68,13 +68,13 @@ public:
|
||||
LLVector4a* intersection = NULL, // return the intersection point
|
||||
LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
|
||||
LLVector4a* normal = NULL, // return the surface normal at the intersection point
|
||||
LLVector4a* tangent = NULL); // return the surface tangent at the intersection point
|
||||
LLVector4a* tangent = NULL) override; // return the surface tangent at the intersection point
|
||||
|
||||
virtual void updateDebugText();
|
||||
void updateDebugText() override;
|
||||
|
||||
virtual std::string getFullname() const;
|
||||
std::string getFullname() const override;
|
||||
|
||||
virtual bool shouldRenderRigged() const;
|
||||
bool shouldRenderRigged() const override;
|
||||
|
||||
virtual BOOL isImpostor();
|
||||
|
||||
@@ -101,7 +101,7 @@ typedef std::map<LLUUID, S32> signaled_animation_map_t;
|
||||
typedef std::map<LLUUID, signaled_animation_map_t> object_signaled_animation_map_t;
|
||||
|
||||
// Stores information about previously requested animations, by object id.
|
||||
class LLObjectSignaledAnimationMap: public LLSingleton<LLObjectSignaledAnimationMap>
|
||||
class LLObjectSignaledAnimationMap final : public LLSingleton<LLObjectSignaledAnimationMap>
|
||||
{
|
||||
public:
|
||||
LLObjectSignaledAnimationMap() {}
|
||||
|
||||
@@ -1620,7 +1620,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
||||
retval |= checkMediaURL(media_url);
|
||||
|
||||
//
|
||||
// Unpack particle system data
|
||||
// Unpack particle system data (legacy)
|
||||
//
|
||||
if (value & 0x8)
|
||||
{
|
||||
@@ -2188,23 +2188,22 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
||||
mStatic = FALSE;
|
||||
}
|
||||
|
||||
// BUG: This code leads to problems during group rotate and any scale operation.
|
||||
// Small discepencies between the simulator and viewer representations cause the
|
||||
// selection center to creep, leading to objects moving around the wrong center.
|
||||
//
|
||||
// Removing this, however, means that if someone else drags an object you have
|
||||
// selected, your selection center and dialog boxes will be wrong. It also means
|
||||
// that higher precision information on selected objects will be ignored.
|
||||
//
|
||||
// I believe the group rotation problem is fixed. JNC 1.21.2002
|
||||
//
|
||||
// BUG: This code leads to problems during group rotate and any scale operation.
|
||||
// Small discepencies between the simulator and viewer representations cause the
|
||||
// selection center to creep, leading to objects moving around the wrong center.
|
||||
//
|
||||
// Removing this, however, means that if someone else drags an object you have
|
||||
// selected, your selection center and dialog boxes will be wrong. It also means
|
||||
// that higher precision information on selected objects will be ignored.
|
||||
//
|
||||
// I believe the group rotation problem is fixed. JNC 1.21.2002
|
||||
//
|
||||
// Additionally, if any child is selected, need to update the dialogs and selection
|
||||
// center.
|
||||
BOOL needs_refresh = mUserSelected;
|
||||
for (child_list_t::iterator iter = mChildList.begin();
|
||||
iter != mChildList.end(); iter++)
|
||||
for (auto& iter : mChildList)
|
||||
{
|
||||
LLViewerObject* child = *iter;
|
||||
LLViewerObject* child = iter;
|
||||
needs_refresh = needs_refresh || child->mUserSelected;
|
||||
}
|
||||
|
||||
@@ -2952,10 +2951,9 @@ void LLViewerObject::updateControlAvatar()
|
||||
{
|
||||
bool any_rigged_mesh = root->isRiggedMesh();
|
||||
LLViewerObject::const_child_list_t& child_list = root->getChildren();
|
||||
for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
|
||||
iter != child_list.end(); ++iter)
|
||||
for (const auto& iter : child_list)
|
||||
{
|
||||
const LLViewerObject* child = *iter;
|
||||
const LLViewerObject* child = iter;
|
||||
any_rigged_mesh = any_rigged_mesh || child->isRiggedMesh();
|
||||
}
|
||||
should_have_control_avatar = is_animated_object && any_rigged_mesh;
|
||||
@@ -3136,6 +3134,7 @@ void LLViewerObject::unlinkControlAvatar()
|
||||
if (mControlAvatar)
|
||||
{
|
||||
mControlAvatar->markForDeath();
|
||||
mControlAvatar->mRootVolp = NULL;
|
||||
mControlAvatar = NULL;
|
||||
}
|
||||
}
|
||||
@@ -3269,7 +3268,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS
|
||||
LLInventoryObject::object_list_t::iterator end = object->mInventory->end();
|
||||
std::list<LLUUID>& pending_lst = object->mPendingInventoryItemsIDs;
|
||||
|
||||
for (; it != end && pending_lst.size(); ++it)
|
||||
for (; it != end && !pending_lst.empty(); ++it)
|
||||
{
|
||||
LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(it->get());
|
||||
if(item && item->getType() != LLAssetType::AT_CATEGORY)
|
||||
@@ -3292,7 +3291,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS
|
||||
}
|
||||
else
|
||||
{
|
||||
// This Occurs When to requests were made, and the first one
|
||||
// This Occurs When two requests were made, and the first one
|
||||
// has already handled it.
|
||||
LL_DEBUGS() << "Problem loading task inventory. Return code: "
|
||||
<< error_code << LL_ENDL;
|
||||
@@ -3412,11 +3411,6 @@ void LLViewerObject::removeInventory(const LLUUID& item_id)
|
||||
msg->sendReliable(mRegionp->getHost());
|
||||
deleteInventoryItem(item_id);
|
||||
++mInventorySerialNum;
|
||||
|
||||
// The viewer object should not refresh UI since this is a utility
|
||||
// function. The UI functionality that called this method should
|
||||
// refresh the views if necessary.
|
||||
//gBuildView->refresh();
|
||||
}
|
||||
|
||||
bool LLViewerObject::isTextureInInventory(LLViewerInventoryItem* item)
|
||||
@@ -3531,7 +3525,7 @@ void LLViewerObject::getInventoryContents(LLInventoryObject::object_list_t& obje
|
||||
|
||||
LLInventoryObject* LLViewerObject::getInventoryRoot()
|
||||
{
|
||||
if (!mInventory || !mInventory->size())
|
||||
if (!mInventory || mInventory->empty())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -3587,8 +3581,8 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent)
|
||||
return;
|
||||
}
|
||||
|
||||
LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
|
||||
LLVector3 pos_agent = getRenderPosition();
|
||||
const LLVector3& viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
|
||||
const LLVector3& pos_agent = getRenderPosition();
|
||||
|
||||
F32 dx = viewer_pos_agent.mV[VX] - pos_agent.mV[VX];
|
||||
F32 dy = viewer_pos_agent.mV[VY] - pos_agent.mV[VY];
|
||||
@@ -3602,7 +3596,7 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent)
|
||||
// to try to get a min distance from face, subtract min_scale/2 from the range.
|
||||
// This means we'll load too much detail sometimes, but that's better than not enough
|
||||
// I don't think there's a better way to do this without calculating distance per-poly
|
||||
F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2;
|
||||
F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2.f;
|
||||
|
||||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
if (range < 0.001f || isHUDAttachment()) // range == zero
|
||||
@@ -3781,10 +3775,9 @@ F32 LLViewerObject::getLinksetPhysicsCost()
|
||||
F32 LLViewerObject::recursiveGetEstTrianglesMax() const
|
||||
{
|
||||
F32 est_tris = getEstTrianglesMax();
|
||||
for (child_list_t::const_iterator iter = mChildList.begin();
|
||||
iter != mChildList.end(); iter++)
|
||||
for (const auto& iter : mChildList)
|
||||
{
|
||||
const LLViewerObject* child = *iter;
|
||||
const LLViewerObject* child = iter;
|
||||
if (!child->isAvatar())
|
||||
{
|
||||
est_tris += child->recursiveGetEstTrianglesMax();
|
||||
@@ -3852,10 +3845,9 @@ U32 LLViewerObject::recursiveGetTriangleCount(S32* vcount) const
|
||||
{
|
||||
S32 total_tris = getTriangleCount(vcount);
|
||||
LLViewerObject::const_child_list_t& child_list = getChildren();
|
||||
for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
|
||||
iter != child_list.end(); ++iter)
|
||||
for (const auto& iter : child_list)
|
||||
{
|
||||
LLViewerObject* childp = *iter;
|
||||
LLViewerObject* childp = iter;
|
||||
if (childp)
|
||||
{
|
||||
total_tris += childp->getTriangleCount(vcount);
|
||||
@@ -3882,13 +3874,11 @@ F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
|
||||
const LLVector3& scale = volume->getScale();
|
||||
area += volume->getVolume()->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
|
||||
}
|
||||
LLViewerObject::const_child_list_t children = volume->getChildren();
|
||||
for (LLViewerObject::const_child_list_t::const_iterator child_iter = children.begin();
|
||||
child_iter != children.end();
|
||||
++child_iter)
|
||||
LLViewerObject::const_child_list_t const& children = volume->getChildren();
|
||||
for (const auto& child_iter : children)
|
||||
{
|
||||
LLViewerObject* child_obj = *child_iter;
|
||||
LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj );
|
||||
LLViewerObject* child_obj = child_iter;
|
||||
LLVOVolume *child = child_obj ? child_obj->asVolume() : nullptr;
|
||||
if (child && child->getVolume())
|
||||
{
|
||||
const LLVector3& scale = child->getScale();
|
||||
@@ -3899,6 +3889,7 @@ F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
|
||||
}
|
||||
return area;
|
||||
}
|
||||
|
||||
void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
|
||||
{
|
||||
if(mDrawable.isNull())
|
||||
|
||||
@@ -570,6 +570,7 @@ public:
|
||||
F32SecondsImplicit mLastImpostorUpdateFrameTime;
|
||||
const LLVector3* getLastAnimExtents() const { return mLastAnimExtents; }
|
||||
void setNeedsExtentUpdate(bool val) { mNeedsExtentUpdate = val; }
|
||||
|
||||
private:
|
||||
LLVector3 mImpostorOffset;
|
||||
LLVector2 mImpostorDim;
|
||||
|
||||
Reference in New Issue
Block a user