| 88 | } |
| 89 | |
| 90 | void ExtrudeApp::makeGeom() |
| 91 | { |
| 92 | // get the shape for this character |
| 93 | Shape2d shape = mFont.getGlyphShape( mFont.getGlyphChar( mCurrentChar ) ); |
| 94 | auto bounds = shape.calcPreciseBoundingBox(); |
| 95 | shape.transform( glm::translate( mat3(), -bounds.getCenter() ) ); |
| 96 | |
| 97 | // this remaps the TEX_COORD_0s to color; it has to be so explicit because VC++ balks about ambiguous calls |
| 98 | std::function<Colorf(vec3)> texCoordToColor = []( vec3 v ) ->Colorf { return Colorf( v.x, v.y, v.z ); }; |
| 99 | |
| 100 | if( mUseSpline ) { |
| 101 | auto extrudeSource = geom::ExtrudeSpline( shape, mSpline, mSubdivisions, mApproximation ).caps( mCaps ); |
| 102 | mBatch = gl::Batch::create( extrudeSource >> geom::ColorFromAttrib( geom::TEX_COORD_0, |
| 103 | texCoordToColor ), mGlsl ); |
| 104 | |
| 105 | mNormalsBatch = gl::Batch::create( extrudeSource >> geom::VertexNormalLines( 3.0f ), gl::getStockShader( gl::ShaderDef().color() ) ); |
| 106 | mSplineBatch = gl::Batch::create( geom::BSpline( mSpline, 100 ), gl::getStockShader( gl::ShaderDef().color() ) ); |
| 107 | } |
| 108 | else { |
| 109 | auto extrudeSource = geom::Extrude( shape, mDepth, mApproximation ).caps( mCaps ).subdivisions( mSubdivisions ); |
| 110 | // this remaps the TEX_COORD_0s to color |
| 111 | mBatch = gl::Batch::create( extrudeSource >> geom::ColorFromAttrib( geom::TEX_COORD_0, |
| 112 | texCoordToColor ), mGlsl ); |
| 113 | |
| 114 | mNormalsBatch = gl::Batch::create( extrudeSource >> geom::VertexNormalLines( 3.0f ), gl::getStockShader( gl::ShaderDef().color() ) ); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | void ExtrudeApp::resize() |
| 119 | { |
nothing calls this directly
no test coverage detected