mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 22:27:13 +02:00
keep a pointer to owning agent in AgentData
This commit is contained in:
parent
a3f30970d6
commit
36892da488
12 changed files with 28 additions and 13 deletions
|
@ -47,7 +47,7 @@ unsigned char *addAgentToBroadcastPacket(unsigned char *currentPosition, Agent *
|
|||
|
||||
void attachAvatarDataToAgent(Agent *newAgent) {
|
||||
if (newAgent->getLinkedData() == NULL) {
|
||||
newAgent->setLinkedData(new AvatarData());
|
||||
newAgent->setLinkedData(new AvatarData(newAgent));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void *receiveAgentData(void *args) {
|
|||
|
||||
void createAvatarDataForAgent(Agent* agent) {
|
||||
if (!agent->getLinkedData()) {
|
||||
agent->setLinkedData(new AvatarData());
|
||||
agent->setLinkedData(new AvatarData(agent));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ int main(int argc, const char* argv[]) {
|
|||
pthread_create(&receiveAgentDataThread, NULL, receiveAgentData, NULL);
|
||||
|
||||
// create an AvatarData object, "eve"
|
||||
AvatarData eve;
|
||||
AvatarData eve(NULL);
|
||||
|
||||
// move eve away from the origin
|
||||
// pick a random point inside a 10x10 grid
|
||||
|
|
|
@ -128,7 +128,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
_viewFrustumOffsetDistance(25.0),
|
||||
_viewFrustumOffsetUp(0.0),
|
||||
_audioScope(256, 200, true),
|
||||
_myAvatar(true),
|
||||
_myAvatar(NULL, true),
|
||||
_manualFirstPerson(false),
|
||||
_mouseX(0),
|
||||
_mouseY(0),
|
||||
|
@ -2098,9 +2098,9 @@ QAction* Application::checkedVoxelModeAction() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void Application::attachNewHeadToAgent(Agent *newAgent) {
|
||||
void Application::attachNewHeadToAgent(Agent* newAgent) {
|
||||
if (newAgent->getLinkedData() == NULL) {
|
||||
newAgent->setLinkedData(new Avatar(false));
|
||||
newAgent->setLinkedData(new Avatar(newAgent, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ bool usingBigSphereCollisionTest = true;
|
|||
float chatMessageScale = 0.0015;
|
||||
float chatMessageHeight = 0.10;
|
||||
|
||||
Avatar::Avatar(bool isMine) :
|
||||
Avatar::Avatar(Agent* owningAgent, bool isMine) :
|
||||
AvatarData(owningAgent),
|
||||
_isMine(isMine),
|
||||
_TEST_bigSphereRadius(0.4f),
|
||||
_TEST_bigSpherePosition(5.0f, _TEST_bigSphereRadius, 5.0f),
|
||||
|
|
|
@ -76,7 +76,7 @@ enum AvatarJointID
|
|||
|
||||
class Avatar : public AvatarData {
|
||||
public:
|
||||
Avatar(bool isMine);
|
||||
Avatar(Agent* owningAgent, bool isMine);
|
||||
~Avatar();
|
||||
|
||||
void reset();
|
||||
|
|
|
@ -44,7 +44,7 @@ GLubyte identityIndices[] = { 0,2,1, 0,3,2, // Z- .
|
|||
10,11,15, 10,15,14, // Y+
|
||||
4,5,6, 4,6,7 }; // Z+ .
|
||||
|
||||
VoxelSystem::VoxelSystem() {
|
||||
VoxelSystem::VoxelSystem() : AgentData(NULL) {
|
||||
_voxelsInReadArrays = _voxelsInWriteArrays = _voxelsUpdated = 0;
|
||||
_writeRenderFullVBO = true;
|
||||
_readRenderFullVBO = true;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "AudioRingBuffer.h"
|
||||
|
||||
AudioRingBuffer::AudioRingBuffer(int ringSamples, int bufferSamples) :
|
||||
AgentData(NULL),
|
||||
_ringBufferLengthSamples(ringSamples),
|
||||
_bufferLengthSamples(bufferSamples),
|
||||
_endOfLastWrite(NULL),
|
||||
|
@ -20,7 +21,7 @@ AudioRingBuffer::AudioRingBuffer(int ringSamples, int bufferSamples) :
|
|||
_shouldBeAddedToMix(false),
|
||||
_shouldLoopbackForAgent(false),
|
||||
_streamIdentifier()
|
||||
{
|
||||
{
|
||||
_buffer = new int16_t[_ringBufferLengthSamples];
|
||||
_nextOutput = _buffer;
|
||||
};
|
||||
|
|
|
@ -31,7 +31,8 @@ int unpackFloatAngleFromTwoByte(uint16_t* byteAnglePointer, float* destinationPo
|
|||
return sizeof(uint16_t);
|
||||
}
|
||||
|
||||
AvatarData::AvatarData() :
|
||||
AvatarData::AvatarData(Agent* owningAgent) :
|
||||
AgentData(owningAgent),
|
||||
_handPosition(0,0,0),
|
||||
_bodyYaw(-90.0),
|
||||
_bodyPitch(0.0),
|
||||
|
|
|
@ -29,7 +29,7 @@ enum KeyState
|
|||
|
||||
class AvatarData : public AgentData {
|
||||
public:
|
||||
AvatarData();
|
||||
AvatarData(Agent* owningAgent);
|
||||
~AvatarData();
|
||||
|
||||
const glm::vec3& getPosition() const { return _position; }
|
||||
|
|
|
@ -8,4 +8,10 @@
|
|||
|
||||
#include "AgentData.h"
|
||||
|
||||
AgentData::AgentData(Agent* owningAgent) :
|
||||
_owningAgent(owningAgent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AgentData::~AgentData() {}
|
|
@ -3,16 +3,21 @@
|
|||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 2/19/13.
|
||||
//
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef hifi_AgentData_h
|
||||
#define hifi_AgentData_h
|
||||
|
||||
class Agent;
|
||||
|
||||
class AgentData {
|
||||
public:
|
||||
AgentData(Agent* owningAgent);
|
||||
virtual ~AgentData() = 0;
|
||||
virtual int parseData(unsigned char* sourceBuffer, int numBytes) = 0;
|
||||
private:
|
||||
Agent* _owningAgent;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <cstdio>
|
||||
|
||||
VoxelAgentData::VoxelAgentData() :
|
||||
AvatarData(NULL),
|
||||
_viewSent(false),
|
||||
_voxelPacketAvailableBytes(MAX_VOXEL_PACKET_SIZE),
|
||||
_maxSearchLevel(1),
|
||||
|
|
Loading…
Reference in a new issue