tools
This commit is contained in:
@@ -18,8 +18,8 @@ import sys
|
||||
|
||||
import tiles
|
||||
|
||||
WALK = 1 # a walkable stone-ish row in surfacemat.2da (verify)
|
||||
BLOCK = 7 # a non-walkable row (verify)
|
||||
WALK = 4 # surfacemat.2da row 4 = Stone, walkable (Neverblender wok_Stone)
|
||||
BLOCK = 7 # surfacemat.2da row 7 = Nonwalk, non-walkable (wok_Nonwalk)
|
||||
|
||||
|
||||
def geometry(spec):
|
||||
@@ -71,15 +71,21 @@ def aabb_tree(verts, faces):
|
||||
return nodes
|
||||
|
||||
|
||||
def emit(spec):
|
||||
def aabb_node(spec):
|
||||
"""The `node aabb <ref>_wok ... endnode` block (reused by make_mdl embed)."""
|
||||
verts, faces = geometry(spec)
|
||||
nodes = aabb_tree(verts, faces)
|
||||
name = tiles.resref(spec)
|
||||
L = [f"# {name} walkmesh (ASCII, first-pass) - compile via nwnmdlcomp/cleanmodels",
|
||||
f"node aabb {name}_wok",
|
||||
L = [f"node aabb {name}_wg",
|
||||
f" parent {name}",
|
||||
" position 0.0 0.0 0.0",
|
||||
" orientation 0.0 0.0 0.0 0.0",
|
||||
" bitmap NULL",
|
||||
" ambient 0.0 0.0 0.0",
|
||||
" diffuse 0.0 0.0 0.0",
|
||||
" specular 0.0 0.0 0.0",
|
||||
" render 0",
|
||||
" shadow 0",
|
||||
f" verts {len(verts)}"]
|
||||
L += [f" {v[0]:.5f} {v[1]:.5f} {v[2]:.5f}" for v in verts]
|
||||
L.append(f" faces {len(faces)}")
|
||||
@@ -89,7 +95,13 @@ def emit(spec):
|
||||
L += [f" {mn[0]:.5f} {mn[1]:.5f} {mn[2]:.5f} {mx[0]:.5f} {mx[1]:.5f} {mx[2]:.5f} {fi}"
|
||||
for mn, mx, fi in nodes]
|
||||
L.append("endnode")
|
||||
return name, "\n".join(L) + "\n"
|
||||
return name, L
|
||||
|
||||
|
||||
def emit(spec):
|
||||
name, L = aabb_node(spec)
|
||||
head = f"# {name} walkmesh (ASCII) - compile via nwnmdlcomp/cleanmodels"
|
||||
return name, head + "\n" + "\n".join(L) + "\n"
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user