Created
August 1, 2014 21:53
-
-
Save larsberg/4b80d84e81562b6024ee to your computer and use it in GitHub Desktop.
OF svg to ofMesh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void addSvgToMesh(string dir, ofMesh& m) | |
{ | |
ofxSVG svg; | |
svg.load(dir); | |
for ( auto i=0; i<svg.getNumPath(); i++ ) | |
{ | |
auto& path = svg.getPathAt(i); | |
path.simplify(); | |
auto pm = path.getTessellation(); | |
if(pm.getIndices().size()) | |
{ | |
auto& v = pm.getVertices(); | |
for(auto& i: pm.getIndices()) m.addVertex(v[i]); | |
} | |
else | |
{ | |
for(auto& v: pm.getVertices()) m.addVertex(v); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment