BlueGit

timfa questward

Add cliff walls with dirt sides and ground-sampled magenta tops.

Thick/thin cliff sprites reuse wall shapes: sides bake dirt browns with face lighting; tops stay magenta and the block atlas shader replaces them with a center crop of the ground tile beneath, then applies lightmap darkness.

timfa Tim Falken · pushed by timfa

Authored 2026-08-31 · 2 months ago

Hash
ce77ea77dc297ca387d4b84700c3b79cd5c04660
Parent
78419164
36 files changed +134 −20
client/assets/blocks/thick-cliff/thick-cliff-e.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-es.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-esw.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-n.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-ne.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-nes.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-nesw.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-ns.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-s.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-sw.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-swn.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-w.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-we.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-wn.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff-wne.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-cliff/thick-cliff.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-e.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-es.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-esw.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-n.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-ne.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-nes.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-nesw.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-ns.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-s.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-sw.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-swn.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-w.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-we.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-wn.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff-wne.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-cliff/thin-cliff.png added Binary file +0 −0

The contents of this binary file are not shown.

client/scripts/texture-wall-sprites.mjs +27 −16
@@ -122,6 +122,7 @@ function decodePngRgba (path)
122 122 let off = 8;
123 123 let w = 0;
124 124 let h = 0;
125 let colorType = 6;
125 126 const idat = [];
126 127 while (off < buf.length)
127 128 {
@@ -132,6 +133,7 @@ function decodePngRgba (path)
132 133 {
133 134 w = data.readUInt32BE(0);
134 135 h = data.readUInt32BE(4);
136 colorType = data[9];
135 137 }
136 138 else if (type === "IDAT")
137 139 { idat.push(data); }
@@ -139,43 +141,52 @@ function decodePngRgba (path)
139 141 { break; }
140 142 off += 12 + len;
141 143 }
144 const channels = colorType === 2 ? 3 : colorType === 6 ? 4 : 0;
145 if (!channels)
146 { throw new Error(`${path}: unsupported PNG color type ${colorType}`); }
142 147 const inflated = inflateSync(Buffer.concat(idat));
143 148 const rgba = new Uint8Array(w * h * 4);
144 const bpp = 4;
145 149 let src = 0;
150 const prevRow = new Uint8Array(w * channels);
151 const curRow = new Uint8Array(w * channels);
146 152 for (let y = 0; y < h; y++)
147 153 {
148 154 const filter = inflated[src++];
149 const row = inflated.subarray(src, src + w * bpp);
150 src += w * bpp;
151 const prev = y > 0 ? rgba.subarray((y - 1) * w * bpp, y * w * bpp) : null;
152 const out = rgba.subarray(y * w * bpp, (y + 1) * w * bpp);
153 for (let i = 0; i < row.length; i++)
155 for (let i = 0; i < w * channels; i++)
154 156 {
155 let v = row[i];
157 let v = inflated[src++];
156 158 if (filter === 1)
157 { v = (v + (i >= bpp ? out[i - bpp] : 0)) & 255; }
159 { v = (v + (i >= channels ? curRow[i - channels] : 0)) & 255; }
158 160 else if (filter === 2)
159 { v = (v + (prev ? prev[i] : 0)) & 255; }
161 { v = (v + prevRow[i]) & 255; }
160 162 else if (filter === 3)
161 163 {
162 const a = i >= bpp ? out[i - bpp] : 0;
163 const b = prev ? prev[i] : 0;
164 v = (v + Math.floor((a + b) / 2)) & 255;
164 const a = i >= channels ? curRow[i - channels] : 0;
165 v = (v + Math.floor((a + prevRow[i]) / 2)) & 255;
165 166 }
166 167 else if (filter === 4)
167 168 {
168 const a = i >= bpp ? out[i - bpp] : 0;
169 const b = prev ? prev[i] : 0;
170 const c = prev && i >= bpp ? prev[i - bpp] : 0;
169 const a = i >= channels ? curRow[i - channels] : 0;
170 const b = prevRow[i];
171 const c = i >= channels ? prevRow[i - channels] : 0;
171 172 const p = a + b - c;
172 173 const pa = Math.abs(p - a);
173 174 const pb = Math.abs(p - b);
174 175 const pc = Math.abs(p - c);
175 176 v = (v + (pa <= pb && pa <= pc ? a : pb <= pc ? b : c)) & 255;
176 177 }
177 out[i] = v;
178 curRow[i] = v;
178 179 }
180 for (let x = 0; x < w; x++)
181 {
182 const si = x * channels;
183 const di = (y * w + x) * 4;
184 rgba[di] = curRow[si];
185 rgba[di + 1] = curRow[si + 1];
186 rgba[di + 2] = curRow[si + 2];
187 rgba[di + 3] = channels === 4 ? curRow[si + 3] : 255;
188 }
189 prevRow.set(curRow);
179 190 }
180 191 if (w !== SIZE || h !== SIZE)
181 192 { throw new Error(`${path}: expected ${SIZE}×${SIZE}, got ${w}×${h}`); }
@@ -122,6 +122,7 @@ function decodePngRgba (path)
122 let off = 8;
122 let off = 8;
123 let w = 0;
123 let w = 0;
124 let h = 0;
124 let h = 0;
125 let colorType = 6;
125 const idat = [];
126 const idat = [];
126 while (off < buf.length)
127 while (off < buf.length)
127 {
128 {
@@ -132,6 +133,7 @@ function decodePngRgba (path)
132 {
133 {
133 w = data.readUInt32BE(0);
134 w = data.readUInt32BE(0);
134 h = data.readUInt32BE(4);
135 h = data.readUInt32BE(4);
136 colorType = data[9];
135 }
137 }
136 else if (type === "IDAT")
138 else if (type === "IDAT")
137 { idat.push(data); }
139 { idat.push(data); }
@@ -139,43 +141,52 @@ function decodePngRgba (path)
139 { break; }
141 { break; }
140 off += 12 + len;
142 off += 12 + len;
141 }
143 }
144 const channels = colorType === 2 ? 3 : colorType === 6 ? 4 : 0;
145 if (!channels)
146 { throw new Error(`${path}: unsupported PNG color type ${colorType}`); }
142 const inflated = inflateSync(Buffer.concat(idat));
147 const inflated = inflateSync(Buffer.concat(idat));
143 const rgba = new Uint8Array(w * h * 4);
148 const rgba = new Uint8Array(w * h * 4);
144 const bpp = 4;
145 let src = 0;
149 let src = 0;
150 const prevRow = new Uint8Array(w * channels);
151 const curRow = new Uint8Array(w * channels);
146 for (let y = 0; y < h; y++)
152 for (let y = 0; y < h; y++)
147 {
153 {
148 const filter = inflated[src++];
154 const filter = inflated[src++];
149 const row = inflated.subarray(src, src + w * bpp);
155 for (let i = 0; i < w * channels; i++)
150 src += w * bpp;
151 const prev = y > 0 ? rgba.subarray((y - 1) * w * bpp, y * w * bpp) : null;
152 const out = rgba.subarray(y * w * bpp, (y + 1) * w * bpp);
153 for (let i = 0; i < row.length; i++)
154 {
156 {
155 let v = row[i];
157 let v = inflated[src++];
156 if (filter === 1)
158 if (filter === 1)
157 { v = (v + (i >= bpp ? out[i - bpp] : 0)) & 255; }
159 { v = (v + (i >= channels ? curRow[i - channels] : 0)) & 255; }
158 else if (filter === 2)
160 else if (filter === 2)
159 { v = (v + (prev ? prev[i] : 0)) & 255; }
161 { v = (v + prevRow[i]) & 255; }
160 else if (filter === 3)
162 else if (filter === 3)
161 {
163 {
162 const a = i >= bpp ? out[i - bpp] : 0;
164 const a = i >= channels ? curRow[i - channels] : 0;
163 const b = prev ? prev[i] : 0;
165 v = (v + Math.floor((a + prevRow[i]) / 2)) & 255;
164 v = (v + Math.floor((a + b) / 2)) & 255;
165 }
166 }
166 else if (filter === 4)
167 else if (filter === 4)
167 {
168 {
168 const a = i >= bpp ? out[i - bpp] : 0;
169 const a = i >= channels ? curRow[i - channels] : 0;
169 const b = prev ? prev[i] : 0;
170 const b = prevRow[i];
170 const c = prev && i >= bpp ? prev[i - bpp] : 0;
171 const c = i >= channels ? prevRow[i - channels] : 0;
171 const p = a + b - c;
172 const p = a + b - c;
172 const pa = Math.abs(p - a);
173 const pa = Math.abs(p - a);
173 const pb = Math.abs(p - b);
174 const pb = Math.abs(p - b);
174 const pc = Math.abs(p - c);
175 const pc = Math.abs(p - c);
175 v = (v + (pa <= pb && pa <= pc ? a : pb <= pc ? b : c)) & 255;
176 v = (v + (pa <= pb && pa <= pc ? a : pb <= pc ? b : c)) & 255;
176 }
177 }
177 out[i] = v;
178 curRow[i] = v;
178 }
179 }
180 for (let x = 0; x < w; x++)
181 {
182 const si = x * channels;
183 const di = (y * w + x) * 4;
184 rgba[di] = curRow[si];
185 rgba[di + 1] = curRow[si + 1];
186 rgba[di + 2] = curRow[si + 2];
187 rgba[di + 3] = channels === 4 ? curRow[si + 3] : 255;
188 }
189 prevRow.set(curRow);
179 }
190 }
180 if (w !== SIZE || h !== SIZE)
191 if (w !== SIZE || h !== SIZE)
181 { throw new Error(`${path}: expected ${SIZE}×${SIZE}, got ${w}×${h}`); }
192 { throw new Error(`${path}: expected ${SIZE}×${SIZE}, got ${w}×${h}`); }
client/src/render/worldView.js +69 −3
@@ -352,8 +352,51 @@ const ATLAS_LIGHTING_FRAG = [
352 352 "}"
353 353 ].join("\n");
354 354
355 /**
356 * Block-row atlas: optional magenta → sample center crop of the ground atlas
357 * (bound as u_bump). Used so cliff tops show the ground the wall sits on.
358 * Darkness matches ATLAS_LIGHTING_FRAG (lightmap in u_secondary).
359 */
360 const ATLAS_BLOCK_GROUND_TOP_FRAG = [
361 "precision mediump float;",
362 "varying vec2 v_texCoord;",
363 "uniform sampler2D u_texture;",
364 "uniform sampler2D u_secondary;",
365 "uniform sampler2D u_bump;",
366 "uniform float u_alpha;",
367 "uniform float u_ambientDark;",
368 "uniform float u_lightRow;",
369 "void main() {",
370 " vec4 color = texture2D(u_texture, v_texCoord);",
371 " if (color.a <= 0.0) { discard; }",
372 " vec3 rgb = color.rgb;",
373 " // Magenta family (R≈B, G<R): replace with ground tile center crop.",
374 " float rbDiff = abs(rgb.r - rgb.b);",
375 " if (rbDiff < 0.02 && rgb.g < rgb.r - 0.02) {",
376 " float tileX = floor(v_texCoord.x * 16.0);",
377 " float tileY = max(u_lightRow, 0.0);",
378 " float localX = fract(v_texCoord.x * 16.0);",
379 " float localY = v_texCoord.y;",
380 " vec2 groundUV = vec2(",
381 " (tileX + 0.25 + localX * 0.5) / 16.0,",
382 " (tileY + 0.25 + localY * 0.5) / 16.0",
383 " );",
384 " rgb = texture2D(u_bump, groundUV).rgb;",
385 " }",
386 " vec2 lightUV = v_texCoord;",
387 " if (u_lightRow >= 0.0) {",
388 " lightUV.y = (u_lightRow + v_texCoord.y) / 16.0;",
389 " }",
390 " float lit = texture2D(u_secondary, lightUV).r;",
391 " float darkness = u_ambientDark * (1.0 - lit);",
392 " rgb = mix(rgb, vec3(0.0), darkness);",
393 " gl_FragColor = vec4(rgb, color.a * u_alpha);",
394 "}"
395 ].join("\n");
396
355 397 let spriteLightingShader = null;
356 398 let atlasLightingShader = null;
399 let atlasBlockGroundTopShader = null;
357 400 let waterGroundShader = null;
358 401 let tintLitSpriteShader = null;
359 402 let dualTintLitSpriteShader = null;
@@ -374,6 +417,13 @@ function getAtlasLightingShader ()
374 417 return atlasLightingShader;
375 418 }
376 419
420 function getAtlasBlockGroundTopShader ()
421 {
422 if (!atlasBlockGroundTopShader)
423 { atlasBlockGroundTopShader = Shader.fragment(ATLAS_BLOCK_GROUND_TOP_FRAG); }
424 return atlasBlockGroundTopShader;
425 }
426
377 427 function getWaterGroundShader ()
378 428 {
379 429 if (!waterGroundShader)
@@ -3297,7 +3347,7 @@ export class WorldView
3297 3347 for (let row = 0; row < CHUNK_SIZE; row++)
3298 3348 {
3299 3349 const object = new GameObject(0, 0, baked.blockImages[row], SORT_BLOCK);
3300 this.#applyAtlasLighting(object, baked.lightmapImage, row);
3350 this.#applyAtlasLighting(object, baked.lightmapImage, row, baked.groundImage);
3301 3351 this.scene.addObject(object);
3302 3352 baked.blockObjects.push(object);
3303 3353 }
@@ -3314,6 +3364,7 @@ export class WorldView
3314 3364 baked.groundCanvas = atlases.ground;
3315 3365 baked.groundImage = groundImage;
3316 3366 baked.groundObject.renderer.sprite = groundImage;
3367 this.#applyAtlasLighting(baked.groundObject, baked.lightmapImage, -1);
3317 3368 }
3318 3369 for (let row = 0; row < CHUNK_SIZE; row++)
3319 3370 {
@@ -3323,6 +3374,12 @@ export class WorldView
3323 3374 baked.blockImages[row] = blockImages[row];
3324 3375 baked.blockObjects[row].renderer.sprite = blockImages[row];
3325 3376 }
3377 this.#applyAtlasLighting(
3378 baked.blockObjects[row],
3379 baked.lightmapImage,
3380 row,
3381 baked.groundImage
3382 );
3326 3383 }
3327 3384 if (baked.bloomCanvas !== atlases.bloom)
3328 3385 {
@@ -3419,12 +3476,21 @@ export class WorldView
3419 3476 { this.#scheduleTextureWarm(); }
3420 3477 }
3421 3478
3422 #applyAtlasLighting (object, lightmapImage, lightRow)
3479 #applyAtlasLighting (object, lightmapImage, lightRow, groundImage = null)
3423 3480 {
3424 3481 if (!object?.renderer)
3425 3482 { return; }
3426 3483 object._lit = true;
3427 object.renderer.shader = getAtlasLightingShader();
3484 if (groundImage)
3485 {
3486 object.renderer.shader = getAtlasBlockGroundTopShader();
3487 object.renderer.bumpMap = groundImage;
3488 }
3489 else
3490 {
3491 object.renderer.shader = getAtlasLightingShader();
3492 object.renderer.bumpMap = null;
3493 }
3428 3494 object.renderer.secondaryMap = lightmapImage;
3429 3495 object.renderer.shaderUniforms = {
3430 3496 u_ambientDark: 0,
@@ -352,8 +352,51 @@ const ATLAS_LIGHTING_FRAG = [
352 "}"
352 "}"
353].join("\n");
353].join("\n");
354
354
355/**
356 * Block-row atlas: optional magenta → sample center crop of the ground atlas
357 * (bound as u_bump). Used so cliff tops show the ground the wall sits on.
358 * Darkness matches ATLAS_LIGHTING_FRAG (lightmap in u_secondary).
359 */
360const ATLAS_BLOCK_GROUND_TOP_FRAG = [
361 "precision mediump float;",
362 "varying vec2 v_texCoord;",
363 "uniform sampler2D u_texture;",
364 "uniform sampler2D u_secondary;",
365 "uniform sampler2D u_bump;",
366 "uniform float u_alpha;",
367 "uniform float u_ambientDark;",
368 "uniform float u_lightRow;",
369 "void main() {",
370 " vec4 color = texture2D(u_texture, v_texCoord);",
371 " if (color.a <= 0.0) { discard; }",
372 " vec3 rgb = color.rgb;",
373 " // Magenta family (R≈B, G<R): replace with ground tile center crop.",
374 " float rbDiff = abs(rgb.r - rgb.b);",
375 " if (rbDiff < 0.02 && rgb.g < rgb.r - 0.02) {",
376 " float tileX = floor(v_texCoord.x * 16.0);",
377 " float tileY = max(u_lightRow, 0.0);",
378 " float localX = fract(v_texCoord.x * 16.0);",
379 " float localY = v_texCoord.y;",
380 " vec2 groundUV = vec2(",
381 " (tileX + 0.25 + localX * 0.5) / 16.0,",
382 " (tileY + 0.25 + localY * 0.5) / 16.0",
383 " );",
384 " rgb = texture2D(u_bump, groundUV).rgb;",
385 " }",
386 " vec2 lightUV = v_texCoord;",
387 " if (u_lightRow >= 0.0) {",
388 " lightUV.y = (u_lightRow + v_texCoord.y) / 16.0;",
389 " }",
390 " float lit = texture2D(u_secondary, lightUV).r;",
391 " float darkness = u_ambientDark * (1.0 - lit);",
392 " rgb = mix(rgb, vec3(0.0), darkness);",
393 " gl_FragColor = vec4(rgb, color.a * u_alpha);",
394 "}"
395].join("\n");
396
355let spriteLightingShader = null;
397let spriteLightingShader = null;
356let atlasLightingShader = null;
398let atlasLightingShader = null;
399let atlasBlockGroundTopShader = null;
357let waterGroundShader = null;
400let waterGroundShader = null;
358let tintLitSpriteShader = null;
401let tintLitSpriteShader = null;
359let dualTintLitSpriteShader = null;
402let dualTintLitSpriteShader = null;
@@ -374,6 +417,13 @@ function getAtlasLightingShader ()
374 return atlasLightingShader;
417 return atlasLightingShader;
375}
418}
376
419
420function getAtlasBlockGroundTopShader ()
421{
422 if (!atlasBlockGroundTopShader)
423 { atlasBlockGroundTopShader = Shader.fragment(ATLAS_BLOCK_GROUND_TOP_FRAG); }
424 return atlasBlockGroundTopShader;
425}
426
377function getWaterGroundShader ()
427function getWaterGroundShader ()
378{
428{
379 if (!waterGroundShader)
429 if (!waterGroundShader)
@@ -3297,7 +3347,7 @@ export class WorldView
3297 for (let row = 0; row < CHUNK_SIZE; row++)
3347 for (let row = 0; row < CHUNK_SIZE; row++)
3298 {
3348 {
3299 const object = new GameObject(0, 0, baked.blockImages[row], SORT_BLOCK);
3349 const object = new GameObject(0, 0, baked.blockImages[row], SORT_BLOCK);
3300 this.#applyAtlasLighting(object, baked.lightmapImage, row);
3350 this.#applyAtlasLighting(object, baked.lightmapImage, row, baked.groundImage);
3301 this.scene.addObject(object);
3351 this.scene.addObject(object);
3302 baked.blockObjects.push(object);
3352 baked.blockObjects.push(object);
3303 }
3353 }
@@ -3314,6 +3364,7 @@ export class WorldView
3314 baked.groundCanvas = atlases.ground;
3364 baked.groundCanvas = atlases.ground;
3315 baked.groundImage = groundImage;
3365 baked.groundImage = groundImage;
3316 baked.groundObject.renderer.sprite = groundImage;
3366 baked.groundObject.renderer.sprite = groundImage;
3367 this.#applyAtlasLighting(baked.groundObject, baked.lightmapImage, -1);
3317 }
3368 }
3318 for (let row = 0; row < CHUNK_SIZE; row++)
3369 for (let row = 0; row < CHUNK_SIZE; row++)
3319 {
3370 {
@@ -3323,6 +3374,12 @@ export class WorldView
3323 baked.blockImages[row] = blockImages[row];
3374 baked.blockImages[row] = blockImages[row];
3324 baked.blockObjects[row].renderer.sprite = blockImages[row];
3375 baked.blockObjects[row].renderer.sprite = blockImages[row];
3325 }
3376 }
3377 this.#applyAtlasLighting(
3378 baked.blockObjects[row],
3379 baked.lightmapImage,
3380 row,
3381 baked.groundImage
3382 );
3326 }
3383 }
3327 if (baked.bloomCanvas !== atlases.bloom)
3384 if (baked.bloomCanvas !== atlases.bloom)
3328 {
3385 {
@@ -3419,12 +3476,21 @@ export class WorldView
3419 { this.#scheduleTextureWarm(); }
3476 { this.#scheduleTextureWarm(); }
3420 }
3477 }
3421
3478
3422 #applyAtlasLighting (object, lightmapImage, lightRow)
3479 #applyAtlasLighting (object, lightmapImage, lightRow, groundImage = null)
3423 {
3480 {
3424 if (!object?.renderer)
3481 if (!object?.renderer)
3425 { return; }
3482 { return; }
3426 object._lit = true;
3483 object._lit = true;
3427 object.renderer.shader = getAtlasLightingShader();
3484 if (groundImage)
3485 {
3486 object.renderer.shader = getAtlasBlockGroundTopShader();
3487 object.renderer.bumpMap = groundImage;
3488 }
3489 else
3490 {
3491 object.renderer.shader = getAtlasLightingShader();
3492 object.renderer.bumpMap = null;
3493 }
3428 object.renderer.secondaryMap = lightmapImage;
3494 object.renderer.secondaryMap = lightmapImage;
3429 object.renderer.shaderUniforms = {
3495 object.renderer.shaderUniforms = {
3430 u_ambientDark: 0,
3496 u_ambientDark: 0,
server/tests/tile-states.test.js +3 −0
@@ -32,6 +32,9 @@ test("sprite folders expose alphabetical states; first is default", () =>
32 32 assert.ok(catalog.images.some((image) => image.name === "block:thick-wood-wall:pine-0"));
33 33 assert.ok(catalog.images.some((image) => image.name === "block:thin-wood-wall:oak-15"));
34 34 assert.equal(catalog.blocks["thick-wood-wall"].states.length, WOOD_TIER_ORDER.length * 16);
35 assert.equal(catalog.blocks["thick-cliff"].states.length, 16);
36 assert.equal(catalog.blocks["thin-cliff"].states.length, 16);
37 assert.ok(catalog.images.some((image) => image.name === "block:thick-cliff:thick-cliff-nesw"));
35 38 assert.equal(catalog.images[0].subImgTotal, 1);
36 39 assert.equal(catalog.images[0].perRow, 1);
37 40 });
@@ -32,6 +32,9 @@ test("sprite folders expose alphabetical states; first is default", () =>
32 assert.ok(catalog.images.some((image) => image.name === "block:thick-wood-wall:pine-0"));
32 assert.ok(catalog.images.some((image) => image.name === "block:thick-wood-wall:pine-0"));
33 assert.ok(catalog.images.some((image) => image.name === "block:thin-wood-wall:oak-15"));
33 assert.ok(catalog.images.some((image) => image.name === "block:thin-wood-wall:oak-15"));
34 assert.equal(catalog.blocks["thick-wood-wall"].states.length, WOOD_TIER_ORDER.length * 16);
34 assert.equal(catalog.blocks["thick-wood-wall"].states.length, WOOD_TIER_ORDER.length * 16);
35 assert.equal(catalog.blocks["thick-cliff"].states.length, 16);
36 assert.equal(catalog.blocks["thin-cliff"].states.length, 16);
37 assert.ok(catalog.images.some((image) => image.name === "block:thick-cliff:thick-cliff-nesw"));
35 assert.equal(catalog.images[0].subImgTotal, 1);
38 assert.equal(catalog.images[0].subImgTotal, 1);
36 assert.equal(catalog.images[0].perRow, 1);
39 assert.equal(catalog.images[0].perRow, 1);
37});
40});
shared/definitions/tiles.js +35 −1
@@ -84,7 +84,9 @@ export const BlockType = Object.freeze({
84 84 brickWall: 41,
85 85 brickWallThin: 42,
86 86 woodWall: 43,
87 woodWallThin: 44
87 woodWallThin: 44,
88 cliff: 45,
89 cliffThin: 46
88 90 });
89 91
90 92 export const GROUND_DEFINITIONS = Object.freeze({
@@ -284,6 +286,38 @@ export const BLOCK_DEFINITIONS = Object.freeze({
284 286 neighborConnectByMaterial: true,
285 287 defaultNeighborMaterial: WoodTier.pine
286 288 }),
289 [BlockType.cliff]: Object.freeze({
290 id: BlockType.cliff,
291 key: "thick-cliff",
292 displayName: "Thick cliff",
293 passable: false,
294 lightRangeTiles: 0,
295 frames: 1,
296 framesPerRow: 1,
297 animationSpeed: 0,
298 outdoor: true,
299 neighborConnect: true,
300 neighborConnectNamed: true,
301 /**
302 * Magenta top faces are replaced at draw time with a center crop of the
303 * ground tile beneath (atlas block shader + ground as u_bump).
304 */
305 cliffGroundTop: true
306 }),
307 [BlockType.cliffThin]: Object.freeze({
308 id: BlockType.cliffThin,
309 key: "thin-cliff",
310 displayName: "Thin cliff",
311 passable: false,
312 lightRangeTiles: 0,
313 frames: 1,
314 framesPerRow: 1,
315 animationSpeed: 0,
316 outdoor: true,
317 neighborConnect: true,
318 neighborConnectNamed: true,
319 cliffGroundTop: true
320 }),
287 321 [BlockType.torch]: Object.freeze({
288 322 id: BlockType.torch,
289 323 key: "torch",
@@ -84,7 +84,9 @@ export const BlockType = Object.freeze({
84 brickWall: 41,
84 brickWall: 41,
85 brickWallThin: 42,
85 brickWallThin: 42,
86 woodWall: 43,
86 woodWall: 43,
87 woodWallThin: 44
87 woodWallThin: 44,
88 cliff: 45,
89 cliffThin: 46
88});
90});
89
91
90export const GROUND_DEFINITIONS = Object.freeze({
92export const GROUND_DEFINITIONS = Object.freeze({
@@ -284,6 +286,38 @@ export const BLOCK_DEFINITIONS = Object.freeze({
284 neighborConnectByMaterial: true,
286 neighborConnectByMaterial: true,
285 defaultNeighborMaterial: WoodTier.pine
287 defaultNeighborMaterial: WoodTier.pine
286 }),
288 }),
289 [BlockType.cliff]: Object.freeze({
290 id: BlockType.cliff,
291 key: "thick-cliff",
292 displayName: "Thick cliff",
293 passable: false,
294 lightRangeTiles: 0,
295 frames: 1,
296 framesPerRow: 1,
297 animationSpeed: 0,
298 outdoor: true,
299 neighborConnect: true,
300 neighborConnectNamed: true,
301 /**
302 * Magenta top faces are replaced at draw time with a center crop of the
303 * ground tile beneath (atlas block shader + ground as u_bump).
304 */
305 cliffGroundTop: true
306 }),
307 [BlockType.cliffThin]: Object.freeze({
308 id: BlockType.cliffThin,
309 key: "thin-cliff",
310 displayName: "Thin cliff",
311 passable: false,
312 lightRangeTiles: 0,
313 frames: 1,
314 framesPerRow: 1,
315 animationSpeed: 0,
316 outdoor: true,
317 neighborConnect: true,
318 neighborConnectNamed: true,
319 cliffGroundTop: true
320 }),
287 [BlockType.torch]: Object.freeze({
321 [BlockType.torch]: Object.freeze({
288 id: BlockType.torch,
322 id: BlockType.torch,
289 key: "torch",
323 key: "torch",