From 65181cb4e01a636002956a4af963ff074e183d28 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Mon, 6 May 2013 22:23:16 -0700 Subject: [PATCH] changed some spacing formatting things --- interface/src/Avatar.cpp | 6 +-- interface/src/AvatarRenderer.cpp | 22 --------- interface/src/AvatarTouch.cpp | 26 +++++----- interface/src/AvatarTouch.h | 6 +-- interface/src/main.cpp | 82 ++++++++++++++------------------ 5 files changed, 54 insertions(+), 88 deletions(-) diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index fc2177c1d3..9a4a1b16c8 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -312,7 +312,7 @@ void Avatar::setLeanSideways(float dist){ _head.leanSideways = dist; } -void Avatar::setMousePressed( bool mousePressed ) { +void Avatar::setMousePressed(bool mousePressed) { _mousePressed = mousePressed; } @@ -445,7 +445,7 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) { _avatarTouch.setMyBodyPosition(_position); Avatar * _interactingOther = NULL; - float closestDistance = std::numeric_limits::max();; + float closestDistance = std::numeric_limits::max(); //loop through all the other avatars for potential interactions... AgentList* agentList = AgentList::getInstance(); @@ -479,7 +479,7 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) { //Set the vector we send for hand position to other people to be our right hand setHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position); - if ( _mousePressed ) { + if (_mousePressed) { _handState = 1; } else { _handState = 0; diff --git a/interface/src/AvatarRenderer.cpp b/interface/src/AvatarRenderer.cpp index 52d3fc0026..02a2f1db83 100644 --- a/interface/src/AvatarRenderer.cpp +++ b/interface/src/AvatarRenderer.cpp @@ -11,31 +11,9 @@ #include "AvatarRenderer.h" #include "InterfaceConfig.h" - -#include -#include -#include -#include -#include "Avatar.h" -#include "Log.h" -#include "ui/TextRenderer.h" -#include -#include -#include - - AvatarRenderer::AvatarRenderer() { } // this method renders the avatar void AvatarRenderer::render(Avatar *avatar, bool lookingInMirror) { -/* - // show avatar position - glColor4f( 0.5f, 0.5f, 0.5f, 0.6 ); - glPushMatrix(); - glTranslatef(avatar->_position.x, avatar->_position.y, avatar->_position.z); - glScalef( 0.03, 0.03, 0.03 ); - glutSolidSphere( 1, 10, 10 ); - glPopMatrix(); - */ } \ No newline at end of file diff --git a/interface/src/AvatarTouch.cpp b/interface/src/AvatarTouch.cpp index b56a8ac7e8..45d1eac1ed 100644 --- a/interface/src/AvatarTouch.cpp +++ b/interface/src/AvatarTouch.cpp @@ -32,31 +32,31 @@ AvatarTouch::AvatarTouch() { } } -void AvatarTouch::setMyHandPosition( glm::vec3 position ) { +void AvatarTouch::setMyHandPosition(glm::vec3 position) { _myHandPosition = position; } -void AvatarTouch::setYourHandPosition( glm::vec3 position ) { +void AvatarTouch::setYourHandPosition(glm::vec3 position) { _yourHandPosition = position; } -void AvatarTouch::setMyBodyPosition( glm::vec3 position ) { +void AvatarTouch::setMyBodyPosition(glm::vec3 position) { _myBodyPosition = position; } -void AvatarTouch::setYourBodyPosition( glm::vec3 position ) { +void AvatarTouch::setYourBodyPosition(glm::vec3 position) { _yourBodyPosition = position; } -void AvatarTouch::setMyHandState( int state ) { +void AvatarTouch::setMyHandState(int state) { _myHandState = state; } -void AvatarTouch::setYourHandState( int state ) { +void AvatarTouch::setYourHandState(int state) { _yourHandState = state; } -void AvatarTouch::setReachableRadius( float r ) { +void AvatarTouch::setReachableRadius(float r) { _reachableRadius = r; } @@ -71,7 +71,7 @@ void AvatarTouch::render(glm::vec3 cameraPosition) { renderCircle(p, _reachableRadius, glm::vec3(0.0f, 1.0f, 0.0f), 30); // if your hand is grasping, show it... - if ( _yourHandState == 1 ) { + if (_yourHandState == 1) { glPushMatrix(); glTranslatef(_yourHandPosition.x, _yourHandPosition.y, _yourHandPosition.z); glColor4f( 1.0, 1.0, 0.8, 0.3 ); glutSolidSphere( 0.020f, 10.0f, 10.0f ); @@ -81,13 +81,13 @@ void AvatarTouch::render(glm::vec3 cameraPosition) { } //show beam - glm::vec3 v1( _myHandPosition ); - glm::vec3 v2( _yourHandPosition ); + glm::vec3 v1(_myHandPosition); + glm::vec3 v2(_yourHandPosition); if (_handsCloseEnoughToGrasp) { - glLineWidth( 2.0 ); + glLineWidth(2.0); glColor4f( 0.7f, 0.4f, 0.1f, 0.3 ); - glBegin( GL_LINE_STRIP ); + glBegin(GL_LINE_STRIP); glVertex3f( v1.x, v1.y, v1.z ); glVertex3f( v2.x, v2.y, v2.z ); glEnd(); @@ -103,7 +103,7 @@ void AvatarTouch::render(glm::vec3 cameraPosition) { } // if my hand is grasping, show it... - if ( _myHandState == 1 ) { + if (_myHandState == 1) { glPushMatrix(); glTranslatef(_myHandPosition.x, _myHandPosition.y, _myHandPosition.z); glColor4f( 1.0, 1.0, 0.8, 0.3 ); glutSolidSphere( 0.020f, 10.0f, 10.0f ); diff --git a/interface/src/AvatarTouch.h b/interface/src/AvatarTouch.h index 81803bd051..7da3df5adc 100644 --- a/interface/src/AvatarTouch.h +++ b/interface/src/AvatarTouch.h @@ -30,9 +30,9 @@ public: void setReachableRadius (float r); void setAbleToReachOtherAvatar (bool a) {_canReachToOtherAvatar = a;} void setHandsCloseEnoughToGrasp(bool h) {_handsCloseEnoughToGrasp = h;} - - bool getAbleToReachOtherAvatar () {return _canReachToOtherAvatar;} - bool getHandsCloseEnoughToGrasp() {return _handsCloseEnoughToGrasp;} + + bool getAbleToReachOtherAvatar () const {return _canReachToOtherAvatar;} + bool getHandsCloseEnoughToGrasp() const {return _handsCloseEnoughToGrasp;} private: diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 2c4c886171..78aa3ebf33 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -692,14 +692,14 @@ void displaySide(Camera& whichCamera) { float sphereRadius = 0.25f; glColor3f(1,0,0); glPushMatrix(); - glutSolidSphere( sphereRadius, 15, 15 ); + glutSolidSphere(sphereRadius, 15, 15); glPopMatrix(); //draw a grid ground plane.... drawGroundPlaneGrid(10.f); // Draw voxels - if ( showingVoxels ) + if (showingVoxels) { voxels.render(); } @@ -984,15 +984,15 @@ void display(void) glMateriali(GL_FRONT, GL_SHININESS, 96); // camera settings - if ( ::lookingInMirror ) { + if (::lookingInMirror) { // set the camera to looking at my own face - myCamera.setTargetPosition ( myAvatar.getHeadPosition() ); - myCamera.setTargetYaw ( myAvatar.getBodyYaw() - 180.0f ); // 180 degrees from body yaw - myCamera.setPitch ( 0.0 ); - myCamera.setRoll ( 0.0 ); - myCamera.setUpShift ( 0.0 ); - myCamera.setDistance ( 0.2 ); - myCamera.setTightness ( 100.0f ); + myCamera.setTargetPosition (myAvatar.getHeadPosition()); + myCamera.setTargetYaw (myAvatar.getBodyYaw() - 180.0f); // 180 degrees from body yaw + myCamera.setPitch (0.0); + myCamera.setRoll (0.0); + myCamera.setUpShift (0.0); + myCamera.setDistance (0.2); + myCamera.setTightness (100.0f); } else { //float firstPersonPitch = 20.0f; @@ -1010,36 +1010,24 @@ void display(void) float thirdPersonDistance = 1.2f; float thirdPersonTightness = 8.0f; - if ( USING_FIRST_PERSON_EFFECT ) { + if (USING_FIRST_PERSON_EFFECT) { float ff = 0.0; float min = 0.1; float max = 0.5; - if ( myAvatar.getIsNearInteractingOther()){ - if ( myAvatar.getSpeed() < max ) { + if (myAvatar.getIsNearInteractingOther()){ + if (myAvatar.getSpeed() < max) { float s = (myAvatar.getSpeed()- min)/max ; ff = 1.0 - s; } } - - /* - if ( ff < 0.8 ) { - myAvatar.setDisplayingHead( true ); - } else { - myAvatar.setDisplayingHead( false ); - } - */ - - //printf( "ff = %f\n", ff ); - myCamera.setPitch ( thirdPersonPitch + ff * ( firstPersonPitch - thirdPersonPitch )); - myCamera.setUpShift ( thirdPersonUpShift + ff * ( firstPersonUpShift - thirdPersonUpShift )); - myCamera.setDistance ( thirdPersonDistance + ff * ( firstPersonDistance - thirdPersonDistance )); - myCamera.setTightness ( thirdPersonTightness + ff * ( firstPersonTightness - thirdPersonTightness )); + myCamera.setPitch (thirdPersonPitch + ff * (firstPersonPitch - thirdPersonPitch )); + myCamera.setUpShift (thirdPersonUpShift + ff * (firstPersonUpShift - thirdPersonUpShift )); + myCamera.setDistance (thirdPersonDistance + ff * (firstPersonDistance - thirdPersonDistance )); + myCamera.setTightness (thirdPersonTightness + ff * (firstPersonTightness - thirdPersonTightness)); - - // 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 ) { @@ -1073,13 +1061,13 @@ void display(void) myCamera.setTightness(thirdPersonTightness); } - myCamera.setTargetPosition( myAvatar.getHeadPosition() ); - myCamera.setTargetYaw ( myAvatar.getBodyYaw() ); - myCamera.setRoll ( 0.0 ); + myCamera.setTargetPosition(myAvatar.getHeadPosition()); + myCamera.setTargetYaw (myAvatar.getBodyYaw()); + myCamera.setRoll (0.0); } // important... - myCamera.update( 1.f/FPS ); + myCamera.update(1.f/FPS); // Note: whichCamera is used to pick between the normal camera myCamera for our // main camera, vs, an alternate camera. The alternate camera we support right now @@ -1095,11 +1083,11 @@ 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.setPitch ( ::viewFrustumOffsetPitch ); - viewFrustumOffsetCamera.setRoll ( ::viewFrustumOffsetRoll ); - viewFrustumOffsetCamera.setUpShift ( ::viewFrustumOffsetUp ); - viewFrustumOffsetCamera.setDistance ( ::viewFrustumOffsetDistance ); + viewFrustumOffsetCamera.setTargetYaw(::viewFrustumOffsetYaw + myAvatar.getBodyYaw() ); + viewFrustumOffsetCamera.setPitch (::viewFrustumOffsetPitch ); + viewFrustumOffsetCamera.setRoll (::viewFrustumOffsetRoll ); + viewFrustumOffsetCamera.setUpShift (::viewFrustumOffsetUp ); + viewFrustumOffsetCamera.setDistance (::viewFrustumOffsetDistance); viewFrustumOffsetCamera.update(1.f/FPS); whichCamera = viewFrustumOffsetCamera; } @@ -1109,11 +1097,11 @@ void display(void) // or could be viewFrustumOffsetCamera if in offset mode // I changed the ordering here - roll is FIRST (JJV) - glRotatef ( whichCamera.getRoll(), IDENTITY_FRONT.x, IDENTITY_FRONT.y, IDENTITY_FRONT.z ); - glRotatef ( whichCamera.getPitch(), IDENTITY_RIGHT.x, IDENTITY_RIGHT.y, IDENTITY_RIGHT.z ); - glRotatef ( 180.0 - whichCamera.getYaw(), IDENTITY_UP.x, IDENTITY_UP.y, IDENTITY_UP.z ); + glRotatef ( whichCamera.getRoll(), IDENTITY_FRONT.x, IDENTITY_FRONT.y, IDENTITY_FRONT.z); + glRotatef ( whichCamera.getPitch(), IDENTITY_RIGHT.x, IDENTITY_RIGHT.y, IDENTITY_RIGHT.z); + glRotatef (180.0 - whichCamera.getYaw(), IDENTITY_UP.x, IDENTITY_UP.y, IDENTITY_UP.z ); - glTranslatef( -whichCamera.getPosition().x, -whichCamera.getPosition().y, -whichCamera.getPosition().z ); + glTranslatef(-whichCamera.getPosition().x, -whichCamera.getPosition().y, -whichCamera.getPosition().z); if (::oculusOn) { displayOculus(whichCamera); @@ -1666,16 +1654,16 @@ void idle(void) { // update behaviors for avatar hand movement: handControl takes mouse values as input, // and gives back 3D values modulated for smooth transitioning between interaction modes. - handControl.update( mouseX, mouseY ); - myAvatar.setHandMovementValues( handControl.getValues() ); + handControl.update(mouseX, mouseY); + myAvatar.setHandMovementValues(handControl.getValues()); // tell my avatar if the mouse is being pressed... - if ( mousePressed) { + if (mousePressed) { myAvatar.setMousePressed(mousePressed); } // walking triggers the handControl to stop - if ( myAvatar.getMode() == AVATAR_MODE_WALKING ) { + if (myAvatar.getMode() == AVATAR_MODE_WALKING) { handControl.stop(); } @@ -1868,7 +1856,7 @@ int main(int argc, const char * argv[]) #ifdef _WIN32 WSADATA WsaData; - int wsaresult = WSAStartup( MAKEWORD(2,2), &WsaData ); + int wsaresult = WSAStartup(MAKEWORD(2,2), &WsaData); #endif // start the agentList threads