From 75b57d17a768d8963dfc11c6cf8eddd4f1516c34 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Mon, 27 May 2013 18:54:44 -0700 Subject: [PATCH] fixed some things based on recent code review --- interface/src/Audio.cpp | 2 +- interface/src/Avatar.cpp | 12 +++++++----- interface/src/Avatar.h | 36 +++--------------------------------- 3 files changed, 11 insertions(+), 39 deletions(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 596751ac27..9870f31b29 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -208,7 +208,7 @@ int audioCallback (const void* inputBuffer, // if we haven't fired off the flange effect, check if we should // TODO: lastMeasuredHeadYaw is now relative to body - check if this still works. - int lastYawMeasured = fabsf(interfaceAvatar->getLastMeasuredHeadYaw()); + int lastYawMeasured = fabsf(interfaceAvatar->getHeadYawRate()); if (!::samplesLeftForFlange && lastYawMeasured > MIN_FLANGE_EFFECT_THRESHOLD) { // we should flange for one second diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 0127ffa4c8..9976dfa951 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -60,6 +60,8 @@ const float LEAN_AVERAGING = 10.0; const float HEAD_RATE_MAX = 50.f; const float SKIN_COLOR[] = {1.0, 0.84, 0.66}; const float DARK_SKIN_COLOR[] = {0.9, 0.78, 0.63}; +const int NUM_BODY_CONE_SIDES = 9; + bool usingBigSphereCollisionTest = true; @@ -1238,9 +1240,7 @@ void Avatar::readAvatarDataFromFile() { void Avatar::renderJointConnectingCone(glm::vec3 position1, glm::vec3 position2, float radius1, float radius2) { glBegin(GL_TRIANGLES); - - int num = 9; - + glm::vec3 axis = position2 - position1; float length = glm::length(axis); @@ -1255,10 +1255,12 @@ void Avatar::renderJointConnectingCone(glm::vec3 position1, glm::vec3 position2, float anglea = 0.0; float angleb = 0.0; - for (int i = 0; i < num; i ++) { + for (int i = 0; i < NUM_BODY_CONE_SIDES; i ++) { + // the rectangles that comprise the sides of the cone section are + // referenced by "a" and "b" in one dimension, and "1", and "2" in the other dimension. anglea = angleb; - angleb = ((float)(i+1) / (float)num) * PI * 2.0f; + angleb = ((float)(i+1) / (float)NUM_BODY_CONE_SIDES) * PI * 2.0f; float sa = sinf(anglea); float sb = sinf(angleb); diff --git a/interface/src/Avatar.h b/interface/src/Avatar.h index abeea56277..1ef5675d9b 100644 --- a/interface/src/Avatar.h +++ b/interface/src/Avatar.h @@ -18,6 +18,7 @@ #include "SerialInterface.h" #include "Balls.h" #include "Head.h" +#include "Skeleton.h" #include "Transmitter.h" enum DriveKeys @@ -41,38 +42,6 @@ enum AvatarMode NUM_AVATAR_MODES }; -enum AvatarJointID -{ - AVATAR_JOINT_NULL = -1, - AVATAR_JOINT_PELVIS, - AVATAR_JOINT_TORSO, - AVATAR_JOINT_CHEST, - AVATAR_JOINT_NECK_BASE, - AVATAR_JOINT_HEAD_BASE, - AVATAR_JOINT_HEAD_TOP, - AVATAR_JOINT_LEFT_COLLAR, - AVATAR_JOINT_LEFT_SHOULDER, - AVATAR_JOINT_LEFT_ELBOW, - AVATAR_JOINT_LEFT_WRIST, - AVATAR_JOINT_LEFT_FINGERTIPS, - AVATAR_JOINT_RIGHT_COLLAR, - AVATAR_JOINT_RIGHT_SHOULDER, - AVATAR_JOINT_RIGHT_ELBOW, - AVATAR_JOINT_RIGHT_WRIST, - AVATAR_JOINT_RIGHT_FINGERTIPS, - AVATAR_JOINT_LEFT_HIP, - AVATAR_JOINT_LEFT_KNEE, - AVATAR_JOINT_LEFT_HEEL, - AVATAR_JOINT_LEFT_TOES, - AVATAR_JOINT_RIGHT_HIP, - AVATAR_JOINT_RIGHT_KNEE, - AVATAR_JOINT_RIGHT_HEEL, - AVATAR_JOINT_RIGHT_TOES, - - NUM_AVATAR_JOINTS -}; - - class Avatar : public AvatarData { public: Avatar(Agent* owningAgent = NULL); @@ -95,7 +64,7 @@ public: void setMouseRay (const glm::vec3 &origin, const glm::vec3 &direction); //getters - float getLastMeasuredHeadYaw () const { return _head.yawRate;} + float getHeadYawRate () const { return _head.yawRate;} float getBodyYaw () const { return _bodyYaw;} bool getIsNearInteractingOther() const { return _avatarTouch.getAbleToReachOtherAvatar();} const glm::vec3& getHeadPosition () const { return _joint[ AVATAR_JOINT_HEAD_BASE ].position;} @@ -147,6 +116,7 @@ private: }; Head _head; + Skeleton _skeleton; float _TEST_bigSphereRadius; glm::vec3 _TEST_bigSpherePosition; bool _mousePressed;