@developerz.ai/ts23d 0.0.0-stage → 0.1.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 +79 -0
- package/CLAUDE.md +85 -0
- package/LICENSE +21 -0
- package/README.md +380 -2
- package/dist/chunk-11v28977.js +1575 -0
- package/dist/chunk-11v28977.js.map +30 -0
- package/dist/chunk-1ypfs7ga.js +3571 -0
- package/dist/chunk-1ypfs7ga.js.map +42 -0
- package/dist/chunk-4ddzsqtc.js +464 -0
- package/dist/chunk-4ddzsqtc.js.map +19 -0
- package/dist/chunk-a8fxakcj.js +19 -0
- package/dist/chunk-a8fxakcj.js.map +11 -0
- package/dist/chunk-gcyp9b4d.js +755 -0
- package/dist/chunk-gcyp9b4d.js.map +22 -0
- package/dist/chunk-kgvbpqqw.js +44 -0
- package/dist/chunk-kgvbpqqw.js.map +10 -0
- package/dist/chunk-kvcep7ft.js +1919 -0
- package/dist/chunk-kvcep7ft.js.map +43 -0
- package/dist/chunk-ravbb06q.js +89 -0
- package/dist/chunk-ravbb06q.js.map +11 -0
- package/dist/chunk-w1zyhj40.js +1031 -0
- package/dist/chunk-w1zyhj40.js.map +21 -0
- package/dist/chunk-wtqhq529.js +2532 -0
- package/dist/chunk-wtqhq529.js.map +43 -0
- package/dist/chunk-xnt2sdhf.js +836 -0
- package/dist/chunk-xnt2sdhf.js.map +17 -0
- package/dist/cli/args.d.ts +24 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +307 -0
- package/dist/cli/bin.js.map +14 -0
- package/dist/cli/load.d.ts +2 -0
- package/dist/cli/manifest.d.ts +49 -0
- package/dist/cli/render-cmds.d.ts +12 -0
- package/dist/cli/run.d.ts +1 -0
- package/dist/core/asset.d.ts +10 -0
- package/dist/core/definition.d.ts +148 -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/glb.d.ts +38 -0
- package/dist/export/index.d.ts +4 -0
- package/dist/export/index.js +26 -0
- package/dist/export/index.js.map +9 -0
- package/dist/export/lights.d.ts +8 -0
- package/dist/export/materials.d.ts +23 -0
- package/dist/export/merge-pivots.d.ts +6 -0
- package/dist/export/metadata.d.ts +19 -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 +411 -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 +9 -0
- package/dist/kinds/head-beard.d.ts +6 -0
- package/dist/kinds/head-bust.d.ts +4 -0
- package/dist/kinds/head-extras.d.ts +15 -0
- package/dist/kinds/head-face.d.ts +6 -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 +27 -0
- package/dist/kinds/head-params.d.ts +108 -0
- package/dist/kinds/head-presets.d.ts +19 -0
- package/dist/kinds/head-rim.d.ts +10 -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/generator.d.ts +4 -0
- package/dist/material/index.d.ts +4 -0
- package/dist/material/index.js +38 -0
- package/dist/material/index.js.map +9 -0
- package/dist/material/paint/bond.d.ts +3 -0
- package/dist/material/paint/canvas.d.ts +32 -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 +2 -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/masks.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 +35 -0
- package/dist/material/paint/validate.d.ts +3 -0
- package/dist/material/palette.d.ts +12 -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/trim-sheet.d.ts +22 -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 +20 -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 +52 -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 +80 -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/landscape.md +49 -0
- package/docs/plans/roadmap.md +127 -0
- package/examples/build-with-bun.ts +41 -0
- package/llms.txt +47 -0
- package/package.json +99 -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 +46 -0
- package/recipes/boxcar/boxcar.ts +916 -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 +62 -0
- package/recipes/goblin_head/goblin_head.ts +36 -0
- package/recipes/human_head/README.md +64 -0
- package/recipes/human_head/human_head.ts +37 -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 +183 -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 +66 -0
- package/recipes/orc_head/orc_head.ts +39 -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 +112 -0
- package/src/cli/bin.ts +7 -0
- package/src/cli/load.ts +17 -0
- package/src/cli/manifest.ts +89 -0
- package/src/cli/render-cmds.ts +66 -0
- package/src/cli/run.ts +168 -0
- package/src/core/asset.ts +128 -0
- package/src/core/definition.ts +149 -0
- package/src/core/errors.ts +45 -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/glb.ts +200 -0
- package/src/export/index.ts +18 -0
- package/src/export/lights.ts +49 -0
- package/src/export/materials.ts +126 -0
- package/src/export/merge-pivots.ts +146 -0
- package/src/export/metadata.ts +59 -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 +151 -0
- package/src/kinds/head-beard.ts +133 -0
- package/src/kinds/head-bust.ts +221 -0
- package/src/kinds/head-extras.ts +150 -0
- package/src/kinds/head-face.ts +222 -0
- package/src/kinds/head-geom.ts +31 -0
- package/src/kinds/head-hair.ts +152 -0
- package/src/kinds/head-layout.ts +63 -0
- package/src/kinds/head-mesh.ts +157 -0
- package/src/kinds/head-params.ts +153 -0
- package/src/kinds/head-presets.ts +152 -0
- package/src/kinds/head-rim.ts +128 -0
- package/src/kinds/head.ts +171 -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/generator.ts +56 -0
- package/src/material/index.ts +29 -0
- package/src/material/paint/bond.ts +60 -0
- package/src/material/paint/canvas.ts +91 -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 +100 -0
- package/src/material/paint/default-sheet.ts +61 -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/masks.ts +44 -0
- package/src/material/paint/noise.ts +52 -0
- package/src/material/paint/normal.ts +52 -0
- package/src/material/paint/orm.ts +95 -0
- package/src/material/paint/planks.ts +56 -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 +42 -0
- package/src/material/paint/surface.ts +60 -0
- package/src/material/paint/types.ts +51 -0
- package/src/material/paint/validate.ts +58 -0
- package/src/material/palette.ts +43 -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/trim-sheet.ts +100 -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 +95 -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 +199 -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,221 @@
|
|
|
1
|
+
// The bust under the head: chest, trapezius and deltoid caps, cut flat at the base and at the arms
|
|
2
|
+
// (the classic sculpted bust), plus the gear that sells the race at a glance — layered spiked
|
|
3
|
+
// pauldrons and a fur mantle (orc), a draped hood (goblin), a tunic with cloak and clasp (human).
|
|
4
|
+
// 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 } from '../primitives/index.ts';
|
|
8
|
+
import { armour, chestOf } from './head-armour.ts';
|
|
9
|
+
import type { HeadLayout } from './head-layout.ts';
|
|
10
|
+
import type { HeadParams } from './head-params.ts';
|
|
11
|
+
|
|
12
|
+
/** Bare-chested torso forms under the armour: pectorals with a sternal groove, deltoid caps. */
|
|
13
|
+
function torso(p: HeadParams, cx: number, b: number): SculptEdit[] {
|
|
14
|
+
const c = p.colors;
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
shape: 'ellipsoid',
|
|
18
|
+
at: [cx + 0.17, 0.16, b + 0.32],
|
|
19
|
+
size: [0.16, 0.19, 0.12],
|
|
20
|
+
rotate: [0, 0, 12],
|
|
21
|
+
color: c.skin,
|
|
22
|
+
blend: 0.07,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
shape: 'capsule',
|
|
26
|
+
at: [cx + 0.33, 0, b + 0.42],
|
|
27
|
+
to: [cx + 0.34, 0, b + 0.1],
|
|
28
|
+
size: 0.012,
|
|
29
|
+
op: 'subtract',
|
|
30
|
+
blend: 0.04,
|
|
31
|
+
color: c.shade,
|
|
32
|
+
mirror: false,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function hood(p: HeadParams, cx: number, nz: number): SculptEdit[] {
|
|
38
|
+
const c = p.colors;
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
shape: 'torus',
|
|
42
|
+
at: [cx - 0.08, 0, nz + 0.04],
|
|
43
|
+
size: [p.neck.radius + 0.13, 0.11],
|
|
44
|
+
color: c.cloth,
|
|
45
|
+
blend: 0.05,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
shape: 'ellipsoid',
|
|
49
|
+
at: [cx - 0.36, 0, nz + 0.14],
|
|
50
|
+
size: [0.16, 0.3, 0.2],
|
|
51
|
+
color: c.cloth,
|
|
52
|
+
blend: 0.08,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
shape: 'cone',
|
|
56
|
+
at: [cx - 0.42, 0, nz + 0.1],
|
|
57
|
+
size: [0.12, 0.02, 0.32],
|
|
58
|
+
rotate: [0, -165, 0],
|
|
59
|
+
color: c.cloth,
|
|
60
|
+
blend: 0.05,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
shape: 'roundBox',
|
|
64
|
+
at: [cx + 0.1, 0.32, nz - 0.02],
|
|
65
|
+
size: [0.04, 0.1, 0.08],
|
|
66
|
+
round: 0.01,
|
|
67
|
+
rotate: [20, 0, 0],
|
|
68
|
+
color: c.leather,
|
|
69
|
+
blend: 0.005,
|
|
70
|
+
mirror: false,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
shape: 'capsule',
|
|
74
|
+
at: [cx + 0.18, 0.12, nz - 0.02],
|
|
75
|
+
to: [cx + 0.26, 0.05, nz - 0.32],
|
|
76
|
+
size: 0.018,
|
|
77
|
+
color: c.leather,
|
|
78
|
+
blend: 0.01,
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function tunic(p: HeadParams, cx: number, s: number, b: number, nz: number): SculptEdit[] {
|
|
84
|
+
const c = p.colors;
|
|
85
|
+
const chest = chestOf(cx, s, b);
|
|
86
|
+
const shell = (g: number): SculptEdit => ({
|
|
87
|
+
shape: 'ellipsoid',
|
|
88
|
+
at: chest.at,
|
|
89
|
+
size: [chest.r[0] + g, chest.r[1] + g, chest.r[2] + g],
|
|
90
|
+
});
|
|
91
|
+
const n = p.neck.radius;
|
|
92
|
+
const axis = (z: number): Vec3 => [cx - 0.08, 0, z];
|
|
93
|
+
const mantle = (g: number): SculptEdit => ({
|
|
94
|
+
shape: 'ellipsoid',
|
|
95
|
+
at: [cx - 0.1, 0, b + 0.45],
|
|
96
|
+
size: [0.42 + g, s + 0.06 + g, 0.3 + g],
|
|
97
|
+
});
|
|
98
|
+
const opening: SculptEdit = {
|
|
99
|
+
shape: 'ellipsoid',
|
|
100
|
+
at: [cx + 0.38, 0, nz - 0.1],
|
|
101
|
+
size: [0.3, s * 0.45, 0.5],
|
|
102
|
+
op: 'subtract',
|
|
103
|
+
blend: 0.02,
|
|
104
|
+
};
|
|
105
|
+
const brooch = (y: number): SculptEdit => ({
|
|
106
|
+
group: [
|
|
107
|
+
mantle(0.03),
|
|
108
|
+
{ shape: 'sphere', at: [cx + 0.17, y, b + 0.5], size: 0.065, op: 'intersect' },
|
|
109
|
+
],
|
|
110
|
+
color: c.metal,
|
|
111
|
+
blend: 0.004,
|
|
112
|
+
});
|
|
113
|
+
return [
|
|
114
|
+
// Mantle: a dome over shoulders and back, cut level below, open at the front.
|
|
115
|
+
{
|
|
116
|
+
group: [
|
|
117
|
+
mantle(0),
|
|
118
|
+
{ shape: 'roundBox', at: [0, 0, b + 0.3 + 1], size: [4, 4, 2], op: 'intersect' },
|
|
119
|
+
opening,
|
|
120
|
+
],
|
|
121
|
+
color: c.cape ?? c.leather,
|
|
122
|
+
blend: 0.01,
|
|
123
|
+
},
|
|
124
|
+
brooch(s * 0.4),
|
|
125
|
+
// Standing collar, notched open at the throat.
|
|
126
|
+
{
|
|
127
|
+
group: [
|
|
128
|
+
{ shape: 'capsule', at: axis(nz - 0.06), to: axis(nz + 0.1), size: n + 0.08 },
|
|
129
|
+
{
|
|
130
|
+
shape: 'capsule',
|
|
131
|
+
at: axis(nz - 0.2),
|
|
132
|
+
to: axis(nz + 0.3),
|
|
133
|
+
size: n + 0.02,
|
|
134
|
+
op: 'subtract',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
shape: 'ellipsoid',
|
|
138
|
+
at: [cx + 0.2, 0, nz + 0.12],
|
|
139
|
+
size: [0.12, 0.08, 0.14],
|
|
140
|
+
op: 'subtract',
|
|
141
|
+
blend: 0.02,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
color: c.leather,
|
|
145
|
+
blend: 0.015,
|
|
146
|
+
},
|
|
147
|
+
// Leather placket with three brass buttons down the chest.
|
|
148
|
+
{
|
|
149
|
+
group: [
|
|
150
|
+
shell(0.012),
|
|
151
|
+
{ shape: 'roundBox', at: [cx + 0.3, 0, b + 0.2], size: [0.4, 0.07, 0.6], op: 'intersect' },
|
|
152
|
+
],
|
|
153
|
+
color: c.leather,
|
|
154
|
+
blend: 0.004,
|
|
155
|
+
mirror: false,
|
|
156
|
+
},
|
|
157
|
+
...[0.42, 0.3, 0.18].map(
|
|
158
|
+
(z): SculptEdit => ({
|
|
159
|
+
group: [
|
|
160
|
+
shell(0.03),
|
|
161
|
+
{ shape: 'sphere', at: [cx + 0.3, 0, b + z], size: 0.03, op: 'intersect' },
|
|
162
|
+
],
|
|
163
|
+
color: c.metal,
|
|
164
|
+
blend: 0.003,
|
|
165
|
+
mirror: false,
|
|
166
|
+
}),
|
|
167
|
+
),
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function bustEdits(p: HeadParams, l: HeadLayout): SculptEdit[] {
|
|
172
|
+
const c = p.colors;
|
|
173
|
+
const cx = l.cranium.at[0] + p.jaw.muzzle * 0.3;
|
|
174
|
+
const s = p.bust.shoulders;
|
|
175
|
+
const b = l.base;
|
|
176
|
+
const nz = b + 0.6; // neck root
|
|
177
|
+
const body = p.bust.style === 'pauldrons' ? c.skin : c.cloth;
|
|
178
|
+
const e: SculptEdit[] = [
|
|
179
|
+
{ shape: 'ellipsoid', at: chestOf(cx, s, b).at, size: chestOf(cx, s, b).r, color: body },
|
|
180
|
+
{
|
|
181
|
+
shape: 'capsule',
|
|
182
|
+
at: [cx - 0.16, 0.1, nz + 0.16],
|
|
183
|
+
to: [cx - 0.1, s * 0.78, b + 0.44],
|
|
184
|
+
size: 0.15,
|
|
185
|
+
color: body,
|
|
186
|
+
blend: 0.15,
|
|
187
|
+
},
|
|
188
|
+
{ shape: 'sphere', at: [cx - 0.04, s * 0.84, b + 0.3], size: 0.2, color: body, blend: 0.1 },
|
|
189
|
+
// Trapezius: from high behind the neck down to the shoulder.
|
|
190
|
+
{
|
|
191
|
+
shape: 'capsule',
|
|
192
|
+
at: [cx - 0.2, 0.08, nz + 0.3],
|
|
193
|
+
to: [cx - 0.1, s * 0.62, b + 0.5],
|
|
194
|
+
size: 0.1 + p.neck.radius * 0.2,
|
|
195
|
+
color: body,
|
|
196
|
+
blend: 0.12,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
shape: 'capsule',
|
|
200
|
+
at: [cx - 0.08, 0, nz - 0.05],
|
|
201
|
+
to: [cx - 0.1, 0, nz + 0.12],
|
|
202
|
+
size: p.neck.radius * 1.05,
|
|
203
|
+
color: c.skin,
|
|
204
|
+
blend: 0.03,
|
|
205
|
+
},
|
|
206
|
+
];
|
|
207
|
+
// Arms cut flat at the shoulders (before the gear, so pauldrons overhang the cut).
|
|
208
|
+
e.push({
|
|
209
|
+
shape: 'roundBox',
|
|
210
|
+
at: [0, s + 1.02, b + 0.5],
|
|
211
|
+
size: [4, 2, 4],
|
|
212
|
+
op: 'subtract',
|
|
213
|
+
color: body,
|
|
214
|
+
});
|
|
215
|
+
if (p.bust.style === 'pauldrons') e.push(...torso(p, cx, b), ...armour(p, cx, s, b, nz));
|
|
216
|
+
else if (p.bust.style === 'hood') e.push(...hood(p, cx, nz));
|
|
217
|
+
else e.push(...tunic(p, cx, s, b, nz));
|
|
218
|
+
// Base cut flat at z = base.
|
|
219
|
+
e.push({ shape: 'roundBox', at: [0, 0, b - 1], size: [4, 4, 2], op: 'subtract' });
|
|
220
|
+
return e;
|
|
221
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// The skull edit list, primary → secondary forms (the ZBrush order): cranium, face plate, cheek
|
|
2
|
+
// bones, muzzle, mandible + chin, neck; then sockets, brow ridge, lids, nose, lips and the mouth
|
|
3
|
+
// line. Head units, mirrored across Y. The jaw cut (head-split.ts) later divides this one field
|
|
4
|
+
// into the `head` and `jaw` parts, so their surfaces meet without a seam.
|
|
5
|
+
|
|
6
|
+
import type { Vec3 } from '../core/index.ts';
|
|
7
|
+
import type { SculptEdit } from '../primitives/index.ts';
|
|
8
|
+
import { alongX, alongZ, unit } from './head-geom.ts';
|
|
9
|
+
import type { HeadLayout } from './head-layout.ts';
|
|
10
|
+
import type { HeadParams } from './head-params.ts';
|
|
11
|
+
|
|
12
|
+
/** Brain case + face plate: the forms the eyes are seated against (head.ts probes them). */
|
|
13
|
+
export function primaryEdits(l: HeadLayout): SculptEdit[] {
|
|
14
|
+
const [cx, , cz] = l.cranium.at;
|
|
15
|
+
const [rx, ry, rz] = l.cranium.r;
|
|
16
|
+
return [
|
|
17
|
+
{ shape: 'ellipsoid', at: [cx, 0, cz], size: [rx, ry, rz] },
|
|
18
|
+
{
|
|
19
|
+
shape: 'ellipsoid',
|
|
20
|
+
at: [l.faceX - 0.19, 0, l.eye[2] - 0.03],
|
|
21
|
+
size: [0.2, ry * 0.86, 0.24],
|
|
22
|
+
blend: 0.08,
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function skullEdits(p: HeadParams, l: HeadLayout): SculptEdit[] {
|
|
28
|
+
const c = p.colors;
|
|
29
|
+
const cx = l.cranium.at[0];
|
|
30
|
+
const [ex, ey, ez] = l.eye;
|
|
31
|
+
const r = l.eyeR;
|
|
32
|
+
const lipT = p.mouth.lips;
|
|
33
|
+
const mw = p.mouth.width;
|
|
34
|
+
const [ax, ay, az] = l.angle;
|
|
35
|
+
const [hx, hz] = l.hinge;
|
|
36
|
+
const chin = l.chin;
|
|
37
|
+
const tipX = l.faceX + 0.06 + p.nose.length * 0.25 + p.nose.bridge + p.jaw.muzzle * 0.5;
|
|
38
|
+
const tipZ = l.noseZ + 0.035 - p.nose.hook;
|
|
39
|
+
const e: SculptEdit[] = [
|
|
40
|
+
// Primary: brain case, face plate, cheek bones, muzzle, mandible, chin, neck.
|
|
41
|
+
...primaryEdits(l),
|
|
42
|
+
{
|
|
43
|
+
shape: 'ellipsoid',
|
|
44
|
+
at: [ex - 0.03, (ey + 0.06) * p.cheeks.width, ez - r - 0.065 * p.cheeks.size],
|
|
45
|
+
size: [0.09 * p.cheeks.size, 0.08 * p.cheeks.size, 0.065 * p.cheeks.size],
|
|
46
|
+
rotate: [0, 0, 25],
|
|
47
|
+
blend: 0.09,
|
|
48
|
+
},
|
|
49
|
+
// Maxilla: fills the midface between cheekbones, nose and muzzle.
|
|
50
|
+
{
|
|
51
|
+
shape: 'ellipsoid',
|
|
52
|
+
at: [l.faceX - 0.13 + p.jaw.muzzle * 0.6, 0, l.noseZ + 0.01],
|
|
53
|
+
size: [0.15, 0.2 * p.cheeks.width, 0.13],
|
|
54
|
+
blend: 0.08,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
shape: 'ellipsoid',
|
|
58
|
+
at: [l.mouthX - 0.13, 0, l.mouthZ + 0.02],
|
|
59
|
+
size: [0.14, Math.max(mw * 1.15, 0.13), 0.12 + p.jaw.drop * 0.2],
|
|
60
|
+
blend: 0.07,
|
|
61
|
+
},
|
|
62
|
+
// Mandible: a U of bone — body from the jaw angles to the chin, ramus up to the hinge.
|
|
63
|
+
{
|
|
64
|
+
shape: 'roundBox',
|
|
65
|
+
at: [(ax + chin[0]) / 2 + 0.01, 0, (az + chin[2]) / 2 + 0.03],
|
|
66
|
+
size: [chin[0] - ax + 0.04, ay * 1.75, 0.16 + p.jaw.drop * 0.5],
|
|
67
|
+
round: 0.07,
|
|
68
|
+
rotate: [0, Math.atan2(az - chin[2], chin[0] - ax) * (180 / Math.PI) * 0.6, 0],
|
|
69
|
+
blend: 0.08,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
shape: 'capsule',
|
|
73
|
+
at: [hx - 0.04, ay * 0.85, hz],
|
|
74
|
+
to: [ax, ay, az],
|
|
75
|
+
size: 0.055,
|
|
76
|
+
blend: 0.07,
|
|
77
|
+
},
|
|
78
|
+
{ shape: 'sphere', at: [ax + 0.02, ay * 0.95, az], size: 0.065, blend: 0.07 },
|
|
79
|
+
{
|
|
80
|
+
shape: 'ellipsoid',
|
|
81
|
+
at: chin,
|
|
82
|
+
size: [0.065 * p.jaw.chin, 0.09 * p.jaw.chin, 0.07 * p.jaw.chin],
|
|
83
|
+
blend: 0.06,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
shape: 'capsule',
|
|
87
|
+
at: [cx + 0.02, 0, ez - 0.22],
|
|
88
|
+
to: [cx - 0.05, 0, l.base + 0.45],
|
|
89
|
+
size: p.neck.radius,
|
|
90
|
+
blend: 0.1,
|
|
91
|
+
},
|
|
92
|
+
// Secondary: sockets, brow, lids.
|
|
93
|
+
{
|
|
94
|
+
shape: 'capsule',
|
|
95
|
+
at: [ex + r * 0.75, 0.025, l.browZ - p.brow.scowl],
|
|
96
|
+
to: [ex + r * 0.1, ey + r * 1.25, l.browZ + p.brow.scowl * 0.5],
|
|
97
|
+
size: p.brow.ridge,
|
|
98
|
+
blend: 0.06,
|
|
99
|
+
},
|
|
100
|
+
{ shape: 'sphere', at: l.eye, size: r * 1.12, op: 'subtract', blend: r * 0.5, color: c.shade },
|
|
101
|
+
];
|
|
102
|
+
// Lids: a shell over the eyeball, kept above (upper) / below (lower) a plane through the eye
|
|
103
|
+
// centre tilted to the lid angle, so the lid edge crosses the cornea exactly at that angle.
|
|
104
|
+
const lid = (deg: number, upper: boolean): SculptEdit => {
|
|
105
|
+
const t = (deg * Math.PI) / 180;
|
|
106
|
+
const n: Vec3 = upper ? [-Math.sin(t), 0, Math.cos(t)] : [Math.sin(t), 0, Math.cos(t)];
|
|
107
|
+
const k = upper ? 1 : -1;
|
|
108
|
+
return {
|
|
109
|
+
group: [
|
|
110
|
+
{ shape: 'sphere', at: l.eye, size: r * (upper ? 1.14 : 1.1) },
|
|
111
|
+
{
|
|
112
|
+
shape: 'roundBox',
|
|
113
|
+
at: [ex + n[0] * k, ey, ez + n[2] * k],
|
|
114
|
+
size: [4, 4, 2],
|
|
115
|
+
rotate: [0, upper ? -deg : deg, 0],
|
|
116
|
+
op: 'intersect',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
blend: r * 0.22,
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
e.push(lid(p.eyes.lid, true), lid(p.eyes.lowerLid, false));
|
|
123
|
+
// Nose: bridge (humped by `hook`), tip, wings, nostrils.
|
|
124
|
+
const noseRoot: Vec3 = [ex + r * 0.4, 0, ez - r * 0.4];
|
|
125
|
+
const noseDir: Vec3 = [tipX - noseRoot[0], 0, tipZ + 0.01 - noseRoot[2]];
|
|
126
|
+
const midNose: Vec3 = [
|
|
127
|
+
(ex + r * 0.6 + tipX) / 2,
|
|
128
|
+
0,
|
|
129
|
+
(ez - 0.02 + tipZ) / 2 + p.nose.hook * 0.6 + 0.01,
|
|
130
|
+
];
|
|
131
|
+
e.push(
|
|
132
|
+
{
|
|
133
|
+
shape: 'cone',
|
|
134
|
+
at: noseRoot,
|
|
135
|
+
size: [0.02 + p.nose.width * 0.6, p.nose.tip * 0.8, Math.hypot(...noseDir)],
|
|
136
|
+
rotate: alongZ(noseDir),
|
|
137
|
+
blend: 0.04,
|
|
138
|
+
},
|
|
139
|
+
{ shape: 'sphere', at: midNose, size: 0.02 + p.nose.width * 0.2, blend: 0.04 },
|
|
140
|
+
{ shape: 'sphere', at: [tipX, 0, tipZ], size: p.nose.tip, blend: 0.03 },
|
|
141
|
+
{
|
|
142
|
+
shape: 'ellipsoid',
|
|
143
|
+
at: [tipX - p.nose.tip * 1.2, p.nose.width, l.noseZ + 0.02],
|
|
144
|
+
size: [0.045, 0.035, 0.032],
|
|
145
|
+
blend: 0.025,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
shape: 'ellipsoid',
|
|
149
|
+
at: [tipX - p.nose.tip * 0.6, p.nose.width * 0.55, l.noseZ + 0.005],
|
|
150
|
+
size: [0.022, 0.014, 0.012],
|
|
151
|
+
op: 'subtract',
|
|
152
|
+
blend: 0.008,
|
|
153
|
+
color: c.mouth,
|
|
154
|
+
},
|
|
155
|
+
);
|
|
156
|
+
// Lips and the mouth line (a grin opens it and lifts the corners).
|
|
157
|
+
const g = p.mouth.grin;
|
|
158
|
+
e.push(
|
|
159
|
+
{
|
|
160
|
+
shape: 'ellipsoid',
|
|
161
|
+
at: [l.mouthX - 0.01, 0, l.mouthZ + lipT * 0.7],
|
|
162
|
+
size: [0.032, mw, lipT],
|
|
163
|
+
color: c.lips,
|
|
164
|
+
blend: 0.03,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
shape: 'ellipsoid',
|
|
168
|
+
at: [l.mouthX - 0.015 + p.jaw.underbite * 0.7, 0, l.mouthZ - lipT * 0.8],
|
|
169
|
+
size: [0.034, mw * 0.85, lipT * 1.1],
|
|
170
|
+
color: c.lips,
|
|
171
|
+
blend: 0.03,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
shape: 'capsule',
|
|
175
|
+
at: [l.mouthX + 0.05, 0, l.mouthZ],
|
|
176
|
+
to: [l.mouthX - 0.03 - 0.02 * g, mw * 0.98, l.mouthZ + 0.012 + g * 0.05],
|
|
177
|
+
size: 0.006 + g * 0.022,
|
|
178
|
+
op: 'subtract',
|
|
179
|
+
blend: 0.012,
|
|
180
|
+
color: c.mouth,
|
|
181
|
+
},
|
|
182
|
+
);
|
|
183
|
+
if (g > 0.15) e.push(...teethRows(p, l));
|
|
184
|
+
// Nasolabial fold from the nose wing towards the mouth corner.
|
|
185
|
+
const fold = unit([-0.02, mw - p.nose.width, l.mouthZ - l.noseZ]);
|
|
186
|
+
e.push({
|
|
187
|
+
shape: 'ellipsoid',
|
|
188
|
+
at: [tipX - p.nose.tip * 1.5 - 0.035, p.nose.width + 0.05, l.noseZ - 0.035],
|
|
189
|
+
size: [0.08, 0.006, 0.006],
|
|
190
|
+
rotate: alongX(fold),
|
|
191
|
+
op: 'subtract',
|
|
192
|
+
blend: 0.03,
|
|
193
|
+
color: c.shade,
|
|
194
|
+
});
|
|
195
|
+
return e;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Upper and lower teeth, visible in a grin: rounded blocks along the dental arch. */
|
|
199
|
+
function teethRows(p: HeadParams, l: HeadLayout): SculptEdit[] {
|
|
200
|
+
const out: SculptEdit[] = [];
|
|
201
|
+
const mw = p.mouth.width * 0.8;
|
|
202
|
+
for (let i = 0; i < 4; i++) {
|
|
203
|
+
const a = ((i + 0.5) / 4) * 0.9;
|
|
204
|
+
const y = Math.sin(a) * mw;
|
|
205
|
+
const x = l.mouthX - 0.025 - (1 - Math.cos(a)) * mw * 0.9;
|
|
206
|
+
const z = l.mouthZ + 0.004 + p.mouth.grin * 0.03 * (i / 4);
|
|
207
|
+
for (const [dz, h] of [
|
|
208
|
+
[0.016, 0.02],
|
|
209
|
+
[-0.016, 0.018],
|
|
210
|
+
] as const)
|
|
211
|
+
out.push({
|
|
212
|
+
shape: 'roundBox',
|
|
213
|
+
at: [x, y, z + dz * (1 + p.mouth.grin)],
|
|
214
|
+
size: [0.02, 0.028, h * (1 + p.mouth.grin * 0.6)],
|
|
215
|
+
round: 0.006,
|
|
216
|
+
rotate: [0, 0, (a * 180) / Math.PI],
|
|
217
|
+
color: p.colors.teeth,
|
|
218
|
+
blend: 0.003,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return out;
|
|
222
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Small geometry helpers for head edit lists: the `rotate` that points an edit's local X (or Z) along
|
|
2
|
+
// a direction, and point/vector helpers.
|
|
3
|
+
|
|
4
|
+
import type { Vec3 } from '../core/index.ts';
|
|
5
|
+
|
|
6
|
+
const DEG = 180 / Math.PI;
|
|
7
|
+
|
|
8
|
+
/** `rotate` (deg, X→Y→Z) taking local +X onto `d`, then rolling `roll` deg about it. */
|
|
9
|
+
export function alongX(d: Vec3, roll = 0): Vec3 {
|
|
10
|
+
const yaw = Math.atan2(d[1], d[0]);
|
|
11
|
+
const pitch = -Math.atan2(d[2], Math.hypot(d[0], d[1]));
|
|
12
|
+
return [roll, pitch * DEG, yaw * DEG];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** `rotate` taking local +Z (a cone's axis) onto `d`. */
|
|
16
|
+
export function alongZ(d: Vec3): Vec3 {
|
|
17
|
+
const len = Math.hypot(d[0], d[1], d[2]) || 1;
|
|
18
|
+
const tilt = Math.acos(Math.max(-1, Math.min(1, d[2] / len)));
|
|
19
|
+
return [0, tilt * DEG, Math.atan2(d[1], d[0]) * DEG];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const unit = (d: Vec3): Vec3 => {
|
|
23
|
+
const l = Math.hypot(d[0], d[1], d[2]) || 1;
|
|
24
|
+
return [d[0] / l, d[1] / l, d[2] / l];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const along = (a: Vec3, d: Vec3, t: number): Vec3 => [
|
|
28
|
+
a[0] + d[0] * t,
|
|
29
|
+
a[1] + d[1] * t,
|
|
30
|
+
a[2] + d[2] * t,
|
|
31
|
+
];
|