mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:23:39 +02:00
Put _isFaceshiftConnected in a bit set
This commit is contained in:
parent
c2502d03db
commit
8f27d22f7b
2 changed files with 43 additions and 37 deletions
|
@ -157,24 +157,6 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
memcpy(destinationBuffer, &_headData->_audioLoudness, sizeof(float));
|
memcpy(destinationBuffer, &_headData->_audioLoudness, sizeof(float));
|
||||||
destinationBuffer += sizeof(float);
|
destinationBuffer += sizeof(float);
|
||||||
|
|
||||||
memcpy(destinationBuffer, &_headData->_isFaceshiftConnected, sizeof(_headData->_isFaceshiftConnected));
|
|
||||||
destinationBuffer += sizeof(_headData->_isFaceshiftConnected);
|
|
||||||
|
|
||||||
// If it is connected, pack up the data
|
|
||||||
if (_headData->_isFaceshiftConnected) {
|
|
||||||
memcpy(destinationBuffer, &_headData->_leftEyeBlink, sizeof(float));
|
|
||||||
destinationBuffer += sizeof(float);
|
|
||||||
|
|
||||||
memcpy(destinationBuffer, &_headData->_rightEyeBlink, sizeof(float));
|
|
||||||
destinationBuffer += sizeof(float);
|
|
||||||
|
|
||||||
memcpy(destinationBuffer, &_headData->_averageLoudness, sizeof(float));
|
|
||||||
destinationBuffer += sizeof(float);
|
|
||||||
|
|
||||||
memcpy(destinationBuffer, &_headData->_browAudioLift, sizeof(float));
|
|
||||||
destinationBuffer += sizeof(float);
|
|
||||||
}
|
|
||||||
|
|
||||||
// camera details
|
// camera details
|
||||||
memcpy(destinationBuffer, &_cameraPosition, sizeof(_cameraPosition));
|
memcpy(destinationBuffer, &_cameraPosition, sizeof(_cameraPosition));
|
||||||
destinationBuffer += sizeof(_cameraPosition);
|
destinationBuffer += sizeof(_cameraPosition);
|
||||||
|
@ -204,6 +186,26 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
setSemiNibbleAt(bitItems,HAND_STATE_START_BIT,_handState);
|
setSemiNibbleAt(bitItems,HAND_STATE_START_BIT,_handState);
|
||||||
*destinationBuffer++ = bitItems;
|
*destinationBuffer++ = bitItems;
|
||||||
|
|
||||||
|
unsigned char bitItems = 0;
|
||||||
|
if (_headData->_isFaceshiftConnected) { setAtBit(bitItems, IS_FACESHIFT_CONNECTED); }
|
||||||
|
|
||||||
|
*destinationBuffer++ = bitItems;
|
||||||
|
|
||||||
|
// If it is connected, pack up the data
|
||||||
|
if (_headData->_isFaceshiftConnected) {
|
||||||
|
memcpy(destinationBuffer, &_headData->_leftEyeBlink, sizeof(float));
|
||||||
|
destinationBuffer += sizeof(float);
|
||||||
|
|
||||||
|
memcpy(destinationBuffer, &_headData->_rightEyeBlink, sizeof(float));
|
||||||
|
destinationBuffer += sizeof(float);
|
||||||
|
|
||||||
|
memcpy(destinationBuffer, &_headData->_averageLoudness, sizeof(float));
|
||||||
|
destinationBuffer += sizeof(float);
|
||||||
|
|
||||||
|
memcpy(destinationBuffer, &_headData->_browAudioLift, sizeof(float));
|
||||||
|
destinationBuffer += sizeof(float);
|
||||||
|
}
|
||||||
|
|
||||||
// leap hand data
|
// leap hand data
|
||||||
destinationBuffer += _handData->encodeRemoteData(destinationBuffer);
|
destinationBuffer += _handData->encodeRemoteData(destinationBuffer);
|
||||||
|
|
||||||
|
@ -286,24 +288,6 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
memcpy(&_headData->_audioLoudness, sourceBuffer, sizeof(float));
|
memcpy(&_headData->_audioLoudness, sourceBuffer, sizeof(float));
|
||||||
sourceBuffer += sizeof(float);
|
sourceBuffer += sizeof(float);
|
||||||
|
|
||||||
memcpy(&_headData->_isFaceshiftConnected, sourceBuffer, sizeof(_headData->_isFaceshiftConnected));
|
|
||||||
sourceBuffer += sizeof(_headData->_isFaceshiftConnected);
|
|
||||||
|
|
||||||
// If it is connected, pack up the data
|
|
||||||
if (_headData->_isFaceshiftConnected) {
|
|
||||||
memcpy(&_headData->_leftEyeBlink, sourceBuffer, sizeof(float));
|
|
||||||
sourceBuffer += sizeof(float);
|
|
||||||
|
|
||||||
memcpy(&_headData->_rightEyeBlink, sourceBuffer, sizeof(float));
|
|
||||||
sourceBuffer += sizeof(float);
|
|
||||||
|
|
||||||
memcpy(&_headData->_averageLoudness, sourceBuffer, sizeof(float));
|
|
||||||
sourceBuffer += sizeof(float);
|
|
||||||
|
|
||||||
memcpy(&_headData->_browAudioLift, sourceBuffer, sizeof(float));
|
|
||||||
sourceBuffer += sizeof(float);
|
|
||||||
}
|
|
||||||
|
|
||||||
// camera details
|
// camera details
|
||||||
memcpy(&_cameraPosition, sourceBuffer, sizeof(_cameraPosition));
|
memcpy(&_cameraPosition, sourceBuffer, sizeof(_cameraPosition));
|
||||||
sourceBuffer += sizeof(_cameraPosition);
|
sourceBuffer += sizeof(_cameraPosition);
|
||||||
|
@ -334,6 +318,24 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
// hand state, stored as a semi-nibble in the bitItems
|
// hand state, stored as a semi-nibble in the bitItems
|
||||||
_handState = getSemiNibbleAt(bitItems,HAND_STATE_START_BIT);
|
_handState = getSemiNibbleAt(bitItems,HAND_STATE_START_BIT);
|
||||||
|
|
||||||
|
bitItems = (unsigned char)*sourceBuffer++;
|
||||||
|
_headData->_isFaceshiftConnected = oneAtBit(bitItems, IS_FACESHIFT_CONNECTED);
|
||||||
|
|
||||||
|
// If it is connected, pack up the data
|
||||||
|
if (_headData->_isFaceshiftConnected) {
|
||||||
|
memcpy(&_headData->_leftEyeBlink, sourceBuffer, sizeof(float));
|
||||||
|
sourceBuffer += sizeof(float);
|
||||||
|
|
||||||
|
memcpy(&_headData->_rightEyeBlink, sourceBuffer, sizeof(float));
|
||||||
|
sourceBuffer += sizeof(float);
|
||||||
|
|
||||||
|
memcpy(&_headData->_averageLoudness, sourceBuffer, sizeof(float));
|
||||||
|
sourceBuffer += sizeof(float);
|
||||||
|
|
||||||
|
memcpy(&_headData->_browAudioLift, sourceBuffer, sizeof(float));
|
||||||
|
sourceBuffer += sizeof(float);
|
||||||
|
}
|
||||||
|
|
||||||
// leap hand data
|
// leap hand data
|
||||||
if (sourceBuffer - startPosition < numBytes) {
|
if (sourceBuffer - startPosition < numBytes) {
|
||||||
// check passed, bytes match
|
// check passed, bytes match
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "HeadData.h"
|
#include "HeadData.h"
|
||||||
#include "HandData.h"
|
#include "HandData.h"
|
||||||
|
|
||||||
|
// First bitset
|
||||||
const int WANT_LOW_RES_MOVING_BIT = 0;
|
const int WANT_LOW_RES_MOVING_BIT = 0;
|
||||||
const int WANT_COLOR_AT_BIT = 1;
|
const int WANT_COLOR_AT_BIT = 1;
|
||||||
const int WANT_DELTA_AT_BIT = 2;
|
const int WANT_DELTA_AT_BIT = 2;
|
||||||
|
@ -30,6 +31,9 @@ const int KEY_STATE_START_BIT = 3; // 4th and 5th bits
|
||||||
const int HAND_STATE_START_BIT = 5; // 6th and 7th bits
|
const int HAND_STATE_START_BIT = 5; // 6th and 7th bits
|
||||||
const int WANT_OCCLUSION_CULLING_BIT = 7; // 8th bit
|
const int WANT_OCCLUSION_CULLING_BIT = 7; // 8th bit
|
||||||
|
|
||||||
|
// Second bitset
|
||||||
|
const int IS_FACESHIFT_CONNECTED = 0;
|
||||||
|
|
||||||
const float MAX_AUDIO_LOUDNESS = 1000.0; // close enough for mouth animation
|
const float MAX_AUDIO_LOUDNESS = 1000.0; // close enough for mouth animation
|
||||||
|
|
||||||
enum KeyState
|
enum KeyState
|
||||||
|
|
Loading…
Reference in a new issue