agent

+46:54
reasoning

Initial focus is on creating a new design based on the provided "block_dummy" template, targeting a design refinement appropriate for a striker-level character, with specific requirements for plates, panel lines, joints, and color blocking. This involves a direct transformation of a base template into a final, refined design.

Considering a deviation from the previous approach to showcase a radical improvement. The intention is to demonstrate a distinct advantage over the existing work, moving beyond the established design approach. Exploring alternative strategies to highlight a significant departure from the project's current path.

The previous design utilized intersecting 2D extruded polygons, resulting in a blocky aesthetic lacking surface curvature. Examining lib.panels() reveals a failure to create authentic 3D panel lines or armor seams. Therefore, the approach requires significant revision to achieve the desired hard-surface and biomechanical qualities, with a focus on implementing true 3D surface modeling using appropriate tools.

The previous method projected random rectangles onto flat surfaces, creating a blocky appearance and failing to produce authentic 3D panel lines. The new approach will move to building a bespoke, true 3D hard-surface model using dedicated tools, integrating five different 3D hard-surface techniques, like aero-chine lofting with crease-weighted subdivision, to achieve the desired biomechanical quality. This strategy aims to create a superior design compared to the past orthogonal intersection and random tile application.

The design will leverage multi-station 3D cross-sections to sculpt components with hard chine creases and smooth bellies, subdivided and creased in a 3D modeling tool. True 3D geometric panel seams will be implemented, creating physical gaps for panel lines rather than relying on surface perturbations. The silhouette will be a high-agility orbital interceptor frame, the YF-09 Kestrel, distinct from the original template, maintaining proportions but with a unique sensor mast.

Aero-chine pauldrons will feature variable geometry with vernier wing-blades, recessed RCS slat trims, and exposed titanium trunnions with hydraulic rams. The torso design encompasses an angular stealth-fighter fuselage with a visible, recessed orbital cockpit capsule including an armored ejection hatch and wrap-around canopy glass. The prow design will integrate a compound-curved dark optical canopy, twin recessed cyan glowing optical arrays, swept dorsal telemetry antennae, and lateral optical rangefinder pods.

Split-shell forearms will incorporate integrated rail-carbine barrels and dorsal plasma blades, with articulated mechanical manipulators. The design includes split chevron flight skirts, sculpted chine thighs, double-jointed knee armor with optical sensors, aerodynamic lower-leg thruster fairings, articulated raptor talon-sabot feet, and a twin-boom orbital vector pack with a glowing Tokamak reactor core, twin gimballed main vector bells, and articulated variable thrust vector arrays.

The design incorporates sweep thrust-vectoring wing binders, each with an armored shroud and high-output vector bell. A true side-by-side yardstick presentation will be implemented, including in-flight plumes and a full synchronized 360° turn, with the "S" character as a comparison. The current rendering system will be modified to accommodate simultaneous display of both models.

Focusing on implementing synchronized flight animations for both the new and original designs. This involves rigging the models, setting up identical poses, and integrating the game's volumetric thruster plumes for a rear-flight comparison. The goal is to capture high-resolution side-by-side images and a 360-degree turn video, showcasing the design's motion.

Recording wall-clock timestamps for each stage of the process, beginning now at 02:39:15Z, to document the exact time taken for each step within the report. Initial focus is on creating a Blender hard-surface generator script, kit/blocks/dummy.py, to construct a true 3D model with specific tools. This generator will produce a layered mech design based on the existing rig, aiming for a 3–5 second build time. The process necessitates examination of existing primitives within kit/lib.py, alongside bmesh and bpy, to implement custom chine-surface, panel-seam, and mechanical detail functions.

  • read_file{"EndLine":140,"Path":"~/work/sortie/kit/lib.py","StartLine":1}

    input

    {
      "EndLine": 140,
      "Path": "~/work/sortie/kit/lib.py",
      "StartLine": 1
    }

    result, 141 lines

    Showing lines 1-140 of 437
    1: """Modelling helpers shared by every kit script.
    2: 
    3: Blender units are metres, Z is up, and models face -Y (Blender's front view). The glTF exporter turns
    4: that into three.js's Y up with models facing +Z.
    5: 
    6: Parts are solids built from a few primitives:
    7:   loft      cross-sections stacked along an axis (most armour, limbs, hulls)
    8:   prism     a 2D outline pushed through a depth
    9:   two_view  a front outline and a side outline intersected, the classic hard-surface blockout
    10: Every solid gets a material role (main, accent, frame, glow_eye, ...). The game maps roles to toon
    11: materials, so one model can wear any faction's paint.
    12: """
    13: import math
    14: 
    15: import bmesh
    16: import bpy
    17: from mathutils import Matrix, Vector
    18: 
    19: # Preview colours only, for anyone opening a .blend. The game ignores them.
    20: PREVIEW = {
    21:     "main": (0.86, 0.87, 0.9), "accent": (0.12, 0.3, 0.55), "trim": (0.85, 0.55, 0.12),
    22:     "frame": (0.2, 0.21, 0.24), "joint": (0.12, 0.12, 0.14), "visor": (0.05, 0.06, 0.08),
    23:     "glow_eye": (0.3, 1.0, 0.9), "glow_core": (0.3, 1.0, 0.9), "glow_thruster": (0.6, 0.78, 1.0),
    24:     "glow_exhaust": (0.31, 0.56, 1.0),
    25:     "metal": (0.55, 0.57, 0.6), "hull": (0.72, 0.73, 0.75), "hull_dark": (0.32, 0.33, 0.36),
    26:     "deck": (0.25, 0.26, 0.28), "hazard": (0.9, 0.75, 0.1), "light": (1.0, 0.97, 0.9),
    27:     "screen": (0.2, 0.8, 0.75), "glass": (0.1, 0.2, 0.25), "lamp_red": (1.0, 0.2, 0.15),
    28:     "lamp_green": (0.3, 1.0, 0.4), "suit": (0.14, 0.19, 0.36), "glow_hot": (0.92, 1.0, 0.98),
    29:     # raider salvage (palette.ts): donor paint, primer, rust, hand paint
    30:     "donor_a": (0.78, 0.76, 0.72), "donor_b": (0.24, 0.34, 0.43), "donor_c": (0.36, 0.38, 0.26), "primer": (0.54, 0.55, 0.52),
    31:     "rust": (0.42, 0.23, 0.13), "handpaint": (0.93, 0.89, 0.8), "warpaint": (0.76, 0.23, 0.15),
    32:     # markings: pattern codes, service text, unit codes (a decal layer in geometry)
    33:     "stencil": (0.13, 0.14, 0.16),
    34:     "crystal": (0.8, 0.81, 0.84), "crystal_lit": (0.55, 0.45, 0.78), "glow_violet": (0.66, 0.48, 1.0),
    35: }
    36: 
    37: 
    38: def reset():
    39:     for o in list(bpy.data.objects):
    40:         bpy.data.objects.remove(o, do_unlink=True)
    41:     for coll in (bpy.data.meshes, bpy.data.materials):
    42:         for item in list(coll):
    43:             coll.remove(item)
    44: 
    45: 
    46: def material(role):
    47:     m = bpy.data.materials.get(role)
    48:     if m is None:
    49:         m = bpy.data.materials.new(role)
    50:         c = PREVIEW.get(role, (0.7, 0.7, 0.7))
    51:         m.diffuse_color = (*c, 1.0)
    52:     return m
    53: 
    54: 
    55: def link(o):
    56:     bpy.context.scene.collection.objects.link(o)
    57:     return o
    58: 
    59: 
    60: def empty(name, at=(0, 0, 0), parent=None, **extras):
    61:     """A joint or marker. Children keep their world placement when parented to it."""
    62:     o = link(bpy.data.objects.new(name, None))
    63:     o.empty_display_size = 0.4
    64:     o.location = Vector(at) if parent is None else parent.matrix_world.inverted() @ Vector(at)
    65:     if parent is not None:
    66:         o.parent = parent
    67:     for k, v in extras.items():
    68:         o[k] = v
    69:     bpy.context.view_layer.update()
    70:     return o
    71: 
    72: 
    73: def attach(o, parent):
    74:     """Parent without moving: geometry is authored in world (rest pose) coordinates."""
    75:     bpy.context.view_layer.update()
    76:     mw = o.matrix_world.copy()
    77:     o.parent = parent
    78:     o.matrix_parent_inverse = parent.matrix_world.inverted()
    79:     o.matrix_world = mw
    80:     return o
    81: 
    82: 
    83: # ---- 2D outlines ------------------------------------------------------------------------------------------
    84: def octo(w, d, c=0.2, cf=None, cb=None, x=0.0, y=0.0):
    85:     """A chamfered rectangle, w along X and d along Y, CCW seen from above. The front (-Y) and back
    86:     chamfers can differ: cf, cb. Returns 8 points."""
    87:     cf = c if cf is None else cf
    88:     cb = c if cb is None else cb
    89:     hw, hd = w / 2, d / 2
    90:     cf, cb = min(cf, hw * 0.95, hd * 0.95), min(cb, hw * 0.95, hd * 0.95)
    91:     return [(x - hw + cf, y - hd), (x + hw - cf, y - hd), (x + hw, y - hd + cf), (x + hw, y + hd - cb),
    92:             (x + hw - cb, y + hd), (x - hw + cb, y + hd), (x - hw, y + hd - cb), (x - hw, y - hd + cf)]
    93: 
    94: 
    95: def circle(r, n=12, x=0.0, y=0.0, phase=0.5):
    96:     return [(x + r * math.cos(2 * math.pi * (i + phase) / n), y + r * math.sin(2 * math.pi * (i + phase) / n))
    97:             for i in range(n)]
    98: 
    99: 
    100: def ccw(poly):
    101:     a = sum(poly[i][0] * poly[(i + 1) % len(poly)][1] - poly[(i + 1) % len(poly)][0] * poly[i][1]
    102:             for i in range(len(poly)))
    103:     return poly if a > 0 else list(reversed(poly))
    104: 
    105: 
    106: # ---- solids (bmesh) ---------------------------------------------------------------------------------------
    107: def loft(rings, axis="z", caps=True):
    108:     """rings: [(height, [(u, v), ...]), ...], all with the same point count. With axis "z" the outline
    109:     is (x, y) at height z; "y" means (x, z) outlines along y; "x" means (y, z) outlines along x."""
    110:     bm = bmesh.new()
    111:     loops = []
    112:     for h, pts in rings:
    113:         loop = []
    114:         for u, v in pts:
    115:             p = {"z": (u, v, h), "y": (u, h, v), "x": (h, u, v)}[axis]
    116:             loop.append(bm.verts.new(p))
    117:         loops.append(loop)
    118:     n = len(loops[0])
    119:     for a, b in zip(loops, loops[1:]):
    120:         for i in range(n):
    121:             j = (i + 1) % n
    122:             bm.faces.new((a[i], a[j], b[j], b[i]))
    123:     if caps:
    124:         bm.faces.new(list(reversed(loops[0])))
    125:         bm.faces.new(loops[-1])
    126:     _outward(bm)
    127:     return bm
    128: 
    129: 
    130: def prism(poly, lo, hi, plane="xz"):
    131:     """A 2D outline pushed through [lo, hi]. plane "xz": outline in (x, z), depth along y.
    132:     "yz": (y, z) along x. "xy": (x, y) along z."""
    133:     poly = ccw(poly)
    134:     axis = {"xz": "y", "yz": "x", "xy": "z"}[plane]
    135:     return loft([(lo, poly), (hi, poly)], axis=axis)
    136: 
    137: 
    138: def _outward(bm):
    139:     bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
    140:
  • read_file{"EndLine":260,"Path":"~/work/sortie/kit/lib.py","StartLine":140}

    input

    {
      "EndLine": 260,
      "Path": "~/work/sortie/kit/lib.py",
      "StartLine": 140
    }

    result, 122 lines

    Showing lines 140-260 of 437
    140: 
    141: 
    142: def merge(*bms):
    143:     out = bmesh.new()
    144:     for b in bms:
    145:         me = bpy.data.meshes.new("_tmp")
    146:         b.to_mesh(me)
    147:         out.from_mesh(me)
    148:         bpy.data.meshes.remove(me)
    149:         b.free()
    150:     return out
    151: 
    152: 
    153: def transform(bm, m):
    154:     bmesh.ops.transform(bm, matrix=m, verts=bm.verts)
    155:     return bm
    156: 
    157: 
    158: def mirror_x(bm):
    159:     """A mirrored copy (left from right) with the winding fixed."""
    160:     me = bpy.data.meshes.new("_m")
    161:     bm.to_mesh(me)
    162:     out = bmesh.new()
    163:     out.from_mesh(me)
    164:     bpy.data.meshes.remove(me)
    165:     bmesh.ops.scale(out, vec=(-1, 1, 1), verts=out.verts)
    166:     bmesh.ops.reverse_faces(out, faces=out.faces)
    167:     return out
    168: 
    169: 
    170: def rot(axis, deg, about=(0, 0, 0)):
    171:     c = Vector(about)
    172:     return Matrix.Translation(c) @ Matrix.Rotation(math.radians(deg), 4, axis) @ Matrix.Translation(-c)
    173: 
    174: 
    175: # ---- objects ----------------------------------------------------------------------------------------------
    176: def solid(name, bm, role, parent=None, bevel=0.0, segs=1, angle=40, smooth=False, outline=True, panels=None):
    177:     """Turn a bmesh into an object with a material role, an optional chamfer on edges sharper than
    178:     `angle`, flat or smooth shading, parented to a joint without moving. Armour roles get panel
    179:     seams on their large faces unless panels=False."""
    180:     me = bpy.data.meshes.new(name)
    181:     bm.to_mesh(me)
    182:     bm.free()
    183:     me.materials.append(material(role))
    184:     o = link(bpy.data.objects.new(name, me))
    185:     if bevel > 0:
    186:         mod = o.modifiers.new("bevel", "BEVEL")
    187:         mod.width = bevel
    188:         mod.segments = segs
    189:         mod.limit_method = "ANGLE"
    190:         mod.angle_limit = math.radians(angle)
    191:         mod.use_clamp_overlap = True
    192:         mod.miter_outer = "MITER_ARC"
    193:         bake(o)
    194:     if panels is None:
    195:         panels = role in ("main", "accent", "hull") and not smooth
    196:     if panels:
    197:         panel_lines(o)
    198:     me = o.data
    199:     if smooth:
    200:         me.shade_smooth()
    201:         me.set_sharp_from_angle(angle=math.radians(12))
    202:     if not outline:
    203:         o["outline"] = False
    204:     if parent is not None:
    205:         attach(o, parent)
    206:     return o
    207: 
    208: 
    209: def panel_lines(o, min_area=1.1, width=0.05, depth=0.016):
    210:     """Recess every large face slightly inside a thin border: reads as panel seams on armour."""
    211:     bm = bmesh.new()
    212:     bm.from_mesh(o.data)
    213:     faces = [f for f in bm.faces if f.calc_area() > min_area]
    214:     if faces:
    215:         bmesh.ops.inset_individual(bm, faces=faces, thickness=width, depth=-depth, use_even_offset=True)
    216:     bm.to_mesh(o.data)
    217:     bm.free()
    218:     return o
    219: 
    220: 
    221: def bake(o):
    222:     dg = bpy.context.evaluated_depsgraph_get()
    223:     me = bpy.data.meshes.new_from_object(o.evaluated_get(dg))
    224:     old = o.data
    225:     o.modifiers.clear()
    226:     o.data = me
    227:     me.name = old.name
    228:     bpy.data.meshes.remove(old)
    229:     return o
    230: 
    231: 
    232: def boolean(target, cutter_bm, op="DIFFERENCE", role=None):
    233:     """Cut (or intersect/union) a solid object with a bmesh volume. With a role, the faces the cutter
    234:     leaves behind (the inside of a cavity) take that material."""
    235:     me = bpy.data.meshes.new("_cut")
    236:     cutter_bm.to_mesh(me)
    237:     cutter_bm.free()
    238:     if role is not None:
    239:         me.materials.append(material(role))
    240:     cutter = link(bpy.data.objects.new("_cut", me))
    241:     bpy.context.view_layer.update()
    242:     cutter.matrix_world = target.matrix_world.copy()
    243:     mod = target.modifiers.new("bool", "BOOLEAN")
    244:     mod.operation = op
    245:     mod.object = cutter
    246:     mod.solver = "EXACT"
    247:     if role is not None:
    248:         mod.material_mode = "TRANSFER"
    249:     bake(target)
    250:     bpy.data.objects.remove(cutter, do_unlink=True)
    251:     bpy.data.meshes.remove(me)
    252:     return target
    253: 
    254: 
    255: def two_view(front, side, top=None, span=60.0):
    256:     """Intersect a front outline (x, z) with a side outline (y, z), and optionally a top outline
    257:     (x, y). Returns a bmesh. The classic way to block out armour and heads."""
    258:     a = prism(front, -span, span, "xz")
    259:     me = bpy.data.meshes.new("_tv")
    260:     a.to_mesh(me)
  • read_file{"EndLine":437,"Path":"~/work/sortie/kit/lib.py","StartLine":260}

    input

    {
      "EndLine": 437,
      "Path": "~/work/sortie/kit/lib.py",
      "StartLine": 260
    }

    result, 179 lines

    Showing lines 260-437 of 437
    260:     a.to_mesh(me)
    261:     a.free()
    262:     o = link(bpy.data.objects.new("_tv", me))
    263:     boolean(o, prism(side, -span, span, "yz"), "INTERSECT")
    264:     if top is not None:
    265:         boolean(o, prism(top, -span, span, "xy"), "INTERSECT")
    266:     bm = bmesh.new()
    267:     bm.from_mesh(o.data)
    268:     bpy.data.objects.remove(o, do_unlink=True)
    269:     return bm
    270: 
    271: 
    272: def clip(bm, x=(-60, 60), y=(-60, 60), z=(-60, 60)):
    273:     """The part of a solid inside an axis-aligned box. Cutting one envelope into several boxes with
    274:     gaps between them gives separate shells over the same form."""
    275:     me = bpy.data.meshes.new("_clip")
    276:     bm.to_mesh(me)
    277:     bm.free()
    278:     o = link(bpy.data.objects.new("_clip", me))
    279:     cut = loft([(z[0], [(x[0], y[0]), (x[1], y[0]), (x[1], y[1]), (x[0], y[1])]),
    280:                 (z[1], [(x[0], y[0]), (x[1], y[0]), (x[1], y[1]), (x[0], y[1])])])
    281:     boolean(o, cut, "INTERSECT")
    282:     out = bmesh.new()
    283:     out.from_mesh(o.data)
    284:     data = o.data
    285:     bpy.data.objects.remove(o, do_unlink=True)
    286:     bpy.data.meshes.remove(data)
    287:     return out
    288: 
    289: 
    290: def copy(bm):
    291:     me = bpy.data.meshes.new("_copy")
    292:     bm.to_mesh(me)
    293:     out = bmesh.new()
    294:     out.from_mesh(me)
    295:     bpy.data.meshes.remove(me)
    296:     return out
    297: 
    298: 
    299: def _keep_side(bm, co, no, below):
    300:     """Keep the part of a solid below (or above) a plane and cap the opening."""
    301:     geom = bm.verts[:] + bm.edges[:] + bm.faces[:]
    302:     res = bmesh.ops.bisect_plane(bm, geom=geom, plane_co=co, plane_no=no, clear_outer=below, clear_inner=not below)
    303:     edges = [e for e in res["geom_cut"] if isinstance(e, bmesh.types.BMEdge)]
    304:     if edges:
    305:         bmesh.ops.holes_fill(bm, edges=edges, sides=0)
    306:     bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
    307:     return bm
    308: 
    309: 
    310: def halves(bm, co, no, gap=.04):
    311:     """Split a solid along a plane into two capped pieces with a gap between them: a panel seam
    312:     with real depth, so the dark frame beneath shows through."""
    313:     co, no = Vector(co), Vector(no).normalized()
    314:     a = _keep_side(copy(bm), co - no * gap / 2, no, below=True)
    315:     b = _keep_side(bm, co + no * gap / 2, no, below=False)
    316:     return a, b
    317: 
    318: 
    319: def panels(bm, cuts, gap=.04):
    320:     """Cut a solid by several planes [(point, normal), ...] into panels with seams between them."""
    321:     pieces = [bm]
    322:     for co, no in cuts:
    323:         out = []
    324:         for p in pieces:
    325:             for h in halves(p, co, no, gap):
    326:                 if len(h.faces) >= 4:
    327:                     out.append(h)
    328:                 else:
    329:                     h.free()
    330:         pieces = out
    331:     return pieces
    332: 
    333: 
    334: def fold(objs, t, half, y0, y1):
    335:     """Fold the front of a part into a shallow V: in front of y0 (fully in front of y1) every vertex
    336:     moves forward (-Y) by t * (half - |x|), so the centre line becomes a ridge and both sides angle
    337:     back. Meshes are cut on the centre line first so flat plates fold instead of tilting. Works on
    338:     mesh coordinates, which are the authored ones."""
    339:     for ob in objs:
    340:         bm = bmesh.new()
    341:         bm.from_mesh(ob.data)
    342:         if bm.verts and min(v.co.y for v in bm.verts) < y0:
    343:             geom = bm.verts[:] + bm.edges[:] + bm.faces[:]
    344:             bmesh.ops.bisect_plane(bm, geom=geom, plane_co=(0, 0, 0), plane_no=(1, 0, 0))
    345:             for v in bm.verts:
    346:                 ax = abs(v.co.x)
    347:                 if v.co.y < y0 and ax < half:
    348:                     w = min(1.0, (y0 - v.co.y) / (y0 - y1))
    349:                     v.co.y -= t * (half - ax) * w * w * (3 - 2 * w)
    350:             bm.to_mesh(ob.data)
    351:         bm.free()
    352: 
    353: 
    354: def piston(p0, p1, r=.12, n=8):
    355:     """A hydraulic piston from p0 to p1: a body over the first 60%, a thinner rod the rest, end eyes."""
    356:     p0, p1 = Vector(p0), Vector(p1)
    357:     axis = p1 - p0
    358:     m = Matrix.Translation(p0) @ Vector((0, 0, 1)).rotation_difference(axis.normalized()).to_matrix().to_4x4()
    359:     L = axis.length
    360:     body = loft([(0, circle(r, n)), (L * .6, circle(r, n))])
    361:     rod = loft([(L * .55, circle(r * .45, n)), (L, circle(r * .45, n))])
    362:     eyes = merge(loft([(-r * .4, circle(r * .7, n)), (r * .4, circle(r * .7, n))]),
    363:                  loft([(L - r * .4, circle(r * .6, n)), (L + r * .4, circle(r * .6, n))]))
    364:     return transform(merge(body, rod, eyes), m)
    365: 
    366: 
    367: def subd(bm, levels=2, sharp=45, crease=1.0):
    368:     """Smooth a low-poly cage with Catmull-Clark subdivision. Edges whose faces meet at more than
    369:     `sharp` degrees are creased, so they stay crisp while everything else rounds off: helmets and
    370:     shells that are soft where they should be and hard where they shouldn't."""
    371:     me = bpy.data.meshes.new("_subd")
    372:     bm.to_mesh(me)
    373:     bm.free()
    374:     attr = me.attributes.get("crease_edge") or me.attributes.new("crease_edge", "FLOAT", "EDGE")
    375:     probe = bmesh.new()
    376:     probe.from_mesh(me)
    377:     probe.edges.ensure_lookup_table()
    378:     lim = math.radians(sharp)
    379:     for e in probe.edges:
    380:         f = e.link_faces
    381:         if len(f) == 2 and f[0].normal.angle(f[1].normal, 0) > lim:
    382:             attr.data[e.index].value = crease
    383:     probe.free()
    384:     o = link(bpy.data.objects.new("_subd", me))
    385:     mod = o.modifiers.new("subd", "SUBSURF")
    386:     mod.levels = mod.render_levels = levels
    387:     bake(o)
    388:     out = bmesh.new()
    389:     out.from_mesh(o.data)
    390:     data = o.data
    391:     bpy.data.objects.remove(o, do_unlink=True)
    392:     bpy.data.meshes.remove(data)
    393:     return out
    394: 
    395: 
    396: def cylinder(r, z0, z1, n=10, r1=None, axis="z", at=(0, 0)):
    397:     """An n-sided cylinder (or cone with r1) between z0 and z1 along an axis, centred at `at` in the
    398:     other two coordinates."""
    399:     r1 = r if r1 is None else r1
    400:     return loft([(z0, circle(r, n, *at)), (z1, circle(r1, n, *at))], axis=axis)
    401: 
    402: 
    403: def nozzle(r_out, length, n=12, flare=1.25):
    404:     """A thruster bell along -Z from the origin (throat at z=0, exit at z=-length), open-ended with
    405:     a thick lip. Returns (shell bmesh, glow disc bmesh)."""
    406:     ro, ri = r_out, r_out * 0.78
    407:     rings_out = [(0, circle(ro / flare, n)), (-length * 0.6, circle(ro * 0.92, n)), (-length, circle(ro, n))]
    408:     rings_in = [(-length, circle(ri, n)), (-length * 0.6, circle(ri * 0.9, n)), (0.0, circle(ri / flare * 0.9, n))]
    409:     bm = bmesh.new()
    410:     loops = []
    411:     for h, pts in rings_out + rings_in:
    412:         loops.append([bm.verts.new((u, v, h)) for u, v in pts])
    413:     for a, b in zip(loops, loops[1:]):
    414:         for i in range(n):
    415:             j = (i + 1) % n
    416:             bm.faces.new((a[i], a[j], b[j], b[i]))
    417:     bm.faces.new(list(reversed(loops[0])))
    418:     _outward(bm)
    419:     glow = loft([(-length * 0.15, circle(ri / flare * 0.85, n)), (-length * 0.12, circle(ri / flare * 0.85, n))])
    420:     return bm, glow
    421: 
    422: 
    423: def slats(x0, x1, z0, z1, y, n, depth=0.12, gap=0.35):
    424:     """Horizontal vent slats on a plane facing -Y at depth y."""
    425:     out = []
    426:     h = (z1 - z0) / n
    427:     for i in range(n):
    428:         zb = z0 + i * h
    429:         out.append(prism([(x0, zb), (x1, zb), (x1, zb + h * (1 - gap)), (x0, zb + h * (1 - gap))],
    430:                          y - depth, y + 0.05, "xz"))
    431:     return merge(*out)
    432: 
    433: 
    434: def export(path, extras=True):
    435:     bpy.ops.export_scene.gltf(filepath=path, export_format="GLB", export_apply=True, export_yup=True,
    436:                               export_extras=extras, export_cameras=False, export_lights=False,
    437:                               export_materials="EXPORT", export_normals=True, export_texcoords=False)