A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date. Images, audio, models and binaries go through Git LFS (.gitattributes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1132 lines
65 KiB
Python
1132 lines
65 KiB
Python
"""v3 environment: outdoor campus set dressing + upgraded hero props (pallet, pop table, truck, pallet rack).
|
|
Authored in UNITY coordinates through v2's B() helpers (Unity +Z = front, origin = floor centre).
|
|
Run: blender -b --factory-startup --python v3_env.py -- [names]
|
|
"""
|
|
import sys, os
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
from v2 import *
|
|
from v2 import ubox as v2_ubox
|
|
|
|
|
|
# ======================================================================= helpers
|
|
|
|
def V(*a):
|
|
return Vector(a)
|
|
|
|
|
|
def ext(name, pts, mapper, d0, d1, m):
|
|
"""Generic prism: 2D profile pts (a, b) extruded along d0..d1; mapper(a, b, d) -> unity (x, y, z)."""
|
|
bm = bmesh.new()
|
|
f0 = [bm.verts.new(B(*mapper(a, b, d0))) for a, b in pts]
|
|
f1 = [bm.verts.new(B(*mapper(a, b, d1))) for a, b in pts]
|
|
bm.faces.new(f0)
|
|
bm.faces.new(list(reversed(f1)))
|
|
n = len(pts)
|
|
for i in range(n):
|
|
j = (i + 1) % n
|
|
bm.faces.new((f0[i], f0[j], f1[j], f1[i]))
|
|
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
|
|
o = mesh_obj(name, bm)
|
|
set_mats(o, m)
|
|
return o
|
|
|
|
|
|
def seg(name, p0, p1, w, t, m, up=(0, 0, 1), caps=True):
|
|
"""Square-section bar between two unity points (w = width, t = thickness along `up`)."""
|
|
p0, p1 = Vector(p0), Vector(p1)
|
|
a = (p1 - p0).normalized()
|
|
u = Vector(up)
|
|
u = (u - a * u.dot(a))
|
|
if u.length < 1e-6:
|
|
u = Vector((1, 0, 0)) if abs(a.x) < 0.9 else Vector((0, 1, 0))
|
|
u = (u - a * u.dot(a))
|
|
u.normalize()
|
|
v = a.cross(u).normalized()
|
|
bm = bmesh.new()
|
|
cs = [(-1, -1), (1, -1), (1, 1), (-1, 1)]
|
|
r0 = [bm.verts.new(B(*(p0 + v * (sx * w / 2) + u * (sy * t / 2)))) for sx, sy in cs]
|
|
r1 = [bm.verts.new(B(*(p1 + v * (sx * w / 2) + u * (sy * t / 2)))) for sx, sy in cs]
|
|
for i in range(4):
|
|
j = (i + 1) % 4
|
|
bm.faces.new((r0[i], r0[j], r1[j], r1[i]))
|
|
if caps:
|
|
bm.faces.new(list(reversed(r0)))
|
|
bm.faces.new(r1)
|
|
bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
|
|
o = mesh_obj(name, bm)
|
|
set_mats(o, m)
|
|
return o
|
|
|
|
|
|
def ico(name, r, c, m, sub=2, jitter=0.12, seed=0, scale=(1, 1, 1)):
|
|
"""Lumpy low-poly blob (icosphere with radial jitter), unity centre c."""
|
|
rnd = random.Random(seed)
|
|
bm = bmesh.new()
|
|
bmesh.ops.create_icosphere(bm, subdivisions=sub, radius=1.0)
|
|
ph = [rnd.uniform(0, 6.28) for _ in range(3)]
|
|
for vv in bm.verts:
|
|
d = vv.co.normalized()
|
|
k = 1 + jitter * (0.6 * math.sin(3.1 * d.x + ph[0]) * math.sin(2.7 * d.y + ph[1]) + 0.4 * math.sin(4.3 * d.z + ph[2]))
|
|
k += rnd.uniform(-jitter, jitter) * 0.35
|
|
vv.co = d * r * k
|
|
bmesh.ops.scale(bm, vec=Vector((scale[0], scale[2], scale[1])), verts=bm.verts)
|
|
bmesh.ops.translate(bm, vec=Vector(B(*c)), verts=bm.verts)
|
|
o = mesh_obj(name, bm)
|
|
set_mats(o, m)
|
|
return o
|
|
|
|
|
|
def to_unity(co):
|
|
return (-co.x, co.z, -co.y)
|
|
|
|
|
|
PLANKS = [(0.115, 0.24), (0.26, 0.39), (0.41, 0.59), (0.61, 0.737), (0.757, 0.888)]
|
|
|
|
|
|
def uv_board(o, along, plank, vscale=1.0, voff=0.0):
|
|
"""Wood UVs per board: grain (texture V) runs along unity axis `along`; the board's cross axis is fitted
|
|
into one plank strip of T_Wood/T_PalletWood so the painted plank grooves never show on a single board."""
|
|
me = o.data
|
|
bm = bmesh.new()
|
|
bm.from_mesh(me)
|
|
uvl = bm.loops.layers.uv.verify()
|
|
pts = [to_unity(v.co) for v in bm.verts]
|
|
lo = [min(p[i] for p in pts) for i in range(3)]
|
|
hi = [max(p[i] for p in pts) for i in range(3)]
|
|
u0, u1 = PLANKS[plank % len(PLANKS)]
|
|
for f in bm.faces:
|
|
n = to_unity(f.normal)
|
|
k = max(range(3), key=lambda i: abs(n[i]))
|
|
if k == along:
|
|
a, b = [i for i in range(3) if i != k]
|
|
for l in f.loops:
|
|
p = to_unity(l.vert.co)
|
|
l[uvl].uv = (u0 + (p[a] - lo[a]) * 0.6, p[b] * 0.6 + voff)
|
|
continue
|
|
cross = 3 - k - along
|
|
span = max(1e-6, hi[cross] - lo[cross])
|
|
for l in f.loops:
|
|
p = to_unity(l.vert.co)
|
|
u = u0 + (p[cross] - lo[cross]) / span * (u1 - u0)
|
|
l[uvl].uv = (u, p[along] * vscale + voff)
|
|
bm.to_mesh(me)
|
|
bm.free()
|
|
return o
|
|
|
|
|
|
def finalize_keep_uv(parts, name, ang=40):
|
|
o = join(parts, name)
|
|
smooth(o, ang)
|
|
return o
|
|
|
|
|
|
# ======================================================================= 6. SM_Pallet
|
|
|
|
def pallet_v3():
|
|
"""Euro-style block pallet, 1.22 (X) x 1.0 (Z) x 0.144, same envelope as the old one."""
|
|
rnd = random.Random(11)
|
|
P = []
|
|
L, W = 0.61, 0.5
|
|
WD = "M_PalletWood"
|
|
bev = 0.007
|
|
|
|
def board(x0, x1, y0, y1, z0, z1, along):
|
|
b = ubox("board", x0, x1, y0, y1, z0, z1, WD, bevel=bev, segs=1)
|
|
uv_board(b, along, rnd.randrange(5), voff=rnd.uniform(0, 1))
|
|
P.append(b)
|
|
return b
|
|
# bottom boards (run along X)
|
|
for zc, hw in ((-0.44, 0.06), (0.0, 0.0725), (0.44, 0.06)):
|
|
board(-L, L, 0.0, 0.022, zc - hw, zc + hw, 0)
|
|
# 9 blocks
|
|
xs = (-0.555, 0.0, 0.555)
|
|
zs = ((-0.44, 0.06), (0.0, 0.0725), (0.44, 0.06))
|
|
for x in xs:
|
|
hx = 0.055 if x else 0.0725
|
|
for zc, hz in zs:
|
|
za_, zb_ = zc - hz, zc + hz
|
|
if x and zc: # corner blocks sit 3 mm in so the painted stamp stays inside the 1.0 m envelope
|
|
za_, zb_ = (za_ + 0.003, zb_) if zc < 0 else (za_, zb_ - 0.003)
|
|
b = ubox("block", x - hx, x + hx, 0.022, 0.1, za_, zb_, WD, bevel=0.009, segs=1)
|
|
uv_board(b, 2, rnd.randrange(5), voff=rnd.uniform(0, 1))
|
|
P.append(b)
|
|
# stringer (cross) boards along Z
|
|
for x in xs:
|
|
hx = 0.055 if x else 0.0725
|
|
board(x - hx, x + hx, 0.1, 0.122, -W, W, 2)
|
|
# top deck: 5 boards along X with gaps
|
|
tops = ((-0.4275, 0.0725), (-0.215, 0.06), (0.0, 0.0725), (0.215, 0.06), (0.4275, 0.0725))
|
|
for zc, hw in tops:
|
|
board(-L, L, 0.122, 0.144, zc - hw, zc + hw, 0)
|
|
# nail heads (flush-ish, 0.3 mm proud)
|
|
for x in xs:
|
|
for dz in (-hw * 0.5, hw * 0.5):
|
|
P.append(ucyl("nail", 0.0075, 0.0006, (x + rnd.uniform(-0.02, 0.02), 0.1443, zc + dz), "Y", verts=6, m="M_DarkGrey"))
|
|
# stamped corner blocks: painted plate + burnt stamp marks on the outward (+/-Z) faces of the 4 corner blocks
|
|
for x in (-0.555, 0.555):
|
|
for s in (-1, 1):
|
|
zf = s * 0.497 # face of the inset corner block
|
|
P.append(ubox("paint", x - 0.045, x + 0.045, 0.03, 0.092, min(zf, zf + s * 0.0018), max(zf, zf + s * 0.0018), "M_PaintBlue"))
|
|
zs_ = zf + s * 0.0018
|
|
for (ya, yb, xa, xb) in ((0.072, 0.082, -0.03, 0.03), (0.055, 0.063, -0.03, 0.008), (0.04, 0.047, -0.03, 0.02)):
|
|
P.append(ubox("stamp", x + xa, x + xb, ya, yb, min(zs_, zs_ + s * 0.001), max(zs_, zs_ + s * 0.001), "M_PaintWhite"))
|
|
o = finalize_keep_uv(P, "SM_Pallet", ang=35)
|
|
return dict(elev=28, azim=-35)
|
|
|
|
|
|
# ======================================================================= 7. SM_PopTable
|
|
|
|
def pop_table_v3():
|
|
"""Packing table: 2.4 (X) x 1.2 (Z), top surface exactly at y = 0.85."""
|
|
P = []
|
|
L, Wd, T = 1.2, 0.6, 0.85
|
|
top = ubox("top", -L, L, T - 0.075, T, -Wd, Wd, "M_Wood", bevel=0.035, segs=4)
|
|
cut = cube("cut", (2.14, 1.0, 0.2), B(0, T + 0.1 - 0.006, 0))
|
|
mod(top, "BOOLEAN", operation="DIFFERENCE", object=cut, solver="EXACT")
|
|
bake(top)
|
|
bpy.data.objects.remove(cut)
|
|
uv_box(top, 1.0)
|
|
P.append(top)
|
|
mat_ = ubox("mat", -1.07, 1.07, T - 0.012, T, -0.5, 0.5, "M_CuttingMat", bevel=0.004, segs=1)
|
|
uv_face_fit(mat_, lambda f: f.normal.z > 0.9, 0, 1, flip_u=True)
|
|
P.append(mat_)
|
|
# apron under the top
|
|
for s in (-1, 1):
|
|
a = ubox("apron", -1.03, 1.03, T - 0.2, T - 0.075, s * 0.45 - 0.03, s * 0.45 + 0.03, "M_PaintYellow", bevel=0.015, segs=2)
|
|
uv_box(a, 1); P.append(a)
|
|
a = ubox("apron", s * 1.08 - 0.03, s * 1.08 + 0.03, T - 0.2, T - 0.075, -0.42, 0.42, "M_PaintYellow", bevel=0.015, segs=2)
|
|
uv_box(a, 1); P.append(a)
|
|
# legs + levelling feet
|
|
for sx in (-1, 1):
|
|
for sz in (-1, 1):
|
|
x, z = sx * 1.08, sz * 0.48
|
|
lg = ubox("leg", x - 0.05, x + 0.05, 0.07, T - 0.075, z - 0.05, z + 0.05, "M_PaintBlue", bevel=0.02, segs=2)
|
|
uv_box(lg, 1); P.append(lg)
|
|
P.append(ucyl("stem", 0.018, 0.05, (x, 0.05, z), "Y", verts=8, m="M_Metal"))
|
|
P.append(ucyl("foot", 0.06, 0.03, (x, 0.015, z), "Y", verts=14, m="M_Rubber", bevel=0.01))
|
|
P.append(ucyl("cap", 0.052, 0.008, (x, 0.07, z), "Y", verts=12, m="M_DarkGrey"))
|
|
# lower shelf on cross rails
|
|
for s in (-1, 1):
|
|
r = ubox("rail", -1.03, 1.03, 0.18, 0.24, s * 0.48 - 0.025, s * 0.48 + 0.025, "M_PaintBlue", bevel=0.012, segs=1)
|
|
uv_box(r, 1); P.append(r)
|
|
sh = ubox("shelf", -1.03, 1.03, 0.24, 0.27, -0.455, 0.455, "M_Wood", bevel=0.012, segs=2)
|
|
uv_box(sh, 1); P.append(sh)
|
|
for s in (-1, 1):
|
|
lip = ubox("lip", -1.03, 1.03, 0.27, 0.3, s * 0.44 - 0.015, s * 0.44 + 0.015, "M_PaintYellow", bevel=0.01, segs=1)
|
|
uv_box(lip, 1); P.append(lip)
|
|
# stock on the shelf: flattened cardboard stack + a tape gun
|
|
for k in range(4):
|
|
fb = ubox("flat", -0.95 + k * 0.012, -0.25 + k * 0.01, 0.27 + k * 0.022, 0.29 + k * 0.022, -0.36 + k * 0.01, 0.3 - k * 0.012, "M_Cardboard", bevel=0.004, segs=1)
|
|
uv_box(fb, 1); P.append(fb)
|
|
G = []
|
|
gx, gy, gz = 0.55, 0.27, 0.05
|
|
G.append(ucyl("roll", 0.09, 0.05, (gx, gy + 0.14, gz), "X", verts=18, m="M_Tape"))
|
|
G.append(ucyl("core", 0.05, 0.056, (gx, gy + 0.14, gz), "X", verts=14, m="M_Cardboard"))
|
|
G.append(ubox("frame", gx - 0.012, gx + 0.012, gy + 0.03, gy + 0.2, gz - 0.12, gz + 0.13, "M_PaintRed", bevel=0.01, segs=1))
|
|
G.append(ubox("blade", gx - 0.035, gx + 0.035, gy + 0.03, gy + 0.07, gz + 0.11, gz + 0.16, "M_PaintRed", bevel=0.01, segs=1))
|
|
G.append(ubox("teeth", gx - 0.033, gx + 0.033, gy + 0.065, gy + 0.075, gz + 0.14, gz + 0.165, "M_Metal"))
|
|
G.append(utube("handle", [(gx, gy + 0.08, gz - 0.06), (gx, gy + 0.03, gz - 0.14), (gx, gy + 0.015, gz - 0.24)], 0.02, "M_PaintRed", res=3, segs=8))
|
|
G.append(ucyl("grip", 0.026, 0.11, (gx, gy + 0.024, gz - 0.21), "Z", verts=10, m="M_Rubber", bevel=0.008))
|
|
for o in G:
|
|
uv_box(o, 3)
|
|
P.extend(G)
|
|
o = finalize_keep_uv(P, "SM_PopTable", ang=40)
|
|
return dict(elev=30, azim=-35)
|
|
|
|
|
|
# ======================================================================= 8. SM_Truck
|
|
|
|
def wheel_u(name, r, w, c, rim_m="M_PaintWhite", segs=14, side=1, dual=False, nuts=True):
|
|
"""Wheel with tyre, rim, hub cap and lug nuts; axis X, outer face toward side*X."""
|
|
W = []
|
|
if dual: # twin tyres as one body with a groove (background vehicles)
|
|
g = w * 0.06
|
|
prof = [(r * 0.55, -w / 2), (r * 0.96, -w / 2), (r, -w / 2 + w * 0.1), (r, -g), (r * 0.8, 0.0), (r, g), (r, w / 2 - w * 0.1), (r * 0.96, w / 2), (r * 0.55, w / 2)]
|
|
t = revolve("tire", prof, segs=segs, axis="X", close_top=False)
|
|
set_mats(t, "M_Rubber")
|
|
W.append(t)
|
|
W.append(cyl("rim", r * 0.6, w * 0.9, axis="X", verts=segs, m=rim_m))
|
|
W.append(cyl("hub", r * 0.2, w + 0.06, axis="X", verts=8, m="M_DarkGrey"))
|
|
o = join(W, name)
|
|
o.location = B(*c)
|
|
apply_xform(o)
|
|
return o
|
|
prof = [(r * 0.55, -w / 2), (r * 0.96, -w / 2), (r, -w / 2 + w * 0.22), (r, w / 2 - w * 0.22), (r * 0.96, w / 2), (r * 0.55, w / 2)]
|
|
t = revolve("tire", prof, segs=segs, axis="X", close_top=False)
|
|
set_mats(t, "M_Rubber")
|
|
W.append(t)
|
|
W.append(cyl("rim", r * 0.6, w * 0.86, axis="X", verts=segs, m=rim_m))
|
|
W.append(cyl("hub", r * 0.2, w + 0.06, axis="X", verts=8, m="M_DarkGrey"))
|
|
if nuts:
|
|
for k in range(5):
|
|
a = 2 * math.pi * k / 5
|
|
W.append(cyl("nut", 0.026, w * 0.92 + 0.02, loc=(0, r * 0.3 * math.cos(a), r * 0.3 * math.sin(a)), axis="X", verts=4, m="M_DarkGrey"))
|
|
o = join(W, name)
|
|
o.location = B(*c)
|
|
apply_xform(o)
|
|
return o
|
|
|
|
|
|
def truck_v3():
|
|
"""Delivery box truck (same envelope/pivot as the old SM_Truck): cab at +Z, open cargo box toward -Z with
|
|
the two rear doors swung open. Objects: Body, Decals."""
|
|
def ubox(*a, **k): # single-segment bevels keep the truck near the prop budget
|
|
k["segs"] = 1 if k.get("bevel", 0) < 0.2 else 3
|
|
return v2_ubox(*a, **k)
|
|
P = []
|
|
# chassis
|
|
P.append(ubox("chassis", -0.95, 0.95, 0.55, 0.8, -3.35, 3.35, "M_DarkGrey", bevel=0.04))
|
|
for s in (-1, 1):
|
|
P.append(ubox("rail", s * 0.75 - 0.08, s * 0.75 + 0.08, 0.42, 0.62, -3.4, 3.3, "M_DarkGrey", bevel=0.02, segs=1))
|
|
# cab shell
|
|
P.append(ubox("cab", -1.2, 1.2, 0.75, 2.9, 1.75, 3.6, "M_PaintRed", bevel=0.25, segs=4))
|
|
P.append(ubox("roofcap", -1.0, 1.0, 2.86, 2.98, 1.95, 3.3, "M_PaintWhite", bevel=0.05, segs=2))
|
|
P.append(ubox("beacon", -0.2, 0.2, 2.98, 3.06, 2.4, 2.6, "M_PaintOrange", bevel=0.03, segs=2))
|
|
P.append(ubox("windshield", -1.08, 1.08, 1.85, 2.62, 2.9, 3.66, "M_WindowGlass", bevel=0.08, segs=1))
|
|
P.append(ubox("wiper", -0.7, -0.05, 1.86, 1.89, 3.64, 3.68, "M_DarkGrey"))
|
|
P.append(ubox("wiper", 0.1, 0.75, 1.86, 1.89, 3.64, 3.68, "M_DarkGrey"))
|
|
# front: grille, bumper, headlights, indicators, plate
|
|
P.append(ubox("grilleframe", -0.62, 0.62, 0.9, 1.62, 3.55, 3.66, "M_DarkGrey", bevel=0.05, segs=2))
|
|
for k in range(5):
|
|
y = 0.98 + k * 0.12
|
|
P.append(ubox("grillebar", -0.54, 0.54, y, y + 0.06, 3.6, 3.68, "M_Metal"))
|
|
P.append(ubox("bumper", -1.25, 1.25, 0.55, 0.88, 3.5, 3.75, "M_DarkGrey", bevel=0.08, segs=3))
|
|
P.append(ubox("bumperstrip", -1.15, 1.15, 0.7, 0.76, 3.7, 3.755, "M_PaintYellow"))
|
|
P.append(ubox("plate", -0.25, 0.25, 0.6, 0.72, 3.7, 3.752, "M_PaintWhite", bevel=0.01, segs=1))
|
|
for s in (-1, 1):
|
|
x = s * 0.88
|
|
P.append(ucyl("hlhouse", 0.2, 0.08, (x, 1.25, 3.6), "Z", verts=14, m="M_Metal"))
|
|
P.append(ucyl("hl", 0.15, 0.04, (x, 1.25, 3.645), "Z", verts=14, m="M_Emissive"))
|
|
P.append(ubox("ind", x - 0.12 * s - 0.07, x - 0.12 * s + 0.07, 0.96, 1.03, 3.58, 3.66, "M_PaintOrange", bevel=0.015, segs=1))
|
|
P.append(ubox("fog", s * 0.85 - 0.09, s * 0.85 + 0.09, 0.66, 0.78, 3.72, 3.75, "M_Emissive", bevel=0.01, segs=1))
|
|
# side windows, door seam, handle
|
|
P.append(ubox("sidewin", s * 1.21 - 0.02, s * 1.21 + 0.02, 1.7, 2.5, 2.2, 3.1, "M_WindowGlass", bevel=0.05, segs=1))
|
|
P.append(ubox("doorline", s * 1.22 - 0.025, s * 1.22 + 0.025, 0.9, 2.55, 2.86, 2.9, "M_DarkGrey"))
|
|
P.append(ubox("doorline", s * 1.22 - 0.025, s * 1.22 + 0.025, 0.9, 2.55, 1.93, 1.97, "M_DarkGrey"))
|
|
P.append(ubox("handle", s * 1.23 - 0.03, s * 1.23 + 0.03, 1.55, 1.6, 2.05, 2.3, "M_Metal", bevel=0.012, segs=1))
|
|
# mirror on an arm
|
|
P.append(utube("marm", [(s * 1.18, 2.15, 3.2), (s * 1.42, 2.2, 3.25), (s * 1.48, 2.35, 3.2)], 0.025, "M_DarkGrey", res=3, segs=6))
|
|
P.append(ubox("mirror", s * 1.42 - 0.07, s * 1.42 + 0.07, 1.95, 2.5, 3.1, 3.22, "M_DarkGrey", bevel=0.04, segs=2))
|
|
P.append(ubox("mglass", s * 1.42 - 0.055, s * 1.42 + 0.055, 1.99, 2.46, 3.09, 3.1, "M_WindowGlass"))
|
|
# cab steps
|
|
for k, y in enumerate((0.45, 0.72)):
|
|
P.append(ubox("step", s * (1.06 + 0.04 * k) - 0.13, s * (1.06 + 0.04 * k) + 0.13, y, y + 0.05, 2.0, 2.5, "M_Metal", bevel=0.015, segs=1))
|
|
P.append(ubox("stepbr", s * 1.12 - 0.02, s * 1.12 + 0.02, 0.45, 0.8, 2.47, 2.52, "M_DarkGrey"))
|
|
# fuel tank + exhaust
|
|
P.append(ucyl("tank", 0.24, 0.8, (s * 0.98, 0.72, 0.9), "Z", verts=12, m="M_Metal"))
|
|
for zz in (0.62, 1.18):
|
|
P.append(ucyl("strap", 0.25, 0.04, (s * 0.98, 0.72, zz), "Z", verts=12, m="M_DarkGrey", cap=False))
|
|
P.append(ucyl("exhaust", 0.07, 1.5, (-1.02, 2.0, 1.66), "Y", verts=10, m="M_Metal"))
|
|
P.append(ucyl("exhcap", 0.085, 0.12, (-1.02, 2.78, 1.66), "Y", verts=10, m="M_DarkGrey"))
|
|
# cargo box (open toward -Z)
|
|
x0, x1, z0, z1, y0, y1 = -1.25, 1.25, -3.5, 1.6, 0.85, 3.5
|
|
t = 0.08
|
|
P.append(ubox("front", x0, x1, y0, y1, z1 - t, z1, "M_PaintWhite", bevel=0.04))
|
|
P.append(ubox("left", x0, x0 + t, y0, y1, z0, z1, "M_PaintWhite", bevel=0.04))
|
|
P.append(ubox("right", x1 - t, x1, y0, y1, z0, z1, "M_PaintWhite", bevel=0.04))
|
|
P.append(ubox("roof", x0, x1, y1 - t, y1, z0, z1, "M_PaintWhite", bevel=0.04))
|
|
P.append(ubox("floor", x0, x1, y0, y0 + t, z0, z1, "M_Wood", bevel=0.02))
|
|
for s in (-1, 1):
|
|
P.append(ubox("stripe", s * 1.25 - 0.01, s * 1.25 + 0.01, 1.05, 1.25, z0 + 0.1, z1 - 0.1, "M_PaintBlue"))
|
|
P.append(ubox("stripe2", s * 1.25 - 0.01, s * 1.25 + 0.01, 1.3, 1.37, z0 + 0.1, z1 - 0.1, "M_PaintYellow"))
|
|
for zz in (z1 - 0.04,):
|
|
P.append(ubox("rib", s * 1.25 - 0.02, s * 1.25 + 0.02, y0, y1, zz - 0.04, zz + 0.04, "M_PaintWhite", bevel=0.015, segs=1))
|
|
P.append(ubox("skirt", s * 1.0 - 0.02, s * 1.0 + 0.02, 0.62, 0.85, -0.9, 0.95, "M_DarkGrey"))
|
|
P.append(ubox("marker", s * 1.26 - 0.01, s * 1.26 + 0.01, 0.95, 1.01, -1.2, -1.08, "M_PaintOrange"))
|
|
# roof edge trim + cargo interior straps
|
|
for s in (-1, 1):
|
|
P.append(ubox("roofedge", s * 1.25 - 0.03, s * 1.25 + 0.03, y1 - 0.06, y1 + 0.02, z0, z1, "M_DarkGrey", bevel=0.01, segs=1))
|
|
for k in range(3):
|
|
P.append(ubox("strapline", s * 1.165 - 0.006, s * 1.165 + 0.006, 1.5 + k * 0.6, 1.53 + k * 0.6, z0 + 0.1, z1 - 0.15, "M_Metal"))
|
|
# rear frame, posts, tail lights, step
|
|
P.append(ubox("rearframe", x0 - 0.04, x1 + 0.04, y1 - 0.15, y1 + 0.02, z0 - 0.04, z0 + 0.06, "M_DarkGrey", bevel=0.02))
|
|
P.append(ubox("rearsill", x0 - 0.04, x1 + 0.04, y0 - 0.08, y0 + 0.1, z0 - 0.04, z0 + 0.06, "M_DarkGrey", bevel=0.02))
|
|
for s in (-1, 1):
|
|
P.append(ubox("post", s * 1.25 - 0.06, s * 1.25 + 0.06, y0, y1, z0 - 0.04, z0 + 0.06, "M_DarkGrey", bevel=0.02))
|
|
P.append(ubox("tail", s * 1.0 - 0.14, s * 1.0 + 0.14, 0.62, 0.78, z0 - 0.08, z0 - 0.02, "M_PaintRed", bevel=0.02, segs=1))
|
|
P.append(ubox("tailamber", s * 0.8 - 0.06, s * 0.8 + 0.06, 0.62, 0.78, z0 - 0.08, z0 - 0.02, "M_PaintOrange", bevel=0.02, segs=1))
|
|
# open doors swung 160 deg around hinges at x = +-1.32
|
|
d = ubox("door", -0.02 - 1.2, -0.02, y0 + 0.05, y1 - 0.08, -0.04, 0.04, "M_PaintWhite", bevel=0.03)
|
|
dd = [ubox("dbar", -0.75, -0.69, y0 + 0.1, y1 - 0.12, 0.04, 0.07, "M_Metal", bevel=0.01, segs=1),
|
|
ubox("dbar", -0.35, -0.29, y0 + 0.1, y1 - 0.12, 0.04, 0.07, "M_Metal", bevel=0.01, segs=1),
|
|
ubox("dhandle", -0.8, -0.24, 1.75, 1.8, 0.07, 0.1, "M_Metal", bevel=0.01, segs=1)]
|
|
for o in [d] + dd:
|
|
# build the right (+X) door in local space hinge at origin pointing -X, mirror for left
|
|
if s < 0:
|
|
o.scale = (-1, 1, 1)
|
|
apply_xform(o)
|
|
bm = bmesh.new(); bm.from_mesh(o.data); bmesh.ops.reverse_faces(bm, faces=bm.faces); bm.to_mesh(o.data); bm.free()
|
|
o.rotation_euler = (0, 0, math.radians(160 * s))
|
|
o.location = B(s * 1.32, 0, z0 - 0.02)
|
|
apply_xform(o)
|
|
P.append(o)
|
|
P.append(ubox("step", -0.9, 0.9, 0.6, 0.72, z0 - 0.3, z0 + 0.05, "M_DarkGrey", bevel=0.03))
|
|
for k in range(4):
|
|
P.append(ubox("tread", -0.85 + k * 0.45, -0.6 + k * 0.45, 0.72, 0.735, z0 - 0.28, z0 + 0.0, "M_Metal"))
|
|
# wheels, fenders, mud flaps
|
|
for s in (-1, 1):
|
|
for zz, dual in ((2.6, False), (-1.6, True), (-2.75, True)):
|
|
P.append(wheel_u("w", 0.5, 0.36, (s * 1.0, 0.5, zz), side=s, nuts=zz > 0))
|
|
P.append(ubox("fender", s * 1.18 - 0.05, s * 1.18 + 0.05, 1.0, 1.08, 1.95, 3.25, "M_DarkGrey", bevel=0.02))
|
|
P.append(ubox("fender", s * 1.18 - 0.05, s * 1.18 + 0.05, 1.0, 1.08, -3.37, -0.97, "M_DarkGrey", bevel=0.02))
|
|
for zz in (1.95, -3.4):
|
|
P.append(ubox("flap", s * 1.0 - 0.2, s * 1.0 + 0.2, 0.12, 0.85, zz - 0.02, zz + 0.0, "M_Rubber", bevel=0.008, segs=1))
|
|
P.append(ubox("flapbar", s * 1.0 - 0.2, s * 1.0 + 0.2, 0.8, 0.86, zz - 0.035, zz + 0.0, "M_Metal"))
|
|
body = join(P, "Body")
|
|
uv_box(body, 1)
|
|
smooth(body, 40)
|
|
# branded side panels (sign texture), same placement as before
|
|
for s, nm in ((1, "LogoR"), (-1, "LogoL")):
|
|
x = s * 1.262
|
|
za, zb, ya, yb = -2.65, 0.65, 1.25, 3.45
|
|
if s > 0: # +X side: viewer looks -X, U grows toward +Z
|
|
q = quad(nm, [(x, ya, za), (x, ya, zb), (x, yb, zb), (x, yb, za)], [(0, 0), (1, 0), (1, 1), (0, 1)], "M_Sign")
|
|
else: # -X side: U grows toward -Z
|
|
q = quad(nm, [(x, ya, zb), (x, ya, za), (x, yb, za), (x, yb, zb)], [(0, 0), (1, 0), (1, 1), (0, 1)], "M_Sign")
|
|
face_toward(q, (s, 0, 0))
|
|
join([o for o in bpy.context.scene.objects if o.name.startswith("Logo")], "Decals")
|
|
return dict(elev=20, azim=-150)
|
|
|
|
|
|
# ======================================================================= 9. SM_PalletRack
|
|
|
|
def pallet_rack_v3():
|
|
"""2.8 x 1.1 bay, deck tops at 1.45 / 2.85 / 4.25 (unchanged). Blue frames, orange beams, wire decks."""
|
|
P = []
|
|
W, D, HH = 2.8, 1.1, 4.3
|
|
decks = (1.45, 2.85, 4.25)
|
|
FR, BM = "M_PaintBlue", "M_PaintOrange"
|
|
for sx in (-1, 1):
|
|
for sz in (-1, 1):
|
|
x, z = sx * W / 2, sz * D / 2
|
|
P.append(ubox("up", x - 0.045, x + 0.045, 0, HH, z - 0.045, z + 0.045, FR, bevel=0.012, segs=1))
|
|
P.append(ubox("foot", x - 0.08, x + 0.08, 0, 0.02, z - 0.08, z + 0.08, "M_DarkGrey"))
|
|
for (bx_, bz_) in ((x - 0.055, z - 0.055), (x + 0.055, z + 0.055)):
|
|
P.append(ucyl("anchor", 0.012, 0.03, (bx_, 0.03, bz_), "Y", verts=6, m="M_Metal"))
|
|
# punched slots on the aisle-facing faces of the uprights
|
|
fz = z + sz * 0.0455
|
|
for k in range(int((HH - 0.25) / 0.1)):
|
|
y = 0.2 + k * 0.1
|
|
zq = fz + sz * 0.001
|
|
q = quad("slot", [(x - 0.012, y, zq), (x + 0.012, y, zq), (x + 0.012, y + 0.045, zq), (x - 0.012, y + 0.045, zq)], [(0, 0), (1, 0), (1, 1), (0, 1)], "M_DarkGrey")
|
|
face_toward(q, (0, 0, sz))
|
|
P.append(q)
|
|
# column protector at the foot (yellow with a dark band)
|
|
pr = ubox("guard", x - 0.075, x + 0.075, 0.02, 0.42, z - 0.075, z + 0.075, "M_PaintYellow", bevel=0.03, segs=2)
|
|
P.append(pr)
|
|
P.append(ubox("gband", x - 0.077, x + 0.077, 0.2, 0.28, z - 0.077, z + 0.077, "M_DarkGrey", bevel=0.02, segs=1))
|
|
zs = [0.25 + i * 0.6 for i in range(7)]
|
|
for i in range(len(zs) - 1):
|
|
a = (sx * W / 2, zs[i], -D / 2 if i % 2 == 0 else D / 2)
|
|
b = (sx * W / 2, zs[i + 1], D / 2 if i % 2 == 0 else -D / 2)
|
|
P.append(utube("br", [a, b], 0.018, FR, res=1, segs=4))
|
|
for y in (0.25, HH - 0.12):
|
|
P.append(utube("hb", [(sx * W / 2, y, -D / 2), (sx * W / 2, y, D / 2)], 0.02, FR, res=1, segs=4))
|
|
for sz in (-1, 1):
|
|
P.append(ubox("beam0", -W / 2, W / 2, 0.1, 0.2, sz * D / 2 - 0.035, sz * D / 2 + 0.035, BM, bevel=0.015, segs=1))
|
|
for d in decks:
|
|
top = d
|
|
for sz in (-1, 1):
|
|
zc = sz * D / 2
|
|
P.append(ubox("beam", -W / 2 + 0.045, W / 2 - 0.045, top - 0.15, top - 0.03, zc - 0.035, zc + 0.035, BM, bevel=0.015, segs=1))
|
|
for sx in (-1, 1): # end connectors
|
|
P.append(ubox("conn", sx * (W / 2 - 0.07) - 0.025, sx * (W / 2 - 0.07) + 0.025, top - 0.17, top - 0.01, zc - 0.04, zc + 0.04, "M_DarkGrey", bevel=0.006, segs=1))
|
|
if sz > 0: # location labels on the aisle side
|
|
for k, lx in enumerate((-0.7, 0.7)):
|
|
zf = zc + 0.035
|
|
P.append(ubox("label", lx - 0.11, lx + 0.11, top - 0.13, top - 0.05, zf, zf + 0.004, "M_PaintWhite"))
|
|
P.append(ubox("code", lx - 0.085, lx + 0.02, top - 0.105, top - 0.075, zf + 0.004, zf + 0.006, "M_DarkGrey"))
|
|
P.append(ubox("tag", lx + 0.035, lx + 0.09, top - 0.115, top - 0.065, zf + 0.004, zf + 0.006, "M_PaintBlue" if k else "M_PaintRed"))
|
|
# wire-mesh decks: two panels per level, top flush with the deck height
|
|
for (xa, xb) in ((-W / 2 + 0.05, -0.01), (0.01, W / 2 - 0.05)):
|
|
za, zb = -D / 2 - 0.03, D / 2 + 0.03
|
|
# support channels across the depth (under the mesh)
|
|
for xc in (xa + 0.12, (xa + xb) / 2, xb - 0.12):
|
|
P.append(ubox("chan", xc - 0.02, xc + 0.02, top - 0.045, top - 0.012, za + 0.02, zb - 0.02, "M_Metal"))
|
|
# perimeter + waterfall lips over the beams
|
|
for zz in (za, zb):
|
|
P.append(seg("edge", (xa, top - 0.006, zz), (xb, top - 0.006, zz), 0.012, 0.012, "M_Metal", up=(0, 1, 0)))
|
|
P.append(seg("lip", (xa, top - 0.006, zz), (xb, top - 0.006, zz), 0.012, 0.012, "M_Metal", up=(0, 1, 0)))
|
|
for xx in (xa, xb):
|
|
P.append(seg("edge", (xx, top - 0.006, za), (xx, top - 0.006, zb), 0.012, 0.012, "M_Metal", up=(0, 1, 0)))
|
|
n = int((xb - xa) / 0.1)
|
|
for k in range(1, n + 1):
|
|
xx = xa + (xb - xa) * k / (n + 1)
|
|
P.append(seg("wz", (xx, top - 0.009, za), (xx, top - 0.009, zb), 0.006, 0.006, "M_Metal", up=(0, 1, 0), caps=False))
|
|
m = int((zb - za) / 0.1)
|
|
for k in range(1, m + 1):
|
|
zz = za + (zb - za) * k / (m + 1)
|
|
P.append(seg("wx", (xa, top - 0.003, zz), (xb, top - 0.003, zz), 0.006, 0.006, "M_Metal", up=(0, 1, 0), caps=False))
|
|
finalize(P, "SM_PalletRack")
|
|
return dict(elev=18, azim=-30)
|
|
|
|
|
|
# ======================================================================= 1. Fence
|
|
|
|
def env_fence():
|
|
P = []
|
|
X0, X1 = -2.0, 2.0
|
|
y0, y1 = 0.07, 2.05
|
|
for x in (X0, X1):
|
|
P.append(ucyl("post", 0.045, 2.12, (x, 1.06, 0), "Y", verts=10, m="M_Metal"))
|
|
P.append(ucyl("cap", 0.055, 0.04, (x, 2.13, 0), "Y", verts=10, m="M_DarkGrey"))
|
|
P.append(ucyl("footing", 0.11, 0.06, (x, 0.03, 0), "Y", verts=10, m="M_Concrete"))
|
|
# barbed-wire extension arm leaning outward (-Z)
|
|
P.append(seg("arm", (x, 2.05, 0), (x, 2.4, -0.33), 0.03, 0.03, "M_DarkGrey"))
|
|
P.append(ucyl("toprail", 0.03, X1 - X0, (0, y1 + 0.01, 0), "X", verts=8, m="M_Metal"))
|
|
P.append(ucyl("botwire", 0.01, X1 - X0, (0, y0, 0), "X", verts=6, m="M_Metal"))
|
|
# chain link diamonds: two families of 45-degree bars clipped to the panel
|
|
xa, xb = X0 + 0.045, X1 - 0.045
|
|
sp = 0.2
|
|
for fam in (1, -1):
|
|
c = -8.0
|
|
while c < 8.0:
|
|
# line: x = fam * y + c
|
|
if fam > 0:
|
|
ya, yb = max(y0, xa - c), min(y1, xb - c)
|
|
else:
|
|
ya, yb = max(y0, c - xb), min(y1, c - xa)
|
|
if yb - ya > 0.02:
|
|
p0 = (fam * ya + c, ya, 0.0)
|
|
p1 = (fam * yb + c, yb, 0.0)
|
|
P.append(seg("link", p0, p1, 0.011, 0.011, "M_Metal", up=(0, 0, 1), caps=False))
|
|
c += sp
|
|
# barbed wire strands + barbs
|
|
for k, t in enumerate((0.33, 0.66, 1.0)):
|
|
y, z = 2.05 + 0.35 * t, -0.33 * t
|
|
P.append(ucyl("strand", 0.006, X1 - X0, (0, y, z), "X", verts=5, m="M_DarkGrey"))
|
|
x = X0 + 0.12 + k * 0.08
|
|
while x < X1 - 0.1:
|
|
P.append(seg("barb", (x - 0.025, y - 0.025, z), (x + 0.025, y + 0.025, z), 0.006, 0.006, "M_DarkGrey", caps=False))
|
|
P.append(seg("barb", (x, y, z - 0.025), (x, y, z + 0.025), 0.006, 0.006, "M_DarkGrey", up=(1, 0, 0), caps=False))
|
|
x += 0.28
|
|
finalize(P, "SM_Env_Fence", uv=1.0, ang=50)
|
|
return dict(elev=12, azim=-25)
|
|
|
|
|
|
# ======================================================================= 2. Trees / bush
|
|
|
|
def trunk(P, h, r0, r1, branches=(), seed=0):
|
|
P.append(revolve("trunk", [(r0 * 1.35, 0.0), (r0, 0.35), (r0 * 0.85, h * 0.5), (r1, h)], segs=10, m="M_Bark", axis="Z", close_top=True))
|
|
for (p0, p1, rr) in branches:
|
|
P.append(utube("branch", [p0, ((p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 + 0.2, (p0[2] + p1[2]) / 2), p1], rr, "M_Bark", res=3, segs=8))
|
|
|
|
|
|
def tree_a():
|
|
P = []
|
|
trunk(P, 4.6, 0.4, 0.2, branches=[((0, 3.0, 0), (1.3, 4.4, 0.4), 0.11), ((0, 3.4, 0), (-1.2, 4.6, -0.5), 0.1), ((0, 3.8, 0), (0.2, 4.9, -1.2), 0.09)])
|
|
blobs = [((0.0, 5.6, 0.0), 2.2, "M_Leaves"), ((1.7, 4.9, 0.5), 1.55, "M_Leaves"), ((-1.6, 5.0, -0.4), 1.6, "M_LeavesDark"),
|
|
((0.3, 5.0, -1.5), 1.5, "M_LeavesDark"), ((-0.4, 4.8, 1.5), 1.45, "M_Leaves"), ((0.4, 7.0, 0.2), 1.35, "M_Leaves")]
|
|
for i, (c, r, m) in enumerate(blobs):
|
|
P.append(ico("crown", r, c, m, sub=3, jitter=0.1, seed=i + 1, scale=(1, 0.9, 1)))
|
|
o = finalize(P, "SM_Env_Tree_A", uv=1.0, ang=70)
|
|
return dict(elev=12, azim=-30)
|
|
|
|
|
|
def tree_b():
|
|
P = []
|
|
trunk(P, 6.5, 0.26, 0.12, branches=[((0, 2.6, 0), (0.9, 3.4, 0.3), 0.08)])
|
|
blobs = [((0.0, 3.6, 0.0), 1.85, "M_LeavesDark"), ((0.3, 5.0, -0.2), 1.6, "M_LeavesDark"), ((-0.2, 6.3, 0.15), 1.3, "M_Leaves"),
|
|
((0.1, 7.4, 0.0), 0.95, "M_Leaves"), ((1.2, 4.1, 0.6), 1.0, "M_Leaves"), ((-1.1, 4.6, -0.5), 1.0, "M_LeavesDark")]
|
|
for i, (c, r, m) in enumerate(blobs):
|
|
P.append(ico("crown", r, c, m, sub=3, jitter=0.09, seed=20 + i, scale=(1, 1.15, 1)))
|
|
o = finalize(P, "SM_Env_Tree_B", uv=1.0, ang=70)
|
|
return dict(elev=12, azim=-30)
|
|
|
|
|
|
def bush():
|
|
P = []
|
|
blobs = [((0.0, 0.6, 0.0), 0.62, "M_Leaves"), ((0.55, 0.45, 0.2), 0.45, "M_LeavesDark"), ((-0.5, 0.45, -0.15), 0.48, "M_Leaves"),
|
|
((0.1, 0.42, -0.5), 0.42, "M_LeavesDark"), ((-0.15, 0.4, 0.5), 0.4, "M_Leaves")]
|
|
for i, (c, r, m) in enumerate(blobs):
|
|
P.append(ico("blob", r, c, m, sub=2, jitter=0.12, seed=40 + i))
|
|
o = finalize(P, "SM_Env_Bush", uv=1.0, ang=70)
|
|
# sit on the ground
|
|
bpy.context.view_layer.update()
|
|
mnz = min((o.matrix_world @ Vector(c)).z for c in o.bound_box)
|
|
o.data.transform(Matrix.Translation((0, 0, -mnz - 0.05)))
|
|
return dict(elev=20, azim=-30)
|
|
|
|
|
|
# ======================================================================= 3. Container
|
|
|
|
def env_container():
|
|
HW, HT, HL = 1.22, 2.59, 3.03
|
|
B_ = []
|
|
T_ = []
|
|
# inner core (hidden mostly)
|
|
B_.append(ubox("core", -HW + 0.06, HW - 0.06, 0.12, HT - 0.1, -HL + 0.06, HL - 0.08, "M_PaintRed"))
|
|
# corrugated long sides: trapezoid profile along Z, extruded along Y
|
|
def corr_profile(a0, a1, pitch, depth, base):
|
|
pts = []
|
|
n = int((a1 - a0) / pitch)
|
|
pitch = (a1 - a0) / n
|
|
for i in range(n):
|
|
a = a0 + i * pitch
|
|
pts += [(a, base), (a + pitch * 0.18, base + depth), (a + pitch * 0.5, base + depth), (a + pitch * 0.68, base)]
|
|
pts.append((a1, base))
|
|
pts.append((a1, base - 0.03))
|
|
pts.append((a0, base - 0.03))
|
|
return pts
|
|
for s in (-1, 1):
|
|
pts = corr_profile(-HL + 0.12, HL - 0.12, 0.28, 0.04, HW - 0.08)
|
|
B_.append(ext("side", pts, lambda a, b, d, s=s: (s * b, d, a), 0.2, HT - 0.17, "M_PaintRed"))
|
|
# back end (-Z): corrugation along X
|
|
pts = corr_profile(-HW + 0.12, HW - 0.12, 0.3, 0.035, HL - 0.08)
|
|
B_.append(ext("back", pts, lambda a, b, d: (a, d, -b), 0.2, HT - 0.17, "M_PaintRed"))
|
|
# roof: shallow transverse ribs
|
|
pts = corr_profile(-HL + 0.1, HL - 0.1, 0.5, 0.025, HT - 0.1)
|
|
B_.append(extrude_poly("roof", pts, "ZY", -HW + 0.08, HW - 0.08, "M_PaintRed"))
|
|
# doors (+Z), recessed behind the corner castings
|
|
zd = HL - 0.12
|
|
for s in (-1, 1):
|
|
xa, xb = (0.008, HW - 0.1) if s > 0 else (-HW + 0.1, -0.008)
|
|
B_.append(ubox("door", xa, xb, 0.2, HT - 0.17, zd - 0.03, zd, "M_PaintRed", bevel=0.01, segs=1))
|
|
for k in range(4):
|
|
y = 0.55 + k * 0.5
|
|
B_.append(ubox("drib", xa + 0.06, xb - 0.06, y, y + 0.22, zd, zd + 0.02, "M_PaintRed", bevel=0.008, segs=1))
|
|
# ---- trim: corner posts, rails, castings, lock bars
|
|
DG = "M_DarkGrey"
|
|
for sx in (-1, 1):
|
|
for sz in (-1, 1):
|
|
x, z = sx * (HW - 0.08), sz * (HL - 0.08)
|
|
T_.append(ubox("cpost", x - 0.075, x + 0.075, 0.1, HT - 0.1, z - 0.075, z + 0.075, DG, bevel=0.01, segs=1))
|
|
for y in (0.0, HT - 0.12):
|
|
T_.append(ubox("casting", sx * HW - (0.18 if sx > 0 else 0), sx * HW + (0.18 if sx < 0 else 0), y, y + 0.12,
|
|
sz * HL - (0.18 if sz > 0 else 0), sz * HL + (0.18 if sz < 0 else 0), DG, bevel=0.012, segs=1))
|
|
# oval holes (darker inset)
|
|
T_.append(ubox("hole", x - 0.04, x + 0.04, y + 0.035, y + 0.085, sz * HL - 0.001 if sz > 0 else sz * HL - 0.0, sz * HL + 0.001 if sz < 0 else sz * HL + 0.0, "M_Rubber"))
|
|
for y0_, y1_ in ((0.0, 0.2), (HT - 0.17, HT - 0.02)):
|
|
T_.append(ubox("srail", sx * HW - (0.1 if sx > 0 else -0.0), sx * HW + (0.1 if sx < 0 else 0.0), y0_, y1_, -HL + 0.17, HL - 0.17, DG, bevel=0.01, segs=1))
|
|
for sz in (-1, 1):
|
|
for y0_, y1_ in ((0.0, 0.2), (HT - 0.2, HT - 0.02)):
|
|
T_.append(ubox("erail", -HW + 0.17, HW - 0.17, y0_, y1_, sz * HL - (0.1 if sz > 0 else 0), sz * HL + (0.1 if sz < 0 else 0), DG, bevel=0.01, segs=1))
|
|
# forklift pockets
|
|
for s in (-1, 1):
|
|
for zc in (-0.6, 0.6):
|
|
T_.append(ubox("pocket", s * HW - (0.02 if s > 0 else 0), s * HW + (0.02 if s < 0 else 0), 0.03, 0.14, zc - 0.17, zc + 0.17, "M_Rubber"))
|
|
# door hardware
|
|
zb = zd + 0.045
|
|
for s in (-1, 1):
|
|
for xb_ in (s * 0.3, s * 0.85):
|
|
T_.append(ucyl("lockbar", 0.025, HT - 0.42, (xb_, HT / 2 - 0.02, zb), "Y", verts=8, m=DG))
|
|
for y in (0.27, HT - 0.27):
|
|
T_.append(ubox("keeper", xb_ - 0.05, xb_ + 0.05, y - 0.05, y + 0.05, zd, zb + 0.03, DG, bevel=0.01, segs=1))
|
|
T_.append(ubox("hbrk", xb_ - 0.04, xb_ + 0.04, 1.1, 1.18, zd, zb, DG))
|
|
T_.append(utube("lever", [(xb_, 1.15, zb + 0.02), (xb_ + s * 0.12, 1.08, zb + 0.05), (xb_ + s * 0.3, 1.0, zb + 0.05)], 0.018, DG, res=2, segs=6))
|
|
for y in (0.45, 1.3, 2.15):
|
|
T_.append(ucyl("hinge", 0.03, 0.14, (s * (HW - 0.14), y, zd + 0.01), "Y", verts=8, m=DG))
|
|
b = finalize(B_, "Body", uv=0.5, ang=35)
|
|
t = finalize(T_, "Trim", uv=1.0, ang=35)
|
|
return dict(elev=20, azim=-150)
|
|
|
|
|
|
# ======================================================================= 4. Buildings
|
|
|
|
def window_grid(P, face, u0, u1, ys, w, h, pitch, depth=0.06, lit=0.18, seed=0, frame=True):
|
|
"""Punched windows on a facade. face: ('+Z', z) / ('-Z', z) / ('+X', x) / ('-X', x)."""
|
|
rnd = random.Random(seed)
|
|
side, plane = face
|
|
n = int((u1 - u0) / pitch)
|
|
off = (u1 - u0 - n * pitch) / 2
|
|
for y in ys:
|
|
for i in range(n):
|
|
u = u0 + off + (i + 0.5) * pitch
|
|
m = "M_Emissive" if rnd.random() < lit else "M_WindowGlass"
|
|
s = 1 if side[0] == "+" else -1
|
|
if side[1] == "Z":
|
|
P.append(ubox("win", u - w / 2, u + w / 2, y, y + h, plane + (0 if s > 0 else -depth), plane + (depth if s > 0 else 0), m))
|
|
if frame:
|
|
P.append(ubox("sill", u - w / 2 - 0.1, u + w / 2 + 0.1, y - 0.12, y, plane + (0 if s > 0 else -depth - 0.08), plane + (depth + 0.08 if s > 0 else 0), "M_PaintWhite"))
|
|
else:
|
|
P.append(ubox("win", plane + (0 if s > 0 else -depth), plane + (depth if s > 0 else 0), y, y + h, u - w / 2, u + w / 2, m))
|
|
if frame:
|
|
P.append(ubox("sill", plane + (0 if s > 0 else -depth - 0.08), plane + (depth + 0.08 if s > 0 else 0), y - 0.12, y, u - w / 2 - 0.1, u + w / 2 + 0.1, "M_PaintWhite"))
|
|
|
|
|
|
def hvac(P, x, y, z, w=3.0, d=2.0, h=1.4, fans=2):
|
|
P.append(ubox("hvac", x - w / 2, x + w / 2, y, y + h, z - d / 2, z + d / 2, "M_PaintWhite", bevel=0.08, segs=1))
|
|
P.append(ubox("hvacbase", x - w / 2 - 0.1, x + w / 2 + 0.1, y - 0.15, y, z - d / 2 - 0.1, z + d / 2 + 0.1, "M_DarkGrey"))
|
|
for k in range(fans):
|
|
fx = x - w / 2 + w * (k + 0.5) / fans
|
|
P.append(ucyl("fan", min(w / fans, d) * 0.36, 0.12, (fx, y + h + 0.03, z), "Y", verts=14, m="M_DarkGrey"))
|
|
for k in range(4):
|
|
P.append(ubox("louver", x - w / 2 + 0.2, x + w / 2 - 0.2, y + 0.25 + k * 0.22, y + 0.33 + k * 0.22, z + d / 2, z + d / 2 + 0.03, "M_PaintSlate"))
|
|
|
|
|
|
def building_a():
|
|
"""Office block 30 (X) x 20 (Z) x 18 (Y)."""
|
|
P = []
|
|
X, Z, Hb = 15.0, 10.0, 17.2
|
|
P.append(ubox("plinth", -X - 0.2, X + 0.2, 0, 0.6, -Z - 0.2, Z + 0.2, "M_Concrete"))
|
|
P.append(ubox("mass", -X, X, 0.6, Hb, -Z, Z, "M_PaintCream"))
|
|
# floor bands
|
|
floors = [0.6 + 3.3 * k for k in range(1, 5)]
|
|
for y in floors:
|
|
P.append(ubox("band", -X - 0.12, X + 0.12, y - 0.25, y + 0.05, -Z - 0.12, Z + 0.12, "M_PaintWhite"))
|
|
for (xa, xb, za, zb) in ((-X - 0.2, X + 0.2, -Z - 0.2, -Z + 0.3), (-X - 0.2, X + 0.2, Z - 0.3, Z + 0.2),
|
|
(-X - 0.2, -X + 0.3, -Z + 0.3, Z - 0.3), (X - 0.3, X + 0.2, -Z + 0.3, Z - 0.3)):
|
|
P.append(ubox("parapet", xa, xb, Hb, Hb + 0.8, za, zb, "M_PaintTeal"))
|
|
P.append(ubox("roof", -X + 0.3, X - 0.3, Hb + 0.05, Hb + 0.3, -Z + 0.3, Z - 0.3, "M_DarkGrey"))
|
|
ys = [0.6 + 3.3 * k + 0.75 for k in range(1, 5)]
|
|
window_grid(P, ("+Z", Z), -X + 1.0, X - 5.0, ys, 1.5, 1.9, 2.5, seed=1)
|
|
window_grid(P, ("-Z", -Z), -X + 1.0, X - 1.0, ys, 1.5, 1.9, 2.5, seed=2)
|
|
window_grid(P, ("+X", X), -Z + 1.0, Z - 1.0, ys, 1.5, 1.9, 2.5, seed=3)
|
|
window_grid(P, ("-X", -X), -Z + 1.0, Z - 1.0, ys, 1.5, 1.9, 2.5, seed=4)
|
|
# accent stair core at the +X/+Z corner (rises above the roof)
|
|
P.append(ubox("core", X - 4.2, X + 0.4, 0.6, Hb + 2.2, Z - 3.2, Z + 0.4, "M_PaintTeal"))
|
|
P.append(ubox("corecap", X - 4.4, X + 0.6, Hb + 2.2, Hb + 2.5, Z - 3.4, Z + 0.6, "M_PaintWhite"))
|
|
P.append(ubox("coreglass", X - 3.2, X - 0.8, 1.2, Hb + 1.2, Z + 0.4, Z + 0.46, "M_WindowGlass"))
|
|
for y in floors:
|
|
P.append(ubox("coremull", X - 3.25, X - 0.75, y - 0.1, y + 0.1, Z + 0.4, Z + 0.5, "M_PaintWhite"))
|
|
# ground floor lobby glazing + canopy
|
|
P.append(ubox("lobby", -8.0, 4.0, 0.6, 3.4, Z, Z + 0.08, "M_WindowGlass"))
|
|
for x in [-8.0 + 1.5 * k for k in range(9)]:
|
|
P.append(ubox("lmull", x - 0.07, x + 0.07, 0.6, 3.4, Z, Z + 0.14, "M_PaintWhite"))
|
|
P.append(ubox("doors", -3.0, -0.6, 0.6, 3.0, Z + 0.08, Z + 0.12, "M_Emissive"))
|
|
P.append(ubox("canopy", -9.0, 5.0, 3.6, 3.9, Z, Z + 3.0, "M_PaintTeal"))
|
|
P.append(ubox("canopyedge", -9.0, 5.0, 3.5, 3.6, Z + 2.9, Z + 3.0, "M_PaintWhite"))
|
|
for x in (-8.6, 4.6):
|
|
P.append(ucyl("col", 0.14, 3.0, (x, 2.1, Z + 2.7), "Y", verts=10, m="M_PaintWhite"))
|
|
P.append(ubox("steps", -4.0, 0.4, 0.0, 0.3, Z + 0.2, Z + 1.4, "M_Concrete"))
|
|
# logo board on the parapet (+Z)
|
|
P.append(ubox("signboard", -6.0, 2.0, Hb - 1.6, Hb + 0.5, Z + 0.2, Z + 0.4, "M_PaintWhite"))
|
|
P.append(ucyl("logo", 0.75, 0.1, (-4.9, Hb - 0.55, Z + 0.45), "Z", verts=20, m="M_PaintSky"))
|
|
for k in range(3):
|
|
P.append(ubox("logotext", -3.8, 1.3 - k * 1.1, Hb - 0.25 - k * 0.45, Hb - 0.0 - k * 0.45, Z + 0.4, Z + 0.46, "M_PaintSlate"))
|
|
# rooftop
|
|
yr = Hb + 0.3
|
|
hvac(P, -9.0, yr + 0.15, -3.0, 3.6, 2.2, 1.5, 2)
|
|
hvac(P, -3.5, yr + 0.15, -4.0, 2.8, 2.0, 1.3, 2)
|
|
hvac(P, 4.0, yr + 0.15, -5.0, 2.2, 1.8, 1.2, 1)
|
|
P.append(ucyl("tank", 1.0, 1.8, (-10.5, yr + 0.9, 5.0), "Y", verts=16, m="M_PaintWhite", bevel=0.08))
|
|
P.append(ucyl("vent", 0.3, 1.2, (1.5, yr + 0.6, 3.0), "Y", verts=10, m="M_Metal"))
|
|
P.append(ucyl("vent", 0.3, 1.0, (6.0, yr + 0.5, 1.0), "Y", verts=10, m="M_Metal"))
|
|
P.append(ucyl("mast", 0.06, 3.5, (-12.5, yr + 1.75, -7.0), "Y", verts=6, m="M_DarkGrey"))
|
|
P.append(ucyl("dish", 0.5, 0.15, (-12.5, yr + 2.8, -6.8), "Z", verts=12, m="M_PaintWhite"))
|
|
finalize(P, "SM_Env_Building_A", uv=0.25, ang=30)
|
|
return dict(elev=22, azim=-35)
|
|
|
|
|
|
def building_b():
|
|
"""Big shed warehouse 40 (X) x 30 (Z) x 12 (Y) with a sawtooth roof (north lights facing +Z) and loading doors."""
|
|
P = []
|
|
X, Z, E = 20.0, 15.0, 8.5
|
|
P.append(ubox("plinth", -X - 0.1, X + 0.1, 0, 0.9, -Z - 0.1, Z + 0.1, "M_Concrete"))
|
|
walls = ubox("walls", -X, X, 0.9, E, -Z, Z, "M_CorrugatedSand")
|
|
P.append(walls)
|
|
# sawtooth roof: 5 teeth of 6 m, slope rising toward +Z, glazed vertical faces at each tooth's +Z end
|
|
n = 5
|
|
pitch = 2 * Z / n
|
|
for k in range(n):
|
|
z0 = -Z + k * pitch
|
|
z1 = z0 + pitch
|
|
P.append(extrude_poly("tooth", [(z0 - 0.15, E), (z1, E), (z1, 12.0), (z0 - 0.15, E + 0.12)], "ZY", -X - 0.2, X + 0.2, "M_PaintSlate"))
|
|
P.append(ubox("glaze", -X + 0.6, X - 0.6, E + 0.45, 11.5, z1, z1 + 0.06, "M_WindowGlass"))
|
|
for xm in [-X + 0.6 + 2.6 * j for j in range(int((2 * X - 1.2) / 2.6) + 1)]:
|
|
P.append(ubox("gmull", xm - 0.07, xm + 0.07, E + 0.45, 11.5, z1, z1 + 0.1, "M_PaintWhite"))
|
|
P.append(ubox("ridgecap", -X - 0.25, X + 0.25, 11.85, 12.0, z1 - 0.25, z1 + 0.12, "M_PaintWhite"))
|
|
# eave gutters + corner trims
|
|
for s in (-1, 1):
|
|
P.append(ubox("gutter", -X - 0.25, X + 0.25, E - 0.25, E + 0.05, s * Z - (0.0 if s < 0 else 0.25) - (0.25 if s < 0 else 0), s * Z + (0.25 if s > 0 else 0), "M_PaintWhite"))
|
|
for s2 in (-1, 1):
|
|
P.append(ubox("corner", s * X - 0.25, s * X + 0.25, 0.9, E, s2 * Z - 0.25, s2 * Z + 0.25, "M_PaintWhite"))
|
|
# loading doors on the front (+Z)
|
|
for k in range(5):
|
|
xc = -14.0 + k * 5.6
|
|
P.append(ubox("doorframe", xc - 2.15, xc + 2.15, 0.0, 5.2, Z, Z + 0.18, "M_PaintTerracotta"))
|
|
P.append(ubox("shutter", xc - 1.8, xc + 1.8, 0.0, 4.8, Z + 0.18, Z + 0.24, "M_PaintCream"))
|
|
for j in range(8):
|
|
P.append(ubox("slat", xc - 1.8, xc + 1.8, 0.4 + j * 0.55, 0.46 + j * 0.55, Z + 0.24, Z + 0.27, "M_PaintSlate"))
|
|
for s in (-1, 1):
|
|
P.append(ubox("bumper", xc + s * 1.95 - 0.15, xc + s * 1.95 + 0.15, 0.2, 0.9, Z + 0.18, Z + 0.45, "M_Rubber"))
|
|
P.append(ubox("doorlight", xc - 0.2, xc + 0.2, 5.4, 5.6, Z, Z + 0.35, "M_Emissive"))
|
|
P.append(ubox("canopy", -X + 2.0, X - 2.0, 6.0, 6.3, Z, Z + 2.5, "M_PaintTerracotta"))
|
|
for x in (-15.0, -5.0, 5.0, 15.0):
|
|
P.append(utube("tie", [(x, 7.5, Z), (x, 6.3, Z + 2.3)], 0.05, "M_DarkGrey", res=1, segs=4))
|
|
P.append(ubox("apron", -X, X - 4.0, 0.0, 0.06, Z, Z + 0.6, "M_PaintYellow"))
|
|
# person door + office windows on +X side
|
|
P.append(ubox("pdoor", X, X + 0.1, 0.9, 3.1, 8.0, 9.2, "M_PaintTerracotta"))
|
|
P.append(ubox("pcanopy", X, X + 1.2, 3.3, 3.45, 7.6, 9.6, "M_PaintSlate"))
|
|
window_grid(P, ("+X", X), -12.0, 6.5, [2.0, 5.2], 2.0, 1.4, 3.1, seed=5, lit=0.25)
|
|
window_grid(P, ("-X", -X), -12.0, 12.0, [5.6], 2.6, 1.2, 4.0, seed=6, lit=0.1)
|
|
# wall band/sign stripe
|
|
P.append(ubox("stripe", -X - 0.04, X + 0.04, 6.6, 7.0, -Z - 0.04, Z + 0.04, "M_PaintTerracotta"))
|
|
# rooftop vents on ridges
|
|
for (x, z) in ((-12, -9.3), (0, -3.3), (12, 2.7), (-6, 8.7)):
|
|
P.append(ucyl("rvent", 0.45, 0.9, (x, 12.0 - 0.6, z), "Y", verts=10, m="M_Metal"))
|
|
P.append(ucyl("rcap", 0.6, 0.12, (x, 12.0 - 0.1, z), "Y", verts=10, m="M_DarkGrey"))
|
|
finalize(P, "SM_Env_Building_B", uv=0.25, ang=30)
|
|
return dict(elev=25, azim=-35)
|
|
|
|
|
|
def building_c():
|
|
"""Factory ~30 (X) x 25 (Z) x 25 (Y): pitched-roof hall, boiler house with two chimneys, a silo."""
|
|
P = []
|
|
hx0, hx1, hz0, hz1, He, Hr = -15.0, 6.0, -12.5, 6.5, 10.0, 12.6
|
|
zc = (hz0 + hz1) / 2
|
|
P.append(ubox("plinth", hx0 - 0.1, hx1 + 0.1, 0, 0.8, hz0 - 0.1, hz1 + 0.1, "M_Concrete"))
|
|
P.append(extrude_poly("hall", [(hz0, 0.8), (hz1, 0.8), (hz1, He), (zc, Hr), (hz0, He)], "ZY", hx0, hx1, "M_CorrugatedSage"))
|
|
hz_ = (hz1 - hz0) / 2
|
|
for s in (-1, 1):
|
|
ze = zc + s * (hz_ + 0.5)
|
|
P.append(extrude_poly("roof", [(ze, He - 0.3 * 1), (zc, Hr + 0.05), (zc, Hr + 0.35), (ze, He + 0.0)], "ZY", hx0 - 0.4, hx1 + 0.4, "M_PaintSlate"))
|
|
P.append(ubox("ridge", hx0 - 0.4, hx1 + 0.4, Hr + 0.2, Hr + 0.45, zc - 0.3, zc + 0.3, "M_PaintWhite"))
|
|
# roof monitor vents along the ridge
|
|
for x in (-11.0, -6.0, -1.0, 4.0):
|
|
P.append(ubox("monitor", x - 1.2, x + 1.2, Hr + 0.3, Hr + 1.3, zc - 0.9, zc + 0.9, "M_PaintWhite"))
|
|
P.append(ubox("mroof", x - 1.4, x + 1.4, Hr + 1.3, Hr + 1.5, zc - 1.1, zc + 1.1, "M_PaintSlate"))
|
|
P.append(ubox("mlouver", x - 1.0, x + 1.0, Hr + 0.5, Hr + 1.1, zc - 0.92, zc + 0.92, "M_DarkGrey"))
|
|
# clerestory windows on the hall's long sides
|
|
for side, z in (("+Z", hz1), ("-Z", hz0)):
|
|
window_grid(P, (side, z), hx0 + 1, hx1 - 1, [6.8], 3.0, 2.0, 3.8, seed=7 if side == "+Z" else 8, lit=0.15, frame=False)
|
|
window_grid(P, ("-X", hx0), hz0 + 1.5, hz1 - 1.5, [6.8], 2.4, 2.0, 3.5, seed=9, lit=0.1, frame=False)
|
|
# big hall door (+Z)
|
|
P.append(ubox("hdoorframe", -9.5, -3.5, 0.0, 6.0, hz1, hz1 + 0.2, "M_PaintSlate"))
|
|
P.append(ubox("hdoor", -9.1, -3.9, 0.0, 5.6, hz1 + 0.2, hz1 + 0.26, "M_PaintOrange"))
|
|
for j in range(6):
|
|
P.append(ubox("hslat", -9.1, -3.9, 0.5 + j * 0.85, 0.56 + j * 0.85, hz1 + 0.26, hz1 + 0.29, "M_PaintTerracotta"))
|
|
# boiler house (brick colour), flat roof
|
|
bx0, bx1, bz0, bz1, bh = 6.0, 15.0, -12.5, -1.5, 7.5
|
|
P.append(ubox("boiler", bx0, bx1, 0.0, bh, bz0, bz1, "M_PaintTerracotta"))
|
|
P.append(ubox("bcap", bx0 - 0.15, bx1 + 0.15, bh, bh + 0.5, bz0 - 0.15, bz1 + 0.15, "M_PaintCream"))
|
|
window_grid(P, ("+X", bx1), bz0 + 1, bz1 - 1, [2.0, 4.6], 1.6, 1.8, 2.6, seed=10, lit=0.3)
|
|
window_grid(P, ("+Z", bz1), bx0 + 1, bx1 - 1, [4.6], 1.6, 1.8, 2.6, seed=11, lit=0.3)
|
|
P.append(ubox("bdoor", 9.0, 11.4, 0.0, 3.2, bz1, bz1 + 0.12, "M_PaintSlate"))
|
|
hvac(P, 10.5, bh + 0.65, -8.5, 3.0, 2.2, 1.3, 2)
|
|
# two chimneys (cream with terracotta bands), standing in front of the boiler house
|
|
for (cx, cz, h) in ((9.0, 1.6, 25.0), (12.6, 1.6, 22.0)):
|
|
P.append(ubox("cbase", cx - 1.4, cx + 1.4, 0.0, 2.0, cz - 1.4, cz + 1.4, "M_Concrete"))
|
|
P.append(ucyl("chimney", 1.05, h - 2.0, (cx, 2.0 + (h - 2.0) / 2, cz), "Y", verts=16, m="M_PaintCream", r2=0.8))
|
|
for (ya, yb) in ((h - 2.6, h - 1.4), (h - 5.0, h - 4.2)):
|
|
r = 1.05 - (1.05 - 0.8) * ((ya + yb) / 2 - 2.0) / (h - 2.0)
|
|
P.append(ucyl("cband", r + 0.06, yb - ya, (cx, (ya + yb) / 2, cz), "Y", verts=16, m="M_PaintTerracotta"))
|
|
P.append(ucyl("clip", 0.92, 0.3, (cx, h - 0.15, cz), "Y", verts=16, m="M_DarkGrey"))
|
|
# connection duct from the boiler house
|
|
P.append(ubox("duct", cx - 0.5, cx + 0.5, 4.0, 5.0, bz1, cz - 0.8, "M_Metal"))
|
|
# pipe rack between hall and boiler house
|
|
for k, y in enumerate((5.4, 6.0)):
|
|
P.append(ucyl("pipe", 0.22, 6.0, (6.0 + 0.0, y, 3.0 + k * 0.6), "X", verts=10, m="M_Metal"))
|
|
for x in (4.0, 8.0):
|
|
P.append(ubox("pipesup", x - 0.12, x + 0.12, 0.0, 6.3, 2.6, 4.0, "M_DarkGrey"))
|
|
# silo on legs with hopper, conical roof, ladder, feed pipe to the hall roof
|
|
sx, sz, r = -9.5, 9.6, 2.6
|
|
for k in range(4):
|
|
a = math.pi / 4 + k * math.pi / 2
|
|
P.append(ubox("sleg", sx + r * 0.75 * math.cos(a) - 0.15, sx + r * 0.75 * math.cos(a) + 0.15, 0.0, 4.5, sz + r * 0.75 * math.sin(a) - 0.15, sz + r * 0.75 * math.sin(a) + 0.15, "M_DarkGrey"))
|
|
P.append(revolve("hopper", [(0.4, 2.2), (r, 4.5)], segs=20, m="M_PaintWhite", axis="Z", loc=B(sx, 0, sz), close_top=False))
|
|
P.append(ucyl("silo", r, 11.0, (sx, 4.5 + 5.5, sz), "Y", verts=20, m="M_PaintWhite", cap=True))
|
|
P.append(ucyl("sband", r + 0.04, 1.2, (sx, 13.2, sz), "Y", verts=20, m="M_PaintTeal"))
|
|
P.append(ucyl("sband", r + 0.04, 0.25, (sx, 6.5, sz), "Y", verts=20, m="M_PaintTeal"))
|
|
P.append(revolve("sroof", [(r + 0.15, 15.5), (0.35, 17.3), (0.0, 17.5)], segs=20, m="M_PaintSlate", axis="Z", loc=B(sx, 0, sz)))
|
|
for k in range(2):
|
|
P.append(ucyl("rail", 0.035, 9.0, (sx + (k - 0.5) * 0.5, 10.5, sz + r + 0.25), "Y", verts=5, m="M_DarkGrey"))
|
|
for j in range(22):
|
|
P.append(ucyl("rung", 0.025, 0.5, (sx, 6.2 + j * 0.42, sz + r + 0.25), "X", verts=5, m="M_DarkGrey"))
|
|
P.append(utube("feed", [(sx + 1.2, 16.2, sz - 1.0), (-8.0, 15.0, 3.5), (-7.0, Hr + 0.6, zc + 1.0)], 0.35, "M_Metal", res=3, segs=8))
|
|
finalize(P, "SM_Env_Building_C", uv=0.25, ang=30)
|
|
return dict(elev=20, azim=-35)
|
|
|
|
|
|
# ======================================================================= 5. Misc campus props
|
|
|
|
def water_tower():
|
|
P = []
|
|
yb, yt, R = 11.0, 15.6, 3.2
|
|
for k in range(4):
|
|
a = math.pi / 4 + k * math.pi / 2
|
|
p0 = (3.0 * math.cos(a), 0.0, 3.0 * math.sin(a))
|
|
p1 = (2.1 * math.cos(a), yb, 2.1 * math.sin(a))
|
|
P.append(utube("leg", [p0, p1], 0.16, "M_PaintWhite", res=1, segs=8))
|
|
P.append(ucyl("pad", 0.45, 0.3, (p0[0], 0.15, p0[2]), "Y", verts=8, m="M_Concrete"))
|
|
# bracing between neighbouring legs
|
|
for k in range(4):
|
|
a0 = math.pi / 4 + k * math.pi / 2
|
|
a1 = a0 + math.pi / 2
|
|
|
|
def at(a, y):
|
|
rr = 3.0 + (2.1 - 3.0) * y / yb
|
|
return (rr * math.cos(a), y, rr * math.sin(a))
|
|
for (ya, yb_) in ((0.8, 5.6), (5.6, 10.4)):
|
|
P.append(utube("x", [at(a0, ya), at(a1, yb_)], 0.06, "M_DarkGrey", res=1, segs=4))
|
|
P.append(utube("x", [at(a1, ya), at(a0, yb_)], 0.06, "M_DarkGrey", res=1, segs=4))
|
|
for y in (5.6, 10.4):
|
|
P.append(utube("ring", [at(a0, y), at(a1, y)], 0.08, "M_PaintWhite", res=1, segs=4))
|
|
# tank: bowl bottom, drum, roof, finial
|
|
P.append(revolve("bowl", [(0.0, yb - 0.7), (1.6, yb - 0.55), (R, yb)], segs=24, m="M_PaintSky", axis="Z", close_top=False))
|
|
P.append(ucyl("drum", R, yt - yb, (0, (yb + yt) / 2, 0), "Y", verts=24, m="M_PaintSky", cap=False))
|
|
P.append(ucyl("band", R + 0.05, 0.5, (0, yt - 0.6, 0), "Y", verts=24, m="M_PaintWhite", cap=False))
|
|
P.append(ucyl("band", R + 0.05, 0.3, (0, yb + 0.5, 0), "Y", verts=24, m="M_PaintWhite", cap=False))
|
|
P.append(revolve("roof", [(R + 0.2, yt), (R + 0.2, yt + 0.15), (0.5, 17.6), (0.0, 17.7)], segs=24, m="M_PaintWhite", axis="Z"))
|
|
P.append(ucyl("finial", 0.12, 0.6, (0, 18.0, 0), "Y", verts=8, m="M_DarkGrey"))
|
|
P.append(usphere("ball", 0.22, (0, 18.35, 0), "M_PaintRed", seg=10, rings=5))
|
|
# logo disc on the front
|
|
P.append(ucyl("logo", 1.5, 0.08, (0, 13.3, R + 0.02), "Z", verts=20, m="M_PaintYellow") )
|
|
for (dx, dy, rr) in ((-0.55, 0.3, 0.42), (0.5, 0.45, 0.36), (0.0, -0.45, 0.5)):
|
|
P.append(usphere("bub", rr, (dx, 13.3 + dy, R + 0.08), "M_PaintWhite", seg=12, rings=6, scale=(1, 1, 0.35)))
|
|
# catwalk ring + railing
|
|
P.append(revolve("deck", [(R - 0.1, yb), (R + 0.9, yb), (R + 0.9, yb + 0.1), (R - 0.1, yb + 0.1)], segs=24, m="M_DarkGrey", axis="Z", close_top=False))
|
|
rail = torus("rail", R + 0.85, 0.04, loc=B(0, yb + 1.1, 0), axis="Z", seg=24, rseg=4, m="M_DarkGrey")
|
|
P.append(rail)
|
|
for k in range(12):
|
|
a = 2 * math.pi * k / 12
|
|
P.append(ucyl("stanchion", 0.03, 1.0, ((R + 0.85) * math.cos(a), yb + 0.6, (R + 0.85) * math.sin(a)), "Y", verts=5, m="M_DarkGrey"))
|
|
# ladder up the front-right leg
|
|
a = math.pi / 4
|
|
for k in (-1, 1):
|
|
off = (0.25 * k * -math.sin(a), 0, 0.25 * k * math.cos(a))
|
|
P.append(utube("lrail", [(3.0 * math.cos(a) + off[0] + 0.4, 0.0, 3.0 * math.sin(a) + off[2] + 0.4), (2.1 * math.cos(a) + off[0] + 0.4, yb, 2.1 * math.sin(a) + off[2] + 0.4)], 0.03, "M_DarkGrey", res=1, segs=4))
|
|
finalize(P, "SM_Env_WaterTower", uv=0.5, ang=40)
|
|
return dict(elev=12, azim=-30)
|
|
|
|
|
|
def street_light():
|
|
P = []
|
|
P.append(ubox("base", -0.2, 0.2, 0.0, 0.5, -0.2, 0.2, "M_DarkGrey", bevel=0.04, segs=2))
|
|
P.append(ucyl("pole", 0.09, 5.6, (0, 0.5 + 2.8, 0), "Y", verts=10, m="M_PaintSlate", r2=0.06))
|
|
P.append(ucyl("collar", 0.12, 0.2, (0, 0.6, 0), "Y", verts=10, m="M_DarkGrey"))
|
|
P.append(utube("arm", [(0, 5.6, 0), (0, 6.05, 0.35), (0, 6.1, 1.1), (0, 6.0, 1.6)], 0.05, "M_PaintSlate", res=4, segs=8))
|
|
P.append(ubox("head", -0.22, 0.22, 5.86, 6.06, 1.25, 2.05, "M_DarkGrey", bevel=0.06, segs=2))
|
|
P.append(ubox("headtop", -0.18, 0.18, 6.06, 6.1, 1.35, 1.95, "M_PaintSlate", bevel=0.02, segs=1))
|
|
P.append(ubox("sign", -0.01, 0.01, 2.6, 3.0, 0.09, 0.4, "M_PaintSky"))
|
|
finalize(P, "Body", uv=1.0)
|
|
l = ubox("Lamp", -0.17, 0.17, 5.83, 5.87, 1.32, 1.98, "M_Emissive", bevel=0.015, segs=1)
|
|
uv_box(l, 1)
|
|
l.name = "Lamp"
|
|
return dict(elev=12, azim=-60)
|
|
|
|
|
|
def billboard():
|
|
P = []
|
|
y0, y1, hw = 5.0, 9.0, 4.0
|
|
for x in (-2.6, 2.6):
|
|
P.append(ubox("leg", x - 0.2, x + 0.2, 0.0, y0 + 0.4, -0.5, -0.1, "M_DarkGrey", bevel=0.03, segs=1))
|
|
P.append(ubox("legfoot", x - 0.5, x + 0.5, 0.0, 0.4, -0.8, 0.2, "M_Concrete", bevel=0.04, segs=1))
|
|
P.append(utube("strut", [(x, 1.0, -0.5), (x, y0, -1.1)], 0.07, "M_DarkGrey", res=1, segs=6))
|
|
P.append(ubox("backboard", -hw - 0.15, hw + 0.15, y0 - 0.15, y1 + 0.15, -0.12, -0.02, "M_PaintWhite", bevel=0.03, segs=1))
|
|
# frame trim around the face
|
|
for (xa, xb, ya, yb) in ((-hw - 0.2, hw + 0.2, y0 - 0.2, y0), (-hw - 0.2, hw + 0.2, y1, y1 + 0.2), (-hw - 0.2, -hw, y0, y1), (hw, hw + 0.2, y0, y1)):
|
|
P.append(ubox("trim", xa, xb, ya, yb, -0.12, 0.06, "M_PaintSlate", bevel=0.02, segs=1))
|
|
# back structure
|
|
for y in (y0 + 0.6, (y0 + y1) / 2, y1 - 0.6):
|
|
P.append(ubox("purlin", -hw, hw, y - 0.08, y + 0.08, -0.4, -0.12, "M_DarkGrey"))
|
|
for x in (-2.6, 0.0, 2.6):
|
|
P.append(ubox("stud", x - 0.08, x + 0.08, y0 - 0.1, y1 + 0.1, -0.5, -0.12, "M_DarkGrey"))
|
|
# catwalk with railing in front
|
|
P.append(ubox("catwalk", -hw, hw, y0 - 0.45, y0 - 0.35, 0.0, 0.9, "M_DarkGrey"))
|
|
for x in [-hw + k * 1.0 for k in range(9)]:
|
|
P.append(ucyl("post", 0.025, 0.9, (x, y0 + 0.05, 0.86), "Y", verts=5, m="M_DarkGrey"))
|
|
P.append(ucyl("hand", 0.03, 2 * hw, (0, y0 + 0.5, 0.86), "X", verts=6, m="M_DarkGrey"))
|
|
for x in (-2.6, 2.6):
|
|
P.append(utube("brace", [(x, y0 - 0.4, 0.85), (x, y0 - 1.3, -0.1)], 0.04, "M_DarkGrey", res=1, segs=4))
|
|
# spotlights on arms over the top edge
|
|
for x in (-2.7, 0.0, 2.7):
|
|
P.append(utube("larm", [(x, y1 + 0.15, -0.05), (x, y1 + 0.55, 0.4), (x, y1 + 0.55, 1.0)], 0.04, "M_DarkGrey", res=2, segs=6))
|
|
P.append(ubox("lamp", x - 0.25, x + 0.25, y1 + 0.38, y1 + 0.6, 0.9, 1.25, "M_DarkGrey", bevel=0.03, segs=1))
|
|
P.append(ubox("lens", x - 0.2, x + 0.2, y1 + 0.37, y1 + 0.39, 0.95, 1.2, "M_Emissive"))
|
|
finalize(P, "Frame", uv=1.0)
|
|
z = 0.0
|
|
# viewer at +Z looking -Z: their right is -X, so U grows toward -X
|
|
q = quad("Panel", [(hw, y0, z), (-hw, y0, z), (-hw, y1, z), (hw, y1, z)], [(0, 0), (1, 0), (1, 1), (0, 1)], "M_Billboard_1")
|
|
face_toward(q, (0, 0, 1))
|
|
return dict(elev=8, azim=-25)
|
|
|
|
|
|
def barrier():
|
|
P = []
|
|
hl = 1.0
|
|
prof = [(-0.305, 0.0), (0.305, 0.0), (0.305, 0.075), (0.2, 0.33), (0.1427, 0.55), (0.1089, 0.68), (0.075, 0.81),
|
|
(-0.075, 0.81), (-0.1089, 0.68), (-0.1427, 0.55), (-0.2, 0.33), (-0.305, 0.075)]
|
|
body = extrude_poly("jersey", prof, "ZY", -hl, hl, "M_ConcreteLight")
|
|
body.data.materials.append(mat("M_PaintYellow"))
|
|
for p in body.data.polygons:
|
|
c = p.center
|
|
if 0.55 < c.z < 0.68 and abs(p.normal.z) < 0.9 and abs(p.normal.x) < 0.9:
|
|
p.material_index = 1
|
|
puff(body, 0.02, segs=2, angle=25)
|
|
P.append(body)
|
|
# slots at the bottom + lifting loops
|
|
for z in (-0.306, 0.306):
|
|
for x in (-0.55, 0.55):
|
|
P.append(ubox("slot", x - 0.15, x + 0.15, 0.0, 0.07, z - 0.003, z + 0.003, "M_DarkGrey"))
|
|
for x in (-0.6, 0.6):
|
|
t = torus("loop", 0.05, 0.012, loc=B(x, 0.83, 0), axis="Y", seg=10, rseg=4, m="M_Metal")
|
|
P.append(t)
|
|
# end caps: darker connection pin pockets
|
|
for x in (-hl - 0.002, hl - 0.004):
|
|
P.append(ubox("pin", x, x + 0.006, 0.25, 0.6, -0.05, 0.05, "M_DarkGrey"))
|
|
finalize(P, "SM_Env_Barrier", uv=1.0, ang=35)
|
|
return dict(elev=20, azim=-35)
|
|
|
|
|
|
def cone():
|
|
P = []
|
|
P.append(ubox("base", -0.19, 0.19, 0.0, 0.035, -0.19, 0.19, "M_Rubber", bevel=0.03, segs=2))
|
|
|
|
def r_at(y):
|
|
return 0.15 - 0.12 * (y - 0.035) / 0.665
|
|
bands = [(0.035, 0.3, "M_PaintOrange"), (0.3, 0.4, "M_PaintWhite"), (0.4, 0.5, "M_PaintOrange"), (0.5, 0.58, "M_PaintWhite"), (0.58, 0.7, "M_PaintOrange")]
|
|
for (ya, yb, m) in bands:
|
|
P.append(revolve("band", [(r_at(ya), ya), (r_at(yb), yb)] + ([(0.0, 0.7)] if yb >= 0.7 else []), segs=16, m=m, axis="Z", close_top=False))
|
|
P.append(revolve("tip", [(0.03, 0.7), (0.026, 0.72), (0.0, 0.725)], segs=16, m="M_PaintOrange", axis="Z"))
|
|
finalize(P, "SM_Env_Cone", uv=4.0, ang=50)
|
|
return dict(elev=20, azim=-30)
|
|
|
|
|
|
def dumpster():
|
|
P = []
|
|
hx = 0.95
|
|
prof = [(-0.5, 0.18), (0.5, 0.18), (0.62, 1.2), (-0.55, 1.2)]
|
|
body = extrude_poly("bin", prof, "ZY", -hx, hx, "M_PaintDarkGreen")
|
|
puff(body, 0.04, segs=2, angle=25)
|
|
P.append(body)
|
|
P.append(ubox("rim", -hx - 0.04, hx + 0.04, 1.14, 1.24, -0.6, 0.67, "M_PaintDarkGreen", bevel=0.03, segs=2))
|
|
# forklift pockets on the sides
|
|
for s in (-1, 1):
|
|
P.append(ubox("pocket", s * (hx + 0.06) - 0.08, s * (hx + 0.06) + 0.08, 0.62, 0.78, -0.45, 0.45, "M_DarkGrey", bevel=0.02, segs=1))
|
|
for z in (-0.4, 0.4):
|
|
P.append(ubox("pbrk", s * hx - 0.05, s * hx + 0.05, 0.55, 0.85, z - 0.05, z + 0.05, "M_DarkGrey"))
|
|
# vertical ribs on the front
|
|
for x in (-0.6, 0.0, 0.6):
|
|
P.append(extrude_poly("rib", [(0.5, 0.2), (0.56, 0.2), (0.68, 1.12), (0.62, 1.12)], "ZY", x - 0.05, x + 0.05, "M_PaintDarkGreen"))
|
|
# casters
|
|
for sx in (-1, 1):
|
|
for sz in (-1, 1):
|
|
x, z = sx * 0.75, sz * 0.38
|
|
P.append(ubox("fork", x - 0.06, x + 0.06, 0.1, 0.2, z - 0.06, z + 0.06, "M_DarkGrey"))
|
|
P.append(ucyl("caster", 0.08, 0.06, (x, 0.08, z), "X", verts=12, m="M_Rubber"))
|
|
# little label plate
|
|
P.append(extrude_poly("plate", [(0.585, 0.78), (0.6, 0.78), (0.625, 0.98), (0.61, 0.98)], "ZY", 0.12, 0.5, "M_PaintWhite"))
|
|
finalize(P, "Body", uv=1.0, ang=35)
|
|
# lid hinged at the back (-Z) top edge, closed (slight slope)
|
|
L = []
|
|
L.append(ubox("lid", -hx - 0.02, hx + 0.02, 1.24, 1.3, -0.62, 0.72, "M_Rubber", bevel=0.025, segs=2))
|
|
for x in (-0.5, 0.5):
|
|
L.append(ubox("lrib", x - 0.12, x + 0.12, 1.3, 1.34, -0.55, 0.66, "M_Rubber", bevel=0.015, segs=1))
|
|
L.append(ubox("handle", x - 0.1, x + 0.1, 1.2, 1.26, 0.72, 0.76, "M_DarkGrey"))
|
|
lid = finalize(L, "Lid", uv=1.0)
|
|
for x in (-0.6, 0.6):
|
|
P2 = ucyl("hinge", 0.035, 0.18, (x, 1.24, -0.64), "X", verts=8, m="M_DarkGrey")
|
|
uv_box(P2, 1)
|
|
b = bpy.data.objects["Body"]
|
|
nb = join([b, P2], "Body")
|
|
smooth(nb, 35)
|
|
set_origin(lid, B(0, 1.24, -0.64))
|
|
return dict(elev=22, azim=-35)
|
|
|
|
|
|
def trailer_truck():
|
|
"""Parked semi: conventional tractor (Cab, M_PaintBlue only) + 12 m box trailer (Trailer, M_PaintWhite only),
|
|
"Decal" quad on the +X side (UV 0..1, M_Billboard_2), "Details" for glass/lights/grille, "Chassis" for frames/wheels."""
|
|
C, T, D, H = [], [], [], []
|
|
# --- tractor (front at +Z)
|
|
cw = 1.25
|
|
C.append(ubox("hood", -1.0, 1.0, 1.15, 2.25, 6.5, 8.15, "M_PaintBlue", bevel=0.2, segs=3))
|
|
C.append(ubox("cab", -cw, cw, 1.05, 3.35, 4.8, 6.6, "M_PaintBlue", bevel=0.18, segs=3))
|
|
C.append(ubox("sleeper", -cw, cw, 1.05, 3.55, 3.75, 4.9, "M_PaintBlue", bevel=0.18, segs=3))
|
|
C.append(extrude_poly("fairing", [(3.75, 3.5), (4.9, 3.5), (6.0, 3.3), (4.0, 4.15), (3.75, 4.15)], "ZY", -1.15, 1.15, "M_PaintBlue"))
|
|
for s in (-1, 1):
|
|
C.append(ubox("fender", s * 1.15 - 0.17, s * 1.15 + 0.17, 0.95, 1.25, 6.3, 7.95, "M_PaintBlue", bevel=0.1, segs=2))
|
|
C.append(ubox("skirt", s * 1.12 - 0.08, s * 1.12 + 0.08, 0.55, 1.1, 3.9, 6.1, "M_PaintBlue", bevel=0.04, segs=1))
|
|
# details: glass, grille, lights, bumper, mirrors, stacks, steps
|
|
D.append(ubox("windshield", -1.1, 1.1, 2.35, 3.15, 6.55, 6.62, "M_WindowGlass"))
|
|
for s in (-1, 1):
|
|
D.append(ubox("sidewin", s * cw - 0.03, s * cw + 0.03, 2.3, 3.1, 5.3, 6.35, "M_WindowGlass"))
|
|
D.append(ubox("hl", s * 0.78 - 0.18, s * 0.78 + 0.18, 1.6, 1.85, 8.1, 8.2, "M_Emissive", bevel=0.03, segs=1))
|
|
D.append(ubox("ind", s * 0.95 - 0.06, s * 0.95 + 0.06, 1.62, 1.83, 8.08, 8.18, "M_PaintOrange"))
|
|
D.append(utube("marm", [(s * cw, 2.7, 6.45), (s * 1.55, 2.75, 6.6)], 0.03, "M_DarkGrey", res=1, segs=6))
|
|
D.append(ubox("mirror", s * 1.58 - 0.08, s * 1.58 + 0.08, 2.25, 3.0, 6.5, 6.65, "M_DarkGrey", bevel=0.04, segs=1))
|
|
D.append(ucyl("stack", 0.11, 2.9, (s * 1.15, 3.0, 3.6), "Y", verts=10, m="M_Metal"))
|
|
D.append(ucyl("stackcap", 0.13, 0.3, (s * 1.15, 4.5, 3.6), "Y", verts=10, m="M_DarkGrey"))
|
|
D.append(ucyl("tank", 0.36, 1.2, (s * 1.0, 0.85, 4.6), "Z", verts=14, m="M_Metal"))
|
|
for k, y in enumerate((0.55, 0.85)):
|
|
D.append(ubox("step", s * 1.2 - 0.12, s * 1.2 + 0.12, y, y + 0.06, 5.4, 6.0, "M_Metal"))
|
|
D.append(ubox("handle", s * (cw + 0.04) - 0.02, s * (cw + 0.04) + 0.02, 1.4, 2.6, 6.1, 6.15, "M_Metal"))
|
|
D.append(ubox("roofmarker", s * 0.6 - 0.08, s * 0.6 + 0.08, 4.15, 4.22, 4.0, 4.1, "M_PaintOrange"))
|
|
D.append(ubox("grille", -0.65, 0.65, 1.2, 2.2, 8.12, 8.22, "M_Metal", bevel=0.04, segs=2))
|
|
for k in range(6):
|
|
D.append(ubox("gbar", -0.58, 0.58, 1.3 + k * 0.15, 1.36 + k * 0.15, 8.2, 8.25, "M_DarkGrey"))
|
|
D.append(ubox("bumper", -1.3, 1.3, 0.55, 0.95, 8.0, 8.35, "M_Metal", bevel=0.08, segs=2))
|
|
D.append(ubox("visor", -1.15, 1.15, 3.2, 3.32, 6.55, 6.9, "M_DarkGrey", bevel=0.03, segs=1))
|
|
# --- chassis + wheels
|
|
H.append(ubox("frame", -0.55, 0.55, 0.65, 1.0, -0.2, 7.9, "M_DarkGrey"))
|
|
H.append(ubox("fifth", -0.85, 0.85, 1.0, 1.15, 0.9, 2.5, "M_DarkGrey", bevel=0.05, segs=1))
|
|
for zz in (7.05, 2.4, 1.0):
|
|
for s in (-1, 1):
|
|
if zz > 5:
|
|
H.append(wheel_u("w", 0.55, 0.36, (s * 1.0, 0.55, zz), rim_m="M_Metal", segs=12, nuts=False))
|
|
else:
|
|
H.append(wheel_u("w", 0.55, 0.72, (s * 0.98, 0.55, zz), rim_m="M_Metal", segs=12, dual=True))
|
|
for s in (-1, 1):
|
|
H.append(ubox("dfender", s * 1.0 - 0.38, s * 1.0 + 0.38, 1.2, 1.28, 0.3, 3.1, "M_DarkGrey", bevel=0.03, segs=1))
|
|
H.append(ubox("flap", s * 1.0 - 0.32, s * 1.0 + 0.32, 0.2, 1.15, 0.2, 0.24, "M_Rubber"))
|
|
# trailer chassis: landing gear, rear tandem, bumper, mud flaps, side skirts
|
|
for s in (-1, 1):
|
|
H.append(ubox("leg", s * 0.8 - 0.07, s * 0.8 + 0.07, 0.1, 1.25, -0.6, -0.46, "M_DarkGrey"))
|
|
H.append(ubox("legfoot", s * 0.8 - 0.15, s * 0.8 + 0.15, 0.0, 0.1, -0.68, -0.38, "M_DarkGrey"))
|
|
H.append(ubox("tskirt", s * 1.2 - 0.03, s * 1.2 + 0.03, 0.5, 1.22, -5.6, -1.2, "M_PaintSlate"))
|
|
H.append(ubox("trframe", -0.5, 0.5, 0.95, 1.22, -8.6, 1.2, "M_DarkGrey"))
|
|
for zz in (-6.6, -7.9):
|
|
for s in (-1, 1):
|
|
H.append(wheel_u("w", 0.55, 0.72, (s * 0.98, 0.55, zz), rim_m="M_Metal", segs=12, dual=True))
|
|
for s in (-1, 1):
|
|
H.append(ubox("tflap", s * 1.0 - 0.32, s * 1.0 + 0.32, 0.2, 1.05, -8.55, -8.51, "M_Rubber"))
|
|
H.append(ubox("icc", -1.2, 1.2, 0.5, 0.65, -8.9, -8.8, "M_PaintRed"))
|
|
for s in (-1, 1):
|
|
H.append(ubox("iccpost", s * 0.6 - 0.05, s * 0.6 + 0.05, 0.5, 1.2, -8.85, -8.75, "M_DarkGrey"))
|
|
# --- trailer box (white only)
|
|
tz0, tz1, ty0, ty1, tw = -9.0, 3.0, 1.25, 4.0, 1.28
|
|
T.append(ubox("box", -tw, tw, ty0, ty1, tz0, tz1, "M_PaintWhite", bevel=0.06, segs=2))
|
|
for z in [tz0 + 0.6 + k * 1.2 for k in range(10)]:
|
|
if -6.0 < z < 0.0:
|
|
continue # keep the decal area flat
|
|
for s in (-1, 1):
|
|
T.append(ubox("post", s * tw - 0.03, s * tw + 0.03, ty0 + 0.05, ty1 - 0.05, z - 0.05, z + 0.05, "M_PaintWhite"))
|
|
for s in (-1, 1):
|
|
T.append(ubox("toprail", s * tw - 0.04, s * tw + 0.04, ty1 - 0.14, ty1 - 0.02, tz0 + 0.05, tz1 - 0.05, "M_PaintWhite"))
|
|
T.append(ubox("botrail", s * tw - 0.04, s * tw + 0.04, ty0 + 0.02, ty0 + 0.16, tz0 + 0.05, tz1 - 0.05, "M_PaintWhite"))
|
|
# trailer rear doors (details: hinges, lock rods, lights)
|
|
for s in (-1, 1):
|
|
for x in (s * 0.35, s * 0.9):
|
|
D.append(ucyl("rod", 0.025, ty1 - ty0 - 0.3, (x, (ty0 + ty1) / 2, tz0 - 0.03), "Y", verts=6, m="M_Metal"))
|
|
for y in (1.6, 2.6, 3.6):
|
|
D.append(ubox("hinge", s * 1.24 - 0.08, s * 1.24 + 0.04, y - 0.05, y + 0.05, tz0 - 0.04, tz0, "M_Metal"))
|
|
D.append(ubox("tail", s * 0.95 - 0.15, s * 0.95 + 0.15, 1.0, 1.15, -8.82, -8.78, "M_PaintRed"))
|
|
D.append(ubox("smark", s * (tw + 0.01), s * (tw + 0.01) + 0.005 * s, 1.35, 1.42, -8.5, -8.38, "M_PaintOrange"))
|
|
D.append(ubox("smark", s * (tw + 0.01), s * (tw + 0.01) + 0.005 * s, 1.35, 1.42, 2.4, 2.52, "M_PaintOrange"))
|
|
D.append(ubox("seam", -0.012, 0.012, ty0 + 0.1, ty1 - 0.1, tz0 - 0.012, tz0, "M_DarkGrey"))
|
|
finalize(C, "Cab", uv=1.0, ang=35)
|
|
finalize(T, "Trailer", uv=1.0, ang=35)
|
|
finalize(D, "Details", uv=1.0, ang=35)
|
|
finalize(H, "Chassis", uv=1.0, ang=40)
|
|
# side decal on +X: viewer looks -X, U grows toward +Z
|
|
x = tw + 0.012
|
|
za, zb, ya, yb = -5.8, -0.2, 1.4, 3.85
|
|
q = quad("Decal", [(x, ya, za), (x, ya, zb), (x, yb, zb), (x, yb, za)], [(0, 0), (1, 0), (1, 1), (0, 1)], "M_Billboard_2")
|
|
face_toward(q, (1, 0, 0))
|
|
return dict(elev=16, azim=-125)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run({
|
|
"SM_Pallet": pallet_v3,
|
|
"SM_PopTable": pop_table_v3,
|
|
"SM_Truck": truck_v3,
|
|
"SM_PalletRack": pallet_rack_v3,
|
|
"SM_Env_Fence": env_fence,
|
|
"SM_Env_Tree_A": tree_a,
|
|
"SM_Env_Tree_B": tree_b,
|
|
"SM_Env_Bush": bush,
|
|
"SM_Env_Container": env_container,
|
|
"SM_Env_Building_A": building_a,
|
|
"SM_Env_Building_B": building_b,
|
|
"SM_Env_Building_C": building_c,
|
|
"SM_Env_WaterTower": water_tower,
|
|
"SM_Env_StreetLight": street_light,
|
|
"SM_Env_Billboard": billboard,
|
|
"SM_Env_Barrier": barrier,
|
|
"SM_Env_TrailerTruck": trailer_truck,
|
|
"SM_Env_Cone": cone,
|
|
"SM_Env_Dumpster": dumpster,
|
|
})
|