Merge branch 'master' of git://github.com/worklist/hifi into the_midget_are_coming

This commit is contained in:
Atlante45 2013-07-11 17:22:36 -07:00
commit 12bbec66af
3 changed files with 18 additions and 28 deletions

View file

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

View file

@ -137,6 +137,11 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
if (numFingerVectors > 255) if (numFingerVectors > 255)
numFingerVectors = 0; // safety. We shouldn't ever get over 255, so consider that invalid. 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; *destinationBuffer++ = (unsigned char)numFingerVectors;
if (numFingerVectors > 0) { if (numFingerVectors > 0) {
@ -255,8 +260,8 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
// leap hand data // leap hand data
if (sourceBuffer - startPosition < numBytes) // safety check if (sourceBuffer - startPosition < numBytes) // safety check
{ {
std::vector<glm::vec3> fingerTips = _handData->getFingerTips(); std::vector<glm::vec3> fingerTips;
std::vector<glm::vec3> fingerRoots = _handData->getFingerRoots(); std::vector<glm::vec3> fingerRoots;
unsigned int numFingerVectors = *sourceBuffer++; unsigned int numFingerVectors = *sourceBuffer++;
unsigned int numFingerTips = numFingerVectors / 2; unsigned int numFingerTips = numFingerVectors / 2;
unsigned int numFingerRoots = numFingerVectors - numFingerTips; 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].y), 4);
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerTips[i].z), 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->setFingerTips(fingerTips);
_handData->setFingerRoots(fingerRoots); _handData->setFingerRoots(fingerRoots);
} }

View file

@ -1346,33 +1346,13 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp
// There are two types of nodes for which we want to send colors: // There are two types of nodes for which we want to send colors:
// 1) Leaves - obviously // 1) Leaves - obviously
// 2) Non-leaves who's children would be visible and beyond our LOD. // 2) Non-leaves who's children would be visible but are beyond our LOD.
// NOTE: This code works, but it's pretty expensive, because we're calculating distances for all the grand
// children, which we'll end up doing again later in the next level of recursion. We need to optimize this
// in the future.
bool isLeafOrLOD = childNode->isLeaf(); bool isLeafOrLOD = childNode->isLeaf();
if (params.viewFrustum && childNode->isColored() && !childNode->isLeaf()) { if (params.viewFrustum && childNode->isColored() && !childNode->isLeaf()) {
int grandChildrenInView = 0; int childLevel = childNode->getLevel();
int grandChildrenInLOD = 0; float childBoundary = boundaryDistanceForRenderLevel(childLevel + params.boundaryLevelAdjust);
float grandChildBoundaryDistance = boundaryDistanceForRenderLevel(childNode->getLevel() + float grandChildBoundary = boundaryDistanceForRenderLevel(childLevel + 1 + params.boundaryLevelAdjust);
1 + params.boundaryLevelAdjust); isLeafOrLOD = ((distance <= childBoundary) && !(distance <= grandChildBoundary));
for (int grandChildIndex = 0; grandChildIndex < NUMBER_OF_CHILDREN; grandChildIndex++) {
VoxelNode* grandChild = childNode->getChildAtIndex(grandChildIndex);
if (grandChild && grandChild->isColored() && grandChild->isInView(*params.viewFrustum)) {
grandChildrenInView++;
float grandChildDistance = grandChild->distanceToCamera(*params.viewFrustum);
if (grandChildDistance < grandChildBoundaryDistance) {
grandChildrenInLOD++;
}
}
}
// if any of our grandchildren ARE in view, then we don't want to include our color. If none are, then
// we do want to include our color
if (grandChildrenInView > 0 && grandChildrenInLOD == 0) {
isLeafOrLOD = true;
}
} }
// track children with actual color, only if the child wasn't previously in view! // track children with actual color, only if the child wasn't previously in view!