@developerz.ai/ts23d 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/bug-hunter.md +21 -0
- package/.claude/agents/docs-author.md +13 -0
- package/.claude/agents/dx-auditor.md +14 -0
- package/.claude/agents/primitive-author.md +22 -0
- package/.claude/agents/recipe-author.md +36 -0
- package/.claude/agents/visual-reviewer.md +23 -0
- package/.claude/commands/feature.md +28 -0
- package/.claude/commands/new-recipe.md +19 -0
- package/.claude/commands/release.md +14 -0
- package/.claude/commands/verify.md +9 -0
- package/.claude/skills/author-recipe/SKILL.md +93 -0
- package/CHANGELOG.md +90 -0
- package/CLAUDE.md +85 -0
- package/LICENSE +21 -0
- package/README.md +385 -2
- package/dist/chunk-6b05mnmx.js +19 -0
- package/dist/chunk-6b05mnmx.js.map +11 -0
- package/dist/chunk-7rtfjh9f.js +45 -0
- package/dist/chunk-7rtfjh9f.js.map +10 -0
- package/dist/chunk-8j4c28jt.js +4085 -0
- package/dist/chunk-8j4c28jt.js.map +46 -0
- package/dist/chunk-d1fv6hrm.js +2532 -0
- package/dist/chunk-d1fv6hrm.js.map +43 -0
- package/dist/chunk-dbq4qf52.js +902 -0
- package/dist/chunk-dbq4qf52.js.map +25 -0
- package/dist/chunk-drna2rny.js +836 -0
- package/dist/chunk-drna2rny.js.map +17 -0
- package/dist/chunk-dxvypr7y.js +89 -0
- package/dist/chunk-dxvypr7y.js.map +11 -0
- package/dist/chunk-f6yme003.js +1589 -0
- package/dist/chunk-f6yme003.js.map +30 -0
- package/dist/chunk-hg7pf34j.js +465 -0
- package/dist/chunk-hg7pf34j.js.map +19 -0
- package/dist/chunk-jq4e17tj.js +1031 -0
- package/dist/chunk-jq4e17tj.js.map +21 -0
- package/dist/chunk-y63c6zcv.js +2668 -0
- package/dist/chunk-y63c6zcv.js.map +53 -0
- package/dist/cli/args.d.ts +30 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +348 -0
- package/dist/cli/bin.js.map +15 -0
- package/dist/cli/load.d.ts +2 -0
- package/dist/cli/manifest.d.ts +53 -0
- package/dist/cli/render-cmds.d.ts +12 -0
- package/dist/cli/run.d.ts +1 -0
- package/dist/cli/texture-cache.d.ts +4 -0
- package/dist/core/asset.d.ts +10 -0
- package/dist/core/definition.d.ts +155 -0
- package/dist/core/errors.d.ts +17 -0
- package/dist/core/family.d.ts +23 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.js +69 -0
- package/dist/core/index.js.map +9 -0
- package/dist/core/mesh.d.ts +35 -0
- package/dist/core/part.d.ts +114 -0
- package/dist/core/png.d.ts +1 -0
- package/dist/core/rng.d.ts +12 -0
- package/dist/core/transform.d.ts +20 -0
- package/dist/core/vec.d.ts +11 -0
- package/dist/core/world.d.ts +16 -0
- package/dist/export/bin-writer.d.ts +16 -0
- package/dist/export/container.d.ts +3 -0
- package/dist/export/credits.d.ts +4 -0
- package/dist/export/glb-options.d.ts +48 -0
- package/dist/export/glb.d.ts +8 -0
- package/dist/export/hierarchy.d.ts +23 -0
- package/dist/export/index.d.ts +5 -0
- package/dist/export/index.js +40 -0
- package/dist/export/index.js.map +9 -0
- package/dist/export/lights.d.ts +8 -0
- package/dist/export/lod-coverage.d.ts +12 -0
- package/dist/export/materials.d.ts +23 -0
- package/dist/export/merge-pivots.d.ts +6 -0
- package/dist/export/metadata.d.ts +21 -0
- package/dist/export/motion.d.ts +9 -0
- package/dist/export/optimize-parts.d.ts +26 -0
- package/dist/export/primitive.d.ts +3 -0
- package/dist/export/tangents.d.ts +2 -0
- package/dist/export/textures.d.ts +22 -0
- package/dist/export/version.d.ts +2 -0
- package/dist/grammar/index.d.ts +2 -0
- package/dist/grammar/index.js +16 -0
- package/dist/grammar/index.js.map +9 -0
- package/dist/grammar/split.d.ts +21 -0
- package/dist/grammar/whyte.d.ts +5 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +457 -0
- package/dist/index.js.map +9 -0
- package/dist/kinds/building.d.ts +44 -0
- package/dist/kinds/faces.d.ts +27 -0
- package/dist/kinds/head-armour.d.ts +5 -0
- package/dist/kinds/head-beard.d.ts +6 -0
- package/dist/kinds/head-bust.d.ts +5 -0
- package/dist/kinds/head-extras.d.ts +15 -0
- package/dist/kinds/head-face.d.ts +8 -0
- package/dist/kinds/head-garb.d.ts +4 -0
- package/dist/kinds/head-geom.d.ts +7 -0
- package/dist/kinds/head-hair.d.ts +4 -0
- package/dist/kinds/head-layout.d.ts +29 -0
- package/dist/kinds/head-mesh.d.ts +31 -0
- package/dist/kinds/head-mouth.d.ts +4 -0
- package/dist/kinds/head-params.d.ts +116 -0
- package/dist/kinds/head-presets.d.ts +19 -0
- package/dist/kinds/head-rim.d.ts +10 -0
- package/dist/kinds/head-tone.d.ts +10 -0
- package/dist/kinds/head-torso.d.ts +35 -0
- package/dist/kinds/head.d.ts +39 -0
- package/dist/kinds/hull-lines.d.ts +65 -0
- package/dist/kinds/hull-skin.d.ts +6 -0
- package/dist/kinds/hull.d.ts +14 -0
- package/dist/kinds/index.d.ts +16 -0
- package/dist/kinds/index.js +78 -0
- package/dist/kinds/index.js.map +9 -0
- package/dist/kinds/mass.d.ts +15 -0
- package/dist/kinds/openings.d.ts +30 -0
- package/dist/kinds/planned.d.ts +6 -0
- package/dist/kinds/roof-chimney.d.ts +16 -0
- package/dist/kinds/roof-shape.d.ts +64 -0
- package/dist/kinds/roof.d.ts +31 -0
- package/dist/kinds/vegetation-fronds.d.ts +15 -0
- package/dist/kinds/vegetation-impostor.d.ts +9 -0
- package/dist/kinds/vegetation-leaves.d.ts +15 -0
- package/dist/kinds/vegetation-mesh.d.ts +21 -0
- package/dist/kinds/vegetation-params.d.ts +90 -0
- package/dist/kinds/vegetation-presets.d.ts +20 -0
- package/dist/kinds/vegetation-skeleton.d.ts +20 -0
- package/dist/kinds/vegetation.d.ts +42 -0
- package/dist/kinds/vehicle.d.ts +42 -0
- package/dist/material/cc0.d.ts +4 -0
- package/dist/material/define.d.ts +34 -0
- package/dist/material/generator.d.ts +4 -0
- package/dist/material/index.d.ts +9 -0
- package/dist/material/index.js +70 -0
- package/dist/material/index.js.map +9 -0
- package/dist/material/library.d.ts +7 -0
- package/dist/material/material-def.d.ts +30 -0
- package/dist/material/paint/bond.d.ts +3 -0
- package/dist/material/paint/canvas.d.ts +39 -0
- package/dist/material/paint/cell.d.ts +4 -0
- package/dist/material/paint/cells-round.d.ts +5 -0
- package/dist/material/paint/cells.d.ts +7 -0
- package/dist/material/paint/compose.d.ts +5 -0
- package/dist/material/paint/concrete.d.ts +3 -0
- package/dist/material/paint/courses.d.ts +31 -0
- package/dist/material/paint/decode-png.d.ts +6 -0
- package/dist/material/paint/default-sheet.d.ts +4 -0
- package/dist/material/paint/fabric.d.ts +4 -0
- package/dist/material/paint/foliage-broad.d.ts +5 -0
- package/dist/material/paint/foliage-common.d.ts +35 -0
- package/dist/material/paint/foliage-compound.d.ts +4 -0
- package/dist/material/paint/foliage-conifer.d.ts +5 -0
- package/dist/material/paint/foliage-raster.d.ts +26 -0
- package/dist/material/paint/foliage.d.ts +3 -0
- package/dist/material/paint/image-strip.d.ts +4 -0
- package/dist/material/paint/kit.d.ts +5 -0
- package/dist/material/paint/masks.d.ts +3 -0
- package/dist/material/paint/metal.d.ts +3 -0
- package/dist/material/paint/noise.d.ts +9 -0
- package/dist/material/paint/normal.d.ts +8 -0
- package/dist/material/paint/orm.d.ts +8 -0
- package/dist/material/paint/planks.d.ts +3 -0
- package/dist/material/paint/plates.d.ts +3 -0
- package/dist/material/paint/shapes.d.ts +8 -0
- package/dist/material/paint/slate.d.ts +3 -0
- package/dist/material/paint/stamp.d.ts +3 -0
- package/dist/material/paint/strip.d.ts +3 -0
- package/dist/material/paint/surface.d.ts +5 -0
- package/dist/material/paint/types.d.ts +65 -0
- package/dist/material/paint/validate.d.ts +3 -0
- package/dist/material/palette.d.ts +14 -0
- package/dist/material/shader-godot.d.ts +2 -0
- package/dist/material/shader-three.d.ts +2 -0
- package/dist/material/shader.d.ts +46 -0
- package/dist/material/slots.d.ts +5 -0
- package/dist/material/texture-source.d.ts +34 -0
- package/dist/material/trim-sheet.d.ts +38 -0
- package/dist/neural/generator.d.ts +25 -0
- package/dist/neural/images.d.ts +17 -0
- package/dist/neural/index.d.ts +2 -0
- package/dist/neural/index.js +14 -0
- package/dist/neural/index.js.map +9 -0
- package/dist/passes/bake-ao.d.ts +17 -0
- package/dist/passes/grime.d.ts +15 -0
- package/dist/passes/index.d.ts +6 -0
- package/dist/passes/index.js +22 -0
- package/dist/passes/index.js.map +9 -0
- package/dist/passes/livery.d.ts +19 -0
- package/dist/passes/optimize-cache.d.ts +15 -0
- package/dist/passes/optimize-weld.d.ts +15 -0
- package/dist/passes/optimize.d.ts +28 -0
- package/dist/passes/ray-grid.d.ts +23 -0
- package/dist/passes/weighted-normals.d.ts +8 -0
- package/dist/primitives/beam.d.ts +17 -0
- package/dist/primitives/bevel-box.d.ts +13 -0
- package/dist/primitives/box.d.ts +16 -0
- package/dist/primitives/cell.d.ts +20 -0
- package/dist/primitives/check.d.ts +12 -0
- package/dist/primitives/closed.d.ts +11 -0
- package/dist/primitives/erosion.d.ts +22 -0
- package/dist/primitives/font-5x7.d.ts +3 -0
- package/dist/primitives/heightfield.d.ts +16 -0
- package/dist/primitives/index.d.ts +23 -0
- package/dist/primitives/index.js +81 -0
- package/dist/primitives/index.js.map +9 -0
- package/dist/primitives/lathe-facets.d.ts +8 -0
- package/dist/primitives/lathe.d.ts +26 -0
- package/dist/primitives/lattice.d.ts +30 -0
- package/dist/primitives/loft.d.ts +15 -0
- package/dist/primitives/mc-table.d.ts +2 -0
- package/dist/primitives/member.d.ts +19 -0
- package/dist/primitives/noise.d.ts +34 -0
- package/dist/primitives/planar.d.ts +10 -0
- package/dist/primitives/prism.d.ts +13 -0
- package/dist/primitives/sculpt-edit.d.ts +56 -0
- package/dist/primitives/sculpt-tree.d.ts +23 -0
- package/dist/primitives/sculpt.d.ts +27 -0
- package/dist/primitives/sdf-grid.d.ts +17 -0
- package/dist/primitives/sdf-ops.d.ts +37 -0
- package/dist/primitives/sdf.d.ts +21 -0
- package/dist/primitives/strip-uv.d.ts +11 -0
- package/dist/primitives/surface-nets.d.ts +7 -0
- package/dist/primitives/sweep.d.ts +19 -0
- package/dist/primitives/terrain-color.d.ts +30 -0
- package/dist/primitives/terrain-grid.d.ts +36 -0
- package/dist/primitives/text-layout.d.ts +22 -0
- package/dist/primitives/text.d.ts +27 -0
- package/dist/primitives/tiled.d.ts +22 -0
- package/dist/primitives/transport.d.ts +17 -0
- package/dist/primitives/triangulate.d.ts +2 -0
- package/dist/primitives/value-noise.d.ts +10 -0
- package/dist/qa/checks.d.ts +11 -0
- package/dist/qa/clash.d.ts +2 -0
- package/dist/qa/floating.d.ts +5 -0
- package/dist/qa/gates.d.ts +12 -0
- package/dist/qa/geometry.d.ts +21 -0
- package/dist/qa/index.d.ts +12 -0
- package/dist/qa/index.js +78 -0
- package/dist/qa/index.js.map +9 -0
- package/dist/qa/inside.d.ts +12 -0
- package/dist/qa/inspect.d.ts +18 -0
- package/dist/qa/lods.d.ts +12 -0
- package/dist/qa/measures.d.ts +4 -0
- package/dist/qa/occlusion.d.ts +3 -0
- package/dist/qa/sanity.d.ts +7 -0
- package/dist/qa/types.d.ts +12 -0
- package/dist/render/beauty.d.ts +40 -0
- package/dist/render/camera.d.ts +33 -0
- package/dist/render/depth-map.d.ts +38 -0
- package/dist/render/font.d.ts +1 -0
- package/dist/render/ground.d.ts +13 -0
- package/dist/render/index.d.ts +10 -0
- package/dist/render/index.js +47 -0
- package/dist/render/index.js.map +9 -0
- package/dist/render/lighting.d.ts +27 -0
- package/dist/render/lod-strip.d.ts +5 -0
- package/dist/render/metrics.d.ts +37 -0
- package/dist/render/options.d.ts +28 -0
- package/dist/render/photo-match.d.ts +19 -0
- package/dist/render/raster.d.ts +25 -0
- package/dist/render/resolve.d.ts +11 -0
- package/dist/render/review-prompt.d.ts +2 -0
- package/dist/render/review-warnings.d.ts +34 -0
- package/dist/render/review.d.ts +24 -0
- package/dist/render/scene.d.ts +18 -0
- package/dist/render/shade.d.ts +22 -0
- package/dist/render/sheet.d.ts +15 -0
- package/dist/render/texture.d.ts +15 -0
- package/dist/render/thumbnail.d.ts +8 -0
- package/dist/render/vis-buffer.d.ts +18 -0
- package/dist/testing/assert.d.ts +21 -0
- package/dist/testing/compiled.d.ts +15 -0
- package/dist/testing/hash.d.ts +1 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +134 -0
- package/dist/testing/index.js.map +13 -0
- package/dist/testing/snapshot.d.ts +13 -0
- package/docs/README.md +56 -0
- package/docs/architecture/README.md +68 -0
- package/docs/architecture/adding-a-kind.md +44 -0
- package/docs/architecture/adding-a-primitive.md +49 -0
- package/docs/architecture/errors.md +47 -0
- package/docs/architecture/glb-production.md +214 -0
- package/docs/architecture/gltf-capabilities.md +117 -0
- package/docs/architecture/materials.md +151 -0
- package/docs/decisions/001-recipe-compiler-over-ai-meshes.md +27 -0
- package/docs/decisions/002-typescript-not-json.md +22 -0
- package/docs/decisions/003-shared-trim-sheet.md +21 -0
- package/docs/decisions/004-z-up-metres.md +21 -0
- package/docs/decisions/005-zero-runtime-deps.md +21 -0
- package/docs/decisions/006-single-package-subpath-exports.md +20 -0
- package/docs/decisions/007-cpu-contact-sheets.md +21 -0
- package/docs/decisions/008-surface-materials.md +21 -0
- package/docs/decisions/009-gltf-front-axis.md +21 -0
- package/docs/decisions/README.md +15 -0
- package/docs/idea/01-vision.md +117 -0
- package/docs/idea/02-dsl.md +343 -0
- package/docs/idea/03-ir.md +97 -0
- package/docs/idea/04-materials.md +114 -0
- package/docs/idea/05-agent-loop.md +141 -0
- package/docs/idea/06-qa.md +101 -0
- package/docs/idea/07-what-fits.md +45 -0
- package/docs/idea/08-neural-adapters.md +78 -0
- package/docs/idea/09-kinds.md +105 -0
- package/docs/idea/10-sculpting.md +166 -0
- package/docs/idea/11-materials-authoring.md +132 -0
- package/docs/idea/12-blender-bridge.md +136 -0
- package/docs/idea/13-asset-pipeline-research.md +89 -0
- package/docs/landscape.md +49 -0
- package/docs/plans/roadmap.md +139 -0
- package/examples/build-with-bun.ts +41 -0
- package/llms.txt +47 -0
- package/package.json +100 -4
- package/recipes/README.md +38 -0
- package/recipes/asteroid/README.md +46 -0
- package/recipes/asteroid/asteroid.ts +336 -0
- package/recipes/boulders/README.md +28 -0
- package/recipes/boulders/boulders.ts +117 -0
- package/recipes/boxcar/README.md +53 -0
- package/recipes/boxcar/boxcar.ts +1000 -0
- package/recipes/cargo_container_scifi/README.md +52 -0
- package/recipes/cargo_container_scifi/cargo_container_scifi.ts +461 -0
- package/recipes/dropship/README.md +84 -0
- package/recipes/dropship/dropship.ts +1144 -0
- package/recipes/eiffel_tower/README.md +110 -0
- package/recipes/eiffel_tower/eiffel_tower.ts +781 -0
- package/recipes/goblin_head/README.md +75 -0
- package/recipes/goblin_head/goblin_head.ts +38 -0
- package/recipes/human_head/README.md +68 -0
- package/recipes/human_head/human_head.ts +38 -0
- package/recipes/loco_440/README.md +32 -0
- package/recipes/loco_440/loco_440.ts +1404 -0
- package/recipes/material_swatches/README.md +21 -0
- package/recipes/material_swatches/material_swatches.ts +189 -0
- package/recipes/mountain_range/README.md +45 -0
- package/recipes/mountain_range/mountain_range.ts +128 -0
- package/recipes/oak/README.md +30 -0
- package/recipes/oak/oak.ts +19 -0
- package/recipes/orc_head/README.md +78 -0
- package/recipes/orc_head/orc_head.ts +41 -0
- package/recipes/palm/README.md +30 -0
- package/recipes/palm/palm.ts +19 -0
- package/recipes/pine/README.md +29 -0
- package/recipes/pine/pine.ts +19 -0
- package/recipes/signal_gantry/README.md +36 -0
- package/recipes/signal_gantry/signal_gantry.ts +522 -0
- package/recipes/station_halt/README.md +39 -0
- package/recipes/station_halt/station_halt.ts +722 -0
- package/recipes/t34/README.md +44 -0
- package/recipes/t34/t34.ts +1068 -0
- package/recipes/tiger_1/README.md +75 -0
- package/recipes/tiger_1/tiger_1.ts +1370 -0
- package/recipes/water_tower/README.md +40 -0
- package/recipes/water_tower/water_tower.ts +542 -0
- package/src/cli/args.ts +125 -0
- package/src/cli/bin.ts +7 -0
- package/src/cli/load.ts +17 -0
- package/src/cli/manifest.ts +95 -0
- package/src/cli/render-cmds.ts +66 -0
- package/src/cli/run.ts +192 -0
- package/src/cli/texture-cache.ts +24 -0
- package/src/core/asset.ts +129 -0
- package/src/core/definition.ts +156 -0
- package/src/core/errors.ts +50 -0
- package/src/core/family.ts +50 -0
- package/src/core/index.ts +66 -0
- package/src/core/mesh.ts +114 -0
- package/src/core/part.ts +130 -0
- package/src/core/png.ts +49 -0
- package/src/core/rng.ts +49 -0
- package/src/core/transform.ts +90 -0
- package/src/core/vec.ts +26 -0
- package/src/core/world.ts +80 -0
- package/src/export/bin-writer.ts +79 -0
- package/src/export/container.ts +35 -0
- package/src/export/credits.ts +25 -0
- package/src/export/glb-options.ts +53 -0
- package/src/export/glb.ts +187 -0
- package/src/export/hierarchy.ts +122 -0
- package/src/export/index.ts +34 -0
- package/src/export/lights.ts +49 -0
- package/src/export/lod-coverage.ts +71 -0
- package/src/export/materials.ts +126 -0
- package/src/export/merge-pivots.ts +146 -0
- package/src/export/metadata.ts +62 -0
- package/src/export/motion.ts +70 -0
- package/src/export/optimize-parts.ts +80 -0
- package/src/export/primitive.ts +35 -0
- package/src/export/tangents.ts +75 -0
- package/src/export/textures.ts +88 -0
- package/src/export/version.ts +6 -0
- package/src/grammar/index.ts +4 -0
- package/src/grammar/split.ts +87 -0
- package/src/grammar/whyte.ts +20 -0
- package/src/index.ts +14 -0
- package/src/kinds/building.ts +153 -0
- package/src/kinds/faces.ts +138 -0
- package/src/kinds/head-armour.ts +181 -0
- package/src/kinds/head-beard.ts +133 -0
- package/src/kinds/head-bust.ts +184 -0
- package/src/kinds/head-extras.ts +150 -0
- package/src/kinds/head-face.ts +242 -0
- package/src/kinds/head-garb.ts +181 -0
- package/src/kinds/head-geom.ts +31 -0
- package/src/kinds/head-hair.ts +193 -0
- package/src/kinds/head-layout.ts +63 -0
- package/src/kinds/head-mesh.ts +195 -0
- package/src/kinds/head-mouth.ts +111 -0
- package/src/kinds/head-params.ts +162 -0
- package/src/kinds/head-presets.ts +155 -0
- package/src/kinds/head-rim.ts +128 -0
- package/src/kinds/head-tone.ts +52 -0
- package/src/kinds/head-torso.ts +230 -0
- package/src/kinds/head.ts +176 -0
- package/src/kinds/hull-lines.ts +160 -0
- package/src/kinds/hull-skin.ts +83 -0
- package/src/kinds/hull.ts +209 -0
- package/src/kinds/index.ts +63 -0
- package/src/kinds/mass.ts +110 -0
- package/src/kinds/openings.ts +141 -0
- package/src/kinds/planned.ts +12 -0
- package/src/kinds/roof-chimney.ts +100 -0
- package/src/kinds/roof-shape.ts +230 -0
- package/src/kinds/roof.ts +250 -0
- package/src/kinds/vegetation-fronds.ts +126 -0
- package/src/kinds/vegetation-impostor.ts +118 -0
- package/src/kinds/vegetation-leaves.ts +168 -0
- package/src/kinds/vegetation-mesh.ts +174 -0
- package/src/kinds/vegetation-params.ts +147 -0
- package/src/kinds/vegetation-presets.ts +184 -0
- package/src/kinds/vegetation-skeleton.ts +168 -0
- package/src/kinds/vegetation.ts +199 -0
- package/src/kinds/vehicle.ts +144 -0
- package/src/material/cc0.ts +41 -0
- package/src/material/define.ts +130 -0
- package/src/material/generator.ts +63 -0
- package/src/material/index.ts +60 -0
- package/src/material/library.ts +196 -0
- package/src/material/material-def.ts +84 -0
- package/src/material/paint/bond.ts +60 -0
- package/src/material/paint/canvas.ts +101 -0
- package/src/material/paint/cell.ts +39 -0
- package/src/material/paint/cells-round.ts +119 -0
- package/src/material/paint/cells.ts +111 -0
- package/src/material/paint/compose.ts +53 -0
- package/src/material/paint/concrete.ts +62 -0
- package/src/material/paint/courses.ts +85 -0
- package/src/material/paint/decode-png.ts +106 -0
- package/src/material/paint/default-sheet.ts +73 -0
- package/src/material/paint/fabric.ts +63 -0
- package/src/material/paint/foliage-broad.ts +126 -0
- package/src/material/paint/foliage-common.ts +93 -0
- package/src/material/paint/foliage-compound.ts +135 -0
- package/src/material/paint/foliage-conifer.ts +143 -0
- package/src/material/paint/foliage-raster.ts +196 -0
- package/src/material/paint/foliage.ts +23 -0
- package/src/material/paint/image-strip.ts +88 -0
- package/src/material/paint/kit.ts +37 -0
- package/src/material/paint/masks.ts +46 -0
- package/src/material/paint/metal.ts +109 -0
- package/src/material/paint/noise.ts +52 -0
- package/src/material/paint/normal.ts +52 -0
- package/src/material/paint/orm.ts +108 -0
- package/src/material/paint/planks.ts +101 -0
- package/src/material/paint/plates.ts +72 -0
- package/src/material/paint/shapes.ts +28 -0
- package/src/material/paint/slate.ts +52 -0
- package/src/material/paint/stamp.ts +40 -0
- package/src/material/paint/strip.ts +48 -0
- package/src/material/paint/surface.ts +60 -0
- package/src/material/paint/types.ts +94 -0
- package/src/material/paint/validate.ts +74 -0
- package/src/material/palette.ts +46 -0
- package/src/material/shader-godot.ts +77 -0
- package/src/material/shader-three.ts +103 -0
- package/src/material/shader.ts +100 -0
- package/src/material/slots.ts +18 -0
- package/src/material/texture-source.ts +86 -0
- package/src/material/trim-sheet.ts +166 -0
- package/src/neural/generator.ts +37 -0
- package/src/neural/images.ts +27 -0
- package/src/neural/index.ts +10 -0
- package/src/passes/bake-ao.ts +183 -0
- package/src/passes/grime.ts +37 -0
- package/src/passes/index.ts +8 -0
- package/src/passes/livery.ts +66 -0
- package/src/passes/optimize-cache.ts +175 -0
- package/src/passes/optimize-weld.ts +147 -0
- package/src/passes/optimize.ts +85 -0
- package/src/passes/ray-grid.ts +237 -0
- package/src/passes/weighted-normals.ts +125 -0
- package/src/primitives/beam.ts +60 -0
- package/src/primitives/bevel-box.ts +140 -0
- package/src/primitives/box.ts +90 -0
- package/src/primitives/cell.ts +115 -0
- package/src/primitives/check.ts +49 -0
- package/src/primitives/closed.ts +74 -0
- package/src/primitives/erosion.ts +183 -0
- package/src/primitives/font-5x7.ts +117 -0
- package/src/primitives/heightfield.ts +101 -0
- package/src/primitives/index.ts +56 -0
- package/src/primitives/lathe-facets.ts +45 -0
- package/src/primitives/lathe.ts +174 -0
- package/src/primitives/lattice.ts +131 -0
- package/src/primitives/loft.ts +174 -0
- package/src/primitives/mc-table.ts +41 -0
- package/src/primitives/member.ts +130 -0
- package/src/primitives/noise.ts +157 -0
- package/src/primitives/planar.ts +55 -0
- package/src/primitives/prism.ts +85 -0
- package/src/primitives/sculpt-edit.ts +212 -0
- package/src/primitives/sculpt-tree.ts +226 -0
- package/src/primitives/sculpt.ts +80 -0
- package/src/primitives/sdf-grid.ts +131 -0
- package/src/primitives/sdf-ops.ts +145 -0
- package/src/primitives/sdf.ts +83 -0
- package/src/primitives/strip-uv.ts +26 -0
- package/src/primitives/surface-nets.ts +161 -0
- package/src/primitives/sweep.ts +162 -0
- package/src/primitives/terrain-color.ts +85 -0
- package/src/primitives/terrain-grid.ts +137 -0
- package/src/primitives/text-layout.ts +85 -0
- package/src/primitives/text.ts +197 -0
- package/src/primitives/tiled.ts +93 -0
- package/src/primitives/transport.ts +85 -0
- package/src/primitives/triangulate.ts +42 -0
- package/src/primitives/value-noise.ts +62 -0
- package/src/qa/checks.ts +110 -0
- package/src/qa/clash.ts +177 -0
- package/src/qa/floating.ts +63 -0
- package/src/qa/gates.ts +126 -0
- package/src/qa/geometry.ts +187 -0
- package/src/qa/index.ts +28 -0
- package/src/qa/inside.ts +114 -0
- package/src/qa/inspect.ts +107 -0
- package/src/qa/lods.ts +97 -0
- package/src/qa/measures.ts +67 -0
- package/src/qa/occlusion.ts +166 -0
- package/src/qa/sanity.ts +137 -0
- package/src/qa/types.ts +17 -0
- package/src/render/beauty.ts +115 -0
- package/src/render/camera.ts +142 -0
- package/src/render/depth-map.ts +191 -0
- package/src/render/font.ts +76 -0
- package/src/render/ground.ts +87 -0
- package/src/render/index.ts +34 -0
- package/src/render/lighting.ts +121 -0
- package/src/render/lod-strip.ts +34 -0
- package/src/render/metrics.ts +147 -0
- package/src/render/options.ts +81 -0
- package/src/render/photo-match.ts +28 -0
- package/src/render/raster.ts +143 -0
- package/src/render/resolve.ts +109 -0
- package/src/render/review-prompt.ts +59 -0
- package/src/render/review-warnings.ts +92 -0
- package/src/render/review.ts +103 -0
- package/src/render/scene.ts +119 -0
- package/src/render/shade.ts +204 -0
- package/src/render/sheet.ts +88 -0
- package/src/render/texture.ts +97 -0
- package/src/render/thumbnail.ts +75 -0
- package/src/render/vis-buffer.ts +119 -0
- package/src/testing/assert.ts +115 -0
- package/src/testing/compiled.ts +31 -0
- package/src/testing/hash.ts +14 -0
- package/src/testing/index.ts +14 -0
- package/src/testing/snapshot.ts +37 -0
- package/src/types/gltf-validator.d.ts +13 -0
|
@@ -0,0 +1,1144 @@
|
|
|
1
|
+
// VTD-20 "Kite" — an ORIGINAL VTOL troop dropship (no franchise design): a 20 m hard-surface
|
|
2
|
+
// fuselage with a chamfered, tumblehomed section, armoured gear sponsons, a dorsal drive hump, two
|
|
3
|
+
// tilting ducted-fan nacelles on stub wings, a rear loading ramp under an upswept V-tail boom and
|
|
4
|
+
// skid-pad gear. Scale from real tiltrotor / tandem-rotor transports (V-22 fuselage 17.5 m, CH-47
|
|
5
|
+
// fuselage 15.9 m × 3.8 m, cabin 9.3 × 2.29 × 1.98 m): see README.md. +X front, Z up, metres.
|
|
6
|
+
//
|
|
7
|
+
// Engine contract: `nacelle_l/_r` sway ±30° about Y (thrust vectoring) › `fan_l/_r` spin,
|
|
8
|
+
// `thruster_l/_r` glow; `ramp` rests closed (40°), one-way swing to the ground (−22.5°);
|
|
9
|
+
// `turret` › `gun`; light sockets `nav_l` (red, port = +Y), `nav_r` (green), `nav_tail` (white
|
|
10
|
+
// strobe), `cabin_light`, `landing_light`; emitters `thrust_*`, `downwash_*`, `muzzle`.
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
bakeAo,
|
|
14
|
+
beam,
|
|
15
|
+
box,
|
|
16
|
+
type Check,
|
|
17
|
+
type CheckFinding,
|
|
18
|
+
cylinder,
|
|
19
|
+
defineAsset,
|
|
20
|
+
grime,
|
|
21
|
+
hex,
|
|
22
|
+
insideSolid,
|
|
23
|
+
lathe,
|
|
24
|
+
loft,
|
|
25
|
+
type Mesh,
|
|
26
|
+
merge,
|
|
27
|
+
noOverlap,
|
|
28
|
+
place,
|
|
29
|
+
planar,
|
|
30
|
+
prism,
|
|
31
|
+
symmetric,
|
|
32
|
+
text,
|
|
33
|
+
type Vec2,
|
|
34
|
+
type Vec3,
|
|
35
|
+
weightedNormals,
|
|
36
|
+
worldMeshes,
|
|
37
|
+
} from '@developerz.ai/ts23d';
|
|
38
|
+
|
|
39
|
+
// ── palette: gunmetal two-tone, dark belly, orange accent, yellow/black hazard ──────────────────
|
|
40
|
+
const HULL = hex('#636b71');
|
|
41
|
+
const HULL_LIGHT = hex('#788086');
|
|
42
|
+
const PANEL = hex('#4b5258');
|
|
43
|
+
const BELLY = hex('#2c3135');
|
|
44
|
+
const SEAM = hex('#1f2326');
|
|
45
|
+
const DARK = hex('#222528');
|
|
46
|
+
const METAL = hex('#555a60');
|
|
47
|
+
const ACCENT = hex('#c8641c');
|
|
48
|
+
const HAZARD = hex('#d9a421');
|
|
49
|
+
const BLACK = hex('#17181a');
|
|
50
|
+
const GLASS = hex('#3f7598');
|
|
51
|
+
const GLOW = hex('#6fd2ff');
|
|
52
|
+
const INTERIOR = hex('#4a5157');
|
|
53
|
+
const STENCIL = hex('#d6d3c8');
|
|
54
|
+
/** Hull number, stencilled on the sponsons and both faces of the fins. */
|
|
55
|
+
const HULL_NO = '07';
|
|
56
|
+
|
|
57
|
+
// ── layout ───────────────────────────────────────────────────────────────────────────────────────
|
|
58
|
+
type Station = {
|
|
59
|
+
readonly x: number;
|
|
60
|
+
readonly zb: number; // belly
|
|
61
|
+
readonly zw: number; // waist (lower side ends, tumblehome begins)
|
|
62
|
+
readonly zt: number; // roof
|
|
63
|
+
readonly hw: number; // half width at the waist
|
|
64
|
+
};
|
|
65
|
+
/** Nose stations, tip → front bulkhead. The cabin runs from the last one to CABIN_END. */
|
|
66
|
+
const NOSE: readonly Station[] = [
|
|
67
|
+
{ x: 10.0, zb: 2.3, zw: 2.45, zt: 2.6, hw: 0.32 },
|
|
68
|
+
{ x: 9.4, zb: 1.9, zw: 2.45, zt: 3.05, hw: 0.82 },
|
|
69
|
+
{ x: 8.4, zb: 1.6, zw: 2.55, zt: 3.55, hw: 1.3 },
|
|
70
|
+
{ x: 7.0, zb: 1.4, zw: 2.7, zt: 4.05, hw: 1.66 },
|
|
71
|
+
{ x: 5.6, zb: 1.3, zw: 2.8, zt: 4.3, hw: 1.85 },
|
|
72
|
+
];
|
|
73
|
+
const CABIN: Station = { x: 5.6, zb: 1.3, zw: 2.8, zt: 4.3, hw: 1.85 };
|
|
74
|
+
const CABIN_END = -4.3;
|
|
75
|
+
const WALL = 0.08;
|
|
76
|
+
const BOOM: readonly Station[] = [
|
|
77
|
+
{ x: -4.3, zb: 3.45, zw: 3.8, zt: 4.3, hw: 1.7 },
|
|
78
|
+
{ x: -7.2, zb: 3.85, zw: 4.02, zt: 4.38, hw: 1.25 },
|
|
79
|
+
{ x: -9.6, zb: 3.95, zw: 4.05, zt: 4.3, hw: 0.72 },
|
|
80
|
+
];
|
|
81
|
+
const BOOM_END = -9.6;
|
|
82
|
+
const WING_Z = 3.5;
|
|
83
|
+
const WING_TIP = 4.3;
|
|
84
|
+
const POD_X = 0.2;
|
|
85
|
+
const POD_Y = 5.55;
|
|
86
|
+
const POD_R = 1.1;
|
|
87
|
+
const HINGE: Vec3 = [-4.5, 0, 1.35];
|
|
88
|
+
const RAMP_LEN = 3.2;
|
|
89
|
+
const RAMP_HW = 1.4;
|
|
90
|
+
const RAMP_CLOSED = 40;
|
|
91
|
+
const RAMP_OPEN = -22.5; // lip on the ground
|
|
92
|
+
const RAMP_SWING = RAMP_CLOSED - RAMP_OPEN;
|
|
93
|
+
const SPONSON = { x0: 3.8, x1: -3.8, zb: 1.45, zt: 2.78, y0: 1.8, y1: 2.3 };
|
|
94
|
+
const MAIN_GEAR: Vec3 = [-1.4, 2.05, 0];
|
|
95
|
+
const NOSE_GEAR: Vec3 = [7.1, 0, 0];
|
|
96
|
+
const DEG = Math.PI / 180;
|
|
97
|
+
const SIDES = [
|
|
98
|
+
[1, 'l'],
|
|
99
|
+
[-1, 'r'],
|
|
100
|
+
] as const;
|
|
101
|
+
|
|
102
|
+
/** 10-point chamfered, tumblehomed section (y, z) at a station, −Y belly corner first. */
|
|
103
|
+
function section(s: Station, inset = 0): Vec2[] {
|
|
104
|
+
const hw = s.hw - inset;
|
|
105
|
+
const zb = s.zb + inset;
|
|
106
|
+
const zt = s.zt - inset;
|
|
107
|
+
const h = zt - zb;
|
|
108
|
+
const cb = Math.min(0.32, h * 0.18, hw * 0.3);
|
|
109
|
+
const ct = Math.min(0.32, h * 0.2, hw * 0.3);
|
|
110
|
+
const tum = Math.min(0.26, hw * 0.15);
|
|
111
|
+
const zw = Math.min(Math.max(s.zw, zb + cb + 0.02), zt - ct - 0.02);
|
|
112
|
+
const half: Vec2[] = [
|
|
113
|
+
[hw - cb, zb],
|
|
114
|
+
[hw, zb + cb],
|
|
115
|
+
[hw, zw],
|
|
116
|
+
[hw - tum, zt - ct],
|
|
117
|
+
[hw - tum - ct, zt],
|
|
118
|
+
];
|
|
119
|
+
return [...half.map(([y, z]): Vec2 => [-y, z]), ...[...half].reverse()];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const ringOf = (s: Station): Vec3[] => section(s).map(([y, z]): Vec3 => [s.x, y, z]);
|
|
123
|
+
|
|
124
|
+
/** y of the cabin's outer skin at height z on the +Y side (vertical below the waist). */
|
|
125
|
+
function skinY(z: number): number {
|
|
126
|
+
const [, , w, t] = section(CABIN).slice(5).reverse();
|
|
127
|
+
if (!w || !t || z <= w[1]) return CABIN.hw;
|
|
128
|
+
return w[0] + ((t[0] - w[0]) * (z - w[1])) / (t[1] - w[1]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Lofted closed shell, weighted-normal shaded so every panel reads flat and crisp. */
|
|
132
|
+
function shell(rings: readonly (readonly Vec3[])[], color: (p: Vec3) => Vec3, hard = 25): Mesh {
|
|
133
|
+
const m = loft({
|
|
134
|
+
rings,
|
|
135
|
+
color: (_r, _i, p) => color(p),
|
|
136
|
+
capStart: true,
|
|
137
|
+
capEnd: true,
|
|
138
|
+
uv: 'row',
|
|
139
|
+
});
|
|
140
|
+
return weightedNormals(m, { hardAngle: hard });
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const hullColor = (p: Vec3): Vec3 => (p[2] < 1.75 ? BELLY : p[2] > 3.95 ? HULL_LIGHT : HULL);
|
|
144
|
+
|
|
145
|
+
/** A flat quad lifted `off` metres along its normal (CCW seen from the side it faces). */
|
|
146
|
+
function quad(a: Vec3, b: Vec3, c: Vec3, d: Vec3, color: Vec3, off = 0.015): Mesh {
|
|
147
|
+
const u: Vec3 = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];
|
|
148
|
+
const v: Vec3 = [d[0] - a[0], d[1] - a[1], d[2] - a[2]];
|
|
149
|
+
const n: Vec3 = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];
|
|
150
|
+
const l = Math.hypot(...n) || 1;
|
|
151
|
+
const lift = (p: Vec3): Vec3 => [
|
|
152
|
+
p[0] + (n[0] / l) * off,
|
|
153
|
+
p[1] + (n[1] / l) * off,
|
|
154
|
+
p[2] + (n[2] / l) * off,
|
|
155
|
+
];
|
|
156
|
+
return planar({ points: [lift(a), lift(b), lift(c), lift(d)], color });
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** `quad`, wound so its normal points away from `centre` (seams around a ring). */
|
|
160
|
+
function quadOut(a: Vec3, b: Vec3, c: Vec3, d: Vec3, color: Vec3, centre: Vec3, off: number): Mesh {
|
|
161
|
+
const u: Vec3 = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];
|
|
162
|
+
const v: Vec3 = [d[0] - a[0], d[1] - a[1], d[2] - a[2]];
|
|
163
|
+
const n: Vec3 = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];
|
|
164
|
+
const out = (a[0] - centre[0]) * n[0] + (a[1] - centre[1]) * n[1] + (a[2] - centre[2]) * n[2];
|
|
165
|
+
return out >= 0 ? quad(a, b, c, d, color, off) : quad(a, d, c, b, color, off);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Yellow/black stripe band: `stripes` cells from a→b, each `up` tall (CCW: (b−a) × up = out). */
|
|
169
|
+
function hazard(a: Vec3, b: Vec3, up: Vec3, stripes: number, off = 0.012): Mesh {
|
|
170
|
+
const step = [0, 1, 2].map((k) => ((b[k] ?? 0) - (a[k] ?? 0)) / stripes);
|
|
171
|
+
const at = (k: number, t: number): Vec3 => [
|
|
172
|
+
a[0] + (step[0] ?? 0) * k + up[0] * t,
|
|
173
|
+
a[1] + (step[1] ?? 0) * k + up[1] * t,
|
|
174
|
+
a[2] + (step[2] ?? 0) * k + up[2] * t,
|
|
175
|
+
];
|
|
176
|
+
return merge(
|
|
177
|
+
Array.from({ length: stripes }, (_, k) =>
|
|
178
|
+
quad(at(k, 0), at(k + 1, 0), at(k + 1, 1), at(k, 1), k % 2 ? BLACK : HAZARD, off),
|
|
179
|
+
),
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const bevelled = (size: Vec3, color: Vec3, bevel: number, at: Vec3 = [0, 0, 0]): Mesh =>
|
|
184
|
+
box({ size, color, at, bevel: bevel > 0 && bevel < Math.min(...size) / 2 ? bevel : 0 });
|
|
185
|
+
|
|
186
|
+
/** A ring of a cross-section squeezed toward an anchor (loft end fairings). */
|
|
187
|
+
const squeeze = (pts: readonly Vec2[], anchor: Vec2, ky: number, kz: number, x: number): Vec3[] =>
|
|
188
|
+
pts.map(
|
|
189
|
+
([y, z]): Vec3 => [x, anchor[0] + (y - anchor[0]) * ky, anchor[1] + (z - anchor[1]) * kz],
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
/** Hexagonal airfoil ring in XZ at span y: leading edge xl, trailing xt, thickness th. */
|
|
193
|
+
function airfoil(y: number, xl: number, xt: number, th: number): Vec3[] {
|
|
194
|
+
const c = xl - xt;
|
|
195
|
+
return [
|
|
196
|
+
[xl, y, WING_Z],
|
|
197
|
+
[xl - 0.18 * c, y, WING_Z + th / 2],
|
|
198
|
+
[xt + 0.12 * c, y, WING_Z + th / 2],
|
|
199
|
+
[xt, y, WING_Z],
|
|
200
|
+
[xt + 0.12 * c, y, WING_Z - th / 2],
|
|
201
|
+
[xl - 0.18 * c, y, WING_Z - th / 2],
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The ramp's arc (closed → open, every 6°) never enters the hull and never digs into the ground.
|
|
207
|
+
* `clashes` already sweeps the real sector; this adds the ground, which is not geometry.
|
|
208
|
+
*/
|
|
209
|
+
const rampArc: Check = (asset) => {
|
|
210
|
+
const world = worldMeshes(asset.parts);
|
|
211
|
+
const out: CheckFinding[] = [];
|
|
212
|
+
const corners: Vec3[] = [];
|
|
213
|
+
for (const t of [0.02, 0.5, 1])
|
|
214
|
+
for (const y of [-RAMP_HW + 0.05, 0, RAMP_HW - 0.05])
|
|
215
|
+
for (const z of [-0.11, 0.13]) corners.push([-0.05 - t * (RAMP_LEN - 0.05), y, z]);
|
|
216
|
+
for (let a = RAMP_OPEN; a <= RAMP_CLOSED + 1e-9; a += 6) {
|
|
217
|
+
const c = Math.cos(a * DEG);
|
|
218
|
+
const sn = Math.sin(a * DEG);
|
|
219
|
+
for (const [x, y, z] of corners) {
|
|
220
|
+
const p: Vec3 = [HINGE[0] + x * c + z * sn, y, HINGE[2] - x * sn + z * c];
|
|
221
|
+
if (p[2] < -0.02)
|
|
222
|
+
out.push({
|
|
223
|
+
message: `ramp at ${a.toFixed(0)}° digs ${(-p[2]).toFixed(2)} m into the ground`,
|
|
224
|
+
fix: 'shorten the ramp or raise RAMP_OPEN',
|
|
225
|
+
part: 'ramp',
|
|
226
|
+
});
|
|
227
|
+
for (const name of ['fuselage', 'tail_boom', 'dorsal']) {
|
|
228
|
+
const m = world.get(name);
|
|
229
|
+
if (m && insideSolid(p, m))
|
|
230
|
+
out.push({
|
|
231
|
+
message: `ramp at ${a.toFixed(0)}° enters '${name}' at x ${p[0].toFixed(2)} z ${p[2].toFixed(2)}`,
|
|
232
|
+
fix: 'lower RAMP_CLOSED or move the boom',
|
|
233
|
+
part: 'ramp',
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return out.slice(0, 3);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export const dropship = defineAsset({
|
|
242
|
+
name: 'dropship',
|
|
243
|
+
kind: 'vehicle',
|
|
244
|
+
description:
|
|
245
|
+
'Original VTOL troop dropship: chamfered hard-surface fuselage, tilting ducted-fan nacelles, rear ramp, skid gear',
|
|
246
|
+
tags: ['sci-fi', 'vehicle', 'aircraft', 'vtol', 'hard-surface'],
|
|
247
|
+
license: 'CC0-1.0',
|
|
248
|
+
sources: [
|
|
249
|
+
'https://www.boeing.com/defense/military-rotorcraft/v-22-osprey',
|
|
250
|
+
'https://thedefensepost.com/2026/08/03/v-22-osprey-guide/',
|
|
251
|
+
'https://www.boeing.com/defense/military-rotorcraft/h-47-chinook',
|
|
252
|
+
'https://www.inetres.com/gp/military/ar/rotor/CH-47.html',
|
|
253
|
+
'recipes/dropship/README.md (design spec)',
|
|
254
|
+
],
|
|
255
|
+
real: {
|
|
256
|
+
length: 20.2,
|
|
257
|
+
width: 13.4,
|
|
258
|
+
height: 6.0,
|
|
259
|
+
measures: [
|
|
260
|
+
{
|
|
261
|
+
label: 'fuselage width',
|
|
262
|
+
axis: 'y',
|
|
263
|
+
value: 3.7,
|
|
264
|
+
parts: ['fuselage'],
|
|
265
|
+
source: 'design spec (CH-47 fuselage 3.78 m)',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
label: 'fuselage depth',
|
|
269
|
+
axis: 'z',
|
|
270
|
+
value: 3.0,
|
|
271
|
+
parts: ['fuselage'],
|
|
272
|
+
source: 'design spec (CH-47 cabin 1.98 m + floor and roof structure)',
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
label: 'nacelle centres',
|
|
276
|
+
axis: 'y',
|
|
277
|
+
value: 11.1,
|
|
278
|
+
between: ['thruster_l', 'thruster_r'],
|
|
279
|
+
source: 'design spec (V-22 rotor centres ≈ 14.2 m, ducted fans sit closer)',
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
label: 'main gear track',
|
|
283
|
+
axis: 'y',
|
|
284
|
+
value: 4.1,
|
|
285
|
+
between: ['gear_l', 'gear_r'],
|
|
286
|
+
source: 'design spec',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
label: 'nacelle length',
|
|
290
|
+
axis: 'z',
|
|
291
|
+
value: 4.2,
|
|
292
|
+
parts: ['nacelle_r'],
|
|
293
|
+
source: 'design spec',
|
|
294
|
+
},
|
|
295
|
+
{ label: 'ramp width', axis: 'y', value: 2.8, parts: ['ramp'], source: 'design spec' },
|
|
296
|
+
],
|
|
297
|
+
},
|
|
298
|
+
// Measured 12558 / 4872 / 1792; headroom ≤ 17%.
|
|
299
|
+
budget: { triangles: [14400, 5500, 2100] },
|
|
300
|
+
checks: [symmetric('_l', '_r', 'y'), noOverlap('nacelle_*'), rampArc],
|
|
301
|
+
glow: [
|
|
302
|
+
{ parts: ['thruster_*'], color: GLOW, strength: 8 },
|
|
303
|
+
{ parts: ['navlight_l'], color: hex('#ff2a20'), strength: 6 },
|
|
304
|
+
{ parts: ['navlight_r'], color: hex('#22ff5a'), strength: 6 },
|
|
305
|
+
{ parts: ['navlight_tail', 'cabin_lamp'], color: hex('#fff4e0'), strength: 5 },
|
|
306
|
+
],
|
|
307
|
+
build(ctx) {
|
|
308
|
+
const lod = ctx.lod;
|
|
309
|
+
const bv = ctx.pick([0.03, 0.015, 0]);
|
|
310
|
+
const seg = ctx.pick([20, 12, 8]);
|
|
311
|
+
const rng = ctx.rng.fork('greeble');
|
|
312
|
+
/** Static parts are collected, then AO-baked against each other before they are emitted. */
|
|
313
|
+
const statics: [string, Mesh][] = [];
|
|
314
|
+
const solid = (name: string, mesh: Mesh): void => {
|
|
315
|
+
statics.push([name, mesh]);
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
// ── fuselage: lofted nose + thick-walled cabin plates (a real hollow behind the ramp) ────
|
|
319
|
+
const fus: Mesh[] = [shell(NOSE.map(ringOf), hullColor)];
|
|
320
|
+
const outer = section(CABIN);
|
|
321
|
+
const inner = section(CABIN, WALL);
|
|
322
|
+
for (let i = 0; i < outer.length; i++) {
|
|
323
|
+
const j = (i + 1) % outer.length;
|
|
324
|
+
const profile: Vec2[] = [outer[i], outer[j], inner[j], inner[i]].map(
|
|
325
|
+
(p): Vec2 => p ?? [0, 0],
|
|
326
|
+
);
|
|
327
|
+
const mid = ((profile[0]?.[1] ?? 0) + (profile[1]?.[1] ?? 0)) / 2;
|
|
328
|
+
fus.push(
|
|
329
|
+
place(
|
|
330
|
+
prism({
|
|
331
|
+
plane: 'yz',
|
|
332
|
+
depth: CABIN.x - CABIN_END,
|
|
333
|
+
profile,
|
|
334
|
+
color: hullColor([0, 0, mid]),
|
|
335
|
+
}),
|
|
336
|
+
{ at: [(CABIN.x + CABIN_END) / 2, 0, 0] },
|
|
337
|
+
),
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
// Ramp cheeks close the triangles beside the ramp, outboard of its swing.
|
|
341
|
+
for (const s of [-1, 1]) {
|
|
342
|
+
const cheek = prism({
|
|
343
|
+
plane: 'xz',
|
|
344
|
+
depth: 0.3,
|
|
345
|
+
profile: [
|
|
346
|
+
[-4.25, 1.3],
|
|
347
|
+
[-4.5, 1.3],
|
|
348
|
+
[-7.0, 3.86],
|
|
349
|
+
[-4.25, 3.6],
|
|
350
|
+
],
|
|
351
|
+
color: PANEL,
|
|
352
|
+
});
|
|
353
|
+
fus.push(place(cheek, { at: [0, s * 1.64, 0] }));
|
|
354
|
+
}
|
|
355
|
+
solid(
|
|
356
|
+
'fuselage',
|
|
357
|
+
grime(merge(fus), {
|
|
358
|
+
ground: 2.2,
|
|
359
|
+
groundStrength: 0.35,
|
|
360
|
+
zones: [{ at: [-4.4, 0, 1.3], radius: 1.5, strength: 0.3 }],
|
|
361
|
+
}),
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
// ── sponsons (big): armoured gear housings along the lower flanks ─────────────────────────
|
|
365
|
+
const sp = SPONSON;
|
|
366
|
+
const spSec: Vec2[] = [
|
|
367
|
+
[sp.y0, sp.zb],
|
|
368
|
+
[sp.y1 - 0.18, sp.zb],
|
|
369
|
+
[sp.y1, sp.zb + 0.18],
|
|
370
|
+
[sp.y1, sp.zt - 0.26],
|
|
371
|
+
[sp.y1 - 0.22, sp.zt],
|
|
372
|
+
[sp.y0, sp.zt],
|
|
373
|
+
];
|
|
374
|
+
const anchor: Vec2 = [sp.y0, (sp.zb + sp.zt) / 2];
|
|
375
|
+
for (const [s, side] of SIDES) {
|
|
376
|
+
const sec = spSec.map(([y, z]): Vec2 => [s * y, z]);
|
|
377
|
+
const anc: Vec2 = [s * anchor[0], anchor[1]];
|
|
378
|
+
const rings = [
|
|
379
|
+
squeeze(sec, anc, 0.15, 0.55, sp.x0),
|
|
380
|
+
squeeze(sec, anc, 1, 1, sp.x0 - 0.8),
|
|
381
|
+
squeeze(sec, anc, 1, 1, sp.x1 + 0.6),
|
|
382
|
+
squeeze(sec, anc, 0.2, 0.6, sp.x1),
|
|
383
|
+
];
|
|
384
|
+
const bits: Mesh[] = [shell(rings, (p) => (p[2] < 1.7 ? BELLY : HULL), 30)];
|
|
385
|
+
if (lod < 2) {
|
|
386
|
+
// Armour plates (medium) with 6 cm seams, accent stripe, hazard on the rear plate.
|
|
387
|
+
const runs: [number, number][] = [
|
|
388
|
+
[2.9, 1.0],
|
|
389
|
+
[0.94, -0.9],
|
|
390
|
+
[-0.96, -2.9],
|
|
391
|
+
];
|
|
392
|
+
for (const [x0, x1] of runs) {
|
|
393
|
+
bits.push(
|
|
394
|
+
bevelled([x0 - x1, 0.05, 0.78], PANEL, bv / 2, [
|
|
395
|
+
(x0 + x1) / 2,
|
|
396
|
+
s * (sp.y1 + 0.02),
|
|
397
|
+
1.7,
|
|
398
|
+
]),
|
|
399
|
+
);
|
|
400
|
+
if (lod === 0)
|
|
401
|
+
bits.push(
|
|
402
|
+
bevelled([x0 - x1, 0.02, 0.07], ACCENT, 0, [(x0 + x1) / 2, s * (sp.y1 + 0.05), 2.38]),
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
if (lod === 0) {
|
|
406
|
+
// Bolt heads along the plate tops, a step and a grab handle by the crew door.
|
|
407
|
+
const bolt = cylinder({
|
|
408
|
+
radius: 0.025,
|
|
409
|
+
length: 0.02,
|
|
410
|
+
segments: 6,
|
|
411
|
+
axis: 'y',
|
|
412
|
+
color: METAL,
|
|
413
|
+
});
|
|
414
|
+
for (let i = 0; i < 18; i++)
|
|
415
|
+
bits.push(place(bolt, { at: [2.8 - i * 0.33, s * (sp.y1 + 0.055), 2.32] }));
|
|
416
|
+
bits.push(
|
|
417
|
+
hazard(
|
|
418
|
+
s > 0 ? [-1.0, sp.y1 + 0.046, 1.76] : [-2.85, -sp.y1 - 0.046, 1.76],
|
|
419
|
+
s > 0 ? [-2.85, sp.y1 + 0.046, 1.76] : [-1.0, -sp.y1 - 0.046, 1.76],
|
|
420
|
+
[0, 0, 0.16],
|
|
421
|
+
10,
|
|
422
|
+
0.002,
|
|
423
|
+
),
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (lod < 2)
|
|
428
|
+
// Hull number on the forward armour plate, reading front → back on each side.
|
|
429
|
+
bits.push(
|
|
430
|
+
text(HULL_NO, {
|
|
431
|
+
origin: [1.95, s * (sp.y1 + 0.045), 1.82],
|
|
432
|
+
along: [-s, 0, 0],
|
|
433
|
+
height: 0.45,
|
|
434
|
+
align: 'centre',
|
|
435
|
+
color: STENCIL,
|
|
436
|
+
}),
|
|
437
|
+
);
|
|
438
|
+
solid(`sponson_${side}`, grime(merge(bits), { ground: 2, groundStrength: 0.3 }));
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// ── dorsal drive hump + tail boom + V-tail ────────────────────────────────────────────────
|
|
442
|
+
const humpSec: Vec2[] = [
|
|
443
|
+
[-1.0, 4.22],
|
|
444
|
+
[1.0, 4.22],
|
|
445
|
+
[1.0, 4.5],
|
|
446
|
+
[0.72, 4.78],
|
|
447
|
+
[-0.72, 4.78],
|
|
448
|
+
[-1.0, 4.5],
|
|
449
|
+
];
|
|
450
|
+
const hump: Mesh[] = [
|
|
451
|
+
shell(
|
|
452
|
+
[
|
|
453
|
+
squeeze(humpSec, [0, 4.22], 0.7, 0.15, 3.2),
|
|
454
|
+
squeeze(humpSec, [0, 4.22], 1, 1, 2.0),
|
|
455
|
+
squeeze(humpSec, [0, 4.22], 1, 1, -2.2),
|
|
456
|
+
squeeze(humpSec, [0, 4.22], 0.75, 0.2, -3.4),
|
|
457
|
+
],
|
|
458
|
+
(p) => (p[2] > 4.6 ? HULL_LIGHT : HULL),
|
|
459
|
+
),
|
|
460
|
+
];
|
|
461
|
+
if (lod < 2) {
|
|
462
|
+
// Side intakes: dark recess + slats (small), both sides.
|
|
463
|
+
for (const s of [-1, 1]) {
|
|
464
|
+
hump.push(bevelled([1.6, 0.05, 0.22], DARK, 0, [0.6, s * 1.0, 4.27]));
|
|
465
|
+
if (lod === 0)
|
|
466
|
+
for (let i = 0; i < 9; i++)
|
|
467
|
+
hump.push(bevelled([0.05, 0.04, 0.22], METAL, 0, [-0.1 + i * 0.18, s * 1.03, 4.27]));
|
|
468
|
+
}
|
|
469
|
+
if (lod === 0) {
|
|
470
|
+
const slat = bevelled([0.06, 0.9, 0.05], DARK, 0);
|
|
471
|
+
for (let i = 0; i < 12; i++) hump.push(place(slat, { at: [-1.6 + i * 0.13, 0, 4.78] }));
|
|
472
|
+
hump.push(
|
|
473
|
+
lathe({
|
|
474
|
+
profile: [
|
|
475
|
+
[0.3, 0],
|
|
476
|
+
[0.28, 0.12],
|
|
477
|
+
[0.16, 0.24],
|
|
478
|
+
[0, 0.27],
|
|
479
|
+
],
|
|
480
|
+
segments: 14,
|
|
481
|
+
color: DARK,
|
|
482
|
+
at: [1.0, 0, 4.78],
|
|
483
|
+
}),
|
|
484
|
+
);
|
|
485
|
+
for (const [x, y, h] of [
|
|
486
|
+
[-1.9, 0.4, 0.9],
|
|
487
|
+
[-2.1, -0.4, 0.6],
|
|
488
|
+
] as const)
|
|
489
|
+
hump.push(
|
|
490
|
+
beam({ from: [x, y, 4.6], to: [x - 0.18, y, 4.6 + h], width: 0.04, color: METAL }),
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
solid('dorsal', merge(hump));
|
|
495
|
+
|
|
496
|
+
const tail: Mesh[] = [shell(BOOM.map(ringOf), (p) => (p[2] > 4.1 ? HULL_LIGHT : HULL))];
|
|
497
|
+
const fin = prism({
|
|
498
|
+
plane: 'xz',
|
|
499
|
+
depth: 0.18,
|
|
500
|
+
profile: [
|
|
501
|
+
[-6.7, 0],
|
|
502
|
+
[-9.4, 0],
|
|
503
|
+
[-10.2, 2.2],
|
|
504
|
+
[-9.0, 2.2],
|
|
505
|
+
],
|
|
506
|
+
color: HULL,
|
|
507
|
+
});
|
|
508
|
+
for (const s of [-1, 1]) {
|
|
509
|
+
tail.push(place(fin, { at: [0, s * 0.3, 4.2], roll: s * -35 * DEG }));
|
|
510
|
+
if (lod < 2)
|
|
511
|
+
// Fin number on both faces (fin-local: faces at y = ±0.09), placed with the fin.
|
|
512
|
+
tail.push(
|
|
513
|
+
place(
|
|
514
|
+
merge(
|
|
515
|
+
[1, -1].map((f) =>
|
|
516
|
+
text(HULL_NO, {
|
|
517
|
+
origin: [-8.75, f * 0.09, 0.75],
|
|
518
|
+
along: [-f, 0, 0],
|
|
519
|
+
height: 0.5,
|
|
520
|
+
align: 'centre',
|
|
521
|
+
color: STENCIL,
|
|
522
|
+
}),
|
|
523
|
+
),
|
|
524
|
+
),
|
|
525
|
+
{ at: [0, s * 0.3, 4.2], roll: s * -35 * DEG },
|
|
526
|
+
),
|
|
527
|
+
);
|
|
528
|
+
if (lod === 0)
|
|
529
|
+
tail.push(
|
|
530
|
+
place(
|
|
531
|
+
merge([
|
|
532
|
+
hazard([-9.02, 0.09, 1.98], [-10.15, 0.09, 1.98], [0, 0, 0.18], 6, 0.004),
|
|
533
|
+
hazard([-10.15, -0.09, 1.98], [-9.02, -0.09, 1.98], [0, 0, 0.18], 6, 0.004),
|
|
534
|
+
]),
|
|
535
|
+
{ at: [0, s * 0.3, 4.2], roll: s * -35 * DEG },
|
|
536
|
+
),
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
const nozzle = lathe({
|
|
540
|
+
profile: [
|
|
541
|
+
[0.22, 0.3],
|
|
542
|
+
[0.3, 0.05],
|
|
543
|
+
[0.34, -0.2],
|
|
544
|
+
[0.38, -0.32],
|
|
545
|
+
],
|
|
546
|
+
segments: ctx.pick([14, 10, 6]),
|
|
547
|
+
color: METAL,
|
|
548
|
+
axis: 'x',
|
|
549
|
+
});
|
|
550
|
+
for (const s of [-1, 1]) tail.push(place(nozzle, { at: [BOOM_END + 0.05, s * 0.36, 4.12] }));
|
|
551
|
+
if (lod === 0)
|
|
552
|
+
for (let i = 0; i < 5; i++) {
|
|
553
|
+
const g = bevelled(
|
|
554
|
+
[rng.range(0.3, 0.7), rng.range(0.3, 0.6), 0.08],
|
|
555
|
+
rng.pick([PANEL, METAL]),
|
|
556
|
+
0.015,
|
|
557
|
+
);
|
|
558
|
+
tail.push(place(g, { at: [-4.9 - i * 0.75, rng.range(-0.35, 0.35), 4.3] }));
|
|
559
|
+
}
|
|
560
|
+
solid('tail_boom', merge(tail));
|
|
561
|
+
for (const [s, side] of SIDES) {
|
|
562
|
+
ctx.part(
|
|
563
|
+
`thruster_tail_${side}`,
|
|
564
|
+
cylinder({
|
|
565
|
+
radius: 0.24,
|
|
566
|
+
length: 0.04,
|
|
567
|
+
segments: ctx.pick([14, 10, 6]),
|
|
568
|
+
axis: 'x',
|
|
569
|
+
color: GLOW,
|
|
570
|
+
at: [BOOM_END + 0.25, s * 0.36, 4.12],
|
|
571
|
+
}),
|
|
572
|
+
);
|
|
573
|
+
ctx.emitter(`thrust_tail_${side}`, {
|
|
574
|
+
kind: 'fire',
|
|
575
|
+
at: [BOOM_END - 0.35, s * 0.36, 4.12],
|
|
576
|
+
dir: [-1, 0, 0],
|
|
577
|
+
rate: 60,
|
|
578
|
+
life: 0.25,
|
|
579
|
+
size: [0.4, 0.1],
|
|
580
|
+
color: GLOW,
|
|
581
|
+
speed: 12,
|
|
582
|
+
spreadDeg: 6,
|
|
583
|
+
when: 'moving',
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// ── hull detail: canopy frames, portholes, crew door, nose sensor, greebles ──────────────
|
|
588
|
+
const glass: Mesh[] = [];
|
|
589
|
+
const detail: Mesh[] = [];
|
|
590
|
+
const rings = NOSE.map(ringOf);
|
|
591
|
+
for (const i of [1, 2]) {
|
|
592
|
+
const r0 = rings[i] ?? [];
|
|
593
|
+
const r1 = rings[i + 1] ?? [];
|
|
594
|
+
for (const k of [2, 3, 4, 5, 6]) {
|
|
595
|
+
if ((k === 2 || k === 6) && i === 1) continue;
|
|
596
|
+
const [a0, a1, b0, b1] = [r0[k], r0[k + 1], r1[k], r1[k + 1]];
|
|
597
|
+
if (!a0 || !a1 || !b0 || !b1) continue;
|
|
598
|
+
glass.push(quad(a0, a1, b1, b0, GLASS, 0.02));
|
|
599
|
+
if (lod === 0)
|
|
600
|
+
for (const [p, q] of [
|
|
601
|
+
[a0, b0],
|
|
602
|
+
[a1, b1],
|
|
603
|
+
[b0, b1],
|
|
604
|
+
] as const)
|
|
605
|
+
detail.push(beam({ from: p, to: q, width: 0.07, color: DARK }));
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
ctx.part('canopy', merge(glass), { surface: 'glass' });
|
|
609
|
+
if (lod === 0) {
|
|
610
|
+
// Panel seams (small): dark 3 cm lines around the skin at frame stations.
|
|
611
|
+
const seam = (x: number, faces: readonly number[]): void => {
|
|
612
|
+
const r0 = ringOf({ ...CABIN, x: x + 0.015 });
|
|
613
|
+
const r1 = ringOf({ ...CABIN, x: x - 0.015 });
|
|
614
|
+
for (const k of faces) {
|
|
615
|
+
const [a, b, c, d] = [r0[k], r0[(k + 1) % 10], r1[(k + 1) % 10], r1[k]];
|
|
616
|
+
if (a && b && c && d) detail.push(quadOut(a, b, c, d, SEAM, [x, 0, 2.8], 0.004));
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
for (const x of [5.0, 2.95, 0.95, -0.95, -2.95]) seam(x, [2, 3, 4, 5, 6, 7]);
|
|
620
|
+
for (const x of [5.45, -4.2]) seam(x, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
|
621
|
+
// Nose: a seam ring at the windscreen station, lower faces only.
|
|
622
|
+
const nr = ringOf({ ...(NOSE[3] ?? CABIN), x: 6.98 });
|
|
623
|
+
const nq = ringOf({ ...(NOSE[3] ?? CABIN), x: 7.02 });
|
|
624
|
+
for (const k of [0, 1, 7, 8, 9]) {
|
|
625
|
+
const [a, b, c, d] = [nr[k], nr[(k + 1) % 10], nq[(k + 1) % 10], nq[k]];
|
|
626
|
+
if (a && b && c && d) detail.push(quadOut(a, b, c, d, SEAM, [7, 0, 2.7], 0.01));
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
if (lod < 2) {
|
|
630
|
+
// Portholes on the tumblehome (scale cue: a 2 m tall cabin, 0.32 m windows).
|
|
631
|
+
const z0 = 3.15;
|
|
632
|
+
const z1 = 3.47;
|
|
633
|
+
for (const s of [-1, 1])
|
|
634
|
+
for (let i = 0; i < 8; i++) {
|
|
635
|
+
const x = 3.2 - i * 0.95;
|
|
636
|
+
const w = 0.34 * s;
|
|
637
|
+
const P = (px: number, z: number): Vec3 => [px, s * skinY(z), z];
|
|
638
|
+
detail.push(quad(P(x, z0), P(x - w, z0), P(x - w, z1), P(x, z1), GLASS, 0.012));
|
|
639
|
+
if (lod === 0)
|
|
640
|
+
detail.push(
|
|
641
|
+
quad(
|
|
642
|
+
P(x + 0.05 * s, z0 - 0.05),
|
|
643
|
+
P(x - w - 0.05 * s, z0 - 0.05),
|
|
644
|
+
P(x - w - 0.05 * s, z1 + 0.05),
|
|
645
|
+
P(x + 0.05 * s, z1 + 0.05),
|
|
646
|
+
DARK,
|
|
647
|
+
0.006,
|
|
648
|
+
),
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
// Crew door (+Y, port), forward of the sponson: frame, window, handle.
|
|
652
|
+
detail.push(bevelled([1.15, 0.04, 2.0], PANEL, 0.012, [4.75, CABIN.hw + 0.02, 1.55]));
|
|
653
|
+
if (lod === 0) {
|
|
654
|
+
detail.push(bevelled([0.5, 0.03, 0.4], GLASS, 0, [4.75, CABIN.hw + 0.045, 2.95 - 0.6]));
|
|
655
|
+
detail.push(bevelled([0.3, 0.06, 0.07], METAL, 0, [4.4, CABIN.hw + 0.05, 2.2]));
|
|
656
|
+
detail.push(
|
|
657
|
+
hazard(
|
|
658
|
+
[5.35, CABIN.hw + 0.042, 1.6],
|
|
659
|
+
[4.15, CABIN.hw + 0.042, 1.6],
|
|
660
|
+
[0, 0, 0.12],
|
|
661
|
+
8,
|
|
662
|
+
0.002,
|
|
663
|
+
),
|
|
664
|
+
);
|
|
665
|
+
// Nose sensor turret and pitot probes.
|
|
666
|
+
detail.push(
|
|
667
|
+
lathe({
|
|
668
|
+
profile: [
|
|
669
|
+
[0.26, 0],
|
|
670
|
+
[0.24, 0.22],
|
|
671
|
+
[0, 0.26],
|
|
672
|
+
],
|
|
673
|
+
segments: 12,
|
|
674
|
+
axis: 'x',
|
|
675
|
+
color: DARK,
|
|
676
|
+
at: [9.72, 0, 2.15],
|
|
677
|
+
}),
|
|
678
|
+
);
|
|
679
|
+
for (const s of [-1, 1])
|
|
680
|
+
detail.push(
|
|
681
|
+
beam({
|
|
682
|
+
from: [9.3, s * 0.7, 2.3],
|
|
683
|
+
to: [10.1, s * 0.75, 2.3],
|
|
684
|
+
width: 0.03,
|
|
685
|
+
color: METAL,
|
|
686
|
+
}),
|
|
687
|
+
);
|
|
688
|
+
// Roof greebles on the chamfers, seeded.
|
|
689
|
+
for (const s of [-1, 1])
|
|
690
|
+
for (let i = 0; i < 7; i++) {
|
|
691
|
+
const g = bevelled(
|
|
692
|
+
[rng.range(0.3, 0.7), rng.range(0.18, 0.3), rng.range(0.06, 0.12)],
|
|
693
|
+
rng.pick([PANEL, METAL, DARK]),
|
|
694
|
+
0.015,
|
|
695
|
+
);
|
|
696
|
+
const x = i < 3 ? 5.2 - i * 0.8 : -2.7 - (i - 3) * 0.4;
|
|
697
|
+
detail.push(
|
|
698
|
+
place(g, { at: [x + rng.range(-0.1, 0.1), s * 1.43, 4.12], roll: s * -0.6 }),
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
solid('hull_detail', merge(detail));
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
// ── cabin interior: deck, wall panels, troop seats, lamp ──────────────────────────────────
|
|
706
|
+
if (lod < 2) {
|
|
707
|
+
const inside: Mesh[] = [
|
|
708
|
+
bevelled([CABIN.x - CABIN_END - 0.1, 3.3, 0.04], DARK, 0, [0.6, 0, 1.38]),
|
|
709
|
+
];
|
|
710
|
+
for (const s of [-1, 1])
|
|
711
|
+
for (let i = 0; i < 4; i++)
|
|
712
|
+
inside.push(
|
|
713
|
+
bevelled([2.2, 0.04, 1.1], INTERIOR, 0.01, [
|
|
714
|
+
4.0 - i * 2.35,
|
|
715
|
+
s * (CABIN.hw - WALL - 0.02),
|
|
716
|
+
1.5,
|
|
717
|
+
]),
|
|
718
|
+
);
|
|
719
|
+
if (lod === 0) {
|
|
720
|
+
const seat = merge([
|
|
721
|
+
bevelled([0.5, 0.45, 0.08], DARK, 0.01, [0, 0, 0.45]),
|
|
722
|
+
bevelled([0.45, 0.06, 0.6], DARK, 0.01, [0, 0.2, 0.55]),
|
|
723
|
+
beam({ from: [0, 0, 0], to: [0, 0, 0.45], width: 0.04, color: METAL }),
|
|
724
|
+
]);
|
|
725
|
+
for (let i = 0; i < 12; i++)
|
|
726
|
+
for (const s of [-1, 1])
|
|
727
|
+
inside.push(
|
|
728
|
+
place(seat, { at: [-3.5 + i * 0.7, s * 1.45, 1.42], yaw: s > 0 ? 0 : Math.PI }),
|
|
729
|
+
);
|
|
730
|
+
for (const y of [-0.6, 0.6])
|
|
731
|
+
inside.push(bevelled([9.2, 0.08, 0.03], METAL, 0, [0.4, y, 1.42]));
|
|
732
|
+
ctx.part('cabin_lamp', bevelled([6, 0.12, 0.04], hex('#fff4e0'), 0, [0.5, 0, 4.18]));
|
|
733
|
+
}
|
|
734
|
+
solid('cabin', merge(inside));
|
|
735
|
+
ctx.socket('cabin_light', {
|
|
736
|
+
kind: 'light',
|
|
737
|
+
at: [0, 0, 3.9],
|
|
738
|
+
dir: [0, 0, -1],
|
|
739
|
+
data: { light: 'point', color: '#ff6a50', intensity: 40, range: 8 },
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// ── stub wings, nacelles, fans, thrusters ─────────────────────────────────────────────────
|
|
744
|
+
const cowl = weightedNormals(
|
|
745
|
+
lathe({
|
|
746
|
+
profile: [
|
|
747
|
+
[0.7, -1.6],
|
|
748
|
+
[0.78, -2.1],
|
|
749
|
+
[0.88, -2.1],
|
|
750
|
+
[0.98, -1.7],
|
|
751
|
+
[POD_R, -1.25],
|
|
752
|
+
[POD_R, 1.6],
|
|
753
|
+
[1.03, 1.98],
|
|
754
|
+
[0.94, 2.1],
|
|
755
|
+
[0.85, 1.98],
|
|
756
|
+
[0.83, 1.3],
|
|
757
|
+
],
|
|
758
|
+
segments: ctx.pick([24, 14, 8]),
|
|
759
|
+
color: HULL,
|
|
760
|
+
}),
|
|
761
|
+
{ hardAngle: 35 },
|
|
762
|
+
);
|
|
763
|
+
for (const [s, side] of SIDES) {
|
|
764
|
+
const wing: Mesh[] = [
|
|
765
|
+
shell(
|
|
766
|
+
[
|
|
767
|
+
airfoil(s * 1.5, 1.8, -1.4, 0.5),
|
|
768
|
+
airfoil(s * 1.675, 1.79, -1.38, 0.5),
|
|
769
|
+
airfoil(s * WING_TIP, 1.35, -0.95, 0.36),
|
|
770
|
+
],
|
|
771
|
+
(p) => (p[2] > WING_Z ? HULL : PANEL),
|
|
772
|
+
20,
|
|
773
|
+
),
|
|
774
|
+
// Bearing collar at the tip, where the nacelle shaft enters.
|
|
775
|
+
place(cylinder({ radius: 0.3, length: 0.3, segments: seg, axis: 'y', color: METAL }), {
|
|
776
|
+
at: [POD_X, s * (WING_TIP - 0.12), WING_Z],
|
|
777
|
+
}),
|
|
778
|
+
];
|
|
779
|
+
if (lod < 2) {
|
|
780
|
+
wing.push(bevelled([1.6, 1.5, 0.04], PANEL, bv / 2, [0.25, s * 2.95, WING_Z + 0.2]));
|
|
781
|
+
if (lod === 0)
|
|
782
|
+
// Walkway warning, letters' tops outboard (along × up = +Z).
|
|
783
|
+
wing.push(
|
|
784
|
+
text('NO STEP', {
|
|
785
|
+
origin: [0.25, s * 2.95, WING_Z + 0.24],
|
|
786
|
+
along: [s, 0, 0],
|
|
787
|
+
up: [0, s, 0],
|
|
788
|
+
height: 0.14,
|
|
789
|
+
align: 'centre',
|
|
790
|
+
color: STENCIL,
|
|
791
|
+
}),
|
|
792
|
+
);
|
|
793
|
+
if (lod === 0)
|
|
794
|
+
wing.push(
|
|
795
|
+
hazard(
|
|
796
|
+
[s > 0 ? -0.75 : 1.15, s * (WING_TIP - 0.2), WING_Z + 0.18],
|
|
797
|
+
[s > 0 ? 1.15 : -0.75, s * (WING_TIP - 0.2), WING_Z + 0.18],
|
|
798
|
+
[0, s * 0.15, 0],
|
|
799
|
+
10,
|
|
800
|
+
0.004,
|
|
801
|
+
),
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
solid(`wing_${side}`, merge(wing));
|
|
805
|
+
|
|
806
|
+
const pod: Mesh[] = [
|
|
807
|
+
cowl,
|
|
808
|
+
cylinder({ radius: 0.84, length: 0.04, segments: seg, color: DARK, at: [0, 0, 1.26] }),
|
|
809
|
+
// Pivot shaft into the wing bearing + a pylon fairing on the inboard side.
|
|
810
|
+
place(cylinder({ radius: 0.2, length: 0.75, segments: seg, axis: 'y', color: METAL }), {
|
|
811
|
+
at: [0, -s * (POD_R + 0.15), 0],
|
|
812
|
+
}),
|
|
813
|
+
bevelled([1.1, 0.3, 1.3], PANEL, bv, [0, -s * (POD_R - 0.05), -0.65]),
|
|
814
|
+
];
|
|
815
|
+
if (lod < 2) {
|
|
816
|
+
// Open armour rings (no caps), so they stay out of the fan's swept disc.
|
|
817
|
+
for (const z of [1.05, -0.95])
|
|
818
|
+
pod.push(
|
|
819
|
+
lathe({
|
|
820
|
+
profile: [
|
|
821
|
+
[POD_R, z - 0.1],
|
|
822
|
+
[POD_R + 0.035, z - 0.07],
|
|
823
|
+
[POD_R + 0.035, z + 0.07],
|
|
824
|
+
[POD_R, z + 0.1],
|
|
825
|
+
],
|
|
826
|
+
segments: ctx.pick([24, 14, 8]),
|
|
827
|
+
color: PANEL,
|
|
828
|
+
}),
|
|
829
|
+
);
|
|
830
|
+
const vent = merge([
|
|
831
|
+
bevelled([0.07, 0.55, 1.1], PANEL, bv / 2),
|
|
832
|
+
...(lod === 0
|
|
833
|
+
? Array.from({ length: 7 }, (_, i) =>
|
|
834
|
+
bevelled([0.04, 0.44, 0.03], DARK, 0, [0.04, 0, 0.14 + i * 0.13]),
|
|
835
|
+
)
|
|
836
|
+
: []),
|
|
837
|
+
]);
|
|
838
|
+
for (const a of [40, 0, -40].map((d) => d * DEG))
|
|
839
|
+
pod.push(
|
|
840
|
+
place(vent, {
|
|
841
|
+
yaw: s * a,
|
|
842
|
+
at: [POD_R * Math.cos(s * a), POD_R * Math.sin(s * a), -0.55],
|
|
843
|
+
}),
|
|
844
|
+
);
|
|
845
|
+
if (lod === 0) {
|
|
846
|
+
// Hazard ring under the intake lip; exhaust vanes across the nozzle.
|
|
847
|
+
// One stripe per cowl facet (lathe rings start at −90°), so each lies on its face.
|
|
848
|
+
const facets = 24;
|
|
849
|
+
for (let k = 0; k < facets; k++) {
|
|
850
|
+
const a0 = -Math.PI / 2 + (k / facets) * Math.PI * 2;
|
|
851
|
+
const a1 = -Math.PI / 2 + ((k + 1) / facets) * Math.PI * 2;
|
|
852
|
+
const R = POD_R;
|
|
853
|
+
pod.push(
|
|
854
|
+
quad(
|
|
855
|
+
[R * Math.cos(a0), R * Math.sin(a0), 1.38],
|
|
856
|
+
[R * Math.cos(a1), R * Math.sin(a1), 1.38],
|
|
857
|
+
[R * Math.cos(a1), R * Math.sin(a1), 1.52],
|
|
858
|
+
[R * Math.cos(a0), R * Math.sin(a0), 1.52],
|
|
859
|
+
k % 2 ? BLACK : HAZARD,
|
|
860
|
+
0.006,
|
|
861
|
+
),
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
for (let i = 0; i < 4; i++)
|
|
865
|
+
pod.push(bevelled([0.05, 1.3, 0.22], DARK, 0, [-0.45 + i * 0.3, 0, -2.0]));
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
ctx.part(
|
|
869
|
+
`nacelle_${side}`,
|
|
870
|
+
grime(merge(pod), { zones: [{ at: [0, 0, -2.1], radius: 1.0, strength: 0.45 }] }),
|
|
871
|
+
{
|
|
872
|
+
at: [POD_X, s * POD_Y, WING_Z],
|
|
873
|
+
motion: { kind: 'sway', axis: [0, 1, 0], degrees: 30, hz: 0.1 },
|
|
874
|
+
clearOf: [`wing_${side}`],
|
|
875
|
+
},
|
|
876
|
+
);
|
|
877
|
+
if (lod < 2) {
|
|
878
|
+
const blades = ctx.pick([16, 9, 0]);
|
|
879
|
+
const blade = place(bevelled([0.62, 0.16, 0.025], METAL, 0), {
|
|
880
|
+
at: [0.43, 0, 0],
|
|
881
|
+
roll: 0.5,
|
|
882
|
+
});
|
|
883
|
+
ctx.part(
|
|
884
|
+
`fan_${side}`,
|
|
885
|
+
merge([
|
|
886
|
+
lathe({
|
|
887
|
+
profile: [
|
|
888
|
+
[0.24, 0],
|
|
889
|
+
[0.24, 0.18],
|
|
890
|
+
[0.12, 0.32],
|
|
891
|
+
[0, 0.36],
|
|
892
|
+
],
|
|
893
|
+
segments: 12,
|
|
894
|
+
color: DARK,
|
|
895
|
+
}),
|
|
896
|
+
...Array.from({ length: blades }, (_, i) =>
|
|
897
|
+
place(blade, { yaw: (i / blades) * Math.PI * 2, at: [0, 0, 0.1] }),
|
|
898
|
+
),
|
|
899
|
+
]),
|
|
900
|
+
{
|
|
901
|
+
parent: `nacelle_${side}`,
|
|
902
|
+
at: [0, 0, 1.28],
|
|
903
|
+
motion: { kind: 'spin', axis: [0, 0, 1], rps: 6 },
|
|
904
|
+
},
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
ctx.part(
|
|
908
|
+
`thruster_${side}`,
|
|
909
|
+
cylinder({ radius: 0.7, length: 0.04, segments: seg, color: GLOW, at: [0, 0, -1.62] }),
|
|
910
|
+
{ parent: `nacelle_${side}` },
|
|
911
|
+
);
|
|
912
|
+
ctx.emitter(`thrust_${side}`, {
|
|
913
|
+
kind: 'fire',
|
|
914
|
+
parent: `nacelle_${side}`,
|
|
915
|
+
at: [0, 0, -2.2],
|
|
916
|
+
dir: [0, 0, -1],
|
|
917
|
+
rate: 120,
|
|
918
|
+
life: 0.3,
|
|
919
|
+
size: [1.2, 0.2],
|
|
920
|
+
color: GLOW,
|
|
921
|
+
speed: 18,
|
|
922
|
+
spreadDeg: 8,
|
|
923
|
+
when: 'always',
|
|
924
|
+
});
|
|
925
|
+
ctx.emitter(`downwash_${side}`, {
|
|
926
|
+
kind: 'dust',
|
|
927
|
+
at: [POD_X, s * POD_Y, 0.1],
|
|
928
|
+
rate: 40,
|
|
929
|
+
life: 1.5,
|
|
930
|
+
size: [0.5, 3],
|
|
931
|
+
speed: 4,
|
|
932
|
+
spreadDeg: 80,
|
|
933
|
+
when: 'moving',
|
|
934
|
+
});
|
|
935
|
+
// Wingtip nav light: lens on the wing top, light socket just above it.
|
|
936
|
+
ctx.part(
|
|
937
|
+
`navlight_${side}`,
|
|
938
|
+
lathe({
|
|
939
|
+
profile: [
|
|
940
|
+
[0.07, 0],
|
|
941
|
+
[0.07, 0.04],
|
|
942
|
+
[0, 0.08],
|
|
943
|
+
],
|
|
944
|
+
segments: 8,
|
|
945
|
+
color: s > 0 ? hex('#ff3020') : hex('#30ff60'),
|
|
946
|
+
at: [0.95, s * (WING_TIP - 0.2), WING_Z + 0.16],
|
|
947
|
+
}),
|
|
948
|
+
);
|
|
949
|
+
ctx.socket(`nav_${side}`, {
|
|
950
|
+
kind: 'light',
|
|
951
|
+
at: [0.95, s * (WING_TIP - 0.2), WING_Z + 0.35],
|
|
952
|
+
data: { light: 'point', color: s > 0 ? '#ff2020' : '#20ff50', intensity: 8, range: 12 },
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
ctx.part(
|
|
956
|
+
'navlight_tail',
|
|
957
|
+
lathe({
|
|
958
|
+
profile: [
|
|
959
|
+
[0.06, 0],
|
|
960
|
+
[0.06, 0.04],
|
|
961
|
+
[0, 0.07],
|
|
962
|
+
],
|
|
963
|
+
segments: 8,
|
|
964
|
+
color: hex('#fff4e0'),
|
|
965
|
+
at: [-9.0, 0, 4.31],
|
|
966
|
+
}),
|
|
967
|
+
);
|
|
968
|
+
ctx.socket('nav_tail', {
|
|
969
|
+
kind: 'light',
|
|
970
|
+
at: [-9.0, 0, 4.5],
|
|
971
|
+
data: { light: 'point', color: '#ffffff', intensity: 10, range: 14, strobe: 1 },
|
|
972
|
+
});
|
|
973
|
+
ctx.socket('landing_light', {
|
|
974
|
+
kind: 'light',
|
|
975
|
+
at: [8.6, 0, 1.6],
|
|
976
|
+
dir: [0.4, 0, -1],
|
|
977
|
+
data: { light: 'spot', color: '#fff2d8', intensity: 400, range: 40, cone: 30 },
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
// ── ramp: hinged at the cabin floor edge, rest = half way between closed and open ────────
|
|
981
|
+
const rampPlate: Mesh[] = [
|
|
982
|
+
bevelled([RAMP_LEN - 0.05, RAMP_HW * 2, 0.12], PANEL, bv / 2, [
|
|
983
|
+
-(RAMP_LEN + 0.05) / 2,
|
|
984
|
+
0,
|
|
985
|
+
-0.12,
|
|
986
|
+
]),
|
|
987
|
+
...[-1.1, 0, 1.1].map((y) =>
|
|
988
|
+
cylinder({
|
|
989
|
+
radius: 0.09,
|
|
990
|
+
length: 0.4,
|
|
991
|
+
segments: ctx.pick([10, 8, 6]),
|
|
992
|
+
axis: 'y',
|
|
993
|
+
color: METAL,
|
|
994
|
+
at: [0, y, 0],
|
|
995
|
+
}),
|
|
996
|
+
),
|
|
997
|
+
];
|
|
998
|
+
if (lod < 2) {
|
|
999
|
+
for (const s of [-1, 1])
|
|
1000
|
+
rampPlate.push(
|
|
1001
|
+
bevelled([RAMP_LEN - 0.1, 0.1, 0.16], METAL, bv / 2, [
|
|
1002
|
+
-(RAMP_LEN + 0.1) / 2,
|
|
1003
|
+
s * (RAMP_HW - 0.05),
|
|
1004
|
+
-0.02,
|
|
1005
|
+
]),
|
|
1006
|
+
);
|
|
1007
|
+
if (lod === 0) {
|
|
1008
|
+
const rib = bevelled([0.05, RAMP_HW * 2 - 0.3, 0.025], DARK, 0);
|
|
1009
|
+
for (let i = 0; i < 12; i++) rampPlate.push(place(rib, { at: [-0.35 - i * 0.22, 0, 0] }));
|
|
1010
|
+
rampPlate.push(
|
|
1011
|
+
hazard(
|
|
1012
|
+
[-RAMP_LEN + 0.3, -RAMP_HW + 0.12, 0.002],
|
|
1013
|
+
[-RAMP_LEN + 0.3, RAMP_HW - 0.12, 0.002],
|
|
1014
|
+
[-0.28, 0, 0],
|
|
1015
|
+
14,
|
|
1016
|
+
),
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
solid(
|
|
1021
|
+
'hinge_ramp',
|
|
1022
|
+
cylinder({ radius: 0.05, length: 3.6, segments: 8, axis: 'y', color: METAL, at: HINGE }),
|
|
1023
|
+
);
|
|
1024
|
+
// Rests CLOSED; a one-way swing about −Y lowers it to the ground and back.
|
|
1025
|
+
ctx.part('ramp', place(merge(rampPlate), { pitch: RAMP_CLOSED * DEG }), {
|
|
1026
|
+
at: HINGE,
|
|
1027
|
+
motion: { kind: 'sway', axis: [0, -1, 0], degrees: RAMP_SWING, hz: 0.1, oneWay: true },
|
|
1028
|
+
clearOf: ['hinge_ramp'], // knuckles ride on the hinge rod: a real interlock
|
|
1029
|
+
});
|
|
1030
|
+
|
|
1031
|
+
// ── landing gear: oleo struts on skid pads, bay plate on top ─────────────────────────────
|
|
1032
|
+
const gearLeg = (top: number, pad: Vec3): Mesh => {
|
|
1033
|
+
const sr = ctx.pick([12, 8, 6]);
|
|
1034
|
+
const parts: Mesh[] = [
|
|
1035
|
+
bevelled(pad, DARK, bv),
|
|
1036
|
+
cylinder({
|
|
1037
|
+
radius: 0.15,
|
|
1038
|
+
length: top - 0.6,
|
|
1039
|
+
segments: sr,
|
|
1040
|
+
color: METAL,
|
|
1041
|
+
at: [0, 0, (top + 0.6) / 2],
|
|
1042
|
+
}),
|
|
1043
|
+
cylinder({ radius: 0.1, length: 0.5, segments: sr, color: HULL_LIGHT, at: [0, 0, 0.45] }),
|
|
1044
|
+
bevelled([1.3, 0.7, 0.08], BELLY, bv / 2, [0, 0, top - 0.04]),
|
|
1045
|
+
];
|
|
1046
|
+
if (lod < 2) {
|
|
1047
|
+
parts.push(
|
|
1048
|
+
beam({ from: [0, 0, 0.6], to: [-0.55, 0, top - 0.02], width: 0.09, color: METAL }),
|
|
1049
|
+
);
|
|
1050
|
+
parts.push(bevelled([0.34, 0.34, 0.14], METAL, 0.01, [0, 0, pad[2]]));
|
|
1051
|
+
if (lod === 0)
|
|
1052
|
+
parts.push(
|
|
1053
|
+
hazard(
|
|
1054
|
+
[-pad[0] / 2 + 0.05, -pad[1] / 2, 0.04],
|
|
1055
|
+
[pad[0] / 2 - 0.05, -pad[1] / 2, 0.04],
|
|
1056
|
+
[0, 0, 0.1],
|
|
1057
|
+
8,
|
|
1058
|
+
0.004,
|
|
1059
|
+
),
|
|
1060
|
+
);
|
|
1061
|
+
}
|
|
1062
|
+
return merge(parts);
|
|
1063
|
+
};
|
|
1064
|
+
solid('gear_l', place(gearLeg(SPONSON.zb, [1.0, 0.75, 0.2]), { at: MAIN_GEAR }));
|
|
1065
|
+
solid(
|
|
1066
|
+
'gear_r',
|
|
1067
|
+
place(gearLeg(SPONSON.zb, [1.0, 0.75, 0.2]), { at: [MAIN_GEAR[0], -MAIN_GEAR[1], 0] }),
|
|
1068
|
+
);
|
|
1069
|
+
solid('gear_nose', place(gearLeg(1.4, [0.85, 0.65, 0.18]), { at: NOSE_GEAR }));
|
|
1070
|
+
|
|
1071
|
+
// ── chin turret: yaws ±50°, twin guns pitch ±12° ──────────────────────────────────────────
|
|
1072
|
+
const tSeg = ctx.pick([16, 10, 6]);
|
|
1073
|
+
solid(
|
|
1074
|
+
'turret_ring',
|
|
1075
|
+
cylinder({ radius: 0.36, length: 0.08, segments: tSeg, color: DARK, at: [8.55, 0, 1.64] }),
|
|
1076
|
+
);
|
|
1077
|
+
ctx.part(
|
|
1078
|
+
'turret',
|
|
1079
|
+
lathe({
|
|
1080
|
+
profile: [
|
|
1081
|
+
[0, -0.36],
|
|
1082
|
+
[0.16, -0.34],
|
|
1083
|
+
[0.29, -0.25],
|
|
1084
|
+
[0.32, -0.1],
|
|
1085
|
+
[0.3, 0],
|
|
1086
|
+
],
|
|
1087
|
+
segments: tSeg,
|
|
1088
|
+
color: PANEL,
|
|
1089
|
+
}),
|
|
1090
|
+
{
|
|
1091
|
+
at: [8.55, 0, 1.6],
|
|
1092
|
+
motion: { kind: 'sway', axis: [0, 0, 1], degrees: 50, hz: 0.15 },
|
|
1093
|
+
clearOf: ['turret_ring'], // the turret turns in its ring: a real interlock
|
|
1094
|
+
},
|
|
1095
|
+
);
|
|
1096
|
+
ctx.part(
|
|
1097
|
+
'gun',
|
|
1098
|
+
merge([
|
|
1099
|
+
bevelled([0.34, 0.3, 0.16], DARK, ctx.pick([0.02, 0.01, 0]), [0.12, 0, -0.08]),
|
|
1100
|
+
...[-0.08, 0.08].map((y) =>
|
|
1101
|
+
beam({
|
|
1102
|
+
from: [0.25, y, 0],
|
|
1103
|
+
to: [1.0, y, 0],
|
|
1104
|
+
width: 0.055,
|
|
1105
|
+
segments: ctx.pick([8, 6, 4]),
|
|
1106
|
+
color: METAL,
|
|
1107
|
+
}),
|
|
1108
|
+
),
|
|
1109
|
+
]),
|
|
1110
|
+
{
|
|
1111
|
+
parent: 'turret',
|
|
1112
|
+
at: [0.12, 0, -0.2],
|
|
1113
|
+
motion: { kind: 'sway', axis: [0, 1, 0], degrees: 12, hz: 0.2 },
|
|
1114
|
+
clearOf: ['turret'], // the gun's trunnion housing sits inside the turret ball
|
|
1115
|
+
},
|
|
1116
|
+
);
|
|
1117
|
+
ctx.socket('muzzle_gun', {
|
|
1118
|
+
kind: 'mount',
|
|
1119
|
+
parent: 'gun',
|
|
1120
|
+
at: [1.02, 0, 0],
|
|
1121
|
+
data: { caliber: 20 },
|
|
1122
|
+
});
|
|
1123
|
+
ctx.emitter('muzzle', {
|
|
1124
|
+
kind: 'muzzle',
|
|
1125
|
+
parent: 'gun',
|
|
1126
|
+
at: [1.05, 0, 0],
|
|
1127
|
+
dir: [1, 0, 0],
|
|
1128
|
+
rate: 200,
|
|
1129
|
+
life: 0.08,
|
|
1130
|
+
size: [0.2, 0.5],
|
|
1131
|
+
when: 'event',
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
// ── baked AO across every static part (sponson tops, wing roots, gear bays darken) ───────
|
|
1135
|
+
const occluder = merge(statics.map(([, m]) => m));
|
|
1136
|
+
for (const [name, mesh] of statics)
|
|
1137
|
+
ctx.part(
|
|
1138
|
+
name,
|
|
1139
|
+
lod < 2
|
|
1140
|
+
? bakeAo(mesh, { samples: ctx.pick([20, 10, 0]), radius: 1.2, strength: 0.5 }, occluder)
|
|
1141
|
+
: mesh,
|
|
1142
|
+
);
|
|
1143
|
+
},
|
|
1144
|
+
});
|