impr: Split the jump flood algorithm example into two and improve the distance painting#1967
impr: Split the jump flood algorithm example into two and improve the distance painting#1967
Conversation
|
pkg.pr.new packages benchmark commit |
There was a problem hiding this comment.
Pull request overview
This PR refactors the jump flood algorithm example by splitting it into two distinct examples: one focused on Voronoi diagram generation (jump-flood-voronoi) and another on distance field visualization (jump-flood-distance). The distance field example introduces improved visualization with separate gradients for inside/outside regions and interactive drawing capabilities with right-click erasing.
Key changes:
- Split single jump flood example into two focused examples with distinct use cases
- Added interactive drawing/erasing functionality to the distance example with brush controls
- Improved distance field visualization with dual gradients and configurable display options
- Updated test infrastructure to support 256x256 canvas dimensions in mocks
Reviewed changes
Copilot reviewed 13 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/typegpu/tests/examples/utils/commonMocks.ts |
Added HTMLCanvasElement property mocks (width, height, clientWidth, clientHeight) set to 256x256 for consistent test dimensions |
packages/typegpu/tests/examples/individual/slime-mold.test.ts |
Updated coordinate calculations to center at (128, 128) with radius 118, matching new 256x256 canvas dimensions |
packages/typegpu/tests/examples/individual/jump-flood-voronoi.test.ts |
Renamed test suite and updated example name from 'jump-flood' to 'jump-flood-voronoi' |
packages/typegpu/tests/examples/individual/jump-flood-distance.test.ts |
New test file for distance field example with snapshot validation of 4 shader outputs |
packages/typegpu/src/core/root/init.ts |
Added setter for pipeline property in TgpuGuardedComputePipelineImpl |
apps/typegpu-docs/src/examples/algorithms/jump-flood/visualization.ts |
Removed old shared visualization file (functionality split into separate examples) |
apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/meta.json |
Updated title to "Jump Flood (Voronoi)" to distinguish from distance example |
apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts |
Refactored to focus on Voronoi visualization, removing distance/brush features and inlining voronoi fragment shader |
apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.html |
Added simple canvas element for Voronoi example |
apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/visualization.ts |
New file with distance field shader using separate inside/outside gradients |
apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/types.ts |
New type definitions for distance example including visualization params, brush params, and texture types |
apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/meta.json |
New metadata file for distance field example |
apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts |
New comprehensive implementation with mask-based drawing, distance field computation, and interactive controls |
apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.html |
Canvas element for distance field example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
e2e28db to
55c3ddb
Compare
doodlesdf.mov