| 3288 | } |
| 3289 | |
| 3290 | void 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 | |
| 3322 | void Extrude::calculate( vector<vec3> *positions, vector<vec3> *normals, vector<vec3> *texCoords, vector<uint32_t> *indices ) const |
| 3323 | { |
nothing calls this directly
no test coverage detected