Debugging render call for head/hand positions, debugging for ball injection

This commit is contained in:
Philip Rosedale 2013-12-17 11:08:38 -08:00
parent fc28034f37
commit d6efcce28e
4 changed files with 40 additions and 7 deletions

View file

@ -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]],

View file

@ -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;

View file

@ -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; }

View file

@ -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)