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.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
The contents of this binary file are not shown.
@@ -275,7 +275,11 @@ const BRICK = {
O: rgba(72, 36, 30),
mortar: rgba(92, 78, 68),
hi: rgba(210, 110, 88),
lo: rgba(100, 42, 34)
lo: rgba(100, 42, 34),
/** Flat cement cap (no brick bond on tops). */
cement: rgba(168, 160, 152),
cementHi: rgba(184, 176, 168),
cementLo: rgba(148, 140, 132)
};
function cobbleLike (basePal, x, y, role, gritMask)
@@ -308,17 +312,61 @@ function cobbleLike (basePal, x, y, role, gritMask)
return base;
}
function brickShade (x, y, role)
/**
* Brick mortar follows each face:
* - T (thick) / N (thin ridge): flat cement cap
* - S: running bond elevation
* - N (thick bevel): vertical joints along the rim
* - W / E: diagonal course marks — outer column 1px below inner
*/
function brickShade (x, y, role, shapePrefix, faceRgba)
{
if (role === "O")
{ return BRICK.O; }
const row = Math.floor(y / 4);
const brickX = x + (row & 1) * 3;
const onHMortar = (y % 4) === 0;
const onVMortar = (brickX % 6) === 0;
if (onHMortar || onVMortar)
const thin = shapePrefix.startsWith("thin");
const isCap = role === "T" || (thin && role === "N");
if (isCap)
{
const h = hash2(x, y);
if ((h & 31) === 0)
{ return BRICK.cementHi; }
if ((h & 31) === 1)
{ return BRICK.cementLo; }
return BRICK.cement;
}
const courseH = 4;
const brickW = 6;
let onMortar = false;
if (role === "W" || role === "E")
{
const phase = y % courseH;
const outer = role === "W"
? !isSameFace(faceRgba, x - 1, y, role, shapePrefix)
: !isSameFace(faceRgba, x + 1, y, role, shapePrefix);
// Diagonal: ·O then O· on west (outer 1px down); mirrored on east.
if (phase === 0)
{ onMortar = !outer; }
else if (phase === 1)
{ onMortar = outer; }
}
else if (role === "N")
{
onMortar = (x % brickW) === 0;
}
else
{
const row = Math.floor(y / courseH);
const brickX = x + (row & 1) * Math.floor(brickW / 2);
onMortar = (y % courseH) === 0 || (brickX % brickW) === 0;
}
if (onMortar)
{ return BRICK.mortar; }
const h = hash2(x, y);
const h = hash2(x + role.charCodeAt(0) * 17, y);
if ((h & 15) === 0)
{ return BRICK.hi; }
if ((h & 15) === 1)
@@ -326,6 +374,16 @@ function brickShade (x, y, role)
return BRICK[role] ?? BRICK.T;
}
function isSameFace (faceRgba, x, y, role, shapePrefix)
{
if (x < 0 || y < 0 || x >= SIZE || y >= SIZE || !faceRgba)
{ return false; }
const i = (y * SIZE + x) * 4;
if (faceRgba[i + 3] === 0)
{ return false; }
return roleOf(shapePrefix, faceRgba[i]) === role;
}
function woodMagenta (role)
{
// R≈B, G<R — lightness encodes face.
@@ -368,7 +426,7 @@ function cliffShade (x, y, role, shapePrefix)
return mulRgb(d, faceLit(role));
}
function paintPixel (variant, prefix, g, x, y)
function paintPixel (variant, prefix, g, x, y, faceRgba = null)
{
const role = roleOf(prefix, g);
if (!role)
@@ -380,7 +438,7 @@ function paintPixel (variant, prefix, g, x, y)
if (variant === "cliff")
{ return mulRgb(dirtAt(x, y), lit); }
if (variant === "brick")
{ return mulRgb(BRICK.T, lit); }
{ return mulRgb(BRICK.cement, lit); }
return mulRgb(COBBLE.T, lit);
}
if (variant === "cobble")
@@ -388,7 +446,7 @@ function paintPixel (variant, prefix, g, x, y)
if (variant === "smooth")
{ return cobbleLike(COBBLE, x, y, role, 31); }
if (variant === "brick")
{ return brickShade(x, y, role); }
{ return brickShade(x, y, role, prefix, faceRgba); }
if (variant === "wood")
{ return woodMagenta(role); }
if (variant === "cliff")
@@ -406,7 +464,7 @@ function textureMask (rgbaIn, variant, shapePrefix)
const i = (y * SIZE + x) * 4;
if (rgbaIn[i + 3] === 0)
{ continue; }
const color = paintPixel(variant, shapePrefix, rgbaIn[i], x, y);
const color = paintPixel(variant, shapePrefix, rgbaIn[i], x, y, rgbaIn);
out[i] = color[0];
out[i + 1] = color[1];
out[i + 2] = color[2];
@@ -275,7 +275,11 @@ const BRICK = { O: rgba(72, 36, 30), O: rgba(72, 36, 30), mortar: rgba(92, 78, 68), mortar: rgba(92, 78, 68), hi: rgba(210, 110, 88), hi: rgba(210, 110, 88), lo: rgba(100, 42, 34) lo: rgba(100, 42, 34), /** Flat cement cap (no brick bond on tops). */ cement: rgba(168, 160, 152), cementHi: rgba(184, 176, 168), cementLo: rgba(148, 140, 132)};};function cobbleLike (basePal, x, y, role, gritMask)function cobbleLike (basePal, x, y, role, gritMask)@@ -308,17 +312,61 @@ function cobbleLike (basePal, x, y, role, gritMask) return base; return base;}}function brickShade (x, y, role)/** * Brick mortar follows each face: * - T (thick) / N (thin ridge): flat cement cap * - S: running bond elevation * - N (thick bevel): vertical joints along the rim * - W / E: diagonal course marks — outer column 1px below inner */function brickShade (x, y, role, shapePrefix, faceRgba){{ if (role === "O") if (role === "O") { return BRICK.O; } { return BRICK.O; } const row = Math.floor(y / 4); const brickX = x + (row & 1) * 3; const thin = shapePrefix.startsWith("thin"); const onHMortar = (y % 4) === 0; const isCap = role === "T" || (thin && role === "N"); const onVMortar = (brickX % 6) === 0; if (isCap) if (onHMortar || onVMortar) { const h = hash2(x, y); if ((h & 31) === 0) { return BRICK.cementHi; } if ((h & 31) === 1) { return BRICK.cementLo; } return BRICK.cement; } const courseH = 4; const brickW = 6; let onMortar = false; if (role === "W" || role === "E") { const phase = y % courseH; const outer = role === "W" ? !isSameFace(faceRgba, x - 1, y, role, shapePrefix) : !isSameFace(faceRgba, x + 1, y, role, shapePrefix); // Diagonal: ·O then O· on west (outer 1px down); mirrored on east. if (phase === 0) { onMortar = !outer; } else if (phase === 1) { onMortar = outer; } } else if (role === "N") { onMortar = (x % brickW) === 0; } else { const row = Math.floor(y / courseH); const brickX = x + (row & 1) * Math.floor(brickW / 2); onMortar = (y % courseH) === 0 || (brickX % brickW) === 0; } if (onMortar) { return BRICK.mortar; } { return BRICK.mortar; } const h = hash2(x, y); const h = hash2(x + role.charCodeAt(0) * 17, y); if ((h & 15) === 0) if ((h & 15) === 0) { return BRICK.hi; } { return BRICK.hi; } if ((h & 15) === 1) if ((h & 15) === 1)@@ -326,6 +374,16 @@ function brickShade (x, y, role) return BRICK[role] ?? BRICK.T; return BRICK[role] ?? BRICK.T;}}function isSameFace (faceRgba, x, y, role, shapePrefix){ if (x < 0 || y < 0 || x >= SIZE || y >= SIZE || !faceRgba) { return false; } const i = (y * SIZE + x) * 4; if (faceRgba[i + 3] === 0) { return false; } return roleOf(shapePrefix, faceRgba[i]) === role;}function woodMagenta (role)function woodMagenta (role){{ // R≈B, G<R — lightness encodes face. // R≈B, G<R — lightness encodes face.@@ -368,7 +426,7 @@ function cliffShade (x, y, role, shapePrefix) return mulRgb(d, faceLit(role)); return mulRgb(d, faceLit(role));}}function paintPixel (variant, prefix, g, x, y)function paintPixel (variant, prefix, g, x, y, faceRgba = null){{ const role = roleOf(prefix, g); const role = roleOf(prefix, g); if (!role) if (!role)@@ -380,7 +438,7 @@ function paintPixel (variant, prefix, g, x, y) if (variant === "cliff") if (variant === "cliff") { return mulRgb(dirtAt(x, y), lit); } { return mulRgb(dirtAt(x, y), lit); } if (variant === "brick") if (variant === "brick") { return mulRgb(BRICK.T, lit); } { return mulRgb(BRICK.cement, lit); } return mulRgb(COBBLE.T, lit); return mulRgb(COBBLE.T, lit); } } if (variant === "cobble") if (variant === "cobble")@@ -388,7 +446,7 @@ function paintPixel (variant, prefix, g, x, y) if (variant === "smooth") if (variant === "smooth") { return cobbleLike(COBBLE, x, y, role, 31); } { return cobbleLike(COBBLE, x, y, role, 31); } if (variant === "brick") if (variant === "brick") { return brickShade(x, y, role); } { return brickShade(x, y, role, prefix, faceRgba); } if (variant === "wood") if (variant === "wood") { return woodMagenta(role); } { return woodMagenta(role); } if (variant === "cliff") if (variant === "cliff")@@ -406,7 +464,7 @@ function textureMask (rgbaIn, variant, shapePrefix) const i = (y * SIZE + x) * 4; const i = (y * SIZE + x) * 4; if (rgbaIn[i + 3] === 0) if (rgbaIn[i + 3] === 0) { continue; } { continue; } const color = paintPixel(variant, shapePrefix, rgbaIn[i], x, y); const color = paintPixel(variant, shapePrefix, rgbaIn[i], x, y, rgbaIn); out[i] = color[0]; out[i] = color[0]; out[i + 1] = color[1]; out[i + 1] = color[1]; out[i + 2] = color[2]; out[i + 2] = color[2];