tools
This commit is contained in:
@@ -32,6 +32,28 @@ COLORS = {
|
||||
}
|
||||
CURB = "MAT_curb_dark_stone"
|
||||
|
||||
# NWN needs a real texture (bitmap) per trimesh; material name -> texture resref
|
||||
# (<=16 chars, prefix eats 6). make_mdl.py writes a solid-colour .tga per entry.
|
||||
TEXTURES = {
|
||||
"MAT_wet_cobble_dark": "twu01_wcob",
|
||||
"MAT_cobble_patch": "twu01_cpat",
|
||||
"MAT_plaza_slab": "twu01_plaz",
|
||||
"MAT_sidewalk_stone": "twu01_swlk",
|
||||
"MAT_curb_dark_stone": "twu01_curb",
|
||||
"MAT_canal_black_water": "twu01_watr",
|
||||
"MAT_void_black": "twu01_void",
|
||||
"MAT_ramp_stone": "twu01_ramp",
|
||||
"MAT_drain_iron": "twu01_iron",
|
||||
"MAT_foundation_pad": "twu01_fnd",
|
||||
"MAT_debug_walkmesh": "twu01_dwlk",
|
||||
"MAT_debug_blocker": "twu01_dblk",
|
||||
}
|
||||
|
||||
|
||||
def texname(mat):
|
||||
return TEXTURES.get(mat, "twu01_wcob")
|
||||
|
||||
|
||||
F, R, C, RP, MX = "FLAT", "RAISED", "CANAL", "RAMP", "MIXED"
|
||||
|
||||
|
||||
@@ -281,6 +303,32 @@ def wok_quads(spec):
|
||||
return [(_rect(-5, 5, -5, 5, 0.0), True)]
|
||||
|
||||
|
||||
# --- visible mesh: subdivided 10x10 plane, faces tagged by material ----------
|
||||
# Same source as build.py's build_vis so the Blender preview and the exported
|
||||
# .mdl never drift. Faces are quads here; make_mdl.py triangulates on emit.
|
||||
|
||||
def vis_geometry(spec):
|
||||
"""Return (verts, faces): 100-quad plane. faces = (a, b, c, d, matname)."""
|
||||
n, step = 10, 1.0
|
||||
paint = make_paint(spec)
|
||||
verts, vidx = [], {}
|
||||
|
||||
def vi(i, j):
|
||||
if (i, j) not in vidx:
|
||||
x, y = -HALF + i * step, -HALF + j * step
|
||||
vidx[(i, j)] = len(verts)
|
||||
verts.append((x, y, height(spec, x, y)))
|
||||
return vidx[(i, j)]
|
||||
|
||||
faces = []
|
||||
for i in range(n):
|
||||
for j in range(n):
|
||||
cx, cy = -HALF + (i + 0.5) * step, -HALF + (j + 0.5) * step
|
||||
faces.append((vi(i, j), vi(i + 1, j), vi(i + 1, j + 1), vi(i, j + 1),
|
||||
paint(cx, cy)))
|
||||
return verts, faces
|
||||
|
||||
|
||||
# --- NWN .set mapping (AGENTS.md §4, §7) -------------------------------------
|
||||
# Minimal, deliberate vocabulary (AGENTS.md §2.1: every terrain pairing multiplies
|
||||
# tile count). Ground tiles all share 'cobble' so they interconnect freely
|
||||
|
||||
Reference in New Issue
Block a user