diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d6d28726f7..dc1222a36e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1953,6 +1953,7 @@ void Application::initMenu() { (_fullScreenMode = optionsMenu->addAction("Fullscreen", this, SLOT(setFullscreen(bool)), Qt::Key_F))->setCheckable(true); optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true); optionsMenu->addAction("Toggle Skeleton Tracking", &_webcam, SLOT(setSkeletonTrackingOn(bool)))->setCheckable(true); + (_wantCollisionsOn = optionsMenu->addAction("Turn collisions On", this, SLOT(toggleWantCollisionsOn())))->setCheckable(true); optionsMenu->addAction("Cycle Webcam Send Mode", _webcam.getGrabber(), SLOT(cycleVideoSendMode())); optionsMenu->addAction("Go Home", this, SLOT(goHome()), Qt::CTRL | Qt::Key_G); @@ -2146,6 +2147,10 @@ void Application::toggleMixedSong() { } } +void Application::toggleWantCollisionsOn() { + _myAvatar.setWantCollisionsOn(_wantCollisionsOn->isChecked()); +} + void Application::resetSongMixMenuItem() { if (_audio.getSongFileBytes() == 0) { _rawAudioMicrophoneMix->setText("Mix RAW Song"); @@ -2296,6 +2301,56 @@ void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& which renderCircle(haloOrigin, INDICATOR_RADIUS, IDENTITY_UP, NUM_SEGMENTS); } +void Application::renderFollowIndicator() { + NodeList* nodeList = NodeList::getInstance(); + + glLineWidth(5); + glBegin(GL_LINES); + for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); ++node) { + if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { + Avatar* avatar = (Avatar *) node->getLinkedData(); + Avatar* leader = NULL; + + if (avatar->getLeaderID() != UNKNOWN_NODE_ID) { + if (avatar->getLeaderID() == NodeList::getInstance()->getOwnerID()) { + leader = &_myAvatar; + } else { + for (NodeList::iterator it = nodeList->begin(); it != nodeList->end(); ++it) { + if(it->getNodeID() == avatar->getLeaderID() + && it->getType() == NODE_TYPE_AGENT) { + leader = (Avatar*) it->getLinkedData(); + } + } + } + + if (leader != NULL) { + glColor3f(1.f, 0.f, 0.f); + glVertex3f(avatar->getPosition().x, + avatar->getPosition().y, + avatar->getPosition().z); + glColor3f(0.f, 1.f, 0.f); + glVertex3f(leader->getPosition().x, + leader->getPosition().y, + leader->getPosition().z); + } + } + } + } + + if (_myAvatar.getLeadingAvatar() != NULL) { + glColor3f(1.f, 0.f, 0.f); + glVertex3f(_myAvatar.getPosition().x, + _myAvatar.getPosition().y, + _myAvatar.getPosition().z); + glColor3f(0.f, 1.f, 0.f); + glVertex3f(_myAvatar.getLeadingAvatar()->getPosition().x, + _myAvatar.getLeadingAvatar()->getPosition().y, + _myAvatar.getLeadingAvatar()->getPosition().z); + } + + glEnd(); +} + void Application::update(float deltaTime) { // Use Transmitter Hand to move hand if connected, else use mouse @@ -2529,8 +2584,6 @@ void Application::update(float deltaTime) { _myAvatar.simulate(deltaTime, NULL); } - _myAvatar.getHand().simulate(deltaTime, true); - if (!OculusManager::isConnected()) { if (_lookingInMirror->isChecked()) { if (_myCamera.getMode() != CAMERA_MODE_MIRROR) { @@ -2583,7 +2636,7 @@ void Application::update(float deltaTime) { if (_renderParticleSystemOn->isChecked()) { updateParticleSystem(deltaTime); - } + } } void Application::updateAvatar(float deltaTime) { @@ -2598,7 +2651,6 @@ void Application::updateAvatar(float deltaTime) { glm::vec3(_headCameraPitchYawScale, _headCameraPitchYawScale, _headCameraPitchYawScale), - 0.f, _pitchFromTouch); if (_serialHeadSensor.isActive()) { @@ -3082,6 +3134,7 @@ void Application::displaySide(Camera& whichCamera) { } } + renderFollowIndicator(); } void Application::displayOverlay() { diff --git a/interface/src/Application.h b/interface/src/Application.h index c4ae390797..e6abd5f8d9 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -184,6 +184,7 @@ private slots: void setListenModePoint(); void setListenModeSingleSource(); void toggleMixedSong(); + void toggleWantCollisionsOn(); void renderCoverageMap(); @@ -221,6 +222,7 @@ private: bool isLookingAtMyAvatar(Avatar* avatar); void renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera); + void renderFollowIndicator(); void updateAvatar(float deltaTime); void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum); @@ -299,6 +301,7 @@ private: QAction* _rawAudioMicrophoneMix; // Mixing of a RAW audio file with microphone stream for rave gloves QAction* _noise; QAction* _occlusionCulling; + QAction* _wantCollisionsOn; QAction* _renderCoverageMapV2; QAction* _renderCoverageMap; diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 26192ffe5a..c52e990605 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -295,8 +295,8 @@ void Avatar::reset() { // Update avatar head rotation with sensor data void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, const glm::vec3& amplifyAngle, - float yawFromTouch, float pitchFromTouch) { + _head.setMousePitch(pitchFromTouch); SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor(); Webcam* webcam = Application::getInstance()->getWebcam(); glm::vec3 estimatedPosition, estimatedRotation; @@ -308,7 +308,6 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, } else { _head.setPitch(pitchFromTouch); - _head.setYaw(yawFromTouch); return; } if (webcam->isActive()) { @@ -334,8 +333,8 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, } else { _head.getFace().clearFrame(); } - _head.setPitch(estimatedRotation.x * amplifyAngle.x + pitchFromTouch); - _head.setYaw(estimatedRotation.y * amplifyAngle.y + yawFromTouch); + _head.setPitch(estimatedRotation.x * amplifyAngle.x); + _head.setYaw(estimatedRotation.y * amplifyAngle.y); _head.setRoll(estimatedRotation.z * amplifyAngle.z); _head.setCameraFollowsHead(gyroLook); @@ -493,10 +492,13 @@ void Avatar::follow(Avatar* leadingAvatar) { _leadingAvatar = leadingAvatar; if (_leadingAvatar != NULL) { + _leaderID = leadingAvatar->getOwningNode()->getNodeID(); _stringLength = glm::length(_position - _leadingAvatar->getPosition()) / _scale; if (_stringLength > MAX_STRING_LENGTH) { _stringLength = MAX_STRING_LENGTH; } + } else { + _leaderID = UNKNOWN_NODE_ID; } } @@ -623,9 +625,12 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) { _velocity += _scale * _gravity * (GRAVITY_EARTH * deltaTime); } } - updateCollisionWithEnvironment(deltaTime); - updateCollisionWithVoxels(deltaTime); - updateAvatarCollisions(deltaTime); + + if (_isCollisionsOn) { + updateCollisionWithEnvironment(deltaTime); + updateCollisionWithVoxels(deltaTime); + updateAvatarCollisions(deltaTime); + } } // update body balls @@ -633,7 +638,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) { // test for avatar collision response with the big sphere - if (usingBigSphereCollisionTest) { + if (usingBigSphereCollisionTest && _isCollisionsOn) { updateCollisionWithSphere(_TEST_bigSpherePosition, _TEST_bigSphereRadius, deltaTime); } @@ -748,6 +753,8 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) { _head.setScale(_scale); _head.setSkinColor(glm::vec3(SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2])); _head.simulate(deltaTime, isMyAvatar()); + _hand.simulate(deltaTime, isMyAvatar()); + @@ -1372,6 +1379,17 @@ void Avatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) { for (int b = 0; b < NUM_AVATAR_BODY_BALLS; b++) { float alpha = getBallRenderAlpha(b, lookingInMirror); + // When in rave glove mode, don't show the arms at all. + if (_hand.isRaveGloveActive()) { + if (b == BODY_BALL_LEFT_ELBOW + || b == BODY_BALL_LEFT_WRIST + || b == BODY_BALL_LEFT_FINGERTIPS + || b == BODY_BALL_RIGHT_ELBOW + || b == BODY_BALL_RIGHT_WRIST + || b == BODY_BALL_RIGHT_FINGERTIPS) { + continue; + } + } // Always render other people, and render myself when beyond threshold distance if (b == BODY_BALL_HEAD_BASE) { // the head is rendered as a special if (alpha > 0.0f) { diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index b490429ec9..69629f1b83 100755 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -27,7 +27,7 @@ #include "world.h" -static const float MAX_SCALE = 5.f; +static const float MAX_SCALE = 10.f; static const float MIN_SCALE = .5f; static const float SCALING_RATIO = .05f; static const float SMOOTHING_RATIO = .05f; // 0 < ratio < 1 @@ -124,7 +124,6 @@ public: void follow(Avatar* leadingAvatar); void updateFromGyrosAndOrWebcam(bool gyroLook, const glm::vec3& amplifyAngle, - float yawFromTouch, float pitchFromTouch); void addBodyYaw(float bodyYaw) {_bodyYaw += bodyYaw;}; void addBodyYawDelta(float bodyYawDelta) {_bodyYawDelta += bodyYawDelta;} @@ -142,6 +141,7 @@ public: void setMouseRay (const glm::vec3 &origin, const glm::vec3 &direction); void setOrientation (const glm::quat& orientation); void setNewScale (const float scale); + void setWantCollisionsOn (bool wantCollisionsOn ) { _isCollisionsOn = wantCollisionsOn; } //getters bool isInitialized () const { return _initialized;} @@ -263,6 +263,7 @@ private: glm::vec3 _lastCollisionPosition; bool _speedBrakes; bool _isThrustOn; + bool _isCollisionsOn; Avatar* _leadingAvatar; float _stringLength; diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index bf09096d7f..b960f8e56b 100755 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -42,6 +42,9 @@ void Hand::init() { else { _ballColor = glm::vec3(0.0, 0.0, 0.4); } + + _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_FIRE; + _raveGloveEffectsModeChanged = false; } void Hand::reset() { @@ -51,15 +54,20 @@ void Hand::reset() { void Hand::simulate(float deltaTime, bool isMine) { if (_isRaveGloveActive) { + if (_raveGloveEffectsModeChanged && _raveGloveInitialized) { + activateNewRaveGloveMode(); + _raveGloveEffectsModeChanged = false; + } + updateRaveGloveParticles(deltaTime); } } void Hand::calculateGeometry() { - glm::vec3 offset(0.2, -0.2, -0.3); // place the hand in front of the face where we can see it + const glm::vec3 leapHandsOffsetFromFace(0.0, -0.2, -0.3); // place the hand in front of the face where we can see it Head& head = _owningAvatar->getHead(); - _basePosition = head.getPosition() + head.getOrientation() * offset; + _basePosition = head.getPosition() + head.getOrientation() * leapHandsOffsetFromFace; _baseOrientation = head.getOrientation(); // generate finger tip balls.... @@ -106,18 +114,21 @@ void Hand::calculateGeometry() { } void Hand::setRaveGloveEffectsMode(QKeyEvent* event) { + + _raveGloveEffectsModeChanged = true; + switch (event->key()) { - case Qt::Key_0: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_THROBBING_COLOR); break; - case Qt::Key_1: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_TRAILS ); break; - case Qt::Key_2: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_FIRE ); break; - case Qt::Key_3: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_WATER ); break; - case Qt::Key_4: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_FLASHY ); break; - case Qt::Key_5: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_BOZO_SPARKLER ); break; - case Qt::Key_6: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_LONG_SPARKLER ); break; - case Qt::Key_7: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_SNAKE ); break; - case Qt::Key_8: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_PULSE ); break; - case Qt::Key_9: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_THROB ); break; + case Qt::Key_0: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_THROBBING_COLOR; break; + case Qt::Key_1: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_TRAILS; break; + case Qt::Key_2: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_FIRE; break; + case Qt::Key_3: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_WATER; break; + case Qt::Key_4: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_FLASHY; break; + case Qt::Key_5: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_BOZO_SPARKLER; break; + case Qt::Key_6: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_LONG_SPARKLER; break; + case Qt::Key_7: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_SNAKE; break; + case Qt::Key_8: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_PULSE; break; + case Qt::Key_9: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_THROB; break; }; } @@ -129,7 +140,8 @@ void Hand::render(bool lookingInMirror) { calculateGeometry(); if (_isRaveGloveActive) { - renderRaveGloveStage(); + // Disable raveGloveStage while we work on the network glove features + // renderRaveGloveStage(); if (_raveGloveInitialized) { updateRaveGloveEmitters(); // do this after calculateGeometry @@ -142,8 +154,10 @@ void Hand::render(bool lookingInMirror) { if ( SHOW_LEAP_HAND ) { //renderLeapHands(); - renderLeapFingerTrails(); - renderLeapHandSpheres(); + if (!isRaveGloveActive()) { + renderLeapFingerTrails(); + renderLeapHandSpheres(); + } } } @@ -340,6 +354,7 @@ void Hand::updateRaveGloveParticles(float deltaTime) { } setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_FIRE); + activateNewRaveGloveMode(); _raveGloveParticleSystem.setUpDirection(glm::vec3(0.0f, 1.0f, 0.0f)); _raveGloveInitialized = true; } else { @@ -347,12 +362,14 @@ void Hand::updateRaveGloveParticles(float deltaTime) { } } +// The rave glove mode has changed, so activate the effects. +void Hand::activateNewRaveGloveMode() { - -void Hand::setRaveGloveMode(int mode) { - - _raveGloveMode = mode; - + if (!_raveGloveInitialized) { + return; + } + + int mode = _raveGloveEffectsMode; _raveGloveParticleSystem.killAllParticles(); for ( int f = 0; f< NUM_FINGERS; f ++ ) { diff --git a/interface/src/avatar/Hand.h b/interface/src/avatar/Hand.h index 39845141aa..d2a36b97b1 100755 --- a/interface/src/avatar/Hand.h +++ b/interface/src/avatar/Hand.h @@ -72,8 +72,9 @@ private: void setLeapHands(const std::vector& handPositions, const std::vector& handNormals); + void activateNewRaveGloveMode(); + void renderRaveGloveStage(); - virtual void setRaveGloveMode(int mode); void renderLeapHandSpheres(); void renderLeapHands(); void renderLeapHand(PalmData& hand); diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index b88802b7f1..6cdb69fe5e 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -84,6 +84,7 @@ Head::Head(Avatar* owningAvatar) : _rightEyeBlinkVelocity(0.0f), _timeWithoutTalking(0.0f), _cameraPitch(_pitch), + _mousePitch(0.f), _cameraYaw(_yaw), _isCameraMoving(false), _cameraFollowsHead(false), @@ -338,7 +339,7 @@ void Head::setScale (float scale) { } void Head::createMohawk() { - uint16_t nodeId = 0; + uint16_t nodeId = UNKNOWN_NODE_ID; if (_owningAvatar->getOwningNode()) { nodeId = _owningAvatar->getOwningNode()->getNodeID(); } else { @@ -428,7 +429,7 @@ glm::quat Head::getOrientation() const { glm::quat Head::getCameraOrientation () const { Avatar* owningAvatar = static_cast(_owningAvatar); return owningAvatar->getWorldAlignedOrientation() - * glm::quat(glm::radians(glm::vec3(_cameraPitch, _cameraYaw, 0.0f))); + * glm::quat(glm::radians(glm::vec3(_cameraPitch + _mousePitch, _cameraYaw, 0.0f))); } void Head::renderHeadSphere() { diff --git a/interface/src/avatar/Head.h b/interface/src/avatar/Head.h index 1256b05bb7..f31bc53f2a 100644 --- a/interface/src/avatar/Head.h +++ b/interface/src/avatar/Head.h @@ -57,6 +57,8 @@ public: void setCameraFollowsHead(bool cameraFollowsHead) { _cameraFollowsHead = cameraFollowsHead; } + void setMousePitch(float mousePitch) { _mousePitch = mousePitch; } + glm::quat getOrientation() const; glm::quat getCameraOrientation () const; @@ -123,6 +125,7 @@ private: float _rightEyeBlinkVelocity; float _timeWithoutTalking; float _cameraPitch; // Used to position the camera differently from the head + float _mousePitch; float _cameraYaw; bool _isCameraMoving; bool _cameraFollowsHead; diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 1dd6a0787b..6d5d0a6528 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -41,7 +41,8 @@ AvatarData::AvatarData(Node* owningNode) : _wantLowResMoving(false), _wantOcclusionCulling(true), _headData(NULL), - _handData(NULL) + _handData(NULL), + _leaderID(UNKNOWN_NODE_ID) { } @@ -91,8 +92,14 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) { destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyYaw); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyPitch); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyRoll); + + // Body scale destinationBuffer += packFloatRatioToTwoByte(destinationBuffer, _newScale); + // Follow mode info + memcpy(destinationBuffer, &_leaderID, sizeof(uint16_t)); + destinationBuffer += sizeof(uint16_t); + // Head rotation (NOTE: This needs to become a quaternion to save two bytes) destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_yaw); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_pitch); @@ -188,8 +195,14 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) { sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyYaw); sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyPitch); sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyRoll); + + // Body scale sourceBuffer += unpackFloatRatioFromTwoByte( sourceBuffer, _newScale); + // Follow mode info + memcpy(&_leaderID, sourceBuffer, sizeof(uint16_t)); + sourceBuffer += sizeof(uint16_t); + // Head rotation (NOTE: This needs to become a quaternion to save two bytes) float headYaw, headPitch, headRoll; sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &headYaw); diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index a9e14caaa6..bdcf74904e 100755 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -92,10 +92,11 @@ public: const std::string& chatMessage () const { return _chatMessage; } // related to Voxel Sending strategies - bool getWantColor() const { return _wantColor; } - bool getWantDelta() const { return _wantDelta; } - bool getWantLowResMoving() const { return _wantLowResMoving; } + bool getWantColor() const { return _wantColor; } + bool getWantDelta() const { return _wantDelta; } + bool getWantLowResMoving() const { return _wantLowResMoving; } bool getWantOcclusionCulling() const { return _wantOcclusionCulling; } + uint16_t getLeaderID() const { return _leaderID; } void setWantColor(bool wantColor) { _wantColor = wantColor; } void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; } @@ -118,8 +119,13 @@ protected: float _bodyYaw; float _bodyPitch; float _bodyRoll; + + // Body scale float _newScale; + // Following mode infos + uint16_t _leaderID; + // Hand state (are we grabbing something or not) char _handState; diff --git a/libraries/avatars/src/HandData.cpp b/libraries/avatars/src/HandData.cpp index 644a0764b7..2f6e8aa560 100644 --- a/libraries/avatars/src/HandData.cpp +++ b/libraries/avatars/src/HandData.cpp @@ -20,7 +20,8 @@ HandData::HandData(AvatarData* owningAvatar) : _baseOrientation(0.0f, 0.0f, 0.0f, 1.0f), _owningAvatarData(owningAvatar), _isRaveGloveActive(false), - _raveGloveMode(RAVE_GLOVE_EFFECTS_MODE_THROBBING_COLOR) + _raveGloveEffectsMode(RAVE_GLOVE_EFFECTS_MODE_THROBBING_COLOR), + _raveGloveEffectsModeChanged(false) { // Start with two palms addNewPalm(); @@ -160,8 +161,9 @@ int HandData::decodeRemoteData(unsigned char* sourceBuffer) { } setRaveGloveActive((gloveFlags & GLOVE_FLAG_RAVE) != 0); -// This is disabled for crash tracing. -// setRaveGloveMode(effectsMode); + if (numHands > 0) { + setRaveGloveMode(effectsMode); + } // One byte for error checking safety. unsigned char requiredLength = (unsigned char)(sourceBuffer - startPosition); @@ -171,6 +173,13 @@ int HandData::decodeRemoteData(unsigned char* sourceBuffer) { return sourceBuffer - startPosition; } +void HandData::setRaveGloveMode(int effectsMode) { + if (effectsMode != _raveGloveEffectsMode) { + _raveGloveEffectsModeChanged = true; + } + _raveGloveEffectsMode = effectsMode; +} + void HandData::setFingerTrailLength(unsigned int length) { for (size_t i = 0; i < getNumPalms(); ++i) { PalmData& palm = getPalms()[i]; diff --git a/libraries/avatars/src/HandData.h b/libraries/avatars/src/HandData.h index fd820bccc0..c871c568bb 100755 --- a/libraries/avatars/src/HandData.h +++ b/libraries/avatars/src/HandData.h @@ -70,9 +70,9 @@ public: int decodeRemoteData(unsigned char* sourceBuffer); void setRaveGloveActive(bool active) { _isRaveGloveActive = active; } - virtual void setRaveGloveMode(int effectsMode) { _raveGloveMode = effectsMode; } + void setRaveGloveMode(int effectsMode); bool isRaveGloveActive() const { return _isRaveGloveActive; } - int getRaveGloveMode() { return _raveGloveMode; } + int getRaveGloveMode() { return _raveGloveEffectsMode; } friend class AvatarData; protected: @@ -81,7 +81,8 @@ protected: AvatarData* _owningAvatarData; std::vector _palms; bool _isRaveGloveActive; - int _raveGloveMode; + int _raveGloveEffectsMode; + bool _raveGloveEffectsModeChanged; private: // privatize copy ctor and assignment operator so copies of this object cannot be made HandData(const HandData&); diff --git a/libraries/shared/src/NodeList.h b/libraries/shared/src/NodeList.h index 804717dc66..c2b966b879 100644 --- a/libraries/shared/src/NodeList.h +++ b/libraries/shared/src/NodeList.h @@ -74,7 +74,7 @@ public: void setDomainIPToLocalhost(); uint16_t getLastNodeID() const { return _lastNodeID; } - void increaseNodeID() { ++_lastNodeID; } + void increaseNodeID() { (++_lastNodeID == UNKNOWN_NODE_ID) ? ++_lastNodeID : _lastNodeID; } uint16_t getOwnerID() const { return _ownerID; } void setOwnerID(uint16_t ownerID) { _ownerID = ownerID; } diff --git a/libraries/shared/src/PacketHeaders.cpp b/libraries/shared/src/PacketHeaders.cpp index 04b13c8ccd..e8a459d633 100644 --- a/libraries/shared/src/PacketHeaders.cpp +++ b/libraries/shared/src/PacketHeaders.cpp @@ -20,7 +20,7 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) { return 1; case PACKET_TYPE_HEAD_DATA: - return 3; + return 4; case PACKET_TYPE_AVATAR_FACE_VIDEO: return 1;