SL-19887 Water cuts avatar's name bubble
parent
ce0274937f
commit
2a87b64d26
|
|
@ -898,6 +898,15 @@ void LLHUDNameTag::shift(const LLVector3& offset)
|
|||
mPositionAgent += offset;
|
||||
}
|
||||
|
||||
F32 LLHUDNameTag::getWorldHeight() const
|
||||
{
|
||||
const LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
F32 height_meters = mLastDistance * (F32)tan(camera->getView() / 2.f);
|
||||
F32 height_pixels = camera->getViewHeightInPixels() / 2.f;
|
||||
F32 meters_per_pixel = height_meters / height_pixels;
|
||||
return mHeight * meters_per_pixel * gViewerWindow->getDisplayScale().mV[VY];
|
||||
}
|
||||
|
||||
//static
|
||||
void LLHUDNameTag::addPickable(std::set<LLViewerObject*> &pick_list)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -127,11 +127,12 @@ public:
|
|||
/*virtual*/ void markDead();
|
||||
friend class LLHUDObject;
|
||||
/*virtual*/ F32 getDistance() const { return mLastDistance; }
|
||||
S32 getLOD() { return mLOD; }
|
||||
BOOL getVisible() { return mVisible; }
|
||||
S32 getLOD() const { return mLOD; }
|
||||
BOOL getVisible() const { return mVisible; }
|
||||
BOOL getHidden() const { return mHidden; }
|
||||
void setHidden( BOOL hide ) { mHidden = hide; }
|
||||
void shift(const LLVector3& offset);
|
||||
F32 getWorldHeight() const;
|
||||
|
||||
BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render = FALSE);
|
||||
|
||||
|
|
|
|||
|
|
@ -3612,7 +3612,6 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last)
|
|||
local_camera_up.normalize();
|
||||
local_camera_up = local_camera_up * inv_root_rot;
|
||||
|
||||
|
||||
// position is based on head position, does not require mAvatarOffset here. - Nyx
|
||||
LLVector3 avatar_ellipsoid(mBodySize.mV[VX] * 0.4f,
|
||||
mBodySize.mV[VY] * 0.4f,
|
||||
|
|
@ -3634,6 +3633,25 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last)
|
|||
name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av));
|
||||
name_position += pixel_up_vec * NAMETAG_VERTICAL_SCREEN_OFFSET;
|
||||
|
||||
const F32 water_height = getRegion()->getWaterHeight();
|
||||
static const F32 WATER_HEIGHT_DELTA = 0.25f;
|
||||
if (name_position[VZ] < water_height + WATER_HEIGHT_DELTA)
|
||||
{
|
||||
if (LLViewerCamera::getInstance()->getOrigin()[VZ] >= water_height)
|
||||
{
|
||||
name_position[VZ] = water_height;
|
||||
}
|
||||
else // both camera and HUD are below watermark
|
||||
{
|
||||
F32 name_world_height = mNameText->getWorldHeight();
|
||||
F32 max_z_position = water_height - name_world_height;
|
||||
if (name_position[VZ] > max_z_position)
|
||||
{
|
||||
name_position[VZ] = max_z_position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mNameText->setPositionAgent(name_position);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue