Commit Graph

34 Commits

Author SHA1 Message Date
Patrick Walton 9c470e77c1 Make macOS font rendering not depend on FreeType 2017-10-20 12:10:57 -07:00
Patrick Walton 314185684c Implement stem darkening and split ECAA into ECAA and MCAA.
We now implement stem darkening (also known as font dilation) like
macOS and FreeType under certain configurations. This pushes out font
outlines along their normals slightly in order to make small text easier
to read. This is especially important when performing gamma correction,
as otherwise text can end up too light.

Because the stem darkening is implemented in the vertex shader, it can
easily break the mesh. Therefore, I needed to implement a new rendering
mode that does not use the mesh. It's a variant of ECAA, and for
clarity's sake I've renamed the related antialiasing methods:

* MCAA stands for "mesh coverage antialiasing" and is the new name for
what was called "ECAA" prior to this patch.

* ECAA now stands for "edge coverage antialiasing". It does not use the
mesh but rather computes winding numbers from scratch for every pixel.
Surprisingly, despite being worse asymptotically, this usually ends up
being faster than MCAA at small font sizes, presumably because there are
fewer vertices to transform.

* XCAA, "exact coverage antialiasing" is a generic term that refers to
both ECAA and MCAA. References to ECAA have been changed to XCAA as
needed.
2017-10-15 13:28:49 -07:00
Patrick Walton 2a236319d4 Use regular VBOs instead of textures to store vertex positions for ECAA.
This improves performance at small font sizes a bit by reducing vertex
shading load.
2017-10-06 16:42:51 -07:00
Patrick Walton b631fec80f Cache font mesh libraries on the server 2017-10-02 19:58:38 -07:00
Patrick Walton 092b46e056 Reenable early Z optimizations 2017-10-02 15:36:39 -07:00
Patrick Walton f3f893302a Introduce a simple file format for serializing meshes, and use it in the demo 2017-10-02 15:17:21 -07:00
Patrick Walton 475f5dca71 Introduce a new mesh library abstraction for holding meshes.
Simplifies the server code and allows avoiding copying indices all the time.

Closes #29.
2017-10-02 14:03:56 -07:00
Patrick Walton 8c6110a388 Remove the duplicated de Casteljau subdivision code in
`partitioner::geometry`
2017-10-02 11:45:34 -07:00
Patrick Walton 705274997d Remove the now-obsolete path legalizer 2017-10-02 11:40:11 -07:00
Patrick Walton 613bc7c29d Don't start subdividing active edges until we're sure an entire B-quad
will be emitted.

Otherwise it messes up the parity.

Fixes the bottom curve of the lowercase "p" in Open Sans when rendered
with Loop-Blinn.
2017-09-29 13:25:19 -07:00
Patrick Walton c37fd1f1e8 Ignore intersections beyond the sweep line.
Improves the outer stroke of the tiger.
2017-09-25 19:15:36 -07:00
Patrick Walton 93de8383f9 Replace the implicitization algorithm for curve intersection with a
simpler one based on binary search and the quadratic formula.

This does a better job avoiding floating point error and improves the
rendering of the tiger.
2017-09-25 18:51:02 -07:00
Patrick Walton 2a906569e5 Emit B-quads around both self-intersecting active edges.
Improves one of the whiskers in the tiger.
2017-09-25 12:58:42 -07:00
Patrick Walton db32009d7b Create fewer useless B-vertices 2017-09-22 19:15:58 -07:00
Patrick Walton 2039051f01 Remove bogus fast path that tried to avoid active edge order calculation.
It was causing us to miss a bunch of crossings in the tiger whiskers.
2017-09-22 13:42:20 -07:00
Patrick Walton be1b100826 Split B-quads whose curves' convex hulls intersect in most cases.
Avoids some rendering artefacts with Loop-Blinn, improving the tiger.
2017-09-21 22:47:00 -07:00
Patrick Walton a126e1248e Don't structure fills around the even-odd rule.
Improves self-intersecting paths under the winding rule.
2017-09-21 14:54:04 -07:00
Patrick Walton 4ac11e9010 Switch to a more robust intersection algorithm based on implicitization 2017-09-20 21:23:56 -07:00
Patrick Walton b732878532 Encapsulate the file picker code into a view class.
This will allow the mesh debugger to use it.
2017-09-20 11:51:20 -07:00
Patrick Walton 72d9ad7de0 Handle path self intersection 2017-09-19 11:43:39 -07:00
Patrick Walton d644f1b6a6 Implement curve-curve and curve-line intersection, untested as of yet 2017-09-18 21:00:34 -07:00
Patrick Walton dbd83d17ef Implement the winding fill rule for real 2017-09-18 15:34:36 -07:00
Patrick Walton e5f9b56a1d Implement the winding fill rule 2017-09-18 14:19:28 -07:00
Patrick Walton a7d75f913c Split paths into monotonic segments before partitioning them in the demo 2017-09-12 09:35:57 -07:00
Patrick Walton 3e5b53f13c Partially refactor the path APIs to be streaming, like Lyon 2017-09-08 13:09:00 -07:00
Patrick Walton 444e7bbf96 Use the Citardauq Formula in the partitioner as well as the shader to avoid precision problems.
Addresses the issue with the Nimbus Sans "o" mentioned in #24.
2017-09-01 23:45:51 -07:00
Patrick Walton 52afa359b4 Render a line of text using the atlas 2017-08-22 18:25:32 -07:00
Patrick Walton 93277c7c11 Allow multiple glyphs to be rendered simultaneously 2017-08-19 16:34:02 -07:00
Patrick Walton ec78a632dc Split path IDs and Loop-Blinn data into separate VBOs 2017-08-17 12:47:50 -07:00
Patrick Walton 5f89f7ba50 Fix compile errors in shaders 2017-08-13 13:39:51 -07:00
Patrick Walton 57ebbf8281 Split out B-vertex positions and info so that they're easier to pack into textures 2017-08-11 15:56:07 -07:00
Patrick Walton 3fcd4d472b Shuffle `BQuad` fields around for better alignment in GLSL 2017-08-10 17:47:46 -07:00
Patrick Walton 0ad2f9abfe Initial implementation of the Rocket-based demo server 2017-08-10 15:26:27 -07:00
Patrick Walton 95b356435e Rename `partitionfinder` to `partitioner` and remove the old tessellator 2017-08-08 11:32:51 -07:00