Showing the changes to interface/src/main.cpp (1 of 48 files). Show all
Unified · Split
| @@ -228,7 +228,7 @@ void displayStats(void) · 227 unmodified lines | ||
| 228 | 228 | char legend2[] = "* - toggle stars, & - toggle paint mode, '-' - send erase all, '%' - send add scene"; |
| 229 | 229 | drawtext(10, statsVerticalOffset + 32, 0.10f, 0, 1.0, 0, legend2); |
| 230 | 230 | |
| 231 | − glm::vec3 avatarPos = myAvatar.getPos(); | |
| 231 | + glm::vec3 avatarPos = myAvatar.getBodyPosition(); | |
| 232 | 232 | |
| 233 | 233 | char stats[200]; |
| 234 | 234 | sprintf(stats, "FPS = %3.0f Pkts/s = %d Bytes/s = %d Head(x,y,z)= %4.2f, %4.2f, %4.2f ", |
| @@ -309,7 +309,7 @@ void init(void) · 74 unmodified lines | ||
| 309 | 309 | if (noiseOn) { |
| 310 | 310 | myAvatar.setNoise(noise); |
| 311 | 311 | } |
| 312 | − myAvatar.setPos(start_location ); | |
| 312 | + myAvatar.setBodyPosition(start_location); | |
| 313 | 313 | myCamera.setPosition( start_location ); |
| 314 | 314 | |
| 315 | 315 | |
| @@ -351,7 +351,7 @@ void reset_sensors() · 35 unmodified lines | ||
| 351 | 351 | |
| 352 | 352 | renderYawRate = 0; |
| 353 | 353 | renderPitchRate = 0; |
| 354 | − myAvatar.setPos(start_location); | |
| 354 | + myAvatar.setBodyPosition(start_location); | |
| 355 | 355 | headMouseX = WIDTH/2; |
| 356 | 356 | headMouseY = HEIGHT/2; |
| 357 | 357 | |
| @@ -449,8 +449,10 @@ void updateAvatar(float frametime) · 91 unmodified lines | ||
| 449 | 449 | #endif |
| 450 | 450 | |
| 451 | 451 | // Send my stream of head/hand data to the avatar mixer and voxel server |
| 452 | − char broadcastString[200]; | |
| 453 | − int broadcastBytes = myAvatar.getBroadcastData(broadcastString); | |
| 452 | + unsigned char broadcastString[200]; | |
| 453 | + *broadcastString = PACKET_HEADER_HEAD_DATA; | |
| 454 | + | |
| 455 | + int broadcastBytes = myAvatar.getBroadcastData(broadcastString + 1); | |
| 454 | 456 | const char broadcastReceivers[2] = {AGENT_TYPE_VOXEL, AGENT_TYPE_AVATAR_MIXER}; |
| 455 | 457 | |
| 456 | 458 | AgentList::getInstance()->broadcastToAgents(broadcastString, broadcastBytes, broadcastReceivers, 2); |
| @@ -458,7 +460,7 @@ void updateAvatar(float frametime) · 1 unmodified line | ||
| 458 | 460 | // If I'm in paint mode, send a voxel out to VOXEL server agents. |
| 459 | 461 | if (::paintOn) { |
| 460 | 462 | |
| 461 | − glm::vec3 avatarPos = myAvatar.getPos(); | |
| 463 | + glm::vec3 avatarPos = myAvatar.getBodyPosition(); | |
| 462 | 464 | |
| 463 | 465 | // For some reason, we don't want to flip X and Z here. |
| 464 | 466 | ::paintingVoxel.x = avatarPos.x/10.0; |
| @@ -473,7 +475,7 @@ void updateAvatar(float frametime) · 8 unmodified lines | ||
| 473 | 475 | ::paintingVoxel.z >= 0.0 && ::paintingVoxel.z <= 1.0) { |
| 474 | 476 | |
| 475 | 477 | if (createVoxelEditMessage(PACKET_HEADER_SET_VOXEL, 0, 1, &::paintingVoxel, bufferOut, sizeOut)){ |
| 476 | − AgentList::getInstance()->broadcastToAgents((char*)bufferOut, sizeOut, &AGENT_TYPE_VOXEL, 1); | |
| 478 | + AgentList::getInstance()->broadcastToAgents(bufferOut, sizeOut, &AGENT_TYPE_VOXEL, 1); | |
| 477 | 479 | delete bufferOut; |
| 478 | 480 | } |
| 479 | 481 | } |
| @@ -700,11 +702,13 @@ void display(void) · 220 unmodified lines | ||
| 700 | 702 | //-------------------------------------------------------- |
| 701 | 703 | // camera settings |
| 702 | 704 | //-------------------------------------------------------- |
| 705 | + myCamera.setTargetPosition( myAvatar.getBodyPosition() ); | |
| 706 | + | |
| 703 | 707 | if ( displayHead ) { |
| 704 | 708 | //----------------------------------------------- |
| 705 | 709 | // set the camera to looking at my own face |
| 706 | 710 | //----------------------------------------------- |
| 707 | − myCamera.setTargetPosition ( myAvatar.getPos() ); | |
| 711 | + myCamera.setTargetPosition ( myAvatar.getBodyPosition() ); | |
| 708 | 712 | myCamera.setYaw ( - myAvatar.getBodyYaw() ); |
| 709 | 713 | myCamera.setPitch ( 0.0 ); |
| 710 | 714 | myCamera.setRoll ( 0.0 ); |
| @@ -716,7 +720,7 @@ void display(void) · 5 unmodified lines | ||
| 716 | 720 | //---------------------------------------------------- |
| 717 | 721 | // set the camera to third-person view behind my av |
| 718 | 722 | //---------------------------------------------------- |
| 719 | − myCamera.setTargetPosition ( myAvatar.getPos() ); | |
| 723 | + myCamera.setTargetPosition ( myAvatar.getBodyPosition() ); | |
| 720 | 724 | myCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() ); |
| 721 | 725 | myCamera.setPitch ( 0.0 ); // temporarily, this must be 0.0 or else bad juju |
| 722 | 726 | myCamera.setRoll ( 0.0 ); |
| @@ -815,7 +819,7 @@ void display(void) · 92 unmodified lines | ||
| 815 | 819 | if (agent->getLinkedData() != NULL) { |
| 816 | 820 | Head *agentHead = (Head *)agent->getLinkedData(); |
| 817 | 821 | glPushMatrix(); |
| 818 | − glm::vec3 pos = agentHead->getPos(); | |
| 822 | + glm::vec3 pos = agentHead->getBodyPosition(); | |
| 819 | 823 | glTranslatef(-pos.x, -pos.y, -pos.z); |
| 820 | 824 | agentHead->render(0, 0); |
| 821 | 825 | glPopMatrix(); |
| @@ -905,9 +909,11 @@ void display(void) · 83 unmodified lines | ||
| 905 | 909 | |
| 906 | 910 | // If application has just started, report time from startup to now (first frame display) |
| 907 | 911 | if (justStarted) { |
| 908 | − printf("Startup Time: %4.2f\n", | |
| 909 | − (usecTimestampNow() - usecTimestamp(&applicationStartupTime))/1000000.0); | |
| 912 | + float startupTime = (usecTimestampNow() - usecTimestamp(&applicationStartupTime))/1000000.0; | |
| 910 | 913 | justStarted = false; |
| 914 | + char title[30]; | |
| 915 | + snprintf(title, 30, "Interface: %4.2f seconds", startupTime); | |
| 916 | + glutSetWindowTitle(title); | |
| 911 | 917 | } |
| 912 | 918 | } |
| 913 | 919 | |
| @@ -1087,14 +1093,14 @@ void sendVoxelServerEraseAll() { · 173 unmodified lines | ||
| 1087 | 1093 | char message[100]; |
| 1088 | 1094 | sprintf(message,"%c%s",'Z',"erase all"); |
| 1089 | 1095 | int messageSize = strlen(message) + 1; |
| 1090 | − AgentList::getInstance()->broadcastToAgents(message, messageSize, &AGENT_TYPE_VOXEL, 1); | |
| 1091 | −} | |
| 1096 | + AgentList::getInstance()->broadcastToAgents((unsigned char*) message, messageSize, &AGENT_TYPE_VOXEL, 1); | |
| 1097 | +}\ | |
| 1092 | 1098 | |
| 1093 | 1099 | void sendVoxelServerAddScene() { |
| 1094 | 1100 | char message[100]; |
| 1095 | 1101 | sprintf(message,"%c%s",'Z',"add scene"); |
| 1096 | 1102 | int messageSize = strlen(message) + 1; |
| 1097 | − AgentList::getInstance()->broadcastToAgents(message, messageSize, &AGENT_TYPE_VOXEL, 1); | |
| 1103 | + AgentList::getInstance()->broadcastToAgents((unsigned char*)message, messageSize, &AGENT_TYPE_VOXEL, 1); | |
| 1098 | 1104 | } |
| 1099 | 1105 | |
| 1100 | 1106 | void shiftPaintingColor() |
| @@ -1107,7 +1113,7 @@ void shiftPaintingColor() · 6 unmodified lines | ||
| 1107 | 1113 | } |
| 1108 | 1114 | |
| 1109 | 1115 | void setupPaintingVoxel() { |
| 1110 | − glm::vec3 avatarPos = myAvatar.getPos(); | |
| 1116 | + glm::vec3 avatarPos = myAvatar.getBodyPosition(); | |
| 1111 | 1117 | |
| 1112 | 1118 | ::paintingVoxel.x = avatarPos.z/-10.0; // voxel space x is negative z head space |
| 1113 | 1119 | ::paintingVoxel.y = avatarPos.y/-10.0; // voxel space y is negative y head space |
| @@ -1280,7 +1286,7 @@ void *networkReceive(void *args) · 166 unmodified lines | ||
| 1280 | 1286 | { |
| 1281 | 1287 | sockaddr senderAddress; |
| 1282 | 1288 | ssize_t bytesReceived; |
| 1283 | − char *incomingPacket = new char[MAX_PACKET_SIZE]; | |
| 1289 | + unsigned char *incomingPacket = new unsigned char[MAX_PACKET_SIZE]; | |
| 1284 | 1290 | |
| 1285 | 1291 | while (!stopNetworkReceiveThread) { |
| 1286 | 1292 | if (AgentList::getInstance()->getAgentSocket().receive(&senderAddress, incomingPacket, &bytesReceived)) { |
| @@ -1525,6 +1531,9 @@ int main(int argc, const char * argv[]) · 238 unmodified lines | ||
| 1525 | 1531 | AgentList::getInstance()->startPingUnknownAgentsThread(); |
| 1526 | 1532 | |
| 1527 | 1533 | glutInit(&argc, (char**)argv); |
| 1534 | + WIDTH = glutGet(GLUT_SCREEN_WIDTH); | |
| 1535 | + HEIGHT = glutGet(GLUT_SCREEN_HEIGHT); | |
| 1536 | + | |
| 1528 | 1537 | glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); |
| 1529 | 1538 | glutInitWindowSize(WIDTH, HEIGHT); |
| 1530 | 1539 | glutCreateWindow("Interface"); |