-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shapes #89
Merged
Merged
Shapes #89
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #80
adds basic support for shapes. A shape is a path that gets extruded. You can use svg to define the path. It uses https://github.com/pocketsvg/PocketSVG under the hood.
Also adds scale property for every geometry.
E.g:
not every svg spec is supported. Paths like above work best. Basic elements like circle and rectangle should work as well. If there are multiple paths in the svg, they get concatinated.
If the svg does not render properly, try to use https://jakearchibald.github.io/svgomg/ to simplify the svg. Als try experimenting with the Precision in svgom. Setting it too low might also cause some paths to not show up.
Most svg are in pixel coordinates, so they will render very large on arkit (arkit 1 unit = 1 meter). Use the new scale-property to scale it down. Don't try to scale down the sizes in the svg, because there is a lower limit for how precise the svg will get rendered. Also experiment with different float values for
pathFlatness
(defaults to 0.6). See also this comment: https://stackoverflow.com/questions/28597275/how-to-set-the-level-of-detail-smoothness-subdivision-rate-for-scnshape#comment76976130_28600934Additionally, you can specify chamferRadius and chamferProfileSvgPath. chamferProfileSvgPath takes a svg which should describe a path from [1,0] to [0, 1]. It will be scaled to 1 if its larger or smaller than this. See the chamferProfileSvgPath in action in the image below.
TODO:
I could need some advice on the last point. I did not want to add https://github.com/pocketsvg/PocketSVG through cocoapods, because i don't know how that works properly on a library project that might get used without cocoapods. Instead i added it to package.json as a "fake package":
"_PocketSVG": "https://github.com/pocketsvg/PocketSVG"
this will download the package into node_modules on install and can be added as library project. However adding it needs some additional step and i managed to get it work, but i am unsure what's the best practise.
NEW: with chamferProfile: