Fix clouds3d: JS line comments inside FRAG_SRC array broke parsing

When I added the ground-texture code I left the comment as
multiple JS-line-comments ('// Horizon...') between strings.
Those are NOT inside any string, so JS sees:
  '// Horizon: ... satellite    <- opens string, never closes
  // ground texture ...           <- JS thinks these are line comments
  ...
The string stays open until the next ',, then the next string
line parses as a continuation of an unterminated string and the
whole file is rejected. Wrap the comment into one quoted string.
This commit is contained in:
Richard Zink committed 2026-10-07 20:37:58 +02:00
1 parent 6323beccf9
commit 40fcea0548
1 file changed
+1 -5
+1 -5
View File
@@ -195,11 +195,7 @@ var FRAG_SRC = [
// remain visible against a deep but not void-black sky. // remain visible against a deep but not void-black sky.
'float skyDarkness = nightFactor * 0.55;', 'float skyDarkness = nightFactor * 0.55;',
'col = mix(col, col * (1.0 - skyDarkness), 1.0 - cloud);', 'col = mix(col, col * (1.0 - skyDarkness), 1.0 - cloud);',
'// Horizon: when looking down (rd.y < 0), sample the satellite '// Horizon: when looking down (rd.y < 0), sample the satellite ground texture based on ray direction. Use the horizontal component as a UV \u2014 the further off-axis, the more the texture scrolls. Adds parallax-like feel even though the ground is a flat image.',
// ground texture based on ray direction. Use the horizontal
// component as a UV — the further off-axis, the more the
// texture scrolls. Adds parallax-like feel even though the
// ground is a flat image.
'float gmask = smoothstep(-0.02, -0.20, rd.y);', 'float gmask = smoothstep(-0.02, -0.20, rd.y);',
'vec2 gUv = vec2(rd.x * 0.5 + 0.5, -rd.y * 0.5 + 0.3);', 'vec2 gUv = vec2(rd.x * 0.5 + 0.5, -rd.y * 0.5 + 0.3);',
'vec3 groundCol = texture2D(uGround, gUv).rgb;', 'vec3 groundCol = texture2D(uGround, gUv).rgb;',