feat(sample-v33): 墙面材质统一——墙的一切面(墙顶/E格墙面/南向厚度面)=同一岩块材质,面间只靠明度(100/85/80)+棱线分界,禁平涂新颜色;机检 17/17
This commit is contained in:
1 parent
3a28fe07af
commit
08816a3ead
1 file changed
+17
-25
@@ -563,26 +563,18 @@ def draw_hero_on_board(board, ox, oy, cell, hx, hy, records, digit=None):
|
||||
FACADE_FRAC = 0.55 # E 格立面占比(v3.2 档位候选:0.55/0.80/1.00 三档对比,用户挑档)
|
||||
|
||||
def draw_facade(board, x0, y0, cell):
|
||||
"""v3.1 高墙立面(用户方案:地面格南邻墙 → 南部承接墙面展示,E 格)。
|
||||
南部画墙身:横层理暗砖+檐口阴线;程序化示意,终稿=E 瓦片素材(词表扩展)。"""
|
||||
"""v3.3 E 格墙面(用户方案:地面格南邻墙 → 南部承接墙面展示)。
|
||||
墙面=墙顶同款岩块材质(center 瓦片纹理直接贴,明度 ×0.85 表达垂直面),禁平涂新颜色:
|
||||
北端=墙脚阴线(与地面交界),南端=檐口亮棱(与墙顶交界,受光棱线)。"""
|
||||
d = ImageDraw.Draw(board)
|
||||
fy0 = y0 + int(cell * (1.0 - FACADE_FRAC))
|
||||
# 立面基色=墙顶瓦片实测色(E 与南侧墙顶须读作同一堵墙——采样 center 瓦片顶面区)
|
||||
top = WALLS["center"].convert("RGB").crop((4, 4, 28, 14))
|
||||
px = list(top.getdata())
|
||||
wall_top_rgb = tuple(sum(c[i] for c in px) // len(px) for i in range(3))
|
||||
face = _gd_darkened(wall_top_rgb, 0.16) # 北立面=受光面,略暗于顶面 16% 分层
|
||||
d.rectangle([x0, fy0, x0 + cell, y0 + cell], fill=face)
|
||||
for i in range(3): # 横层理(横条纹,禁竖条纹栅栏感——§3.2 高墙条)
|
||||
ly = fy0 + int((i + 1) * (cell * FACADE_FRAC) / 4.0)
|
||||
d.line([(x0 + 2, ly), (x0 + cell - 2, ly)], fill=_gd_darkened(face, 0.30), width=1)
|
||||
for i in range(2): # 层理错缝竖短线(砖缝)
|
||||
for j in range(3):
|
||||
vx = x0 + 6 + j * 14 + (i * 7)
|
||||
vy0 = fy0 + 5 + i * 11
|
||||
d.line([(vx, vy0), (vx, vy0 + 7)], fill=_gd_darkened(face, 0.34), width=1)
|
||||
d.rectangle([x0, fy0, x0 + cell, fy0 + 1], fill=_gd_darkened(wall_top_rgb, 0.35)) # 口沿(地面与立面交界=檐口阴线)
|
||||
d.rectangle([x0, y0 + cell - 1, x0 + cell, y0 + cell], fill=_gd_darkened(face, 0.30)) # 底缘收头 1px(接墙顶北缘亮棱)
|
||||
wall_top = WALLS["center"].resize((cell, cell), Image.NEAREST)
|
||||
face = wall_top.crop((0, 0, cell, cell - fy0 + y0))
|
||||
face = face.point([min(255, int(i * 0.85)) for i in range(256)] * 3)
|
||||
board.paste(face, (x0, fy0))
|
||||
d.rectangle([x0, fy0, x0 + cell, fy0 + 1], fill=(52, 42, 32)) # 墙脚阴线(地面/墙面交界)
|
||||
d.rectangle([x0, y0 + cell - 3, x0 + cell, y0 + cell - 1],
|
||||
fill=(232, 205, 158)) # 檐口亮棱(墙面/墙顶交界,受光)
|
||||
|
||||
|
||||
def is_facade_cell(gmap, x, y):
|
||||
@@ -591,17 +583,17 @@ def is_facade_cell(gmap, x, y):
|
||||
|
||||
|
||||
def lift_south_lip(tile):
|
||||
"""v3.2:南向墙格(南邻地)瓦片底部 ~40% 立面暗条提亮——(56,45,39) 极暗拉低整格观感,
|
||||
用户指「墙顶面应同色」:顶面本同色(147≈145),观感差系暗条过暗。背光面仍暗于顶面,但不死黑。
|
||||
程序化示意,终稿归瓦片重产(§8.5)。"""
|
||||
"""v3.3:南向墙格(南邻地)底部暗条改为顶面同款材质轻微暗档(×0.80)——
|
||||
同一堵墙的顶面材质全板一致,南向厚度面只差明度,不再两截皮。终稿归瓦片重产(§8.5)。"""
|
||||
im = tile.convert("RGB")
|
||||
w, h = im.size
|
||||
y0 = int(h * 0.60)
|
||||
band = im.crop((0, y0, w, h))
|
||||
lut = [min(255, int(i * 1.75 + 18)) for i in range(256)]
|
||||
band = band.point(lut * 3)
|
||||
top_ref = im.crop((0, 0, w, y0)) # 顶面区材质
|
||||
band_h = h - y0
|
||||
ref = top_ref.resize((w, band_h)) # 顶面纹理拉伸到暗条区(同材质)
|
||||
ref = ref.point([min(255, int(i * 0.80)) for i in range(256)] * 3)
|
||||
out = im.copy()
|
||||
out.paste(band, (0, y0))
|
||||
out.paste(ref, (0, y0))
|
||||
if tile.mode == "RGBA":
|
||||
out.putalpha(tile.split()[3])
|
||||
return out.convert("RGBA")
|
||||
|
||||
Reference in new issue
Block a user