mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 17:53:32 +02:00
Another merge and fix ...
This commit is contained in:
commit
1e2e505301
16 changed files with 782 additions and 593 deletions
|
@ -25,6 +25,8 @@
|
|||
#include <fcntl.h>
|
||||
#include <map>
|
||||
#include "AgentList.h"
|
||||
#include "AgentTypes.h"
|
||||
#include <PacketHeaders.h>
|
||||
#include "SharedUtil.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -46,7 +48,7 @@ const int LOGOFF_CHECK_INTERVAL = 5000;
|
|||
#define DEBUG_TO_SELF 0
|
||||
|
||||
int lastActiveCount = 0;
|
||||
AgentList agentList('D', DOMAIN_LISTEN_PORT);
|
||||
AgentList agentList(AGENT_TYPE_DOMAIN, DOMAIN_LISTEN_PORT);
|
||||
|
||||
unsigned char * addAgentToBroadcastPacket(unsigned char *currentPosition, Agent *agentToAdd) {
|
||||
*currentPosition++ = agentToAdd->getType();
|
||||
|
@ -82,7 +84,7 @@ int main(int argc, const char * argv[])
|
|||
char agentType;
|
||||
|
||||
unsigned char *broadcastPacket = new unsigned char[MAX_PACKET_SIZE];
|
||||
*broadcastPacket = 'D';
|
||||
*broadcastPacket = PACKET_HEADER_DOMAIN;
|
||||
|
||||
unsigned char *currentBufferPos;
|
||||
unsigned char *startPointer;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
//------------------------
|
||||
Camera::Camera()
|
||||
{
|
||||
mode = CAMERA_MODE_THIRD_PERSON;
|
||||
fieldOfView = 60.0; // default
|
||||
yaw = 0.0;
|
||||
pitch = 0.0;
|
||||
roll = 0.0;
|
||||
|
@ -22,6 +24,7 @@ Camera::Camera()
|
|||
}
|
||||
|
||||
|
||||
|
||||
//------------------------
|
||||
void Camera::update()
|
||||
{
|
||||
|
@ -33,5 +36,13 @@ void Camera::update()
|
|||
|
||||
position = glm::dvec3( targetPosition );
|
||||
position += glm::dvec3( x, y, z );
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//geterate the ortho-normals for the orientation based on the Euler angles
|
||||
//------------------------------------------------------------------------
|
||||
orientation.setToIdentity();
|
||||
orientation.yaw ( yaw );
|
||||
orientation.pitch ( pitch );
|
||||
orientation.roll ( roll );
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
#include "Orientation.h"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
enum CameraMode
|
||||
{
|
||||
CAMERA_MODE_NULL = -1,
|
||||
CAMERA_MODE_FIRST_PERSON,
|
||||
CAMERA_MODE_THIRD_PERSON,
|
||||
CAMERA_MODE_MY_OWN_FACE,
|
||||
NUM_CAMERA_MODES
|
||||
};
|
||||
|
||||
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
|
@ -19,30 +29,34 @@ public:
|
|||
|
||||
void update();
|
||||
|
||||
void setYaw ( double y ) { yaw = y; }
|
||||
void setPitch ( double p ) { pitch = p; }
|
||||
void setRoll ( double r ) { roll = r; }
|
||||
void setUp ( double u ) { up = u; }
|
||||
void setDistance ( double d ) { distance = d; }
|
||||
void setTargetPosition ( glm::dvec3 t ) { targetPosition = t; };
|
||||
void setPosition ( glm::dvec3 p ) { position = p; };
|
||||
void setMode ( CameraMode m ) { mode = m; }
|
||||
void setYaw ( float y ) { yaw = y; }
|
||||
void setPitch ( float p ) { pitch = p; }
|
||||
void setRoll ( float r ) { roll = r; }
|
||||
void setUp ( float u ) { up = u; }
|
||||
void setDistance ( float d ) { distance = d; }
|
||||
void setTargetPosition ( glm::vec3 t ) { targetPosition = t; };
|
||||
void setPosition ( glm::vec3 p ) { position = p; };
|
||||
void setOrientation ( Orientation o ) { orientation.set(o); }
|
||||
|
||||
double getYaw () { return yaw; }
|
||||
double getPitch () { return pitch; }
|
||||
double getRoll () { return roll; }
|
||||
glm::dvec3 getPosition () { return position; }
|
||||
float getYaw () { return yaw; }
|
||||
float getPitch () { return pitch; }
|
||||
float getRoll () { return roll; }
|
||||
glm::vec3 getPosition () { return position; }
|
||||
Orientation getOrientation () { return orientation; }
|
||||
CameraMode getMode () { return mode; }
|
||||
|
||||
private:
|
||||
|
||||
glm::dvec3 position;
|
||||
glm::dvec3 targetPosition;
|
||||
double yaw;
|
||||
double pitch;
|
||||
double roll;
|
||||
double up;
|
||||
double distance;
|
||||
CameraMode mode;
|
||||
glm::vec3 position;
|
||||
glm::vec3 targetPosition;
|
||||
float fieldOfView;
|
||||
float yaw;
|
||||
float pitch;
|
||||
float roll;
|
||||
float up;
|
||||
float distance;
|
||||
Orientation orientation;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
using namespace std;
|
||||
|
||||
float skinColor[] = {1.0, 0.84, 0.66};
|
||||
float lightBlue[] = { 0.7, 0.8, 1.0 };
|
||||
float browColor[] = {210.0/255.0, 105.0/255.0, 30.0/255.0};
|
||||
float mouthColor[] = {1, 0, 0};
|
||||
|
||||
|
@ -190,7 +191,7 @@ void Head::reset()
|
|||
|
||||
|
||||
|
||||
|
||||
//this pertains to moving the head with the glasses
|
||||
//---------------------------------------------------
|
||||
void Head::UpdatePos(float frametime, SerialInterface * serialInterface, int head_mirror, glm::vec3 * gravity)
|
||||
// Using serial data, update avatar/render position and angles
|
||||
|
@ -239,9 +240,9 @@ void Head::UpdatePos(float frametime, SerialInterface * serialInterface, int hea
|
|||
|
||||
|
||||
//---------------------------------------------------
|
||||
void Head::setAvatarPosition( double x, double y, double z )
|
||||
void Head::setAvatarPosition( float x, float y, float z )
|
||||
{
|
||||
avatar.position = glm::dvec3( x, y, z );
|
||||
avatar.position = glm::vec3( x, y, z );
|
||||
}
|
||||
|
||||
|
||||
|
@ -272,7 +273,7 @@ void Head::setLeanSideways(float dist){
|
|||
|
||||
|
||||
|
||||
// Simulate the head over time
|
||||
// Simulate the avatar over time
|
||||
//---------------------------------------------------
|
||||
void Head::simulate(float deltaTime)
|
||||
{
|
||||
|
@ -285,10 +286,7 @@ void Head::simulate(float deltaTime)
|
|||
sin( avatar.pitch * PI_OVER_180 ),
|
||||
cos( avatar.roll * PI_OVER_180 )
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
glm::vec3 forward(-sinf(getRenderYaw()*PI/180),
|
||||
sinf(getRenderPitch()*PI/180),
|
||||
cosf(getRenderYaw()*PI/180));
|
||||
|
@ -296,103 +294,50 @@ void Head::simulate(float deltaTime)
|
|||
thrust = glm::vec3(0);
|
||||
*/
|
||||
|
||||
const float THRUST_MAG = 10.0;
|
||||
|
||||
/*
|
||||
const float THRUST_LATERAL_MAG = 10.0;
|
||||
const float THRUST_VERTICAL_MAG = 10.0;
|
||||
*/
|
||||
const float THRUST_MAG = 10.0;
|
||||
const float YAW_MAG = 300.0;
|
||||
|
||||
|
||||
avatar.thrust = glm::dvec3( 0.0, 0.0, 0.0 );
|
||||
|
||||
avatar.thrust = glm::vec3( 0.0, 0.0, 0.0 );
|
||||
|
||||
//notice that the z values from avatar.orientation are flipped to accommodate different coordinate system
|
||||
if (driveKeys[FWD])
|
||||
{
|
||||
//position.x += avatar.orientation.getFront().getX() * 0.01;
|
||||
//position.y += avatar.orientation.getFront().getY() * 0.01;
|
||||
//position.z -= avatar.orientation.getFront().getZ() * 0.01;
|
||||
|
||||
avatar.thrust.x += avatar.orientation.getFront().getX() * THRUST_MAG;
|
||||
avatar.thrust.y += avatar.orientation.getFront().getY() * THRUST_MAG;
|
||||
avatar.thrust.z -= avatar.orientation.getFront().getZ() * THRUST_MAG;
|
||||
|
||||
//thrust += THRUST_MAG*forward;
|
||||
glm::vec3 front( avatar.orientation.getFront().getX(), avatar.orientation.getFront().getY(), -avatar.orientation.getFront().getZ() );
|
||||
avatar.thrust += front * THRUST_MAG;
|
||||
}
|
||||
|
||||
if (driveKeys[BACK])
|
||||
{
|
||||
//position.x -= avatar.orientation.getFront().getX() * 0.01;
|
||||
//position.y -= avatar.orientation.getFront().getY() * 0.01;
|
||||
//position.z += avatar.orientation.getFront().getZ() * 0.01;
|
||||
|
||||
avatar.thrust.x -= avatar.orientation.getFront().getX() * THRUST_MAG;
|
||||
avatar.thrust.y -= avatar.orientation.getFront().getY() * THRUST_MAG;
|
||||
avatar.thrust.z += avatar.orientation.getFront().getZ() * THRUST_MAG;
|
||||
|
||||
//thrust += -THRUST_MAG*forward;
|
||||
glm::vec3 front( avatar.orientation.getFront().getX(), avatar.orientation.getFront().getY(), -avatar.orientation.getFront().getZ() );
|
||||
avatar.thrust -= front * THRUST_MAG;
|
||||
}
|
||||
|
||||
|
||||
if (driveKeys[RIGHT])
|
||||
{
|
||||
//position.x += avatar.orientation.getRight().getX() * 0.01;
|
||||
//position.y += avatar.orientation.getRight().getY() * 0.01;
|
||||
//position.z -= avatar.orientation.getRight().getZ() * 0.01;
|
||||
|
||||
avatar.thrust.x += avatar.orientation.getRight().getX() * THRUST_MAG;
|
||||
avatar.thrust.y += avatar.orientation.getRight().getY() * THRUST_MAG;
|
||||
avatar.thrust.z -= avatar.orientation.getRight().getZ() * THRUST_MAG;
|
||||
|
||||
//thrust.x += forward.z*-THRUST_LATERAL_MAG;
|
||||
//thrust.z += forward.x*THRUST_LATERAL_MAG;
|
||||
glm::vec3 right( avatar.orientation.getRight().getX(), avatar.orientation.getRight().getY(), -avatar.orientation.getRight().getZ() );
|
||||
avatar.thrust += right * THRUST_MAG;
|
||||
}
|
||||
if (driveKeys[LEFT])
|
||||
{
|
||||
//position.x -= avatar.orientation.getRight().getX() * 0.01;
|
||||
//position.y -= avatar.orientation.getRight().getY() * 0.01;
|
||||
//position.z += avatar.orientation.getRight().getZ() * 0.01;
|
||||
|
||||
avatar.thrust.x -= avatar.orientation.getRight().getX() * THRUST_MAG;
|
||||
avatar.thrust.y -= avatar.orientation.getRight().getY() * THRUST_MAG;
|
||||
avatar.thrust.z += avatar.orientation.getRight().getZ() * THRUST_MAG;
|
||||
|
||||
//thrust.x += forward.z*THRUST_LATERAL_MAG;
|
||||
//thrust.z += forward.x*-THRUST_LATERAL_MAG;
|
||||
glm::vec3 right( avatar.orientation.getRight().getX(), avatar.orientation.getRight().getY(), -avatar.orientation.getRight().getZ() );
|
||||
avatar.thrust -= right * THRUST_MAG;
|
||||
}
|
||||
|
||||
|
||||
if (driveKeys[UP])
|
||||
{
|
||||
//position.x -= avatar.orientation.getUp().getX() * 0.01;
|
||||
//position.y -= avatar.orientation.getUp().getY() * 0.01;
|
||||
//position.z += avatar.orientation.getUp().getZ() * 0.01;
|
||||
|
||||
avatar.thrust.x -= avatar.orientation.getUp().getX() * THRUST_MAG;
|
||||
avatar.thrust.y -= avatar.orientation.getUp().getY() * THRUST_MAG;
|
||||
avatar.thrust.z += avatar.orientation.getUp().getZ() * THRUST_MAG;
|
||||
|
||||
//thrust.y += -THRUST_VERTICAL_MAG;
|
||||
glm::vec3 up( avatar.orientation.getUp().getX(), avatar.orientation.getUp().getY(), -avatar.orientation.getUp().getZ() );
|
||||
avatar.thrust += up * THRUST_MAG;
|
||||
}
|
||||
if (driveKeys[DOWN])
|
||||
{
|
||||
//position.x += avatar.orientation.getUp().getX() * 0.01;
|
||||
//position.y += avatar.orientation.getUp().getY() * 0.01;
|
||||
//position.z -= avatar.orientation.getUp().getZ() * 0.01;
|
||||
|
||||
avatar.thrust.x += avatar.orientation.getUp().getX() * THRUST_MAG;
|
||||
avatar.thrust.y += avatar.orientation.getUp().getY() * THRUST_MAG;
|
||||
avatar.thrust.z -= avatar.orientation.getUp().getZ() * THRUST_MAG;
|
||||
|
||||
//thrust.y += THRUST_VERTICAL_MAG;
|
||||
glm::vec3 up( avatar.orientation.getUp().getX(), avatar.orientation.getUp().getY(), -avatar.orientation.getUp().getZ() );
|
||||
avatar.thrust -= up * THRUST_MAG;
|
||||
}
|
||||
|
||||
if (driveKeys[ROT_RIGHT])
|
||||
{
|
||||
avatar.yawDelta -= 300.0 * deltaTime;
|
||||
avatar.yawDelta -= YAW_MAG * deltaTime;
|
||||
}
|
||||
if (driveKeys[ROT_LEFT])
|
||||
{
|
||||
avatar.yawDelta += 300.0 * deltaTime;
|
||||
avatar.yawDelta += YAW_MAG * deltaTime;
|
||||
}
|
||||
|
||||
avatar.yaw += avatar.yawDelta * deltaTime;
|
||||
|
@ -404,9 +349,9 @@ void Head::simulate(float deltaTime)
|
|||
|
||||
//avatar.yawDelta *= 0.99;
|
||||
|
||||
avatar.velocity += avatar.thrust * (double)deltaTime;
|
||||
avatar.velocity += glm::dvec3( avatar.thrust * deltaTime );
|
||||
|
||||
position += avatar.velocity * (double)deltaTime;
|
||||
position += (glm::vec3)avatar.velocity * deltaTime;
|
||||
|
||||
//avatar.velocity *= 0.9;
|
||||
|
||||
|
@ -558,9 +503,9 @@ void Head::renderHead( int faceToFace, int isMine )
|
|||
|
||||
glTranslatef
|
||||
(
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].worldPosition.x,
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].worldPosition.y,
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].worldPosition.z
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].position.x,
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].position.y,
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].position.z
|
||||
);
|
||||
|
||||
glScalef( 0.03, 0.03, 0.03 );
|
||||
|
@ -715,9 +660,9 @@ void Head::renderHead( int faceToFace, int isMine )
|
|||
|
||||
|
||||
//---------------------------------------------------------
|
||||
void Head::setHandMovement( glm::dvec3 movement )
|
||||
void Head::setHandMovement( glm::vec3 movement )
|
||||
{
|
||||
handOffset = glm::dvec3( movement.x, -movement.y, movement.z );
|
||||
handOffset = glm::vec3( movement.x, -movement.y, movement.z );
|
||||
}
|
||||
|
||||
|
||||
|
@ -725,23 +670,23 @@ void Head::setHandMovement( glm::dvec3 movement )
|
|||
//-----------------------------------------
|
||||
void Head::initializeAvatar()
|
||||
{
|
||||
avatar.position = glm::dvec3( 0.0, 0.0, 0.0 );
|
||||
avatar.velocity = glm::dvec3( 0.0, 0.0, 0.0 );
|
||||
avatar.thrust = glm::dvec3( 0.0, 0.0, 0.0 );
|
||||
avatar.position = glm::vec3( 0.0, 0.0, 0.0 );
|
||||
avatar.velocity = glm::vec3( 0.0, 0.0, 0.0 );
|
||||
avatar.thrust = glm::vec3( 0.0, 0.0, 0.0 );
|
||||
avatar.orientation.setToIdentity();
|
||||
|
||||
avatar.yaw = 0.0;
|
||||
avatar.pitch = 0.0;
|
||||
avatar.roll = 0.0;
|
||||
avatar.yaw = 90.0;
|
||||
avatar.pitch = 0.0;
|
||||
avatar.roll = 0.0;
|
||||
|
||||
avatar.yawDelta = 0.0;
|
||||
|
||||
for (int b=0; b<NUM_AVATAR_BONES; b++)
|
||||
{
|
||||
avatar.bone[b].worldPosition = glm::dvec3( 0.0, 0.0, 0.0 );
|
||||
//avatar.bone[b].offsetPosition = glm::dvec3( 0.0, 0.0, 0.0 );
|
||||
avatar.bone[b].velocity = glm::dvec3( 0.0, 0.0, 0.0 );
|
||||
avatar.bone[b].worldOrientation.setToIdentity();
|
||||
avatar.bone[b].position = glm::vec3( 0.0, 0.0, 0.0 );
|
||||
avatar.bone[b].springyPosition = glm::vec3( 0.0, 0.0, 0.0 );
|
||||
avatar.bone[b].springyVelocity = glm::vec3( 0.0, 0.0, 0.0 );
|
||||
avatar.bone[b].orientation.setToIdentity();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -778,7 +723,7 @@ void Head::initializeAvatar()
|
|||
//----------------------------------------------------------------------------
|
||||
// left pelvis and leg
|
||||
//----------------------------------------------------------------------------
|
||||
avatar.bone[ AVATAR_BONE_LEFT_PELVIS ].parent = AVATAR_BONE_NULL;
|
||||
avatar.bone[ AVATAR_BONE_LEFT_PELVIS ].parent = AVATAR_BONE_PELVIS_SPINE;
|
||||
avatar.bone[ AVATAR_BONE_LEFT_THIGH ].parent = AVATAR_BONE_LEFT_PELVIS;
|
||||
avatar.bone[ AVATAR_BONE_LEFT_SHIN ].parent = AVATAR_BONE_LEFT_THIGH;
|
||||
avatar.bone[ AVATAR_BONE_LEFT_FOOT ].parent = AVATAR_BONE_LEFT_SHIN;
|
||||
|
@ -786,7 +731,7 @@ void Head::initializeAvatar()
|
|||
//----------------------------------------------------------------------------
|
||||
// right pelvis and leg
|
||||
//----------------------------------------------------------------------------
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_PELVIS ].parent = AVATAR_BONE_NULL;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_PELVIS ].parent = AVATAR_BONE_PELVIS_SPINE;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_THIGH ].parent = AVATAR_BONE_RIGHT_PELVIS;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_SHIN ].parent = AVATAR_BONE_RIGHT_THIGH;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_FOOT ].parent = AVATAR_BONE_RIGHT_SHIN;
|
||||
|
@ -795,29 +740,29 @@ void Head::initializeAvatar()
|
|||
//----------------------------------------------------------
|
||||
// specify the default pose position
|
||||
//----------------------------------------------------------
|
||||
avatar.bone[ AVATAR_BONE_PELVIS_SPINE ].defaultPosePosition = glm::dvec3( 0.0, 0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_MID_SPINE ].defaultPosePosition = glm::dvec3( 0.0, 0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_CHEST_SPINE ].defaultPosePosition = glm::dvec3( 0.0, 0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_NECK ].defaultPosePosition = glm::dvec3( 0.0, 0.06, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].defaultPosePosition = glm::dvec3( 0.0, 0.06, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_CHEST ].defaultPosePosition = glm::dvec3( -0.06, 0.06, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_SHOULDER ].defaultPosePosition = glm::dvec3( -0.03, 0.0, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_UPPER_ARM ].defaultPosePosition = glm::dvec3( 0.0, -0.12, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_FOREARM ].defaultPosePosition = glm::dvec3( 0.0, -0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_HAND ].defaultPosePosition = glm::dvec3( 0.0, -0.05, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_CHEST ].defaultPosePosition = glm::dvec3( 0.06, 0.06, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].defaultPosePosition = glm::dvec3( 0.03, 0.0, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].defaultPosePosition = glm::dvec3( 0.0, -0.12, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_FOREARM ].defaultPosePosition = glm::dvec3( 0.0, -0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].defaultPosePosition = glm::dvec3( 0.0, -0.05, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_PELVIS ].defaultPosePosition = glm::dvec3( -0.05, 0.0, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_THIGH ].defaultPosePosition = glm::dvec3( 0.0, -0.15, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_SHIN ].defaultPosePosition = glm::dvec3( 0.0, -0.15, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_FOOT ].defaultPosePosition = glm::dvec3( 0.0, 0.0, 0.04 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_PELVIS ].defaultPosePosition = glm::dvec3( 0.05, 0.0, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_THIGH ].defaultPosePosition = glm::dvec3( 0.0, -0.15, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_SHIN ].defaultPosePosition = glm::dvec3( 0.0, -0.15, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_FOOT ].defaultPosePosition = glm::dvec3( 0.0, 0.0, 0.04 );
|
||||
avatar.bone[ AVATAR_BONE_PELVIS_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_MID_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_CHEST_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_NECK ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_CHEST ].defaultPosePosition = glm::vec3( -0.06, 0.06, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_SHOULDER ].defaultPosePosition = glm::vec3( -0.03, 0.0, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_UPPER_ARM ].defaultPosePosition = glm::vec3( 0.0, -0.12, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_FOREARM ].defaultPosePosition = glm::vec3( 0.0, -0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_CHEST ].defaultPosePosition = glm::vec3( 0.06, 0.06, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].defaultPosePosition = glm::vec3( 0.03, 0.0, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].defaultPosePosition = glm::vec3( 0.0, -0.12, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_FOREARM ].defaultPosePosition = glm::vec3( 0.0, -0.1, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_PELVIS ].defaultPosePosition = glm::vec3( -0.05, 0.0, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_SHIN ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_LEFT_FOOT ].defaultPosePosition = glm::vec3( 0.0, 0.0, 0.04 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_PELVIS ].defaultPosePosition = glm::vec3( 0.05, 0.0, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_SHIN ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_FOOT ].defaultPosePosition = glm::vec3( 0.0, 0.0, 0.04 );
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// calculate bone length
|
||||
|
@ -829,13 +774,11 @@ void Head::initializeAvatar()
|
|||
//----------------------------------------------------------------------------
|
||||
updateAvatarSkeleton();
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// set offset positions = world positions
|
||||
//----------------------------------------------------------------------------
|
||||
for (int b=0; b<NUM_AVATAR_BONES; b++)
|
||||
{
|
||||
//avatar.bone[b].offsetPosition = avatar.bone[b].worldPosition;
|
||||
}
|
||||
|
||||
|
||||
//avatar.bone[4].springyVelocity = glm::vec3( 1.0f, 0.0f, 0.0f );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -859,8 +802,9 @@ void Head::calculateBoneLengths()
|
|||
//-----------------------------------------
|
||||
void Head::updateAvatarSkeleton()
|
||||
{
|
||||
//rotate the body...
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// rotate...
|
||||
//------------------------------------------------------------------------
|
||||
avatar.orientation.setToIdentity();
|
||||
avatar.orientation.yaw( -avatar.yaw );
|
||||
|
||||
|
@ -871,32 +815,32 @@ void Head::updateAvatarSkeleton()
|
|||
{
|
||||
if ( avatar.bone[b].parent == AVATAR_BONE_NULL )
|
||||
{
|
||||
avatar.bone[b].worldOrientation.set( avatar.orientation );
|
||||
avatar.bone[b].worldPosition = avatar.position;
|
||||
avatar.bone[b].orientation.set( avatar.orientation );
|
||||
avatar.bone[b].position = avatar.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
avatar.bone[b].worldOrientation.set( avatar.bone[ avatar.bone[b].parent ].worldOrientation );
|
||||
avatar.bone[b].worldPosition = avatar.bone[ avatar.bone[b].parent ].worldPosition;
|
||||
avatar.bone[b].orientation.set( avatar.bone[ avatar.bone[b].parent ].orientation );
|
||||
avatar.bone[b].position = avatar.bone[ avatar.bone[b].parent ].position;
|
||||
}
|
||||
|
||||
float xx = glm::dot( avatar.bone[b].defaultPosePosition.x, (float)avatar.bone[b].orientation.getRight ().x )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.y, (float)avatar.bone[b].orientation.getRight ().y )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.z, (float)avatar.bone[b].orientation.getRight ().z );
|
||||
|
||||
float yy = glm::dot( avatar.bone[b].defaultPosePosition.x, (float)avatar.bone[b].orientation.getUp ().x )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.y, (float)avatar.bone[b].orientation.getUp ().y )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.z, (float)avatar.bone[b].orientation.getUp ().z );
|
||||
|
||||
float zz = glm::dot( avatar.bone[b].defaultPosePosition.x, (float)avatar.bone[b].orientation.getFront ().x )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.y, (float)avatar.bone[b].orientation.getFront ().y )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.z, (float)avatar.bone[b].orientation.getFront ().z );
|
||||
|
||||
double xx = glm::dot( avatar.bone[b].defaultPosePosition.x, avatar.bone[b].worldOrientation.getRight ().x )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.y, avatar.bone[b].worldOrientation.getRight ().y )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.z, avatar.bone[b].worldOrientation.getRight ().z );
|
||||
glm::vec3 rotatedBoneVector( xx, yy, zz );
|
||||
|
||||
double yy = glm::dot( avatar.bone[b].defaultPosePosition.x, avatar.bone[b].worldOrientation.getUp ().x )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.y, avatar.bone[b].worldOrientation.getUp ().y )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.z, avatar.bone[b].worldOrientation.getUp ().z );
|
||||
|
||||
double zz = glm::dot( avatar.bone[b].defaultPosePosition.x, avatar.bone[b].worldOrientation.getFront ().x )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.y, avatar.bone[b].worldOrientation.getFront ().y )
|
||||
+ glm::dot( avatar.bone[b].defaultPosePosition.z, avatar.bone[b].worldOrientation.getFront ().z );
|
||||
|
||||
glm::dvec3 rotatedBoneVector( xx, yy, zz );
|
||||
|
||||
//rotatedBonePosition.x = avatar.bone[b].defaultPosePosition.x;// * avatar.bone[b].worldOrientation.getFront().x;
|
||||
//rotatedBonePosition.y = avatar.bone[b].defaultPosePosition.y;// * avatar.bone[b].worldOrientation.getFront().y;
|
||||
//rotatedBonePosition.z = avatar.bone[b].defaultPosePosition.z;// * avatar.bone[b].worldOrientation.getFront().z;
|
||||
//rotatedBonePosition.x = avatar.bone[b].defaultPosePosition.x;// * avatar.bone[b].orientation.getFront().x;
|
||||
//rotatedBonePosition.y = avatar.bone[b].defaultPosePosition.y;// * avatar.bone[b].orientation.getFront().y;
|
||||
//rotatedBonePosition.z = avatar.bone[b].defaultPosePosition.z;// * avatar.bone[b].orientation.getFront().z;
|
||||
|
||||
|
||||
|
||||
|
@ -908,22 +852,28 @@ void Head::updateAvatarSkeleton()
|
|||
//glm::dmat3x3 rotationMatrix = glm::eulerAngleYXZ( 0.0, 0.0, 0.0 );
|
||||
|
||||
|
||||
avatar.bone[b].worldPosition += rotatedBoneVector;
|
||||
avatar.bone[b].position += rotatedBoneVector;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// update springy behavior:
|
||||
//------------------------------------------------------------------------
|
||||
updateAvatarSprings();
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// reset hand and elbow position according to hand movement
|
||||
//------------------------------------------------------------------------
|
||||
updateHandMovement();
|
||||
|
||||
/*
|
||||
glm::dvec3 v( avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition );
|
||||
v -= avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].worldPosition;
|
||||
glm::dvec3 v( avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position );
|
||||
v -= avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position;
|
||||
|
||||
double distance = glm::length(v);
|
||||
if ( distance > avatar.maxArmLength )
|
||||
{
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].worldPosition += v * 0.2;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position += v * 0.2;
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -935,7 +885,7 @@ void Head::updateAvatarSkeleton()
|
|||
//------------------------------------------------------------------------
|
||||
for (int b=0; b<NUM_AVATAR_BONES; b++)
|
||||
{
|
||||
glm::dvec3 diff( avatar.bone[b].worldPosition );
|
||||
glm::dvec3 diff( avatar.bone[b].position );
|
||||
diff -= avatar.bone[b].offsetPosition;
|
||||
|
||||
avatar.bone[b].offsetPosition += diff * 0.1;
|
||||
|
@ -946,13 +896,72 @@ void Head::updateAvatarSkeleton()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------
|
||||
double Head::getAvatarYaw()
|
||||
void Head::updateAvatarSprings()
|
||||
{
|
||||
printf( "listing bone parent springyPosition:\n" );
|
||||
|
||||
for (int b=0; b<NUM_AVATAR_BONES; b++)
|
||||
{
|
||||
printf
|
||||
(
|
||||
"bone %d: %f, %f, %f\n", b,
|
||||
avatar.bone[ avatar.bone[b].parent ].springyPosition.x,
|
||||
avatar.bone[ avatar.bone[b].parent ].springyPosition.y,
|
||||
avatar.bone[ avatar.bone[b].parent ].springyPosition.z
|
||||
);
|
||||
|
||||
glm::vec3 springVector( avatar.bone[b].springyPosition );
|
||||
|
||||
if ( avatar.bone[b].parent == AVATAR_BONE_NULL )
|
||||
{
|
||||
springVector -= avatar.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
springVector -= avatar.bone[ avatar.bone[b].parent ].springyPosition;
|
||||
float length = glm::length( springVector );
|
||||
|
||||
if ( length > 0.0f )
|
||||
{
|
||||
glm::vec3 springDirection = springVector / length;
|
||||
|
||||
float force = ( length - avatar.bone[b].length ) * 0.01;
|
||||
|
||||
avatar.bone[ b ].springyVelocity -= springDirection * force;
|
||||
avatar.bone[ avatar.bone[b].parent ].springyVelocity += springDirection * force;
|
||||
}
|
||||
|
||||
avatar.bone[b].springyVelocity += ( avatar.bone[b].position - avatar.bone[b].springyPosition ) * 0.01f;
|
||||
avatar.bone[b].springyVelocity *= 0.8;
|
||||
avatar.bone[b].springyPosition += avatar.bone[b].springyVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------
|
||||
float Head::getAvatarYaw()
|
||||
{
|
||||
return avatar.yaw;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------
|
||||
glm::vec3 Head::getAvatarHeadLookatDirection()
|
||||
{
|
||||
return glm::vec3
|
||||
(
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].orientation.getFront().x,
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].orientation.getFront().y,
|
||||
avatar.bone[ AVATAR_BONE_HEAD ].orientation.getFront().z
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------
|
||||
void Head::updateHandMovement()
|
||||
|
@ -960,16 +969,15 @@ void Head::updateHandMovement()
|
|||
//----------------------------------------------------------------
|
||||
// adjust right hand and elbow according to hand offset
|
||||
//----------------------------------------------------------------
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition += handOffset;
|
||||
glm::vec3 armVector = avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition;
|
||||
armVector -= avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].worldPosition;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position += handOffset;
|
||||
glm::vec3 armVector = avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position;
|
||||
armVector -= avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// test to see if right hand is being dragged beyond maximum arm length
|
||||
//-------------------------------------------------------------------------------
|
||||
float distance = glm::length( armVector );
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// if right hand is being dragged beyond maximum arm length...
|
||||
//-------------------------------------------------------------------------------
|
||||
|
@ -978,23 +986,32 @@ void Head::updateHandMovement()
|
|||
//-------------------------------------------------------------------------------
|
||||
// reset right hand to be constrained to maximum arm length
|
||||
//-------------------------------------------------------------------------------
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].worldPosition;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position;
|
||||
glm::vec3 armNormal = armVector / distance;
|
||||
armVector = armNormal * (float)avatar.maxArmLength;
|
||||
distance = avatar.maxArmLength;
|
||||
glm::vec3 constrainedPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].worldPosition;
|
||||
glm::vec3 constrainedPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position;
|
||||
constrainedPosition += armVector;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition = constrainedPosition;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position = constrainedPosition;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// set elbow position
|
||||
//-----------------------------------------------------------------------------
|
||||
glm::vec3 newElbowPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].worldPosition;
|
||||
glm::vec3 newElbowPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position;
|
||||
newElbowPosition += armVector * (float)ONE_HALF;
|
||||
glm::dvec3 perpendicular = glm::dvec3( -armVector.y, armVector.x, armVector.z );
|
||||
newElbowPosition += perpendicular * ( 1.0 - ( avatar.maxArmLength / distance ) ) * ONE_HALF;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_FOREARM ].worldPosition = newElbowPosition;
|
||||
glm::vec3 perpendicular = glm::vec3( -armVector.y, armVector.x, armVector.z );
|
||||
newElbowPosition += perpendicular * (float)( ( 1.0 - ( avatar.maxArmLength / distance ) ) * ONE_HALF );
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position = newElbowPosition;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// set wrist position
|
||||
//-----------------------------------------------------------------------------
|
||||
glm::vec3 vv( avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position );
|
||||
vv -= avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position;
|
||||
glm::vec3 newWristPosition = avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position;
|
||||
newWristPosition += vv * 0.7f;
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_FOREARM ].position = newWristPosition;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1003,55 +1020,99 @@ void Head::updateHandMovement()
|
|||
//-----------------------------------------
|
||||
void Head::renderBody()
|
||||
{
|
||||
glColor3fv(skinColor);
|
||||
|
||||
// Render bones as spheres
|
||||
//-----------------------------------------
|
||||
// Render bone positions as spheres
|
||||
//-----------------------------------------
|
||||
for (int b=0; b<NUM_AVATAR_BONES; b++)
|
||||
{
|
||||
glColor3fv( skinColor );
|
||||
glPushMatrix();
|
||||
glTranslatef( avatar.bone[b].worldPosition.x, avatar.bone[b].worldPosition.y, avatar.bone[b].worldPosition.z );
|
||||
glutSolidSphere( .02, 10, 5 );
|
||||
glTranslatef( avatar.bone[b].position.x, avatar.bone[b].position.y, avatar.bone[b].position.z );
|
||||
glutSolidSphere( 0.02f, 10.0f, 5.0f );
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
// Render lines connecting the bones
|
||||
/*
|
||||
glColor3fv( lightBlue );
|
||||
glPushMatrix();
|
||||
glTranslatef( avatar.bone[b].springyPosition.x, avatar.bone[b].springyPosition.y, avatar.bone[b].springyPosition.z );
|
||||
glutSolidSphere( 0.01f, 10.0f, 5.0f );
|
||||
glPopMatrix();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Render lines connecting the bone positions
|
||||
//-----------------------------------------------------
|
||||
glColor3f(1,1,1);
|
||||
glLineWidth(3.0);
|
||||
|
||||
for (int b=1; b<NUM_AVATAR_BONES; b++)
|
||||
{
|
||||
glBegin( GL_LINE_STRIP );
|
||||
glVertex3fv( &avatar.bone[ avatar.bone[ b ].parent ].position.x);
|
||||
glVertex3fv( &avatar.bone[ b ].position.x);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
//-----------------------------------------------------
|
||||
// Render lines connecting the springy positions
|
||||
//-----------------------------------------------------
|
||||
glColor3f( 0.2f, 0.3f, 0.4f );
|
||||
glLineWidth(3.0);
|
||||
|
||||
for (int b=1; b<NUM_AVATAR_BONES; b++)
|
||||
{
|
||||
glBegin( GL_LINE_STRIP );
|
||||
glVertex3fv( &avatar.bone[ avatar.bone[ b ].parent ].springyPosition.x);
|
||||
glVertex3fv( &avatar.bone[ b ].springyPosition.x);
|
||||
glEnd();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_CHEST_SPINE].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_NECK].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_CHEST_SPINE].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_SHOULDER].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_UPPER_ARM].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_FOREARM].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_HAND].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_CHEST_SPINE].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_NECK].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_CHEST_SPINE].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_SHOULDER].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_UPPER_ARM].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_FOREARM].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_HAND].position.x);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_CHEST_SPINE].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_SHOULDER].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_UPPER_ARM].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_FOREARM].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_HAND].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_CHEST_SPINE].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_SHOULDER].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_UPPER_ARM].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_FOREARM].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_HAND].position.x);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_CHEST_SPINE].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_MID_SPINE].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_PELVIS_SPINE].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_CHEST_SPINE].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_MID_SPINE].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_PELVIS_SPINE].position.x);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_PELVIS_SPINE].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_PELVIS].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_THIGH].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_SHIN].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_FOOT].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_PELVIS_SPINE].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_PELVIS].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_THIGH].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_SHIN].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_LEFT_FOOT].position.x);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_PELVIS_SPINE].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_PELVIS].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_THIGH].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_SHIN].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_FOOT].worldPosition.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_PELVIS_SPINE].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_PELVIS].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_THIGH].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_SHIN].position.x);
|
||||
glVertex3fv(&avatar.bone[AVATAR_BONE_RIGHT_FOOT].position.x);
|
||||
glEnd();
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1068,9 +1129,9 @@ int Head::getBroadcastData(char* data)
|
|||
position.x + leanSideways, position.y, position.z + leanForward,
|
||||
loudness, averageLoudness,
|
||||
//hand->getPos().x, hand->getPos().y, hand->getPos().z); //previous to Ventrella change
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition.x,
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition.y,
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition.z ); // Ventrella change
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.x,
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.y,
|
||||
avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.z ); // Ventrella change
|
||||
return strlen(data);
|
||||
}
|
||||
|
||||
|
@ -1079,7 +1140,7 @@ int Head::getBroadcastData(char* data)
|
|||
//---------------------------------------------------
|
||||
void Head::parseData(void *data, int size)
|
||||
{
|
||||
//glm::vec3 pos;//( (glm::vec3)avatar.bone[ AVATAR_BONE_RIGHT_HAND ].worldPosition );
|
||||
//glm::vec3 pos;//( (glm::vec3)avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position );
|
||||
|
||||
// parse head data for this agent
|
||||
glm::vec3 handPos( 0,0,0 );
|
||||
|
@ -1090,7 +1151,9 @@ void Head::parseData(void *data, int size)
|
|||
&Pitch, &Yaw, &Roll,
|
||||
&position.x, &position.y, &position.z,
|
||||
&loudness, &averageLoudness,
|
||||
&handPos.x, &handPos.y, &handPos.z
|
||||
&avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.x,
|
||||
&avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.y,
|
||||
&avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.z
|
||||
);
|
||||
|
||||
if (glm::length(handPos) > 0.0) hand->setPos(handPos);
|
||||
|
|
|
@ -103,27 +103,28 @@ enum AvatarBones
|
|||
|
||||
struct AvatarBone
|
||||
{
|
||||
AvatarBones parent;
|
||||
glm::vec3 worldPosition;
|
||||
glm::dvec3 defaultPosePosition;
|
||||
glm::dvec3 velocity;
|
||||
double yaw;
|
||||
double pitch;
|
||||
double roll;
|
||||
Orientation worldOrientation;
|
||||
double length;
|
||||
AvatarBones parent; // which bone is this bone connected to?
|
||||
glm::vec3 position; // the position at the "end" of the bone
|
||||
glm::vec3 defaultPosePosition; // the parent relative position when the avatar is in the "T-pose"
|
||||
glm::vec3 springyPosition; // used for special effects (a 'flexible' variant of position)
|
||||
glm::dvec3 springyVelocity; // used for special effects ( the velocity of the springy position)
|
||||
float yaw; // the yaw Euler angle of the bone rotation off the parent
|
||||
float pitch; // the pitch Euler angle of the bone rotation off the parent
|
||||
float roll; // the roll Euler angle of the bone rotation off the parent
|
||||
Orientation orientation; // three orthogonal normals determined by yaw, pitch, roll
|
||||
float length; // the length of the bone
|
||||
};
|
||||
|
||||
struct Avatar
|
||||
{
|
||||
glm::dvec3 position;
|
||||
glm::vec3 position;
|
||||
glm::dvec3 velocity;
|
||||
glm::dvec3 thrust;
|
||||
double yaw;
|
||||
double pitch;
|
||||
double roll;
|
||||
double yawDelta;
|
||||
double maxArmLength;
|
||||
glm::vec3 thrust;
|
||||
float yaw;
|
||||
float pitch;
|
||||
float roll;
|
||||
float yawDelta;
|
||||
float maxArmLength;
|
||||
Orientation orientation;
|
||||
AvatarBone bone[ NUM_AVATAR_BONES ];
|
||||
};
|
||||
|
@ -157,17 +158,18 @@ class Head : public AgentData {
|
|||
float getYaw() {return Yaw;}
|
||||
float getLastMeasuredYaw() {return YawRate;}
|
||||
|
||||
double getAvatarYaw();
|
||||
float getAvatarYaw();
|
||||
glm::vec3 getAvatarHeadLookatDirection();
|
||||
|
||||
void render(int faceToFace, int isMine);
|
||||
|
||||
void setAvatarPosition( double, double, double );
|
||||
void setAvatarPosition( float, float, float );
|
||||
void renderBody();
|
||||
void renderHead( int faceToFace, int isMine );
|
||||
|
||||
void simulate(float);
|
||||
|
||||
void setHandMovement( glm::dvec3 movement );
|
||||
void setHandMovement( glm::vec3 movement );
|
||||
void updateHandMovement();
|
||||
|
||||
// Send and receive network data
|
||||
|
@ -233,7 +235,7 @@ class Head : public AgentData {
|
|||
glm::vec3 velocity;
|
||||
glm::vec3 thrust;
|
||||
|
||||
glm::dvec3 handOffset;
|
||||
glm::vec3 handOffset;
|
||||
|
||||
int driveKeys[MAX_DRIVE_KEYS];
|
||||
|
||||
|
@ -245,6 +247,7 @@ class Head : public AgentData {
|
|||
|
||||
void initializeAvatar();
|
||||
void updateAvatarSkeleton();
|
||||
void updateAvatarSprings();
|
||||
void calculateBoneLengths();
|
||||
|
||||
void readSensors();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,29 +0,0 @@
|
|||
//
|
||||
// octal.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip on 2/4/13.
|
||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
// Various subroutines for converting between X,Y,Z coords and octree coordinates.
|
||||
//
|
||||
|
||||
#include "Util.h"
|
||||
#include "octal.h"
|
||||
#include <cstring>
|
||||
|
||||
const int X = 0;
|
||||
const int Y = 1;
|
||||
const int Z = 2;
|
||||
|
||||
domainNode rootNode;
|
||||
|
||||
// Given a position vector between zero and one (but less than one), and a voxel scale 1/2^scale,
|
||||
// returns the smallest voxel at that scale which encloses the given point.
|
||||
void getVoxel(float * pos, int scale, float * vpos) {
|
||||
float vscale = powf(2, scale);
|
||||
vpos[X] = floor(pos[X]*vscale)/vscale;
|
||||
vpos[Y] = floor(pos[Y]*vscale)/vscale;
|
||||
vpos[Z] = floor(pos[Z]*vscale)/vscale;
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
//
|
||||
// octal.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip on 2/4/13.
|
||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __interface__octal__
|
||||
#define __interface__octal__
|
||||
|
||||
#include <iostream>
|
||||
|
||||
struct domainNode {
|
||||
domainNode * child[8];
|
||||
char * hostname;
|
||||
char * nickname;
|
||||
int domain_id;
|
||||
};
|
||||
|
||||
domainNode* createNode(int lengthInBits, char * octalData,
|
||||
char * hostname, char * nickname, int domain_id);
|
||||
|
||||
|
||||
|
||||
#endif /* defined(__interface__octal__) */
|
|
@ -50,7 +50,7 @@ namespace starfield {
|
|||
|
||||
return false;
|
||||
}
|
||||
fprintf(stderr, "Stars.cpp: read %d vertices, using %d\n",
|
||||
fprintf(stderr, "Stars.cpp: read %d stars, rendering %d\n",
|
||||
_valRecordsRead, _ptrVertices->size());
|
||||
|
||||
return true;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <AgentList.h>
|
||||
#include <AgentTypes.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <StdDev.h>
|
||||
#include "AudioRingBuffer.h"
|
||||
|
@ -60,7 +61,7 @@ const int AGENT_LOOPBACK_MODIFIER = 307;
|
|||
|
||||
const int LOOPBACK_SANITY_CHECK = 0;
|
||||
|
||||
AgentList agentList('M', MIXER_LISTEN_PORT);
|
||||
AgentList agentList(AGENT_TYPE_MIXER, MIXER_LISTEN_PORT);
|
||||
StDev stdev;
|
||||
|
||||
void plateauAdditionOfSamples(int16_t &mixSample, int16_t sampleToAdd) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <pthread.h>
|
||||
#include "Agent.h"
|
||||
#include "AgentTypes.h"
|
||||
#include <cstring>
|
||||
#include "UDPSocket.h"
|
||||
#include "SharedUtil.h"
|
||||
|
@ -91,10 +92,36 @@ Agent::~Agent() {
|
|||
delete linkedData;
|
||||
}
|
||||
|
||||
char Agent::getType() {
|
||||
char Agent::getType() const {
|
||||
return type;
|
||||
}
|
||||
|
||||
// Names of Agent Types
|
||||
const char* AGENT_TYPE_NAME_DOMAIN = "Domain";
|
||||
const char* AGENT_TYPE_NAME_VOXEL = "Voxel Server";
|
||||
const char* AGENT_TYPE_NAME_INTERFACE = "Client Interface";
|
||||
const char* AGENT_TYPE_NAME_MIXER = "Audio Mixer";
|
||||
const char* AGENT_TYPE_NAME_UNKNOWN = "Unknown";
|
||||
|
||||
const char* Agent::getTypeName() const {
|
||||
const char* name = AGENT_TYPE_NAME_UNKNOWN;
|
||||
switch (this->type) {
|
||||
case AGENT_TYPE_DOMAIN:
|
||||
name = AGENT_TYPE_NAME_DOMAIN;
|
||||
break;
|
||||
case AGENT_TYPE_VOXEL:
|
||||
name = AGENT_TYPE_NAME_VOXEL;
|
||||
break;
|
||||
case AGENT_TYPE_INTERFACE:
|
||||
name = AGENT_TYPE_NAME_INTERFACE;
|
||||
break;
|
||||
case AGENT_TYPE_MIXER:
|
||||
name = AGENT_TYPE_NAME_MIXER;
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
void Agent::setType(char newType) {
|
||||
type = newType;
|
||||
}
|
||||
|
@ -175,7 +202,7 @@ std::ostream& operator<<(std::ostream& os, const Agent* agent) {
|
|||
sockaddr_in *agentPublicSocket = (sockaddr_in *)agent->publicSocket;
|
||||
sockaddr_in *agentLocalSocket = (sockaddr_in *)agent->localSocket;
|
||||
|
||||
os << "T: " << agent->type << " PA: " << inet_ntoa(agentPublicSocket->sin_addr) <<
|
||||
os << "T: " << agent->getTypeName() << " (" << agent->type << ") PA: " << inet_ntoa(agentPublicSocket->sin_addr) <<
|
||||
":" << ntohs(agentPublicSocket->sin_port) << " LA: " << inet_ntoa(agentLocalSocket->sin_addr) <<
|
||||
":" << ntohs(agentLocalSocket->sin_port);
|
||||
return os;
|
||||
|
|
|
@ -40,7 +40,8 @@ public:
|
|||
|
||||
pthread_mutex_t deleteMutex;
|
||||
|
||||
char getType();
|
||||
char getType() const;
|
||||
const char* getTypeName() const;
|
||||
void setType(char newType);
|
||||
uint16_t getAgentId();
|
||||
void setAgentId(uint16_t thisAgentId);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include "AgentList.h"
|
||||
#include "AgentTypes.h"
|
||||
#include "PacketHeaders.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
|
@ -180,13 +181,13 @@ bool AgentList::addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket,
|
|||
newAgent.activatePublicSocket();
|
||||
}
|
||||
|
||||
if (newAgent.getType() == 'M' && audioMixerSocketUpdate != NULL) {
|
||||
if (newAgent.getType() == AGENT_TYPE_MIXER && audioMixerSocketUpdate != NULL) {
|
||||
// this is an audio mixer
|
||||
// for now that means we need to tell the audio class
|
||||
// to use the local socket information the domain server gave us
|
||||
sockaddr_in *publicSocketIn = (sockaddr_in *)publicSocket;
|
||||
audioMixerSocketUpdate(publicSocketIn->sin_addr.s_addr, publicSocketIn->sin_port);
|
||||
} else if (newAgent.getType() == 'V') {
|
||||
} else if (newAgent.getType() == AGENT_TYPE_VOXEL) {
|
||||
newAgent.activatePublicSocket();
|
||||
}
|
||||
|
||||
|
@ -199,7 +200,7 @@ bool AgentList::addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket,
|
|||
return true;
|
||||
} else {
|
||||
|
||||
if (agent->getType() == 'M' || agent->getType() == 'V') {
|
||||
if (agent->getType() == AGENT_TYPE_MIXER || agent->getType() == AGENT_TYPE_VOXEL) {
|
||||
// until the Audio class also uses our agentList, we need to update
|
||||
// the lastRecvTimeUsecs for the audio mixer so it doesn't get killed and re-added continously
|
||||
agent->setLastRecvTimeUsecs(usecTimestampNow());
|
||||
|
@ -210,9 +211,10 @@ bool AgentList::addOrUpdateAgent(sockaddr *publicSocket, sockaddr *localSocket,
|
|||
}
|
||||
}
|
||||
|
||||
const char* AgentList::AGENTS_OF_TYPE_HEAD = "H";
|
||||
const char* AgentList::AGENTS_OF_TYPE_VOXEL_AND_INTERFACE = "VI";
|
||||
// XXXBHG - do we want to move these?
|
||||
const char* AgentList::AGENTS_OF_TYPE_VOXEL = "V";
|
||||
const char* AgentList::AGENTS_OF_TYPE_INTERFACE = "I";
|
||||
const char* AgentList::AGENTS_OF_TYPE_VOXEL_AND_INTERFACE = "VI";
|
||||
|
||||
void AgentList::broadcastToAgents(char *broadcastData, size_t dataBytes,const char* agentTypes) {
|
||||
for(std::vector<Agent>::iterator agent = agents.begin(); agent != agents.end(); agent++) {
|
||||
|
@ -229,7 +231,7 @@ void AgentList::pingAgents() {
|
|||
*payload = PACKET_HEADER_PING;
|
||||
|
||||
for(std::vector<Agent>::iterator agent = agents.begin(); agent != agents.end(); agent++) {
|
||||
if (agent->getType() == 'I') {
|
||||
if (agent->getType() == AGENT_TYPE_INTERFACE) {
|
||||
if (agent->getActiveSocket() != NULL) {
|
||||
// we know which socket is good for this agent, send there
|
||||
agentSocket.send(agent->getActiveSocket(), payload, 1);
|
||||
|
@ -268,7 +270,8 @@ void *removeSilentAgents(void *args) {
|
|||
|
||||
pthread_mutex_t * agentDeleteMutex = &agent->deleteMutex;
|
||||
|
||||
if ((checkTimeUSecs - agent->getLastRecvTimeUsecs()) > AGENT_SILENCE_THRESHOLD_USECS && agent->getType() != 'V'
|
||||
if ((checkTimeUSecs - agent->getLastRecvTimeUsecs()) > AGENT_SILENCE_THRESHOLD_USECS
|
||||
&& agent->getType() != AGENT_TYPE_VOXEL
|
||||
&& pthread_mutex_trylock(agentDeleteMutex) == 0) {
|
||||
|
||||
std::cout << "Killing agent " << &(*agent) << "\n";
|
||||
|
|
|
@ -67,10 +67,9 @@ public:
|
|||
void startDomainServerCheckInThread();
|
||||
void stopDomainServerCheckInThread();
|
||||
|
||||
static const char* AGENTS_OF_TYPE_HEAD;
|
||||
static const char* AGENTS_OF_TYPE_VOXEL_AND_INTERFACE;
|
||||
static const char* AGENTS_OF_TYPE_VOXEL;
|
||||
|
||||
static const char* AGENTS_OF_TYPE_INTERFACE;
|
||||
static const char* AGENTS_OF_TYPE_VOXEL_AND_INTERFACE;
|
||||
};
|
||||
|
||||
int unpackAgentId(unsigned char *packedData, uint16_t *agentId);
|
||||
|
|
26
shared/src/AgentTypes.h
Normal file
26
shared/src/AgentTypes.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// AgentTypes.h
|
||||
// hifi
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 2013/04/09
|
||||
//
|
||||
//
|
||||
// Single byte/character Agent Types used to identify various agents in the system.
|
||||
// For example, an agent whose is 'V' is always a voxel server.
|
||||
//
|
||||
|
||||
#ifndef hifi_AgentTypes_h
|
||||
#define hifi_AgentTypes_h
|
||||
|
||||
// NOTE: If you add a new AGENT_TYPE_XXX then you also should add a new AGENT_TYPE_NAME_XXX and a new "case" to the
|
||||
// switch statement in Agent.cpp specifically Agent::getTypeName().
|
||||
// If you don't then it will make things harder on your co-developers in debugging because the Agent
|
||||
// class won't know the name and will report it as "Unknown".
|
||||
|
||||
// Agent Type Codes
|
||||
const char AGENT_TYPE_DOMAIN = 'D';
|
||||
const char AGENT_TYPE_VOXEL = 'V';
|
||||
const char AGENT_TYPE_INTERFACE = 'I'; // could also be injector???
|
||||
const char AGENT_TYPE_MIXER = 'M';
|
||||
|
||||
#endif
|
|
@ -13,6 +13,7 @@
|
|||
#include <cstdio>
|
||||
#include <OctalCode.h>
|
||||
#include <AgentList.h>
|
||||
#include <AgentTypes.h>
|
||||
#include <VoxelTree.h>
|
||||
#include "VoxelAgentData.h"
|
||||
#include <SharedUtil.h>
|
||||
|
@ -45,7 +46,7 @@ const int PACKETS_PER_CLIENT_PER_INTERVAL = 2;
|
|||
|
||||
const int MAX_VOXEL_TREE_DEPTH_LEVELS = 4;
|
||||
|
||||
AgentList agentList('V', VOXEL_LISTEN_PORT);
|
||||
AgentList agentList(AGENT_TYPE_VOXEL, VOXEL_LISTEN_PORT);
|
||||
VoxelTree randomTree;
|
||||
|
||||
bool wantColorRandomizer = false;
|
||||
|
@ -344,7 +345,7 @@ int main(int argc, const char * argv[])
|
|||
|
||||
// Now send this to the connected agents so they know to delete
|
||||
printf("rebroadcasting delete voxel message to connected agents... agentList.broadcastToAgents()\n");
|
||||
agentList.broadcastToAgents(packetData,receivedBytes,AgentList::AGENTS_OF_TYPE_HEAD);
|
||||
agentList.broadcastToAgents(packetData,receivedBytes,AgentList::AGENTS_OF_TYPE_INTERFACE);
|
||||
|
||||
}
|
||||
if (packetData[0] == PACKET_HEADER_Z_COMMAND) {
|
||||
|
@ -372,12 +373,14 @@ int main(int argc, const char * argv[])
|
|||
|
||||
// Now send this to the connected agents so they can also process these messages
|
||||
printf("rebroadcasting Z message to connected agents... agentList.broadcastToAgents()\n");
|
||||
agentList.broadcastToAgents(packetData,receivedBytes,AgentList::AGENTS_OF_TYPE_HEAD);
|
||||
agentList.broadcastToAgents(packetData,receivedBytes,AgentList::AGENTS_OF_TYPE_INTERFACE);
|
||||
}
|
||||
// If we got a PACKET_HEADER_HEAD_DATA, then we're talking to an AGENT_TYPE_INTERFACE, and we
|
||||
// need to make sure we have it in our agentList.
|
||||
if (packetData[0] == PACKET_HEADER_HEAD_DATA) {
|
||||
if (agentList.addOrUpdateAgent(&agentPublicAddress,
|
||||
&agentPublicAddress,
|
||||
packetData[0],
|
||||
AGENT_TYPE_INTERFACE,
|
||||
agentList.getLastAgentId())) {
|
||||
agentList.increaseAgentId();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue