void FlockingApp::update() { // UPDATE CAMERA mEye = vec3( 0.0f, 0.0f, mCameraDistance ); mCam.lookAt( mEye, mCenter, mUp ); gl::setMatrices( mCam ); gl::rotate( mSceneRotation ); // UPDATE PARTICLE CONTROLLER if( mCentralGravity ) mParticleController.pullToCenter( mCenter ); mParticleController.update(); }
void FlockingApp::update() { // UPDATE CAMERA mEye = Vec3f( 0.0f, 0.0f, mCameraDistance ); mCam.lookAt( mEye, mCenter, mUp ); gl::setMatrices( mCam ); gl::rotate( mSceneRotation ); // UPDATE PARTICLE CONTROLLER AND PARTICLES mParticleController.applyForceToParticles( mZoneRadius * mZoneRadius ); if( mCentralGravity ) mParticleController.pullToCenter( mCenter ); mParticleController.update( mFlatten ); }
void FlockingApp::update() { if( mLowerThresh > mHigherThresh ) mHigherThresh = mLowerThresh; mParticleController.applyForceToPredators( mZoneRadius, 0.4f, 0.7f ); mParticleController.applyForceToParticles( mZoneRadius, mLowerThresh, mHigherThresh, mAttractStrength, mRepelStrength, mOrientStrength ); if( mCentralGravity ) mParticleController.pullToCenter( mCenter ); mParticleController.update( mFlatten ); mEye = Vec3f( 0.0f, 0.0f, mCameraDistance ); mCam.lookAt( mEye, mCenter, mUp ); gl::setMatrices( mCam ); gl::rotate( mSceneRotation ); }
void TutorialApp::update() { if( ! mChannel ) return; if( mIsPressed ) mParticleController.addParticles( NUM_PARTICLES_TO_SPAWN, mMouseLoc, mMouseVel ); // mParticleController.repulseParticles(); if( mCentralGravity ) mParticleController.pullToCenter(); if( mAllowPerlin ) mParticleController.applyPerlin( mPerlin ); mParticleController.update( mChannel, mMouseLoc ); }
void TutorialApp::update() { // Stop repulsing for now. //mParticleController.repulseParticles(); // UPDATE CAMERA mEye = Vec3f( 0.0f, 0.0f, mCameraDistance ); mCam.lookAt( mEye, mCenter, mUp ); gl::setMatrices( mCam ); gl::rotate( mSceneRotation ); // UPDATE PARTICLE CONTROLLER mParticleController.applyForce( mZoneRadius * mZoneRadius, mThresh ); if( mCentralGravity ) mParticleController.pullToCenter( mCenter ); mParticleController.update( mFlatten ); }