mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:58:27 +02:00
Debugging render call for head/hand positions, debugging for ball injection
This commit is contained in:
parent
fc28034f37
commit
d6efcce28e
4 changed files with 40 additions and 7 deletions
|
@ -17,6 +17,8 @@
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "renderer/ProgramObject.h"
|
#include "renderer/ProgramObject.h"
|
||||||
|
|
||||||
|
//#define DEBUG_HAND
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
const float FINGERTIP_VOXEL_SIZE = 0.05;
|
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;
|
glm::vec3 newVelocity = NO_VELOCITY;
|
||||||
|
|
||||||
// update the particle with it's new state...
|
// update the particle with it's new state...
|
||||||
|
#ifdef DEBUG_HAND
|
||||||
qDebug("Update caught particle!\n");
|
qDebug("Update caught particle!\n");
|
||||||
|
#endif
|
||||||
caughtParticle->updateParticle(newPosition,
|
caughtParticle->updateParticle(newPosition,
|
||||||
closestParticle->getRadius(),
|
closestParticle->getRadius(),
|
||||||
closestParticle->getXColor(),
|
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
|
// create the ball, call MakeParticle, and use the resulting ParticleEditHandle to
|
||||||
// manage the newly created particle.
|
// manage the newly created particle.
|
||||||
// Create a particle on the particle server
|
// Create a particle on the particle server
|
||||||
|
#ifdef DEBUG_HAND
|
||||||
qDebug("Created New Ball\n");
|
qDebug("Created New Ball\n");
|
||||||
|
#endif
|
||||||
glm::vec3 ballPosition = ballFromHand ? palm.getPosition() : fingerTipPosition;
|
glm::vec3 ballPosition = ballFromHand ? palm.getPosition() : fingerTipPosition;
|
||||||
_ballParticleEditHandles[handID] = Application::getInstance()->makeParticle(
|
_ballParticleEditHandles[handID] = Application::getInstance()->makeParticle(
|
||||||
ballPosition / (float)TREE_SCALE,
|
ballPosition / (float)TREE_SCALE,
|
||||||
|
@ -158,7 +164,9 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ball is in hand
|
// 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;
|
glm::vec3 ballPosition = ballFromHand ? palm.getPosition() : fingerTipPosition;
|
||||||
_ballParticleEditHandles[handID]->updateParticle(ballPosition / (float)TREE_SCALE,
|
_ballParticleEditHandles[handID]->updateParticle(ballPosition / (float)TREE_SCALE,
|
||||||
TOY_BALL_RADIUS / (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;
|
ballVelocity = avatarRotation * ballVelocity;
|
||||||
|
|
||||||
// ball is no longer in hand...
|
// ball is no longer in hand...
|
||||||
|
#ifdef DEBUG_HAND
|
||||||
qDebug("Threw ball, v = %.3f\n", glm::length(ballVelocity));
|
qDebug("Threw ball, v = %.3f\n", glm::length(ballVelocity));
|
||||||
|
#endif
|
||||||
_ballParticleEditHandles[handID]->updateParticle(ballPosition / (float)TREE_SCALE,
|
_ballParticleEditHandles[handID]->updateParticle(ballPosition / (float)TREE_SCALE,
|
||||||
TOY_BALL_RADIUS / (float) TREE_SCALE,
|
TOY_BALL_RADIUS / (float) TREE_SCALE,
|
||||||
TOY_BALL_ON_SERVER_COLOR[_whichBallColor[handID]],
|
TOY_BALL_ON_SERVER_COLOR[_whichBallColor[handID]],
|
||||||
|
|
|
@ -426,6 +426,31 @@ static TextRenderer* textRenderer() {
|
||||||
return renderer;
|
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) {
|
void MyAvatar::render(bool forceRenderHead) {
|
||||||
|
|
||||||
// render body
|
// render body
|
||||||
|
@ -438,6 +463,9 @@ void MyAvatar::render(bool forceRenderHead) {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//renderDebugBodyPoints();
|
||||||
|
|
||||||
|
|
||||||
if (!_chatMessage.empty()) {
|
if (!_chatMessage.empty()) {
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int lastWidth = 0;
|
int lastWidth = 0;
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
void simulate(float deltaTime, Transmitter* transmitter);
|
void simulate(float deltaTime, Transmitter* transmitter);
|
||||||
void updateFromGyrosAndOrWebcam(bool turnWithHead);
|
void updateFromGyrosAndOrWebcam(bool turnWithHead);
|
||||||
void render(bool forceRenderHead);
|
void render(bool forceRenderHead);
|
||||||
|
void renderDebugBodyPoints();
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
void setMousePressed(bool mousePressed) { _mousePressed = mousePressed; }
|
void setMousePressed(bool mousePressed) { _mousePressed = mousePressed; }
|
||||||
|
|
|
@ -79,12 +79,6 @@ void SixenseManager::update(float deltaTime) {
|
||||||
palm->setTrigger(data.trigger);
|
palm->setTrigger(data.trigger);
|
||||||
palm->setJoystick(data.joystick_x, data.joystick_y);
|
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]);
|
glm::vec3 position(data.pos[0], data.pos[1], data.pos[2]);
|
||||||
// Adjust for distance between acquisition 'orb' and the user's torso
|
// Adjust for distance between acquisition 'orb' and the user's torso
|
||||||
// (distance to the right of body center, distance below torso, distance behind torso)
|
// (distance to the right of body center, distance below torso, distance behind torso)
|
||||||
|
|
Loading…
Reference in a new issue