Skip to content

docs: Add "Fire Text" example and control sections - #2776

Open
vende11s wants to merge 2 commits into
mainfrom
docs/fire-text-example
Open

docs: Add "Fire Text" example and control sections#2776
vende11s wants to merge 2 commits into
mainfrom
docs/fire-text-example

Conversation

@vende11s

Copy link
Copy Markdown
Collaborator
  • Add section() support to example controls so panels can group related parameters
  • Add the Fire Text simulation example
image

Michal and others added 2 commits July 31, 2026 14:37
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 31, 2026 12:47
@github-actions

Copy link
Copy Markdown

pkg.pr.new

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

https://pkg.pr.new/software-mansion/TypeGPU/eslint-plugin-typegpu@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/color@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/radiance-cascades@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/sdf@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/three@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@c50f2fafdb9b0181e15cfcd7fbd08bab9541c11d

benchmark
view benchmark

commit
view commit

@github-actions

Copy link
Copy Markdown

Resolution Time Benchmark

---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.76, 1.48, 3.12, 4.66, 5.51, 8.76, 16.04, 17.21]
  line [0.67, 1.33, 3.12, 4.82, 5.52, 9.07, 16.66, 17.47]
  line [0.73, 1.52, 3.19, 5.02, 5.59, 8.85, 16.89, 18.63]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.21, 0.43, 0.53, 0.66, 0.87, 1.01, 1.19, 1.28]
  line [0.25, 0.43, 0.48, 0.58, 0.80, 0.83, 1.04, 1.08]
  line [0.22, 0.48, 0.56, 0.66, 0.92, 0.97, 1.20, 1.27]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.72, 1.89, 3.04, 5.27, 9.56, 20.53, 41.53, 85.95]
  line [0.66, 1.82, 3.40, 5.25, 9.90, 19.29, 42.43, 83.65]
  line [0.91, 1.70, 3.33, 5.25, 9.86, 20.83, 43.87, 88.47]
Loading

@github-actions

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 Decreased ➖ Unchanged 🔴 Increased ❔ Unknown
0 322 0 0

import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):

Test tsdown
tgpu_init.ts 260.04 kB ($${\color{green}-3.2\%}$$)
tgpu_initFromDevice.ts 259.51 kB ($${\color{green}-3.4\%}$$)
tgpu_resolve.ts 165.41 kB ($${\color{green}-38.4\%}$$)
tgpu_resolveWithContext.ts 165.35 kB ($${\color{green}-38.4\%}$$)
tgpu_bindGroupLayout.ts 69.27 kB ($${\color{green}-74.2\%}$$)
tgpu_mutableAccessor.ts 66.27 kB ($${\color{green}-75.3\%}$$)
tgpu_accessor.ts 66.26 kB ($${\color{green}-75.3\%}$$)
tgpu_privateVar.ts 65.61 kB ($${\color{green}-75.6\%}$$)
tgpu_workgroupVar.ts 65.60 kB ($${\color{green}-75.6\%}$$)
tgpu_const.ts 64.85 kB ($${\color{green}-75.9\%}$$)
tgpu_fn.ts 38.45 kB ($${\color{green}-85.7\%}$$)
tgpu_fragmentFn.ts 38.45 kB ($${\color{green}-85.7\%}$$)
tgpu_vertexFn.ts 38.27 kB ($${\color{green}-85.8\%}$$)
tgpu_computeFn.ts 37.97 kB ($${\color{green}-85.9\%}$$)
tgpu_vertexLayout.ts 27.08 kB ($${\color{green}-89.9\%}$$)
tgpu_comptime.ts 14.77 kB ($${\color{green}-94.5\%}$$)
tgpu_unroll.ts 1.66 kB ($${\color{green}-99.4\%}$$)
tgpu_slot.ts 1.54 kB ($${\color{green}-99.4\%}$$)
tgpu_lazy.ts 1.19 kB ($${\color{green}-99.6\%}$$)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — new section() abstraction for grouping example controls, and the Fire Text simulation example.

  • section() control grouping: defineControls.ts gains a section() factory; flattenControls.ts (new) flattens nested sections into a linear list consumed by both the React control panel (ControlPanel.tsx) and the standalone StackBlitz runner (stackBlitzIndex.ts). The existing exampleRunner.ts and exampleControlAtom.ts were updated to match.
  • stackBlitzIndex.ts refactor: control rendering was rewritten to use flattenControls instead of inline iteration; gained scroll support for tall panels.
  • Fire Text example: full GPU fluid simulation (advection, Jacobi pressure, vorticity/thermal confinement) with text masking via Canvas 2D, particle spawns, keyboard input, and organized control sections.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

Copilot AI left a comment

Copy link
Copy Markdown

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 enhances the docs example-control system to support grouped control sections, and adds a new “Fire Text” simulation example demonstrating interactive fluid/fire + text masking.

Changes:

  • Add section() / ControlSection support and flattening logic so controls can be grouped under headers.
  • Update the docs control panel and StackBlitz runner to render section headers and use the shared flatten/initialize utilities.
  • Add the new simulation/fire-text example (GPU fluid + text mask + particles) and its metadata.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/typegpu-docs/src/utils/examples/exampleRunner.ts Switches example control collection/initialization to shared flatten/initialize helpers.
apps/typegpu-docs/src/utils/examples/exampleControlAtom.ts Extends control param union with a section/header param shape.
apps/typegpu-docs/src/examples/common/defineControls.ts Introduces section() and allows nested control trees.
apps/typegpu-docs/src/examples/common/flattenControls.ts New shared utility to flatten sectioned controls + eager initialization.
apps/typegpu-docs/src/components/ControlPanel.tsx Renders section headers in the main docs control panel.
apps/typegpu-docs/src/components/stackblitz/stackBlitzIndex.ts Updates StackBlitz control UI to render sections and use flatten/initialize.
apps/typegpu-docs/src/components/stackblitz/openInStackBlitz.ts Adjusts StackBlitz index preprocessing to account for the new flattenControls import path.
apps/typegpu-docs/src/examples/simulation/fire-text/config.ts Adds configuration struct/defaults for the Fire Text simulation.
apps/typegpu-docs/src/examples/simulation/fire-text/fluid.ts Implements the fluid simulation pipelines + bind groups.
apps/typegpu-docs/src/examples/simulation/fire-text/emitter.ts Adds a brush/source stamping compute pipeline.
apps/typegpu-docs/src/examples/simulation/fire-text/particles.ts Implements particle update + render pipelines with text occlusion.
apps/typegpu-docs/src/examples/simulation/fire-text/render.ts Adds render pipelines for fire/density/velocity visualization.
apps/typegpu-docs/src/examples/simulation/fire-text/text.ts Implements the canvas-driven text mask uploader + typing behavior.
apps/typegpu-docs/src/examples/simulation/fire-text/index.ts Wires the simulation loop, UI controls (sectioned), and cleanup.
apps/typegpu-docs/src/examples/simulation/fire-text/index.html Adds the example’s canvas + in-example help overlay.
apps/typegpu-docs/src/examples/simulation/fire-text/meta.json Registers example metadata (title/category/tags).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +45 to +50
if (typeof value === 'object') {
result.push({
...(value as Record<string, unknown>),
label,
});
}
container.style.flex = '1 1 0';
container.style.minHeight = '0';
container.style.justifyContent = 'center';
container.style.alignItems = 'top';
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.

2 participants