Showing the changes to interface/src/Application.cpp (1 of 46 files). Show all
Unified · Split
| @@ -75,8 +75,6 @@ using namespace std; · 74 unmodified lines | ||
| 75 | 75 | static char STAR_FILE[] = "http://s3-us-west-1.amazonaws.com/highfidelity/stars.txt"; |
| 76 | 76 | static char STAR_CACHE_FILE[] = "cachedStars.txt"; |
| 77 | 77 | |
| 78 | −static const bool TESTING_PARTICLE_SYSTEM = true; | |
| 79 | − | |
| 80 | 78 | static const int BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH = 6; // farther dragged clicks are ignored |
| 81 | 79 | |
| 82 | 80 | const glm::vec3 START_LOCATION(4.f, 0.f, 5.f); // Where one's own node begins in the world |
| @@ -166,9 +164,9 @@ void GLCanvas::wheelEvent(QWheelEvent* event) { · 83 unmodified lines | ||
| 166 | 164 | Application::getInstance()->wheelEvent(event); |
| 167 | 165 | } |
| 168 | 166 | |
| 169 | −void messageHandler(QtMsgType type, const char* message) { | |
| 170 | − fprintf(stdout, "%s", message); | |
| 171 | − LogDisplay::instance.addMessage(message); | |
| 167 | +void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { | |
| 168 | + fprintf(stdout, "%s", message.toLocal8Bit().constData()); | |
| 169 | + LogDisplay::instance.addMessage(message.toLocal8Bit().constData()); | |
| 172 | 170 | } |
| 173 | 171 | |
| 174 | 172 | Application::Application(int& argc, char** argv, timeval &startup_time) : |
| @@ -224,7 +222,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 49 unmodified lines | ||
| 224 | 222 | _applicationStartupTime = startup_time; |
| 225 | 223 | _window->setWindowTitle("Interface"); |
| 226 | 224 | |
| 227 | − qInstallMsgHandler(messageHandler); | |
| 225 | + qInstallMessageHandler(messageHandler); | |
| 228 | 226 | |
| 229 | 227 | unsigned int listenPort = 0; // bind to an ephemeral port by default |
| 230 | 228 | const char** constArgv = const_cast<const char**>(argv); |
| @@ -407,7 +405,7 @@ void Application::paintGL() { · 176 unmodified lines | ||
| 407 | 405 | |
| 408 | 406 | } else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { |
| 409 | 407 | _myCamera.setTightness(0.0f); // In first person, camera follows head exactly without delay |
| 410 | − _myCamera.setTargetPosition(_myAvatar.getUprightHeadPosition()); | |
| 408 | + _myCamera.setTargetPosition(_myAvatar.getUprightEyeLevelPosition()); | |
| 411 | 409 | _myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation()); |
| 412 | 410 | |
| 413 | 411 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| @@ -566,6 +564,11 @@ void Application::keyPressEvent(QKeyEvent* event) { · 152 unmodified lines | ||
| 566 | 564 | } |
| 567 | 565 | return; |
| 568 | 566 | } |
| 567 | + | |
| 568 | + //this is for switching between modes for the leap rave glove test | |
| 569 | + if (_simulateLeapHand->isChecked() || _testRaveGlove->isChecked()) { | |
| 570 | + _myAvatar.getHand().setRaveGloveEffectsMode((QKeyEvent*)event); | |
| 571 | + } | |
| 569 | 572 | |
| 570 | 573 | bool shifted = event->modifiers().testFlag(Qt::ShiftModifier); |
| 571 | 574 | switch (event->key()) { |
| @@ -1225,7 +1228,7 @@ void Application::editPreferences() { · 653 unmodified lines | ||
| 1225 | 1228 | |
| 1226 | 1229 | if (domainServerHostname->text().size() > 0) { |
| 1227 | 1230 | // the user input a new hostname, use that |
| 1228 | − newHostname = domainServerHostname->text().toAscii(); | |
| 1231 | + newHostname = domainServerHostname->text().toLocal8Bit(); | |
| 1229 | 1232 | } else { |
| 1230 | 1233 | // the user left the field blank, use the default hostname |
| 1231 | 1234 | newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME); |
| @@ -1504,11 +1507,11 @@ bool Application::sendVoxelsOperation(VoxelNode* node, void* extraData) { · 272 unmodified lines | ||
| 1504 | 1507 | int usecToSleep = CLIENT_TO_SERVER_VOXEL_SEND_INTERVAL_USECS - elapsed; |
| 1505 | 1508 | if (usecToSleep > 0) { |
| 1506 | 1509 | qDebug("sendVoxelsOperation: packet: %d bytes:%lld elapsed %lld usecs, sleeping for %d usecs!\n", |
| 1507 | − args->packetsSent, args->bytesSent, elapsed, usecToSleep); | |
| 1510 | + args->packetsSent, (long long int)args->bytesSent, (long long int)elapsed, usecToSleep); | |
| 1508 | 1511 | usleep(usecToSleep); |
| 1509 | 1512 | } else { |
| 1510 | 1513 | qDebug("sendVoxelsOperation: packet: %d bytes:%lld elapsed %lld usecs, no need to sleep!\n", |
| 1511 | − args->packetsSent, args->bytesSent, elapsed); | |
| 1514 | + args->packetsSent, (long long int)args->bytesSent, (long long int)elapsed); | |
| 1512 | 1515 | } |
| 1513 | 1516 | args->lastSendTime = now; |
| 1514 | 1517 | } |
| @@ -1521,12 +1524,12 @@ bool Application::sendVoxelsOperation(VoxelNode* node, void* extraData) { · 6 unmodified lines | ||
| 1521 | 1524 | } |
| 1522 | 1525 | |
| 1523 | 1526 | void Application::exportVoxels() { |
| 1524 | − QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); | |
| 1527 | + QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | |
| 1525 | 1528 | QString suggestedName = desktopLocation.append("/voxels.svo"); |
| 1526 | 1529 | |
| 1527 | 1530 | QString fileNameString = QFileDialog::getSaveFileName(_glWidget, tr("Export Voxels"), suggestedName, |
| 1528 | 1531 | tr("Sparse Voxel Octree Files (*.svo)")); |
| 1529 | − QByteArray fileNameAscii = fileNameString.toAscii(); | |
| 1532 | + QByteArray fileNameAscii = fileNameString.toLocal8Bit(); | |
| 1530 | 1533 | const char* fileName = fileNameAscii.data(); |
| 1531 | 1534 | VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s); |
| 1532 | 1535 | if (selectedNode) { |
| @@ -1541,11 +1544,11 @@ void Application::exportVoxels() { · 8 unmodified lines | ||
| 1541 | 1544 | |
| 1542 | 1545 | const char* IMPORT_FILE_TYPES = "Sparse Voxel Octree Files, Square PNG, Schematic Files (*.svo *.png *.schematic)"; |
| 1543 | 1546 | void Application::importVoxelsToClipboard() { |
| 1544 | − QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); | |
| 1547 | + QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | |
| 1545 | 1548 | QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels to Clipboard"), desktopLocation, |
| 1546 | 1549 | tr(IMPORT_FILE_TYPES)); |
| 1547 | 1550 | |
| 1548 | − QByteArray fileNameAscii = fileNameString.toAscii(); | |
| 1551 | + QByteArray fileNameAscii = fileNameString.toLocal8Bit(); | |
| 1549 | 1552 | const char* fileName = fileNameAscii.data(); |
| 1550 | 1553 | |
| 1551 | 1554 | _clipboardTree.eraseAllVoxels(); |
| @@ -1575,11 +1578,11 @@ void Application::importVoxelsToClipboard() { · 23 unmodified lines | ||
| 1575 | 1578 | } |
| 1576 | 1579 | |
| 1577 | 1580 | void Application::importVoxels() { |
| 1578 | − QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); | |
| 1581 | + QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | |
| 1579 | 1582 | QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels"), desktopLocation, |
| 1580 | 1583 | tr(IMPORT_FILE_TYPES)); |
| 1581 | 1584 | |
| 1582 | − QByteArray fileNameAscii = fileNameString.toAscii(); | |
| 1585 | + QByteArray fileNameAscii = fileNameString.toLocal8Bit(); | |
| 1583 | 1586 | const char* fileName = fileNameAscii.data(); |
| 1584 | 1587 | |
| 1585 | 1588 | VoxelTree importVoxels; |
| @@ -1693,7 +1696,7 @@ void Application::pasteVoxels() { · 107 unmodified lines | ||
| 1693 | 1696 | controlledBroadcastToNodes(args.messageBuffer, args.bufferInUse, & NODE_TYPE_VOXEL_SERVER, 1); |
| 1694 | 1697 | qDebug("sending packet: %d\n", ++args.packetsSent); |
| 1695 | 1698 | args.bytesSent += args.bufferInUse; |
| 1696 | − qDebug("total bytes sent: %lld\n", args.bytesSent); | |
| 1699 | + qDebug("total bytes sent: %lld\n", (long long int)args.bytesSent); | |
| 1697 | 1700 | } |
| 1698 | 1701 | |
| 1699 | 1702 | if (calculatedOctCode) { |
| @@ -1758,6 +1761,8 @@ void Application::initMenu() { · 58 unmodified lines | ||
| 1758 | 1761 | _renderLookatOn->setChecked(false); |
| 1759 | 1762 | (_renderLookatIndicatorOn = renderMenu->addAction("Lookat Indicator"))->setCheckable(true); |
| 1760 | 1763 | _renderLookatIndicatorOn->setChecked(true); |
| 1764 | + (_renderParticleSystemOn = renderMenu->addAction("Particle System"))->setCheckable(true); | |
| 1765 | + _renderParticleSystemOn->setChecked(true); | |
| 1761 | 1766 | (_manualFirstPerson = renderMenu->addAction( |
| 1762 | 1767 | "First Person", this, SLOT(setRenderFirstPerson(bool)), Qt::Key_P))->setCheckable(true); |
| 1763 | 1768 | (_manualThirdPerson = renderMenu->addAction( |
| @@ -1995,8 +2000,11 @@ const float MAX_VOXEL_EDIT_DISTANCE = 20.0f; · 231 unmodified lines | ||
| 1995 | 2000 | const float HEAD_SPHERE_RADIUS = 0.07; |
| 1996 | 2001 | |
| 1997 | 2002 | |
| 2003 | +static uint16_t DEFAULT_NODE_ID_REF = 1; | |
| 2004 | + | |
| 2005 | + | |
| 1998 | 2006 | bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, |
| 1999 | − glm::vec3& eyePosition, uint16_t& nodeID) { | |
| 2007 | + glm::vec3& eyePosition, uint16_t& nodeID = DEFAULT_NODE_ID_REF) { | |
| 2000 | 2008 | |
| 2001 | 2009 | NodeList* nodeList = NodeList::getInstance(); |
| 2002 | 2010 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| @@ -2053,8 +2061,8 @@ void Application::update(float deltaTime) { · 50 unmodified lines | ||
| 2053 | 2061 | |
| 2054 | 2062 | // Set where I am looking based on my mouse ray (so that other people can see) |
| 2055 | 2063 | glm::vec3 eyePosition; |
| 2056 | − uint16_t ignored; | |
| 2057 | − _isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, ignored); | |
| 2064 | + | |
| 2065 | + _isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition); | |
| 2058 | 2066 | if (_isLookingAtOtherAvatar) { |
| 2059 | 2067 | // If the mouse is over another avatar's head... |
| 2060 | 2068 | glm::vec3 myLookAtFromMouse(eyePosition); |
| @@ -2271,7 +2279,7 @@ void Application::update(float deltaTime) { · 210 unmodified lines | ||
| 2271 | 2279 | _audio.eventuallyAnalyzePing(); |
| 2272 | 2280 | #endif |
| 2273 | 2281 | |
| 2274 | − if (TESTING_PARTICLE_SYSTEM) { | |
| 2282 | + if (_renderParticleSystemOn->isChecked()) { | |
| 2275 | 2283 | updateParticleSystem(deltaTime); |
| 2276 | 2284 | } |
| 2277 | 2285 | } |
| @@ -2320,8 +2328,8 @@ void Application::updateAvatar(float deltaTime) { · 42 unmodified lines | ||
| 2320 | 2328 | _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection); |
| 2321 | 2329 | |
| 2322 | 2330 | glm::vec3 eyePosition; |
| 2323 | − uint16_t ignored; | |
| 2324 | − _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition, ignored); | |
| 2331 | + | |
| 2332 | + _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition); | |
| 2325 | 2333 | if (_isLookingAtOtherAvatar) { |
| 2326 | 2334 | glm::vec3 myLookAtFromMouse(eyePosition); |
| 2327 | 2335 | _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); |
| @@ -2360,7 +2368,7 @@ void Application::updateAvatar(float deltaTime) { · 32 unmodified lines | ||
| 2360 | 2368 | NodeList* nodeList = NodeList::getInstance(); |
| 2361 | 2369 | if (nodeList->getOwnerID() != UNKNOWN_NODE_ID) { |
| 2362 | 2370 | // if I know my ID, send head/hand data to the avatar mixer and voxel server |
| 2363 | − unsigned char broadcastString[200]; | |
| 2371 | + unsigned char broadcastString[MAX_PACKET_SIZE]; | |
| 2364 | 2372 | unsigned char* endOfBroadcastStringWrite = broadcastString; |
| 2365 | 2373 | |
| 2366 | 2374 | endOfBroadcastStringWrite += populateTypeAndVersion(endOfBroadcastStringWrite, PACKET_TYPE_HEAD_DATA); |
| @@ -2679,13 +2687,14 @@ void Application::displaySide(Camera& whichCamera) { · 312 unmodified lines | ||
| 2679 | 2687 | if (_mouseVoxel.s != 0) { |
| 2680 | 2688 | glDisable(GL_LIGHTING); |
| 2681 | 2689 | glPushMatrix(); |
| 2690 | + glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE); | |
| 2691 | + renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s); | |
| 2682 | 2692 | if (_addVoxelMode->isChecked()) { |
| 2683 | 2693 | // use a contrasting color so that we can see what we're doing |
| 2684 | 2694 | glColor3ub(_mouseVoxel.red + 128, _mouseVoxel.green + 128, _mouseVoxel.blue + 128); |
| 2685 | 2695 | } else { |
| 2686 | 2696 | glColor3ub(_mouseVoxel.red, _mouseVoxel.green, _mouseVoxel.blue); |
| 2687 | 2697 | } |
| 2688 | − glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE); | |
| 2689 | 2698 | glTranslatef(_mouseVoxel.x + _mouseVoxel.s*0.5f, |
| 2690 | 2699 | _mouseVoxel.y + _mouseVoxel.s*0.5f, |
| 2691 | 2700 | _mouseVoxel.z + _mouseVoxel.s*0.5f); |
| @@ -2720,25 +2729,23 @@ void Application::displaySide(Camera& whichCamera) { · 28 unmodified lines | ||
| 2720 | 2729 | _myAvatar.getHead().setLookAtPosition(_myCamera.getPosition()); |
| 2721 | 2730 | } |
| 2722 | 2731 | _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked()); |
| 2723 | − _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked()); | |
| 2724 | 2732 | |
| 2725 | 2733 | if (_renderLookatIndicatorOn->isChecked() && _isLookingAtOtherAvatar) { |
| 2726 | 2734 | renderLookatIndicator(_lookatOtherPosition, whichCamera); |
| 2727 | 2735 | } |
| 2728 | 2736 | } |
| 2729 | 2737 | |
| 2730 | − if (TESTING_PARTICLE_SYSTEM) { | |
| 2738 | + if (_renderParticleSystemOn->isChecked()) { | |
| 2731 | 2739 | if (_particleSystemInitialized) { |
| 2732 | 2740 | _particleSystem.render(); |
| 2733 | 2741 | } |
| 2734 | 2742 | } |
| 2735 | − | |
| 2743 | + | |
| 2736 | 2744 | // Render the world box |
| 2737 | 2745 | if (!_lookingInMirror->isChecked() && _renderStatsOn->isChecked()) { render_world_box(); } |
| 2738 | 2746 | |
| 2739 | 2747 | // brad's frustum for debugging |
| 2740 | 2748 | if (_frustumOn->isChecked()) renderViewFrustum(_viewFrustum); |
| 2741 | − | |
| 2742 | 2749 | } |
| 2743 | 2750 | |
| 2744 | 2751 | void Application::displayOverlay() { |
| @@ -3644,7 +3651,7 @@ void Application::saveSettings(QSettings* settings) { · 899 unmodified lines | ||
| 3644 | 3651 | } |
| 3645 | 3652 | |
| 3646 | 3653 | void Application::importSettings() { |
| 3647 | − QString locationDir(QDesktopServices::displayName(QDesktopServices::DesktopLocation)); | |
| 3654 | + QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation)); | |
| 3648 | 3655 | QString fileName = QFileDialog::getOpenFileName(_window, |
| 3649 | 3656 | tr("Open .ini config file"), |
| 3650 | 3657 | locationDir, |
| @@ -3656,7 +3663,7 @@ void Application::importSettings() { · 5 unmodified lines | ||
| 3656 | 3663 | } |
| 3657 | 3664 | |
| 3658 | 3665 | void Application::exportSettings() { |
| 3659 | − QString locationDir(QDesktopServices::displayName(QDesktopServices::DesktopLocation)); | |
| 3666 | + QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation)); | |
| 3660 | 3667 | QString fileName = QFileDialog::getSaveFileName(_window, |
| 3661 | 3668 | tr("Save .ini config file"), |
| 3662 | 3669 | locationDir, |
| @@ -3669,56 +3676,57 @@ void Application::exportSettings() { · 6 unmodified lines | ||
| 3669 | 3676 | } |
| 3670 | 3677 | |
| 3671 | 3678 | |
| 3672 | − | |
| 3673 | 3679 | void Application::updateParticleSystem(float deltaTime) { |
| 3674 | 3680 | |
| 3675 | 3681 | if (!_particleSystemInitialized) { |
| 3682 | + | |
| 3683 | + const int LIFESPAN_IN_SECONDS = 100000.0f; | |
| 3684 | + const float EMIT_RATE_IN_SECONDS = 10000.0; | |
| 3676 | 3685 | // create a stable test emitter and spit out a bunch of particles |
| 3677 | 3686 | _coolDemoParticleEmitter = _particleSystem.addEmitter(); |
| 3678 | − | |
| 3687 | + | |
| 3679 | 3688 | if (_coolDemoParticleEmitter != -1) { |
| 3689 | + | |
| 3680 | 3690 | _particleSystem.setShowingEmitter(_coolDemoParticleEmitter, true); |
| 3681 | 3691 | glm::vec3 particleEmitterPosition = glm::vec3(5.0f, 1.0f, 5.0f); |
| 3682 | − _particleSystem.setEmitterPosition(_coolDemoParticleEmitter, particleEmitterPosition); | |
| 3683 | − glm::vec3 velocity(0.0f, 0.1f, 0.0f); | |
| 3684 | − float lifespan = 100000.0f; | |
| 3685 | − _particleSystem.emitParticlesNow(_coolDemoParticleEmitter, 1500, velocity, lifespan); | |
| 3692 | + | |
| 3693 | + _particleSystem.setEmitterPosition (_coolDemoParticleEmitter, particleEmitterPosition); | |
| 3694 | + _particleSystem.setEmitterParticleLifespan(_coolDemoParticleEmitter, LIFESPAN_IN_SECONDS); | |
| 3695 | + _particleSystem.setEmitterThrust (_coolDemoParticleEmitter, 0.0f); | |
| 3696 | + _particleSystem.setEmitterRate (_coolDemoParticleEmitter, EMIT_RATE_IN_SECONDS); // to emit a pile o particles now | |
| 3686 | 3697 | } |
| 3687 | 3698 | |
| 3688 | 3699 | // signal that the particle system has been initialized |
| 3689 | 3700 | _particleSystemInitialized = true; |
| 3690 | 3701 | } else { |
| 3691 | 3702 | // update the particle system |
| 3692 | − | |
| 3693 | − static float t = 0.0f; | |
| 3694 | − t += deltaTime; | |
| 3703 | + | |
| 3704 | + static bool emitting = true; | |
| 3705 | + static float effectsTimer = 0.0f; | |
| 3706 | + effectsTimer += deltaTime; | |
| 3695 | 3707 | |
| 3696 | 3708 | if (_coolDemoParticleEmitter != -1) { |
| 3697 | 3709 | |
| 3698 | − glm::vec3 tilt = glm::vec3 | |
| 3699 | − ( | |
| 3700 | − 30.0f * sinf( t * 0.55f ), | |
| 3701 | − 0.0f, | |
| 3702 | − 30.0f * cosf( t * 0.75f ) | |
| 3703 | − ); | |
| 3704 | − | |
| 3705 | − _particleSystem.setEmitterRotation(_coolDemoParticleEmitter, glm::quat(glm::radians(tilt))); | |
| 3710 | + _particleSystem.setEmitterDirection(_coolDemoParticleEmitter, glm::vec3(0.0f, 1.0f, 0.0f)); | |
| 3706 | 3711 | |
| 3707 | 3712 | ParticleSystem::ParticleAttributes attributes; |
| 3708 | 3713 | |
| 3709 | 3714 | attributes.radius = 0.01f; |
| 3710 | 3715 | attributes.color = glm::vec4( 1.0f, 1.0f, 1.0f, 1.0f); |
| 3711 | − attributes.gravity = 0.0f + 0.05f * sinf( t * 0.52f ); | |
| 3712 | − attributes.airFriction = 2.5 + 2.0f * sinf( t * 0.32f ); | |
| 3713 | − attributes.jitter = 0.05f + 0.05f * sinf( t * 0.42f ); | |
| 3714 | − attributes.emitterAttraction = 0.015f + 0.015f * cosf( t * 0.6f ); | |
| 3715 | − attributes.tornadoForce = 0.0f + 0.03f * sinf( t * 0.7f ); | |
| 3716 | − attributes.neighborAttraction = 0.1f + 0.1f * cosf( t * 0.8f ); | |
| 3717 | − attributes.neighborRepulsion = 0.2f + 0.2f * sinf( t * 0.4f ); | |
| 3716 | + attributes.gravity = 0.0f + 0.05f * sinf( effectsTimer * 0.52f ); | |
| 3717 | + attributes.airFriction = 2.5 + 2.0f * sinf( effectsTimer * 0.32f ); | |
| 3718 | + attributes.jitter = 0.05f + 0.05f * sinf( effectsTimer * 0.42f ); | |
| 3719 | + attributes.emitterAttraction = 0.015f + 0.015f * cosf( effectsTimer * 0.6f ); | |
| 3720 | + attributes.tornadoForce = 0.0f + 0.03f * sinf( effectsTimer * 0.7f ); | |
| 3721 | + attributes.neighborAttraction = 0.1f + 0.1f * cosf( effectsTimer * 0.8f ); | |
| 3722 | + attributes.neighborRepulsion = 0.2f + 0.2f * sinf( effectsTimer * 0.4f ); | |
| 3718 | 3723 | attributes.bounce = 1.0f; |
| 3719 | 3724 | attributes.usingCollisionSphere = true; |
| 3720 | 3725 | attributes.collisionSpherePosition = glm::vec3( 5.0f, 0.5f, 5.0f ); |
| 3721 | 3726 | attributes.collisionSphereRadius = 0.5f; |
| 3727 | + attributes.usingCollisionPlane = true; | |
| 3728 | + attributes.collisionPlanePosition = glm::vec3( 5.0f, 0.0f, 5.0f ); | |
| 3729 | + attributes.collisionPlaneNormal = glm::vec3( 0.0f, 1.0f, 0.0f ); | |
| 3722 | 3730 | |
| 3723 | 3731 | if (attributes.gravity < 0.0f) { |
| 3724 | 3732 | attributes.gravity = 0.0f; |
| @@ -3729,6 +3737,15 @@ void Application::updateParticleSystem(float deltaTime) { · 4 unmodified lines | ||
| 3729 | 3737 | |
| 3730 | 3738 | _particleSystem.setUpDirection(glm::vec3(0.0f, 1.0f, 0.0f)); |
| 3731 | 3739 | _particleSystem.simulate(deltaTime); |
| 3740 | + | |
| 3741 | + const float EMIT_RATE_IN_SECONDS = 0.0; | |
| 3742 | + | |
| 3743 | + if (_coolDemoParticleEmitter != -1) { | |
| 3744 | + if (emitting) { | |
| 3745 | + _particleSystem.setEmitterRate(_coolDemoParticleEmitter, EMIT_RATE_IN_SECONDS); // stop emitter | |
| 3746 | + emitting = false; | |
| 3747 | + } | |
| 3748 | + } | |
| 3732 | 3749 | } |
| 3733 | 3750 | } |
| 3734 | 3751 | |