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

Method updatePathSubdivision

src/cinder/GeomIo.cpp:3290–3320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3288}
3289
3290void Extrude::updatePathSubdivision()
3291{
3292 mPathSubdivisionPositions.clear();
3293 mPathSubdivisionTangents.clear();
3294
3295 // necessary for texcoord calculation
3296 bool capBoundsEmpty = true;
3297
3298 // iterate all the paths of the shape and subdivide, calculating both positions and tangents
3299 for( const auto &path : mPaths ) {
3300 if( capBoundsEmpty ) {
3301 mCapBounds = path.calcPreciseBoundingBox();
3302 capBoundsEmpty = false;
3303 }
3304 else
3305 mCapBounds.include( path.calcPreciseBoundingBox() );
3306 mPathSubdivisionPositions.emplace_back( vector<vec2>() );
3307 mPathSubdivisionTangents.emplace_back( vector<vec2>() );
3308 path.subdivide( &mPathSubdivisionPositions.back(), &mPathSubdivisionTangents.back(), mApproximationScale );
3309 // normalize the tangents
3310 for( auto &tan : mPathSubdivisionTangents.back() )
3311 tan = normalize( tan );
3312 }
3313
3314 // Each of the subdivided paths' positions constitute a new contour on our triangulation
3315 Triangulator triangulator;
3316 for( const auto &subdivision : mPathSubdivisionPositions )
3317 triangulator.addPolyLine( subdivision );
3318
3319 mCap = triangulator.createMesh();
3320}
3321
3322void Extrude::calculate( vector<vec3> *positions, vector<vec3> *normals, vector<vec3> *texCoords, vector<uint32_t> *indices ) const
3323{

Callers

nothing calls this directly

Calls 14

uniqueFunction · 0.85
lengthFunction · 0.85
backMethod · 0.80
addPolyLineMethod · 0.80
createMeshMethod · 0.80
normalizeFunction · 0.50
clearMethod · 0.45
includeMethod · 0.45
subdivideMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected