7 Commits

Author SHA1 Message Date
luigi-rosso
5a3977f5e1 Fix: tess renderer & nuke old viewer (#9927) c2ec689eb6
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2025-06-07 01:12:12 +00:00
luigi-rosso
fa6e59865c Get rid of MetricsPath.
This lets us trim a raw path directly which means all the trim path logic from the editor can now be pushed down to the C++ runtime, even for the case where the rendering is still happening via Skia/Impeller, all our path operations can be done in C++ (without using RenderPath/MetricsPath/RenderMetricsPath/OnlyMetricsPath/etc). Basically, I needed to do this now to not have as many edge cases in the editor for the difference between using our runtime to render with PLS vs Flutter.

It also quite greatly simplifies the code! More lines removed than added!

Some tests will fail as I think we're using the MetricsPath in some other parts of the code, but that can be refactored following the patterns used here...

It also means that most of our runtime now speaks RawPath which means we can optimize/reserve memory ahead of time in a lot of cases (not doing that yet).

Diffs=
8486c3445 Get rid of MetricsPath. (#7371)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-06-07 00:44:49 +00:00
csmartdalton
9c3168ef9d clang-format updates
- Put braces on their own line
- Turn off single-line case labels

Diffs=
32e79999a clang-format updates
2022-10-03 20:23:45 +00:00
luigi-rosso
f7ac0f9ed1 "fix" broken tess test
When using the earcut triangulatation we pass through the vertex buffer straight from raw path and just use an index buffer generating by the triangulation.

Diffs=
ba0406a89 Fix tess test.
2022-08-30 18:13:28 +00:00
luigi-rosso
88797e58f6 Rive tess vector and meshes
Not sure why github sees a huge change on the catch.hpp file, locally it seems unchanged to me. That's the bulk of the linecount here, so maybe just ignore that file?

The actual important stuff:
- uses earcut and libtess2 for triangulation
- earcut benchmarks are insanely fast, but it fails on any complex path, doesn't do winding rules, etc. I have a pretty lame heuristic in there that tries to use it when we think we can get away with it
- libtess2 for anything multi-path (still need to pass winding rule down, however, that'll be in a follow up pr)
- re-added the stroker I built here: https://rive-app.github.io/stroke-exploration/
- stroker internally builds a tristrip, I convert that to triangles here so sokol can use the same pipeline for drawing the fills and strokes
- clipping with the stencil buffer by drawing clipping shapes additively and then testing on stencil buffer value == clipping shape count. makes it easy to propagate between draw calls and selectively remove clipping shapes when there are minor changes between draw calls (nice for Marty animation). Due to sokol's pipeline model, we have to build N pipelines for however many clipping shapes we want to support (I picked an arbitrary number) as we need to hardcode the stencil test value/ref.
- some obtuse blending

Demos:
https://2dimensions.slack.com/archives/CHMAP278R/p1660948586557719
https://2dimensions.slack.com/archives/CHMAP278R/p1660952553086529

Diffs=
b0d342067 Shader expects good input.
5f642c48c Undo changes to catch.hpp.
937797ace Tweaks based on PR feedback.
576a54a79 fix test
bbd4e5a8b running formatter
959f22dcb More efficient pipeline changes.
b57f553e0 Strokes and clipping working.
56cb62b64 re-adding stroking
4d6253217 Only draw fills for now.
51f383844 Fix clipping.
d52476967 Working on clipping
2f5e858bd Adding solid color to shader
5bf705b1c Rendering
28492f8dc Adding abstraction for sokol render path.
917b0d5e4 Adding triangulation for simple case.
4f3f8af21 Match master
33e81ceb8 Starting to work on triangulation
2022-08-22 23:52:40 +00:00
luigi-rosso
5506f4dd56 Run tests for rive_tess
Adds ability to run tests when building rive_tess:

```
cd packages/runtime/tess/build/macosx
./build_tess.sh test
```

Also runs them in GitHub Actions.

Diffs=
265e9c7aa Run tests for rive_tess
2022-07-19 04:37:30 +00:00
luigi-rosso
5d5f859d61 Adding rive_tess
This is the part that was split out from the other larger PR (#4020).

Diffs=
17c822472 Tabs to spaces and add comments to mat4
aa9448468 Adding rive_tess
2022-07-18 23:00:48 +00:00