| 16 | using namespace std; |
| 17 | |
| 18 | Quake::Quake( float aLat, float aLong, float aMag, const string &aTitle ) |
| 19 | { |
| 20 | mLat = aLat; |
| 21 | mLong = aLong; |
| 22 | mMag = aMag; |
| 23 | mTitle = aTitle; |
| 24 | |
| 25 | std::string magnitudeStr = toString( mMag ); |
| 26 | |
| 27 | TextLayout layout; |
| 28 | |
| 29 | if( mMag > 5.5 ) { |
| 30 | layout.setFont( Font( "HelveticaNeue-Bold", mMag * mMag + 26.0f ) ); |
| 31 | layout.setColor( Color( 1, 0, 0 ) ); |
| 32 | } |
| 33 | else { |
| 34 | layout.setFont( Font( "HelveticaNeue-Bold", mMag * mMag + 10.0f ) ); |
| 35 | layout.setColor( Color( 1, 1, 1 ) ); |
| 36 | } |
| 37 | layout.addCenteredLine( magnitudeStr ); |
| 38 | |
| 39 | if( mMag > 5.5 ) { |
| 40 | layout.setLeadingOffset( -10 ); |
| 41 | layout.setFont( Font( "HelveticaNeue", mMag + 16 ) ); |
| 42 | layout.setColor( Color( 1, 1, 1 ) ); |
| 43 | layout.addCenteredLine( mTitle ); |
| 44 | } |
| 45 | |
| 46 | mLabel = gl::Texture2d::create( layout.render( true ) ); |
| 47 | |
| 48 | float theta = glm::radians( 90 - mLat ); |
| 49 | float phi = glm::radians( 180 + mLong ); |
| 50 | |
| 51 | mLoc = vec3( sin( theta ) * sin( phi ), cos( theta ), sin( theta ) * cos( phi ) ); |
| 52 | } |
| 53 | |
| 54 | std::string Quake::toString( float f, uint8_t precision ) |
| 55 | { |
nothing calls this directly
no test coverage detected