wwwtyro / candygraph

Fast by default, flexible 2D plotting library.
Other
435 stars 11 forks source link

TransparentLineStrip Primitive #44

Closed wwwtyro closed 2 years ago

wwwtyro commented 2 years ago

The primary purpose of this PR is to introduce the TransparentLineStrip primitive. The existing LineStrip primitive has alpha overlap artifacts that make it unsuitable for rendering with transparency. TransparentLineStrip solves this at the cost of some efficiency (6x the number of draw calls) and flexibility (color and width are constant across the line strip, instead of per-vertex).

A backwards incompatible change was required to implement this primitive: multiple DrawCommands are needed to render the TransparentLineStrip, so the Primitive.command function was updated to return multiple named DrawCommands in a Record<string, DrawCommand>. See the change log for more details.

This PR also introduces the OpaqueLineStrip primitive, which is identical to the existing LineStrip primitive, but with the alpha channel of the colors parameter disabled. A warning that LineStrip is deprecated is now printed to the console when it is instantiated.

Another incompatible change was made in this PR: renaming Grid.info to Grid.computed.

Several backwards-compatible changes were made as well: