Showing the changes to interface/src/HandControl.cpp (1 of 6 files). Show all
Unified · Split
| @@ -33,14 +33,14 @@ HandControl::HandControl() { · 32 unmodified lines | |||
| 33 | _envelope = 0.0f; | 33 | _envelope = 0.0f; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void HandControl::setScreenDimensions( int width, int height ) { | 36 | void HandControl::setScreenDimensions(int width, int height) { |
| 37 | _width = width; | 37 | _width = width; |
| 38 | _height = height; | 38 | _height = height; |
| 39 | _startX = _width / 2; | 39 | _startX = _width / 2; |
| 40 | _startY = _height / 2; | 40 | _startY = _height / 2; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | void HandControl::update( int x, int y ) { | 43 | void HandControl::update(int x, int y) { |
| 44 | _lastX = _x; | 44 | _lastX = _x; |
| 45 | _lastY = _y; | 45 | _lastY = _y; |
| 46 | _x = x; | 46 | _x = x; |
| @@ -49,22 +49,22 @@ void HandControl::update( int x, int y ) { · 2 unmodified lines | |||
| 49 | _velocityY = _y - _lastY; | 49 | _velocityY = _y - _lastY; |
| 50 | 50 | ||
| 51 | // if the mouse is moving, ramp up the envelope to increase amplitude of hand movement... | 51 | // if the mouse is moving, ramp up the envelope to increase amplitude of hand movement... |
| 52 | if (( _velocityX != 0 ) | 52 | if ((_velocityX != 0) |
| 53 | || ( _velocityY != 0 )) { | 53 | || (_velocityY != 0)) { |
| 54 | _enabled = true; | 54 | _enabled = true; |
| 55 | if ( _envelope < 1.0 ) { | 55 | if (_envelope < 1.0) { |
| 56 | _envelope += _rampUpRate; | 56 | _envelope += _rampUpRate; |
| 57 | if ( _envelope >= 1.0 ) { | 57 | if (_envelope >= 1.0) { |
| 58 | _envelope = 1.0; | 58 | _envelope = 1.0; |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | // if not enabled ramp down the envelope to decrease amplitude of hand movement... | 63 | // if not enabled ramp down the envelope to decrease amplitude of hand movement... |
| 64 | if ( ! _enabled ) { | 64 | if (! _enabled) { |
| 65 | if ( _envelope > 0.0 ) { | 65 | if (_envelope > 0.0) { |
| 66 | _envelope -= _rampDownRate; | 66 | _envelope -= _rampDownRate; |
| 67 | if ( _envelope <= 0.0 ) { | 67 | if (_envelope <= 0.0) { |
| 68 | _startX = _width / 2; | 68 | _startX = _width / 2; |
| 69 | _startY = _height / 2; | 69 | _startY = _height / 2; |
| 70 | _envelope = 0.0; | 70 | _envelope = 0.0; |
| @@ -77,14 +77,14 @@ void HandControl::update( int x, int y ) { · 6 unmodified lines | |||
| 77 | _backFront = 0.0; | 77 | _backFront = 0.0; |
| 78 | 78 | ||
| 79 | // if envelope is greater than zero, apply mouse movement to values to be output | 79 | // if envelope is greater than zero, apply mouse movement to values to be output |
| 80 | if ( _envelope > 0.0 ) { | 80 | if (_envelope > 0.0) { |
| 81 | _leftRight += ( ( _x - _startX ) / (float)_width ) * _envelope; | 81 | _leftRight += ((_x - _startX) / (float)_width ) * _envelope; |
| 82 | _downUp += ( ( _y - _startY ) / (float)_height ) * _envelope; | 82 | _downUp += ((_y - _startY) / (float)_height) * _envelope; |
| 83 | } | 83 | } |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | glm::vec3 HandControl::getValues() { | 86 | glm::vec3 HandControl::getValues() { |
| 87 | return glm::vec3( _leftRight, _downUp, _backFront ); | 87 | return glm::vec3(_leftRight, _downUp, _backFront); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | void HandControl::stop() { | 90 | void HandControl::stop() { |