mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 00:56:48 +02:00
toggle debug print statements for Leap fingers
This commit is contained in:
parent
0aaeb4550a
commit
5b1ba56d67
2 changed files with 51 additions and 15 deletions
|
@ -80,9 +80,7 @@ void ParticleSystem::simulate(float deltaTime) {
|
|||
assert(_emitter[e].rate >= 0);
|
||||
|
||||
_emitter[e].emitReserve += _emitter[e].rate * deltaTime;
|
||||
|
||||
_emitter[e].numParticlesEmittedThisTime = (int)_emitter[e].emitReserve;
|
||||
|
||||
_emitter[e].emitReserve -= _emitter[e].numParticlesEmittedThisTime;
|
||||
|
||||
for (int p = 0; p < _emitter[e].numParticlesEmittedThisTime; p++) {
|
||||
|
@ -114,8 +112,8 @@ void ParticleSystem::createParticle(int e, float timeFraction) {
|
|||
_particle[p].age = 0.0f;
|
||||
_particle[p].velocity = _emitter[e].direction * _emitter[e].thrust;
|
||||
_particle[p].position = _emitter[e].previousPosition + timeFraction * (_emitter[e].position - _emitter[e].previousPosition);
|
||||
_particle[p].radius = _emitter[e].particleAttributes[0].radius;
|
||||
_particle[p].color = _emitter[e].particleAttributes[0].color;
|
||||
_particle[p].radius = _emitter[e].particleAttributes[PARTICLE_LIFESTAGE_0].radius;
|
||||
_particle[p].color = _emitter[e].particleAttributes[PARTICLE_LIFESTAGE_0].color;
|
||||
_particle[p].previousParticle = NULL_PARTICLE;
|
||||
|
||||
if (_particle[_emitter[e].currentParticle].alive) {
|
||||
|
@ -142,6 +140,8 @@ void ParticleSystem::killParticle(int p) {
|
|||
_particle[p].velocity = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
_particle[p].age = 0.0f;
|
||||
_particle[p].emitterIndex = NULL_PARTICLE;
|
||||
_particle[p].color = glm::vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
_particle[p].radius = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "Util.h"
|
||||
#include "renderer/ProgramObject.h"
|
||||
|
||||
const bool SHOW_LEAP_HAND = false;
|
||||
const bool SHOW_LEAP_HAND = true;
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -246,17 +246,42 @@ void Hand::setLeapHands(const std::vector<glm::vec3>& handPositions,
|
|||
// call this right after the geometry of the leap hands are set
|
||||
void Hand::updateRaveGloveEmitters() {
|
||||
|
||||
bool debug = false;
|
||||
|
||||
if (_raveGloveInitialized) {
|
||||
|
||||
int fingerIndex = 0;
|
||||
|
||||
if(debug) printf( "\n" );
|
||||
if(debug) printf( "------------------------------------\n" );
|
||||
if(debug) printf( "updating rave glove emitters:\n" );
|
||||
if(debug) printf( "------------------------------------\n" );
|
||||
|
||||
int emitterIndex = 0;
|
||||
|
||||
for (size_t i = 0; i < getNumPalms(); ++i) {
|
||||
PalmData& palm = getPalms()[i];
|
||||
|
||||
if(debug) printf( "\n" );
|
||||
if(debug) printf( "palm %d ", (int)i );
|
||||
|
||||
if (palm.isActive()) {
|
||||
|
||||
if(debug) printf( "is active\n" );
|
||||
|
||||
for (size_t f = 0; f < palm.getNumFingers(); ++f) {
|
||||
FingerData& finger = palm.getFingers()[f];
|
||||
|
||||
if(debug) printf( "emitterIndex %d: ", emitterIndex );
|
||||
|
||||
if (finger.isActive()) {
|
||||
if (_raveGloveEmitter[0] != NULL_EMITTER) {
|
||||
|
||||
|
||||
if ((emitterIndex >=0)
|
||||
&& (emitterIndex < NUM_FINGERS)) {
|
||||
|
||||
assert(emitterIndex >=0 );
|
||||
assert(emitterIndex < NUM_FINGERS );
|
||||
|
||||
if(debug) printf( "_raveGloveEmitter[%d] = %d\n", emitterIndex, _raveGloveEmitter[emitterIndex] );
|
||||
|
||||
glm::vec3 fingerDirection = finger.getTipPosition() - finger.getRootPosition();
|
||||
float fingerLength = glm::length(fingerDirection);
|
||||
|
||||
|
@ -266,15 +291,20 @@ void Hand::updateRaveGloveEmitters() {
|
|||
fingerDirection = IDENTITY_UP;
|
||||
}
|
||||
|
||||
assert(_raveGloveEmitter[fingerIndex] >=0 );
|
||||
assert(_raveGloveEmitter[fingerIndex] < NUM_FINGERS );
|
||||
assert(_raveGloveEmitter[emitterIndex] >=0 );
|
||||
assert(_raveGloveEmitter[emitterIndex] < NUM_FINGERS );
|
||||
|
||||
_raveGloveParticleSystem.setEmitterPosition (_raveGloveEmitter[fingerIndex], finger.getTipPosition());
|
||||
_raveGloveParticleSystem.setEmitterDirection(_raveGloveEmitter[fingerIndex], fingerDirection);
|
||||
fingerIndex ++;
|
||||
}
|
||||
_raveGloveParticleSystem.setEmitterPosition (_raveGloveEmitter[emitterIndex], finger.getTipPosition());
|
||||
_raveGloveParticleSystem.setEmitterDirection(_raveGloveEmitter[emitterIndex], fingerDirection);
|
||||
}
|
||||
} else {
|
||||
if(debug) printf( "BOGUS finger\n" );
|
||||
}
|
||||
|
||||
emitterIndex ++;
|
||||
}
|
||||
} else {
|
||||
if(debug) printf( "is NOT active\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -286,10 +316,16 @@ void Hand::updateRaveGloveParticles(float deltaTime) {
|
|||
|
||||
if (!_raveGloveInitialized) {
|
||||
|
||||
//printf( "Initializing rave glove emitters:\n" );
|
||||
//printf( "The indices of the emitters are:\n" );
|
||||
|
||||
// start up the rave glove finger particles...
|
||||
for ( int f = 0; f< NUM_FINGERS; f ++ ) {
|
||||
_raveGloveEmitter[f] = _raveGloveParticleSystem.addEmitter();
|
||||
assert( _raveGloveEmitter[f] >= 0 );
|
||||
assert( _raveGloveEmitter[f] != NULL_EMITTER );
|
||||
|
||||
//printf( "%d\n", _raveGloveEmitter[f] );
|
||||
}
|
||||
|
||||
setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_2);
|
||||
|
|
Loading…
Reference in a new issue