Prevents jumps during 3→2→1 finger transitions by dropping
one frame and reinitializing pinch state for the new finger
count.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reinitialize pinch state (distance, angle, centroid) when
exiting 3-finger mode with 2 fingers remaining. Prevents
large zoom/rotate delta from stale pinch values.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add demo_view_request_redraw() and export as _web_request_redraw.
Shell calls it on visibilitychange, focus, pageshow, and
webglcontextrestored events to force a redraw after phone
lock/unlock or tab switch.
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Toggle canvas width by 1px to ensure GLFW detects the size
change and triggers a redraw after phone lock/unlock.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
preventDefault on touchend after long-press fires, so GLFW
doesn't see it as a click.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Long-press uses _web_reset directly with 10px jitter threshold.
Double-tap-drag undoes first tap's animation toggle via
_web_toggle_animation, then preventDefault blocks GLFW from
seeing the second tap.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use exported _web_reset() for long-press instead of synthesized
keyboard event. Second tap of double-tap-drag naturally undoes
the first tap's animation toggle via GLFW click handling.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Long-press (500ms) resets view. Double-tap and drag vertically
zooms in/out (one-handed zoom like Google Maps).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scale and rotate around the previous finger midpoint, then apply
centroid drift as pan afterwards. This prevents the content from
orbiting during pinch-rotate.
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Single demo_view_pinch() handles all three components atomically:
- Pan from centroid movement
- Zoom around centroid (proven middle-drag math)
- Screen-space Z rotation (separate from 3D quaternion)
Pinch rotation uses a screen_angle field applied as a post-MVP
2D rotation, keeping it independent from the 3D trackball.
Zoom centering works correctly; rotation centering is approximate.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds demo_view_zoom_around() which scales while compensating
translation so the midpoint between fingers stays fixed.
Same maps-like behavior as the pinch rotation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds demo_view_rotate_z_around() which compensates translation
so the point between the two fingers stays fixed during rotation,
like maps apps.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two-finger pinch now does both zoom (distance change) and Z-axis
rotation (angle change) simultaneously. Adds demo_view_rotate_z()
for direct Z-axis rotation from touch input.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Only toggle on keydown (not keyup). Remove vsync from web help.
Format key names with spaces.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Press ? or / to show full keyboard/mouse/touch reference.
Esc or ? again to dismiss.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wine may not properly restore windowed mode after fullscreen.
Works on native Windows.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Disable backface culling (both triangles per quad need to render).
Handle Esc/Q to quit via DestroyWindow. Wire vsync toggle to
swap chain present interval.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The library's hb_gpu_fetch references the global hb_gpu_atlas,
so its StructuredBuffer declaration must precede the library
source in the concatenated shader.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
D3D11 renderer using Win32 windowing and runtime HLSL compilation.
Cross-compiles with MinGW, runs under Wine with DXVK.
Also fixes demo-common.h to guard GL/GLFW includes behind
HB_GPU_NO_GLFW, renames near/far to znear/zfar in demo-view
(reserved on Windows), and adds QueryPerformanceCounter timer
for Win32.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wire up the 'd' key debug mode using _hb_gpu_curve_counts from
the library MSL shader. Same R/G/B heatmap as GL and WebGPU:
red = horizontal curve count, green = vertical, blue = coverage.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Now that the WGSL shader has _hb_gpu_curve_counts, wire up
the debug uniform and heatmap visualization. Same R/G/B output
as the GL demo.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bring WGSL shader in line with GLSL/MSL/HLSL by extracting the
header decode + band index computation into a shared helper.
Enables future debug heatmap support in the WebGPU demo.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Check canvas size each frame and reconfigure the WebGPU surface
when it changes. Fixes black screen when toggling dev tools or
resizing the browser window.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Make hb_gpu_fetch public (no underscore prefix) in all shaders.
Internal functions use _hb_gpu_* consistently, including WGSL
(single leading underscore is legal per gpuweb/gpuweb#2298).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Explain why font scale should be left at default, how dilation
works and what jac means, and provide a simpler static dilation
alternative for 2D rendering at known sizes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Same algorithm as GL: pow(coverage, exp) where exp varies by
foreground brightness and ppem, smoothly transitioning to no
effect above 48ppem. Toggled with 's' key, on by default.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Same per-pixel coverage adjustment as the GL demo. Replaces
unused debug uniform with stem_darkening in the uniform buffer.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>