@fleox/agent3d 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/LICENSE +143 -0
- package/README.md +172 -2
- package/changelog.json +56 -0
- package/dist/agent/agent3d.mjs +11242 -0
- package/dist/agent/chunks/assets-BUUM9TUB.mjs +2448 -0
- package/dist/agent/chunks/browser-t_JL_B82.mjs +226 -0
- package/dist/agent/chunks/cdp-CaKRRzMX.mjs +177 -0
- package/dist/agent/chunks/check-CBO3Ekx1.mjs +971 -0
- package/dist/agent/chunks/export-BCI8vKw8.mjs +1130 -0
- package/dist/agent/chunks/gif-DQznzHTL.mjs +319 -0
- package/dist/agent/chunks/gltf-f_f0-OiV.mjs +207 -0
- package/dist/agent/chunks/imageCodec-BpDU9Lsq.mjs +101 -0
- package/dist/agent/chunks/jsonPath-DUCe1JpS.mjs +155 -0
- package/dist/agent/chunks/meshoptimizer-C-tN9jn5.mjs +1165 -0
- package/dist/agent/chunks/mp4-aOALfp3s.mjs +130 -0
- package/dist/agent/chunks/objects-DBAws7uf.mjs +53 -0
- package/dist/agent/chunks/optimizeSizing-CkZ3fZRp.mjs +540 -0
- package/dist/agent/chunks/package-Ck7_Nszg.mjs +75 -0
- package/dist/agent/chunks/png-DXfSGJZt.mjs +91 -0
- package/dist/agent/chunks/render-Cbuhz5uW.mjs +1511 -0
- package/dist/agent/chunks/rolldown-runtime-ebOQtxsr.mjs +18 -0
- package/dist/agent/chunks/scene-BgajNvBf.mjs +444 -0
- package/dist/agent/chunks/server-CACCerkZ.mjs +237 -0
- package/dist/agent/chunks/suggest-Cpcgv1RP.mjs +46 -0
- package/dist/agent/chunks/tools-DT2tetIK.mjs +1412 -0
- package/dist/agent/chunks/tree-BrNYGui2.mjs +75 -0
- package/dist/agent/chunks/webpAnim-qaq9YgKl.mjs +132 -0
- package/dist/runtime/agent3d-runtime.js +373 -0
- package/dist/runtime/agent3d-runtime.single.js +7360 -0
- package/dist/runtime/chunks/BufferGeometryUtils-Re3wQkXp.js +1 -0
- package/dist/runtime/chunks/EXRLoader-Bzm84si5.js +1 -0
- package/dist/runtime/chunks/FontLoader-BocwqK8V.js +2 -0
- package/dist/runtime/chunks/GLTFLoader-DHp1wv6J.js +1 -0
- package/dist/runtime/chunks/GroundedSkybox-esvlRCO0.js +1 -0
- package/dist/runtime/chunks/HDRLoader-DHrHp8fs.js +5 -0
- package/dist/runtime/chunks/OrbitControls-sjN2MF0e.js +1 -0
- package/dist/runtime/chunks/RectAreaLightUniformsLib-_mZ62yWn.js +1 -0
- package/dist/runtime/chunks/RoomEnvironment-CL4UR6ZW.js +1 -0
- package/dist/runtime/chunks/RoundedBoxGeometry-x-ot8ZSh.js +1 -0
- package/dist/runtime/chunks/SVGLoader-hRF0EwD-.js +1 -0
- package/dist/runtime/chunks/SkeletonUtils-DHlReJx3.js +1 -0
- package/dist/runtime/chunks/Sky-BrLN9Fk5.js +243 -0
- package/dist/runtime/chunks/audio-DbVNbf-r.js +1 -0
- package/dist/runtime/chunks/catalog-DL6sgPay.js +1 -0
- package/dist/runtime/chunks/easing-CXSz2e6P.js +1 -0
- package/dist/runtime/chunks/extrude-m04mghOS.js +1 -0
- package/dist/runtime/chunks/game-BoG2S6g4.js +20 -0
- package/dist/runtime/chunks/generators-OHhFCc2E.js +331 -0
- package/dist/runtime/chunks/materials-C2uffFEd.js +107 -0
- package/dist/runtime/chunks/meshGradient.glsl-BMatplLA.js +88 -0
- package/dist/runtime/chunks/meshopt_decoder.module-DXTYc6wn.js +1 -0
- package/dist/runtime/chunks/model-D-4xZz21.js +1 -0
- package/dist/runtime/chunks/params-DdApDOBw.js +1 -0
- package/dist/runtime/chunks/physicsHost-DPaVdM0R.js +1 -0
- package/dist/runtime/chunks/postfx-BpBXjLX3.js +1527 -0
- package/dist/runtime/chunks/postfx-i_J5Vf-l.js +1 -0
- package/dist/runtime/chunks/random-eeej60NW.js +1 -0
- package/dist/runtime/chunks/shaders-CmeJRio1.js +443 -0
- package/dist/runtime/chunks/svg-B3nZaQFD.js +1 -0
- package/dist/runtime/chunks/text-CmkU-b0C.js +2 -0
- package/dist/runtime/chunks/three.module-W4hp4qHb.js +4225 -0
- package/dist/runtime/chunks/toon-B5Jhf37V.js +6 -0
- package/dist/runtime/chunks/util-THUewKBk.js +1 -0
- package/dist/studio/assets/BufferGeometryUtils-wW9vV1l2.js +1 -0
- package/dist/studio/assets/EXRLoader-f8U8jnlr.js +1 -0
- package/dist/studio/assets/FontLoader-9sHudKzD.js +2 -0
- package/dist/studio/assets/GLTFLoader-C3C_3K62.js +1 -0
- package/dist/studio/assets/GroundedSkybox-BTqmv4fv.js +1 -0
- package/dist/studio/assets/HDRLoader-CkQyrTWY.js +5 -0
- package/dist/studio/assets/OrbitControls-fcOgB96a.js +1 -0
- package/dist/studio/assets/RectAreaLightUniformsLib-CZHWO9xf.js +1 -0
- package/dist/studio/assets/RoomEnvironment-BsISzuCp.js +1 -0
- package/dist/studio/assets/SVGLoader-BIkQDT66.js +1 -0
- package/dist/studio/assets/SkeletonUtils-CG5akqME.js +1 -0
- package/dist/studio/assets/Sky-C282PFL1.js +243 -0
- package/dist/studio/assets/audio-JD1kyX0A.js +1 -0
- package/dist/studio/assets/camera-BhKdE9ej.js +2 -0
- package/dist/studio/assets/editor-BgY_RoRd.js +1 -0
- package/dist/studio/assets/extrude-CnayHczh.js +1 -0
- package/dist/studio/assets/game-Dv5s4eMN.js +19 -0
- package/dist/studio/assets/generators-DVX3bAxe.js +331 -0
- package/dist/studio/assets/index-BQT0otii.css +1 -0
- package/dist/studio/assets/index-Dh-2Y34U.js +479 -0
- package/dist/studio/assets/meshopt_decoder.module-DXTYc6wn.js +1 -0
- package/dist/studio/assets/meshoptimizer-BCSwHBL3.js +1 -0
- package/dist/studio/assets/model-XZSP52pV.js +2 -0
- package/dist/studio/assets/physicsHost-C84FddIe.js +1 -0
- package/dist/studio/assets/postfx-BWWXb8i8.js +1527 -0
- package/dist/studio/assets/runtime-k_MFerbJ.js +572 -0
- package/dist/studio/assets/shaders-BEznGIct.js +443 -0
- package/dist/studio/assets/svg-DT8kx37i.js +2 -0
- package/dist/studio/assets/text-5DsJJHcj.js +3 -0
- package/dist/studio/assets/three.module-ByMn_ZTv.js +4225 -0
- package/dist/studio/index.html +16 -0
- package/library/LICENSES.md +77 -0
- package/library/fonts/LICENSES.md +42 -0
- package/library/fonts/anton.typeface.json +1 -0
- package/library/fonts/bebas-neue.typeface.json +1 -0
- package/library/fonts/display.typeface.json +1 -0
- package/library/fonts/inter-black.typeface.json +1 -0
- package/library/fonts/lobster.typeface.json +1 -0
- package/library/fonts/mono.typeface.json +1 -0
- package/library/fonts/montserrat-extrabold.typeface.json +1 -0
- package/library/fonts/pacifico.typeface.json +1 -0
- package/library/fonts/sans-bold.typeface.json +1 -0
- package/library/fonts/sans.typeface.json +1 -0
- package/library/fonts/serif-bold.typeface.json +1 -0
- package/library/fonts/serif.typeface.json +1 -0
- package/library/fonts/space-grotesk-bold.typeface.json +1 -0
- package/library/hdri/beach.hdr +0 -0
- package/library/hdri/beach.jpg +0 -0
- package/library/hdri/city.hdr +0 -0
- package/library/hdri/city.jpg +0 -0
- package/library/hdri/forest.hdr +0 -0
- package/library/hdri/forest.jpg +0 -0
- package/library/hdri/night-city.hdr +0 -0
- package/library/hdri/night-city.jpg +0 -0
- package/library/hdri/night.hdr +0 -0
- package/library/hdri/night.jpg +0 -0
- package/library/hdri/sky.hdr +0 -0
- package/library/hdri/sky.jpg +0 -0
- package/library/hdri/softbox.hdr +0 -0
- package/library/hdri/softbox.jpg +0 -0
- package/library/hdri/studio.hdr +0 -0
- package/library/hdri/studio.jpg +0 -0
- package/library/hdri/sunset.hdr +0 -0
- package/library/hdri/sunset.jpg +0 -0
- package/library/hdri/warehouse.hdr +0 -0
- package/library/hdri/warehouse.jpg +0 -0
- package/library/index.json +5510 -0
- package/library/models/animals/fish.glb +0 -0
- package/library/models/animals/fox.glb +0 -0
- package/library/models/buildings/castle.glb +0 -0
- package/library/models/buildings/house.glb +0 -0
- package/library/models/buildings/market.glb +0 -0
- package/library/models/buildings/tavern.glb +0 -0
- package/library/models/buildings/tower.glb +0 -0
- package/library/models/buildings/windmill.glb +0 -0
- package/library/models/characters/barbarian.glb +0 -0
- package/library/models/characters/knight.glb +0 -0
- package/library/models/characters/mage.glb +0 -0
- package/library/models/characters/mini-soldier.glb +0 -0
- package/library/models/characters/platformer-hero.glb +0 -0
- package/library/models/characters/robot.glb +0 -0
- package/library/models/characters/rogue.glb +0 -0
- package/library/models/characters/skeleton.glb +0 -0
- package/library/models/city/building-a.glb +0 -0
- package/library/models/city/building-b.glb +0 -0
- package/library/models/city/building-tall.glb +0 -0
- package/library/models/city/fire-hydrant.glb +0 -0
- package/library/models/city/road-corner.glb +0 -0
- package/library/models/city/road-crossing.glb +0 -0
- package/library/models/city/road-junction.glb +0 -0
- package/library/models/city/road-straight.glb +0 -0
- package/library/models/city/streetlight.glb +0 -0
- package/library/models/city/suburban-house.glb +0 -0
- package/library/models/city/traffic-light.glb +0 -0
- package/library/models/city/water-tower.glb +0 -0
- package/library/models/food/apple.glb +0 -0
- package/library/models/food/avocado.glb +0 -0
- package/library/models/food/baguette.glb +0 -0
- package/library/models/food/bread-loaf.glb +0 -0
- package/library/models/food/burger.glb +0 -0
- package/library/models/food/carrot.glb +0 -0
- package/library/models/food/cheese.glb +0 -0
- package/library/models/food/cookie.glb +0 -0
- package/library/models/food/croissant.glb +0 -0
- package/library/models/food/cupcake.glb +0 -0
- package/library/models/food/dinner-plate.glb +0 -0
- package/library/models/food/donut.glb +0 -0
- package/library/models/food/ketchup.glb +0 -0
- package/library/models/food/mug.glb +0 -0
- package/library/models/food/pain-au-chocolat.glb +0 -0
- package/library/models/food/stew.glb +0 -0
- package/library/models/food/tomato.glb +0 -0
- package/library/models/food/veggie-burger.glb +0 -0
- package/library/models/nature/bush.glb +0 -0
- package/library/models/nature/cactus.glb +0 -0
- package/library/models/nature/cloud.glb +0 -0
- package/library/models/nature/fir-tree.glb +0 -0
- package/library/models/nature/forest-patch.glb +0 -0
- package/library/models/nature/grass-small.glb +0 -0
- package/library/models/nature/grass.glb +0 -0
- package/library/models/nature/hex-grass.glb +0 -0
- package/library/models/nature/hex-water.glb +0 -0
- package/library/models/nature/hills.glb +0 -0
- package/library/models/nature/mountain.glb +0 -0
- package/library/models/nature/pine-autumn.glb +0 -0
- package/library/models/nature/pine-tree.glb +0 -0
- package/library/models/nature/pumpkin.glb +0 -0
- package/library/models/nature/rock-flat.glb +0 -0
- package/library/models/nature/rock.glb +0 -0
- package/library/models/nature/tree-dead.glb +0 -0
- package/library/models/nature/tree-slim.glb +0 -0
- package/library/models/nature/trees-cluster.glb +0 -0
- package/library/models/nature/waterlily.glb +0 -0
- package/library/models/platformer/blaster.glb +0 -0
- package/library/models/platformer/block-coin.glb +0 -0
- package/library/models/platformer/brick.glb +0 -0
- package/library/models/platformer/coin.glb +0 -0
- package/library/models/platformer/enemy-flying.glb +0 -0
- package/library/models/platformer/flag.glb +0 -0
- package/library/models/platformer/platform-falling.glb +0 -0
- package/library/models/platformer/platform-grass-round.glb +0 -0
- package/library/models/platformer/platform-large.glb +0 -0
- package/library/models/platformer/platform-medium.glb +0 -0
- package/library/models/platformer/platform.glb +0 -0
- package/library/models/platformer/target.glb +0 -0
- package/library/models/platformer/track-corner.glb +0 -0
- package/library/models/platformer/track-straight.glb +0 -0
- package/library/models/platformer/wall-low.glb +0 -0
- package/library/models/products/boombox.glb +0 -0
- package/library/models/products/iridescent-lamp.glb +0 -0
- package/library/models/products/lantern.glb +0 -0
- package/library/models/products/lounge-chair.glb +0 -0
- package/library/models/products/sneaker.glb +0 -0
- package/library/models/products/velvet-sofa.glb +0 -0
- package/library/models/products/water-bottle.glb +0 -0
- package/library/models/props/alarm-clock.glb +0 -0
- package/library/models/props/armchair.glb +0 -0
- package/library/models/props/barrel.glb +0 -0
- package/library/models/props/bench.glb +0 -0
- package/library/models/props/brass-vase.glb +0 -0
- package/library/models/props/chest.glb +0 -0
- package/library/models/props/coffee-table.glb +0 -0
- package/library/models/props/coin-stack.glb +0 -0
- package/library/models/props/coin.glb +0 -0
- package/library/models/props/couch.glb +0 -0
- package/library/models/props/crate.glb +0 -0
- package/library/models/props/flag.glb +0 -0
- package/library/models/props/gravestone.glb +0 -0
- package/library/models/props/key.glb +0 -0
- package/library/models/props/lamp.glb +0 -0
- package/library/models/props/lantern.glb +0 -0
- package/library/models/props/marble-bust.glb +0 -0
- package/library/models/props/modern-armchair.glb +0 -0
- package/library/models/props/potted-succulent.glb +0 -0
- package/library/models/props/rubber-duck.glb +0 -0
- package/library/models/props/shield.glb +0 -0
- package/library/models/props/sword-shield.glb +0 -0
- package/library/models/props/sword.glb +0 -0
- package/library/models/props/table.glb +0 -0
- package/library/models/props/tent.glb +0 -0
- package/library/models/props/torch.glb +0 -0
- package/library/models/props/trophy.glb +0 -0
- package/library/models/space/base-module.glb +0 -0
- package/library/models/space/lander.glb +0 -0
- package/library/models/space/landing-pad.glb +0 -0
- package/library/models/space/rocks.glb +0 -0
- package/library/models/space/solar-panel.glb +0 -0
- package/library/models/space/space-truck.glb +0 -0
- package/library/models/space/wind-turbine.glb +0 -0
- package/library/models/vehicles/car.glb +0 -0
- package/library/models/vehicles/hatchback.glb +0 -0
- package/library/models/vehicles/motorcycle.glb +0 -0
- package/library/models/vehicles/police-car.glb +0 -0
- package/library/models/vehicles/taxi.glb +0 -0
- package/library/models/vehicles/truck.glb +0 -0
- package/library/sources.json +2856 -0
- package/library/textures/brick-color.jpg +0 -0
- package/library/textures/brick-normal.jpg +0 -0
- package/library/textures/brick-roughness.jpg +0 -0
- package/library/textures/concrete-color.jpg +0 -0
- package/library/textures/concrete-normal.jpg +0 -0
- package/library/textures/concrete-roughness.jpg +0 -0
- package/library/textures/fabric-color.jpg +0 -0
- package/library/textures/fabric-normal.jpg +0 -0
- package/library/textures/fabric-roughness.jpg +0 -0
- package/library/textures/grass-ground-color.jpg +0 -0
- package/library/textures/grass-ground-normal.jpg +0 -0
- package/library/textures/grass-ground-roughness.jpg +0 -0
- package/library/textures/rusty-metal-color.jpg +0 -0
- package/library/textures/rusty-metal-normal.jpg +0 -0
- package/library/textures/rusty-metal-roughness.jpg +0 -0
- package/library/textures/wood-planks-color.jpg +0 -0
- package/library/textures/wood-planks-normal.jpg +0 -0
- package/library/textures/wood-planks-roughness.jpg +0 -0
- package/package.json +67 -4
- package/plugin/.claude-plugin/plugin.json +19 -0
- package/plugin/skills/agent3d-assets/SKILL.md +140 -0
- package/plugin/skills/agent3d-assets/references/sources.md +33 -0
- package/plugin/skills/agent3d-create/SKILL.md +141 -0
- package/plugin/skills/agent3d-create/references/art-direction.md +144 -0
- package/plugin/skills/agent3d-create/references/recipes.md +1357 -0
- package/plugin/skills/agent3d-edit/SKILL.md +121 -0
- package/plugin/skills/agent3d-edit/references/patch-ops.md +278 -0
- package/plugin/skills/agent3d-game/SKILL.md +111 -0
- package/plugin/skills/agent3d-game/references/game-patterns.md +262 -0
- package/plugin/skills/agent3d-game/references/script-api.md +211 -0
- package/plugin/skills/agent3d-publish/SKILL.md +161 -0
- package/plugin/skills/agent3d-publish/references/integrations.md +221 -0
- package/templates/banner-aurora-night/README.md +15 -0
- package/templates/banner-aurora-night/agent3d.json +8 -0
- package/templates/banner-aurora-night/preview.png +0 -0
- package/templates/banner-aurora-night/scene.json +327 -0
- package/templates/banner-aurora-night/template.json +24 -0
- package/templates/banner-data-bars/README.md +15 -0
- package/templates/banner-data-bars/agent3d.json +8 -0
- package/templates/banner-data-bars/preview.png +0 -0
- package/templates/banner-data-bars/scene.json +222 -0
- package/templates/banner-data-bars/template.json +25 -0
- package/templates/banner-floating-shapes/README.md +15 -0
- package/templates/banner-floating-shapes/agent3d.json +8 -0
- package/templates/banner-floating-shapes/preview.png +0 -0
- package/templates/banner-floating-shapes/scene.json +703 -0
- package/templates/banner-floating-shapes/template.json +24 -0
- package/templates/banner-gradient-blob/README.md +16 -0
- package/templates/banner-gradient-blob/agent3d.json +8 -0
- package/templates/banner-gradient-blob/preview.png +0 -0
- package/templates/banner-gradient-blob/scene.json +330 -0
- package/templates/banner-gradient-blob/template.json +21 -0
- package/templates/banner-liquid-chrome/README.md +16 -0
- package/templates/banner-liquid-chrome/agent3d.json +8 -0
- package/templates/banner-liquid-chrome/preview.png +0 -0
- package/templates/banner-liquid-chrome/scene.json +290 -0
- package/templates/banner-liquid-chrome/template.json +24 -0
- package/templates/banner-logo-extrude/README.md +24 -0
- package/templates/banner-logo-extrude/agent3d.json +8 -0
- package/templates/banner-logo-extrude/assets/logo.svg +6 -0
- package/templates/banner-logo-extrude/assets/manifest.json +13 -0
- package/templates/banner-logo-extrude/preview.png +0 -0
- package/templates/banner-logo-extrude/scene.json +332 -0
- package/templates/banner-logo-extrude/template.json +22 -0
- package/templates/banner-neon-title/README.md +18 -0
- package/templates/banner-neon-title/agent3d.json +8 -0
- package/templates/banner-neon-title/preview.png +0 -0
- package/templates/banner-neon-title/scene.json +494 -0
- package/templates/banner-neon-title/template.json +25 -0
- package/templates/banner-wave-grid/README.md +18 -0
- package/templates/banner-wave-grid/agent3d.json +8 -0
- package/templates/banner-wave-grid/preview.png +0 -0
- package/templates/banner-wave-grid/scene.json +217 -0
- package/templates/banner-wave-grid/template.json +23 -0
- package/templates/card-hover-3d/README.md +16 -0
- package/templates/card-hover-3d/agent3d.json +8 -0
- package/templates/card-hover-3d/preview.png +0 -0
- package/templates/card-hover-3d/scene.json +359 -0
- package/templates/card-hover-3d/template.json +21 -0
- package/templates/card-product-tilt/README.md +14 -0
- package/templates/card-product-tilt/agent3d.json +8 -0
- package/templates/card-product-tilt/preview.png +0 -0
- package/templates/card-product-tilt/scene.json +296 -0
- package/templates/card-product-tilt/template.json +23 -0
- package/templates/character-mascot-hero/README.md +19 -0
- package/templates/character-mascot-hero/agent3d.json +8 -0
- package/templates/character-mascot-hero/preview.png +0 -0
- package/templates/character-mascot-hero/scene.json +512 -0
- package/templates/character-mascot-hero/template.json +8 -0
- package/templates/character-showcase/README.md +27 -0
- package/templates/character-showcase/agent3d.json +8 -0
- package/templates/character-showcase/preview.png +0 -0
- package/templates/character-showcase/scene.json +440 -0
- package/templates/character-showcase/template.json +24 -0
- package/templates/diorama-city/README.md +21 -0
- package/templates/diorama-city/agent3d.json +8 -0
- package/templates/diorama-city/preview.png +0 -0
- package/templates/diorama-city/scene.json +432 -0
- package/templates/diorama-city/template.json +21 -0
- package/templates/game-basket/README.md +25 -0
- package/templates/game-basket/agent3d.json +8 -0
- package/templates/game-basket/preview.png +0 -0
- package/templates/game-basket/scene.json +640 -0
- package/templates/game-basket/scripts/basket.js +176 -0
- package/templates/game-basket/template.json +8 -0
- package/templates/game-coin-collector/README.md +28 -0
- package/templates/game-coin-collector/agent3d.json +8 -0
- package/templates/game-coin-collector/preview.png +0 -0
- package/templates/game-coin-collector/scene.json +900 -0
- package/templates/game-coin-collector/scripts/collector.js +210 -0
- package/templates/game-coin-collector/template.json +19 -0
- package/templates/game-maze/README.md +24 -0
- package/templates/game-maze/agent3d.json +8 -0
- package/templates/game-maze/preview.png +0 -0
- package/templates/game-maze/scene.json +315 -0
- package/templates/game-maze/scripts/maze.js +168 -0
- package/templates/game-maze/template.json +18 -0
- package/templates/game-physics-playground/README.md +30 -0
- package/templates/game-physics-playground/agent3d.json +8 -0
- package/templates/game-physics-playground/preview.png +0 -0
- package/templates/game-physics-playground/scene.json +1712 -0
- package/templates/game-physics-playground/scripts/playground.js +151 -0
- package/templates/game-physics-playground/template.json +19 -0
- package/templates/game-platformer/README.md +26 -0
- package/templates/game-platformer/agent3d.json +8 -0
- package/templates/game-platformer/preview.png +0 -0
- package/templates/game-platformer/scene.json +1063 -0
- package/templates/game-platformer/scripts/platformer.js +222 -0
- package/templates/game-platformer/template.json +8 -0
- package/templates/game-runner/README.md +30 -0
- package/templates/game-runner/agent3d.json +8 -0
- package/templates/game-runner/preview.png +0 -0
- package/templates/game-runner/scene.json +1317 -0
- package/templates/game-runner/scripts/runner.js +263 -0
- package/templates/game-runner/template.json +18 -0
- package/templates/game-tap-targets/README.md +21 -0
- package/templates/game-tap-targets/agent3d.json +8 -0
- package/templates/game-tap-targets/preview.png +0 -0
- package/templates/game-tap-targets/scene.json +924 -0
- package/templates/game-tap-targets/scripts/targets.js +159 -0
- package/templates/game-tap-targets/template.json +19 -0
- package/templates/hero-floating-island/README.md +18 -0
- package/templates/hero-floating-island/agent3d.json +8 -0
- package/templates/hero-floating-island/preview.png +0 -0
- package/templates/hero-floating-island/scene.json +658 -0
- package/templates/hero-floating-island/template.json +8 -0
- package/templates/hero-perfume-luxury/README.md +18 -0
- package/templates/hero-perfume-luxury/agent3d.json +8 -0
- package/templates/hero-perfume-luxury/preview.png +0 -0
- package/templates/hero-perfume-luxury/scene.json +529 -0
- package/templates/hero-perfume-luxury/template.json +27 -0
- package/templates/hero-product-turntable/README.md +16 -0
- package/templates/hero-product-turntable/agent3d.json +8 -0
- package/templates/hero-product-turntable/preview.png +0 -0
- package/templates/hero-product-turntable/scene.json +225 -0
- package/templates/hero-product-turntable/template.json +21 -0
- package/templates/hero-saas-globe/README.md +16 -0
- package/templates/hero-saas-globe/agent3d.json +8 -0
- package/templates/hero-saas-globe/preview.png +0 -0
- package/templates/hero-saas-globe/scene.json +318 -0
- package/templates/hero-saas-globe/template.json +24 -0
- package/templates/hero-scroll-story/README.md +26 -0
- package/templates/hero-scroll-story/agent3d.json +8 -0
- package/templates/hero-scroll-story/preview.png +0 -0
- package/templates/hero-scroll-story/scene.json +642 -0
- package/templates/hero-scroll-story/template.json +22 -0
- package/templates/hero-sneaker-showcase/README.md +19 -0
- package/templates/hero-sneaker-showcase/agent3d.json +8 -0
- package/templates/hero-sneaker-showcase/preview.png +0 -0
- package/templates/hero-sneaker-showcase/scene.json +523 -0
- package/templates/hero-sneaker-showcase/template.json +23 -0
- package/templates/hero-space-planet/README.md +17 -0
- package/templates/hero-space-planet/agent3d.json +8 -0
- package/templates/hero-space-planet/preview.png +0 -0
- package/templates/hero-space-planet/scene.json +330 -0
- package/templates/hero-space-planet/template.json +21 -0
- package/templates/landscape-island/README.md +21 -0
- package/templates/landscape-island/agent3d.json +8 -0
- package/templates/landscape-island/preview.png +0 -0
- package/templates/landscape-island/scene.json +716 -0
- package/templates/landscape-island/template.json +24 -0
- package/templates/landscape-night-galaxy/README.md +25 -0
- package/templates/landscape-night-galaxy/agent3d.json +8 -0
- package/templates/landscape-night-galaxy/preview.png +0 -0
- package/templates/landscape-night-galaxy/scene.json +403 -0
- package/templates/landscape-night-galaxy/template.json +8 -0
- package/templates/landscape-valley-sunset/README.md +20 -0
- package/templates/landscape-valley-sunset/agent3d.json +8 -0
- package/templates/landscape-valley-sunset/preview.png +0 -0
- package/templates/landscape-valley-sunset/scene.json +265 -0
- package/templates/landscape-valley-sunset/template.json +22 -0
- package/templates/scene-cozy-room/README.md +21 -0
- package/templates/scene-cozy-room/agent3d.json +8 -0
- package/templates/scene-cozy-room/preview.png +0 -0
- package/templates/scene-cozy-room/scene.json +728 -0
- package/templates/scene-cozy-room/template.json +8 -0
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import { createRequire as __a3dRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __a3dPath } from "node:url";
|
|
3
|
+
import { dirname as __a3dDirname } from "node:path";
|
|
4
|
+
__a3dRequire(import.meta.url);
|
|
5
|
+
const __filename = __a3dPath(import.meta.url);
|
|
6
|
+
__a3dDirname(__filename);
|
|
7
|
+
import { S as CATALOG, b as isLibraryRef, f as DEFAULT_ASPECT, m as MATERIAL_TEXTURE_SLOTS, x as libraryId, y as findLibraryAsset } from "../agent3d.mjs";
|
|
8
|
+
import { o as walkObjects } from "./tree-BrNYGui2.mjs";
|
|
9
|
+
import { r as modelFileBounds, t as glbJson } from "./gltf-f_f0-OiV.mjs";
|
|
10
|
+
// src/ops/refs.ts
|
|
11
|
+
function visitAssetRefs(scene, visit) {
|
|
12
|
+
const env = scene.environment;
|
|
13
|
+
if (env) {
|
|
14
|
+
const bg = env.background;
|
|
15
|
+
if (bg && typeof bg === "object" && typeof bg.hdri === "string") {
|
|
16
|
+
const r = visit(bg.hdri, "environment.background.hdri", "hdri");
|
|
17
|
+
if (typeof r === "string") bg.hdri = r;
|
|
18
|
+
}
|
|
19
|
+
const lighting = env.lighting;
|
|
20
|
+
if (lighting && typeof lighting === "object" && typeof lighting.hdri === "string") {
|
|
21
|
+
const r = visit(lighting.hdri, "environment.lighting.hdri", "hdri");
|
|
22
|
+
if (typeof r === "string") lighting.hdri = r;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const material = (m, at) => {
|
|
26
|
+
if (!m || typeof m !== "object") return;
|
|
27
|
+
const mat = m;
|
|
28
|
+
for (const k of MATERIAL_TEXTURE_SLOTS) if (typeof mat[k] === "string") {
|
|
29
|
+
const r = visit(mat[k], `${at}.${k}`, "texture");
|
|
30
|
+
if (typeof r === "string") mat[k] = r;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
walkObjects(scene.objects, (o) => {
|
|
34
|
+
const at = `objects#${o.id}`;
|
|
35
|
+
if (o.kind === "model" && typeof o.src === "string") {
|
|
36
|
+
const r = visit(o.src, `${at}.src`, "model");
|
|
37
|
+
if (typeof r === "string") o.src = r;
|
|
38
|
+
}
|
|
39
|
+
if (o.kind === "svg" && typeof o.src === "string" && !o.src.trim().startsWith("<")) {
|
|
40
|
+
const r = visit(o.src, `${at}.src`, "svg");
|
|
41
|
+
if (typeof r === "string") o.src = r;
|
|
42
|
+
}
|
|
43
|
+
if (o.kind === "text") {
|
|
44
|
+
const font = typeof o.font === "string" && o.font ? o.font : "sans-bold";
|
|
45
|
+
const r = visit(font.includes("/") || font.includes(":") ? font : `library:fonts/${font}.typeface.json`, `${at}.font`, "font");
|
|
46
|
+
if (typeof r === "string") o.font = r;
|
|
47
|
+
}
|
|
48
|
+
if ("material" in o) material(o.material, `${at}.material`);
|
|
49
|
+
});
|
|
50
|
+
const audio = scene.audio;
|
|
51
|
+
if (audio?.sounds) {
|
|
52
|
+
for (const [name, s] of Object.entries(audio.sounds)) if (s && typeof s === "object" && "src" in s && typeof s.src === "string") {
|
|
53
|
+
const r = visit(s.src, `audio.sounds.${name}.src`, "audio");
|
|
54
|
+
if (typeof r === "string") s.src = r;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (audio?.music && typeof audio.music.src === "string") {
|
|
58
|
+
const r = visit(audio.music.src, "audio.music.src", "audio");
|
|
59
|
+
if (typeof r === "string") audio.music.src = r;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function collectAssetRefs(scene) {
|
|
63
|
+
const refs = [];
|
|
64
|
+
visitAssetRefs(scene, (path, at, kind) => void refs.push({
|
|
65
|
+
path,
|
|
66
|
+
at,
|
|
67
|
+
kind
|
|
68
|
+
}));
|
|
69
|
+
return refs;
|
|
70
|
+
}
|
|
71
|
+
function kindFromPath(path) {
|
|
72
|
+
const ext = path.toLowerCase().split("?")[0].split(".").pop() ?? "";
|
|
73
|
+
if ([
|
|
74
|
+
"glb",
|
|
75
|
+
"gltf",
|
|
76
|
+
"bin"
|
|
77
|
+
].includes(ext)) return "model";
|
|
78
|
+
if (["hdr", "exr"].includes(ext)) return "hdri";
|
|
79
|
+
if ([
|
|
80
|
+
"png",
|
|
81
|
+
"jpg",
|
|
82
|
+
"jpeg",
|
|
83
|
+
"webp",
|
|
84
|
+
"ktx2",
|
|
85
|
+
"avif"
|
|
86
|
+
].includes(ext)) return "texture";
|
|
87
|
+
if ([
|
|
88
|
+
"mp3",
|
|
89
|
+
"ogg",
|
|
90
|
+
"wav",
|
|
91
|
+
"m4a",
|
|
92
|
+
"aac",
|
|
93
|
+
"opus"
|
|
94
|
+
].includes(ext)) return "audio";
|
|
95
|
+
if ([
|
|
96
|
+
"ttf",
|
|
97
|
+
"otf",
|
|
98
|
+
"woff",
|
|
99
|
+
"woff2",
|
|
100
|
+
"typeface"
|
|
101
|
+
].includes(ext) || path.endsWith(".typeface.json")) return "font";
|
|
102
|
+
if (ext === "svg") return "svg";
|
|
103
|
+
return "other";
|
|
104
|
+
}
|
|
105
|
+
function mimeFromPath(path) {
|
|
106
|
+
return {
|
|
107
|
+
glb: "model/gltf-binary",
|
|
108
|
+
gltf: "model/gltf+json",
|
|
109
|
+
bin: "application/octet-stream",
|
|
110
|
+
png: "image/png",
|
|
111
|
+
jpg: "image/jpeg",
|
|
112
|
+
jpeg: "image/jpeg",
|
|
113
|
+
webp: "image/webp",
|
|
114
|
+
avif: "image/avif",
|
|
115
|
+
ktx2: "image/ktx2",
|
|
116
|
+
svg: "image/svg+xml",
|
|
117
|
+
hdr: "image/vnd.radiance",
|
|
118
|
+
exr: "image/x-exr",
|
|
119
|
+
mp3: "audio/mpeg",
|
|
120
|
+
ogg: "audio/ogg",
|
|
121
|
+
wav: "audio/wav",
|
|
122
|
+
m4a: "audio/mp4",
|
|
123
|
+
aac: "audio/aac",
|
|
124
|
+
opus: "audio/opus",
|
|
125
|
+
js: "text/javascript",
|
|
126
|
+
mjs: "text/javascript",
|
|
127
|
+
json: "application/json",
|
|
128
|
+
ttf: "font/ttf",
|
|
129
|
+
otf: "font/otf",
|
|
130
|
+
woff: "font/woff",
|
|
131
|
+
woff2: "font/woff2"
|
|
132
|
+
}[path.toLowerCase().split("?")[0].split(".").pop() ?? ""] ?? "application/octet-stream";
|
|
133
|
+
}
|
|
134
|
+
function gltfDependencies(gltfPath, gltfText) {
|
|
135
|
+
let json;
|
|
136
|
+
try {
|
|
137
|
+
json = JSON.parse(gltfText);
|
|
138
|
+
} catch {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
const dir = gltfPath.includes("/") ? gltfPath.slice(0, gltfPath.lastIndexOf("/") + 1) : "";
|
|
142
|
+
const out = [];
|
|
143
|
+
for (const item of [...json.buffers ?? [], ...json.images ?? []]) {
|
|
144
|
+
const uri = item?.uri;
|
|
145
|
+
if (typeof uri !== "string" || uri.startsWith("data:") || /^[a-z]+:/i.test(uri)) continue;
|
|
146
|
+
out.push(joinPath(dir, decodeURIComponent(uri)));
|
|
147
|
+
}
|
|
148
|
+
return [...new Set(out)];
|
|
149
|
+
}
|
|
150
|
+
function joinPath(dir, rel) {
|
|
151
|
+
const parts = `${dir}${rel}`.split("/");
|
|
152
|
+
const out = [];
|
|
153
|
+
for (const p of parts) {
|
|
154
|
+
if (p === "" || p === ".") continue;
|
|
155
|
+
if (p === "..") out.pop();
|
|
156
|
+
else out.push(p);
|
|
157
|
+
}
|
|
158
|
+
return out.join("/");
|
|
159
|
+
}
|
|
160
|
+
// src/ops/optimizeSizing.ts
|
|
161
|
+
var TEXTURE_TIERS = [
|
|
162
|
+
256,
|
|
163
|
+
512,
|
|
164
|
+
1024,
|
|
165
|
+
2048
|
|
166
|
+
];
|
|
167
|
+
var BACKGROUND_TIERS = [
|
|
168
|
+
512,
|
|
169
|
+
1024,
|
|
170
|
+
2048,
|
|
171
|
+
4096
|
|
172
|
+
];
|
|
173
|
+
var FALLBACK_MAX_SIZE = 1024;
|
|
174
|
+
var REF_CSS_WIDTH = {
|
|
175
|
+
banner: 1440,
|
|
176
|
+
hero: 1440,
|
|
177
|
+
fullscreen: 1920,
|
|
178
|
+
inline: 800,
|
|
179
|
+
card: 400,
|
|
180
|
+
square: 600,
|
|
181
|
+
game: 1280
|
|
182
|
+
};
|
|
183
|
+
var MIN_COLOR_TIER = {
|
|
184
|
+
banner: 256,
|
|
185
|
+
hero: 512,
|
|
186
|
+
fullscreen: 512,
|
|
187
|
+
inline: 256,
|
|
188
|
+
card: 256,
|
|
189
|
+
square: 256,
|
|
190
|
+
game: 256
|
|
191
|
+
};
|
|
192
|
+
var MAX_TIER = {
|
|
193
|
+
banner: 2048,
|
|
194
|
+
hero: 2048,
|
|
195
|
+
fullscreen: 2048,
|
|
196
|
+
inline: 2048,
|
|
197
|
+
card: 1024,
|
|
198
|
+
square: 2048,
|
|
199
|
+
game: 1024
|
|
200
|
+
};
|
|
201
|
+
var ROLE_FACTOR = {
|
|
202
|
+
color: 1,
|
|
203
|
+
normal: .75,
|
|
204
|
+
data: .5,
|
|
205
|
+
background: 1,
|
|
206
|
+
lighting: 1
|
|
207
|
+
};
|
|
208
|
+
var MODEL_ATLAS_FACTOR = 1.5;
|
|
209
|
+
var MARGIN = 1.15;
|
|
210
|
+
function sceneViewport(scene) {
|
|
211
|
+
const kind = scene.target?.kind && scene.target.kind in REF_CSS_WIDTH ? scene.target.kind : "hero";
|
|
212
|
+
const dpr = Math.min(2, Math.max(1, Number(scene.target?.maxDpr) || 2));
|
|
213
|
+
const [aw, ah] = String(scene.target?.aspect ?? DEFAULT_ASPECT[kind]).split(":").map(Number);
|
|
214
|
+
const aspect = aw > 0 && ah > 0 ? aw / ah : 16 / 9;
|
|
215
|
+
const cssW = REF_CSS_WIDTH[kind];
|
|
216
|
+
let cssH = cssW / aspect;
|
|
217
|
+
const h = /^(\d+(?:\.\d+)?)(px|vh|svh|dvh|lvh)$/.exec(String(scene.target?.height ?? "").trim());
|
|
218
|
+
if (h) cssH = h[2] === "px" ? Number(h[1]) : 900 * Number(h[1]) / 100;
|
|
219
|
+
return {
|
|
220
|
+
width: Math.round(cssW * dpr),
|
|
221
|
+
height: Math.round(cssH * dpr),
|
|
222
|
+
dpr,
|
|
223
|
+
kind
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function pickTier(pixels, tiers, min, max) {
|
|
227
|
+
const need = pixels / 1.12;
|
|
228
|
+
const t = tiers.find((x) => x >= need) ?? tiers[tiers.length - 1];
|
|
229
|
+
return Math.max(min, Math.min(max, t));
|
|
230
|
+
}
|
|
231
|
+
var v3 = (v, d) => Array.isArray(v) && v.length === 3 && v.every((x) => typeof x === "number") ? v : [
|
|
232
|
+
d,
|
|
233
|
+
d,
|
|
234
|
+
d
|
|
235
|
+
];
|
|
236
|
+
var scaleOf = (s) => typeof s === "number" ? Math.abs(s) : Array.isArray(s) ? Math.max(...s.map((x) => Math.abs(Number(x) || 0))) || 1 : 1;
|
|
237
|
+
var dist = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
|
|
238
|
+
var GEOMETRY_DEFAULTS = new Map(CATALOG.geometries.map((g) => [g.id, Object.fromEntries(g.params.map((p) => [p.name, p.default]))]));
|
|
239
|
+
function geometrySize(geometry) {
|
|
240
|
+
if (!geometry) return 1;
|
|
241
|
+
const p = {
|
|
242
|
+
...GEOMETRY_DEFAULTS.get(String(geometry.type)) ?? {},
|
|
243
|
+
...geometry
|
|
244
|
+
};
|
|
245
|
+
const n = (k) => typeof p[k] === "number" ? p[k] : 0;
|
|
246
|
+
const s = Math.max(n("width"), n("height"), n("depth"), n("length") + 2 * n("radius"), 2 * n("radius") + 2 * n("tube"), 2 * n("outerRadius"), 2 * n("radiusTop"), 2 * n("radiusBottom"), n("size"));
|
|
247
|
+
return s > 0 ? s : 1;
|
|
248
|
+
}
|
|
249
|
+
function placeObjects(scene) {
|
|
250
|
+
const out = [];
|
|
251
|
+
const visit = (objects, origin, parentScale) => {
|
|
252
|
+
for (const o of objects ?? []) {
|
|
253
|
+
if (!o || typeof o !== "object") continue;
|
|
254
|
+
const p = v3(o.position, 0);
|
|
255
|
+
const world = [
|
|
256
|
+
origin[0] + p[0] * parentScale,
|
|
257
|
+
origin[1] + p[1] * parentScale,
|
|
258
|
+
origin[2] + p[2] * parentScale
|
|
259
|
+
];
|
|
260
|
+
const scale = parentScale * scaleOf(o.scale);
|
|
261
|
+
out.push({
|
|
262
|
+
object: o,
|
|
263
|
+
world,
|
|
264
|
+
scale
|
|
265
|
+
});
|
|
266
|
+
visit(o.children, world, scale);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
visit(scene.objects, [
|
|
270
|
+
0,
|
|
271
|
+
0,
|
|
272
|
+
0
|
|
273
|
+
], 1);
|
|
274
|
+
return out;
|
|
275
|
+
}
|
|
276
|
+
function trackValues(scene, target) {
|
|
277
|
+
return (scene.timeline?.tracks ?? []).filter((t) => t?.target === target).flatMap((t) => (t.keys ?? []).map((k) => k?.[1]));
|
|
278
|
+
}
|
|
279
|
+
function cameraPositions(scene) {
|
|
280
|
+
const cam = scene.camera;
|
|
281
|
+
const list = [v3(cam?.position, 5)];
|
|
282
|
+
for (const s of cam?.scrollPath ?? []) if (Array.isArray(s?.position)) list.push(v3(s.position, 5));
|
|
283
|
+
for (const v of trackValues(scene, "camera.position")) if (Array.isArray(v) && v.length === 3) list.push(v);
|
|
284
|
+
return list;
|
|
285
|
+
}
|
|
286
|
+
function closestDistance(scene, point, objectId, radius) {
|
|
287
|
+
const cam = scene.camera;
|
|
288
|
+
let d = Math.min(...cameraPositions(scene).map((c) => dist(c, point)));
|
|
289
|
+
let note;
|
|
290
|
+
if (cam?.controls === "follow" && cam.follow) {
|
|
291
|
+
const off = v3(cam.follow.offset, 0);
|
|
292
|
+
const f = Math.hypot(...off) || d;
|
|
293
|
+
if (cam.follow.target === objectId) d = f;
|
|
294
|
+
else d = Math.min(d, f);
|
|
295
|
+
note = "follow camera";
|
|
296
|
+
}
|
|
297
|
+
if (cam?.controls === "orbit" && cam.orbitZoom !== false) {
|
|
298
|
+
const min = Number(cam.orbitLimits?.minDistance);
|
|
299
|
+
const zoomed = Number.isFinite(min) && min > 0 ? min : d * .6;
|
|
300
|
+
if (zoomed < d) {
|
|
301
|
+
d = zoomed;
|
|
302
|
+
note = "orbit zoom";
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (cam?.controls === "parallax") d *= .9;
|
|
306
|
+
return {
|
|
307
|
+
d: Math.max(d - radius * .5, radius * .35, Number(cam?.near) || .1),
|
|
308
|
+
note
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function projectedPixels(scene, vp, size, d) {
|
|
312
|
+
const cam = scene.camera;
|
|
313
|
+
if (cam?.type === "orthographic") {
|
|
314
|
+
const visible = Number(cam.zoom) > 0 ? Number(cam.zoom) : 10;
|
|
315
|
+
return size * vp.height / visible;
|
|
316
|
+
}
|
|
317
|
+
const fovs = [Number(cam?.fov) || 45, ...trackValues(scene, "camera.fov").map(Number).filter((x) => x > 0)];
|
|
318
|
+
const fov = Math.min(...fovs);
|
|
319
|
+
const visible = 2 * d * Math.tan(fov * Math.PI / 180 / 2);
|
|
320
|
+
return size * vp.height / Math.max(visible, .001);
|
|
321
|
+
}
|
|
322
|
+
async function objectSize(fs, o, ctx) {
|
|
323
|
+
switch (o.kind) {
|
|
324
|
+
case "mesh": return geometrySize(o.geometry);
|
|
325
|
+
case "text": return Math.max(1, (Number(o.size) || 1) * Math.max(1, String(o.text ?? "").split("\n").reduce((m, l) => Math.max(m, l.length), 0)) * .65);
|
|
326
|
+
case "model":
|
|
327
|
+
if (typeof o.fit === "number" && o.fit > 0) return o.fit;
|
|
328
|
+
if (isLibraryRef(o.src)) {
|
|
329
|
+
const s = findLibraryAsset(ctx.library, libraryId(o.src))?.size;
|
|
330
|
+
if (s) return Math.max(...s);
|
|
331
|
+
} else {
|
|
332
|
+
const b = await modelFileBounds(fs, String(o.src ?? "")).catch(() => null);
|
|
333
|
+
if (b) return Math.max(...b.size);
|
|
334
|
+
}
|
|
335
|
+
return 1;
|
|
336
|
+
default: return 1;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function decide(cur, use, tiers, min, max) {
|
|
340
|
+
const tier = pickTier(use.pixels, tiers, min, max);
|
|
341
|
+
if (!cur) return {
|
|
342
|
+
maxSize: tier,
|
|
343
|
+
reason: `${use.why} → ${tier} px`,
|
|
344
|
+
uses: [use]
|
|
345
|
+
};
|
|
346
|
+
const uses = [...cur.uses, use];
|
|
347
|
+
const head = tier > cur.maxSize ? `${use.why} → ${tier} px` : cur.reason.replace(/ \(largest of \d+ uses\)$/, "");
|
|
348
|
+
return {
|
|
349
|
+
maxSize: Math.max(tier, cur.maxSize),
|
|
350
|
+
reason: `${head} (largest of ${uses.length} uses)`,
|
|
351
|
+
uses
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function addUse(map, path, use, tiers, min, max) {
|
|
355
|
+
map.set(path, decide(map.get(path), use, tiers, min, max));
|
|
356
|
+
}
|
|
357
|
+
var round = (n) => Math.round(n);
|
|
358
|
+
async function planTextureSizes(fs, scene, ctx = {}) {
|
|
359
|
+
const vp = sceneViewport(scene);
|
|
360
|
+
const files = /* @__PURE__ */ new Map();
|
|
361
|
+
const modelRoles = /* @__PURE__ */ new Map();
|
|
362
|
+
const max = MAX_TIER[vp.kind];
|
|
363
|
+
const where = `${vp.kind} ${vp.width}x${vp.height}`;
|
|
364
|
+
for (const { object: o, world, scale } of placeObjects(scene)) {
|
|
365
|
+
const base = await objectSize(fs, o, ctx) * scale;
|
|
366
|
+
const scaleKeys = trackValues(scene, `${o.id}.scale`).map(scaleOf);
|
|
367
|
+
const grown = base * Math.max(1, ...scaleKeys);
|
|
368
|
+
const points = [world, ...trackValues(scene, `${o.id}.position`).filter((v) => Array.isArray(v) && v.length === 3).map((v) => v)];
|
|
369
|
+
let best = { d: Infinity };
|
|
370
|
+
for (const p of points) {
|
|
371
|
+
const c = closestDistance(scene, p, o.id, grown);
|
|
372
|
+
if (c.d < best.d) best = c;
|
|
373
|
+
}
|
|
374
|
+
const projected = Math.min(projectedPixels(scene, vp, grown, best.d), Math.max(vp.width, vp.height) * 1.5);
|
|
375
|
+
const dist = `${grown.toFixed(2)} u at ${best.d.toFixed(1)} u${best.note ? ` (${best.note})` : ""}`;
|
|
376
|
+
if (o.kind === "model" && typeof o.src === "string" && (ctx.includeLibrary || !isLibraryRef(o.src)) && /\.glb$/i.test(o.src)) {
|
|
377
|
+
const roles = modelRoles.get(o.src) ?? {};
|
|
378
|
+
for (const role of [
|
|
379
|
+
"color",
|
|
380
|
+
"normal",
|
|
381
|
+
"data"
|
|
382
|
+
]) {
|
|
383
|
+
const pixels = projected * MODEL_ATLAS_FACTOR * ROLE_FACTOR[role] * MARGIN;
|
|
384
|
+
const use = {
|
|
385
|
+
at: `objects#${o.id}.src`,
|
|
386
|
+
role,
|
|
387
|
+
pixels: round(pixels),
|
|
388
|
+
why: `${role} atlas of model "${o.id}", ${dist} ≈ ${round(projected)} px on a ${where} canvas`
|
|
389
|
+
};
|
|
390
|
+
roles[role] = decide(roles[role], use, TEXTURE_TIERS, role === "color" ? MIN_COLOR_TIER[vp.kind] : 256, max);
|
|
391
|
+
}
|
|
392
|
+
modelRoles.set(o.src, roles);
|
|
393
|
+
addUse(files, o.src, {
|
|
394
|
+
at: `objects#${o.id}.src`,
|
|
395
|
+
role: "color",
|
|
396
|
+
pixels: round(projected * MODEL_ATLAS_FACTOR * MARGIN),
|
|
397
|
+
why: `model "${o.id}", ${dist} ≈ ${round(projected)} px on a ${where} canvas`
|
|
398
|
+
}, TEXTURE_TIERS, MIN_COLOR_TIER[vp.kind], max);
|
|
399
|
+
}
|
|
400
|
+
const mat = o.material;
|
|
401
|
+
if (mat && typeof mat === "object") {
|
|
402
|
+
const rep = Array.isArray(mat.repeat) ? Math.max(1, ...mat.repeat.map((x) => Math.abs(Number(x) || 1))) : 1;
|
|
403
|
+
for (const [k, role] of [
|
|
404
|
+
["map", "color"],
|
|
405
|
+
["normalMap", "normal"],
|
|
406
|
+
["roughnessMap", "data"]
|
|
407
|
+
]) {
|
|
408
|
+
const path = mat[k];
|
|
409
|
+
if (typeof path !== "string" || isLibraryRef(path) && !ctx.includeLibrary) continue;
|
|
410
|
+
const pixels = projected / rep * ROLE_FACTOR[role] * MARGIN;
|
|
411
|
+
addUse(files, path, {
|
|
412
|
+
at: `objects#${o.id}.material.${k}`,
|
|
413
|
+
role,
|
|
414
|
+
pixels: round(pixels),
|
|
415
|
+
why: `${k} of "${o.id}", ${dist}${rep > 1 ? `, repeat ${rep}` : ""} ≈ ${round(projected / rep)} px per tile on a ${where} canvas`
|
|
416
|
+
}, TEXTURE_TIERS, role === "color" ? MIN_COLOR_TIER[vp.kind] : 256, max);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const env = scene.environment;
|
|
421
|
+
const bg = env?.background;
|
|
422
|
+
if (bg && typeof bg === "object" && typeof bg.hdri === "string" && (ctx.includeLibrary || !isLibraryRef(bg.hdri))) {
|
|
423
|
+
const fov = Number(scene.camera?.fov) || 45;
|
|
424
|
+
const hfov = 2 * Math.atan(Math.tan(fov * Math.PI / 180 / 2) * (vp.width / vp.height)) * 180 / Math.PI;
|
|
425
|
+
const blur = Math.max(0, Number(bg.blur) || 0);
|
|
426
|
+
const pixels = vp.width * 360 / Math.max(hfov, 10) / (1 + blur * 8);
|
|
427
|
+
addUse(files, bg.hdri, {
|
|
428
|
+
at: "environment.background.hdri",
|
|
429
|
+
role: "background",
|
|
430
|
+
pixels: round(pixels),
|
|
431
|
+
why: `equirect background seen ${round(hfov)}° wide on a ${where} canvas${blur ? `, blur ${blur}` : ""} needs ≈ ${round(pixels)} px`
|
|
432
|
+
}, BACKGROUND_TIERS, 1024, 4096);
|
|
433
|
+
}
|
|
434
|
+
const lighting = env?.lighting;
|
|
435
|
+
if (lighting && typeof lighting === "object" && typeof lighting.hdri === "string" && (ctx.includeLibrary || !isLibraryRef(lighting.hdri))) addUse(files, lighting.hdri, {
|
|
436
|
+
at: "environment.lighting.hdri",
|
|
437
|
+
role: "lighting",
|
|
438
|
+
pixels: 1024,
|
|
439
|
+
why: "image-based lighting only (prefiltered to a 256 px cube map)"
|
|
440
|
+
}, BACKGROUND_TIERS, 1024, 1024);
|
|
441
|
+
return {
|
|
442
|
+
viewport: vp,
|
|
443
|
+
files,
|
|
444
|
+
modelRoles
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function imageHeader(bytes) {
|
|
448
|
+
const b = bytes;
|
|
449
|
+
const dv = new DataView(b.buffer, b.byteOffset, b.byteLength);
|
|
450
|
+
if (b.byteLength > 24 && b[0] === 137 && b[1] === 80 && b[2] === 78 && b[3] === 71) {
|
|
451
|
+
const colorType = b[25];
|
|
452
|
+
return {
|
|
453
|
+
width: dv.getUint32(16),
|
|
454
|
+
height: dv.getUint32(20),
|
|
455
|
+
mimeType: "image/png",
|
|
456
|
+
alpha: colorType === 4 || colorType === 6 ? "maybe" : colorType === 3 ? "maybe" : false
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
if (b.byteLength > 4 && b[0] === 255 && b[1] === 216) {
|
|
460
|
+
let off = 2;
|
|
461
|
+
while (off + 9 < b.byteLength) {
|
|
462
|
+
if (b[off] !== 255) {
|
|
463
|
+
off++;
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
const marker = b[off + 1];
|
|
467
|
+
if (marker === 216 || marker === 1 || marker >= 208 && marker <= 215) {
|
|
468
|
+
off += 2;
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
const len = dv.getUint16(off + 2);
|
|
472
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) return {
|
|
473
|
+
height: dv.getUint16(off + 5),
|
|
474
|
+
width: dv.getUint16(off + 7),
|
|
475
|
+
mimeType: "image/jpeg",
|
|
476
|
+
alpha: false
|
|
477
|
+
};
|
|
478
|
+
off += 2 + len;
|
|
479
|
+
}
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
if (b.byteLength > 30 && String.fromCharCode(b[0], b[1], b[2], b[3]) === "RIFF" && String.fromCharCode(b[8], b[9], b[10], b[11]) === "WEBP") {
|
|
483
|
+
const chunk = String.fromCharCode(b[12], b[13], b[14], b[15]);
|
|
484
|
+
if (chunk === "VP8 ") return {
|
|
485
|
+
width: dv.getUint16(26, true) & 16383,
|
|
486
|
+
height: dv.getUint16(28, true) & 16383,
|
|
487
|
+
mimeType: "image/webp",
|
|
488
|
+
alpha: false
|
|
489
|
+
};
|
|
490
|
+
if (chunk === "VP8L") {
|
|
491
|
+
const v = dv.getUint32(21, true);
|
|
492
|
+
return {
|
|
493
|
+
width: (v & 16383) + 1,
|
|
494
|
+
height: (v >> 14 & 16383) + 1,
|
|
495
|
+
mimeType: "image/webp",
|
|
496
|
+
alpha: v >> 28 & 1 ? "maybe" : false
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
if (chunk === "VP8X") return {
|
|
500
|
+
width: 1 + (b[24] | b[25] << 8 | b[26] << 16),
|
|
501
|
+
height: 1 + (b[27] | b[28] << 8 | b[29] << 16),
|
|
502
|
+
mimeType: "image/webp",
|
|
503
|
+
alpha: b[20] & 16 ? "maybe" : false
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
return null;
|
|
507
|
+
}
|
|
508
|
+
var kb = (n) => Math.round(n / 102.4) / 10;
|
|
509
|
+
async function optimizeSuggestions(fs, scene, opts = {}) {
|
|
510
|
+
const out = {
|
|
511
|
+
models: [],
|
|
512
|
+
textures: []
|
|
513
|
+
};
|
|
514
|
+
const files = (await fs.list("assets/")).filter((f) => /\.(png|jpe?g|webp|glb)$/i.test(f));
|
|
515
|
+
if (!files.length) return out;
|
|
516
|
+
const sizing = await planTextureSizes(fs, scene, opts);
|
|
517
|
+
for (const path of files) {
|
|
518
|
+
const bytes = await fs.readBytes(path);
|
|
519
|
+
if (/\.glb$/i.test(path)) {
|
|
520
|
+
if (bytes.byteLength < 51200) continue;
|
|
521
|
+
const json = glbJson(bytes);
|
|
522
|
+
const used = json?.extensionsUsed ?? [];
|
|
523
|
+
if (json && json.meshes?.length && !used.includes("EXT_meshopt_compression") && !used.includes("KHR_draco_mesh_compression") && !(json.accessors ?? []).some((a) => a.sparse)) out.models.push({
|
|
524
|
+
path,
|
|
525
|
+
kb: kb(bytes.byteLength)
|
|
526
|
+
});
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
const h = imageHeader(bytes);
|
|
530
|
+
const d = sizing.files.get(path);
|
|
531
|
+
if (h && d && Math.max(h.width, h.height) >= d.maxSize * 2) out.textures.push({
|
|
532
|
+
path,
|
|
533
|
+
size: Math.max(h.width, h.height),
|
|
534
|
+
maxSize: d.maxSize,
|
|
535
|
+
kb: kb(bytes.byteLength)
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
return out;
|
|
539
|
+
}
|
|
540
|
+
export { collectAssetRefs as a, mimeFromPath as c, planTextureSizes as i, visitAssetRefs as l, imageHeader as n, gltfDependencies as o, optimizeSuggestions as r, kindFromPath as s, FALLBACK_MAX_SIZE as t };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { createRequire as __a3dRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __a3dPath } from "node:url";
|
|
3
|
+
import { dirname as __a3dDirname } from "node:path";
|
|
4
|
+
__a3dRequire(import.meta.url);
|
|
5
|
+
const __filename = __a3dPath(import.meta.url);
|
|
6
|
+
__a3dDirname(__filename);
|
|
7
|
+
import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
|
|
8
|
+
// package.json
|
|
9
|
+
var package_exports = /* @__PURE__ */ __exportAll({ default: () => package_default });
|
|
10
|
+
var name = "@fleox/agent3d";
|
|
11
|
+
var version = "0.2.0";
|
|
12
|
+
var package_default = {
|
|
13
|
+
name,
|
|
14
|
+
version,
|
|
15
|
+
type: "module",
|
|
16
|
+
description: "The 3D studio your AI agent can run: describe a scene as JSON (banners, characters, landscapes, mini games), preview and screenshot it headless, and export a self-contained embed for any website. No server, no account.",
|
|
17
|
+
license: "SEE LICENSE IN LICENSE",
|
|
18
|
+
engines: { "node": ">=20" },
|
|
19
|
+
bin: { "agent3d": "dist/agent/agent3d.mjs" },
|
|
20
|
+
files: [
|
|
21
|
+
"dist/agent",
|
|
22
|
+
"dist/runtime",
|
|
23
|
+
"dist/studio",
|
|
24
|
+
"library",
|
|
25
|
+
"templates",
|
|
26
|
+
"plugin",
|
|
27
|
+
"changelog.json",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
scripts: {
|
|
32
|
+
"dev": "vite",
|
|
33
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.agent.json",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:watch": "vitest",
|
|
36
|
+
"build:runtime": "vite build --config vite.runtime.config.ts && vite build --config vite.runtime.config.ts --mode single",
|
|
37
|
+
"build:studio": "vite build",
|
|
38
|
+
"build:agent": "vite build --config vite.agent.config.ts",
|
|
39
|
+
"build": "npm run build:runtime && npm run build:studio && npm run build:agent && node scripts/write-version.mjs",
|
|
40
|
+
"check:skills": "node scripts/check-skills.mjs",
|
|
41
|
+
"hermes:build": "node scripts/build-hermes.mjs",
|
|
42
|
+
"check:hermes": "node scripts/build-hermes.mjs --check && python3 -m unittest discover -s hermes/tests",
|
|
43
|
+
"docs:cli": "node scripts/build-cli-docs.mjs",
|
|
44
|
+
"check:docs": "node scripts/build-cli-docs.mjs --check",
|
|
45
|
+
"version": "node scripts/sync-version.mjs && npm run build && node scripts/build-hermes.mjs && node scripts/build-cli-docs.mjs && git add -A plugin hermes .claude-plugin README.md docs integrations/agentcms/README.md",
|
|
46
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build && npm run check:skills"
|
|
47
|
+
},
|
|
48
|
+
devDependencies: {
|
|
49
|
+
"@types/node": "^26.6.6",
|
|
50
|
+
"@types/react": "^19.3.0",
|
|
51
|
+
"@types/react-dom": "^19.3.0",
|
|
52
|
+
"@types/three": "^0.187.0",
|
|
53
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
54
|
+
"autoprefixer": "^10.7.0",
|
|
55
|
+
"cannon-es": "^0.20.0",
|
|
56
|
+
"clsx": "^2.1.1",
|
|
57
|
+
"happy-dom": "^21.0.4",
|
|
58
|
+
"lucide-react": "^1.77.0",
|
|
59
|
+
"meshoptimizer": "~1.1.1",
|
|
60
|
+
"postcss": "^8.5.33",
|
|
61
|
+
"react": "^19.3.1",
|
|
62
|
+
"react-dom": "^19.3.1",
|
|
63
|
+
"tailwindcss": "^3.4.19",
|
|
64
|
+
"three": "^0.187.0",
|
|
65
|
+
"typescript": "^7.0.2",
|
|
66
|
+
"vite": "^8.3.8",
|
|
67
|
+
"vitest": "^5.1.1"
|
|
68
|
+
},
|
|
69
|
+
repository: {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/fleox/agent3d.git"
|
|
72
|
+
},
|
|
73
|
+
publishConfig: { "access": "public" }
|
|
74
|
+
};
|
|
75
|
+
export { package_exports as n, version as r, package_default as t };
|