Commit graph

6 commits

Author SHA1 Message Date
c-u
3c9f7c4eb1
Add Interpolation attribute for the VertexOutput and add Error trait implementation for RenderError (#49)
* impl trait Error for RenderError

* fix shader for usage in web
2023-08-06 13:07:42 -02:30
Héctor Ramón Jiménez
f64771c2c3 Grow internal packer and re-upload glyphs automatically 2023-07-04 14:54:05 -02:30
Héctor Ramón Jiménez
a74ce29c1a Implement growing logic for TextAtlas
The `TextAtlas` will have an initial size of `256` (we could make this
configurable) and `try_allocate` will keep track of the glyphs in use
in the current frame, returning `None` when the LRU glyph is in use.

In that case, `TextRenderer::prepare` will return
`PrepareError::AtlasFull` with the `ContentType` of the atlas that is
full. The user of the library can then call `TextAtlas::grow` with the
provided `ContentType` to obtain a bigger atlas (by `256`).

A `TextAtlas::grow` call clears the whole atlas and, as a result, all of
the `prepare` calls need to be repeated in a frame until they all
succeed. Overall, the atlas will rarely need to grow and so the calls
will not need to be repated often.

Finally, the user needs to call `TextAtlas::trim` at the end of the
frame. This allows us to clear the glyphs in use collection in the atlas. Maybe
there is a better way to model this in an API that forces the user to
trim the atlas (e.g. make `trim` return a new type and changing `prepare` and `render` to take that type instead).
2023-07-04 14:54:05 -02:30
grovesNL
296c99f059 Add documentation to all public types
Fixes #11
2022-10-18 13:25:24 -02:30
grovesNL
7e2983374e Reword error messages 2022-10-18 13:04:06 -02:30
Andrew Wheeler(Genusis)
4075536745 Merge #19 2022-10-18 12:52:00 -02:30