mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 20:34:07 +02:00
Merge pull request #74 from Ventrella/master
removed initilalizeAvatar() (deprecated)
This commit is contained in:
commit
f4acdda922
5 changed files with 440 additions and 372 deletions
File diff suppressed because it is too large
Load diff
|
@ -22,8 +22,7 @@
|
|||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
|
||||
#include <glm/gtx/quaternion.hpp> //looks like we might not need this
|
||||
|
||||
enum eyeContactTargets {LEFT_EYE, RIGHT_EYE, MOUTH};
|
||||
|
||||
|
@ -85,12 +84,13 @@ struct AvatarBone
|
|||
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 springBodyTightness; // how tightly the springy position tries to stay on the position
|
||||
glm::quat rotation; // this will eventually replace yaw, pitch and roll (and maybe orienttion)
|
||||
glm::quat rotation; // this will eventually replace yaw, pitch and roll (and maybe orientation)
|
||||
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
|
||||
float radius; // used for detecting collisions for certain physical effects
|
||||
};
|
||||
|
||||
struct Avatar
|
||||
|
@ -111,9 +111,9 @@ class Head : public AvatarData {
|
|||
void reset();
|
||||
void UpdateGyros(float frametime, SerialInterface * serialInterface, int head_mirror, glm::vec3 * gravity);
|
||||
void setNoise (float mag) { noise = mag; }
|
||||
void setPitch(float p) {Pitch = p; }
|
||||
void setYaw(float y) {Yaw = y; }
|
||||
void setRoll(float r) {Roll = r; };
|
||||
void setPitch(float p) {_headPitch = p; }
|
||||
void setYaw(float y) {_headYaw = y; }
|
||||
void setRoll(float r) {_headRoll = r; };
|
||||
void setScale(float s) {scale = s; };
|
||||
void setRenderYaw(float y) {renderYaw = y;}
|
||||
void setRenderPitch(float p) {renderPitch = p;}
|
||||
|
@ -121,14 +121,14 @@ class Head : public AvatarData {
|
|||
float getRenderPitch() {return renderPitch;}
|
||||
void setLeanForward(float dist);
|
||||
void setLeanSideways(float dist);
|
||||
void addPitch(float p) {Pitch -= p; }
|
||||
void addYaw(float y){Yaw -= y; }
|
||||
void addRoll(float r){Roll += r; }
|
||||
void addPitch(float p) {_headPitch -= p; }
|
||||
void addYaw(float y){_headYaw -= y; }
|
||||
void addRoll(float r){_headRoll += r; }
|
||||
void addLean(float x, float z);
|
||||
float getPitch() {return Pitch;}
|
||||
float getRoll() {return Roll;}
|
||||
float getYaw() {return Yaw;}
|
||||
float getLastMeasuredYaw() {return YawRate;}
|
||||
float getPitch() {return _headPitch;}
|
||||
float getRoll() {return _headRoll;}
|
||||
float getYaw() {return _headYaw;}
|
||||
float getLastMeasuredYaw() {return _headYawRate;}
|
||||
|
||||
float getBodyYaw() {return _bodyYaw;};
|
||||
void addBodyYaw(float y) {_bodyYaw += y;};
|
||||
|
@ -180,12 +180,12 @@ class Head : public AvatarData {
|
|||
private:
|
||||
bool _isMine;
|
||||
float noise;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
float Roll;
|
||||
float PitchRate;
|
||||
float YawRate;
|
||||
float RollRate;
|
||||
float _headPitch;
|
||||
float _headYaw;
|
||||
float _headRoll;
|
||||
float _headPitchRate;
|
||||
float _headYawRate;
|
||||
float _headRollRate;
|
||||
float EyeballPitch[2];
|
||||
float EyeballYaw[2];
|
||||
float EyebrowPitch[2];
|
||||
|
@ -212,7 +212,9 @@ class Head : public AvatarData {
|
|||
float averageLoudness;
|
||||
float audioAttack;
|
||||
float browAudioLift;
|
||||
|
||||
|
||||
glm::vec3 _TEST_bigSpherePosition;
|
||||
float _TEST_bigSphereRadius;
|
||||
|
||||
//temporary - placeholder for real other avs
|
||||
glm::vec3 DEBUG_otherAvatarListPosition [ NUM_OTHER_AVATARS ];
|
||||
|
@ -253,12 +255,12 @@ class Head : public AvatarData {
|
|||
//-----------------------------
|
||||
// private methods...
|
||||
//-----------------------------
|
||||
void initializeAvatar();
|
||||
void initializeSkeleton();
|
||||
void updateSkeleton();
|
||||
void initializeBodySprings();
|
||||
void updateBodySprings( float deltaTime );
|
||||
void calculateBoneLengths();
|
||||
void updateBigSphereCollisionTest( float deltaTime );
|
||||
void readSensors();
|
||||
};
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#define ACCEL_Z 5
|
||||
|
||||
// Gyro sensors, in coodinate system of head/airplane
|
||||
#define PITCH_RATE 1
|
||||
#define YAW_RATE 0
|
||||
#define ROLL_RATE 2
|
||||
#define HEAD_PITCH_RATE 1
|
||||
#define HEAD_YAW_RATE 0
|
||||
#define HEAD_ROLL_RATE 2
|
||||
|
||||
class SerialInterface {
|
||||
public:
|
||||
|
|
|
@ -167,8 +167,8 @@ int headMouseX, headMouseY;
|
|||
int mouseX, mouseY; // Where is the mouse
|
||||
|
||||
// Mouse location at start of last down click
|
||||
int mouseStartX;// = WIDTH / 2;
|
||||
int mouseStartY;// = HEIGHT / 2;
|
||||
int mouseStartX = WIDTH / 2;
|
||||
int mouseStartY = HEIGHT / 2;
|
||||
int mousePressed = 0; // true if mouse has been pressed (clear when finished)
|
||||
|
||||
Menu menu; // main menu
|
||||
|
@ -379,8 +379,8 @@ void updateAvatarHand(float deltaTime) {
|
|||
//
|
||||
void updateAvatar(float frametime)
|
||||
{
|
||||
float gyroPitchRate = serialPort.getRelativeValue(PITCH_RATE);
|
||||
float gyroYawRate = serialPort.getRelativeValue(YAW_RATE);
|
||||
float gyroPitchRate = serialPort.getRelativeValue(HEAD_PITCH_RATE);
|
||||
float gyroYawRate = serialPort.getRelativeValue(HEAD_YAW_RATE );
|
||||
|
||||
myAvatar.UpdateGyros(frametime, &serialPort, headMirror, &gravity);
|
||||
|
||||
|
@ -833,7 +833,6 @@ void display(void)
|
|||
// brad's frustum for debugging
|
||||
if (::frustumOn) render_view_frustum();
|
||||
|
||||
|
||||
//Render my own avatar
|
||||
myAvatar.render(true);
|
||||
}
|
||||
|
@ -1319,22 +1318,21 @@ void idle(void) {
|
|||
// Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time
|
||||
|
||||
if (diffclock(&lastTimeIdle, &check) > IDLE_SIMULATE_MSECS) {
|
||||
// If mouse is being dragged, update hand movement in the avatar
|
||||
//if ( mousePressed == 1 )
|
||||
|
||||
if ( myAvatar.getMode() == AVATAR_MODE_COMMUNICATING ) {
|
||||
//if ( myAvatar.getMode() == AVATAR_MODE_COMMUNICATING ) {
|
||||
float leftRight = ( mouseX - mouseStartX ) / (float)WIDTH;
|
||||
float downUp = ( mouseY - mouseStartY ) / (float)HEIGHT;
|
||||
float backFront = 0.0;
|
||||
glm::vec3 handMovement( leftRight, downUp, backFront );
|
||||
myAvatar.setHandMovement( handMovement );
|
||||
}
|
||||
/*}
|
||||
else {
|
||||
mouseStartX = mouseX;
|
||||
mouseStartY = mouseY;
|
||||
//mouseStartX = (float)WIDTH / 2.0f;
|
||||
//mouseStartY = (float)HEIGHT / 2.0f;
|
||||
}
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------
|
||||
// when the mouse is being pressed, an 'action' is being
|
||||
|
@ -1348,14 +1346,13 @@ void idle(void) {
|
|||
}
|
||||
|
||||
//
|
||||
// Sample hardware, update view frustum if needed, send avatar data to mixer/agents
|
||||
// Sample hardware, update view frustum if needed, Lsend avatar data to mixer/agents
|
||||
//
|
||||
updateAvatar( 1.f/FPS );
|
||||
|
||||
|
||||
//test
|
||||
/*
|
||||
for(std::vector<Agent>::iterator agent = agentList.getAgents().begin(); agent != agentList.getAgents().end(); agent++)
|
||||
//loop through all the other avatars and simulate them.
|
||||
AgentList * agentList = AgentList::getInstance();
|
||||
for(std::vector<Agent>::iterator agent = agentList->getAgents().begin(); agent != agentList->getAgents().end(); agent++)
|
||||
{
|
||||
if (agent->getLinkedData() != NULL)
|
||||
{
|
||||
|
@ -1363,7 +1360,7 @@ void idle(void) {
|
|||
agentHead->simulate(1.f/FPS);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
updateAvatarHand(1.f/FPS);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
memcpy(destinationBuffer, &_handPosition, sizeof(float) * 3);
|
||||
destinationBuffer += sizeof(float) * 3;
|
||||
|
||||
//std::cout << _bodyPosition.x << ", " << _bodyPosition.y << ", " << _bodyPosition.z << "\n";
|
||||
std::cout << _handPosition.x << ", " << _handPosition.y << ", " << _handPosition.z << "\n";
|
||||
|
||||
return destinationBuffer - bufferStart;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue