Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

graph: fix drawGradientTriangle double-scaling colours to white

The callers in Form.graph already pre-multiply vertex colours by 255, so
the new scanline raster's extra `* 255` pushed every channel past 255 and
UInt8ClampedArray clamped them all to white. Alias the inputs directly
(they're already 0-255) — no re-scale needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+6 -6
+6 -6
system/public/aesthetic.computer/lib/graph.mjs
··· 4122 4122 let e2Row = (x3 - px0) * (y1 - py0) - (x1 - px0) * (y3 - py0); 4123 4123 let e3Row = (x1 - px0) * (y2 - py0) - (x2 - px0) * (y1 - py0); 4124 4124 4125 - // Pre-scale colour channels to 0-255 to remove the per-pixel *255 multiply. 4126 - const c1r = color1[0] * 255, c1g = color1[1] * 255, c1b = color1[2] * 255; 4127 - const c2r = color2[0] * 255, c2g = color2[1] * 255, c2b = color2[2] * 255; 4128 - const c3r = color3[0] * 255, c3g = color3[1] * 255, c3b = color3[2] * 255; 4129 - const c1a = color1[3] * 255, c2a = color2[3] * 255, c3a = color3[3] * 255; 4125 + // Colour components are passed in pre-scaled 0-255 space (the caller in 4126 + // Form.graph does the `* 255` multiply). We just alias them for readability. 4127 + const c1r = color1[0], c1g = color1[1], c1b = color1[2], c1a = color1[3]; 4128 + const c2r = color2[0], c2g = color2[1], c2b = color2[2], c2a = color2[3]; 4129 + const c3r = color3[0], c3g = color3[1], c3b = color3[2], c3a = color3[3]; 4130 4130 // If every vertex is fully opaque we can skip the per-pixel alpha path. 4131 - const allOpaque = c1a >= 254.5 && c2a >= 254.5 && c3a >= 254.5; 4131 + const allOpaque = c1a >= 254 && c2a >= 254 && c3a >= 254; 4132 4132 4133 4133 const hasDepth = depthBuffer.length > 0; 4134 4134 const pix = pixels;