mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 18:30:42 +02:00
Merge pull request #229 from birarda/interface-send-id
make eve send her ID to identify with the avatar mixer
This commit is contained in:
commit
ab82bfc9d8
3 changed files with 35 additions and 31 deletions
|
@ -25,6 +25,10 @@ const int MIN_ITERATIONS_BETWEEN_AUDIO_SENDS = (MIN_AUDIO_SEND_INTERVAL_SECS * 1
|
||||||
const int MAX_AUDIO_SEND_INTERVAL_SECS = 15;
|
const int MAX_AUDIO_SEND_INTERVAL_SECS = 15;
|
||||||
const float MAX_ITERATIONS_BETWEEN_AUDIO_SENDS = (MAX_AUDIO_SEND_INTERVAL_SECS * 1000) / DATA_SEND_INTERVAL_MSECS;
|
const float MAX_ITERATIONS_BETWEEN_AUDIO_SENDS = (MAX_AUDIO_SEND_INTERVAL_SECS * 1000) / DATA_SEND_INTERVAL_MSECS;
|
||||||
|
|
||||||
|
const int ITERATIONS_BEFORE_HAND_GRAB = 100;
|
||||||
|
const int HAND_GRAB_DURATION_ITERATIONS = 50;
|
||||||
|
const int HAND_TIMER_SLEEP_ITERATIONS = 50;
|
||||||
|
|
||||||
bool stopReceiveAgentDataThread;
|
bool stopReceiveAgentDataThread;
|
||||||
bool injectAudioThreadRunning = false;
|
bool injectAudioThreadRunning = false;
|
||||||
|
|
||||||
|
@ -130,8 +134,6 @@ int main(int argc, const char* argv[]) {
|
||||||
unsigned char broadcastPacket[MAX_PACKET_SIZE];
|
unsigned char broadcastPacket[MAX_PACKET_SIZE];
|
||||||
broadcastPacket[0] = PACKET_HEADER_HEAD_DATA;
|
broadcastPacket[0] = PACKET_HEADER_HEAD_DATA;
|
||||||
|
|
||||||
int numBytesToSend = 0;
|
|
||||||
|
|
||||||
timeval thisSend;
|
timeval thisSend;
|
||||||
double numMicrosecondsSleep = 0;
|
double numMicrosecondsSleep = 0;
|
||||||
|
|
||||||
|
@ -145,16 +147,19 @@ int main(int argc, const char* argv[]) {
|
||||||
gettimeofday(&thisSend, NULL);
|
gettimeofday(&thisSend, NULL);
|
||||||
|
|
||||||
// find the current avatar mixer
|
// find the current avatar mixer
|
||||||
Agent *avatarMixer = agentList->soloAgentOfType(AGENT_TYPE_AVATAR_MIXER);
|
Agent* avatarMixer = agentList->soloAgentOfType(AGENT_TYPE_AVATAR_MIXER);
|
||||||
|
|
||||||
// make sure we actually have an avatar mixer with an active socket
|
// make sure we actually have an avatar mixer with an active socket
|
||||||
if (avatarMixer != NULL && avatarMixer->getActiveSocket() != NULL) {
|
if (agentList->getOwnerID() != UNKNOWN_AGENT_ID && avatarMixer && avatarMixer->getActiveSocket() != NULL) {
|
||||||
|
unsigned char* packetPosition = broadcastPacket + sizeof(PACKET_HEADER);
|
||||||
|
packetPosition += packAgentId(packetPosition, agentList->getOwnerID());
|
||||||
|
|
||||||
// use the getBroadcastData method in the AvatarData class to populate the broadcastPacket buffer
|
// use the getBroadcastData method in the AvatarData class to populate the broadcastPacket buffer
|
||||||
numBytesToSend = eve.getBroadcastData((broadcastPacket + 1));
|
packetPosition += eve.getBroadcastData(packetPosition);
|
||||||
|
|
||||||
// use the UDPSocket instance attached to our agent list to send avatar data to mixer
|
// use the UDPSocket instance attached to our agent list to send avatar data to mixer
|
||||||
agentList->getAgentSocket().send(avatarMixer->getActiveSocket(), broadcastPacket, numBytesToSend);
|
agentList->getAgentSocket().send(avatarMixer->getActiveSocket(), broadcastPacket, packetPosition - broadcastPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporarily disable Eve's audio sending until the file is actually available on EC2 box
|
// temporarily disable Eve's audio sending until the file is actually available on EC2 box
|
||||||
if (numIterationsLeftBeforeAudioSend == 0) {
|
if (numIterationsLeftBeforeAudioSend == 0) {
|
||||||
|
@ -175,13 +180,12 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
// simulate the effect of pressing and un-pressing the mouse button/pad
|
// simulate the effect of pressing and un-pressing the mouse button/pad
|
||||||
handStateTimer++;
|
handStateTimer++;
|
||||||
if ( handStateTimer == 100 ) {
|
|
||||||
|
if (handStateTimer == ITERATIONS_BEFORE_HAND_GRAB) {
|
||||||
eve.setHandState(1);
|
eve.setHandState(1);
|
||||||
}
|
} else if (handStateTimer == ITERATIONS_BEFORE_HAND_GRAB + HAND_GRAB_DURATION_ITERATIONS) {
|
||||||
if ( handStateTimer == 150 ) {
|
|
||||||
eve.setHandState(0);
|
eve.setHandState(0);
|
||||||
}
|
} else if (handStateTimer >= ITERATIONS_BEFORE_HAND_GRAB + HAND_GRAB_DURATION_ITERATIONS + HAND_TIMER_SLEEP_ITERATIONS) {
|
||||||
if ( handStateTimer >= 200 ) {
|
|
||||||
handStateTimer = 0;
|
handStateTimer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,7 +429,7 @@ void updateAvatar(float frametime) {
|
||||||
myAvatar.setCameraNearClip(::viewFrustum.getNearClip());
|
myAvatar.setCameraNearClip(::viewFrustum.getNearClip());
|
||||||
myAvatar.setCameraFarClip(::viewFrustum.getFarClip());
|
myAvatar.setCameraFarClip(::viewFrustum.getFarClip());
|
||||||
|
|
||||||
AgentList *agentList = AgentList::getInstance();
|
AgentList* agentList = AgentList::getInstance();
|
||||||
|
|
||||||
if (agentList->getOwnerID() != UNKNOWN_AGENT_ID) {
|
if (agentList->getOwnerID() != UNKNOWN_AGENT_ID) {
|
||||||
// if I know my ID, send head/hand data to the avatar mixer and voxel server
|
// if I know my ID, send head/hand data to the avatar mixer and voxel server
|
||||||
|
@ -451,9 +451,9 @@ void updateAvatar(float frametime) {
|
||||||
glm::vec3 avatarPos = myAvatar.getPosition();
|
glm::vec3 avatarPos = myAvatar.getPosition();
|
||||||
|
|
||||||
// For some reason, we don't want to flip X and Z here.
|
// For some reason, we don't want to flip X and Z here.
|
||||||
::paintingVoxel.x = avatarPos.x/10.0;
|
::paintingVoxel.x = avatarPos.x / 10.0;
|
||||||
::paintingVoxel.y = avatarPos.y/10.0;
|
::paintingVoxel.y = avatarPos.y / 10.0;
|
||||||
::paintingVoxel.z = avatarPos.z/10.0;
|
::paintingVoxel.z = avatarPos.z / 10.0;
|
||||||
|
|
||||||
unsigned char* bufferOut;
|
unsigned char* bufferOut;
|
||||||
int sizeOut;
|
int sizeOut;
|
||||||
|
@ -696,8 +696,7 @@ void displaySide(Camera& whichCamera) {
|
||||||
drawGroundPlaneGrid(10.f);
|
drawGroundPlaneGrid(10.f);
|
||||||
|
|
||||||
// Draw voxels
|
// Draw voxels
|
||||||
if (showingVoxels)
|
if (showingVoxels) {
|
||||||
{
|
|
||||||
voxels.render();
|
voxels.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,18 +13,19 @@
|
||||||
#ifndef hifi_PacketHeaders_h
|
#ifndef hifi_PacketHeaders_h
|
||||||
#define hifi_PacketHeaders_h
|
#define hifi_PacketHeaders_h
|
||||||
|
|
||||||
const char PACKET_HEADER_DOMAIN = 'D';
|
typedef char PACKET_HEADER;
|
||||||
const char PACKET_HEADER_PING = 'P';
|
const PACKET_HEADER PACKET_HEADER_DOMAIN = 'D';
|
||||||
const char PACKET_HEADER_PING_REPLY = 'R';
|
const PACKET_HEADER PACKET_HEADER_PING = 'P';
|
||||||
const char PACKET_HEADER_HEAD_DATA = 'H';
|
const PACKET_HEADER PACKET_HEADER_PING_REPLY = 'R';
|
||||||
const char PACKET_HEADER_Z_COMMAND = 'Z';
|
const PACKET_HEADER PACKET_HEADER_HEAD_DATA = 'H';
|
||||||
const char PACKET_HEADER_INJECT_AUDIO = 'I';
|
const PACKET_HEADER PACKET_HEADER_Z_COMMAND = 'Z';
|
||||||
const char PACKET_HEADER_SET_VOXEL = 'S';
|
const PACKET_HEADER PACKET_HEADER_INJECT_AUDIO = 'I';
|
||||||
const char PACKET_HEADER_ERASE_VOXEL = 'E';
|
const PACKET_HEADER PACKET_HEADER_SET_VOXEL = 'S';
|
||||||
const char PACKET_HEADER_VOXEL_DATA = 'V';
|
const PACKET_HEADER PACKET_HEADER_ERASE_VOXEL = 'E';
|
||||||
const char PACKET_HEADER_BULK_AVATAR_DATA = 'X';
|
const PACKET_HEADER PACKET_HEADER_VOXEL_DATA = 'V';
|
||||||
const char PACKET_HEADER_TRANSMITTER_DATA = 't';
|
const PACKET_HEADER PACKET_HEADER_BULK_AVATAR_DATA = 'X';
|
||||||
const char PACKET_HEADER_DOMAIN_LIST_REQUEST = 'L';
|
const PACKET_HEADER PACKET_HEADER_TRANSMITTER_DATA = 't';
|
||||||
const char PACKET_HEADER_DOMAIN_RFD = 'C';
|
const PACKET_HEADER PACKET_HEADER_DOMAIN_LIST_REQUEST = 'L';
|
||||||
|
const PACKET_HEADER PACKET_HEADER_DOMAIN_RFD = 'C';
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue