From fe11d929e398ffe282612fa749a02bc158aabee5 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Tue, 7 May 2013 08:43:14 -0700 Subject: [PATCH] cleaned up code spacing --- interface/src/Avatar.cpp | 185 +++++++++++++++++----------------- interface/src/AvatarTouch.cpp | 42 ++++---- interface/src/Camera.cpp | 31 +++--- interface/src/HandControl.cpp | 26 ++--- interface/src/Util.cpp | 38 +++---- interface/src/main.cpp | 30 +++--- 6 files changed, 172 insertions(+), 180 deletions(-) diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 9a4a1b16c8..3e97fd32b6 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -322,7 +322,6 @@ bool Avatar::getIsNearInteractingOther() { void Avatar::simulate(float deltaTime) { - // update balls if (_balls) { _balls->simulate(deltaTime); } @@ -496,7 +495,7 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) { void Avatar::updateHead(float deltaTime) { //apply the head lean values to the springy position... - if (fabs( _head.leanSideways + _head.leanForward ) > 0.0f) { + if (fabs(_head.leanSideways + _head.leanForward) > 0.0f) { glm::vec3 headLean = _orientation.getRight() * _head.leanSideways + _orientation.getFront() * _head.leanForward; @@ -514,7 +513,7 @@ void Avatar::updateHead(float deltaTime) { if (_head.noise) { // Move toward new target _headPitch += (_head.pitchTarget - _headPitch) * 10 * deltaTime; // (1.f - DECAY*deltaTime)*Pitch + ; - _headYaw += (_head.yawTarget - _headYaw ) * 10 * deltaTime; // (1.f - DECAY*deltaTime); + _headYaw += (_head.yawTarget - _headYaw ) * 10 * deltaTime; // (1.f - DECAY*deltaTime); _headRoll *= 1.f - (DECAY * deltaTime); } @@ -661,7 +660,7 @@ void Avatar::updateAvatarCollisions(float deltaTime) { glm::vec3 vectorBetweenBoundingSpheres(_position - otherAvatar->_position); if (glm::length(vectorBetweenBoundingSpheres) < _height * ONE_HALF + otherAvatar->_height * ONE_HALF) { //apply forces from collision - applyCollisionWithOtherAvatar(otherAvatar, deltaTime ); + applyCollisionWithOtherAvatar(otherAvatar, deltaTime); } // test other avatar hand position for proximity @@ -695,7 +694,7 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime glm::vec3 vectorBetweenJoints(_joint[b].springyPosition - otherAvatar->_joint[o].springyPosition); float distanceBetweenJoints = glm::length(vectorBetweenJoints); - if (distanceBetweenJoints > 0.0 ) { // to avoid divide by zero + if (distanceBetweenJoints > 0.0) { // to avoid divide by zero float combinedRadius = _joint[b].radius + otherAvatar->_joint[o].radius; // check for collision @@ -706,7 +705,7 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime glm::vec3 ballPushForce = directionVector * COLLISION_BALL_FORCE * deltaTime; float ballMomentum = 1.0 - COLLISION_BALL_FRICTION * deltaTime; - if (ballMomentum < 0.0 ) { ballMomentum = 0.0;} + if (ballMomentum < 0.0) { ballMomentum = 0.0;} _joint[b].springyVelocity += ballPushForce; otherAvatar->_joint[o].springyVelocity -= ballPushForce; @@ -717,7 +716,7 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime // accumulate forces and frictions to apply to the velocities of avatar bodies bodyPushForce += directionVector * COLLISION_BODY_FORCE * deltaTime; bodyMomentum -= COLLISION_BODY_FRICTION * deltaTime; - if (bodyMomentum < 0.0 ) { bodyMomentum = 0.0;} + if (bodyMomentum < 0.0) { bodyMomentum = 0.0;} }// check for collision } // to avoid divide by zero @@ -736,7 +735,7 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime -void Avatar::setDisplayingHead(bool displayingHead ) { +void Avatar::setDisplayingHead(bool displayingHead) { _displayingHead = displayingHead; } @@ -755,25 +754,25 @@ void Avatar::setGravity(glm::vec3 gravity) { void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) { // render a simple round on the ground projected down from the avatar's position - renderDiskShadow(_position, glm::vec3(0.0f, 1.0f, 0.0f ), 0.1f, 0.2f ); + renderDiskShadow(_position, glm::vec3(0.0f, 1.0f, 0.0f), 0.1f, 0.2f); /* // show avatar position - glColor4f(0.5f, 0.5f, 0.5f, 0.6 ); + glColor4f(0.5f, 0.5f, 0.5f, 0.6); glPushMatrix(); glTranslatef(_position.x, _position.y, _position.z); - glScalef(0.03, 0.03, 0.03 ); - glutSolidSphere(1, 10, 10 ); + glScalef(0.03, 0.03, 0.03); + glutSolidSphere(1, 10, 10); glPopMatrix(); */ - if (usingBigSphereCollisionTest ) { + if (usingBigSphereCollisionTest) { // show TEST big sphere - glColor4f(0.5f, 0.6f, 0.8f, 0.7 ); + glColor4f(0.5f, 0.6f, 0.8f, 0.7); glPushMatrix(); glTranslatef(_TEST_bigSpherePosition.x, _TEST_bigSpherePosition.y, _TEST_bigSpherePosition.z); - glScalef(_TEST_bigSphereRadius, _TEST_bigSphereRadius, _TEST_bigSphereRadius ); - glutSolidSphere(1, 20, 20 ); + glScalef(_TEST_bigSphereRadius, _TEST_bigSphereRadius, _TEST_bigSphereRadius); + glutSolidSphere(1, 20, 20); glPopMatrix(); } @@ -786,7 +785,7 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) { } // if this is my avatar, then render my interactions with the other avatar - if (_isMine ) { + if (_isMine) { _avatarTouch.render(cameraPosition); } @@ -847,7 +846,7 @@ void Avatar::renderHead(bool lookingInMirror) { glEnable(GL_RESCALE_NORMAL); // show head orientation - //renderOrientationDirections(_joint[ AVATAR_JOINT_HEAD_BASE ].springyPosition, _joint[ AVATAR_JOINT_HEAD_BASE ].orientation, 0.2f ); + //renderOrientationDirections(_joint[ AVATAR_JOINT_HEAD_BASE ].springyPosition, _joint[ AVATAR_JOINT_HEAD_BASE ].orientation, 0.2f); glPushMatrix(); @@ -875,7 +874,7 @@ void Avatar::renderHead(bool lookingInMirror) { //glRotatef(_bodyPitch + _headPitch, 1, 0, 0); //glRotatef(_bodyRoll - _headRoll, 0, 0, 1); // don't let body pitch and roll affect the head.. - glRotatef( _headPitch, 1, 0, 0); + glRotatef(_headPitch, 1, 0, 0); glRotatef(-_headRoll, 0, 0, 1); } else { glRotatef(_bodyYaw + _headYaw, 0, 1, 0); @@ -1012,7 +1011,7 @@ void Avatar::renderHead(bool lookingInMirror) { glPopMatrix(); } -void Avatar::setHandMovementValues(glm::vec3 handOffset ) { +void Avatar::setHandMovementValues(glm::vec3 handOffset) { _movedHandOffset = handOffset; } @@ -1025,11 +1024,11 @@ void Avatar::initializeSkeleton() { for (int b=0; b 0.0f ) { + if (length > 0.0f) { glm::vec3 springDirection = springVector / length; float force = (length - _joint[b].length) * BODY_SPRING_FORCE * deltaTime; _joint[b].springyVelocity -= springDirection * force; - if ( _joint[b].parent != AVATAR_JOINT_NULL ) { + if (_joint[b].parent != AVATAR_JOINT_NULL) { _joint[_joint[b].parent].springyVelocity += springDirection * force; } } @@ -1271,7 +1270,7 @@ void Avatar::updateBodySprings( float deltaTime ) { _joint[b].springyVelocity *= decay; } else { - _joint[b].springyVelocity = glm::vec3( 0.0f, 0.0f, 0.0f ); + _joint[b].springyVelocity = glm::vec3(0.0f, 0.0f, 0.0f); } _joint[b].springyPosition += _joint[b].springyVelocity * deltaTime; @@ -1290,17 +1289,17 @@ const glm::vec3& Avatar::getHeadPosition() const { -void Avatar::updateArmIKAndConstraints( float deltaTime ) { +void Avatar::updateArmIKAndConstraints(float deltaTime) { // determine the arm vector glm::vec3 armVector = _joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position; armVector -= _joint[ AVATAR_JOINT_RIGHT_SHOULDER ].position; // test to see if right hand is being dragged beyond maximum arm length - float distance = glm::length( armVector ); + float distance = glm::length(armVector); // don't let right hand get dragged beyond maximum arm length... - if ( distance > _maxArmLength ) { + if (distance > _maxArmLength) { // reset right hand to be constrained to maximum arm length _joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = _joint[ AVATAR_JOINT_RIGHT_SHOULDER ].position; glm::vec3 armNormal = armVector / distance; @@ -1315,13 +1314,13 @@ void Avatar::updateArmIKAndConstraints( float deltaTime ) { glm::vec3 newElbowPosition = _joint[ AVATAR_JOINT_RIGHT_SHOULDER ].position; newElbowPosition += armVector * ONE_HALF; - glm::vec3 perpendicular = glm::cross( _orientation.getFront(), armVector ); + glm::vec3 perpendicular = glm::cross(_orientation.getFront(), armVector); - newElbowPosition += perpendicular * ( 1.0f - ( _maxArmLength / distance ) ) * ONE_HALF; + newElbowPosition += perpendicular * (1.0f - (_maxArmLength / distance)) * ONE_HALF; _joint[ AVATAR_JOINT_RIGHT_ELBOW ].position = newElbowPosition; // set wrist position - glm::vec3 vv( _joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position ); + glm::vec3 vv(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position); vv -= _joint[ AVATAR_JOINT_RIGHT_ELBOW ].position; glm::vec3 newWristPosition = _joint[ AVATAR_JOINT_RIGHT_ELBOW ].position + vv * 0.7f; _joint[ AVATAR_JOINT_RIGHT_WRIST ].position = newWristPosition; @@ -1333,53 +1332,53 @@ void Avatar::renderBody() { // Render joint positions as spheres for (int b = 0; b < NUM_AVATAR_JOINTS; b++) { - if ( b != AVATAR_JOINT_HEAD_BASE ) { // the head is rendered as a special case in "renderHead" + if (b != AVATAR_JOINT_HEAD_BASE) { // the head is rendered as a special case in "renderHead" //render bone orientation - //renderOrientationDirections( _joint[b].springyPosition, _joint[b].orientation, _joint[b].radius * 2.0 ); + //renderOrientationDirections(_joint[b].springyPosition, _joint[b].orientation, _joint[b].radius * 2.0); - if ( _usingBodySprings ) { - glColor3fv( skinColor ); + if (_usingBodySprings) { + glColor3fv(skinColor); glPushMatrix(); - glTranslatef( _joint[b].springyPosition.x, _joint[b].springyPosition.y, _joint[b].springyPosition.z ); - glutSolidSphere( _joint[b].radius, 20.0f, 20.0f ); + glTranslatef(_joint[b].springyPosition.x, _joint[b].springyPosition.y, _joint[b].springyPosition.z); + glutSolidSphere(_joint[b].radius, 20.0f, 20.0f); glPopMatrix(); } else { - glColor3fv( skinColor ); + glColor3fv(skinColor); glPushMatrix(); - glTranslatef( _joint[b].position.x, _joint[b].position.y, _joint[b].position.z ); - glutSolidSphere( _joint[b].radius, 20.0f, 20.0f ); + glTranslatef(_joint[b].position.x, _joint[b].position.y, _joint[b].position.z); + glutSolidSphere(_joint[b].radius, 20.0f, 20.0f); glPopMatrix(); } } } // Render lines connecting the joint positions - if ( _usingBodySprings ) { - glColor3f( 0.4f, 0.5f, 0.6f ); + if (_usingBodySprings) { + glColor3f(0.4f, 0.5f, 0.6f); glLineWidth(3.0); for (int b = 1; b < NUM_AVATAR_JOINTS; b++) { - if ( _joint[b].parent != AVATAR_JOINT_NULL ) - if ( b != AVATAR_JOINT_HEAD_TOP ) { - glBegin( GL_LINE_STRIP ); - glVertex3fv( &_joint[ _joint[ b ].parent ].springyPosition.x ); - glVertex3fv( &_joint[ b ].springyPosition.x ); + if (_joint[b].parent != AVATAR_JOINT_NULL) + if (b != AVATAR_JOINT_HEAD_TOP) { + glBegin(GL_LINE_STRIP); + glVertex3fv(&_joint[ _joint[ b ].parent ].springyPosition.x); + glVertex3fv(&_joint[ b ].springyPosition.x); glEnd(); } } } /* else { - glColor3fv( skinColor ); + glColor3fv(skinColor); glLineWidth(3.0); for (int b = 1; b < NUM_AVATAR_JOINTS; b++) { - if ( _joint[b].parent != AVATAR_JOINT_NULL ) { - glBegin( GL_LINE_STRIP ); - glVertex3fv( &_joint[ _joint[ b ].parent ].position.x ); - glVertex3fv( &_joint[ b ].position.x); + if (_joint[b].parent != AVATAR_JOINT_NULL) { + glBegin(GL_LINE_STRIP); + glVertex3fv(&_joint[ _joint[ b ].parent ].position.x); + glVertex3fv(&_joint[ b ].position.x); glEnd(); } } @@ -1442,9 +1441,7 @@ void Avatar::processTransmitterData(unsigned char* packetData, int numBytes) { //printLog("Packet: [%s]\n", packetData); //printLog("Version: %s\n", device); - _transmitterInitialReading = glm::vec3( rot3, - rot2, - rot1 ); + _transmitterInitialReading = glm::vec3(rot3, rot2, rot1); } const int TRANSMITTER_COUNT = 100; if (_transmitterPackets % TRANSMITTER_COUNT == 0) { @@ -1452,7 +1449,7 @@ void Avatar::processTransmitterData(unsigned char* packetData, int numBytes) { timeval now; gettimeofday(&now, NULL); double msecsElapsed = diffclock(&_transmitterTimer, &now); - _transmitterHz = static_cast( (double)TRANSMITTER_COUNT / (msecsElapsed / 1000.0) ); + _transmitterHz = static_cast((double)TRANSMITTER_COUNT / (msecsElapsed / 1000.0)); _transmitterTimer = now; printLog("Transmitter Hz: %3.1f\n", _transmitterHz); } @@ -1469,12 +1466,12 @@ void Avatar::processTransmitterData(unsigned char* packetData, int numBytes) { glm::vec3 angularVelocity; if (deviceType != DEVICE_GLASS) { angularVelocity = glm::vec3(glm::degrees(gyrZ), glm::degrees(-gyrX), glm::degrees(gyrY)); - setHeadFromGyros( &eulerAngles, &angularVelocity, + setHeadFromGyros(&eulerAngles, &angularVelocity, (_transmitterHz == 0.f) ? 0.f : 1.f / _transmitterHz, 1.0); } else { angularVelocity = glm::vec3(glm::degrees(gyrY), glm::degrees(-gyrX), glm::degrees(-gyrZ)); - setHeadFromGyros( &eulerAngles, &angularVelocity, + setHeadFromGyros(&eulerAngles, &angularVelocity, (_transmitterHz == 0.f) ? 0.f : 1.f / _transmitterHz, 1000.0); } diff --git a/interface/src/AvatarTouch.cpp b/interface/src/AvatarTouch.cpp index 45d1eac1ed..89e9889005 100644 --- a/interface/src/AvatarTouch.cpp +++ b/interface/src/AvatarTouch.cpp @@ -16,10 +16,10 @@ const float THREAD_RADIUS = 0.012; AvatarTouch::AvatarTouch() { - _myHandPosition = glm::vec3( 0.0f, 0.0f, 0.0f ); - _yourHandPosition = glm::vec3( 0.0f, 0.0f, 0.0f ); - _myBodyPosition = glm::vec3( 0.0f, 0.0f, 0.0f ); - _yourBodyPosition = glm::vec3( 0.0f, 0.0f, 0.0f ); + _myHandPosition = glm::vec3(0.0f, 0.0f, 0.0f); + _yourHandPosition = glm::vec3(0.0f, 0.0f, 0.0f); + _myBodyPosition = glm::vec3(0.0f, 0.0f, 0.0f); + _yourBodyPosition = glm::vec3(0.0f, 0.0f, 0.0f); _myHandState = 0; _yourHandState = 0; _reachableRadius = 0.0f; @@ -28,7 +28,7 @@ AvatarTouch::AvatarTouch() { _handsCloseEnoughToGrasp = false; for (int p=0; p 1.0f ) { + if (_modeShift > 1.0f) { _modeShift = 1.0f; } } @@ -53,22 +53,19 @@ void Camera::update( float deltaTime ) { generateOrientation(); } - - // generate the ortho-normals for the orientation based on the three Euler angles void Camera::generateOrientation() { _orientation.setToIdentity(); - _orientation.pitch( _pitch ); - _orientation.yaw ( _yaw ); - _orientation.roll ( _roll ); + _orientation.pitch(_pitch); + _orientation.yaw (_yaw ); + _orientation.roll (_roll ); } - // use iterative forces to keep the camera at the desired position and angle -void Camera::updateFollowMode( float deltaTime ) { +void Camera::updateFollowMode(float deltaTime) { // derive t from tightness float t = _tightness * deltaTime; - if ( t > 1.0 ) { + if (t > 1.0) { t = 1.0; } @@ -114,8 +111,6 @@ void Camera::setFarClip (float f) { _frustumNeedsReshape = true; } - - // call to find out if the view frustum needs to be reshaped bool Camera::getFrustumNeedsReshape() { return _frustumNeedsReshape; diff --git a/interface/src/HandControl.cpp b/interface/src/HandControl.cpp index 37efc755c2..1d95388dd9 100644 --- a/interface/src/HandControl.cpp +++ b/interface/src/HandControl.cpp @@ -33,14 +33,14 @@ HandControl::HandControl() { _envelope = 0.0f; } -void HandControl::setScreenDimensions( int width, int height ) { +void HandControl::setScreenDimensions(int width, int height) { _width = width; _height = height; _startX = _width / 2; _startY = _height / 2; } -void HandControl::update( int x, int y ) { +void HandControl::update(int x, int y) { _lastX = _x; _lastY = _y; _x = x; @@ -49,22 +49,22 @@ void HandControl::update( int x, int y ) { _velocityY = _y - _lastY; // if the mouse is moving, ramp up the envelope to increase amplitude of hand movement... - if (( _velocityX != 0 ) - || ( _velocityY != 0 )) { + if ((_velocityX != 0) + || (_velocityY != 0)) { _enabled = true; - if ( _envelope < 1.0 ) { + if (_envelope < 1.0) { _envelope += _rampUpRate; - if ( _envelope >= 1.0 ) { + if (_envelope >= 1.0) { _envelope = 1.0; } } } // if not enabled ramp down the envelope to decrease amplitude of hand movement... - if ( ! _enabled ) { - if ( _envelope > 0.0 ) { + if (! _enabled) { + if (_envelope > 0.0) { _envelope -= _rampDownRate; - if ( _envelope <= 0.0 ) { + if (_envelope <= 0.0) { _startX = _width / 2; _startY = _height / 2; _envelope = 0.0; @@ -77,14 +77,14 @@ void HandControl::update( int x, int y ) { _backFront = 0.0; // if envelope is greater than zero, apply mouse movement to values to be output - if ( _envelope > 0.0 ) { - _leftRight += ( ( _x - _startX ) / (float)_width ) * _envelope; - _downUp += ( ( _y - _startY ) / (float)_height ) * _envelope; + if (_envelope > 0.0) { + _leftRight += ((_x - _startX) / (float)_width ) * _envelope; + _downUp += ((_y - _startY) / (float)_height) * _envelope; } } glm::vec3 HandControl::getValues() { - return glm::vec3( _leftRight, _downUp, _backFront ); + return glm::vec3(_leftRight, _downUp, _backFront); } void HandControl::stop() { diff --git a/interface/src/Util.cpp b/interface/src/Util.cpp index 69054e5bad..8d931f27c8 100644 --- a/interface/src/Util.cpp +++ b/interface/src/Util.cpp @@ -172,7 +172,7 @@ void drawtext(int x, int y, float scale, float rotate, float thick, int mono, // Draws text on screen as stroked so it can be resized // glPushMatrix(); - glTranslatef( static_cast(x), static_cast(y), 0.0f); + glTranslatef(static_cast(x), static_cast(y), 0.0f); glColor3f(r,g,b); glRotated(rotate,0,0,1); // glLineWidth(thick); @@ -208,7 +208,7 @@ void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, gl } void drawGroundPlaneGrid(float size) { - glColor3f( 0.4f, 0.5f, 0.3f ); + glColor3f(0.4f, 0.5f, 0.3f); glLineWidth(2.0); for (float x = 0; x <= size; x++) { @@ -234,7 +234,7 @@ void drawGroundPlaneGrid(float size) { void renderDiskShadow(glm::vec3 position, glm::vec3 upDirection, float radius, float darkness) { - glColor4f( 0.0f, 0.0f, 0.0f, darkness ); + glColor4f(0.0f, 0.0f, 0.0f, darkness); int num = 20; float y = 0.001f; @@ -264,7 +264,7 @@ void renderDiskShadow(glm::vec3 position, glm::vec3 upDirection, float radius, f void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::vec3 cameraPosition) { glm::vec3 vectorToPosition(glm::normalize(position - cameraPosition)); - glm::vec3 right = glm::cross(vectorToPosition, glm::vec3( 0.0f, 1.0f, 0.0f)); + glm::vec3 right = glm::cross(vectorToPosition, glm::vec3(0.0f, 1.0f, 0.0f)); glm::vec3 up = glm::cross(right, vectorToPosition); glBegin(GL_LINE_STRIP); @@ -285,7 +285,7 @@ void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::ve } -void renderCircle(glm::vec3 position, float radius, glm::vec3 surfaceNormal, int numSides ) { +void renderCircle(glm::vec3 position, float radius, glm::vec3 surfaceNormal, int numSides) { glm::vec3 perp1 = glm::vec3(surfaceNormal.y, surfaceNormal.z, surfaceNormal.x); glm::vec3 perp2 = glm::vec3(surfaceNormal.z, surfaceNormal.x, surfaceNormal.y); @@ -306,27 +306,27 @@ void renderCircle(glm::vec3 position, float radius, glm::vec3 surfaceNormal, int } -void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) { +void renderOrientationDirections(glm::vec3 position, Orientation orientation, float size) { glm::vec3 pRight = position + orientation.getRight() * size; - glm::vec3 pUp = position + orientation.getUp() * size; + glm::vec3 pUp = position + orientation.getUp () * size; glm::vec3 pFront = position + orientation.getFront() * size; - glColor3f( 1.0f, 0.0f, 0.0f ); - glBegin( GL_LINE_STRIP ); - glVertex3f( position.x, position.y, position.z ); - glVertex3f( pRight.x, pRight.y, pRight.z ); + glColor3f(1.0f, 0.0f, 0.0f); + glBegin(GL_LINE_STRIP); + glVertex3f(position.x, position.y, position.z); + glVertex3f(pRight.x, pRight.y, pRight.z); glEnd(); - glColor3f( 0.0f, 1.0f, 0.0f ); - glBegin( GL_LINE_STRIP ); - glVertex3f( position.x, position.y, position.z ); - glVertex3f( pUp.x, pUp.y, pUp.z ); + glColor3f(0.0f, 1.0f, 0.0f); + glBegin(GL_LINE_STRIP); + glVertex3f(position.x, position.y, position.z); + glVertex3f(pUp.x, pUp.y, pUp.z); glEnd(); - glColor3f( 0.0f, 0.0f, 1.0f ); - glBegin( GL_LINE_STRIP ); - glVertex3f( position.x, position.y, position.z ); - glVertex3f( pFront.x, pFront.y, pFront.z ); + glColor3f(0.0f, 0.0f, 1.0f); + glBegin(GL_LINE_STRIP); + glVertex3f(position.x, position.y, position.z); + glVertex3f(pFront.x, pFront.y, pFront.z); glEnd(); } diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 78aa3ebf33..c2425957a5 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -1030,27 +1030,27 @@ void display(void) // this version uses a ramp-up/ramp-down timer in the camera to determine shift between first and thirs-person view /* - if ( myAvatar.getSpeed() < 0.02 ) { + if (myAvatar.getSpeed() < 0.02) { - if (myCamera.getMode() != CAMERA_MODE_FIRST_PERSON ) { + if (myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) { myCamera.setMode(CAMERA_MODE_FIRST_PERSON); } - //printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift()); - myCamera.setPitch ( thirdPersonPitch + myCamera.getModeShift() * ( firstPersonPitch - thirdPersonPitch )); - myCamera.setUpShift ( thirdPersonUpShift + myCamera.getModeShift() * ( firstPersonUpShift - thirdPersonUpShift )); - myCamera.setDistance ( thirdPersonDistance + myCamera.getModeShift() * ( firstPersonDistance - thirdPersonDistance )); - myCamera.setTightness ( thirdPersonTightness + myCamera.getModeShift() * ( firstPersonTightness - thirdPersonTightness )); + //printf("myCamera.getModeShift() = %f\n", myCamera.getModeShift()); + myCamera.setPitch (thirdPersonPitch + myCamera.getModeShift() * (firstPersonPitch - thirdPersonPitch )); + myCamera.setUpShift (thirdPersonUpShift + myCamera.getModeShift() * (firstPersonUpShift - thirdPersonUpShift )); + myCamera.setDistance (thirdPersonDistance + myCamera.getModeShift() * (firstPersonDistance - thirdPersonDistance )); + myCamera.setTightness (thirdPersonTightness + myCamera.getModeShift() * (firstPersonTightness - thirdPersonTightness)); } else { - if (myCamera.getMode() != CAMERA_MODE_THIRD_PERSON ) { + if (myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) { myCamera.setMode(CAMERA_MODE_THIRD_PERSON); } - //printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift()); - myCamera.setPitch ( firstPersonPitch + myCamera.getModeShift() * ( thirdPersonPitch - firstPersonPitch )); - myCamera.setUpShift ( firstPersonUpShift + myCamera.getModeShift() * ( thirdPersonUpShift - firstPersonUpShift )); - myCamera.setDistance ( firstPersonDistance + myCamera.getModeShift() * ( thirdPersonDistance - firstPersonDistance )); - myCamera.setTightness ( firstPersonTightness + myCamera.getModeShift() * ( thirdPersonTightness - firstPersonTightness )); + //printf("myCamera.getModeShift() = %f\n", myCamera.getModeShift()); + myCamera.setPitch (firstPersonPitch + myCamera.getModeShift() * (thirdPersonPitch - firstPersonPitch )); + myCamera.setUpShift (firstPersonUpShift + myCamera.getModeShift() * (thirdPersonUpShift - firstPersonUpShift )); + myCamera.setDistance (firstPersonDistance + myCamera.getModeShift() * (thirdPersonDistance - firstPersonDistance )); + myCamera.setTightness (firstPersonTightness + myCamera.getModeShift() * (thirdPersonTightness - firstPersonTightness)); } */ @@ -1083,7 +1083,7 @@ void display(void) if (::viewFrustumFromOffset && ::frustumOn) { // set the camera to third-person view but offset so we can see the frustum - viewFrustumOffsetCamera.setTargetYaw(::viewFrustumOffsetYaw + myAvatar.getBodyYaw() ); + viewFrustumOffsetCamera.setTargetYaw(::viewFrustumOffsetYaw + myAvatar.getBodyYaw()); viewFrustumOffsetCamera.setPitch (::viewFrustumOffsetPitch ); viewFrustumOffsetCamera.setRoll (::viewFrustumOffsetRoll ); viewFrustumOffsetCamera.setUpShift (::viewFrustumOffsetUp ); @@ -1778,7 +1778,7 @@ glm::vec3 getGravity(glm::vec3 pos) { } void mouseFunc(int button, int state, int x, int y) { - if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN ) { + if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { if (state == GLUT_DOWN && !menu.mouseClick(x, y)) { mouseX = x; mouseY = y;