MCPcopy Create free account
hub / github.com/cinder/Cinder / reConfigIslandGroup

Method reConfigIslandGroup

samples/FallingGears/src/SceneController.cpp:307–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307void SceneController::reConfigIslandGroup( IslandContainerT &islandGroup, float yOffset )
308{
309 CI_ASSERT( islandGroup.size() == 4 );
310
311 const size_t pitchMax = FUNDAMENTAL_MAX + 11;
312
313 size_t f0 = calcNextFundamental();
314 CI_LOG_V( "f0: " << f0 );
315
316 bool isMinor = randBool();
317
318 islandGroup[0]->mFreqMidi = f0;
319 islandGroup[1]->mFreqMidi = f0 + ( isMinor ? 3 : 4 );;
320 islandGroup[2]->mFreqMidi = f0 + 7;
321 islandGroup[3]->mFreqMidi = f0 + ( isMinor ? 10 : 11 );
322
323 float islandY = yOffset + pointsToMeters( app::getWindowHeight() + FUNNEL_MAX_HEIGHT + 200 );
324
325 for( auto &island : islandGroup ) {
326 float x = lmap<float>( island->mFreqMidi, FUNDAMENTAL_MIN, pitchMax, 0, app::getWindowWidth() );
327 float perYOffset = pointsToMeters( randFloat( - mParams.mYOffsetVariance, mParams.mYOffsetVariance ) );
328 island->setPosition( vec2( pointsToMeters( x ), islandY + perYOffset ) );
329 }
330}
331
332// generates fundamental pitches that are contionusly decending in fifths, wraps if below FUNDAMENTAL_MIN
333// note: we're going over the max here, but that's ok, it is only used to layout how far over right side of islands should sit.

Callers

nothing calls this directly

Calls 7

randBoolFunction · 0.85
pointsToMetersFunction · 0.85
getWindowHeightFunction · 0.85
getWindowWidthFunction · 0.85
randFloatFunction · 0.85
sizeMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected