7dir / aframe-svgfile-component

aframe svgfile
https://7dir.github.io/aframe-svgfile-component/
18 stars 6 forks source link

add support for lines #9

Closed morandd closed 7 years ago

morandd commented 7 years ago

Currently all paths are assumed to be closed and rendered as polygons. Would be better to check the "fill" attribute of the path and in the case that the path is not filled, it is a line, then we can use: https://github.com/andreasplesch/aframe-meshline-component

to render lines, with line thickness (since webgl doesn't support line thickness).

This component doesn't support curves. So we'd need to look for "C", "c", "A", etc, in the SVG path and if we find these, interpolate to line segments. This can be done by putting the SVG curve into a new Three.CubicBezierCurve, then using Three.Curve.getSpacedPoints to interpolate into line segments that can be fed into aframe-meshline. Alternatively, this logic could be added to meshline, so that meshline can accept "C" commands in its path instead of just linear segments (see suggestion https://github.com/andreasplesch/aframe-meshline-component/issues/8)

morandd commented 7 years ago

making good progress on this: https://github.com/morandd/aframe-svgfile-component

will send a PR in the coming days