From 606c91bb471928c697b119c0e7e7a67a58644ace Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 11 Apr 2013 14:56:10 -0700 Subject: [PATCH 1/3] remove the Vector3D class, not in use --- interface/src/Vector3D.cpp | 267 ------------------------------------- interface/src/Vector3D.h | 66 --------- 2 files changed, 333 deletions(-) delete mode 100755 interface/src/Vector3D.cpp delete mode 100755 interface/src/Vector3D.h diff --git a/interface/src/Vector3D.cpp b/interface/src/Vector3D.cpp deleted file mode 100755 index 0e6393ecac..0000000000 --- a/interface/src/Vector3D.cpp +++ /dev/null @@ -1,267 +0,0 @@ -//----------------------------------------------------------- -// -// Created by Jeffrey Ventrella and added as a utility -// class for High Fidelity Code base, April 2013 -// -//----------------------------------------------------------- - -#include "Vector3D.h" -#include // "Math.h" - -//--------------------------------------- -Vector3D::Vector3D() -{ - x = 0.0; - y = 0.0; - z = 0.0; -} - -//--------------------------------------- -Vector3D::Vector3D( double x_, double y_, double z_ ) -{ - x = x_; - y = y_; - z = z_; -} - -//--------------------------------------- -Vector3D::Vector3D( const Vector3D & v ) -{ - x = v.x; - y = v.y; - z = v.z; -} - -//----------------------------------------------------- -void Vector3D::setXYZ( double x_, double y_, double z_ ) -{ - x = x_; - y = y_; - z = z_; -} - - -//--------------------- -void Vector3D::clear() -{ - x = 0.0; - y = 0.0; - z = 0.0; -} - - -//----------------------------------------------------- -void Vector3D::addXYZ( double x_, double y_, double z_ ) -{ - x += x_; - y += y_; - z += z_; -} - -//--------------------------------------- -void Vector3D::set( const Vector3D &v ) -{ - x = v.x; - y = v.y; - z = v.z; -} - -//------------------------------------- -void Vector3D::add( const Vector3D &v ) -{ - x += v.x; - y += v.y; - z += v.z; -} - - -//-------------------------------------------- -void Vector3D::subtract ( const Vector3D &v ) -{ - x -= v.x; - y -= v.y; - z -= v.z; -} - -//----------------------------------------------------- -void Vector3D::addScaled( const Vector3D &v, double s ) -{ - x += v.x * s; - y += v.y * s; - z += v.z * s; -} - -//----------------------------------------------------- -void Vector3D::subtractScaled( const Vector3D &v, double s ) -{ - x -= v.x * s; - y -= v.y * s; - z -= v.z * s; -} - - -//------------------------- -void Vector3D::normalize() -{ - double d = sqrt( x * x + y * y + z * z ); - - if ( d > 0.0 ) - { - x /= d; - y /= d; - z /= d; - } -} - - -//-------------------------------------------- -void Vector3D::setX ( double x_ ) { x = x_; } -void Vector3D::setY ( double y_ ) { y = y_; } -void Vector3D::setZ ( double z_ ) { z = z_; } - -void Vector3D::addX ( double x_ ) { x += x_; } -void Vector3D::addY ( double y_ ) { y += y_; } -void Vector3D::addZ ( double z_ ) { z += z_; } - -double Vector3D::getX () { return x; } -double Vector3D::getY () { return y; } -double Vector3D::getZ () { return z; } - -void Vector3D::scaleX ( double s ) { x *= s; } -void Vector3D::scaleY ( double s ) { y *= s; } -void Vector3D::scaleZ ( double s ) { z *= s; } - - -//----------------------------------------------------- -void Vector3D::setToScaled( const Vector3D &v, double s ) -{ - Vector3D c; - - x = v.x * s; - y = v.y * s; - z = v.z * s; -} - -//-------------------------------------------------------------------- -void Vector3D::setToAverage( const Vector3D &v1, const Vector3D &v2 ) -{ - x = v1.x + ( v2.x - v1.x ) * 0.5; - y = v1.y + ( v2.y - v1.y ) * 0.5; - z = v1.z + ( v2.z - v1.z ) * 0.5; -} - - -//----------------------------------------------------- -void Vector3D::setToDifference( const Vector3D &v1, const Vector3D &v2 ) -{ - x = v1.x - v2.x; - y = v1.y - v2.y; - z = v1.z - v2.z; -} - -//----------------------------------------------------- -void Vector3D::scale( double s ) -{ - x *= s; - y *= s; - z *= s; -} - -//----------------------------------------------------- -double Vector3D::getMagnitude() -{ - return sqrt( x * x + y * y + z * z ); -} - - -//----------------------------------------------------- -double Vector3D::getMagnitudeSquared() -{ - return x * x + y * y + z * z ; -} - -//----------------------------------------------------- -double Vector3D::getDistanceTo( const Vector3D &v ) -{ - double xx = v.x - x; - double yy = v.y - y; - double zz = v.z - z; - - return sqrt( xx * xx + yy * yy + zz * zz ); -} - - -//----------------------------------------------------- -double Vector3D::getDistanceSquaredTo( const Vector3D &v ) -{ - double xx = v.x - x; - double yy = v.y - y; - double zz = v.z - z; - - return xx * xx + yy * yy + zz * zz; -} - - -//------------------------------------------------------------------- -double Vector3D::getDistance( const Vector3D &v1, const Vector3D &v2 ) -{ - double xx = v2.x - v1.x; - double yy = v2.y - v1.y; - double zz = v2.z - v1.z; - - return sqrt( xx * xx + yy * yy + zz * zz ); -} - - -//--------------------------------------------------------------------------- -double Vector3D::getDistanceSquared( const Vector3D &v1, const Vector3D &v2 ) -{ - double xx = v2.x - v1.x; - double yy = v2.y - v1.y; - double zz = v2.z - v1.z; - - return xx * xx + yy * yy + zz * zz; -} - - -//----------------------------------------------------- -double Vector3D::dotWith( const Vector3D &v ) -{ - return - x * v.x + - y * v.y + - z * v.z; -} - - - -//----------------------------------------------------------------- -void Vector3D::setToCross( const Vector3D &v1, const Vector3D &v2 ) -{ - x = v1.z * v2.y - v1.y * v2.z; - y = v1.x * v2.z - v1.z * v2.x; - z = v1.y * v2.x - v1.x * v2.y; -} - - -//--------------------------------------------------------------- -void Vector3D::setToSum( const Vector3D &v1, const Vector3D &v2 ) -{ - x = v1.x + v2.x; - y = v1.y + v2.y; - z = v1.z + v2.z; -} - - -//----------------------------------------------------- -void Vector3D::halve() -{ - x *= 0.5; - y *= 0.5; - z *= 0.5; -} - - - - - diff --git a/interface/src/Vector3D.h b/interface/src/Vector3D.h deleted file mode 100755 index 9b2bc9744c..0000000000 --- a/interface/src/Vector3D.h +++ /dev/null @@ -1,66 +0,0 @@ -//----------------------------------------------------------- -// -// Created by Jeffrey Ventrella and added as a utility -// class for High Fidelity Code base, April 2013 -// -//----------------------------------------------------------- - -#ifndef __interface__vector3D__ -#define __interface__vector3D__ - -class Vector3D -{ -public: - - //------------------ - // members - //------------------ - double x; - double y; - double z; - - //------------------ - // methods - //------------------ - Vector3D(); - Vector3D( double, double, double ); - Vector3D( const Vector3D & ); - - void clear(); - void set ( const Vector3D & ); - void setToScaled ( const Vector3D &, double ); - void add ( const Vector3D & ); - void subtract ( const Vector3D & ); - void addScaled ( const Vector3D &, double ); - void subtractScaled ( const Vector3D &, double ); - void normalize (); - void setToCross ( const Vector3D &, const Vector3D & ); - void setToAverage ( const Vector3D &, const Vector3D & ); - void setToSum ( const Vector3D &, const Vector3D & ); - void setXYZ ( double, double, double ); - void addXYZ ( double, double, double ); - void setX ( double ); - void setY ( double ); - void setZ ( double ); - void addX ( double ); - void addY ( double ); - void addZ ( double ); - void scaleX ( double ); - void scaleY ( double ); - void scaleZ ( double ); - void halve (); - double getX (); - double getY (); - double getZ (); - double getMagnitude (); - double getMagnitudeSquared (); - double getDistance ( const Vector3D &, const Vector3D & ); - double getDistanceSquared ( const Vector3D &, const Vector3D & ); - double getDistanceTo ( const Vector3D & ); - double getDistanceSquaredTo( const Vector3D & ); - double dotWith ( const Vector3D & ); - void scale ( double ); - void setToDifference ( const Vector3D &, const Vector3D & ); -}; - -#endif From 556f11a0c07d06306ae5cdc5069ddd446c56bdd6 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Thu, 11 Apr 2013 15:32:35 -0700 Subject: [PATCH 2/3] added test 'other' avatar for proxemixs testing --- interface/src/Head.cpp | 278 +++++++++++++++++++++++++---------------- interface/src/Head.h | 11 ++ interface/src/main.cpp | 12 +- 3 files changed, 188 insertions(+), 113 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index cdfd19483c..cc7d0dd8cc 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -86,9 +86,12 @@ Head::Head() noise = 0; handBeingMoved = false; + previousHandBeingMoved = false; movedHandOffset = glm::vec3( 0.0, 0.0, 0.0 ); - - sphere = NULL; + + sphere = NULL; + + usingSprings = false; springForce = 6.0f; springToBodyTightness = 4.0f; @@ -103,6 +106,12 @@ Head::Head() std::cout << "error " << error << ": " << lodepng_error_text(error) << std::endl; } } + + for (int o=0; ogetPos().x, hand->getPos().y, hand->getPos().z); //previous to Ventrella change @@ -1170,6 +1237,7 @@ void Head::parseData(void *data, int size) ( (char *)data, "H%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", &Pitch, &Yaw, &Roll, + //&avatar.yaw, &avatar.pitch, &avatar.roll, &position.x, &position.y, &position.z, &loudness, &averageLoudness, &avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.x, diff --git a/interface/src/Head.h b/interface/src/Head.h index 3268383439..7c9f4b91aa 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -30,6 +30,8 @@ enum eyeContactTargets {LEFT_EYE, RIGHT_EYE, MOUTH}; #define ROT_RIGHT 7 #define MAX_DRIVE_KEYS 8 +#define NUM_OTHER_AVATARS 5 + /* enum AvatarJoints { @@ -237,7 +239,15 @@ class Head : public AgentData { //glm::vec3 velocity; //glm::vec3 thrust; + float closeEnoughToInteract; + int closestOtherAvatar; + glm::vec3 DEBUG_otherAvatarListPosition [ NUM_OTHER_AVATARS ]; + float DEBUG_otherAvatarListTimer [ NUM_OTHER_AVATARS ]; + + bool usingSprings; + bool handBeingMoved; + bool previousHandBeingMoved; glm::vec3 movedHandOffset; //glm::vec3 movedHandPosition; @@ -255,6 +265,7 @@ class Head : public AgentData { void initializeAvatar(); void updateAvatarSkeleton(); + void initializeAvatarSprings(); void updateAvatarSprings( float deltaTime ); void calculateBoneLengths(); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 50dda5a84e..62415a667c 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -827,10 +827,8 @@ void display(void) if (displayField) field.render(); // Render avatars of other agents - for(std::vector::iterator agent = agentList.getAgents().begin(); agent != agentList.getAgents().end(); agent++) - { - if (agent->getLinkedData() != NULL) - { + for(std::vector::iterator agent = agentList.getAgents().begin(); agent != agentList.getAgents().end(); agent++) { + if (agent->getLinkedData() != NULL) { Head *agentHead = (Head *)agent->getLinkedData(); glPushMatrix(); glm::vec3 pos = agentHead->getPos(); @@ -870,8 +868,7 @@ void display(void) if (audioScope.getState()) audioScope.render(); #endif - if (displayHeadMouse && !displayHead && statsOn) - { + if (displayHeadMouse && !displayHead && statsOn) { // Display small target box at center or head mouse target that can also be used to measure LOD glColor3f(1.0, 1.0, 1.0); glDisable(GL_LINE_SMOOTH); @@ -1026,8 +1023,7 @@ void shiftPaintingColor() ::paintingVoxel.blue = (::dominantColor==2)?randIntInRange(200,255):randIntInRange(40,100); } -void setupPaintingVoxel() -{ +void setupPaintingVoxel() { glm::vec3 avatarPos = myAvatar.getPos(); ::paintingVoxel.x = avatarPos.z/-10.0; // voxel space x is negative z head space From bd0908403157757e1959ccf36f9b9d9697fa8b34 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Thu, 11 Apr 2013 15:37:15 -0700 Subject: [PATCH 3/3] cleaned up some Orientation formtting --- interface/src/Orientation.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/interface/src/Orientation.cpp b/interface/src/Orientation.cpp index 7c37951359..439538ce8a 100755 --- a/interface/src/Orientation.cpp +++ b/interface/src/Orientation.cpp @@ -1,33 +1,28 @@ #include "Orientation.h" #include "Util.h" -//------------------------ -Orientation::Orientation() -{ +Orientation::Orientation() { right = glm::vec3( 1.0, 0.0, 0.0 ); up = glm::vec3( 0.0, 1.0, 0.0 ); front = glm::vec3( 0.0, 0.0, 1.0 ); } -//------------------------------- -void Orientation::setToIdentity() -{ + +void Orientation::setToIdentity() { right = glm::vec3( 1.0, 0.0, 0.0 ); up = glm::vec3( 0.0, 1.0, 0.0 ); front = glm::vec3( 0.0, 0.0, 1.0 ); } -//------------------------------------ -void Orientation::set( Orientation o ) -{ + +void Orientation::set( Orientation o ) { right = o.getRight(); up = o.getUp(); front = o.getFront(); } -//--------------------------------------- -void Orientation::yaw( float angle ) -{ + +void Orientation::yaw( float angle ) { float r = angle * PI_OVER_180; float s = sin( r ); float c = cos( r ); @@ -41,9 +36,8 @@ void Orientation::yaw( float angle ) right = cosineRight - sineFront; } -//--------------------------------------- -void Orientation::pitch( float angle ) -{ + +void Orientation::pitch( float angle ) { float r = angle * PI_OVER_180; float s = sin( r ); float c = cos( r ); @@ -57,9 +51,8 @@ void Orientation::pitch( float angle ) front = cosineFront - sineUp; } -//--------------------------------------- -void Orientation::roll( float angle ) -{ + +void Orientation::roll( float angle ) { double r = angle * PI_OVER_180; double s = sin( r ); double c = cos( r ); @@ -73,9 +66,8 @@ void Orientation::roll( float angle ) right = cosineRight - sineUp; } -//--------------------------------------------------------------------------------------------- -void Orientation::setRightUpFront( const glm::vec3 &r, const glm::vec3 &u, const glm::vec3 &f ) -{ + +void Orientation::setRightUpFront( const glm::vec3 &r, const glm::vec3 &u, const glm::vec3 &f ) { right = r; up = u; front = f;