Last active
July 26, 2018 15:12
-
-
Save vvzen/7e131529fc94ba1877db35c76d628ccc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| //////////////////////////////////////// | |
| // MESH EXPORT | |
| // original code by Lior Ben Gai (http://soogbet.net/i/) | |
| ////////////////////////////////////// | |
| // This uses the OBJExport library: | |
| // https://n-e-r-v-o-u-s.com/tools/obj/ | |
| public void exportMesh(String fileName){ | |
| // export an obj file, change to X3DExport for x3d | |
| MeshExport output = (MeshExport) createGraphics(10, 10, "nervoussystem.obj.OBJExport", fileName + ".obj"); | |
| output.beginDraw(); | |
| // this methods uses a PGraphics object as parameter, see below | |
| this.draw(output); | |
| output.endDraw(); | |
| output.dispose(); | |
| println(fileName + " Export complete."); | |
| } | |
| // THE DRAW METHOD IS LIKE THAT: | |
| // (draws all vertices using LINE_STRIP to a provided PGraphics object) | |
| public void draw(PGraphics pg){ | |
| pushTransform(pg); | |
| //draw all vertices | |
| pg.beginShape(POINTS); | |
| for (int i = 0; i < vertices.size();i++){ | |
| PVector p = vertices.get(i).position; | |
| pg.vertex(p.x, p.y, p.z); | |
| } | |
| pg.endShape(); | |
| popTransform(pg); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment