fixed get and set semi nibble to deal with 16 bits

This commit is contained in:
amantley 2018-06-07 15:43:21 -07:00
parent 836c3da858
commit 67fc7b90b5
2 changed files with 5 additions and 6 deletions

View file

@ -59,7 +59,6 @@ void Head::simulate(float deltaTime) {
_longTermAverageLoudness = glm::mix(_longTermAverageLoudness, _averageLoudness, glm::min(deltaTime / AUDIO_LONG_TERM_AVERAGING_SECS, 1.0f)); _longTermAverageLoudness = glm::mix(_longTermAverageLoudness, _averageLoudness, glm::min(deltaTime / AUDIO_LONG_TERM_AVERAGING_SECS, 1.0f));
} }
//if (!_isFaceTrackerConnected) {
if (!_isEyeTrackerConnected) { if (!_isEyeTrackerConnected) {
// Update eye saccades // Update eye saccades
const float AVERAGE_MICROSACCADE_INTERVAL = 1.0f; const float AVERAGE_MICROSACCADE_INTERVAL = 1.0f;
@ -77,7 +76,7 @@ void Head::simulate(float deltaTime) {
} else { } else {
_saccade = glm::vec3(); _saccade = glm::vec3();
} }
const float BLINK_SPEED = 10.0f; const float BLINK_SPEED = 10.0f;
const float BLINK_SPEED_VARIABILITY = 1.0f; const float BLINK_SPEED_VARIABILITY = 1.0f;
const float BLINK_START_VARIABILITY = 0.25f; const float BLINK_START_VARIABILITY = 0.25f;

View file

@ -298,11 +298,11 @@ void setAtBit(unsigned char& byte, int bitIndex) {
} }
bool oneAtBit16(unsigned short word, int bitIndex) { bool oneAtBit16(unsigned short word, int bitIndex) {
return (word >> (16 - bitIndex) & 1); return (word >> (15 - bitIndex) & 1);
} }
void setAtBit16(unsigned short& word, int bitIndex) { void setAtBit16(unsigned short& word, int bitIndex) {
word |= (1 << (16 - bitIndex)); word |= (1 << (15 - bitIndex));
} }
@ -313,7 +313,7 @@ void clearAtBit(unsigned char& byte, int bitIndex) {
} }
int getSemiNibbleAt(unsigned short word, int bitIndex) { int getSemiNibbleAt(unsigned short word, int bitIndex) {
return (word >> (6 - bitIndex) & 3); // semi-nibbles store 00, 01, 10, or 11 return (word >> (14 - bitIndex) & 3); // semi-nibbles store 00, 01, 10, or 11
} }
int getNthBit(unsigned char byte, int ordinal) { int getNthBit(unsigned char byte, int ordinal) {
@ -337,7 +337,7 @@ int getNthBit(unsigned char byte, int ordinal) {
void setSemiNibbleAt(unsigned short& word, int bitIndex, int value) { void setSemiNibbleAt(unsigned short& word, int bitIndex, int value) {
//assert(value <= 3 && value >= 0); //assert(value <= 3 && value >= 0);
word |= ((value & 3) << (6 - bitIndex)); // semi-nibbles store 00, 01, 10, or 11 word |= ((value & 3) << (14 - bitIndex)); // semi-nibbles store 00, 01, 10, or 11
} }
bool isInEnvironment(const char* environment) { bool isInEnvironment(const char* environment) {