Skip to content

impr: Split the jump flood algorithm example into two and improve the distance painting#1967

Merged
reczkok merged 5 commits intomainfrom
docs/better-jump-flood
Dec 12, 2025
Merged

impr: Split the jump flood algorithm example into two and improve the distance painting#1967
reczkok merged 5 commits intomainfrom
docs/better-jump-flood

Conversation

@reczkok
Copy link
Contributor

@reczkok reczkok commented Dec 10, 2025

doodlesdf.mov

@github-actions
Copy link

github-actions bot commented Dec 10, 2025

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@0dae74874bf6f44d6e73f81c31262c7e7f2cd925
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@0dae74874bf6f44d6e73f81c31262c7e7f2cd925
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@0dae74874bf6f44d6e73f81c31262c7e7f2cd925

benchmark
view benchmark

commit
view commit

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@reczkok reczkok force-pushed the docs/better-jump-flood branch from e2e28db to 55c3ddb Compare December 11, 2025 11:22
@reczkok reczkok marked this pull request as ready for review December 11, 2025 11:23
Copy link
Collaborator

@iwoplaza iwoplaza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💜

Copy link
Contributor

@aleksanderkatan aleksanderkatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@reczkok reczkok merged commit 118e8b1 into main Dec 12, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants