Ejemplo n.º 1
0
void matrixP::update() {
	if(mRenderAuto) {
		framecounter++;
		if(framecounter==CYCLELIMIT) {
			typecounter++;
			mGhostGoal.x = Rand::randFloat(0.0f, getWindowWidth() - 1.0f);
			mGhostGoal.y = Rand::randFloat(0.0f, getWindowHeight() - 1.0f);
			mStepX = (mGhostGoal.x - mGhostMouse.x)/CYCLELIMIT;
			mStepY = (mGhostGoal.y - mGhostMouse.y)/CYCLELIMIT;
			framecounter = 0;
		}
		if(typecounter==4) {
			mRenderOrdered = !mRenderOrdered;
			typecounter = 1;
		}
		mRenderColor = typecounter;
		
		mGhostMouse.x += mStepX;
		mGhostMouse.y += mStepY;

		mParticleController.update(mRenderColor, mRenderOrdered, mGhostMouse);
	}
	else mParticleController.update(mRenderColor, mRenderOrdered, mMouseLoc);
	printStats();
}
Ejemplo n.º 2
0
void chapter3App::update()
{
    if (! mChannel ) return;
    
    if( mIsPressed )
        mParticleController.addParticles( 5, mMouseLoc, mMouseVel );
    
    mParticleController.update(perlin, mChannel, mMouseLoc );
}
void HellCinderApp::update()
{
    if (particleCount < maxParticles) {
        particleController.addParticles( particleIncrement );
        particleCount += particleIncrement;
    }
    
    particleController.update(channel);
}
Ejemplo n.º 4
0
void TutorialApp::update()
{
	if( ! mChannel ) return;
	
	if( mIsPressed )
		mParticleController.addParticles( NUM_PARTICLES_TO_SPAWN, mMouseLoc, mMouseVel );
	
	mParticleController.update( mPerlin, mChannel, mMouseLoc );
}
Ejemplo n.º 5
0
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();
}
Ejemplo n.º 6
0
void Box2DTestApp::update()
{
	if (mousePressed)
		particleController.addParticle(mousePos);
	particleController.update();

	// step physics world
	float32 timeStep = 1.0f / 60.0f;
	int32 velocityIterations = 6;
	int32 positionIterations = 2;
	world.Step(timeStep, velocityIterations, positionIterations);
}
Ejemplo n.º 7
0
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 );
}
Ejemplo n.º 8
0
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 );
}
Ejemplo n.º 9
0
void VideoPanApp::update()
{
	if( mMovie.checkNewFrame() ) {
		mMovieFrame = gl::Texture(mMovie.getTexture());
		if( particleCount < maxParticles ) {
			mParticleController.addParticle( gl::Texture(mMovie.getTexture()) );
			particleCount++;
			mMovie.stepForward();
		}
	} else {
		mParticleController.setWidth(mParticleWidth);
		mParticleController.setPixelOffset(mPixelOffset);
		mParticleController.update();
	}
}
Ejemplo n.º 10
0
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 );
}
Ejemplo n.º 11
0
void syphonImpApp::renderSceneToFbo()
{
	// this will restore the old framebuffer binding when we leave this function
	// on non-OpenGL ES platforms, you can just call mFbo.unbindFramebuffer() at the end of the function
	// but this will restore the "screen" FBO on OpenGL ES, and does the right thing on both platforms
	gl::SaveFramebufferBinding bindingSaver;
	
	// bind the framebuffer - now everything we draw will go there
	myFbo.bindFramebuffer();
    gl::setViewport(myFbo.getBounds() );
    gl::setMatricesWindow( myFbo.getSize(), false );
	
	// clear out the FBO with blue
	gl::clear();
   mParticleController.update();
    mParticleController.draw();
    
}
Ejemplo n.º 12
0
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 );
}
Ejemplo n.º 13
0
void RoboticaProjectApp::update()
{
    //get the latest pcm buffer from the track
	mPcmBuffer = mTrack->getPcmBuffer();
    
    if( mPcmBuffer ){
       // mPcmBuffer->getChannelData( audio::CHANNEL_FRONT_LEFT )
        fftRef = audio::calculateFft( mPcmBuffer->getChannelData( audio::CHANNEL_FRONT_LEFT ), bandCount );
        if(mAddParticle){
            particleC->addParticle(mAddPos);
            mAddParticle = false;
        }
        
        particleC->update(fftRef, bandCount, getElapsedSeconds());
    }    
        
    
    
}
Ejemplo n.º 14
0
void JtChapterOneApp::update()
{
    if( ! mChannel ) return;
    myPController.update( mChannel );
}
Ejemplo n.º 15
0
void PixarDemo2012::update()
{
    if ( mFullScreen != isFullScreen() ) {
        setFullScreen(mFullScreen);
//        mCamera->setAspectRatio(getWindowAspectRatio());
//        mySurface = cairo::SurfaceImage(getWindowWidth(),getWindowHeight(),true);
        if ( isFullScreen() == true ) {
            hideCursor();
        } else {
            showCursor();
        }
    }

    mTime += 0.01f;
    float kFudge = 0.1; // ten times our step

    if(mAutoCut && mTime > mCuts[mCurrentCut] && mTime < mCuts[mCurrentCut] + kFudge )
    {
        doFade = true;
        mCurrentCut = mCurrentCut + 1;
        if(mCurrentCut >= mCuts.size())
        {
            mCurrentCut = mCuts.size()-1;
        }

    }
    mParticleController.update();

    if ( drawTitle ) {
        theTitle.Update();
    }

    if ( drawCloth ) {
        theCloth.Update(  );
    }

    if ( drawCubes ) {
        theCubes.Update();
    }

    if ( drawMindField ) {
        theMindField.Update();
    }

    // Check if track is playing and has a PCM buffer available
    if ( mTrack->isPlaying() && mTrack->isPcmBuffering() ) {

        // Get buffer
        mBuffer = mTrack->getPcmBuffer();
        if ( mBuffer && mBuffer->getInterleavedData() ) {

            // Get sample count
            uint32_t sampleCount = mBuffer->getInterleavedData()->mSampleCount;
            if ( sampleCount > 0 ) {

                // Initialize analyzer
                if ( !mFft ) {
                    mFft = Kiss::create( sampleCount );
                }

                // Analyze data
                if ( mBuffer->getInterleavedData()->mData != 0 ) {
                    mFft->setData( mBuffer->getInterleavedData()->mData );
                }

            }

        }

    }

}
Ejemplo n.º 16
0
void TutorialApp::update()
{
	if( ! mChannel ) return;
	
	mParticleController.update( mChannel );
}
Ejemplo n.º 17
0
//------------------------------------------------------------
//--
//------------------------------------------------------------
void cdr_Snow::update()
{
    myParticles.update();
}
Ejemplo n.º 18
0
void TutorialApp::update()
{
	mParticleController.update();
}