mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
some work on hands
This commit is contained in:
parent
1df7026b26
commit
8fc800acff
4 changed files with 27 additions and 6 deletions
|
@ -2024,6 +2024,7 @@ void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& which
|
|||
}
|
||||
|
||||
void Application::update(float deltaTime) {
|
||||
|
||||
// Use Transmitter Hand to move hand if connected, else use mouse
|
||||
if (_myTransmitter.isConnected()) {
|
||||
const float HAND_FORCE_SCALING = 0.01f;
|
||||
|
|
|
@ -51,6 +51,7 @@ void Hand::reset() {
|
|||
|
||||
|
||||
void Hand::simulate(float deltaTime, bool isMine) {
|
||||
|
||||
if (_isRaveGloveActive) {
|
||||
updateRaveGloveParticles(deltaTime);
|
||||
}
|
||||
|
@ -120,9 +121,9 @@ void Hand::render(bool lookingInMirror) {
|
|||
glEnable(GL_RESCALE_NORMAL);
|
||||
|
||||
if ( SHOW_LEAP_HAND ) {
|
||||
renderLeapHands();
|
||||
//renderFingerTrails();
|
||||
//renderHandSpheres();
|
||||
//renderLeapHands();
|
||||
renderLeapFingerTrails();
|
||||
renderLeapHandSpheres();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +156,6 @@ void Hand::renderRaveGloveStage() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
void Hand::renderLeapHands() {
|
||||
for (size_t i = 0; i < getNumPalms(); ++i) {
|
||||
PalmData& hand = getPalms()[i];
|
||||
|
@ -165,7 +165,6 @@ void Hand::renderLeapHands() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Hand::renderLeapHand(PalmData& hand) {
|
||||
|
||||
glPushMatrix();
|
||||
|
@ -265,6 +264,7 @@ void Hand::renderLeapFingerTrails() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Hand::setLeapHands(const std::vector<glm::vec3>& handPositions,
|
||||
const std::vector<glm::vec3>& handNormals) {
|
||||
for (size_t i = 0; i < getNumPalms(); ++i) {
|
||||
|
|
|
@ -130,6 +130,8 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
|
||||
// leap hand data
|
||||
std::vector<glm::vec3> fingerVectors;
|
||||
|
||||
//printf("about to call _handData->encodeRemoteData(fingerVectors);\n");
|
||||
_handData->encodeRemoteData(fingerVectors);
|
||||
|
||||
if (fingerVectors.size() > 255)
|
||||
|
@ -244,17 +246,32 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
// hand state, stored as a semi-nibble in the bitItems
|
||||
_handState = getSemiNibbleAt(bitItems,HAND_STATE_START_BIT);
|
||||
|
||||
//printf("about to call leap hand data code in AvatarData::parseData...\n");
|
||||
|
||||
// leap hand data
|
||||
if (sourceBuffer - startPosition < numBytes) {
|
||||
|
||||
//printf("got inside of 'if (sourceBuffer - startPosition < numBytes)'\n");
|
||||
|
||||
|
||||
// check passed, bytes match
|
||||
unsigned int numFingerVectors = *sourceBuffer++;
|
||||
|
||||
//printf("numFingerVectors = %d\n", numFingerVectors);
|
||||
|
||||
|
||||
if (numFingerVectors > 0) {
|
||||
|
||||
//printf("ok, we got fingers in AvatarData::parseData\n");
|
||||
|
||||
std::vector<glm::vec3> fingerVectors(numFingerVectors);
|
||||
for (size_t i = 0; i < numFingerVectors; ++i) {
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].x), fingerVectorRadix);
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].y), fingerVectorRadix);
|
||||
sourceBuffer += unpackFloatScalarFromSignedTwoByteFixed((int16_t*) sourceBuffer, &(fingerVectors[i].z), fingerVectorRadix);
|
||||
}
|
||||
|
||||
//printf("about to call _handData->decodeRemoteData(fingerVectors);\n");
|
||||
_handData->decodeRemoteData(fingerVectors);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,12 +51,15 @@ _owningHandData(owningHandData)
|
|||
|
||||
void HandData::encodeRemoteData(std::vector<glm::vec3>& fingerVectors) {
|
||||
fingerVectors.clear();
|
||||
|
||||
for (size_t i = 0; i < getNumPalms(); ++i) {
|
||||
|
||||
PalmData& palm = getPalms()[i];
|
||||
fingerVectors.push_back(palm.getRawPosition());
|
||||
fingerVectors.push_back(palm.getRawNormal());
|
||||
for (size_t f = 0; f < palm.getNumFingers(); ++f) {
|
||||
FingerData& finger = palm.getFingers()[f];
|
||||
|
||||
if (finger.isActive()) {
|
||||
fingerVectors.push_back(finger.getTipRawPosition());
|
||||
fingerVectors.push_back(finger.getRootRawPosition());
|
||||
|
@ -82,7 +85,7 @@ void HandData::decodeRemoteData(const std::vector<glm::vec3>& fingerVectors) {
|
|||
if (palmActive) {
|
||||
palm.setRawPosition(fingerVectors[vectorIndex++]);
|
||||
palm.setRawNormal(fingerVectors[vectorIndex++]);
|
||||
for (size_t f = 0; f < NUM_FINGERS_PER_HAND; ++f) {
|
||||
for (size_t f = 0; f < NUM_FINGERS_PER_HAND; ++f) {
|
||||
FingerData& finger = palm.getFingers()[i];
|
||||
finger.setRawTipPosition(fingerVectors[vectorIndex++]);
|
||||
finger.setRawRootPosition(fingerVectors[vectorIndex++]);
|
||||
|
|
Loading…
Reference in a new issue