Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all
Unified · Split
| @@ -95,8 +95,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 94 unmodified lines | |||
| 95 | _frameCount(0), | 95 | _frameCount(0), |
| 96 | _fps(120.0f), | 96 | _fps(120.0f), |
| 97 | _justStarted(true), | 97 | _justStarted(true), |
| 98 | _particleSystemInitialized(false), | ||
| 99 | _coolDemoParticleEmitter(-1), | ||
| 100 | _wantToKillLocalVoxels(false), | 98 | _wantToKillLocalVoxels(false), |
| 101 | _audioScope(256, 200, true), | 99 | _audioScope(256, 200, true), |
| 102 | _mouseX(0), | 100 | _mouseX(0), |
| @@ -1971,10 +1969,6 @@ void Application::update(float deltaTime) { · 1868 unmodified lines | |||
| 1971 | _audio.setLastVelocity(_myAvatar.getVelocity()); | 1969 | _audio.setLastVelocity(_myAvatar.getVelocity()); |
| 1972 | _audio.eventuallyAnalyzePing(); | 1970 | _audio.eventuallyAnalyzePing(); |
| 1973 | #endif | 1971 | #endif |
| 1974 | |||
| 1975 | if (Menu::getInstance()->isOptionChecked(MenuOption::ParticleSystem)) { | ||
| 1976 | updateParticleSystem(deltaTime); | ||
| 1977 | } | ||
| 1978 | } | 1972 | } |
| 1979 | 1973 | ||
| 1980 | void Application::updateAvatar(float deltaTime) { | 1974 | void Application::updateAvatar(float deltaTime) { |
| @@ -2449,12 +2443,6 @@ void Application::displaySide(Camera& whichCamera) { · 468 unmodified lines | |||
| 2449 | 2443 | ||
| 2450 | _myAvatar.renderScreenTint(SCREEN_TINT_AFTER_AVATARS, whichCamera); | 2444 | _myAvatar.renderScreenTint(SCREEN_TINT_AFTER_AVATARS, whichCamera); |
| 2451 | 2445 | ||
| 2452 | if (Menu::getInstance()->isOptionChecked(MenuOption::ParticleSystem)) { | ||
| 2453 | if (_particleSystemInitialized) { | ||
| 2454 | _particleSystem.render(); | ||
| 2455 | } | ||
| 2456 | } | ||
| 2457 | |||
| 2458 | // Render the world box | 2446 | // Render the world box |
| 2459 | if (!Menu::getInstance()->isOptionChecked(MenuOption::Mirror) && Menu::getInstance()->isOptionChecked(MenuOption::Stats)) { | 2447 | if (!Menu::getInstance()->isOptionChecked(MenuOption::Mirror) && Menu::getInstance()->isOptionChecked(MenuOption::Stats)) { |
| 2460 | renderWorldBox(); | 2448 | renderWorldBox(); |
| @@ -3379,80 +3367,4 @@ void* Application::networkReceive(void* args) { · 918 unmodified lines | |||
| 3379 | pthread_exit(0); | 3367 | pthread_exit(0); |
| 3380 | } | 3368 | } |
| 3381 | return NULL; | 3369 | return NULL; |
| 3382 | } | 3370 | } |
| 3383 | |||
| 3384 | void Application::updateParticleSystem(float deltaTime) { | ||
| 3385 | |||
| 3386 | if (!_particleSystemInitialized) { | ||
| 3387 | |||
| 3388 | const int LIFESPAN_IN_SECONDS = 100000.0f; | ||
| 3389 | const float EMIT_RATE_IN_SECONDS = 10000.0; | ||
| 3390 | // create a stable test emitter and spit out a bunch of particles | ||
| 3391 | _coolDemoParticleEmitter = _particleSystem.addEmitter(); | ||
| 3392 | |||
| 3393 | if (_coolDemoParticleEmitter != -1) { | ||
| 3394 | |||
| 3395 | _particleSystem.setShowingEmitter(_coolDemoParticleEmitter, true); | ||
| 3396 | glm::vec3 particleEmitterPosition = glm::vec3(5.0f, 1.0f, 5.0f); | ||
| 3397 | |||
| 3398 | _particleSystem.setEmitterPosition (_coolDemoParticleEmitter, particleEmitterPosition); | ||
| 3399 | _particleSystem.setEmitterParticleLifespan(_coolDemoParticleEmitter, LIFESPAN_IN_SECONDS); | ||
| 3400 | _particleSystem.setEmitterThrust (_coolDemoParticleEmitter, 0.0f); | ||
| 3401 | _particleSystem.setEmitterRate (_coolDemoParticleEmitter, EMIT_RATE_IN_SECONDS); // to emit a pile o particles now | ||
| 3402 | } | ||
| 3403 | |||
| 3404 | // signal that the particle system has been initialized | ||
| 3405 | _particleSystemInitialized = true; | ||
| 3406 | } else { | ||
| 3407 | // update the particle system | ||
| 3408 | |||
| 3409 | static bool emitting = true; | ||
| 3410 | static float effectsTimer = 0.0f; | ||
| 3411 | effectsTimer += deltaTime; | ||
| 3412 | |||
| 3413 | if (_coolDemoParticleEmitter != -1) { | ||
| 3414 | |||
| 3415 | _particleSystem.setEmitterDirection(_coolDemoParticleEmitter, glm::vec3(0.0f, 1.0f, 0.0f)); | ||
| 3416 | |||
| 3417 | ParticleSystem::ParticleAttributes attributes; | ||
| 3418 | |||
| 3419 | attributes.radius = 0.01f; | ||
| 3420 | attributes.color = glm::vec4( 1.0f, 1.0f, 1.0f, 1.0f); | ||
| 3421 | attributes.gravity = 0.0f + 0.05f * sinf( effectsTimer * 0.52f ); | ||
| 3422 | attributes.airFriction = 2.5 + 2.0f * sinf( effectsTimer * 0.32f ); | ||
| 3423 | attributes.jitter = 0.05f + 0.05f * sinf( effectsTimer * 0.42f ); | ||
| 3424 | attributes.emitterAttraction = 0.015f + 0.015f * cosf( effectsTimer * 0.6f ); | ||
| 3425 | attributes.tornadoForce = 0.0f + 0.03f * sinf( effectsTimer * 0.7f ); | ||
| 3426 | attributes.neighborAttraction = 0.1f + 0.1f * cosf( effectsTimer * 0.8f ); | ||
| 3427 | attributes.neighborRepulsion = 0.2f + 0.2f * sinf( effectsTimer * 0.4f ); | ||
| 3428 | attributes.bounce = 1.0f; | ||
| 3429 | attributes.usingCollisionSphere = true; | ||
| 3430 | attributes.collisionSpherePosition = glm::vec3( 5.0f, 0.5f, 5.0f ); | ||
| 3431 | attributes.collisionSphereRadius = 0.5f; | ||
| 3432 | attributes.usingCollisionPlane = true; | ||
| 3433 | attributes.collisionPlanePosition = glm::vec3( 5.0f, 0.0f, 5.0f ); | ||
| 3434 | attributes.collisionPlaneNormal = glm::vec3( 0.0f, 1.0f, 0.0f ); | ||
| 3435 | |||
| 3436 | if (attributes.gravity < 0.0f) { | ||
| 3437 | attributes.gravity = 0.0f; | ||
| 3438 | } | ||
| 3439 | |||
| 3440 | _particleSystem.setParticleAttributes(_coolDemoParticleEmitter, attributes); | ||
| 3441 | } | ||
| 3442 | |||
| 3443 | _particleSystem.setUpDirection(glm::vec3(0.0f, 1.0f, 0.0f)); | ||
| 3444 | _particleSystem.simulate(deltaTime); | ||
| 3445 | |||
| 3446 | const float EMIT_RATE_IN_SECONDS = 0.0; | ||
| 3447 | |||
| 3448 | if (_coolDemoParticleEmitter != -1) { | ||
| 3449 | if (emitting) { | ||
| 3450 | _particleSystem.setEmitterRate(_coolDemoParticleEmitter, EMIT_RATE_IN_SECONDS); // stop emitter | ||
| 3451 | emitting = false; | ||
| 3452 | } | ||
| 3453 | } | ||
| 3454 | } | ||
| 3455 | } | ||
| 3456 | |||
| 3457 | |||
| 3458 | |||