@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,181 @@
|
|
|
1
|
+
// The orc's armoured bust gear as sculpt groups: plate pauldrons built like real armour — a domed
|
|
2
|
+
// shoulder cap and two shingled lames, each a hollow shell (so its edge shows a thickness and a
|
|
3
|
+
// shadowed underside) with a rolled rim, a raised crest and bone spikes along it, rivets — plus a
|
|
4
|
+
// leather baldric that hugs the chest (a shell of the torso ∩ a diagonal slab) with an iron buckle,
|
|
5
|
+
// and a fur mantle of clumped, tapering strands over the trapezius. Head units, mirrored across Y.
|
|
6
|
+
|
|
7
|
+
import type { Vec3 } from '../core/index.ts';
|
|
8
|
+
import type { SculptEdit } from '../primitives/index.ts';
|
|
9
|
+
import { alongZ, unit } from './head-geom.ts';
|
|
10
|
+
import type { HeadParams } from './head-params.ts';
|
|
11
|
+
import { type BustFrame, bustCut, torsoForms } from './head-torso.ts';
|
|
12
|
+
|
|
13
|
+
const RAD = Math.PI / 180;
|
|
14
|
+
const shade = (c: Vec3, k: number): Vec3 => [c[0] * k, c[1] * k, c[2] * k];
|
|
15
|
+
|
|
16
|
+
/** Half-space kept above the plane through `p` whose normal is +Z rolled `deg` about X. */
|
|
17
|
+
const above = (p: Vec3, deg: number): SculptEdit => {
|
|
18
|
+
const n: Vec3 = [0, -Math.sin(deg * RAD), Math.cos(deg * RAD)];
|
|
19
|
+
return {
|
|
20
|
+
shape: 'roundBox',
|
|
21
|
+
at: [p[0] + n[0], p[1] + n[1], p[2] + n[2]],
|
|
22
|
+
size: [4, 4, 2],
|
|
23
|
+
rotate: [deg, 0, 0],
|
|
24
|
+
op: 'intersect',
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Thin slab (thickness `t`) through `p`, normal +Z rolled `deg` about X. */
|
|
29
|
+
const slab = (p: Vec3, deg: number, t: number): SculptEdit => ({
|
|
30
|
+
shape: 'roundBox',
|
|
31
|
+
at: p,
|
|
32
|
+
size: [4, 4, t],
|
|
33
|
+
rotate: [deg, 0, 0],
|
|
34
|
+
op: 'intersect',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const ell = (at: Vec3, r: Vec3, g: number, roll: number): SculptEdit => ({
|
|
38
|
+
shape: 'ellipsoid',
|
|
39
|
+
at,
|
|
40
|
+
size: [r[0] + g, r[1] + g, r[2] + g],
|
|
41
|
+
rotate: [roll, 0, 0],
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/** One plate: a shell of thickness `t` trimmed above a tilted plane, with a rolled rim. */
|
|
45
|
+
function plate(
|
|
46
|
+
at: Vec3,
|
|
47
|
+
r: Vec3,
|
|
48
|
+
roll: number,
|
|
49
|
+
cut: Vec3,
|
|
50
|
+
tilt: number,
|
|
51
|
+
c: Vec3,
|
|
52
|
+
t: number,
|
|
53
|
+
): SculptEdit[] {
|
|
54
|
+
return [
|
|
55
|
+
{
|
|
56
|
+
group: [
|
|
57
|
+
ell(at, r, 0, roll),
|
|
58
|
+
// Hollow only while the shell is thinner than the plate itself (fine LODs).
|
|
59
|
+
...(t < Math.min(...r) * 0.6 ? [{ ...ell(at, r, -t, roll), op: 'subtract' as const }] : []),
|
|
60
|
+
above(cut, tilt),
|
|
61
|
+
],
|
|
62
|
+
color: c,
|
|
63
|
+
blend: 0.006,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
group: [
|
|
67
|
+
ell(at, r, 0.022, roll),
|
|
68
|
+
...(t < Math.min(...r) * 0.6
|
|
69
|
+
? [{ ...ell(at, r, -t * 0.8, roll), op: 'subtract' as const }]
|
|
70
|
+
: []),
|
|
71
|
+
slab(cut, tilt, 0.05),
|
|
72
|
+
],
|
|
73
|
+
// Worn edge: the rim catches the light (a painter's edge highlight).
|
|
74
|
+
color: shade(c, 1.3),
|
|
75
|
+
blend: 0.006,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** `cell`: the bust's sculpt cell; plates thicken to ≈ 2.5 cells so far LODs stay closed. */
|
|
81
|
+
export function armour(p: HeadParams, f: BustFrame, cell = 0): SculptEdit[] {
|
|
82
|
+
const t = Math.max(0.085, cell * 2.5);
|
|
83
|
+
const c = p.colors;
|
|
84
|
+
const { cx, s, b, nz } = f;
|
|
85
|
+
const metal = c.metal;
|
|
86
|
+
const out: SculptEdit[] = [];
|
|
87
|
+
// Pauldron: a big shoulder cap, then two lames shingled out and down over the arm.
|
|
88
|
+
const cap: Vec3 = [cx - 0.04, s * 0.8, b + 0.66];
|
|
89
|
+
for (let k = 1; k >= 0; k--) {
|
|
90
|
+
const at: Vec3 = [cap[0], cap[1] + k * 0.07 * s, cap[2] - k * 0.17];
|
|
91
|
+
const r: Vec3 = k === 0 ? [0.27, 0.29, 0.25] : [0.23, 0.25, 0.19];
|
|
92
|
+
const tilt = -(38 + k * 14);
|
|
93
|
+
const cut: Vec3 = [at[0], at[1], at[2] - r[2] * 0.45];
|
|
94
|
+
out.push(...plate(at, r, -25 - k * 10, cut, tilt, shade(metal, 1 - k * 0.15), t));
|
|
95
|
+
// Rivets along each plate's rim.
|
|
96
|
+
for (let j = 0; j < 4; j++) {
|
|
97
|
+
const x = at[0] + (j - 1.5) * 0.12;
|
|
98
|
+
out.push({
|
|
99
|
+
shape: 'sphere',
|
|
100
|
+
at: [x, at[1] + r[1] * 0.62, cut[2] + 0.02 - r[1] * 0.62 * Math.tan(-tilt * RAD) * 0.4],
|
|
101
|
+
size: 0.017,
|
|
102
|
+
color: shade(metal, 1.35),
|
|
103
|
+
blend: 0.004,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Crest along the cap's crown, bone spikes rising out of it.
|
|
108
|
+
const crest: Vec3 = [cap[0], cap[1] - 0.03, cap[2] + 0.25];
|
|
109
|
+
out.push({
|
|
110
|
+
shape: 'ellipsoid',
|
|
111
|
+
at: crest,
|
|
112
|
+
size: [0.25, 0.028, 0.07],
|
|
113
|
+
rotate: [-22, 0, 0],
|
|
114
|
+
color: shade(metal, 0.75),
|
|
115
|
+
blend: 0.02,
|
|
116
|
+
});
|
|
117
|
+
for (let k = 0; k < 3; k++)
|
|
118
|
+
out.push({
|
|
119
|
+
shape: 'cone',
|
|
120
|
+
at: [crest[0] - 0.14 + k * 0.14, crest[1] + 0.01, crest[2] + 0.02 - Math.abs(k - 1) * 0.03],
|
|
121
|
+
size: [0.075, 0.012, 0.36 - Math.abs(k - 1) * 0.12],
|
|
122
|
+
rotate: alongZ(unit([(k - 1) * 0.3, 0.55, 1])),
|
|
123
|
+
color: c.teeth,
|
|
124
|
+
blend: 0.015,
|
|
125
|
+
});
|
|
126
|
+
// Baldric: a shell of the chest cut to a diagonal band over the left shoulder; iron buckle.
|
|
127
|
+
const band: Vec3 = [cx, 0, b + 0.36];
|
|
128
|
+
out.push(
|
|
129
|
+
{
|
|
130
|
+
group: [{ group: torsoForms(f, 0.03) }, slab(band, 50, 0.15), bustCut(f)],
|
|
131
|
+
color: c.leather,
|
|
132
|
+
blend: 0.006,
|
|
133
|
+
mirror: false,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
group: [
|
|
137
|
+
{ group: torsoForms(f, 0.055) },
|
|
138
|
+
bustCut(f),
|
|
139
|
+
{
|
|
140
|
+
shape: 'roundBox',
|
|
141
|
+
at: [cx + 0.3, 0.02, b + 0.38],
|
|
142
|
+
size: [0.3, 0.14, 0.14],
|
|
143
|
+
rotate: [50, 0, 0],
|
|
144
|
+
op: 'intersect',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
shape: 'ellipsoid',
|
|
148
|
+
at: [cx + 0.42, 0.02, b + 0.38],
|
|
149
|
+
size: [0.1, 0.04, 0.04],
|
|
150
|
+
op: 'subtract',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
color: shade(metal, 0.8),
|
|
154
|
+
blend: 0.004,
|
|
155
|
+
mirror: false,
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
// Fur mantle over the trapezius: clumped strands fanning back and out from behind the neck.
|
|
159
|
+
const fur = c.fur ?? c.leather;
|
|
160
|
+
const R = f.n + 0.08;
|
|
161
|
+
for (let row = 0; row < 3; row++)
|
|
162
|
+
for (let i = 0; i < 8; i++) {
|
|
163
|
+
const a = (-80 + i * 22 + row * 11) * RAD;
|
|
164
|
+
const rr = R + row * 0.07;
|
|
165
|
+
const root: Vec3 = [
|
|
166
|
+
cx - 0.1 - Math.abs(Math.cos(a)) * rr * 0.9,
|
|
167
|
+
Math.abs(Math.sin(a)) * rr + 0.02,
|
|
168
|
+
nz + 0.16 - row * 0.05,
|
|
169
|
+
];
|
|
170
|
+
const dir = unit([-0.7, Math.abs(Math.sin(a)) * 0.8, -0.55 - ((i + row) % 2) * 0.3]);
|
|
171
|
+
out.push({
|
|
172
|
+
shape: 'cone',
|
|
173
|
+
at: root,
|
|
174
|
+
size: [0.075 - row * 0.008, 0.012, 0.16 + ((i + row) % 3) * 0.04],
|
|
175
|
+
rotate: alongZ(dir),
|
|
176
|
+
color: (i + row) % 2 ? fur : shade(fur, 0.72),
|
|
177
|
+
blend: 0.035,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return out;
|
|
181
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Facial hair as sculpt groups, part of the skull field (so a beard splits with the jaw):
|
|
2
|
+
// eyebrows riding just proud of the brow ridge (tapered, arched), and beards built as one clipped
|
|
3
|
+
// volume — a mass around jaw and chin, trimmed above a cheek line that rises to the ears, the lips
|
|
4
|
+
// carved clear — plus a two-segment moustache and optional braid. Head units, mirrored across Y.
|
|
5
|
+
|
|
6
|
+
import type { Vec3 } from '../core/index.ts';
|
|
7
|
+
import type { SculptEdit } from '../primitives/index.ts';
|
|
8
|
+
import { along, unit } from './head-geom.ts';
|
|
9
|
+
import type { HeadLayout } from './head-layout.ts';
|
|
10
|
+
import type { HeadParams } from './head-params.ts';
|
|
11
|
+
|
|
12
|
+
const RAD = Math.PI / 180;
|
|
13
|
+
|
|
14
|
+
/** Eyebrows: two capsule segments (inner thick → outer thin) offset off the brow ridge. */
|
|
15
|
+
export function browEdits(p: HeadParams, l: HeadLayout): SculptEdit[] {
|
|
16
|
+
const h = p.brow.hair ?? 0;
|
|
17
|
+
if (h <= 0) return [];
|
|
18
|
+
const [ex, ey] = l.eye;
|
|
19
|
+
const r = l.eyeR;
|
|
20
|
+
const lift: Vec3 = [p.brow.ridge * 0.55 + 0.012, 0, p.brow.ridge * 0.8 + 0.018];
|
|
21
|
+
const inner: Vec3 = [ex + r * 0.75 + lift[0], 0.035, l.browZ - p.brow.scowl + lift[2]];
|
|
22
|
+
const outer: Vec3 = [
|
|
23
|
+
ex + r * 0.1 + lift[0] * 0.6,
|
|
24
|
+
ey + r * 1.25,
|
|
25
|
+
l.browZ + p.brow.scowl * 0.5 + lift[2] * 0.7,
|
|
26
|
+
];
|
|
27
|
+
const mid: Vec3 = [
|
|
28
|
+
(inner[0] + outer[0]) / 2,
|
|
29
|
+
inner[1] + (outer[1] - inner[1]) * 0.55,
|
|
30
|
+
(inner[2] + outer[2]) / 2 + 0.014,
|
|
31
|
+
];
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
group: [
|
|
35
|
+
{ shape: 'capsule', at: inner, to: mid, size: h },
|
|
36
|
+
{ shape: 'capsule', at: mid, to: outer, size: h * 0.65, blend: 0.006 },
|
|
37
|
+
],
|
|
38
|
+
color: p.colors.hair,
|
|
39
|
+
blend: 0.006,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Box whose top face is the plane through `p` tilted `deg` about Y (positive: higher at back). */
|
|
45
|
+
const below = (p: Vec3, deg: number): SculptEdit => {
|
|
46
|
+
const n: Vec3 = [-Math.sin(deg * RAD), 0, Math.cos(deg * RAD)];
|
|
47
|
+
return {
|
|
48
|
+
shape: 'roundBox',
|
|
49
|
+
at: [p[0] - n[0], p[1], p[2] - n[2]],
|
|
50
|
+
size: [4, 4, 2],
|
|
51
|
+
rotate: [0, -deg, 0],
|
|
52
|
+
op: 'intersect',
|
|
53
|
+
blend: 0.02,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export function beardEdits(p: HeadParams, l: HeadLayout): SculptEdit[] {
|
|
58
|
+
if (p.beard === 'none') return [];
|
|
59
|
+
const h = p.colors.hair;
|
|
60
|
+
const light: Vec3 = [h[0] * 1.35, h[1] * 1.35, h[2] * 1.35];
|
|
61
|
+
const [ax, ay, az] = l.angle;
|
|
62
|
+
const ch = l.chin;
|
|
63
|
+
const mw = p.mouth.width;
|
|
64
|
+
const lipT = p.mouth.lips;
|
|
65
|
+
const full = p.beard !== 'goatee';
|
|
66
|
+
const mass: SculptEdit = full
|
|
67
|
+
? {
|
|
68
|
+
shape: 'ellipsoid',
|
|
69
|
+
at: [(ax + ch[0]) / 2 + 0.03, 0, (az + ch[2]) / 2 + 0.01],
|
|
70
|
+
size: [(ch[0] - ax) / 2 + 0.08, ay + 0.065, 0.17],
|
|
71
|
+
}
|
|
72
|
+
: { shape: 'ellipsoid', at: [ch[0] + 0.01, 0, ch[2] + 0.02], size: [0.09, mw * 0.9, 0.11] };
|
|
73
|
+
const out: SculptEdit[] = [
|
|
74
|
+
{
|
|
75
|
+
group: [
|
|
76
|
+
mass,
|
|
77
|
+
// Chin volume: the beard grows forward and down off the chin.
|
|
78
|
+
{
|
|
79
|
+
shape: 'ellipsoid',
|
|
80
|
+
at: [ch[0] + 0.025, 0, ch[2] - 0.03],
|
|
81
|
+
size: [0.08, full ? 0.13 : 0.08, 0.1],
|
|
82
|
+
blend: 0.04,
|
|
83
|
+
},
|
|
84
|
+
// Trimmed below a cheek line that rises towards the ears.
|
|
85
|
+
below([l.mouthX, 0, l.mouthZ + 0.03], full ? 28 : 0),
|
|
86
|
+
// Lips carved clear.
|
|
87
|
+
{
|
|
88
|
+
shape: 'ellipsoid',
|
|
89
|
+
at: [l.mouthX + 0.02, 0, l.mouthZ - lipT * 0.3],
|
|
90
|
+
size: [0.07, mw * 1.05, lipT * 2.3],
|
|
91
|
+
op: 'subtract',
|
|
92
|
+
blend: 0.012,
|
|
93
|
+
},
|
|
94
|
+
// Clump grooves down the chin.
|
|
95
|
+
...[-0.05, 0.05].map(
|
|
96
|
+
(y): SculptEdit => ({
|
|
97
|
+
shape: 'capsule',
|
|
98
|
+
at: [ch[0] + 0.12, y, l.mouthZ - 0.06],
|
|
99
|
+
to: [ch[0] + 0.06, y * 1.3, ch[2] - 0.14],
|
|
100
|
+
size: 0.008,
|
|
101
|
+
op: 'subtract',
|
|
102
|
+
blend: 0.012,
|
|
103
|
+
mirror: false,
|
|
104
|
+
}),
|
|
105
|
+
),
|
|
106
|
+
],
|
|
107
|
+
color: h,
|
|
108
|
+
blend: 0.012,
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
if (p.beard === 'braided')
|
|
112
|
+
out.push({
|
|
113
|
+
shape: 'capsule',
|
|
114
|
+
at: [ch[0] + 0.03, 0.035, ch[2] - 0.08],
|
|
115
|
+
to: [ch[0] + 0.01, 0.045, ch[2] - 0.34],
|
|
116
|
+
size: 0.032,
|
|
117
|
+
color: light,
|
|
118
|
+
blend: 0.02,
|
|
119
|
+
});
|
|
120
|
+
// Moustache: from under the nose, over the lip corners, drooping past them.
|
|
121
|
+
const root: Vec3 = [l.mouthX + 0.02, 0.012, l.mouthZ + lipT * 1.9];
|
|
122
|
+
const bend: Vec3 = [l.mouthX - 0.005, mw * 0.85, l.mouthZ + lipT * 0.6];
|
|
123
|
+
const tip = along(bend, unit([-0.4, 0.5, -1]), 0.05);
|
|
124
|
+
out.push({
|
|
125
|
+
group: [
|
|
126
|
+
{ shape: 'capsule', at: root, to: bend, size: 0.024 },
|
|
127
|
+
{ shape: 'capsule', at: bend, to: tip, size: 0.016, blend: 0.01 },
|
|
128
|
+
],
|
|
129
|
+
color: light,
|
|
130
|
+
blend: 0.008,
|
|
131
|
+
});
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// The bust under the head: the anatomy, bust cut and plinth (head-torso.ts) plus the gear that
|
|
2
|
+
// sells the race at a glance — spiked plate pauldrons and a fur mantle (orc, head-armour.ts), a
|
|
3
|
+
// leather vest, scarf and cowl (goblin, head-garb.ts), a draped hood, or a tunic with mantle and
|
|
4
|
+
// brooch (human). Head units, mirrored across Y; the neck itself belongs to the head.
|
|
5
|
+
|
|
6
|
+
import type { Vec3 } from '../core/index.ts';
|
|
7
|
+
import { type SculptEdit, sculptField } from '../primitives/index.ts';
|
|
8
|
+
import { armour } from './head-armour.ts';
|
|
9
|
+
import { vest } from './head-garb.ts';
|
|
10
|
+
import type { HeadLayout } from './head-layout.ts';
|
|
11
|
+
import type { HeadParams } from './head-params.ts';
|
|
12
|
+
import {
|
|
13
|
+
type BustFrame,
|
|
14
|
+
bodyEdits,
|
|
15
|
+
bustCut,
|
|
16
|
+
frameOf,
|
|
17
|
+
plinthEdits,
|
|
18
|
+
torsoForms,
|
|
19
|
+
} from './head-torso.ts';
|
|
20
|
+
|
|
21
|
+
function hood(p: HeadParams, cx: number, nz: number): SculptEdit[] {
|
|
22
|
+
const c = p.colors;
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
shape: 'torus',
|
|
26
|
+
at: [cx - 0.08, 0, nz + 0.04],
|
|
27
|
+
size: [p.neck.radius + 0.13, 0.11],
|
|
28
|
+
color: c.cloth,
|
|
29
|
+
blend: 0.05,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
shape: 'ellipsoid',
|
|
33
|
+
at: [cx - 0.36, 0, nz + 0.14],
|
|
34
|
+
size: [0.16, 0.3, 0.2],
|
|
35
|
+
color: c.cloth,
|
|
36
|
+
blend: 0.08,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
shape: 'cone',
|
|
40
|
+
at: [cx - 0.42, 0, nz + 0.1],
|
|
41
|
+
size: [0.12, 0.02, 0.32],
|
|
42
|
+
rotate: [0, -165, 0],
|
|
43
|
+
color: c.cloth,
|
|
44
|
+
blend: 0.05,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
shape: 'roundBox',
|
|
48
|
+
at: [cx + 0.1, 0.32, nz - 0.02],
|
|
49
|
+
size: [0.04, 0.1, 0.08],
|
|
50
|
+
round: 0.01,
|
|
51
|
+
rotate: [20, 0, 0],
|
|
52
|
+
color: c.leather,
|
|
53
|
+
blend: 0.005,
|
|
54
|
+
mirror: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
shape: 'capsule',
|
|
58
|
+
at: [cx + 0.18, 0.12, nz - 0.02],
|
|
59
|
+
to: [cx + 0.26, 0.05, nz - 0.32],
|
|
60
|
+
size: 0.018,
|
|
61
|
+
color: c.leather,
|
|
62
|
+
blend: 0.01,
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function tunic(p: HeadParams, f: BustFrame): SculptEdit[] {
|
|
68
|
+
const c = p.colors;
|
|
69
|
+
const { cx, s, b, nz } = f;
|
|
70
|
+
const shell = (g: number): SculptEdit => ({ group: torsoForms(f, g) });
|
|
71
|
+
const torso = sculptField(torsoForms(f), { color: c.cloth, mirror: 'y' }).field;
|
|
72
|
+
const front = (z: number): number => {
|
|
73
|
+
let x = cx + 0.7;
|
|
74
|
+
for (let i = 0; i < 300 && torso([x, 0, z]) > 0; i++) x -= 0.004;
|
|
75
|
+
return x;
|
|
76
|
+
};
|
|
77
|
+
const n = p.neck.radius;
|
|
78
|
+
const axis = (z: number): Vec3 => [cx - 0.08, 0, z];
|
|
79
|
+
const mantle = (g: number): SculptEdit => ({
|
|
80
|
+
shape: 'ellipsoid',
|
|
81
|
+
at: [cx - 0.1, 0, b + 0.45],
|
|
82
|
+
size: [0.42 + g, s + 0.06 + g, 0.3 + g],
|
|
83
|
+
});
|
|
84
|
+
const opening: SculptEdit = {
|
|
85
|
+
shape: 'ellipsoid',
|
|
86
|
+
at: [cx + 0.38, 0, nz - 0.1],
|
|
87
|
+
size: [0.3, s * 0.45, 0.5],
|
|
88
|
+
op: 'subtract',
|
|
89
|
+
blend: 0.02,
|
|
90
|
+
};
|
|
91
|
+
const brooch = (y: number): SculptEdit => ({
|
|
92
|
+
group: [
|
|
93
|
+
mantle(0.03),
|
|
94
|
+
{ shape: 'sphere', at: [cx + 0.17, y, b + 0.5], size: 0.065, op: 'intersect' },
|
|
95
|
+
],
|
|
96
|
+
color: c.metal,
|
|
97
|
+
blend: 0.004,
|
|
98
|
+
});
|
|
99
|
+
return [
|
|
100
|
+
// Mantle: a dome over shoulders and back, cut level below, open at the front.
|
|
101
|
+
{
|
|
102
|
+
group: [
|
|
103
|
+
mantle(0),
|
|
104
|
+
{ shape: 'roundBox', at: [0, 0, b + 0.3 + 1], size: [4, 4, 2], op: 'intersect' },
|
|
105
|
+
opening,
|
|
106
|
+
bustCut(f),
|
|
107
|
+
],
|
|
108
|
+
color: c.cape ?? c.leather,
|
|
109
|
+
blend: 0.01,
|
|
110
|
+
},
|
|
111
|
+
brooch(s * 0.4),
|
|
112
|
+
// Standing collar, notched open at the throat.
|
|
113
|
+
{
|
|
114
|
+
group: [
|
|
115
|
+
{ shape: 'capsule', at: axis(nz - 0.06), to: axis(nz + 0.1), size: n + 0.08 },
|
|
116
|
+
{
|
|
117
|
+
shape: 'capsule',
|
|
118
|
+
at: axis(nz - 0.2),
|
|
119
|
+
to: axis(nz + 0.3),
|
|
120
|
+
size: n + 0.02,
|
|
121
|
+
op: 'subtract',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
shape: 'ellipsoid',
|
|
125
|
+
at: [cx + 0.2, 0, nz + 0.12],
|
|
126
|
+
size: [0.12, 0.08, 0.14],
|
|
127
|
+
op: 'subtract',
|
|
128
|
+
blend: 0.02,
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
color: c.leather,
|
|
132
|
+
blend: 0.015,
|
|
133
|
+
},
|
|
134
|
+
// Leather placket with three brass buttons down the chest.
|
|
135
|
+
{
|
|
136
|
+
group: [
|
|
137
|
+
shell(0.012),
|
|
138
|
+
{ shape: 'roundBox', at: [cx + 0.3, 0, b + 0.2], size: [0.4, 0.07, 0.6], op: 'intersect' },
|
|
139
|
+
],
|
|
140
|
+
color: c.leather,
|
|
141
|
+
blend: 0.004,
|
|
142
|
+
mirror: false,
|
|
143
|
+
},
|
|
144
|
+
// Brass buttons seated on the chest surface (probed along −X at the midline).
|
|
145
|
+
...[0.5, 0.38, 0.26].map(
|
|
146
|
+
(z): SculptEdit => ({
|
|
147
|
+
shape: 'sphere',
|
|
148
|
+
at: [front(b + z) + 0.014, 0, b + z],
|
|
149
|
+
size: 0.028,
|
|
150
|
+
color: c.metal,
|
|
151
|
+
blend: 0.004,
|
|
152
|
+
mirror: false,
|
|
153
|
+
}),
|
|
154
|
+
),
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** `cell`: the bust's sculpt cell (head units), floors the plinth disc so far LODs keep it. */
|
|
159
|
+
export function bustEdits(p: HeadParams, l: HeadLayout, cell = 0): SculptEdit[] {
|
|
160
|
+
const c = p.colors;
|
|
161
|
+
const f = frameOf(p, l);
|
|
162
|
+
const style = p.bust.style;
|
|
163
|
+
const bare = style === 'pauldrons' || style === 'vest';
|
|
164
|
+
const e: SculptEdit[] = [
|
|
165
|
+
...bodyEdits(p, f, bare ? c.skin : c.cloth),
|
|
166
|
+
// Neck root in skin, so the head's neck seats into the bust without a cloth ring (flattened,
|
|
167
|
+
// so it never pokes through the chest below the collar).
|
|
168
|
+
{
|
|
169
|
+
shape: 'ellipsoid',
|
|
170
|
+
at: [f.cx - 0.09, 0, f.nz + 0.06],
|
|
171
|
+
size: [f.n * 1.02, f.n * 1.02, 0.12],
|
|
172
|
+
color: c.skin,
|
|
173
|
+
blend: 0.04,
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
if (style === 'pauldrons') e.push(...armour(p, f, cell));
|
|
177
|
+
else if (style === 'hood') e.push(...hood(p, f.cx, f.nz));
|
|
178
|
+
else if (style === 'vest') e.push(...vest(p, f));
|
|
179
|
+
else e.push(...tunic(p, f));
|
|
180
|
+
e.push(...plinthEdits(p, f, cell * 1.5));
|
|
181
|
+
// Base cut flat at z = base.
|
|
182
|
+
e.push({ shape: 'roundBox', at: [0, 0, f.floor - 1], size: [4, 4, 2], op: 'subtract' });
|
|
183
|
+
return e;
|
|
184
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Tertiary head forms as edit lists: ears (added to the head after the jaw cut, so the cut never
|
|
2
|
+
// clips a lobe), tusks (added to the jaw), war paint and warts (part of the skull field). Hair and
|
|
3
|
+
// beards: head-hair.ts. Head units, mirrored across Y unless an edit opts out.
|
|
4
|
+
|
|
5
|
+
import type { Rng, Vec3 } from '../core/index.ts';
|
|
6
|
+
import type { SculptEdit } from '../primitives/index.ts';
|
|
7
|
+
import { along, alongX, alongZ, unit } from './head-geom.ts';
|
|
8
|
+
import type { HeadLayout } from './head-layout.ts';
|
|
9
|
+
import type { HeadParams } from './head-params.ts';
|
|
10
|
+
|
|
11
|
+
const RAD = Math.PI / 180;
|
|
12
|
+
|
|
13
|
+
/** `minThick`: the blade's floor thickness (≈ a cell), so far LODs keep their ears attached. */
|
|
14
|
+
export function earEdits(p: HeadParams, l: HeadLayout, minThick = 0): SculptEdit[] {
|
|
15
|
+
const { length, width, sweep, lift, shape } = p.ears;
|
|
16
|
+
const cx = l.cranium.at[0];
|
|
17
|
+
const ry = l.cranium.r[1];
|
|
18
|
+
const root: Vec3 = [cx + 0.02, ry * 0.9, l.eye[2] - 0.05];
|
|
19
|
+
const d = unit([-Math.sin(sweep * RAD), Math.cos(sweep * RAD), Math.tan(lift * RAD)]);
|
|
20
|
+
const rot = alongX(d, shape === 'pointed' ? -10 : 0);
|
|
21
|
+
const thick = Math.max(0.022 + width * 0.06, minThick);
|
|
22
|
+
const front: Vec3 = [Math.cos(sweep * RAD), Math.sin(sweep * RAD), 0];
|
|
23
|
+
const shade = p.colors.shade;
|
|
24
|
+
if (shape === 'round') {
|
|
25
|
+
// A human/dwarf ear: upright oval, the long axis vertical, set just behind the jaw hinge.
|
|
26
|
+
const at = along(root, d, 0.03);
|
|
27
|
+
const rot2: Vec3 = [0, -lift, 90 + sweep];
|
|
28
|
+
return [
|
|
29
|
+
{ shape: 'ellipsoid', at, size: [width / 2, thick, length / 2], rotate: rot2, blend: 0.02 },
|
|
30
|
+
{
|
|
31
|
+
shape: 'ellipsoid',
|
|
32
|
+
at: along(along(at, d, thick * 0.6), front, 0.004),
|
|
33
|
+
size: [width * 0.3, thick * 0.55, length * 0.3],
|
|
34
|
+
rotate: rot2,
|
|
35
|
+
op: 'subtract',
|
|
36
|
+
blend: 0.012,
|
|
37
|
+
color: shade,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
shape: 'ellipsoid',
|
|
41
|
+
at: [at[0], at[1] + thick * 0.4, at[2] - length * 0.33],
|
|
42
|
+
size: [width * 0.24, thick * 0.9, length * 0.16],
|
|
43
|
+
blend: 0.015,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
// A pointed leaf ear: broad root blade, tapering tip blade, a hollow facing forward.
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
shape: 'ellipsoid',
|
|
51
|
+
at: along(root, d, length * 0.3),
|
|
52
|
+
size: [length * 0.36, thick, width * 0.5],
|
|
53
|
+
rotate: rot,
|
|
54
|
+
blend: 0.03,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
shape: 'ellipsoid',
|
|
58
|
+
at: along(root, d, length * 0.68),
|
|
59
|
+
size: [length * 0.34, thick * 0.75, width * 0.22],
|
|
60
|
+
rotate: rot,
|
|
61
|
+
blend: 0.04,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
shape: 'ellipsoid',
|
|
65
|
+
at: along(along(root, d, length * 0.42), front, thick * 0.85),
|
|
66
|
+
size: [length * 0.36, thick * 0.6, width * 0.3],
|
|
67
|
+
rotate: rot,
|
|
68
|
+
op: 'subtract',
|
|
69
|
+
blend: 0.015,
|
|
70
|
+
color: shade,
|
|
71
|
+
},
|
|
72
|
+
{ shape: 'sphere', at: root, size: 0.04, blend: 0.03 },
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Lower tusks rising from the jaw past the upper lip, curving out and back (3 cone segments). */
|
|
77
|
+
/** `minR`: radius floor (≈ half a cell) so far LODs keep the tusks. */
|
|
78
|
+
export function tuskEdits(p: HeadParams, l: HeadLayout, minR = 0): SculptEdit[] {
|
|
79
|
+
const t = p.tusks;
|
|
80
|
+
if (!t) return [];
|
|
81
|
+
const out: SculptEdit[] = [];
|
|
82
|
+
let at: Vec3 = [l.mouthX - 0.03 + p.jaw.underbite * 0.5, t.spread, l.mouthZ - 0.02];
|
|
83
|
+
let dir = unit([0.25, t.flare * 0.5, 1]);
|
|
84
|
+
const seg = t.length / 3;
|
|
85
|
+
for (let i = 0; i < 3; i++) {
|
|
86
|
+
const r0 = Math.max(t.radius * (1 - i / 3.4), minR);
|
|
87
|
+
const r1 = Math.max(t.radius * (1 - (i + 1) / 3.4), minR * 0.6);
|
|
88
|
+
out.push({
|
|
89
|
+
shape: 'cone',
|
|
90
|
+
at,
|
|
91
|
+
size: [r0, Math.max(r1, 0.004), seg * 1.05],
|
|
92
|
+
rotate: alongZ(dir),
|
|
93
|
+
color: p.colors.teeth,
|
|
94
|
+
blend: i === 0 ? 0.02 : 0.004,
|
|
95
|
+
});
|
|
96
|
+
at = along(at, dir, seg);
|
|
97
|
+
dir = unit([dir[0] - 0.22, dir[1] + t.flare * 0.15, dir[2]]);
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** War paint: thin deep ellipsoids painted through the skin, so each stripe is a clean band of
|
|
103
|
+
* constant width wherever it crosses the surface — two claw marks per cheek, a crest stripe up
|
|
104
|
+
* the forehead, three down the chin. */
|
|
105
|
+
export function paintEdits(p: HeadParams, l: HeadLayout): SculptEdit[] {
|
|
106
|
+
const c = p.colors.paint;
|
|
107
|
+
if (!c) return [];
|
|
108
|
+
const [ex, ey, ez] = l.eye;
|
|
109
|
+
const band = (at: Vec3, r: Vec3, mirror = true, tilt = 0): SculptEdit => ({
|
|
110
|
+
shape: 'ellipsoid',
|
|
111
|
+
at,
|
|
112
|
+
size: r,
|
|
113
|
+
rotate: [tilt, 0, 0],
|
|
114
|
+
op: 'paint',
|
|
115
|
+
color: c,
|
|
116
|
+
blend: 0.006,
|
|
117
|
+
mirror,
|
|
118
|
+
});
|
|
119
|
+
const chinZ = (l.mouthZ + l.chin[2]) / 2 - 0.02;
|
|
120
|
+
return [
|
|
121
|
+
band([ex + 0.1, ey - 0.035, ez - 0.13], [0.45, 0.016, 0.09], true, -8),
|
|
122
|
+
band([ex + 0.1, ey + 0.035, ez - 0.12], [0.45, 0.016, 0.085], true, -8),
|
|
123
|
+
band([l.cranium.at[0], 0, l.browZ + 0.14], [0.6, 0.028, 0.13], false),
|
|
124
|
+
band([l.chin[0], 0, chinZ], [0.4, 0.012, 0.06], false),
|
|
125
|
+
band([l.chin[0], 0.055, chinZ], [0.4, 0.012, 0.05]),
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Seeded warts and bumps on the cranium and cheeks. */
|
|
130
|
+
export function wartEdits(p: HeadParams, l: HeadLayout, rng: Rng): SculptEdit[] {
|
|
131
|
+
const cx = l.cranium.at[0];
|
|
132
|
+
const [rx, ry, rz] = l.cranium.r;
|
|
133
|
+
return Array.from({ length: p.warts }, (): SculptEdit => {
|
|
134
|
+
const yaw = rng.range(-1.2, 1.2);
|
|
135
|
+
const el = rng.range(-0.1, 0.9);
|
|
136
|
+
const at: Vec3 = [
|
|
137
|
+
cx + rx * Math.cos(el) * Math.cos(yaw),
|
|
138
|
+
ry * Math.cos(el) * Math.sin(yaw),
|
|
139
|
+
l.cranium.at[2] + rz * Math.sin(el),
|
|
140
|
+
];
|
|
141
|
+
return {
|
|
142
|
+
shape: 'sphere',
|
|
143
|
+
at,
|
|
144
|
+
size: rng.range(0.008, 0.016),
|
|
145
|
+
color: p.colors.shade,
|
|
146
|
+
blend: 0.01,
|
|
147
|
+
mirror: false,
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
}
|