From d6efcce28e58dd90d787f81bb575214036c182c3 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 17 Dec 2013 11:08:38 -0800 Subject: [PATCH] Debugging render call for head/hand positions, debugging for ball injection --- interface/src/avatar/Hand.cpp | 12 +++++++++- interface/src/avatar/MyAvatar.cpp | 28 ++++++++++++++++++++++++ interface/src/avatar/MyAvatar.h | 1 + interface/src/devices/SixenseManager.cpp | 6 ----- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index cb2ccab1ae..d446c32469 100755 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -17,6 +17,8 @@ #include "Util.h" #include "renderer/ProgramObject.h" +//#define DEBUG_HAND + using namespace std; const float FINGERTIP_VOXEL_SIZE = 0.05; @@ -98,7 +100,9 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f glm::vec3 newVelocity = NO_VELOCITY; // update the particle with it's new state... +#ifdef DEBUG_HAND qDebug("Update caught particle!\n"); +#endif caughtParticle->updateParticle(newPosition, closestParticle->getRadius(), closestParticle->getXColor(), @@ -144,7 +148,9 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f // create the ball, call MakeParticle, and use the resulting ParticleEditHandle to // manage the newly created particle. // Create a particle on the particle server +#ifdef DEBUG_HAND qDebug("Created New Ball\n"); +#endif glm::vec3 ballPosition = ballFromHand ? palm.getPosition() : fingerTipPosition; _ballParticleEditHandles[handID] = Application::getInstance()->makeParticle( ballPosition / (float)TREE_SCALE, @@ -158,7 +164,9 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f } } else { // Ball is in hand - //qDebug("Ball in hand\n"); +#ifdef DEBUG_HAND + qDebug("Ball in hand\n"); +#endif glm::vec3 ballPosition = ballFromHand ? palm.getPosition() : fingerTipPosition; _ballParticleEditHandles[handID]->updateParticle(ballPosition / (float)TREE_SCALE, TOY_BALL_RADIUS / (float) TREE_SCALE, @@ -180,7 +188,9 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f ballVelocity = avatarRotation * ballVelocity; // ball is no longer in hand... +#ifdef DEBUG_HAND qDebug("Threw ball, v = %.3f\n", glm::length(ballVelocity)); +#endif _ballParticleEditHandles[handID]->updateParticle(ballPosition / (float)TREE_SCALE, TOY_BALL_RADIUS / (float) TREE_SCALE, TOY_BALL_ON_SERVER_COLOR[_whichBallColor[handID]], diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index e462426f2e..c668eb5956 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -426,6 +426,31 @@ static TextRenderer* textRenderer() { return renderer; } +void MyAvatar::renderDebugBodyPoints() { + glm::vec3 torsoPosition(getPosition()); + glm::vec3 headPosition(getHead().getEyePosition()); + float torsoToHead = glm::length(headPosition - torsoPosition); + glm::vec3 position; + printf("head-above-torso %.2f, scale = %0.2f\n", torsoToHead, getScale()); + + // Torso Sphere + position = torsoPosition; + glPushMatrix(); + glColor4f(0, 1, 0, .5f); + glTranslatef(position.x, position.y, position.z); + glutSolidSphere(0.2, 10, 10); + glPopMatrix(); + + // Head Sphere + position = headPosition; + glPushMatrix(); + glColor4f(0, 1, 0, .5f); + glTranslatef(position.x, position.y, position.z); + glutSolidSphere(0.15, 10, 10); + glPopMatrix(); + + +} void MyAvatar::render(bool forceRenderHead) { // render body @@ -438,6 +463,9 @@ void MyAvatar::render(bool forceRenderHead) { glPopMatrix(); } + //renderDebugBodyPoints(); + + if (!_chatMessage.empty()) { int width = 0; int lastWidth = 0; diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index df8ab4aa92..508f9ce5d2 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -30,6 +30,7 @@ public: void simulate(float deltaTime, Transmitter* transmitter); void updateFromGyrosAndOrWebcam(bool turnWithHead); void render(bool forceRenderHead); + void renderDebugBodyPoints(); // setters void setMousePressed(bool mousePressed) { _mousePressed = mousePressed; } diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index 3a5c2bf95c..36693000a9 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -79,12 +79,6 @@ void SixenseManager::update(float deltaTime) { palm->setTrigger(data.trigger); palm->setJoystick(data.joystick_x, data.joystick_y); - // Vibrate if needed - if (palm->getIsCollidingWithVoxel()) { - //printf("vibrate!\n"); - //vibrate(data.controller_index, 100, 1); - } - glm::vec3 position(data.pos[0], data.pos[1], data.pos[2]); // Adjust for distance between acquisition 'orb' and the user's torso // (distance to the right of body center, distance below torso, distance behind torso)