Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -205,8 +205,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 204 unmodified lines | |||
| 205 | _justEditedVoxel(false), | 205 | _justEditedVoxel(false), |
| 206 | _isLookingAtOtherAvatar(false), | 206 | _isLookingAtOtherAvatar(false), |
| 207 | _lookatIndicatorScale(1.0f), | 207 | _lookatIndicatorScale(1.0f), |
| 208 | _paintOn(false), | ||
| 209 | _dominantColor(0), | ||
| 210 | _perfStatsOn(false), | 208 | _perfStatsOn(false), |
| 211 | _chatEntryOn(false), | 209 | _chatEntryOn(false), |
| 212 | _oculusTextureID(0), | 210 | _oculusTextureID(0), |
| @@ -540,27 +538,20 @@ void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_ · 327 unmodified lines | |||
| 540 | // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise) | 538 | // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise) |
| 541 | BandwidthMeter::ChannelIndex channel; | 539 | BandwidthMeter::ChannelIndex channel; |
| 542 | switch (nodeTypes[i]) { | 540 | switch (nodeTypes[i]) { |
| 543 | case NODE_TYPE_AGENT: | 541 | case NODE_TYPE_AGENT: |
| 544 | case NODE_TYPE_AVATAR_MIXER: | 542 | case NODE_TYPE_AVATAR_MIXER: |
| 545 | channel = BandwidthMeter::AVATARS; | 543 | channel = BandwidthMeter::AVATARS; |
| 546 | break; | 544 | break; |
| 547 | case NODE_TYPE_VOXEL_SERVER: | 545 | case NODE_TYPE_VOXEL_SERVER: |
| 548 | channel = BandwidthMeter::VOXELS; | 546 | channel = BandwidthMeter::VOXELS; |
| 549 | break; | 547 | break; |
| 550 | default: | 548 | default: |
| 551 | continue; | 549 | continue; |
| 552 | } | 550 | } |
| 553 | self->_bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes); | 551 | self->_bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes); |
| 554 | } | 552 | } |
| 555 | } | 553 | } |
| 556 | 554 | ||
| 557 | void Application::sendVoxelServerAddScene() { | ||
| 558 | char message[100]; | ||
| 559 | sprintf(message,"%c%s",'Z',"add scene"); | ||
| 560 | int messageSize = strlen(message) + 1; | ||
| 561 | controlledBroadcastToNodes((unsigned char*)message, messageSize, & NODE_TYPE_VOXEL_SERVER, 1); | ||
| 562 | } | ||
| 563 | |||
| 564 | void Application::keyPressEvent(QKeyEvent* event) { | 555 | void Application::keyPressEvent(QKeyEvent* event) { |
| 565 | if (activeWindow() == _window) { | 556 | if (activeWindow() == _window) { |
| 566 | if (_chatEntryOn) { | 557 | if (_chatEntryOn) { |
| @@ -626,19 +617,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 59 unmodified lines | |||
| 626 | _viewFrustumOffsetUp += 0.05; | 617 | _viewFrustumOffsetUp += 0.05; |
| 627 | break; | 618 | break; |
| 628 | 619 | ||
| 629 | case Qt::Key_Ampersand: | ||
| 630 | _paintOn = !_paintOn; | ||
| 631 | setupPaintingVoxel(); | ||
| 632 | break; | ||
| 633 | |||
| 634 | case Qt::Key_AsciiCircum: | ||
| 635 | shiftPaintingColor(); | ||
| 636 | break; | ||
| 637 | |||
| 638 | case Qt::Key_Percent: | ||
| 639 | sendVoxelServerAddScene(); | ||
| 640 | break; | ||
| 641 | |||
| 642 | case Qt::Key_Semicolon: | 620 | case Qt::Key_Semicolon: |
| 643 | _audio.ping(); | 621 | _audio.ping(); |
| 644 | break; | 622 | break; |
| @@ -2761,26 +2739,6 @@ void Application::updateAvatar(float deltaTime) { · 2116 unmodified lines | |||
| 2761 | sendAvatarVoxelURLMessage(_myAvatar.getVoxels()->getVoxelURL()); | 2739 | sendAvatarVoxelURLMessage(_myAvatar.getVoxels()->getVoxelURL()); |
| 2762 | } | 2740 | } |
| 2763 | } | 2741 | } |
| 2764 | |||
| 2765 | // If I'm in paint mode, send a voxel out to VOXEL server nodes. | ||
| 2766 | if (_paintOn) { | ||
| 2767 | |||
| 2768 | glm::vec3 avatarPos = _myAvatar.getPosition(); | ||
| 2769 | |||
| 2770 | // For some reason, we don't want to flip X and Z here. | ||
| 2771 | _paintingVoxel.x = avatarPos.x / 10.0; | ||
| 2772 | _paintingVoxel.y = avatarPos.y / 10.0; | ||
| 2773 | _paintingVoxel.z = avatarPos.z / 10.0; | ||
| 2774 | |||
| 2775 | if (_paintingVoxel.x >= 0.0 && _paintingVoxel.x <= 1.0 && | ||
| 2776 | _paintingVoxel.y >= 0.0 && _paintingVoxel.y <= 1.0 && | ||
| 2777 | _paintingVoxel.z >= 0.0 && _paintingVoxel.z <= 1.0) { | ||
| 2778 | |||
| 2779 | PACKET_TYPE message = (_destructiveAddVoxel->isChecked() ? | ||
| 2780 | PACKET_TYPE_SET_VOXEL_DESTRUCTIVE : PACKET_TYPE_SET_VOXEL); | ||
| 2781 | sendVoxelEditMessage(message, _paintingVoxel); | ||
| 2782 | } | ||
| 2783 | } | ||
| 2784 | } | 2742 | } |
| 2785 | 2743 | ||
| 2786 | ///////////////////////////////////////////////////////////////////////////////////// | 2744 | ///////////////////////////////////////////////////////////////////////////////////// |
| @@ -3268,15 +3226,6 @@ void Application::displayOverlay() { · 481 unmodified lines | |||
| 3268 | sprintf(nodes, "Servers: %d, Avatars: %d\n", totalServers, totalAvatars); | 3226 | sprintf(nodes, "Servers: %d, Avatars: %d\n", totalServers, totalAvatars); |
| 3269 | drawtext(_glWidget->width() - 150, 20, 0.10, 0, 1.0, 0, nodes, 1, 0, 0); | 3227 | drawtext(_glWidget->width() - 150, 20, 0.10, 0, 1.0, 0, nodes, 1, 0, 0); |
| 3270 | 3228 | ||
| 3271 | if (_paintOn) { | ||
| 3272 | |||
| 3273 | char paintMessage[100]; | ||
| 3274 | sprintf(paintMessage,"Painting (%.3f,%.3f,%.3f/%.3f/%d,%d,%d)", | ||
| 3275 | _paintingVoxel.x, _paintingVoxel.y, _paintingVoxel.z, _paintingVoxel.s, | ||
| 3276 | (unsigned int)_paintingVoxel.red, (unsigned int)_paintingVoxel.green, (unsigned int)_paintingVoxel.blue); | ||
| 3277 | drawtext(_glWidget->width() - 350, 50, 0.10, 0, 1.0, 0, paintMessage, 1, 1, 0); | ||
| 3278 | } | ||
| 3279 | |||
| 3280 | // render the webcam input frame | 3229 | // render the webcam input frame |
| 3281 | _webcam.renderPreview(_glWidget->width(), _glWidget->height()); | 3230 | _webcam.renderPreview(_glWidget->width(), _glWidget->height()); |
| 3282 | 3231 | ||
| @@ -3734,26 +3683,6 @@ void Application::renderViewFrustum(ViewFrustum& viewFrustum) { · 451 unmodified lines | |||
| 3734 | } | 3683 | } |
| 3735 | } | 3684 | } |
| 3736 | 3685 | ||
| 3737 | void Application::setupPaintingVoxel() { | ||
| 3738 | glm::vec3 avatarPos = _myAvatar.getPosition(); | ||
| 3739 | |||
| 3740 | _paintingVoxel.x = avatarPos.z/-10.0; // voxel space x is negative z head space | ||
| 3741 | _paintingVoxel.y = avatarPos.y/-10.0; // voxel space y is negative y head space | ||
| 3742 | _paintingVoxel.z = avatarPos.x/-10.0; // voxel space z is negative x head space | ||
| 3743 | _paintingVoxel.s = 1.0/256; | ||
| 3744 | |||
| 3745 | shiftPaintingColor(); | ||
| 3746 | } | ||
| 3747 | |||
| 3748 | void Application::shiftPaintingColor() { | ||
| 3749 | // About the color of the paintbrush... first determine the dominant color | ||
| 3750 | _dominantColor = (_dominantColor + 1) % 3; // 0=red,1=green,2=blue | ||
| 3751 | _paintingVoxel.red = (_dominantColor == 0) ? randIntInRange(200, 255) : randIntInRange(40, 100); | ||
| 3752 | _paintingVoxel.green = (_dominantColor == 1) ? randIntInRange(200, 255) : randIntInRange(40, 100); | ||
| 3753 | _paintingVoxel.blue = (_dominantColor == 2) ? randIntInRange(200, 255) : randIntInRange(40, 100); | ||
| 3754 | } | ||
| 3755 | |||
| 3756 | |||
| 3757 | void Application::injectVoxelAddedSoundEffect() { | 3686 | void Application::injectVoxelAddedSoundEffect() { |
| 3758 | AudioInjector* voxelInjector = AudioInjectionManager::injectorWithCapacity(11025); | 3687 | AudioInjector* voxelInjector = AudioInjectionManager::injectorWithCapacity(11025); |
| 3759 | 3688 | ||