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

Method makeGeom

samples/Extrude/src/ExtrudeApp.cpp:90–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void 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
118void ExtrudeApp::resize()
119{

Callers

nothing calls this directly

Calls 10

ColorFromAttribFunction · 0.85
getGlyphShapeMethod · 0.80
getGlyphCharMethod · 0.80
colorMethod · 0.80
translateFunction · 0.50
createFunction · 0.50
ShaderDefClass · 0.50
BSplineClass · 0.50
transformMethod · 0.45

Tested by

no test coverage detected