add VoxelAgentData class for VS to hold position and level data for clients

This commit is contained in:
Stephen Birarda 2013-03-22 10:36:19 -07:00
parent 3fa0439f29
commit 2c701c8e69
2 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,33 @@
//
// VoxelAgentData.cpp
// hifi
//
// Created by Stephen Birarda on 3/21/13.
//
//
#include "VoxelAgentData.h"
VoxelAgentData::VoxelAgentData() {
lastSeenLevel = 0;
}
VoxelAgentData::~VoxelAgentData() {
// nothing to explicitly destroy here
}
VoxelAgentData::VoxelAgentData(const VoxelAgentData &otherAgentData) {
lastSeenLevel = otherAgentData.lastSeenLevel;
memcpy(position, otherAgentData.position, sizeof(float) * 3);
}
VoxelAgentData* VoxelAgentData::clone() const {
return new VoxelAgentData(*this);
}
void VoxelAgentData::parseData(void *data, int size) {
// pull the position from the interface agent data packet
sscanf((char *)data,
"H%*f,%*f,%*f,%f,%f,%f",
&position[0], &position[1], &position[2]);
}

View file

@ -0,0 +1,28 @@
//
// VoxelAgentData.h
// hifi
//
// Created by Stephen Birarda on 3/21/13.
//
//
#ifndef __hifi__VoxelAgentData__
#define __hifi__VoxelAgentData__
#include <AgentData.h>
#include <iostream>
class VoxelAgentData : public AgentData {
public:
float position[3];
int lastSeenLevel;
VoxelAgentData();
~VoxelAgentData();
VoxelAgentData(const VoxelAgentData &otherAgentData);
void parseData(void *data, int size);
VoxelAgentData* clone() const;
};
#endif /* defined(__hifi__VoxelAgentData__) */