From 5a8c5ff0114ae6058d30448e50b2d02433a5298c Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 12 Apr 2013 16:55:57 -0700 Subject: [PATCH] coding standards clean up --- interface/src/Head.cpp | 4 +- interface/src/Orientation.cpp | 12 ++--- interface/src/main.cpp | 76 +++++++++++++--------------- libraries/voxels/src/ViewFrustum.cpp | 36 ++++++++----- 4 files changed, 69 insertions(+), 59 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index b4f67411e8..85050de2a1 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -1080,7 +1080,9 @@ void Head::updateHandMovement() { glm::vec3 newElbowPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; newElbowPosition += armVector * (float)ONE_HALF; glm::vec3 perpendicular = glm::cross( avatar.orientation.getFront(), armVector ); - newElbowPosition += perpendicular * (float)(( 1.0f - ( avatar.maxArmLength / distance ) ) * ONE_HALF); // XXXBHG - Jeffery, you should clean this up. You can't multiple glm::vec3's by doubles, only floats + + // XXXBHG - Jeffery, you should clean this up. You can't multiple glm::vec3's by doubles, only floats + newElbowPosition += perpendicular * (float)(( 1.0f - ( avatar.maxArmLength / distance ) ) * ONE_HALF); avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position = newElbowPosition; //----------------------------------------------------------------------------- diff --git a/interface/src/Orientation.cpp b/interface/src/Orientation.cpp index da46ed3e47..f82ced6630 100755 --- a/interface/src/Orientation.cpp +++ b/interface/src/Orientation.cpp @@ -25,8 +25,8 @@ void Orientation::set( Orientation o ) { void Orientation::yaw( float angle ) { float r = angle * PI_OVER_180; - float s = sin( r ); - float c = cos( r ); + float s = sin(r); + float c = cos(r); glm::vec3 cosineFront = front * c; glm::vec3 cosineRight = right * c; @@ -40,8 +40,8 @@ void Orientation::yaw( float angle ) { void Orientation::pitch( float angle ) { float r = angle * PI_OVER_180; - float s = sin( r ); - float c = cos( r ); + float s = sin(r); + float c = cos(r); glm::vec3 cosineUp = up * c; glm::vec3 cosineFront = front * c; @@ -55,8 +55,8 @@ void Orientation::pitch( float angle ) { void Orientation::roll( float angle ) { float r = angle * PI_OVER_180; - float s = sin( r ); - float c = cos( r ); + float s = sin(r); + float c = cos(r); glm::vec3 cosineUp = up * c; glm::vec3 cosineRight = right * c; diff --git a/interface/src/main.cpp b/interface/src/main.cpp index b5c7dd75c2..4fef28d587 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -534,7 +534,6 @@ void render_view_frustum() { right = headRight; } - //////////////////////////////////////// // Ask the ViewFrustum class to calculate our corners ViewFrustum vf(position,direction,up,right,::WIDTH,::HEIGHT); @@ -544,32 +543,30 @@ void render_view_frustum() { glLineWidth(1.0); glBegin(GL_LINES); - //////////////////////////////////////// // Drawing the head direction vectors - glm::vec3 headLookingAt = headPosition+(headDirection*0.2f); - glm::vec3 headLookingAtUp = headPosition+(headUp*0.2f); - glm::vec3 headLookingAtRight = headPosition+(headRight*0.2f); + glm::vec3 headLookingAt = headPosition + (headDirection * 0.2f); + glm::vec3 headLookingAtUp = headPosition + (headUp * 0.2f); + glm::vec3 headLookingAtRight = headPosition + (headRight * 0.2f); // Looking At from head = white glColor3f(1,1,1); - glVertex3f(headPosition.x,headPosition.y,headPosition.z); - glVertex3f(headLookingAt.x,headLookingAt.y,headLookingAt.z); + glVertex3f(headPosition.x, headPosition.y, headPosition.z); + glVertex3f(headLookingAt.x, headLookingAt.y, headLookingAt.z); // up from head = purple glColor3f(1,0,1); - glVertex3f(headPosition.x,headPosition.y,headPosition.z); - glVertex3f(headLookingAtUp.x,headLookingAtUp.y,headLookingAtUp.z); + glVertex3f(headPosition.x, headPosition.y, headPosition.z); + glVertex3f(headLookingAtUp.x, headLookingAtUp.y, headLookingAtUp.z); // right from head = cyan glColor3f(0,1,1); - glVertex3f(headPosition.x,headPosition.y,headPosition.z); - glVertex3f(headLookingAtRight.x,headLookingAtRight.y,headLookingAtRight.z); + glVertex3f(headPosition.x, headPosition.y, headPosition.z); + glVertex3f(headLookingAtRight.x, headLookingAtRight.y, headLookingAtRight.z); - //////////////////////////////////////// // Drawing the camera direction vectors - glm::vec3 cameraLookingAt = cameraPosition+(cameraDirection*0.2f); - glm::vec3 cameraLookingAtUp = cameraPosition+(cameraUp*0.2f); - glm::vec3 cameraLookingAtRight = cameraPosition+(cameraRight*0.2f); + glm::vec3 cameraLookingAt = cameraPosition + (cameraDirection * 0.2f); + glm::vec3 cameraLookingAtUp = cameraPosition + (cameraUp * 0.2f); + glm::vec3 cameraLookingAtRight = cameraPosition + (cameraRight * 0.2f); // Looking At from camera = white glColor3f(1,1,1); @@ -587,61 +584,60 @@ void render_view_frustum() { glVertex3f(cameraLookingAtRight.x,cameraLookingAtRight.y,cameraLookingAtRight.z); - //////////////////////////////////////// // Drawing the bounds of the frustum // vf.getNear plane - bottom edge glColor3f(1,0,0); - glVertex3f(vf.getNearBottomLeft().x,vf.getNearBottomLeft().y,vf.getNearBottomLeft().z); - glVertex3f(vf.getNearBottomRight().x,vf.getNearBottomRight().y,vf.getNearBottomRight().z); + glVertex3f(vf.getNearBottomLeft().x, vf.getNearBottomLeft().y, vf.getNearBottomLeft().z); + glVertex3f(vf.getNearBottomRight().x, vf.getNearBottomRight().y, vf.getNearBottomRight().z); // vf.getNear plane - top edge - glVertex3f(vf.getNearTopLeft().x,vf.getNearTopLeft().y,vf.getNearTopLeft().z); - glVertex3f(vf.getNearTopRight().x,vf.getNearTopRight().y,vf.getNearTopRight().z); + glVertex3f(vf.getNearTopLeft().x, vf.getNearTopLeft().y, vf.getNearTopLeft().z); + glVertex3f(vf.getNearTopRight().x, vf.getNearTopRight().y, vf.getNearTopRight().z); // vf.getNear plane - right edge - glVertex3f(vf.getNearBottomRight().x,vf.getNearBottomRight().y,vf.getNearBottomRight().z); - glVertex3f(vf.getNearTopRight().x,vf.getNearTopRight().y,vf.getNearTopRight().z); + glVertex3f(vf.getNearBottomRight().x, vf.getNearBottomRight().y, vf.getNearBottomRight().z); + glVertex3f(vf.getNearTopRight().x, vf.getNearTopRight().y, vf.getNearTopRight().z); // vf.getNear plane - left edge - glVertex3f(vf.getNearBottomLeft().x,vf.getNearBottomLeft().y,vf.getNearBottomLeft().z); - glVertex3f(vf.getNearTopLeft().x,vf.getNearTopLeft().y,vf.getNearTopLeft().z); + glVertex3f(vf.getNearBottomLeft().x, vf.getNearBottomLeft().y, vf.getNearBottomLeft().z); + glVertex3f(vf.getNearTopLeft().x, vf.getNearTopLeft().y, vf.getNearTopLeft().z); // vf.getFar plane - bottom edge glColor3f(0,1,0); // GREEN!!! - glVertex3f(vf.getFarBottomLeft().x,vf.getFarBottomLeft().y,vf.getFarBottomLeft().z); - glVertex3f(vf.getFarBottomRight().x,vf.getFarBottomRight().y,vf.getFarBottomRight().z); + glVertex3f(vf.getFarBottomLeft().x, vf.getFarBottomLeft().y, vf.getFarBottomLeft().z); + glVertex3f(vf.getFarBottomRight().x, vf.getFarBottomRight().y, vf.getFarBottomRight().z); // vf.getFar plane - top edge - glVertex3f(vf.getFarTopLeft().x,vf.getFarTopLeft().y,vf.getFarTopLeft().z); - glVertex3f(vf.getFarTopRight().x,vf.getFarTopRight().y,vf.getFarTopRight().z); + glVertex3f(vf.getFarTopLeft().x, vf.getFarTopLeft().y, vf.getFarTopLeft().z); + glVertex3f(vf.getFarTopRight().x, vf.getFarTopRight().y, vf.getFarTopRight().z); // vf.getFar plane - right edge - glVertex3f(vf.getFarBottomRight().x,vf.getFarBottomRight().y,vf.getFarBottomRight().z); - glVertex3f(vf.getFarTopRight().x,vf.getFarTopRight().y,vf.getFarTopRight().z); + glVertex3f(vf.getFarBottomRight().x, vf.getFarBottomRight().y, vf.getFarBottomRight().z); + glVertex3f(vf.getFarTopRight().x, vf.getFarTopRight().y, vf.getFarTopRight().z); // vf.getFar plane - left edge - glVertex3f(vf.getFarBottomLeft().x,vf.getFarBottomLeft().y,vf.getFarBottomLeft().z); - glVertex3f(vf.getFarTopLeft().x,vf.getFarTopLeft().y,vf.getFarTopLeft().z); + glVertex3f(vf.getFarBottomLeft().x, vf.getFarBottomLeft().y, vf.getFarBottomLeft().z); + glVertex3f(vf.getFarTopLeft().x, vf.getFarTopLeft().y, vf.getFarTopLeft().z); // RIGHT PLANE IS CYAN // right plane - bottom edge - vf.getNear to distant glColor3f(0,1,1); - glVertex3f(vf.getNearBottomRight().x,vf.getNearBottomRight().y,vf.getNearBottomRight().z); - glVertex3f(vf.getFarBottomRight().x,vf.getFarBottomRight().y,vf.getFarBottomRight().z); + glVertex3f(vf.getNearBottomRight().x, vf.getNearBottomRight().y, vf.getNearBottomRight().z); + glVertex3f(vf.getFarBottomRight().x, vf.getFarBottomRight().y, vf.getFarBottomRight().z); // right plane - top edge - vf.getNear to distant - glVertex3f(vf.getNearTopRight().x,vf.getNearTopRight().y,vf.getNearTopRight().z); - glVertex3f(vf.getFarTopRight().x,vf.getFarTopRight().y,vf.getFarTopRight().z); + glVertex3f(vf.getNearTopRight().x, vf.getNearTopRight().y, vf.getNearTopRight().z); + glVertex3f(vf.getFarTopRight().x, vf.getFarTopRight().y, vf.getFarTopRight().z); // LEFT PLANE IS BLUE // left plane - bottom edge - vf.getNear to distant glColor3f(0,0,1); - glVertex3f(vf.getNearBottomLeft().x,vf.getNearBottomLeft().y,vf.getNearBottomLeft().z); - glVertex3f(vf.getFarBottomLeft().x,vf.getFarBottomLeft().y,vf.getFarBottomLeft().z); + glVertex3f(vf.getNearBottomLeft().x, vf.getNearBottomLeft().y, vf.getNearBottomLeft().z); + glVertex3f(vf.getFarBottomLeft().x, vf.getFarBottomLeft().y, vf.getFarBottomLeft().z); // left plane - top edge - vf.getNear to distant - glVertex3f(vf.getNearTopLeft().x,vf.getNearTopLeft().y,vf.getNearTopLeft().z); - glVertex3f(vf.getFarTopLeft().x,vf.getFarTopLeft().y,vf.getFarTopLeft().z); + glVertex3f(vf.getNearTopLeft().x, vf.getNearTopLeft().y, vf.getNearTopLeft().z); + glVertex3f(vf.getFarTopLeft().x, vf.getFarTopLeft().y, vf.getFarTopLeft().z); glEnd(); } diff --git a/libraries/voxels/src/ViewFrustum.cpp b/libraries/voxels/src/ViewFrustum.cpp index 29ed92fb9e..b7fae39ca5 100644 --- a/libraries/voxels/src/ViewFrustum.cpp +++ b/libraries/voxels/src/ViewFrustum.cpp @@ -10,7 +10,8 @@ #include "ViewFrustum.h" -ViewFrustum::ViewFrustum(glm::vec3 position, glm::vec3 direction, glm::vec3 up, glm::vec3 right, float screenWidth, float screenHeight) { +ViewFrustum::ViewFrustum(glm::vec3 position, glm::vec3 direction, + glm::vec3 up, glm::vec3 right, float screenWidth, float screenHeight) { this->calculateViewFrustum(position, direction, up, right, screenWidth, screenHeight); } @@ -23,7 +24,8 @@ ViewFrustum::ViewFrustum(glm::vec3 position, glm::vec3 direction, glm::vec3 up, // Notes on how/why this works: // http://www.lighthouse3d.com/tutorials/view-frustum-culling/view-frustums-shape/ // -void ViewFrustum::calculateViewFrustum(glm::vec3 position, glm::vec3 direction, glm::vec3 up, glm::vec3 right, float screenWidth, float screenHeight) { +void ViewFrustum::calculateViewFrustum(glm::vec3 position, glm::vec3 direction, + glm::vec3 up, glm::vec3 right, float screenWidth, float screenHeight) { // Save the values we were passed... this->_position=position; @@ -73,17 +75,27 @@ void ViewFrustum::dump() { printf("nearHeight=%f\n",this->_nearHeight); printf("nearWidth=%f\n",this->_nearWidth); - printf("farCenter.x=%f, farCenter.y=%f, farCenter.z=%f\n",this->_farCenter.x,this->_farCenter.y,this->_farCenter.z); - printf("farTopLeft.x=%f, farTopLeft.y=%f, farTopLeft.z=%f\n",this->_farTopLeft.x,this->_farTopLeft.y,this->_farTopLeft.z); - printf("farTopRight.x=%f, farTopRight.y=%f, farTopRight.z=%f\n",this->_farTopRight.x,this->_farTopRight.y,this->_farTopRight.z); - printf("farBottomLeft.x=%f, farBottomLeft.y=%f, farBottomLeft.z=%f\n",this->_farBottomLeft.x,this->_farBottomLeft.y,this->_farBottomLeft.z); - printf("farBottomRight.x=%f, farBottomRight.y=%f, farBottomRight.z=%f\n",this->_farBottomRight.x,this->_farBottomRight.y,this->_farBottomRight.z); + printf("farCenter.x=%f, farCenter.y=%f, farCenter.z=%f\n", + this->_farCenter.x,this->_farCenter.y,this->_farCenter.z); + printf("farTopLeft.x=%f, farTopLeft.y=%f, farTopLeft.z=%f\n", + this->_farTopLeft.x,this->_farTopLeft.y,this->_farTopLeft.z); + printf("farTopRight.x=%f, farTopRight.y=%f, farTopRight.z=%f\n", + this->_farTopRight.x,this->_farTopRight.y,this->_farTopRight.z); + printf("farBottomLeft.x=%f, farBottomLeft.y=%f, farBottomLeft.z=%f\n", + this->_farBottomLeft.x,this->_farBottomLeft.y,this->_farBottomLeft.z); + printf("farBottomRight.x=%f, farBottomRight.y=%f, farBottomRight.z=%f\n", + this->_farBottomRight.x,this->_farBottomRight.y,this->_farBottomRight.z); - printf("nearCenter.x=%f, nearCenter.y=%f, nearCenter.z=%f\n",this->_nearCenter.x,this->_nearCenter.y,this->_nearCenter.z); - printf("nearTopLeft.x=%f, nearTopLeft.y=%f, nearTopLeft.z=%f\n",this->_nearTopLeft.x,this->_nearTopLeft.y,this->_nearTopLeft.z); - printf("nearTopRight.x=%f, nearTopRight.y=%f, nearTopRight.z=%f\n",this->_nearTopRight.x,this->_nearTopRight.y,this->_nearTopRight.z); - printf("nearBottomLeft.x=%f, nearBottomLeft.y=%f, nearBottomLeft.z=%f\n",this->_nearBottomLeft.x,this->_nearBottomLeft.y,this->_nearBottomLeft.z); - printf("nearBottomRight.x=%f, nearBottomRight.y=%f, nearBottomRight.z=%f\n",this->_nearBottomRight.x,this->_nearBottomRight.y,this->_nearBottomRight.z); + printf("nearCenter.x=%f, nearCenter.y=%f, nearCenter.z=%f\n", + this->_nearCenter.x,this->_nearCenter.y,this->_nearCenter.z); + printf("nearTopLeft.x=%f, nearTopLeft.y=%f, nearTopLeft.z=%f\n", + this->_nearTopLeft.x,this->_nearTopLeft.y,this->_nearTopLeft.z); + printf("nearTopRight.x=%f, nearTopRight.y=%f, nearTopRight.z=%f\n", + this->_nearTopRight.x,this->_nearTopRight.y,this->_nearTopRight.z); + printf("nearBottomLeft.x=%f, nearBottomLeft.y=%f, nearBottomLeft.z=%f\n", + this->_nearBottomLeft.x,this->_nearBottomLeft.y,this->_nearBottomLeft.z); + printf("nearBottomRight.x=%f, nearBottomRight.y=%f, nearBottomRight.z=%f\n", + this->_nearBottomRight.x,this->_nearBottomRight.y,this->_nearBottomRight.z); }