inline getters and setters in Avatar

This commit is contained in:
Stephen Birarda 2013-05-17 12:25:00 -07:00
parent fb2f36519d
commit 3e65d5a548
3 changed files with 7 additions and 26 deletions

View file

@ -786,14 +786,14 @@ void Application::idle() {
if (_myAvatar.isTransmitterV2Connected()) { if (_myAvatar.isTransmitterV2Connected()) {
const float HAND_FORCE_SCALING = 0.05f; const float HAND_FORCE_SCALING = 0.05f;
const float* handAcceleration = _myAvatar.getTransmitterHandLastAcceleration(); const float* handAcceleration = _myAvatar.getTransmitterHandLastAcceleration();
_myAvatar.setHandMovementValues(glm::vec3(-handAcceleration[0] * HAND_FORCE_SCALING, _myAvatar.setMovedHandOffset(glm::vec3(-handAcceleration[0] * HAND_FORCE_SCALING,
handAcceleration[1] * HAND_FORCE_SCALING, handAcceleration[1] * HAND_FORCE_SCALING,
handAcceleration[2] * HAND_FORCE_SCALING)); handAcceleration[2] * HAND_FORCE_SCALING));
} else { } else {
// update behaviors for avatar hand movement: handControl takes mouse values as input, // update behaviors for avatar hand movement: handControl takes mouse values as input,
// and gives back 3D values modulated for smooth transitioning between interaction modes. // and gives back 3D values modulated for smooth transitioning between interaction modes.
_handControl.update(_mouseX, _mouseY); _handControl.update(_mouseX, _mouseY);
_myAvatar.setHandMovementValues(_handControl.getValues()); _myAvatar.setMovedHandOffset(_handControl.getValues());
} }
// tell my avatar if the mouse is being pressed... // tell my avatar if the mouse is being pressed...

View file

@ -551,10 +551,6 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) {
} }
} }
float Avatar::getHeight() {
return _height;
}
void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float deltaTime) { void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float deltaTime) {
float myBodyApproximateBoundingRadius = 1.0f; float myBodyApproximateBoundingRadius = 1.0f;
glm::vec3 vectorFromMyBodyToBigSphere(_position - position); glm::vec3 vectorFromMyBodyToBigSphere(_position - position);
@ -780,16 +776,6 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
} }
} }
void Avatar::setHandMovementValues(glm::vec3 handOffset) {
_movedHandOffset = handOffset;
}
AvatarMode Avatar::getMode() {
return _mode;
}
void Avatar::initializeSkeleton() { void Avatar::initializeSkeleton() {
for (int b=0; b<NUM_AVATAR_JOINTS; b++) { for (int b=0; b<NUM_AVATAR_JOINTS; b++) {
@ -1072,7 +1058,6 @@ const glm::vec3& Avatar::getHeadPosition() const {
return _joint[ AVATAR_JOINT_HEAD_BASE ].position; return _joint[ AVATAR_JOINT_HEAD_BASE ].position;
} }
glm::vec3 Avatar::getApproximateEyePosition() { glm::vec3 Avatar::getApproximateEyePosition() {
return _head.getApproximateEyePosition(); return _head.getApproximateEyePosition();
} }
@ -1327,7 +1312,6 @@ void Avatar::transmitterV2RenderLevels(int width, int height) {
glEnd(); glEnd();
} }
void Avatar::setHeadFromGyros(glm::vec3* eulerAngles, glm::vec3* angularVelocity, float deltaTime, float smoothingTime) { void Avatar::setHeadFromGyros(glm::vec3* eulerAngles, glm::vec3* angularVelocity, float deltaTime, float smoothingTime) {
// //
// Given absolute position and angular velocity information, update the avatar's head angles // Given absolute position and angular velocity information, update the avatar's head angles
@ -1366,8 +1350,6 @@ void Avatar::setHeadFromGyros(glm::vec3* eulerAngles, glm::vec3* angularVelocity
} }
} }
const char AVATAR_DATA_FILENAME[] = "avatar.ifd"; const char AVATAR_DATA_FILENAME[] = "avatar.ifd";
void Avatar::writeAvatarDataToFile() { void Avatar::writeAvatarDataToFile() {
@ -1395,5 +1377,4 @@ void Avatar::readAvatarDataFromFile() {
} }
fclose(avatarFile); fclose(avatarFile);
} }
} }

View file

@ -99,18 +99,18 @@ public:
const glm::vec3& getSpringyHeadPosition() const ; // get the springy position of the avatar's head const glm::vec3& getSpringyHeadPosition() const ; // get the springy position of the avatar's head
const glm::vec3& getJointPosition(AvatarJointID j) const { return _joint[j].springyPosition; }; const glm::vec3& getJointPosition(AvatarJointID j) const { return _joint[j].springyPosition; };
const glm::vec3& getBodyUpDirection() const { return _orientation.getUp(); }; const glm::vec3& getBodyUpDirection() const { return _orientation.getUp(); };
float getSpeed() const { return _speed; }; float getSpeed() const { return _speed; }
const glm::vec3& getVelocity() const { return _velocity; }; const glm::vec3& getVelocity() const { return _velocity; };
float getGirth(); float getGirth();
float getHeight(); float getHeight() const { return _height; }
AvatarMode getMode(); AvatarMode getMode() const { return _mode; }
void setMousePressed(bool pressed); void setMousePressed(bool pressed);
void render(bool lookingInMirror, glm::vec3 cameraPosition); void render(bool lookingInMirror, glm::vec3 cameraPosition);
void renderBody(bool lookingInMirror); void renderBody(bool lookingInMirror);
void simulate(float); void simulate(float);
void setHandMovementValues( glm::vec3 movement ); void setMovedHandOffset(glm::vec3 movedHandOffset) { _movedHandOffset = movedHandOffset; }
void updateArmIKAndConstraints( float deltaTime ); void updateArmIKAndConstraints( float deltaTime );
void setDisplayingHead( bool displayingHead ); void setDisplayingHead( bool displayingHead );