mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
add VoxelAgentData class for VS to hold position and level data for clients
This commit is contained in:
parent
3fa0439f29
commit
2c701c8e69
2 changed files with 61 additions and 0 deletions
33
voxel/src/VoxelAgentData.cpp
Normal file
33
voxel/src/VoxelAgentData.cpp
Normal 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]);
|
||||
}
|
28
voxel/src/VoxelAgentData.h
Normal file
28
voxel/src/VoxelAgentData.h
Normal 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__) */
|
Loading…
Reference in a new issue