Commit ffe7ec0
authored
feat(background): add pixel_grid, a configurable lattice of square cells (#204)
grid_dots draws circles on a fixed lattice with a built-in pulse — there was
no way to get a field of square tiles, to control how many of them appear, or
to make the density vary across the frame. Reproducing a reference piece's
texture with it meant settling for regular dots where the reference has a
scatter that thickens toward one edge.
pixel_grid covers two looks with one shape: one colour under density 1 gives a
sparse tile field; two colours at density 1.0 alternate by (col + row) and give
a real checkerboard.
Occupancy is a hash of (col, row, seed), not a random draw — the same cell must
resolve the same way on every frame or the whole field boils, and two renders
of one scenario have to match. `spacing` is clamped to `size`: a smaller pitch
would draw a solid sheet and silently lose the lattice the preset exists for.
`tile_spacing` reports the pitch so a world view's camera can wrap on it.
Six tests: cell stability, seed actually scattering, neighbours uncorrelated
(a hash that walks with the coordinate draws stripes, not a scatter), each
ramp running the direction it names, the spacing clamp, and degenerate configs
staying inert rather than panicking.1 parent b5b3b4d commit ffe7ec0
3 files changed
Lines changed: 367 additions & 2 deletions
File tree
- .claude/skills/rustmotion
- crates
- rustmotion-core/src/schema
- rustmotion/src/engine/render
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2337 | 2337 | | |
2338 | 2338 | | |
2339 | 2339 | | |
2340 | | - | |
| 2340 | + | |
2341 | 2341 | | |
2342 | 2342 | | |
2343 | 2343 | | |
2344 | 2344 | | |
2345 | 2345 | | |
2346 | 2346 | | |
2347 | 2347 | | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
2348 | 2381 | | |
2349 | 2382 | | |
2350 | 2383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
72 | 161 | | |
73 | 162 | | |
74 | 163 | | |
| |||
101 | 190 | | |
102 | 191 | | |
103 | 192 | | |
| 193 | + | |
104 | 194 | | |
105 | 195 | | |
106 | 196 | | |
| |||
111 | 201 | | |
112 | 202 | | |
113 | 203 | | |
| 204 | + | |
114 | 205 | | |
115 | 206 | | |
116 | 207 | | |
| |||
143 | 234 | | |
144 | 235 | | |
145 | 236 | | |
| 237 | + | |
146 | 238 | | |
147 | 239 | | |
148 | 240 | | |
| |||
168 | 260 | | |
169 | 261 | | |
170 | 262 | | |
| 263 | + | |
171 | 264 | | |
172 | 265 | | |
173 | 266 | | |
| |||
367 | 460 | | |
368 | 461 | | |
369 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
370 | 466 | | |
371 | 467 | | |
372 | 468 | | |
| |||
0 commit comments