Showing the changes to interface/src/main.cpp (1 of 11 files). Show all
Unified · Split
| @@ -85,6 +85,7 @@ · 84 unmodified lines | ||
| 85 | 85 | using namespace std; |
| 86 | 86 | |
| 87 | 87 | void reshape(int width, int height); // will be defined below |
| 88 | +void loadViewFrustum(ViewFrustum& viewFrustum); // will be defined below | |
| 88 | 89 | |
| 89 | 90 | |
| 90 | 91 | pthread_t networkReceiveThread; |
| @@ -522,6 +523,22 @@ void updateAvatar(float frametime) · 431 unmodified lines | ||
| 522 | 523 | myAvatar.setAverageLoudness(averageLoudness); |
| 523 | 524 | #endif |
| 524 | 525 | |
| 526 | + // Update Avatar with latest camera and view frustum data... | |
| 527 | + // NOTE: we get this from the view frustum, to make it simpler, since the | |
| 528 | + // loadViewFrumstum() method will get the correct details from the camera | |
| 529 | + // We could optimize this to not actually load the viewFrustum, since we don't | |
| 530 | + // actually need to calculate the view frustum planes to send these details | |
| 531 | + // to the server. | |
| 532 | + loadViewFrustum(::viewFrustum); | |
| 533 | + myAvatar.setCameraPosition(::viewFrustum.getPosition()); | |
| 534 | + myAvatar.setCameraDirection(::viewFrustum.getDirection()); | |
| 535 | + myAvatar.setCameraUp(::viewFrustum.getUp()); | |
| 536 | + myAvatar.setCameraRight(::viewFrustum.getRight()); | |
| 537 | + myAvatar.setCameraFov(::viewFrustum.getFieldOfView()); | |
| 538 | + myAvatar.setCameraAspectRatio(::viewFrustum.getAspectRatio()); | |
| 539 | + myAvatar.setCameraNearClip(::viewFrustum.getNearClip()); | |
| 540 | + myAvatar.setCameraFarClip(::viewFrustum.getFarClip()); | |
| 541 | + | |
| 525 | 542 | // Send my stream of head/hand data to the avatar mixer and voxel server |
| 526 | 543 | unsigned char broadcastString[200]; |
| 527 | 544 | *broadcastString = PACKET_HEADER_HEAD_DATA; |
| @@ -559,7 +576,7 @@ void updateAvatar(float frametime) · 31 unmodified lines | ||
| 559 | 576 | } |
| 560 | 577 | |
| 561 | 578 | ///////////////////////////////////////////////////////////////////////////////////// |
| 562 | −// renderViewFrustum() | |
| 579 | +// loadViewFrustum() | |
| 563 | 580 | // |
| 564 | 581 | // Description: this will load the view frustum bounds for EITHER the head |
| 565 | 582 | // or the "myCamera". |