merge fixes

This commit is contained in:
Philip Rosedale 2013-06-12 13:29:17 -07:00
commit 6cffb16279
4 changed files with 16 additions and 4 deletions

View file

@ -883,6 +883,10 @@ void Application::editPreferences() {
headCameraPitchYawScale->setValue(_headCameraPitchYawScale);
form->addRow("Head Camera Pitch/Yaw Scale:", headCameraPitchYawScale);
QDoubleSpinBox* leanScale = new QDoubleSpinBox();
leanScale->setValue(_myAvatar.getLeanScale());
form->addRow("Lean Scale:", leanScale);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dialog.connect(buttons, SIGNAL(accepted()), SLOT(accept()));
dialog.connect(buttons, SIGNAL(rejected()), SLOT(reject()));
@ -896,6 +900,7 @@ void Application::editPreferences() {
sendAvatarVoxelURLMessage(url);
_headCameraPitchYawScale = headCameraPitchYawScale->value();
_myAvatar.setLeanScale(leanScale->value());
}
void Application::pair() {

View file

@ -79,6 +79,7 @@ Avatar::Avatar(Agent* owningAgent) :
_thrust(0.0f, 0.0f, 0.0f),
_speed(0.0f),
_maxArmLength(0.0f),
_leanScale(0.5f),
_pelvisStandingHeight(0.0f),
_pelvisFloatingHeight(0.0f),
_distanceToNearestAvatar(std::numeric_limits<float>::max()),
@ -286,7 +287,7 @@ void Avatar::updateHeadFromGyros(float deltaTime, SerialInterface* serialInterfa
_head.setRoll(estimatedRotation.z * AMPLIFY_ROLL);
// Update torso lean distance based on accelerometer data
glm::vec3 estimatedPosition = serialInterface->getEstimatedPosition();
glm::vec3 estimatedPosition = serialInterface->getEstimatedPosition() * _leanScale;
const float TORSO_LENGTH = 0.5f;
const float MAX_LEAN = 45.0f;
_head.setLeanSideways(glm::clamp(glm::degrees(atanf(-estimatedPosition.x / TORSO_LENGTH)), -MAX_LEAN, MAX_LEAN));
@ -1217,6 +1218,8 @@ void Avatar::loadData(QSettings* settings) {
_voxels.setVoxelURL(settings->value("voxelURL").toUrl());
_leanScale = loadSetting(settings, "leanScale", 0.5f);
settings->endGroup();
}
@ -1238,6 +1241,8 @@ void Avatar::saveData(QSettings* set) {
set->setValue("voxelURL", _voxels.getVoxelURL());
set->setValue("leanScale", _leanScale);
set->endGroup();
}

View file

@ -97,6 +97,7 @@ public:
void setThrust (glm::vec3 newThrust ) { _thrust = newThrust; };
void setDisplayingLookatVectors(bool displayingLookatVectors) { _head.setRenderLookatVectors(displayingLookatVectors);}
void setVelocity (const glm::vec3 velocity ) { _velocity = velocity; };
void setLeanScale (float scale ) { _leanScale = scale;}
void setGravity (glm::vec3 gravity);
void setMouseRay (const glm::vec3 &origin, const glm::vec3 &direction);
void setOrientation (const glm::quat& orientation);
@ -116,6 +117,7 @@ public:
float getSpeed () const { return _speed;}
float getHeight () const { return _height;}
AvatarMode getMode () const { return _mode;}
float getLeanScale () const { return _leanScale;}
float getAbsoluteHeadYaw () const;
float getAbsoluteHeadPitch () const;
Head& getHead () {return _head; }
@ -183,7 +185,7 @@ private:
glm::vec3 _thrust;
float _speed;
float _maxArmLength;
glm::quat _righting;
float _leanScale;
int _driveKeys[MAX_DRIVE_KEYS];
float _pelvisStandingHeight;
float _pelvisFloatingHeight;

View file

@ -498,9 +498,9 @@ void runTimingTests() {
}
float loadSetting(QSettings* settings, const char* name, float defaultValue) {
float value = settings->value(name, 0.0f).toFloat();
float value = settings->value(name, defaultValue).toFloat();
if (isnan(value)) {
value = defaultValue;
}
return value;
}
}