mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 06:32:35 +02:00
Added head _isMine variable, added hand position transmission!
This commit is contained in:
parent
5729ecb3f4
commit
952cb2f2ae
5 changed files with 36 additions and 13 deletions
|
@ -45,7 +45,7 @@ vector<unsigned char> iris_texture;
|
|||
unsigned int iris_texture_width = 512;
|
||||
unsigned int iris_texture_height = 256;
|
||||
|
||||
Head::Head() {
|
||||
Head::Head(bool isMine) {
|
||||
initializeAvatar();
|
||||
|
||||
_avatar.orientation.setToIdentity();
|
||||
|
@ -59,6 +59,7 @@ Head::Head() {
|
|||
_bodyYawDelta = 0.0;
|
||||
_triggeringAction = false;
|
||||
_mode = AVATAR_MODE_STANDING;
|
||||
_isMine = isMine;
|
||||
|
||||
initializeSkeleton();
|
||||
|
||||
|
@ -529,7 +530,7 @@ void Head::simulate(float deltaTime) {
|
|||
|
||||
|
||||
|
||||
void Head::render(int faceToFace, int isMine) {
|
||||
void Head::render(int faceToFace) {
|
||||
|
||||
//---------------------------------------------------
|
||||
// show avatar position
|
||||
|
@ -553,7 +554,7 @@ void Head::render(int faceToFace, int isMine) {
|
|||
//---------------------------------------------------
|
||||
// render head
|
||||
//---------------------------------------------------
|
||||
renderHead( faceToFace, isMine );
|
||||
renderHead(faceToFace);
|
||||
|
||||
//---------------------------------------------------
|
||||
// render other avatars (DEBUG TEST)
|
||||
|
@ -613,7 +614,7 @@ void Head::renderOrientationDirections( glm::vec3 position, Orientation orientat
|
|||
|
||||
|
||||
|
||||
void Head::renderHead( int faceToFace, int isMine ) {
|
||||
void Head::renderHead( int faceToFace) {
|
||||
int side = 0;
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
@ -659,6 +660,7 @@ void Head::renderHead( int faceToFace, int isMine ) {
|
|||
glColor3fv(skinColor);
|
||||
|
||||
// Head
|
||||
if (!_isMine) glColor3f(0,0,1); // Temp: Other people are BLUE
|
||||
glutSolidSphere(1, 30, 30);
|
||||
|
||||
// Ears
|
||||
|
@ -1059,8 +1061,8 @@ void Head::updateHandMovement() {
|
|||
+ _avatar.orientation.getUp() * -_movedHandOffset.y * 0.5f
|
||||
+ _avatar.orientation.getFront() * -_movedHandOffset.y;
|
||||
|
||||
_bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement;
|
||||
|
||||
_bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement;
|
||||
|
||||
//if holding hands, add a pull to the hand...
|
||||
if ( _usingSprings ) {
|
||||
if ( _closestOtherAvatar != -1 ) {
|
||||
|
@ -1142,6 +1144,10 @@ void Head::updateHandMovement() {
|
|||
glm::vec3 newWristPosition = _bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position;
|
||||
newWristPosition += vv * 0.7f;
|
||||
_bone[ AVATAR_BONE_RIGHT_FOREARM ].position = newWristPosition;
|
||||
|
||||
// Set the vector we send for hand position to other people to be our right hand
|
||||
setHandPosition(_bone[ AVATAR_BONE_RIGHT_HAND ].position);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ struct Avatar
|
|||
|
||||
class Head : public AvatarData {
|
||||
public:
|
||||
Head();
|
||||
Head(bool isMine);
|
||||
~Head();
|
||||
Head(const Head &otherHead);
|
||||
Head* clone() const;
|
||||
|
@ -143,10 +143,10 @@ class Head : public AvatarData {
|
|||
|
||||
void setTriggeringAction( bool trigger );
|
||||
|
||||
void render(int faceToFace, int isMine);
|
||||
void render(int faceToFace);
|
||||
|
||||
void renderBody();
|
||||
void renderHead( int faceToFace, int isMine );
|
||||
void renderHead( int faceToFace);
|
||||
//void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size );
|
||||
|
||||
void simulate(float);
|
||||
|
@ -178,6 +178,7 @@ class Head : public AvatarData {
|
|||
float getTransmitterHz() { return transmitterHz; };
|
||||
|
||||
private:
|
||||
bool _isMine;
|
||||
float noise;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
|
|
|
@ -102,7 +102,7 @@ Oscilloscope audioScope(256,200,true);
|
|||
|
||||
ViewFrustum viewFrustum; // current state of view frustum, perspective, orientation, etc.
|
||||
|
||||
Head myAvatar; // The rendered avatar of oneself
|
||||
Head myAvatar(true); // The rendered avatar of oneself
|
||||
Camera myCamera; // My view onto the world (sometimes on myself :)
|
||||
Camera viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode
|
||||
|
||||
|
@ -826,7 +826,7 @@ void display(void)
|
|||
glPushMatrix();
|
||||
glm::vec3 pos = agentHead->getBodyPosition();
|
||||
glTranslatef(-pos.x, -pos.y, -pos.z);
|
||||
agentHead->render(0, 0);
|
||||
agentHead->render(0);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
@ -841,7 +841,7 @@ void display(void)
|
|||
|
||||
|
||||
//Render my own avatar
|
||||
myAvatar.render( true, 1 );
|
||||
myAvatar.render(true);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
@ -1494,7 +1494,7 @@ void mouseoverFunc( int x, int y)
|
|||
|
||||
void attachNewHeadToAgent(Agent *newAgent) {
|
||||
if (newAgent->getLinkedData() == NULL) {
|
||||
newAgent->setLinkedData(new Head());
|
||||
newAgent->setLinkedData(new Head(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
// TODO: DRY this up to a shared method
|
||||
// that can pack any type given the number of bytes
|
||||
// and return the number of bytes to push the pointer
|
||||
|
||||
memcpy(destinationBuffer, &_bodyPosition, sizeof(float) * 3);
|
||||
destinationBuffer += sizeof(float) * 3;
|
||||
|
||||
|
@ -58,6 +59,11 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyPitch);
|
||||
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyRoll);
|
||||
|
||||
memcpy(destinationBuffer, &_handPosition, sizeof(float) * 3);
|
||||
destinationBuffer += sizeof(float) * 3;
|
||||
|
||||
//std::cout << _handPosition.x << ", " << _handPosition.y << ", " << _handPosition.z << "\n";
|
||||
|
||||
return destinationBuffer - bufferStart;
|
||||
}
|
||||
|
||||
|
@ -73,6 +79,10 @@ void AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t *)sourceBuffer, &_bodyYaw);
|
||||
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t *)sourceBuffer, &_bodyPitch);
|
||||
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t *)sourceBuffer, &_bodyRoll);
|
||||
|
||||
memcpy(&_handPosition, sourceBuffer, sizeof(float) * 3);
|
||||
sourceBuffer += sizeof(float) * 3;
|
||||
|
||||
}
|
||||
|
||||
glm::vec3 AvatarData::getBodyPosition() {
|
||||
|
@ -85,6 +95,10 @@ void AvatarData::setBodyPosition(glm::vec3 bodyPosition) {
|
|||
_bodyPosition = bodyPosition;
|
||||
}
|
||||
|
||||
void AvatarData::setHandPosition(glm::vec3 handPosition) {
|
||||
_handPosition = handPosition;
|
||||
}
|
||||
|
||||
float AvatarData::getBodyYaw() {
|
||||
return _bodyYaw;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
|
||||
glm::vec3 getBodyPosition();
|
||||
void setBodyPosition(glm::vec3 bodyPosition);
|
||||
void setHandPosition(glm::vec3 handPosition);
|
||||
|
||||
int getBroadcastData(unsigned char* destinationBuffer);
|
||||
void parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
|
@ -39,6 +40,7 @@ public:
|
|||
|
||||
protected:
|
||||
glm::vec3 _bodyPosition;
|
||||
glm::vec3 _handPosition;
|
||||
|
||||
float _bodyYaw;
|
||||
float _bodyPitch;
|
||||
|
|
Loading…
Reference in a new issue