Skip to content

Commit 462f8f6

Browse files
committed
Add lap accent tint and saturation note
1 parent 6f816f8 commit 462f8f6

File tree

1 file changed

+5
-2
lines changed
  • apps/typegpu-docs/src/examples/algorithms/genetic-racing

1 file changed

+5
-2
lines changed

apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ const carFragment = tgpu.fragmentFn({
357357
'use gpu';
358358
const sample = std.textureSampleLevel(carSpriteView.$, linearSampler.$, uv, 0);
359359
const t = std.smoothstep(0, 1, progress);
360-
const tint = std.mix(d.vec3f(0.4, 0.6, 1.0), d.vec3f(1.0, 0.85, 0.15), t);
360+
const baseTint = std.mix(d.vec3f(0.4, 0.6, 1.0), d.vec3f(1.0, 0.85, 0.15), t);
361+
const lapAccent = std.smoothstep(1, 10, progress);
362+
const tint = std.mix(baseTint, d.vec3f(0.15, 1.0, 0.35), lapAccent);
361363
const lum = std.dot(sample.xyz, d.vec3f(0.299, 0.587, 0.114));
362364
const rgb = std.mix(d.vec3f(lum) * 0.4, sample.xyz * tint, isAlive);
363365
const a = sample.w * std.mix(0.45, 1, isAlive);
@@ -469,7 +471,8 @@ function frame() {
469471
const genStr = String(ga.generation).padStart(5);
470472
const stepStr = String(steps).padStart(String(stepsPerGeneration).length);
471473
const bestStr = displayedBestFitness.toFixed(2).padStart(6);
472-
statsDiv.textContent = `Gen ${genStr} Step ${stepStr}/${stepsPerGeneration} Pop ${population} Best ${bestStr}`;
474+
const saturatedNote = displayedBestFitness >= 64 ? ' (saturated)' : '';
475+
statsDiv.textContent = `Gen ${genStr} Step ${stepStr}/${stepsPerGeneration} Pop ${population} Best ${bestStr}${saturatedNote}`;
473476

474477
trackPipeline.withColorAttachment({ view: context, clearValue: [0.04, 0.05, 0.07, 1] }).draw(3);
475478

0 commit comments

Comments
 (0)