mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
maintain a pointer to owning avatar from HeadData
This commit is contained in:
parent
36892da488
commit
49b483ef53
6 changed files with 15 additions and 8 deletions
|
@ -71,6 +71,7 @@ float chatMessageHeight = 0.10;
|
||||||
|
|
||||||
Avatar::Avatar(Agent* owningAgent, bool isMine) :
|
Avatar::Avatar(Agent* owningAgent, bool isMine) :
|
||||||
AvatarData(owningAgent),
|
AvatarData(owningAgent),
|
||||||
|
_head(this),
|
||||||
_isMine(isMine),
|
_isMine(isMine),
|
||||||
_TEST_bigSphereRadius(0.4f),
|
_TEST_bigSphereRadius(0.4f),
|
||||||
_TEST_bigSpherePosition(5.0f, _TEST_bigSphereRadius, 5.0f),
|
_TEST_bigSpherePosition(5.0f, _TEST_bigSphereRadius, 5.0f),
|
||||||
|
|
|
@ -30,8 +30,8 @@ unsigned int IRIS_TEXTURE_WIDTH = 768;
|
||||||
unsigned int IRIS_TEXTURE_HEIGHT = 498;
|
unsigned int IRIS_TEXTURE_HEIGHT = 498;
|
||||||
vector<unsigned char> irisTexture;
|
vector<unsigned char> irisTexture;
|
||||||
|
|
||||||
Head::Head() :
|
Head::Head(Avatar* owningAvatar) :
|
||||||
|
HeadData((AvatarData*)owningAvatar),
|
||||||
yawRate(0.0f),
|
yawRate(0.0f),
|
||||||
_returnHeadToCenter(false),
|
_returnHeadToCenter(false),
|
||||||
_audioLoudness(0.0f),
|
_audioLoudness(0.0f),
|
||||||
|
|
|
@ -24,9 +24,11 @@ enum eyeContactTargets
|
||||||
MOUTH
|
MOUTH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Avatar;
|
||||||
|
|
||||||
class Head : public HeadData {
|
class Head : public HeadData {
|
||||||
public:
|
public:
|
||||||
Head();
|
Head(Avatar* owningAvatar);
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void simulate(float deltaTime, bool isMine);
|
void simulate(float deltaTime, bool isMine);
|
||||||
|
|
|
@ -68,7 +68,7 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
|
|
||||||
// lazily allocate memory for HeadData in case we're not an Avatar instance
|
// lazily allocate memory for HeadData in case we're not an Avatar instance
|
||||||
if (!_headData) {
|
if (!_headData) {
|
||||||
_headData = new HeadData();
|
_headData = new HeadData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Body world position
|
// Body world position
|
||||||
|
@ -149,7 +149,7 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
|
|
||||||
// lazily allocate memory for HeadData in case we're not an Avatar instance
|
// lazily allocate memory for HeadData in case we're not an Avatar instance
|
||||||
if (!_headData) {
|
if (!_headData) {
|
||||||
_headData = new HeadData();
|
_headData = new HeadData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment to push past the packet header
|
// increment to push past the packet header
|
||||||
|
|
|
@ -8,13 +8,14 @@
|
||||||
|
|
||||||
#include "HeadData.h"
|
#include "HeadData.h"
|
||||||
|
|
||||||
HeadData::HeadData() :
|
HeadData::HeadData(AvatarData* owningAvatar) :
|
||||||
_yaw(0.0f),
|
_yaw(0.0f),
|
||||||
_pitch(0.0f),
|
_pitch(0.0f),
|
||||||
_roll(0.0f),
|
_roll(0.0f),
|
||||||
_lookAtPosition(0.0f, 0.0f, 0.0f),
|
_lookAtPosition(0.0f, 0.0f, 0.0f),
|
||||||
_leanSideways(0.0f),
|
_leanSideways(0.0f),
|
||||||
_leanForward(0.0f)
|
_leanForward(0.0f),
|
||||||
|
_owningAvatar(owningAvatar)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,11 @@ const float MAX_HEAD_PITCH = 60;
|
||||||
const float MIN_HEAD_ROLL = -50;
|
const float MIN_HEAD_ROLL = -50;
|
||||||
const float MAX_HEAD_ROLL = 50;
|
const float MAX_HEAD_ROLL = 50;
|
||||||
|
|
||||||
|
class AvatarData;
|
||||||
|
|
||||||
class HeadData {
|
class HeadData {
|
||||||
public:
|
public:
|
||||||
HeadData();
|
HeadData(AvatarData* owningAvatar);
|
||||||
|
|
||||||
float getLeanSideways() const { return _leanSideways; }
|
float getLeanSideways() const { return _leanSideways; }
|
||||||
void setLeanSideways(float leanSideways) { _leanSideways = leanSideways; }
|
void setLeanSideways(float leanSideways) { _leanSideways = leanSideways; }
|
||||||
|
@ -55,6 +57,7 @@ protected:
|
||||||
glm::vec3 _lookAtPosition;
|
glm::vec3 _lookAtPosition;
|
||||||
float _leanSideways;
|
float _leanSideways;
|
||||||
float _leanForward;
|
float _leanForward;
|
||||||
|
AvatarData* _owningAvatar;
|
||||||
private:
|
private:
|
||||||
// privatize copy ctor and assignment operator so copies of this object cannot be made
|
// privatize copy ctor and assignment operator so copies of this object cannot be made
|
||||||
HeadData(const HeadData&);
|
HeadData(const HeadData&);
|
||||||
|
|
Loading…
Reference in a new issue