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

Method Quake

samples/Earthquake/src/Quake.cpp:18–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16using namespace std;
17
18Quake::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
54std::string Quake::toString( float f, uint8_t precision )
55{

Callers

nothing calls this directly

Calls 11

sinFunction · 0.85
cosFunction · 0.85
addCenteredLineMethod · 0.80
setLeadingOffsetMethod · 0.80
toStringFunction · 0.50
FontFunction · 0.50
ColorFunction · 0.50
createFunction · 0.50
setFontMethod · 0.45
setColorMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected