Permalink
Browse files

Updating tour for minor changes, incorporating fs::path and removing …

…implicit Vec3f -> float*
  • Loading branch information...
1 parent c11294a commit b1cfc518136d4f51b51ca3ec3758a4431acafa0e @andrewfb andrewfb committed May 12, 2012
@@ -123,7 +123,7 @@ void TutorialApp::draw()
}
if( mSaveFrames ){
- writeImage( getHomeDirectory() + "image_" + toString( getElapsedFrames() ) + ".png", copyWindowSurface() );
+ writeImage( getHomeDirectory() / ("image_" + toString( getElapsedFrames() ) + ".png"), copyWindowSurface() );
}
}
@@ -147,7 +147,7 @@ void TutorialApp::draw()
}
if( mSaveFrames ){
- writeImage( getHomeDirectory() + "image_" + toString( getElapsedFrames() ) + ".png", copyWindowSurface() );
+ writeImage( getHomeDirectory() / ( "image_" + toString( getElapsedFrames() ) + ".png" ), copyWindowSurface() );
}
}
@@ -75,9 +75,9 @@ void Particle::draw()
void Particle::drawTail()
{
gl::color( ColorA( 1.0f, 1.0f, 1.0f, 1.0f ) );
- glVertex3fv( mPos );
+ gl::vertex( mPos );
gl::color( ColorA( 1.0f, 0.0f, 0.0f, 1.0f ) );
- glVertex3fv( mTailPos );
+ gl::vertex( mTailPos );
}
@@ -76,10 +76,7 @@ void Particle::draw()
void Particle::drawTail()
{
gl::color( ColorA( 1.0f, 1.0f, 1.0f, 1.0f ) );
- glVertex3fv( mPos );
+ gl::vertex( mPos );
gl::color( ColorA( 1.0f, 0.0f, 0.0f, 1.0f ) );
- glVertex3fv( mTailPos );
+ gl::vertex( mTailPos );
}
-
-
-
@@ -125,7 +125,7 @@ void FlockingApp::draw()
mParticleController.draw();
if( mSaveFrames ){
- writeImage( getHomeDirectory() + "flocking/image_" + toString( getElapsedFrames() ) + ".png", copyWindowSurface() );
+ writeImage( getHomeDirectory() / "flocking" / ("image_" + toString( getElapsedFrames() ) + ".png"), copyWindowSurface() );
}
// DRAW PARAMS WINDOW
@@ -95,9 +95,9 @@ void Particle::draw()
void Particle::drawTail()
{
gl::color( ColorA( 1.0f, 1.0f, 1.0f, 1.0f ) );
- glVertex3fv( mPos );
+ gl::vertex( mPos );
gl::color( ColorA( 1.0f, 0.0f, 0.0f, 1.0f ) );
- glVertex3fv( mTailPos );
+ gl::vertex( mTailPos );
}
void Particle::addNeighborPos( Vec3f pos )
@@ -36,15 +36,15 @@ void ParticleController::applyForce( float zoneRadius, float lowerThresh, float
} else if( percent < higherThresh ){ // Alignment
float threshDelta = higherThresh - lowerThresh;
float adjustedPercent = ( percent - lowerThresh )/threshDelta;
- float F = ( 1.0 - ( cos( adjustedPercent * twoPI ) * -0.5f + 0.5f ) ) * alignStrength;
+ float F = ( 1.0f - ( cos( adjustedPercent * twoPI ) * -0.5f + 0.5f ) ) * alignStrength;
p1->mAcc += p2->mVelNormal * F;
p2->mAcc += p1->mVelNormal * F;
} else { // Cohesion
float threshDelta = 1.0f - higherThresh;
float adjustedPercent = ( percent - higherThresh )/threshDelta;
- float F = ( 1.0 - ( cos( adjustedPercent * twoPI ) * -0.5f + 0.5f ) ) * attractStrength;
+ float F = ( 1.0f - ( cos( adjustedPercent * twoPI ) * -0.5f + 0.5f ) ) * attractStrength;
dir.normalize();
dir *= F;
@@ -127,7 +127,7 @@ void FlockingApp::draw()
mParticleController.draw();
if( mSaveFrames ){
- writeImage( getHomeDirectory() + "flocking/image_" + toString( getElapsedFrames() ) + ".png", copyWindowSurface() );
+ writeImage( getHomeDirectory() / "flocking" / ("image_" + toString( getElapsedFrames() ) + ".png"), copyWindowSurface() );
}
// DRAW PARAMS WINDOW
@@ -108,9 +108,9 @@ void Particle::draw()
void Particle::drawTail()
{
glColor4f( mColor );
- glVertex3fv( mPos );
+ gl::vertex( mPos );
glColor4f( ColorA( mColor.r, mColor.g, mColor.b, 0.01f ) );
- glVertex3fv( mTailPos );
+ gl::vertex( mTailPos );
}
void Particle::addNeighborPos( Vec3f pos )
@@ -40,15 +40,15 @@ void ParticleController::applyForceToParticles( float zoneRadius, float lowerThr
} else if( per < higherThresh ){ // Alignment
float threshDelta = higherThresh - lowerThresh;
float adjPer = ( per - lowerThresh )/threshDelta;
- float F = ( 1.0 - ( cos( adjPer * twoPI ) * -0.5f + 0.5f ) ) * alignStrength;
+ float F = ( 1.0f - ( cos( adjPer * twoPI ) * -0.5f + 0.5f ) ) * alignStrength;
p1->mAcc += p2->mVelNormal * F;
p2->mAcc += p1->mVelNormal * F;
} else { // Cohesion (prep)
float threshDelta = 1.0f - higherThresh;
float adjPer = ( per - higherThresh )/threshDelta;
- float F = ( 1.0 - ( cos( adjPer * twoPI ) * -0.5f + 0.5f ) ) * attractStrength;
+ float F = ( 1.0f - ( cos( adjPer * twoPI ) * -0.5f + 0.5f ) ) * attractStrength;
dir.normalize();
dir *= F;
@@ -134,7 +134,7 @@ void ParticleController::applyForceToPredators( float zoneRadius, float lowerThr
} else { // Cohesion
float threshDelta = 1.0f - higherThresh;
float adjPer = ( per - higherThresh )/threshDelta;
- float F = ( 1.0 - ( cos( adjPer * twoPI ) * -0.5f + 0.5f ) ) * 0.1f;
+ float F = ( 1.0f - ( cos( adjPer * twoPI ) * -0.5f + 0.5f ) ) * 0.1f;
dir.normalize();
dir *= F;
@@ -105,11 +105,10 @@ void Predator::draw()
void Predator::drawTail()
{
- glVertex3fv( mPos[0] );
- glVertex3fv( mPos[1] );
+ gl::vertex( mPos[0] );
+ gl::vertex( mPos[1] );
}
-
void Predator::addNeighborPos( Vec3f pos )
{
mNeighborPos += pos;

0 comments on commit b1cfc51

Please sign in to comment.