Added referentials to AvatarData

This commit is contained in:
Atlante45 2014-07-30 16:49:53 -07:00
parent bc77630c5b
commit 1138a3a275
6 changed files with 22 additions and 1 deletions

View file

@ -444,6 +444,11 @@ glm::vec3 MyAvatar::getRightPalmPosition() {
return rightHandPosition;
}
void MyAvatar::changeReferential(Referential *ref) {
delete _referential;
_referential = ref;
}
void MyAvatar::setLocalGravity(glm::vec3 gravity) {
_motionBehaviors |= AVATAR_MOTION_OBEY_LOCAL_GRAVITY;
// Environmental and Local gravities are incompatible. Since Local is being set here

View file

@ -149,6 +149,8 @@ public slots:
glm::vec3 getLeftPalmPosition();
glm::vec3 getRightPalmPosition();
void changeReferential(Referential* ref);
signals:
void transformChanged();

View file

@ -36,6 +36,7 @@ using namespace std;
AvatarData::AvatarData() :
_sessionUUID(),
_handPosition(0,0,0),
_referential(NULL),
_bodyYaw(-90.f),
_bodyPitch(0.0f),
_bodyRoll(0.0f),
@ -62,6 +63,7 @@ AvatarData::AvatarData() :
AvatarData::~AvatarData() {
delete _headData;
delete _handData;
delete _referential;
}
glm::vec3 AvatarData::getHandPosition() const {

View file

@ -49,6 +49,7 @@ typedef unsigned long long quint64;
#include <Node.h>
#include "Referential.h"
#include "HeadData.h"
#include "HandData.h"
@ -283,6 +284,8 @@ protected:
QUuid _sessionUUID;
glm::vec3 _position;
glm::vec3 _handPosition;
Referential* _referential;
// Body rotation
float _bodyYaw; // degrees

View file

@ -15,4 +15,8 @@ Referential::Referential(AvatarData* avatar) :
_isValid(true),
_avatar(avatar)
{
if (_avatar == NULL) {
_isValid = false;
return;
}
}

View file

@ -12,10 +12,15 @@
#ifndef hifi_Referential_h
#define hifi_Referential_h
#include "AvatarData.h"
#include <glm/gtx/quaternion.hpp>
#include <glm/vec3.hpp>
class AvatarData;
class Referential {
public:
virtual ~Referential();
virtual bool isValid() { return _isValid; }
virtual void update() = 0;