Merge branch 'master' of https://github.com/worklist/hifi into multiple_voxel_servers

Conflicts:
	interface/src/Application.cpp
This commit is contained in:
ZappoMan 2013-08-06 13:49:42 -07:00
commit 6cf87fc120
14 changed files with 175 additions and 49 deletions

View file

@ -1953,6 +1953,7 @@ void Application::initMenu() {
(_fullScreenMode = optionsMenu->addAction("Fullscreen", this, SLOT(setFullscreen(bool)), Qt::Key_F))->setCheckable(true); (_fullScreenMode = optionsMenu->addAction("Fullscreen", this, SLOT(setFullscreen(bool)), Qt::Key_F))->setCheckable(true);
optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true); optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true);
optionsMenu->addAction("Toggle Skeleton Tracking", &_webcam, SLOT(setSkeletonTrackingOn(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("Cycle Webcam Send Mode", _webcam.getGrabber(), SLOT(cycleVideoSendMode()));
optionsMenu->addAction("Go Home", this, SLOT(goHome()), Qt::CTRL | Qt::Key_G); 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() { void Application::resetSongMixMenuItem() {
if (_audio.getSongFileBytes() == 0) { if (_audio.getSongFileBytes() == 0) {
_rawAudioMicrophoneMix->setText("Mix RAW Song"); _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); 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) { void Application::update(float deltaTime) {
// Use Transmitter Hand to move hand if connected, else use mouse // 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.simulate(deltaTime, NULL);
} }
_myAvatar.getHand().simulate(deltaTime, true);
if (!OculusManager::isConnected()) { if (!OculusManager::isConnected()) {
if (_lookingInMirror->isChecked()) { if (_lookingInMirror->isChecked()) {
if (_myCamera.getMode() != CAMERA_MODE_MIRROR) { if (_myCamera.getMode() != CAMERA_MODE_MIRROR) {
@ -2583,7 +2636,7 @@ void Application::update(float deltaTime) {
if (_renderParticleSystemOn->isChecked()) { if (_renderParticleSystemOn->isChecked()) {
updateParticleSystem(deltaTime); updateParticleSystem(deltaTime);
} }
} }
void Application::updateAvatar(float deltaTime) { void Application::updateAvatar(float deltaTime) {
@ -2598,7 +2651,6 @@ void Application::updateAvatar(float deltaTime) {
glm::vec3(_headCameraPitchYawScale, glm::vec3(_headCameraPitchYawScale,
_headCameraPitchYawScale, _headCameraPitchYawScale,
_headCameraPitchYawScale), _headCameraPitchYawScale),
0.f,
_pitchFromTouch); _pitchFromTouch);
if (_serialHeadSensor.isActive()) { if (_serialHeadSensor.isActive()) {
@ -3082,6 +3134,7 @@ void Application::displaySide(Camera& whichCamera) {
} }
} }
renderFollowIndicator();
} }
void Application::displayOverlay() { void Application::displayOverlay() {

View file

@ -184,6 +184,7 @@ private slots:
void setListenModePoint(); void setListenModePoint();
void setListenModeSingleSource(); void setListenModeSingleSource();
void toggleMixedSong(); void toggleMixedSong();
void toggleWantCollisionsOn();
void renderCoverageMap(); void renderCoverageMap();
@ -221,6 +222,7 @@ private:
bool isLookingAtMyAvatar(Avatar* avatar); bool isLookingAtMyAvatar(Avatar* avatar);
void renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera); void renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera);
void renderFollowIndicator();
void updateAvatar(float deltaTime); void updateAvatar(float deltaTime);
void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum); 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* _rawAudioMicrophoneMix; // Mixing of a RAW audio file with microphone stream for rave gloves
QAction* _noise; QAction* _noise;
QAction* _occlusionCulling; QAction* _occlusionCulling;
QAction* _wantCollisionsOn;
QAction* _renderCoverageMapV2; QAction* _renderCoverageMapV2;
QAction* _renderCoverageMap; QAction* _renderCoverageMap;

View file

@ -295,8 +295,8 @@ void Avatar::reset() {
// Update avatar head rotation with sensor data // Update avatar head rotation with sensor data
void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook,
const glm::vec3& amplifyAngle, const glm::vec3& amplifyAngle,
float yawFromTouch,
float pitchFromTouch) { float pitchFromTouch) {
_head.setMousePitch(pitchFromTouch);
SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor(); SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor();
Webcam* webcam = Application::getInstance()->getWebcam(); Webcam* webcam = Application::getInstance()->getWebcam();
glm::vec3 estimatedPosition, estimatedRotation; glm::vec3 estimatedPosition, estimatedRotation;
@ -308,7 +308,6 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook,
} else { } else {
_head.setPitch(pitchFromTouch); _head.setPitch(pitchFromTouch);
_head.setYaw(yawFromTouch);
return; return;
} }
if (webcam->isActive()) { if (webcam->isActive()) {
@ -334,8 +333,8 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook,
} else { } else {
_head.getFace().clearFrame(); _head.getFace().clearFrame();
} }
_head.setPitch(estimatedRotation.x * amplifyAngle.x + pitchFromTouch); _head.setPitch(estimatedRotation.x * amplifyAngle.x);
_head.setYaw(estimatedRotation.y * amplifyAngle.y + yawFromTouch); _head.setYaw(estimatedRotation.y * amplifyAngle.y);
_head.setRoll(estimatedRotation.z * amplifyAngle.z); _head.setRoll(estimatedRotation.z * amplifyAngle.z);
_head.setCameraFollowsHead(gyroLook); _head.setCameraFollowsHead(gyroLook);
@ -493,10 +492,13 @@ void Avatar::follow(Avatar* leadingAvatar) {
_leadingAvatar = leadingAvatar; _leadingAvatar = leadingAvatar;
if (_leadingAvatar != NULL) { if (_leadingAvatar != NULL) {
_leaderID = leadingAvatar->getOwningNode()->getNodeID();
_stringLength = glm::length(_position - _leadingAvatar->getPosition()) / _scale; _stringLength = glm::length(_position - _leadingAvatar->getPosition()) / _scale;
if (_stringLength > MAX_STRING_LENGTH) { if (_stringLength > MAX_STRING_LENGTH) {
_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); _velocity += _scale * _gravity * (GRAVITY_EARTH * deltaTime);
} }
} }
updateCollisionWithEnvironment(deltaTime);
updateCollisionWithVoxels(deltaTime); if (_isCollisionsOn) {
updateAvatarCollisions(deltaTime); updateCollisionWithEnvironment(deltaTime);
updateCollisionWithVoxels(deltaTime);
updateAvatarCollisions(deltaTime);
}
} }
// update body balls // update body balls
@ -633,7 +638,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
// test for avatar collision response with the big sphere // test for avatar collision response with the big sphere
if (usingBigSphereCollisionTest) { if (usingBigSphereCollisionTest && _isCollisionsOn) {
updateCollisionWithSphere(_TEST_bigSpherePosition, _TEST_bigSphereRadius, deltaTime); updateCollisionWithSphere(_TEST_bigSpherePosition, _TEST_bigSphereRadius, deltaTime);
} }
@ -748,6 +753,8 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
_head.setScale(_scale); _head.setScale(_scale);
_head.setSkinColor(glm::vec3(SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2])); _head.setSkinColor(glm::vec3(SKIN_COLOR[0], SKIN_COLOR[1], SKIN_COLOR[2]));
_head.simulate(deltaTime, isMyAvatar()); _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++) { for (int b = 0; b < NUM_AVATAR_BODY_BALLS; b++) {
float alpha = getBallRenderAlpha(b, lookingInMirror); 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 // 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 (b == BODY_BALL_HEAD_BASE) { // the head is rendered as a special
if (alpha > 0.0f) { if (alpha > 0.0f) {

View file

@ -27,7 +27,7 @@
#include "world.h" #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 MIN_SCALE = .5f;
static const float SCALING_RATIO = .05f; static const float SCALING_RATIO = .05f;
static const float SMOOTHING_RATIO = .05f; // 0 < ratio < 1 static const float SMOOTHING_RATIO = .05f; // 0 < ratio < 1
@ -124,7 +124,6 @@ public:
void follow(Avatar* leadingAvatar); void follow(Avatar* leadingAvatar);
void updateFromGyrosAndOrWebcam(bool gyroLook, void updateFromGyrosAndOrWebcam(bool gyroLook,
const glm::vec3& amplifyAngle, const glm::vec3& amplifyAngle,
float yawFromTouch,
float pitchFromTouch); float pitchFromTouch);
void addBodyYaw(float bodyYaw) {_bodyYaw += bodyYaw;}; void addBodyYaw(float bodyYaw) {_bodyYaw += bodyYaw;};
void addBodyYawDelta(float bodyYawDelta) {_bodyYawDelta += bodyYawDelta;} void addBodyYawDelta(float bodyYawDelta) {_bodyYawDelta += bodyYawDelta;}
@ -142,6 +141,7 @@ public:
void setMouseRay (const glm::vec3 &origin, const glm::vec3 &direction); void setMouseRay (const glm::vec3 &origin, const glm::vec3 &direction);
void setOrientation (const glm::quat& orientation); void setOrientation (const glm::quat& orientation);
void setNewScale (const float scale); void setNewScale (const float scale);
void setWantCollisionsOn (bool wantCollisionsOn ) { _isCollisionsOn = wantCollisionsOn; }
//getters //getters
bool isInitialized () const { return _initialized;} bool isInitialized () const { return _initialized;}
@ -263,6 +263,7 @@ private:
glm::vec3 _lastCollisionPosition; glm::vec3 _lastCollisionPosition;
bool _speedBrakes; bool _speedBrakes;
bool _isThrustOn; bool _isThrustOn;
bool _isCollisionsOn;
Avatar* _leadingAvatar; Avatar* _leadingAvatar;
float _stringLength; float _stringLength;

View file

@ -42,6 +42,9 @@ void Hand::init() {
else { else {
_ballColor = glm::vec3(0.0, 0.0, 0.4); _ballColor = glm::vec3(0.0, 0.0, 0.4);
} }
_raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_FIRE;
_raveGloveEffectsModeChanged = false;
} }
void Hand::reset() { void Hand::reset() {
@ -51,15 +54,20 @@ void Hand::reset() {
void Hand::simulate(float deltaTime, bool isMine) { void Hand::simulate(float deltaTime, bool isMine) {
if (_isRaveGloveActive) { if (_isRaveGloveActive) {
if (_raveGloveEffectsModeChanged && _raveGloveInitialized) {
activateNewRaveGloveMode();
_raveGloveEffectsModeChanged = false;
}
updateRaveGloveParticles(deltaTime); updateRaveGloveParticles(deltaTime);
} }
} }
void Hand::calculateGeometry() { 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(); Head& head = _owningAvatar->getHead();
_basePosition = head.getPosition() + head.getOrientation() * offset; _basePosition = head.getPosition() + head.getOrientation() * leapHandsOffsetFromFace;
_baseOrientation = head.getOrientation(); _baseOrientation = head.getOrientation();
// generate finger tip balls.... // generate finger tip balls....
@ -106,18 +114,21 @@ void Hand::calculateGeometry() {
} }
void Hand::setRaveGloveEffectsMode(QKeyEvent* event) { void Hand::setRaveGloveEffectsMode(QKeyEvent* event) {
_raveGloveEffectsModeChanged = true;
switch (event->key()) { switch (event->key()) {
case Qt::Key_0: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_THROBBING_COLOR); break; case Qt::Key_0: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_THROBBING_COLOR; break;
case Qt::Key_1: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_TRAILS ); break; case Qt::Key_1: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_TRAILS; break;
case Qt::Key_2: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_FIRE ); break; case Qt::Key_2: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_FIRE; break;
case Qt::Key_3: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_WATER ); break; case Qt::Key_3: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_WATER; break;
case Qt::Key_4: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_FLASHY ); break; case Qt::Key_4: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_FLASHY; break;
case Qt::Key_5: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_BOZO_SPARKLER ); break; case Qt::Key_5: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_BOZO_SPARKLER; break;
case Qt::Key_6: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_LONG_SPARKLER ); break; case Qt::Key_6: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_LONG_SPARKLER; break;
case Qt::Key_7: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_SNAKE ); break; case Qt::Key_7: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_SNAKE; break;
case Qt::Key_8: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_PULSE ); break; case Qt::Key_8: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_PULSE; break;
case Qt::Key_9: setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_THROB ); break; case Qt::Key_9: _raveGloveEffectsMode = RAVE_GLOVE_EFFECTS_MODE_THROB; break;
}; };
} }
@ -129,7 +140,8 @@ void Hand::render(bool lookingInMirror) {
calculateGeometry(); calculateGeometry();
if (_isRaveGloveActive) { if (_isRaveGloveActive) {
renderRaveGloveStage(); // Disable raveGloveStage while we work on the network glove features
// renderRaveGloveStage();
if (_raveGloveInitialized) { if (_raveGloveInitialized) {
updateRaveGloveEmitters(); // do this after calculateGeometry updateRaveGloveEmitters(); // do this after calculateGeometry
@ -142,8 +154,10 @@ void Hand::render(bool lookingInMirror) {
if ( SHOW_LEAP_HAND ) { if ( SHOW_LEAP_HAND ) {
//renderLeapHands(); //renderLeapHands();
renderLeapFingerTrails(); if (!isRaveGloveActive()) {
renderLeapHandSpheres(); renderLeapFingerTrails();
renderLeapHandSpheres();
}
} }
} }
@ -340,6 +354,7 @@ void Hand::updateRaveGloveParticles(float deltaTime) {
} }
setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_FIRE); setRaveGloveMode(RAVE_GLOVE_EFFECTS_MODE_FIRE);
activateNewRaveGloveMode();
_raveGloveParticleSystem.setUpDirection(glm::vec3(0.0f, 1.0f, 0.0f)); _raveGloveParticleSystem.setUpDirection(glm::vec3(0.0f, 1.0f, 0.0f));
_raveGloveInitialized = true; _raveGloveInitialized = true;
} else { } else {
@ -347,12 +362,14 @@ void Hand::updateRaveGloveParticles(float deltaTime) {
} }
} }
// The rave glove mode has changed, so activate the effects.
void Hand::activateNewRaveGloveMode() {
if (!_raveGloveInitialized) {
void Hand::setRaveGloveMode(int mode) { return;
}
_raveGloveMode = mode;
int mode = _raveGloveEffectsMode;
_raveGloveParticleSystem.killAllParticles(); _raveGloveParticleSystem.killAllParticles();
for ( int f = 0; f< NUM_FINGERS; f ++ ) { for ( int f = 0; f< NUM_FINGERS; f ++ ) {

View file

@ -72,8 +72,9 @@ private:
void setLeapHands(const std::vector<glm::vec3>& handPositions, void setLeapHands(const std::vector<glm::vec3>& handPositions,
const std::vector<glm::vec3>& handNormals); const std::vector<glm::vec3>& handNormals);
void activateNewRaveGloveMode();
void renderRaveGloveStage(); void renderRaveGloveStage();
virtual void setRaveGloveMode(int mode);
void renderLeapHandSpheres(); void renderLeapHandSpheres();
void renderLeapHands(); void renderLeapHands();
void renderLeapHand(PalmData& hand); void renderLeapHand(PalmData& hand);

View file

@ -84,6 +84,7 @@ Head::Head(Avatar* owningAvatar) :
_rightEyeBlinkVelocity(0.0f), _rightEyeBlinkVelocity(0.0f),
_timeWithoutTalking(0.0f), _timeWithoutTalking(0.0f),
_cameraPitch(_pitch), _cameraPitch(_pitch),
_mousePitch(0.f),
_cameraYaw(_yaw), _cameraYaw(_yaw),
_isCameraMoving(false), _isCameraMoving(false),
_cameraFollowsHead(false), _cameraFollowsHead(false),
@ -338,7 +339,7 @@ void Head::setScale (float scale) {
} }
void Head::createMohawk() { void Head::createMohawk() {
uint16_t nodeId = 0; uint16_t nodeId = UNKNOWN_NODE_ID;
if (_owningAvatar->getOwningNode()) { if (_owningAvatar->getOwningNode()) {
nodeId = _owningAvatar->getOwningNode()->getNodeID(); nodeId = _owningAvatar->getOwningNode()->getNodeID();
} else { } else {
@ -428,7 +429,7 @@ glm::quat Head::getOrientation() const {
glm::quat Head::getCameraOrientation () const { glm::quat Head::getCameraOrientation () const {
Avatar* owningAvatar = static_cast<Avatar*>(_owningAvatar); Avatar* owningAvatar = static_cast<Avatar*>(_owningAvatar);
return owningAvatar->getWorldAlignedOrientation() 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() { void Head::renderHeadSphere() {

View file

@ -57,6 +57,8 @@ public:
void setCameraFollowsHead(bool cameraFollowsHead) { _cameraFollowsHead = cameraFollowsHead; } void setCameraFollowsHead(bool cameraFollowsHead) { _cameraFollowsHead = cameraFollowsHead; }
void setMousePitch(float mousePitch) { _mousePitch = mousePitch; }
glm::quat getOrientation() const; glm::quat getOrientation() const;
glm::quat getCameraOrientation () const; glm::quat getCameraOrientation () const;
@ -123,6 +125,7 @@ private:
float _rightEyeBlinkVelocity; float _rightEyeBlinkVelocity;
float _timeWithoutTalking; float _timeWithoutTalking;
float _cameraPitch; // Used to position the camera differently from the head float _cameraPitch; // Used to position the camera differently from the head
float _mousePitch;
float _cameraYaw; float _cameraYaw;
bool _isCameraMoving; bool _isCameraMoving;
bool _cameraFollowsHead; bool _cameraFollowsHead;

View file

@ -41,7 +41,8 @@ AvatarData::AvatarData(Node* owningNode) :
_wantLowResMoving(false), _wantLowResMoving(false),
_wantOcclusionCulling(true), _wantOcclusionCulling(true),
_headData(NULL), _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, _bodyYaw);
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyPitch); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyPitch);
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyRoll); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyRoll);
// Body scale
destinationBuffer += packFloatRatioToTwoByte(destinationBuffer, _newScale); 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) // Head rotation (NOTE: This needs to become a quaternion to save two bytes)
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_yaw); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_yaw);
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_pitch); 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, &_bodyYaw);
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyPitch); sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyPitch);
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyRoll); sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyRoll);
// Body scale
sourceBuffer += unpackFloatRatioFromTwoByte( sourceBuffer, _newScale); 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) // Head rotation (NOTE: This needs to become a quaternion to save two bytes)
float headYaw, headPitch, headRoll; float headYaw, headPitch, headRoll;
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &headYaw); sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &headYaw);

View file

@ -92,10 +92,11 @@ public:
const std::string& chatMessage () const { return _chatMessage; } const std::string& chatMessage () const { return _chatMessage; }
// related to Voxel Sending strategies // related to Voxel Sending strategies
bool getWantColor() const { return _wantColor; } bool getWantColor() const { return _wantColor; }
bool getWantDelta() const { return _wantDelta; } bool getWantDelta() const { return _wantDelta; }
bool getWantLowResMoving() const { return _wantLowResMoving; } bool getWantLowResMoving() const { return _wantLowResMoving; }
bool getWantOcclusionCulling() const { return _wantOcclusionCulling; } bool getWantOcclusionCulling() const { return _wantOcclusionCulling; }
uint16_t getLeaderID() const { return _leaderID; }
void setWantColor(bool wantColor) { _wantColor = wantColor; } void setWantColor(bool wantColor) { _wantColor = wantColor; }
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; } void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
@ -118,8 +119,13 @@ protected:
float _bodyYaw; float _bodyYaw;
float _bodyPitch; float _bodyPitch;
float _bodyRoll; float _bodyRoll;
// Body scale
float _newScale; float _newScale;
// Following mode infos
uint16_t _leaderID;
// Hand state (are we grabbing something or not) // Hand state (are we grabbing something or not)
char _handState; char _handState;

View file

@ -20,7 +20,8 @@ HandData::HandData(AvatarData* owningAvatar) :
_baseOrientation(0.0f, 0.0f, 0.0f, 1.0f), _baseOrientation(0.0f, 0.0f, 0.0f, 1.0f),
_owningAvatarData(owningAvatar), _owningAvatarData(owningAvatar),
_isRaveGloveActive(false), _isRaveGloveActive(false),
_raveGloveMode(RAVE_GLOVE_EFFECTS_MODE_THROBBING_COLOR) _raveGloveEffectsMode(RAVE_GLOVE_EFFECTS_MODE_THROBBING_COLOR),
_raveGloveEffectsModeChanged(false)
{ {
// Start with two palms // Start with two palms
addNewPalm(); addNewPalm();
@ -160,8 +161,9 @@ int HandData::decodeRemoteData(unsigned char* sourceBuffer) {
} }
setRaveGloveActive((gloveFlags & GLOVE_FLAG_RAVE) != 0); setRaveGloveActive((gloveFlags & GLOVE_FLAG_RAVE) != 0);
// This is disabled for crash tracing. if (numHands > 0) {
// setRaveGloveMode(effectsMode); setRaveGloveMode(effectsMode);
}
// One byte for error checking safety. // One byte for error checking safety.
unsigned char requiredLength = (unsigned char)(sourceBuffer - startPosition); unsigned char requiredLength = (unsigned char)(sourceBuffer - startPosition);
@ -171,6 +173,13 @@ int HandData::decodeRemoteData(unsigned char* sourceBuffer) {
return sourceBuffer - startPosition; return sourceBuffer - startPosition;
} }
void HandData::setRaveGloveMode(int effectsMode) {
if (effectsMode != _raveGloveEffectsMode) {
_raveGloveEffectsModeChanged = true;
}
_raveGloveEffectsMode = effectsMode;
}
void HandData::setFingerTrailLength(unsigned int length) { void HandData::setFingerTrailLength(unsigned int length) {
for (size_t i = 0; i < getNumPalms(); ++i) { for (size_t i = 0; i < getNumPalms(); ++i) {
PalmData& palm = getPalms()[i]; PalmData& palm = getPalms()[i];

View file

@ -70,9 +70,9 @@ public:
int decodeRemoteData(unsigned char* sourceBuffer); int decodeRemoteData(unsigned char* sourceBuffer);
void setRaveGloveActive(bool active) { _isRaveGloveActive = active; } void setRaveGloveActive(bool active) { _isRaveGloveActive = active; }
virtual void setRaveGloveMode(int effectsMode) { _raveGloveMode = effectsMode; } void setRaveGloveMode(int effectsMode);
bool isRaveGloveActive() const { return _isRaveGloveActive; } bool isRaveGloveActive() const { return _isRaveGloveActive; }
int getRaveGloveMode() { return _raveGloveMode; } int getRaveGloveMode() { return _raveGloveEffectsMode; }
friend class AvatarData; friend class AvatarData;
protected: protected:
@ -81,7 +81,8 @@ protected:
AvatarData* _owningAvatarData; AvatarData* _owningAvatarData;
std::vector<PalmData> _palms; std::vector<PalmData> _palms;
bool _isRaveGloveActive; bool _isRaveGloveActive;
int _raveGloveMode; int _raveGloveEffectsMode;
bool _raveGloveEffectsModeChanged;
private: private:
// privatize copy ctor and assignment operator so copies of this object cannot be made // privatize copy ctor and assignment operator so copies of this object cannot be made
HandData(const HandData&); HandData(const HandData&);

View file

@ -74,7 +74,7 @@ public:
void setDomainIPToLocalhost(); void setDomainIPToLocalhost();
uint16_t getLastNodeID() const { return _lastNodeID; } uint16_t getLastNodeID() const { return _lastNodeID; }
void increaseNodeID() { ++_lastNodeID; } void increaseNodeID() { (++_lastNodeID == UNKNOWN_NODE_ID) ? ++_lastNodeID : _lastNodeID; }
uint16_t getOwnerID() const { return _ownerID; } uint16_t getOwnerID() const { return _ownerID; }
void setOwnerID(uint16_t ownerID) { _ownerID = ownerID; } void setOwnerID(uint16_t ownerID) { _ownerID = ownerID; }

View file

@ -20,7 +20,7 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
return 1; return 1;
case PACKET_TYPE_HEAD_DATA: case PACKET_TYPE_HEAD_DATA:
return 3; return 4;
case PACKET_TYPE_AVATAR_FACE_VIDEO: case PACKET_TYPE_AVATAR_FACE_VIDEO:
return 1; return 1;