This commit is contained in:
Siana Gearz
2011-03-09 19:27:51 +01:00
17 changed files with 244 additions and 186 deletions

View File

@@ -47,13 +47,15 @@
const F32 MAX_WALK_PLAYBACK_SPEED = 8.f; // max m/s for which we adjust walk cycle speed const F32 MAX_WALK_PLAYBACK_SPEED = 8.f; // max m/s for which we adjust walk cycle speed
const F32 MIN_WALK_SPEED = 0.1f; // minimum speed at which we use velocity for down foot detection const F32 MIN_WALK_SPEED = 0.1f; // minimum speed at which we use velocity for down foot detection
const F32 TIME_EPSILON = 0.001f; // minumum frame time
const F32 MAX_TIME_DELTA = 2.f; // max two seconds a frame for calculating interpolation const F32 MAX_TIME_DELTA = 2.f; // max two seconds a frame for calculating interpolation
const F32 SPEED_ADJUST_MAX = 2.5f; // maximum adjustment of walk animation playback speed F32 SPEED_ADJUST_MAX_SEC = 2.f; // maximum adjustment to walk animation playback speed for a second
const F32 SPEED_ADJUST_MAX_SEC = 3.f; // maximum adjustment to walk animation playback speed for a second F32 ANIM_SPEED_MAX = 1.5f; // absolute upper limit on animation speed
const F32 DRIFT_COMP_MAX_TOTAL = 0.07f;//0.55f; // maximum drift compensation overall, in any direction const F32 DRIFT_COMP_MAX_TOTAL = 0.1f; // maximum drift compensation overall, in any direction
const F32 DRIFT_COMP_MAX_SPEED = 4.f; // speed at which drift compensation total maxes out const F32 DRIFT_COMP_MAX_SPEED = 4.f; // speed at which drift compensation total maxes out
const F32 MAX_ROLL = 0.6f; const F32 MAX_ROLL = 0.6f;
const F32 SPEED_FINAL_SCALING = 0.5f; // final scaling for walk animation const F32 PELVIS_COMPENSATION_WIEGHT = 0.7f; // proportion of foot drift that is compensated by moving the avatar directly
const F32 SPEED_ADJUST_TIME_CONSTANT = 0.1f; // time constant for speed adjustment interpolation
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLKeyframeWalkMotion() // LLKeyframeWalkMotion()
@@ -145,10 +147,8 @@ BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask)
LLWalkAdjustMotion::LLWalkAdjustMotion(const LLUUID &id) : LLWalkAdjustMotion::LLWalkAdjustMotion(const LLUUID &id) :
LLMotion(id), LLMotion(id),
mLastTime(0.f), mLastTime(0.f),
mAvgCorrection(0.f),
mSpeedAdjust(0.f),
mAnimSpeed(0.f), mAnimSpeed(0.f),
mAvgSpeed(0.f), mAdjustedSpeed(0.f),
mRelativeDir(0.f), mRelativeDir(0.f),
mAnkleOffset(0.f) mAnkleOffset(0.f)
{ {
@@ -185,15 +185,16 @@ LLMotion::LLMotionInitStatus LLWalkAdjustMotion::onInitialize(LLCharacter *chara
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BOOL LLWalkAdjustMotion::onActivate() BOOL LLWalkAdjustMotion::onActivate()
{ {
mAvgCorrection = 0.f;
mSpeedAdjust = 0.f;
mAnimSpeed = 0.f; mAnimSpeed = 0.f;
mAvgSpeed = 0.f; mAdjustedSpeed = 0.f;
mRelativeDir = 1.f; mRelativeDir = 1.f;
mPelvisState->setPosition(LLVector3::zero); mPelvisState->setPosition(LLVector3::zero);
// store ankle positions for next frame // store ankle positions for next frame
mLastLeftAnklePos = mCharacter->getPosGlobalFromAgent(mLeftAnkleJoint->getWorldPosition()); mLastLeftFootGlobalPos = mCharacter->getPosGlobalFromAgent(mLeftAnkleJoint->getWorldPosition());
mLastRightAnklePos = mCharacter->getPosGlobalFromAgent(mRightAnkleJoint->getWorldPosition()); mLastLeftFootGlobalPos.mdV[VZ] = 0.0;
mLastRightFootGlobalPos = mCharacter->getPosGlobalFromAgent(mRightAnkleJoint->getWorldPosition());
mLastRightFootGlobalPos.mdV[VZ] = 0.0;
F32 leftAnkleOffset = (mLeftAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec(); F32 leftAnkleOffset = (mLeftAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec();
F32 rightAnkleOffset = (mRightAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec(); F32 rightAnkleOffset = (mRightAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec();
@@ -207,144 +208,121 @@ BOOL LLWalkAdjustMotion::onActivate()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
{ {
LLVector3 footCorrection; // delta_time is guaranteed to be non zero
LLVector3 vel = mCharacter->getCharacterVelocity() * mCharacter->getTimeDilation(); F32 delta_time = llclamp(time - mLastTime, TIME_EPSILON, MAX_TIME_DELTA);
F32 deltaTime = llclamp(time - mLastTime, 0.f, MAX_TIME_DELTA);
mLastTime = time; mLastTime = time;
LLQuaternion inv_rotation = ~mPelvisJoint->getWorldRotation(); // find the avatar motion vector in the XY plane
LLVector3 avatar_velocity = mCharacter->getCharacterVelocity() * mCharacter->getTimeDilation();
avatar_velocity.mV[VZ] = 0.f;
// get speed and normalize velocity vector F32 speed = llclamp(avatar_velocity.magVec(), 0.f, MAX_WALK_PLAYBACK_SPEED);
LLVector3 ang_vel = mCharacter->getCharacterAngularVelocity() * mCharacter->getTimeDilation();
F32 speed = llmin(vel.normVec(), MAX_WALK_PLAYBACK_SPEED);
mAvgSpeed = lerp(mAvgSpeed, speed, LLCriticalDamp::getInterpolant(0.2f));
// calculate facing vector in pelvis-local space // grab avatar->world transforms
// (either straight forward or back, depending on velocity) LLQuaternion avatar_to_world_rot = mCharacter->getRootJoint()->getWorldRotation();
LLVector3 localVel = vel * inv_rotation;
if (localVel.mV[VX] > 0.f)
{
mRelativeDir = 1.f;
}
else if (localVel.mV[VX] < 0.f)
{
mRelativeDir = -1.f;
}
// calculate world-space foot drift LLQuaternion world_to_avatar_rot(avatar_to_world_rot);
LLVector3 leftFootDelta; world_to_avatar_rot.conjugate();
LLVector3 leftFootWorldPosition = mLeftAnkleJoint->getWorldPosition();
LLVector3d leftFootGlobalPosition = mCharacter->getPosGlobalFromAgent(leftFootWorldPosition);
leftFootDelta.setVec(mLastLeftAnklePos - leftFootGlobalPosition);
mLastLeftAnklePos = leftFootGlobalPosition;
LLVector3 rightFootDelta; LLVector3 foot_slip_vector;
LLVector3 rightFootWorldPosition = mRightAnkleJoint->getWorldPosition();
LLVector3d rightFootGlobalPosition = mCharacter->getPosGlobalFromAgent(rightFootWorldPosition);
rightFootDelta.setVec(mLastRightAnklePos - rightFootGlobalPosition);
mLastRightAnklePos = rightFootGlobalPosition;
// find foot drift along velocity vector // find foot drift along velocity vector
if (mAvgSpeed > 0.1) if (speed > MIN_WALK_SPEED)
{ { // walking/running
// walking/running
F32 leftFootDriftAmt = leftFootDelta * vel;
F32 rightFootDriftAmt = rightFootDelta * vel;
if (rightFootDriftAmt > leftFootDriftAmt) // calculate world-space foot drift
{ // use global coordinates to seamlessly handle region crossings
footCorrection = rightFootDelta; LLVector3d leftFootGlobalPosition = mCharacter->getPosGlobalFromAgent(mLeftAnkleJoint->getWorldPosition());
} else leftFootGlobalPosition.mdV[VZ] = 0.0;
{ LLVector3 leftFootDelta(leftFootGlobalPosition - mLastLeftFootGlobalPos);
footCorrection = leftFootDelta; mLastLeftFootGlobalPos = leftFootGlobalPosition;
}
LLVector3d rightFootGlobalPosition = mCharacter->getPosGlobalFromAgent(mRightAnkleJoint->getWorldPosition());
rightFootGlobalPosition.mdV[VZ] = 0.0;
LLVector3 rightFootDelta(rightFootGlobalPosition - mLastRightFootGlobalPos);
mLastRightFootGlobalPos = rightFootGlobalPosition;
// get foot drift along avatar direction of motion
F32 left_foot_slip_amt = leftFootDelta * avatar_velocity;
F32 right_foot_slip_amt = rightFootDelta * avatar_velocity;
// if right foot is pushing back faster than left foot...
if (right_foot_slip_amt < left_foot_slip_amt)
{ //...use it to calculate optimal animation speed
foot_slip_vector = rightFootDelta;
} }
else else
{ { // otherwise use the left foot
mAvgSpeed = ang_vel.magVec() * mAnkleOffset; foot_slip_vector = leftFootDelta;
mRelativeDir = 1.f;
// standing/turning
// find the lower foot
if (leftFootWorldPosition.mV[VZ] < rightFootWorldPosition.mV[VZ])
{
// pivot on left foot
footCorrection = leftFootDelta;
} }
else
{
// pivot on right foot
footCorrection = rightFootDelta;
}
}
// rotate into avatar coordinates
footCorrection = footCorrection * inv_rotation;
// calculate ideal pelvis offset so that foot is glued to ground and damp towards it // calculate ideal pelvis offset so that foot is glued to ground and damp towards it
// the amount of foot slippage this frame + the offset applied last frame // this will soak up transient slippage
mPelvisOffset = mPelvisState->getPosition() + lerp(LLVector3::zero, footCorrection, LLCriticalDamp::getInterpolant(0.2f)); //
// FIXME: this interacts poorly with speed adjustment
// mPelvisOffset compensates for foot drift by moving the avatar pelvis in the opposite
// direction of the drift, up to a certain limited distance
// but this will cause the animation playback rate calculation below to
// kick in too slowly and sometimes start playing the animation in reverse.
// pelvis drift (along walk direction) //mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLCriticalDamp::getInterpolant(0.1f));
mAvgCorrection = lerp(mAvgCorrection, footCorrection.mV[VX] * mRelativeDir, LLCriticalDamp::getInterpolant(0.1f));
// calculate average velocity of foot slippage ////F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL * (llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED);
F32 footSlipVelocity = (deltaTime != 0.f) ? (-mAvgCorrection / deltaTime) : 0.f; //F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL;
F32 newSpeedAdjust = 0.f; //// clamp pelvis offset to a 90 degree arc behind the nominal position
//// NB: this is an ADDITIVE amount that is accumulated every frame, so clamping it alone won't do the trick
//// must clamp with absolute position of pelvis in mind
//LLVector3 currentPelvisPos = mPelvisState->getJoint()->getPosition();
//mPelvisOffset.mV[VX] = llclamp( mPelvisOffset.mV[VX], -drift_comp_max, drift_comp_max );
//mPelvisOffset.mV[VY] = llclamp( mPelvisOffset.mV[VY], -drift_comp_max, drift_comp_max );
//mPelvisOffset.mV[VZ] = 0.f;
//
//mLastRightFootGlobalPos += LLVector3d(mPelvisOffset * avatar_to_world_rot);
//mLastLeftFootGlobalPos += LLVector3d(mPelvisOffset * avatar_to_world_rot);
//foot_slip_vector -= mPelvisOffset;
LLVector3 avatar_movement_dir = avatar_velocity;
avatar_movement_dir.normalize();
// planted foot speed is avatar velocity - foot slip amount along avatar movement direction
F32 foot_speed = speed - ((foot_slip_vector * avatar_movement_dir) / delta_time);
// multiply animation playback rate so that foot speed matches avatar speed
F32 min_speed_multiplier = clamp_rescale(speed, 0.f, 1.f, 0.f, 0.1f);
F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX);
// blend towards new speed adjustment value
F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(SPEED_ADJUST_TIME_CONSTANT));
// limit that rate at which the speed adjustment changes
F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time);
mAdjustedSpeed += speedDelta;
// modulate speed by dot products of facing and velocity // modulate speed by dot products of facing and velocity
// so that if we are moving sideways, we slow down the animation // so that if we are moving sideways, we slow down the animation
// and if we're moving backward, we walk backward // and if we're moving backward, we walk backward
// do this at the end to be more responsive to direction changes instead of in the above speed calculations
F32 directional_factor = (avatar_movement_dir * world_to_avatar_rot).mV[VX];
F32 directional_factor = localVel.mV[VX] * mRelativeDir; mAnimSpeed = mAdjustedSpeed * directional_factor;
if (speed > 0.1f)
{
// calculate ratio of desired foot velocity to detected foot velocity
newSpeedAdjust = llclamp(footSlipVelocity - mAvgSpeed * (1.f - directional_factor),
-SPEED_ADJUST_MAX, SPEED_ADJUST_MAX);
newSpeedAdjust = lerp(mSpeedAdjust, newSpeedAdjust, LLCriticalDamp::getInterpolant(0.2f));
F32 speedDelta = newSpeedAdjust - mSpeedAdjust;
speedDelta = llclamp(speedDelta, -SPEED_ADJUST_MAX_SEC * deltaTime, SPEED_ADJUST_MAX_SEC * deltaTime);
mSpeedAdjust = mSpeedAdjust + speedDelta;
} }
else else
{ { // standing/turning
mSpeedAdjust = lerp(mSpeedAdjust, 0.f, LLCriticalDamp::getInterpolant(0.2f));
// damp out speed adjustment to 0
mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(0.2f));
//mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(0.2f));
} }
mAnimSpeed = (mAvgSpeed + mSpeedAdjust) * mRelativeDir; // broadcast walk speed change
mAnimSpeed = mAnimSpeed * SPEED_FINAL_SCALING;
// char debug_text[64];
// sprintf(debug_text, "Foot slip vel: %.2f", footSlipVelocity);
// mCharacter->addDebugText(debug_text);
// sprintf(debug_text, "Speed: %.2f", mAvgSpeed);
// mCharacter->addDebugText(debug_text);
// sprintf(debug_text, "Speed Adjust: %.2f", mSpeedAdjust);
// mCharacter->addDebugText(debug_text);
// sprintf(debug_text, "Animation Playback Speed: %.2f", mAnimSpeed);
// mCharacter->addDebugText(debug_text);
mCharacter->setAnimationData("Walk Speed", &mAnimSpeed); mCharacter->setAnimationData("Walk Speed", &mAnimSpeed);
// clamp pelvis offset to a 90 degree arc behind the nominal position
F32 drift_comp_max = llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED;
drift_comp_max *= DRIFT_COMP_MAX_TOTAL;
LLVector3 currentPelvisPos = mPelvisState->getJoint()->getPosition();
// NB: this is an ADDITIVE amount that is accumulated every frame, so clamping it alone won't do the trick
// must clamp with absolute position of pelvis in mind
mPelvisOffset.mV[VX] = llclamp( mPelvisOffset.mV[VX], -drift_comp_max - currentPelvisPos.mV[VX], drift_comp_max - currentPelvisPos.mV[VX] );
mPelvisOffset.mV[VY] = llclamp( mPelvisOffset.mV[VY], -drift_comp_max - currentPelvisPos.mV[VY], drift_comp_max - currentPelvisPos.mV[VY]);
mPelvisOffset.mV[VZ] = 0.f;
// set position // set position
// need to update *some* joint to keep this animation active
mPelvisState->setPosition(mPelvisOffset); mPelvisState->setPosition(mPelvisOffset);
mCharacter->setAnimationData("Pelvis Offset", &mPelvisOffset);
return TRUE; return TRUE;
} }

View File

@@ -126,13 +126,11 @@ public:
LLJoint* mRightAnkleJoint; LLJoint* mRightAnkleJoint;
LLPointer<LLJointState> mPelvisState; LLPointer<LLJointState> mPelvisState;
LLJoint* mPelvisJoint; LLJoint* mPelvisJoint;
LLVector3d mLastLeftAnklePos; LLVector3d mLastLeftFootGlobalPos;
LLVector3d mLastRightAnklePos; LLVector3d mLastRightFootGlobalPos;
F32 mLastTime; F32 mLastTime;
F32 mAvgCorrection; F32 mAdjustedSpeed;
F32 mSpeedAdjust;
F32 mAnimSpeed; F32 mAnimSpeed;
F32 mAvgSpeed;
F32 mRelativeDir; F32 mRelativeDir;
LLVector3 mPelvisOffset; LLVector3 mPelvisOffset;
F32 mAnkleOffset; F32 mAnkleOffset;

View File

@@ -34,7 +34,7 @@
#include "linden_common.h" #include "linden_common.h"
#include "llsdutil.h" #include "llsdutil_math.h"
#include "v3math.h" #include "v3math.h"
#include "v4math.h" #include "v4math.h"

View File

@@ -12822,6 +12822,28 @@
<key>Value</key> <key>Value</key>
<integer>1</integer> <integer>1</integer>
</map> </map>
<key>UseNewWalkRun</key>
<map>
<key>Comment</key>
<string>Replace standard walk/run animations with new ones.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>UseCrossWalkRun</key>
<map>
<key>Comment</key>
<string>Use opposite gender walk/run animations.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>UseStartScreen</key> <key>UseStartScreen</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@@ -349,6 +349,12 @@ const LLVector3* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_
} }
} }
llassert(driven);
if (!driven)
{
return NULL; // shouldn't happen, but...
}
// We're already in the middle of a param's distortions, so get the next one. // We're already in the middle of a param's distortions, so get the next one.
const LLVector3* v = driven->mParam->getNextDistortion( index, poly_mesh ); const LLVector3* v = driven->mParam->getNextDistortion( index, poly_mesh );
if( (!v) && (iter != mDriven.end()) ) if( (!v) && (iter != mDriven.end()) )

View File

@@ -395,9 +395,9 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename)
{ {
wcsncpy( mFilesW,L"untitled.jpeg", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/ wcsncpy( mFilesW,L"untitled.jpeg", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
} }
mOFN.lpstrDefExt = L"jpeg"; mOFN.lpstrDefExt = L"jpg";
mOFN.lpstrFilter = mOFN.lpstrFilter =
L"JPEG Images (*.jpeg)\0*.jpeg\0" \ L"JPEG Images (*.jpg *.jpeg)\0*.jpg;*.jpeg\0" \
L"\0"; L"\0";
break; break;
case FFSAVE_AVI: case FFSAVE_AVI:

View File

@@ -67,6 +67,7 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD
mInitializedRes = -1; mInitializedRes = -1;
mSimulateRes = 0; mSimulateRes = 0;
mFrameNum = 0; mFrameNum = 0;
mCollisionSphereRadius = 0.f;
mRenderRes = 1; mRenderRes = 1;
if(mVO->mDrawable.notNull()) if(mVO->mDrawable.notNull())

View File

@@ -1115,12 +1115,11 @@ void LLGestureManager::notifyObservers()
{ {
lldebugs << "LLGestureManager::notifyObservers" << llendl; lldebugs << "LLGestureManager::notifyObservers" << llendl;
std::vector<LLGestureManagerObserver*> observers = mObservers; for(std::vector<LLGestureManagerObserver*>::iterator iter = mObservers.begin();
iter != mObservers.end();
std::vector<LLGestureManagerObserver*>::iterator it; ++iter)
for (it = observers.begin(); it != observers.end(); ++it)
{ {
LLGestureManagerObserver* observer = *it; LLGestureManagerObserver* observer = (*iter);
observer->changed(); observer->changed();
} }
} }

View File

@@ -121,7 +121,7 @@ void LLHUDEffectSpiral::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
LLHUDEffect::unpackData(mesgsys, blocknum); LLHUDEffect::unpackData(mesgsys, blocknum);
LLUUID object_id, target_object_id; LLUUID object_id, target_object_id;
S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); size_t size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
if (size != EFFECT_SIZE) if (size != EFFECT_SIZE)
{ {
llwarns << "Spiral effect with bad size " << size << llendl; llwarns << "Spiral effect with bad size " << size << llendl;

View File

@@ -62,11 +62,12 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
const LLColor4& color, const LLColor4& color,
const BOOL orthographic) const BOOL orthographic)
{ {
LLViewerCamera* camera = LLViewerCamera::getInstance();
// Do cheap plane culling // Do cheap plane culling
LLVector3 dir_vec = pos_agent - LLViewerCamera::getInstance()->getOrigin(); LLVector3 dir_vec = pos_agent - camera->getOrigin();
dir_vec /= dir_vec.magVec(); dir_vec /= dir_vec.magVec();
if (wstr.empty() || (!orthographic && dir_vec * LLViewerCamera::getInstance()->getAtAxis() <= 0.f)) if (wstr.empty() || (!orthographic && dir_vec * camera->getAtAxis() <= 0.f))
{ {
return; return;
} }
@@ -80,15 +81,15 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
} }
else else
{ {
LLViewerCamera::getInstance()->getPixelVectors(pos_agent, up_axis, right_axis); camera->getPixelVectors(pos_agent, up_axis, right_axis);
} }
LLCoordFrame render_frame = *LLViewerCamera::getInstance(); LLCoordFrame render_frame = *camera;
LLQuaternion rot; LLQuaternion rot;
if (!orthographic) if (!orthographic)
{ {
rot = render_frame.getQuaternion(); rot = render_frame.getQuaternion();
rot = rot * LLQuaternion(-F_PI_BY_TWO, LLViewerCamera::getInstance()->getYAxis()); rot = rot * LLQuaternion(-F_PI_BY_TWO, camera->getYAxis());
rot = rot * LLQuaternion(F_PI_BY_TWO, LLViewerCamera::getInstance()->getXAxis()); rot = rot * LLQuaternion(F_PI_BY_TWO, camera->getXAxis());
} }
else else
{ {

View File

@@ -512,9 +512,10 @@ void LLManip::renderXYZ(const LLVector3 &vec)
const S32 PAD = 10; const S32 PAD = 10;
std::string feedback_string; std::string feedback_string;
LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis(); LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis();
S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET;
S32 window_center_x = gViewerWindow->getWindowWidth() / 2; S32 window_center_x = gViewerWindow->getWindowWidth() / 2;
S32 window_center_y = gViewerWindow->getWindowHeight() / 2; S32 window_center_y = gViewerWindow->getWindowHeight() / 2;
S32 vertical_offset = window_center_y - VERTICAL_OFFSET;
glPushMatrix(); glPushMatrix();
{ {
@@ -536,29 +537,30 @@ void LLManip::renderXYZ(const LLVector3 &vec)
gViewerWindow->setup3DRender(); gViewerWindow->setup3DRender();
{ {
const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF );
LLLocale locale(LLLocale::USER_LOCALE); LLLocale locale(LLLocale::USER_LOCALE);
LLGLDepthTest gls_depth(GL_FALSE); LLGLDepthTest gls_depth(GL_FALSE);
// render drop shadowed text // render drop shadowed text
feedback_string = llformat("X: %.3f", vec.mV[VX]); feedback_string = llformat("X: %.3f", vec.mV[VX]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
feedback_string = llformat("Y: %.3f", vec.mV[VY]); feedback_string = llformat("Y: %.3f", vec.mV[VY]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
feedback_string = llformat("Z: %.3f", vec.mV[VZ]); feedback_string = llformat("Z: %.3f", vec.mV[VZ]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
// render text on top // render text on top
feedback_string = llformat("X: %.3f", vec.mV[VX]); feedback_string = llformat("X: %.3f", vec.mV[VX]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE);
glColor3f(0.5f, 1.f, 0.5f); glColor3f(0.5f, 1.f, 0.5f);
feedback_string = llformat("Y: %.3f", vec.mV[VY]); feedback_string = llformat("Y: %.3f", vec.mV[VY]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE);
glColor3f(0.5f, 0.5f, 1.f); glColor3f(0.5f, 0.5f, 1.f);
feedback_string = llformat("Z: %.3f", vec.mV[VZ]); feedback_string = llformat("Z: %.3f", vec.mV[VZ]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE);
} }
} }

View File

@@ -180,6 +180,7 @@ LLManipScale::LLManipScale( LLToolComposite* composite )
mScaleSnapUnit2(1.f), mScaleSnapUnit2(1.f),
mSnapRegimeOffset(0.f), mSnapRegimeOffset(0.f),
mSnapGuideLength(0.f), mSnapGuideLength(0.f),
mInSnapRegime(FALSE),
mScaleSnapValue(0.f) mScaleSnapValue(0.f)
{ {
mManipulatorScales = new F32[NUM_MANIPULATORS]; mManipulatorScales = new F32[NUM_MANIPULATORS];

View File

@@ -276,10 +276,13 @@ void LLPanelFace::sendAlpha()
void LLPanelFace::sendGlow() void LLPanelFace::sendGlow()
{ {
LLSpinCtrl* mCtrlGlow = getChild<LLSpinCtrl>("glow"); LLSpinCtrl* mCtrlGlow = getChild<LLSpinCtrl>("glow");
llassert(mCtrlGlow);
if (mCtrlGlow)
{
F32 glow = mCtrlGlow->get(); F32 glow = mCtrlGlow->get();
LLSelectMgr::getInstance()->selectionSetGlow( glow ); LLSelectMgr::getInstance()->selectionSetGlow( glow );
} }
}
struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
{ {
@@ -296,6 +299,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
LLCheckBoxCtrl* checkFlipScaleS = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip s"); LLCheckBoxCtrl* checkFlipScaleS = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip s");
LLCheckBoxCtrl* checkFlipScaleT = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip t"); LLCheckBoxCtrl* checkFlipScaleT = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip t");
LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen"); LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen");
llassert(comboTexGen);
llassert(object);
if (ctrlTexScaleS) if (ctrlTexScaleS)
{ {
valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative(); valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative();
@@ -306,7 +311,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
{ {
value = -value; value = -value;
} }
if (comboTexGen->getCurrentIndex() == 1) if (comboTexGen &&
comboTexGen->getCurrentIndex() == 1)
{ {
value *= 0.5f; value *= 0.5f;
} }
@@ -324,7 +330,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
{ {
value = -value; value = -value;
} }
if (comboTexGen->getCurrentIndex() == 1) if (comboTexGen &&
comboTexGen->getCurrentIndex() == 1)
{ {
value *= 0.5f; value *= 0.5f;
} }

View File

@@ -994,7 +994,11 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create ); registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create );
registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create ); registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create );
registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create ); registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create );
registerMotion( ANIM_AGENT_FEMALE_RUN_NEW, LLKeyframeWalkMotion::create ); //v2
registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_FEMALE_WALK_NEW, LLKeyframeWalkMotion::create ); //v2
registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create ); registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_RUN_NEW, LLKeyframeWalkMotion::create ); //v2
registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create ); registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create );
registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create ); registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create );
registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create ); registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create );
@@ -1004,13 +1008,13 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create ); registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create ); registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create ); registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_WALK_NEW, LLKeyframeWalkMotion::create ); //v2
// motions without a start/stop bit // motions without a start/stop bit
registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create ); registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create );
registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create ); registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create );
registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create ); registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create );
registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create ); registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create );
registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create ); registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create );
registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create ); registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create );
registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create ); registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create );
@@ -5783,6 +5787,56 @@ std::string LLVOAvatar::getIdleTime()
return output; return output;
} }
// Override selectively based on avatar sex and whether we're using new
// animations.
LLUUID LLVOAvatar::remapMotionID(const LLUUID& id)
{
LLCachedControl<bool> use_new_walk_run("UseNewWalkRun",true);
LLCachedControl<bool> use_cross_walk_run("UseCrossWalkRun",false);
LLUUID result = id;
// start special case female walk for female avatars
if ((getSex() == SEX_FEMALE) != use_cross_walk_run)
{
if (id == ANIM_AGENT_WALK)
{
if (use_new_walk_run)
result = ANIM_AGENT_FEMALE_WALK_NEW;
else
result = ANIM_AGENT_FEMALE_WALK;
}
else if (id == ANIM_AGENT_RUN)
{
// There is no old female run animation, so only override
// in one case.
if (use_new_walk_run)
result = ANIM_AGENT_FEMALE_RUN_NEW;
}
else if (id == ANIM_AGENT_SIT)
{
result = ANIM_AGENT_SIT_FEMALE;
}
}
else
{
// Male avatar.
if (id == ANIM_AGENT_WALK)
{
if (use_new_walk_run)
result = ANIM_AGENT_WALK_NEW;
}
else if (id == ANIM_AGENT_RUN)
{
if (use_new_walk_run)
result = ANIM_AGENT_RUN_NEW;
}
}
return result;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// startMotion() // startMotion()
// id is the asset id of the animation to start // id is the asset id of the animation to start
@@ -5801,25 +5855,14 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
LLMemType mt(LLMemType::MTYPE_AVATAR); LLMemType mt(LLMemType::MTYPE_AVATAR);
// start special case female walk for female avatars LLUUID remap_id = remapMotionID(id);
if (getSex() == SEX_FEMALE)
{
if (id == ANIM_AGENT_WALK)
{
return LLCharacter::startMotion(ANIM_AGENT_FEMALE_WALK, time_offset);
}
else if (id == ANIM_AGENT_SIT)
{
return LLCharacter::startMotion(ANIM_AGENT_SIT_FEMALE, time_offset);
}
}
if (mIsSelf && id == ANIM_AGENT_AWAY) if (mIsSelf && remap_id == ANIM_AGENT_AWAY)
{ {
gAgent.setAFK(); gAgent.setAFK();
} }
return LLCharacter::startMotion(id, time_offset); return LLCharacter::startMotion(remap_id, time_offset);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -5827,21 +5870,15 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
{ {
LLUUID remap_id = remapMotionID(id);
if (mIsSelf) if (mIsSelf)
{ {
gAgent.onAnimStop(id); gAgent.onAnimStop(remap_id);
} }
if (id == ANIM_AGENT_WALK) return LLCharacter::stopMotion(remap_id, stop_immediate);
{
LLCharacter::stopMotion(ANIM_AGENT_FEMALE_WALK, stop_immediate);
}
else if (id == ANIM_AGENT_SIT)
{
LLCharacter::stopMotion(ANIM_AGENT_SIT_FEMALE, stop_immediate);
}
return LLCharacter::stopMotion(id, stop_immediate);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -208,6 +208,7 @@ public:
virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position); virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position); virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
virtual void updateVisualParams(); virtual void updateVisualParams();
LLUUID remapMotionID(const LLUUID& id);
virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
virtual void stopMotionFromSource(const LLUUID& source_id); virtual void stopMotionFromSource(const LLUUID& source_id);

View File

@@ -975,7 +975,10 @@ void LLVOSky::calcAtmospherics(void)
} }
temp2.mV[1] = llmax(0.f, lighty); temp2.mV[1] = llmax(0.f, lighty);
if(temp2.mV[1] > 0.f)
{
temp2.mV[1] = 1.f / temp2.mV[1]; temp2.mV[1] = 1.f / temp2.mV[1];
}
componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1]));
// Distance // Distance

View File

@@ -123,6 +123,7 @@ LLWorld::LLWorld() :
void LLWorld::destroyClass() void LLWorld::destroyClass()
{ {
mHoleWaterObjects.clear();
gObjectList.destroy(); gObjectList.destroy();
for(region_list_t::iterator region_it = mRegionList.begin(); region_it != mRegionList.end(); ) for(region_list_t::iterator region_it = mRegionList.begin(); region_it != mRegionList.end(); )
{ {
@@ -263,6 +264,7 @@ void LLWorld::removeRegion(const LLHost &host)
llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl; llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl;
LLAppViewer::instance()->forceDisconnect("You have been disconnected from the region you were in."); LLAppViewer::instance()->forceDisconnect("You have been disconnected from the region you were in.");
return; return;
} }