Some Leap finger fixes, but also temporarily disable Leap data sending, due to a crash.

Will resolve the crash before re-enabling.
This commit is contained in:
Eric Johnston 2013-07-11 16:06:31 -07:00
parent c3242598f5
commit 58b50067ad
2 changed files with 13 additions and 3 deletions

View file

@ -54,7 +54,7 @@ void Hand::calculateGeometry() {
_position = head.getPosition() + head.getOrientation() * offset;
_orientation = head.getOrientation();
int numLeapBalls = _fingerTips.size() + _fingerRoots.size();
int numLeapBalls = _fingerTips.size();
_leapBalls.resize(numLeapBalls);
for (int i = 0; i < _fingerTips.size(); ++i) {

View file

@ -137,6 +137,11 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
if (numFingerVectors > 255)
numFingerVectors = 0; // safety. We shouldn't ever get over 255, so consider that invalid.
/////////////////////////////////
// Temporarily disable Leap finger sending, as it's causing a crash whenever someone's got a Leap connected
numFingerVectors = 0;
/////////////////////////////////
*destinationBuffer++ = (unsigned char)numFingerVectors;
if (numFingerVectors > 0) {
@ -255,8 +260,8 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
// leap hand data
if (sourceBuffer - startPosition < numBytes) // safety check
{
std::vector<glm::vec3> fingerTips = _handData->getFingerTips();
std::vector<glm::vec3> fingerRoots = _handData->getFingerRoots();
std::vector<glm::vec3> fingerTips;
std::vector<glm::vec3> fingerRoots;
unsigned int numFingerVectors = *sourceBuffer++;
unsigned int numFingerTips = numFingerVectors / 2;
unsigned int numFingerRoots = numFingerVectors - numFingerTips;
@ -267,6 +272,11 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerTips[i].y), 4);
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerTips[i].z), 4);
}
for (size_t i = 0; i < numFingerRoots; ++i) {
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerRoots[i].x), 4);
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerRoots[i].y), 4);
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerRoots[i].z), 4);
}
_handData->setFingerTips(fingerTips);
_handData->setFingerRoots(fingerRoots);
}