BlueGit

timfa questward

Improve brick walls: cement tops and diagonal side mortar.

Tops are flat cement; west/east use stepped diagonal course marks; south keeps running bond. Applies to thick and thin.

timfa Tim Falken · pushed by timfa

Authored 2026-08-31 · 2 months ago

Hash
8d3b18aa3f93cc8fabee632442e792d7c5813747
Parent
3553d21a
33 files changed +70 −12
client/assets/blocks/thick-brick-wall/thick-brick-wall-e.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-es.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-esw.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-n.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-ne.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-nes.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-nesw.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-ns.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-s.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-sw.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-swn.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-w.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-we.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-wn.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall-wne.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thick-brick-wall/thick-brick-wall.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-e.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-es.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-esw.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-n.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-ne.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-nes.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-nesw.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-ns.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-s.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-sw.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-swn.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-w.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-we.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-wn.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall-wne.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/blocks/thin-brick-wall/thin-brick-wall.png Binary file +0 −0

The contents of this binary file are not shown.

client/scripts/texture-wall-sprites.mjs +70 −12
@@ -275,7 +275,11 @@ const BRICK = {
275 275 O: rgba(72, 36, 30),
276 276 mortar: rgba(92, 78, 68),
277 277 hi: rgba(210, 110, 88),
278 lo: rgba(100, 42, 34)
278 lo: rgba(100, 42, 34),
279 /** Flat cement cap (no brick bond on tops). */
280 cement: rgba(168, 160, 152),
281 cementHi: rgba(184, 176, 168),
282 cementLo: rgba(148, 140, 132)
279 283 };
280 284
281 285 function cobbleLike (basePal, x, y, role, gritMask)
@@ -308,17 +312,61 @@ function cobbleLike (basePal, x, y, role, gritMask)
308 312 return base;
309 313 }
310 314
311 function brickShade (x, y, role)
315 /**
316 * Brick mortar follows each face:
317 * - T (thick) / N (thin ridge): flat cement cap
318 * - S: running bond elevation
319 * - N (thick bevel): vertical joints along the rim
320 * - W / E: diagonal course marks — outer column 1px below inner
321 */
322 function brickShade (x, y, role, shapePrefix, faceRgba)
312 323 {
313 324 if (role === "O")
314 325 { return BRICK.O; }
315 const row = Math.floor(y / 4);
316 const brickX = x + (row & 1) * 3;
317 const onHMortar = (y % 4) === 0;
318 const onVMortar = (brickX % 6) === 0;
319 if (onHMortar || onVMortar)
326
327 const thin = shapePrefix.startsWith("thin");
328 const isCap = role === "T" || (thin && role === "N");
329 if (isCap)
330 {
331 const h = hash2(x, y);
332 if ((h & 31) === 0)
333 { return BRICK.cementHi; }
334 if ((h & 31) === 1)
335 { return BRICK.cementLo; }
336 return BRICK.cement;
337 }
338
339 const courseH = 4;
340 const brickW = 6;
341 let onMortar = false;
342
343 if (role === "W" || role === "E")
344 {
345 const phase = y % courseH;
346 const outer = role === "W"
347 ? !isSameFace(faceRgba, x - 1, y, role, shapePrefix)
348 : !isSameFace(faceRgba, x + 1, y, role, shapePrefix);
349 // Diagonal: ·O then O· on west (outer 1px down); mirrored on east.
350 if (phase === 0)
351 { onMortar = !outer; }
352 else if (phase === 1)
353 { onMortar = outer; }
354 }
355 else if (role === "N")
356 {
357 onMortar = (x % brickW) === 0;
358 }
359 else
360 {
361 const row = Math.floor(y / courseH);
362 const brickX = x + (row & 1) * Math.floor(brickW / 2);
363 onMortar = (y % courseH) === 0 || (brickX % brickW) === 0;
364 }
365
366 if (onMortar)
320 367 { return BRICK.mortar; }
321 const h = hash2(x, y);
368
369 const h = hash2(x + role.charCodeAt(0) * 17, y);
322 370 if ((h & 15) === 0)
323 371 { return BRICK.hi; }
324 372 if ((h & 15) === 1)
@@ -326,6 +374,16 @@ function brickShade (x, y, role)
326 374 return BRICK[role] ?? BRICK.T;
327 375 }
328 376
377 function isSameFace (faceRgba, x, y, role, shapePrefix)
378 {
379 if (x < 0 || y < 0 || x >= SIZE || y >= SIZE || !faceRgba)
380 { return false; }
381 const i = (y * SIZE + x) * 4;
382 if (faceRgba[i + 3] === 0)
383 { return false; }
384 return roleOf(shapePrefix, faceRgba[i]) === role;
385 }
386
329 387 function woodMagenta (role)
330 388 {
331 389 // R≈B, G<R — lightness encodes face.
@@ -368,7 +426,7 @@ function cliffShade (x, y, role, shapePrefix)
368 426 return mulRgb(d, faceLit(role));
369 427 }
370 428
371 function paintPixel (variant, prefix, g, x, y)
429 function paintPixel (variant, prefix, g, x, y, faceRgba = null)
372 430 {
373 431 const role = roleOf(prefix, g);
374 432 if (!role)
@@ -380,7 +438,7 @@ function paintPixel (variant, prefix, g, x, y)
380 438 if (variant === "cliff")
381 439 { return mulRgb(dirtAt(x, y), lit); }
382 440 if (variant === "brick")
383 { return mulRgb(BRICK.T, lit); }
441 { return mulRgb(BRICK.cement, lit); }
384 442 return mulRgb(COBBLE.T, lit);
385 443 }
386 444 if (variant === "cobble")
@@ -388,7 +446,7 @@ function paintPixel (variant, prefix, g, x, y)
388 446 if (variant === "smooth")
389 447 { return cobbleLike(COBBLE, x, y, role, 31); }
390 448 if (variant === "brick")
391 { return brickShade(x, y, role); }
449 { return brickShade(x, y, role, prefix, faceRgba); }
392 450 if (variant === "wood")
393 451 { return woodMagenta(role); }
394 452 if (variant === "cliff")
@@ -406,7 +464,7 @@ function textureMask (rgbaIn, variant, shapePrefix)
406 464 const i = (y * SIZE + x) * 4;
407 465 if (rgbaIn[i + 3] === 0)
408 466 { continue; }
409 const color = paintPixel(variant, shapePrefix, rgbaIn[i], x, y);
467 const color = paintPixel(variant, shapePrefix, rgbaIn[i], x, y, rgbaIn);
410 468 out[i] = color[0];
411 469 out[i + 1] = color[1];
412 470 out[i + 2] = color[2];
@@ -275,7 +275,11 @@ const BRICK = {
275 O: rgba(72, 36, 30),
275 O: rgba(72, 36, 30),
276 mortar: rgba(92, 78, 68),
276 mortar: rgba(92, 78, 68),
277 hi: rgba(210, 110, 88),
277 hi: rgba(210, 110, 88),
278 lo: rgba(100, 42, 34)
278 lo: rgba(100, 42, 34),
279 /** Flat cement cap (no brick bond on tops). */
280 cement: rgba(168, 160, 152),
281 cementHi: rgba(184, 176, 168),
282 cementLo: rgba(148, 140, 132)
279};
283};
280
284
281function cobbleLike (basePal, x, y, role, gritMask)
285function cobbleLike (basePal, x, y, role, gritMask)
@@ -308,17 +312,61 @@ function cobbleLike (basePal, x, y, role, gritMask)
308 return base;
312 return base;
309}
313}
310
314
311function brickShade (x, y, role)
315/**
316 * Brick mortar follows each face:
317 * - T (thick) / N (thin ridge): flat cement cap
318 * - S: running bond elevation
319 * - N (thick bevel): vertical joints along the rim
320 * - W / E: diagonal course marks — outer column 1px below inner
321 */
322function brickShade (x, y, role, shapePrefix, faceRgba)
312{
323{
313 if (role === "O")
324 if (role === "O")
314 { return BRICK.O; }
325 { return BRICK.O; }
315 const row = Math.floor(y / 4);
326
316 const brickX = x + (row & 1) * 3;
327 const thin = shapePrefix.startsWith("thin");
317 const onHMortar = (y % 4) === 0;
328 const isCap = role === "T" || (thin && role === "N");
318 const onVMortar = (brickX % 6) === 0;
329 if (isCap)
319 if (onHMortar || onVMortar)
330 {
331 const h = hash2(x, y);
332 if ((h & 31) === 0)
333 { return BRICK.cementHi; }
334 if ((h & 31) === 1)
335 { return BRICK.cementLo; }
336 return BRICK.cement;
337 }
338
339 const courseH = 4;
340 const brickW = 6;
341 let onMortar = false;
342
343 if (role === "W" || role === "E")
344 {
345 const phase = y % courseH;
346 const outer = role === "W"
347 ? !isSameFace(faceRgba, x - 1, y, role, shapePrefix)
348 : !isSameFace(faceRgba, x + 1, y, role, shapePrefix);
349 // Diagonal: ·O then O· on west (outer 1px down); mirrored on east.
350 if (phase === 0)
351 { onMortar = !outer; }
352 else if (phase === 1)
353 { onMortar = outer; }
354 }
355 else if (role === "N")
356 {
357 onMortar = (x % brickW) === 0;
358 }
359 else
360 {
361 const row = Math.floor(y / courseH);
362 const brickX = x + (row & 1) * Math.floor(brickW / 2);
363 onMortar = (y % courseH) === 0 || (brickX % brickW) === 0;
364 }
365
366 if (onMortar)
320 { return BRICK.mortar; }
367 { return BRICK.mortar; }
321 const h = hash2(x, y);
368
369 const h = hash2(x + role.charCodeAt(0) * 17, y);
322 if ((h & 15) === 0)
370 if ((h & 15) === 0)
323 { return BRICK.hi; }
371 { return BRICK.hi; }
324 if ((h & 15) === 1)
372 if ((h & 15) === 1)
@@ -326,6 +374,16 @@ function brickShade (x, y, role)
326 return BRICK[role] ?? BRICK.T;
374 return BRICK[role] ?? BRICK.T;
327}
375}
328
376
377function isSameFace (faceRgba, x, y, role, shapePrefix)
378{
379 if (x < 0 || y < 0 || x >= SIZE || y >= SIZE || !faceRgba)
380 { return false; }
381 const i = (y * SIZE + x) * 4;
382 if (faceRgba[i + 3] === 0)
383 { return false; }
384 return roleOf(shapePrefix, faceRgba[i]) === role;
385}
386
329function woodMagenta (role)
387function woodMagenta (role)
330{
388{
331 // R≈B, G<R — lightness encodes face.
389 // R≈B, G<R — lightness encodes face.
@@ -368,7 +426,7 @@ function cliffShade (x, y, role, shapePrefix)
368 return mulRgb(d, faceLit(role));
426 return mulRgb(d, faceLit(role));
369}
427}
370
428
371function paintPixel (variant, prefix, g, x, y)
429function paintPixel (variant, prefix, g, x, y, faceRgba = null)
372{
430{
373 const role = roleOf(prefix, g);
431 const role = roleOf(prefix, g);
374 if (!role)
432 if (!role)
@@ -380,7 +438,7 @@ function paintPixel (variant, prefix, g, x, y)
380 if (variant === "cliff")
438 if (variant === "cliff")
381 { return mulRgb(dirtAt(x, y), lit); }
439 { return mulRgb(dirtAt(x, y), lit); }
382 if (variant === "brick")
440 if (variant === "brick")
383 { return mulRgb(BRICK.T, lit); }
441 { return mulRgb(BRICK.cement, lit); }
384 return mulRgb(COBBLE.T, lit);
442 return mulRgb(COBBLE.T, lit);
385 }
443 }
386 if (variant === "cobble")
444 if (variant === "cobble")
@@ -388,7 +446,7 @@ function paintPixel (variant, prefix, g, x, y)
388 if (variant === "smooth")
446 if (variant === "smooth")
389 { return cobbleLike(COBBLE, x, y, role, 31); }
447 { return cobbleLike(COBBLE, x, y, role, 31); }
390 if (variant === "brick")
448 if (variant === "brick")
391 { return brickShade(x, y, role); }
449 { return brickShade(x, y, role, prefix, faceRgba); }
392 if (variant === "wood")
450 if (variant === "wood")
393 { return woodMagenta(role); }
451 { return woodMagenta(role); }
394 if (variant === "cliff")
452 if (variant === "cliff")
@@ -406,7 +464,7 @@ function textureMask (rgbaIn, variant, shapePrefix)
406 const i = (y * SIZE + x) * 4;
464 const i = (y * SIZE + x) * 4;
407 if (rgbaIn[i + 3] === 0)
465 if (rgbaIn[i + 3] === 0)
408 { continue; }
466 { continue; }
409 const color = paintPixel(variant, shapePrefix, rgbaIn[i], x, y);
467 const color = paintPixel(variant, shapePrefix, rgbaIn[i], x, y, rgbaIn);
410 out[i] = color[0];
468 out[i] = color[0];
411 out[i + 1] = color[1];
469 out[i + 1] = color[1];
412 out[i + 2] = color[2];
470 out[i + 2] = color[2];