mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 09:33:36 +02:00
fixed it so both leap hands produce particles
This commit is contained in:
parent
8a55db53ce
commit
fdebe166ba
3 changed files with 18 additions and 15 deletions
|
@ -32,7 +32,7 @@ Hand::Hand(Avatar* owningAvatar) :
|
|||
|
||||
{
|
||||
// initialize all finger particle emitters with an invalid id as default
|
||||
for (int f = 0; f< NUM_FINGERS_PER_HAND; f ++ ) {
|
||||
for (int f = 0; f< NUM_FINGERS; f ++ ) {
|
||||
_fingerParticleEmitter[f] = -1;
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ void Hand::setLeapHands(const std::vector<glm::vec3>& handPositions,
|
|||
void Hand::updateFingerParticleEmitters() {
|
||||
|
||||
if (_particleSystemInitialized) {
|
||||
|
||||
|
||||
int fingerIndex = 0;
|
||||
for (size_t i = 0; i < getNumPalms(); ++i) {
|
||||
PalmData& palm = getPalms()[i];
|
||||
|
@ -240,7 +240,7 @@ void Hand::updateFingerParticleEmitters() {
|
|||
for (size_t f = 0; f < palm.getNumFingers(); ++f) {
|
||||
FingerData& finger = palm.getFingers()[f];
|
||||
if (finger.isActive()) {
|
||||
if (_fingerParticleEmitter[fingerIndex] != -1) {
|
||||
if (_fingerParticleEmitter[0] != -1) {
|
||||
|
||||
glm::vec3 fingerDirection = finger.getTipPosition() - finger.getRootPosition();
|
||||
float fingerLength = glm::length(fingerDirection);
|
||||
|
@ -251,8 +251,9 @@ void Hand::updateFingerParticleEmitters() {
|
|||
fingerDirection = IDENTITY_UP;
|
||||
}
|
||||
|
||||
_particleSystem.setEmitterPosition (_fingerParticleEmitter[f], finger.getTipPosition());
|
||||
_particleSystem.setEmitterDirection(_fingerParticleEmitter[f], fingerDirection);
|
||||
_particleSystem.setEmitterPosition (_fingerParticleEmitter[fingerIndex], finger.getTipPosition());
|
||||
_particleSystem.setEmitterDirection(_fingerParticleEmitter[fingerIndex], fingerDirection);
|
||||
fingerIndex ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -262,14 +263,13 @@ void Hand::updateFingerParticleEmitters() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// call this from within the simulate method
|
||||
void Hand::updateFingerParticles(float deltaTime) {
|
||||
|
||||
if (!_particleSystemInitialized) {
|
||||
|
||||
// start up the rave glove finger particles...
|
||||
for ( int f = 0; f< NUM_FINGERS_PER_HAND; f ++ ) {
|
||||
for ( int f = 0; f< NUM_FINGERS; f ++ ) {
|
||||
_fingerParticleEmitter[f] = _particleSystem.addEmitter();
|
||||
assert( _fingerParticleEmitter[f] != -1 );
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void Hand::updateFingerParticles(float deltaTime) {
|
|||
|
||||
attributes.color = glm::vec4(red, green, blue, 1.0f);
|
||||
attributes.radius = 0.02f;
|
||||
for ( int f = 0; f< NUM_FINGERS_PER_HAND; f ++ ) {
|
||||
for ( int f = 0; f< NUM_FINGERS; f ++ ) {
|
||||
_particleSystem.setParticleAttributes(_fingerParticleEmitter[f], 0, attributes);
|
||||
_particleSystem.setParticleAttributes(_fingerParticleEmitter[f], 1, attributes);
|
||||
_particleSystem.setParticleAttributes(_fingerParticleEmitter[f], 2, attributes);
|
||||
|
@ -314,8 +314,9 @@ void Hand::updateFingerParticles(float deltaTime) {
|
|||
for (size_t f = 0; f < palm.getNumFingers(); ++f) {
|
||||
FingerData& finger = palm.getFingers()[f];
|
||||
if (finger.isActive()) {
|
||||
if (_fingerParticleEmitter[fingerIndex] != -1) {
|
||||
_particleSystem.emitNow(_fingerParticleEmitter[f]);
|
||||
if (_fingerParticleEmitter[0] != -1) {
|
||||
_particleSystem.emitNow(_fingerParticleEmitter[fingerIndex]);
|
||||
fingerIndex ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +331,7 @@ void Hand::setRaveGloveMode(int mode) {
|
|||
|
||||
_particleSystem.killAllParticles();
|
||||
|
||||
for ( int f = 0; f< NUM_FINGERS_PER_HAND; f ++ ) {
|
||||
for ( int f = 0; f< NUM_FINGERS; f ++ ) {
|
||||
|
||||
ParticleSystem::ParticleAttributes attributes;
|
||||
|
||||
|
|
|
@ -60,18 +60,17 @@ private:
|
|||
float _testRaveGloveClock;
|
||||
int _testRaveGloveMode;
|
||||
bool _particleSystemInitialized;
|
||||
int _fingerParticleEmitter[NUM_FINGERS_PER_HAND];
|
||||
int _fingerParticleEmitter[NUM_FINGERS];
|
||||
Avatar* _owningAvatar;
|
||||
float _renderAlpha;
|
||||
bool _lookingInMirror;
|
||||
bool _isRaveGloveActive;
|
||||
glm::vec3 _ballColor;
|
||||
std::vector<HandBall> _leapBalls;
|
||||
|
||||
std::vector<HandBall> _leapBalls;
|
||||
|
||||
// private methods
|
||||
void setLeapHands(const std::vector<glm::vec3>& handPositions,
|
||||
const std::vector<glm::vec3>& handNormals);
|
||||
const std::vector<glm::vec3>& handNormals);
|
||||
|
||||
void renderRaveGloveStage();
|
||||
void setRaveGloveMode(int mode);
|
||||
|
|
|
@ -19,7 +19,10 @@ class AvatarData;
|
|||
class FingerData;
|
||||
class PalmData;
|
||||
|
||||
const int NUM_HANDS = 2;
|
||||
const int NUM_FINGERS_PER_HAND = 5;
|
||||
const int NUM_FINGERS = NUM_HANDS * NUM_FINGERS_PER_HAND;
|
||||
|
||||
const int LEAPID_INVALID = -1;
|
||||
|
||||
class HandData {
|
||||
|
|
Loading…
Reference in a new issue