-
Notifications
You must be signed in to change notification settings - Fork 110
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
Basic GPU stroke rendering with support for caps and joins #408
Commits on Nov 8, 2023
-
Shitty offset curves for GPU stroke scaffolding
Implemented a stroking scheme in the flatten stage in which every flattened line segment gets offset along the curve normal by the line width. The line vertices are offset _after_ subdivision and does not try to accurately estimate subdivisions for the offset curve. Cusps are not detected and are prone to failure. Regions with high curvature (especially around self-intersections) are handled by simply boosting the subdivision count using the curve offset which is not correct but avoids awfully missing samples when the tolerance is set too low. This is intended as a placeholder but is the first step towards implementing correct strokes without optimizing for performance.
Configuration menu - View commit details
-
Copy full SHA for e2f63bd - Browse repository at this point
Copy the full SHA e2f63bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for f72a066 - Browse repository at this point
Copy the full SHA f72a066View commit details -
[encoding] Implement stroke cap marker segment encoding
- Implemented the stroke cap marker segment encoding scheme outlined in #303. The proposed scheme has been slightly modified such that instead of an open/closed bit, the segment is encoded as a lineto or quadto to distinguish between the different states. Encoding the marker segment as a quad to for open segments also handles a limitation with only using linetos: for an open path, the marker must encode both the start tangent and the coordinates of the first control point to correctly position a start cap. Encoding these as 4 f32s requires an implicit moveto before the lineto which must terminate the preceding subpath. Encoding this as a quadto preserves the invariant that every stroked subpath only contains one segment with the SUBPATH_END_BIT set to 1, which now serves as the stroke cap marker. For a closed path, a lineto is sufficient since the preceding coordinate (from the lineto encoded for a "closepath" verb) must already equal the subpath's first control point. - Shitty stroking continues to work by detecting and ignoring the stroke cap marker.
Configuration menu - View commit details
-
Copy full SHA for 08fc286 - Browse repository at this point
Copy the full SHA 08fc286View commit details -
Update caps and joins to use the new stroke cap marker encoding
The flatten stage now makes use of the stroke cap marker encoding scheme to draw caps and joins at the right locations. At this stage only the butt cap and bevel join styles are supported.
Configuration menu - View commit details
-
Copy full SHA for 73dd128 - Browse repository at this point
Copy the full SHA 73dd128View commit details -
[encoding] Eliminate zero-length start segments
Make sure that a path start segment has a tangent that has a non-zero length.
Configuration menu - View commit details
-
Copy full SHA for 13810b8 - Browse repository at this point
Copy the full SHA 13810b8View commit details -
- Add versions of the cubics without co-incident start and end points - Reposition the closed paths so they fit within the view
Configuration menu - View commit details
-
Copy full SHA for deba7c8 - Browse repository at this point
Copy the full SHA deba7c8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 83359c5 - Browse repository at this point
Copy the full SHA 83359c5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f5a93d - Browse repository at this point
Copy the full SHA 1f5a93dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 24681fa - Browse repository at this point
Copy the full SHA 24681faView commit details
Commits on Nov 10, 2023
-
[flatten] Settle on a consistent vector normalization scheme
Make it so that tangent vectors are NOT normalized and normals are normalized. Vector helpers that derive normals from tangents now always return normalized vectors. This keeps things internally consistent.
Configuration menu - View commit details
-
Copy full SHA for 3df413a - Browse repository at this point
Copy the full SHA 3df413aView commit details
Commits on Nov 13, 2023
-
Configuration menu - View commit details
-
Copy full SHA for eded0a1 - Browse repository at this point
Copy the full SHA eded0a1View commit details -
Style and comment fixes in the WGSL
* Fix the phrasing in a comment regarding subdivision count * Use the vec4f and vec2f predeclared aliases for vec4<f32> and vec2<f32> in `flatten`. I've been consistent with this style for new code in this shader and I may make the other shaders use the alises in a follow up since it's more concise.
Configuration menu - View commit details
-
Copy full SHA for 7a122b6 - Browse repository at this point
Copy the full SHA 7a122b6View commit details