sera-code 0.1.2 → 0.1.4

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.
Files changed (333) hide show
  1. package/README.md +9 -1
  2. package/bin/sera.mjs +31 -0
  3. package/dist/bundle/chunks/{chunk-LOMPDCMP.js → chunk-DFRGGJWV.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-AZC5WTED.js → chunk-EMXTNOOJ.js} +5 -5
  5. package/dist/bundle/chunks/{chunk-KXU77PUU.js → chunk-ET2ARYK4.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-ZNCN2NGY.js → chunk-G5BGS7HZ.js} +2 -2
  7. package/dist/bundle/chunks/{chunk-HODJBMOY.js → chunk-GSGPISRE.js} +3 -4
  8. package/dist/bundle/chunks/{chunk-46WGNYIE.js → chunk-NMUS7OCP.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-HQBQWHLD.js → chunk-RCQXVPCE.js} +1 -1
  10. package/dist/bundle/chunks/{cli-MML2DU4A.js → cli-NOCFT7AL.js} +1 -1
  11. package/dist/bundle/chunks/{execute-HXDNZ26B.js → execute-S2O3RL6V.js} +1 -1
  12. package/dist/bundle/chunks/github-copilot.js +1 -1
  13. package/dist/bundle/chunks/{runtime-JAH75CB5.js → runtime-BRT7AUXY.js} +1 -1
  14. package/dist/bundle/chunks/{virtual-modules-Z2V3PTLI.js → virtual-modules-QR2XYBMY.js} +1 -1
  15. package/dist/bundle/cli-runtime.js +1 -1
  16. package/dist/bundle/index.js +1 -1
  17. package/dist/bundle/rpc-entry.js +1 -1
  18. package/lib/postinstall.js +16 -0
  19. package/lib/update.js +85 -0
  20. package/lib/win-setup.js +96 -0
  21. package/package.json +4 -1
  22. package/sera-core/skills/ambalaj-tasarim/NOTICE +1 -0
  23. package/sera-core/skills/ambalaj-tasarim/SKILL.md +34 -0
  24. package/sera-core/skills/ambalaj-tasarim/dieline.mjs +17 -0
  25. package/sera-core/skills/ambalaj-tasarim/sera-pack.js +535 -0
  26. package/sera-core/skills/animasyonlu-site/NOTICE +1 -0
  27. package/sera-core/skills/animasyonlu-site/SKILL.md +26 -0
  28. package/sera-core/skills/animasyonlu-site/sera-motion.js +310 -0
  29. package/sera-core/skills/animate/LICENSE +21 -0
  30. package/sera-core/skills/animate/NOTICE +2 -0
  31. package/sera-core/skills/animate/RECIPES.md +324 -0
  32. package/sera-core/skills/animate/SKILL.md +209 -0
  33. package/sera-core/skills/astryx-ui/SKILL.md +37 -0
  34. package/sera-core/skills/awwwards/LICENSE +21 -0
  35. package/sera-core/skills/awwwards/NOTICE +5 -0
  36. package/sera-core/skills/awwwards/SKILL.md +357 -0
  37. package/sera-core/skills/awwwards/references/anatomy.md +103 -0
  38. package/sera-core/skills/awwwards/references/art-direction.md +114 -0
  39. package/sera-core/skills/awwwards/references/astro.md +235 -0
  40. package/sera-core/skills/awwwards/references/concepts.md +110 -0
  41. package/sera-core/skills/awwwards/references/content.md +88 -0
  42. package/sera-core/skills/awwwards/references/engine.md +751 -0
  43. package/sera-core/skills/awwwards/references/layout.md +81 -0
  44. package/sera-core/skills/awwwards/references/motion.md +463 -0
  45. package/sera-core/skills/awwwards/references/nextjs.md +386 -0
  46. package/sera-core/skills/awwwards/references/patterns.md +123 -0
  47. package/sera-core/skills/awwwards/references/quality-bar.md +151 -0
  48. package/sera-core/skills/awwwards/references/quality.md +91 -0
  49. package/sera-core/skills/awwwards/references/ship.md +36 -0
  50. package/sera-core/skills/awwwards/references/typography.md +135 -0
  51. package/sera-core/skills/awwwards/references/webgl.md +430 -0
  52. package/sera-core/skills/awwwards/scripts/audit.mjs +243 -0
  53. package/sera-core/skills/awwwards/scripts/browser.mjs +54 -0
  54. package/sera-core/skills/awwwards/scripts/font.mjs +87 -0
  55. package/sera-core/skills/awwwards/scripts/og.mjs +20 -0
  56. package/sera-core/skills/awwwards/scripts/photos.mjs +65 -0
  57. package/sera-core/skills/awwwards/scripts/serve.mjs +48 -0
  58. package/sera-core/skills/awwwards/scripts/shoot.mjs +675 -0
  59. package/sera-core/skills/beceri-yaz/SKILL.md +39 -0
  60. package/sera-core/skills/brag-slim/LICENSE +21 -0
  61. package/sera-core/skills/brag-slim/NOTICE +2 -0
  62. package/sera-core/skills/brag-slim/SKILL.md +108 -0
  63. package/sera-core/skills/brainstorming/LICENSE +21 -0
  64. package/sera-core/skills/brainstorming/NOTICE +5 -0
  65. package/sera-core/skills/brainstorming/SKILL.md +298 -0
  66. package/sera-core/skills/brainstorming/builder-check-prompt.md +23 -0
  67. package/sera-core/skills/copywriting/LICENSE +21 -0
  68. package/sera-core/skills/copywriting/NOTICE +5 -0
  69. package/sera-core/skills/copywriting/SKILL.md +343 -0
  70. package/sera-core/skills/copywriting/references/ai-tells.md +309 -0
  71. package/sera-core/skills/copywriting/references/copy-frameworks.md +432 -0
  72. package/sera-core/skills/copywriting/references/natural-transitions.md +256 -0
  73. package/sera-core/skills/cro/LICENSE +21 -0
  74. package/sera-core/skills/cro/NOTICE +5 -0
  75. package/sera-core/skills/cro/SKILL.md +198 -0
  76. package/sera-core/skills/cro/references/experiments.md +248 -0
  77. package/sera-core/skills/cro/references/form.md +422 -0
  78. package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +11 -0
  79. package/sera-core/skills/emil-design-eng/LICENSE +21 -0
  80. package/sera-core/skills/emil-design-eng/NOTICE +2 -0
  81. package/sera-core/skills/emil-design-eng/SKILL.md +684 -0
  82. package/sera-core/skills/frontend-design/LICENSE.txt +177 -0
  83. package/sera-core/skills/frontend-design/NOTICE +2 -0
  84. package/sera-core/skills/frontend-design/SKILL.md +71 -0
  85. package/sera-core/skills/gorsel-denetim/SKILL.md +30 -0
  86. package/sera-core/skills/hallmark/LICENSE +21 -0
  87. package/sera-core/skills/hallmark/NOTICE +5 -0
  88. package/sera-core/skills/hallmark/SKILL.md +154 -0
  89. package/sera-core/skills/hallmark/references/anatomy.md +71 -0
  90. package/sera-core/skills/hallmark/references/brand-truth.md +40 -0
  91. package/sera-core/skills/hallmark/references/comp.md +104 -0
  92. package/sera-core/skills/hallmark/references/craft.md +116 -0
  93. package/sera-core/skills/hallmark/references/dark-mode.md +49 -0
  94. package/sera-core/skills/hallmark/references/data-viz.md +48 -0
  95. package/sera-core/skills/hallmark/references/design-md.md +53 -0
  96. package/sera-core/skills/hallmark/references/direction.md +52 -0
  97. package/sera-core/skills/hallmark/references/export-formats.md +80 -0
  98. package/sera-core/skills/hallmark/references/flow.md +131 -0
  99. package/sera-core/skills/hallmark/references/fonts.md +58 -0
  100. package/sera-core/skills/hallmark/references/gates.md +243 -0
  101. package/sera-core/skills/hallmark/references/genres/atmospheric.md +24 -0
  102. package/sera-core/skills/hallmark/references/genres/editorial.md +24 -0
  103. package/sera-core/skills/hallmark/references/genres/modern-minimal.md +24 -0
  104. package/sera-core/skills/hallmark/references/genres/playful.md +24 -0
  105. package/sera-core/skills/hallmark/references/imagery.md +99 -0
  106. package/sera-core/skills/hallmark/references/interaction-and-states.md +89 -0
  107. package/sera-core/skills/hallmark/references/layout.md +104 -0
  108. package/sera-core/skills/hallmark/references/macrostructures/01-bento-grid.md +21 -0
  109. package/sera-core/skills/hallmark/references/macrostructures/02-long-document.md +35 -0
  110. package/sera-core/skills/hallmark/references/macrostructures/03-marquee-hero.md +21 -0
  111. package/sera-core/skills/hallmark/references/macrostructures/04-stat-led.md +21 -0
  112. package/sera-core/skills/hallmark/references/macrostructures/05-workbench.md +21 -0
  113. package/sera-core/skills/hallmark/references/macrostructures/06-conversational-faq.md +28 -0
  114. package/sera-core/skills/hallmark/references/macrostructures/07-manifesto.md +28 -0
  115. package/sera-core/skills/hallmark/references/macrostructures/08-photographic.md +21 -0
  116. package/sera-core/skills/hallmark/references/macrostructures/09-quote-led.md +21 -0
  117. package/sera-core/skills/hallmark/references/macrostructures/10-specimen.md +21 -0
  118. package/sera-core/skills/hallmark/references/macrostructures/11-catalogue.md +21 -0
  119. package/sera-core/skills/hallmark/references/macrostructures/12-letter.md +21 -0
  120. package/sera-core/skills/hallmark/references/macrostructures/13-index-first.md +21 -0
  121. package/sera-core/skills/hallmark/references/macrostructures/14-narrative-workflow.md +21 -0
  122. package/sera-core/skills/hallmark/references/macrostructures/15-split-studio.md +21 -0
  123. package/sera-core/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
  124. package/sera-core/skills/hallmark/references/macrostructures/17-type-specimen.md +19 -0
  125. package/sera-core/skills/hallmark/references/macrostructures/18-portfolio-grid.md +21 -0
  126. package/sera-core/skills/hallmark/references/macrostructures/19-map-diagram.md +21 -0
  127. package/sera-core/skills/hallmark/references/macrostructures/20-ecosystem-index.md +19 -0
  128. package/sera-core/skills/hallmark/references/macrostructures/21-component-playground.md +21 -0
  129. package/sera-core/skills/hallmark/references/macrostructures.md +119 -0
  130. package/sera-core/skills/hallmark/references/microinteractions.md +80 -0
  131. package/sera-core/skills/hallmark/references/patterns.md +202 -0
  132. package/sera-core/skills/hallmark/references/redesign.md +88 -0
  133. package/sera-core/skills/hallmark/references/responsive.md +46 -0
  134. package/sera-core/skills/hallmark/references/review-finish.md +19 -0
  135. package/sera-core/skills/hallmark/references/review-hero.md +20 -0
  136. package/sera-core/skills/hallmark/references/scroll-choreography.md +110 -0
  137. package/sera-core/skills/hallmark/references/texture.md +90 -0
  138. package/sera-core/skills/hallmark/references/themes/README.md +58 -0
  139. package/sera-core/skills/hallmark/references/themes/almanac.md +103 -0
  140. package/sera-core/skills/hallmark/references/themes/arcade.md +102 -0
  141. package/sera-core/skills/hallmark/references/themes/atelier.md +98 -0
  142. package/sera-core/skills/hallmark/references/themes/bloom.md +102 -0
  143. package/sera-core/skills/hallmark/references/themes/blueprint.md +103 -0
  144. package/sera-core/skills/hallmark/references/themes/broadside.md +108 -0
  145. package/sera-core/skills/hallmark/references/themes/brutal.md +95 -0
  146. package/sera-core/skills/hallmark/references/themes/carnival.md +104 -0
  147. package/sera-core/skills/hallmark/references/themes/cobalt.md +101 -0
  148. package/sera-core/skills/hallmark/references/themes/console.md +99 -0
  149. package/sera-core/skills/hallmark/references/themes/coral.md +102 -0
  150. package/sera-core/skills/hallmark/references/themes/darkroom.md +99 -0
  151. package/sera-core/skills/hallmark/references/themes/dose.md +98 -0
  152. package/sera-core/skills/hallmark/references/themes/dusk.md +105 -0
  153. package/sera-core/skills/hallmark/references/themes/editorial.md +97 -0
  154. package/sera-core/skills/hallmark/references/themes/formwork.md +107 -0
  155. package/sera-core/skills/hallmark/references/themes/furrow.md +98 -0
  156. package/sera-core/skills/hallmark/references/themes/garden.md +97 -0
  157. package/sera-core/skills/hallmark/references/themes/grid.md +101 -0
  158. package/sera-core/skills/hallmark/references/themes/halftone.md +106 -0
  159. package/sera-core/skills/hallmark/references/themes/hedgerow.md +104 -0
  160. package/sera-core/skills/hallmark/references/themes/hum.md +99 -0
  161. package/sera-core/skills/hallmark/references/themes/ink.md +106 -0
  162. package/sera-core/skills/hallmark/references/themes/kiln.md +108 -0
  163. package/sera-core/skills/hallmark/references/themes/loom.md +106 -0
  164. package/sera-core/skills/hallmark/references/themes/lumen.md +103 -0
  165. package/sera-core/skills/hallmark/references/themes/manifesto.md +101 -0
  166. package/sera-core/skills/hallmark/references/themes/midnight.md +97 -0
  167. package/sera-core/skills/hallmark/references/themes/newsprint.md +102 -0
  168. package/sera-core/skills/hallmark/references/themes/overprint.md +101 -0
  169. package/sera-core/skills/hallmark/references/themes/pasteup.md +100 -0
  170. package/sera-core/skills/hallmark/references/themes/piste.md +99 -0
  171. package/sera-core/skills/hallmark/references/themes/refract.md +101 -0
  172. package/sera-core/skills/hallmark/references/themes/ribbon.md +106 -0
  173. package/sera-core/skills/hallmark/references/themes/rim.md +96 -0
  174. package/sera-core/skills/hallmark/references/themes/riso.md +98 -0
  175. package/sera-core/skills/hallmark/references/themes/solstice.md +104 -0
  176. package/sera-core/skills/hallmark/references/themes/specimen.md +100 -0
  177. package/sera-core/skills/hallmark/references/themes/spore.md +104 -0
  178. package/sera-core/skills/hallmark/references/themes/sport.md +101 -0
  179. package/sera-core/skills/hallmark/references/themes/squeeze.md +99 -0
  180. package/sera-core/skills/hallmark/references/themes/sticker.md +106 -0
  181. package/sera-core/skills/hallmark/references/themes/studio.md +99 -0
  182. package/sera-core/skills/hallmark/references/themes/terminal.md +96 -0
  183. package/sera-core/skills/hallmark/references/themes/terrazzo.md +106 -0
  184. package/sera-core/skills/hallmark/references/themes/ultraviolet.md +106 -0
  185. package/sera-core/skills/hallmark/references/themes/vantage.md +99 -0
  186. package/sera-core/skills/hallmark/references/themes/vellum.md +105 -0
  187. package/sera-core/skills/hallmark/references/themes/wayfind.md +105 -0
  188. package/sera-core/skills/hallmark/references/themes/werkstatt.md +105 -0
  189. package/sera-core/skills/hallmark/scripts/capture.mjs +132 -0
  190. package/sera-core/skills/hallmark/scripts/refcheck.mjs +405 -0
  191. package/sera-core/skills/hallmark/scripts/sloplint-render.mjs +1283 -0
  192. package/sera-core/skills/hallmark/scripts/sloplint.mjs +4426 -0
  193. package/sera-core/skills/hallmark/scripts/theme.mjs +660 -0
  194. package/sera-core/skills/kurum-ici-iletisim/SKILL.md +40 -0
  195. package/sera-core/skills/launch/LICENSE +21 -0
  196. package/sera-core/skills/launch/NOTICE +5 -0
  197. package/sera-core/skills/launch/SKILL.md +385 -0
  198. package/sera-core/skills/launch/references/shipped-changes.md +84 -0
  199. package/sera-core/skills/launch/references/site-launch-qa.md +57 -0
  200. package/sera-core/skills/marka-kimligi/SKILL.md +30 -0
  201. package/sera-core/skills/mcp-yaz/SKILL.md +41 -0
  202. package/sera-core/skills/mobil-arayuz/SKILL.md +12 -0
  203. package/sera-core/skills/mvp-scoping/LICENSE +21 -0
  204. package/sera-core/skills/mvp-scoping/NOTICE +5 -0
  205. package/sera-core/skills/mvp-scoping/SKILL.md +95 -0
  206. package/sera-core/skills/ortak-yazarlik/SKILL.md +32 -0
  207. package/sera-core/skills/oyun-turleri/SKILL.md +176 -0
  208. package/sera-core/skills/paralel-sadelestirme/SKILL.md +33 -0
  209. package/sera-core/skills/phaser-core/LICENSE +201 -0
  210. package/sera-core/skills/phaser-core/NOTICE +5 -0
  211. package/sera-core/skills/phaser-core/NOTICE-UPSTREAM +15 -0
  212. package/sera-core/skills/phaser-core/SKILL.md +245 -0
  213. package/sera-core/skills/phaser-core/references/scene-flow.md +177 -0
  214. package/sera-core/skills/pitch-deck/LICENSE +21 -0
  215. package/sera-core/skills/pitch-deck/NOTICE +5 -0
  216. package/sera-core/skills/pitch-deck/SKILL.md +103 -0
  217. package/sera-core/skills/sera-3d-oyun/NOTICE +1 -0
  218. package/sera-core/skills/sera-3d-oyun/SKILL.md +12 -0
  219. package/sera-core/skills/sera-3d-oyun/sera-3d.js +3697 -0
  220. package/sera-core/skills/sera-diyagram/SKILL.md +43 -0
  221. package/sera-core/skills/sera-ofis-dosya/SKILL.md +3 -0
  222. package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-ileri.md +46 -0
  223. package/sera-core/skills/sera-ui-site/NOTICE +1 -0
  224. package/sera-core/skills/sera-ui-site/SKILL.md +10 -0
  225. package/sera-core/skills/sera-ui-site/sera-ui.js +83 -0
  226. package/sera-core/skills/sera-veri-gorsel/SKILL.md +3 -0
  227. package/sera-core/skills/sera-veri-gorsel/referanslar/palet-dogrula.mjs +80 -0
  228. package/sera-core/skills/sistem-tarama/SKILL.md +49 -0
  229. package/sera-core/skills/sistem-tarama/referanslar/komutlar.md +78 -0
  230. package/sera-core/skills/tasarim-stilleri/SKILL.md +113 -0
  231. package/sera-core/skills/teardown/LICENSE +22 -0
  232. package/sera-core/skills/teardown/NOTICE +3 -0
  233. package/sera-core/skills/teardown/SKILL.md +144 -0
  234. package/sera-core/skills/teardown/package-lock.json +545 -0
  235. package/sera-core/skills/teardown/package.json +18 -0
  236. package/sera-core/skills/teardown/paths.mjs +30 -0
  237. package/sera-core/skills/teardown/run_sfx.py +10 -0
  238. package/sera-core/skills/teardown/sfx/__init__.py +10 -0
  239. package/sera-core/skills/teardown/sfx/__main__.py +64 -0
  240. package/sera-core/skills/teardown/sfx/dsp.py +453 -0
  241. package/sera-core/skills/teardown/sfx/loudness.py +72 -0
  242. package/sera-core/skills/teardown/sfx/mix.py +111 -0
  243. package/sera-core/skills/teardown/sfx/samples/SOURCES.md +23 -0
  244. package/sera-core/skills/teardown/sfx/samples/fs-258269-mouth-pop.ogg +0 -0
  245. package/sera-core/skills/teardown/sfx/samples/fs-323432-typing.ogg +0 -0
  246. package/sera-core/skills/teardown/sfx/samples/fs-329533-room-tone-in-an-apartment-livi.ogg +0 -0
  247. package/sera-core/skills/teardown/sfx/samples/fs-329569-roomtone-bedroom-yew.ogg +0 -0
  248. package/sera-core/skills/teardown/sfx/samples/fs-339521-vhs-rewind-forward-and-eject.ogg +0 -0
  249. package/sera-core/skills/teardown/sfx/samples/fs-349504-triangle-open-04.ogg +0 -0
  250. package/sera-core/skills/teardown/sfx/samples/fs-416777-digital-typing-wav.ogg +0 -0
  251. package/sera-core/skills/teardown/sfx/samples/fs-426767-apartment-room-tone-wav.ogg +0 -0
  252. package/sera-core/skills/teardown/sfx/samples/fs-447909-keyboard-typing.ogg +0 -0
  253. package/sera-core/skills/teardown/sfx/samples/fs-447910-plop.ogg +0 -0
  254. package/sera-core/skills/teardown/sfx/samples/fs-79388-keyboard-typing-wav.ogg +0 -0
  255. package/sera-core/skills/teardown/sfx/samples/fs-824189-pop-in-sfx.ogg +0 -0
  256. package/sera-core/skills/teardown/sfx/score_kit.py +206 -0
  257. package/sera-core/skills/teardown/sfx/synth.py +294 -0
  258. package/sera-core/skills/teardown/sheet.mjs +127 -0
  259. package/sera-core/skills/teardown/sims/beats.py +212 -0
  260. package/sera-core/skills/teardown/sims/build.mjs +141 -0
  261. package/sera-core/skills/teardown/sims/capture.mjs +211 -0
  262. package/sera-core/skills/teardown/sims/cessna-film/main.js +4 -0
  263. package/sera-core/skills/teardown/sims/cessna-film/timeline.json +1 -0
  264. package/sera-core/skills/teardown/sims/cessna-live/main.js +5 -0
  265. package/sera-core/skills/teardown/sims/cessna-shared/console.js +288 -0
  266. package/sera-core/skills/teardown/sims/cessna-shared/film.js +254 -0
  267. package/sera-core/skills/teardown/sims/cessna-shared/flight.js +53 -0
  268. package/sera-core/skills/teardown/sims/cessna-shared/gear.js +364 -0
  269. package/sera-core/skills/teardown/sims/cessna-shared/live.js +351 -0
  270. package/sera-core/skills/teardown/sims/cessna-shared/score.py +41 -0
  271. package/sera-core/skills/teardown/sims/cessna-shared/stage.js +248 -0
  272. package/sera-core/skills/teardown/sims/kit/director.js +300 -0
  273. package/sera-core/skills/teardown/sims/kit/hud.js +194 -0
  274. package/sera-core/skills/teardown/sims/kit/runtime.js +168 -0
  275. package/sera-core/skills/teardown/sims/kit/stage3d.js +114 -0
  276. package/sera-core/skills/teardown/sims/kit/style.css +137 -0
  277. package/sera-core/skills/teardown/sims/kit/util.js +79 -0
  278. package/sera-core/skills/teardown/sims/kit/warm.js +66 -0
  279. package/sera-core/skills/teardown/sims/strandbeest-film/main.js +4 -0
  280. package/sera-core/skills/teardown/sims/strandbeest-film/timeline.json +1 -0
  281. package/sera-core/skills/teardown/sims/strandbeest-live/main.js +5 -0
  282. package/sera-core/skills/teardown/sims/strandbeest-shared/beast.js +419 -0
  283. package/sera-core/skills/teardown/sims/strandbeest-shared/console.js +375 -0
  284. package/sera-core/skills/teardown/sims/strandbeest-shared/film.js +352 -0
  285. package/sera-core/skills/teardown/sims/strandbeest-shared/jansen.js +67 -0
  286. package/sera-core/skills/teardown/sims/strandbeest-shared/live.js +420 -0
  287. package/sera-core/skills/teardown/sims/strandbeest-shared/score.py +85 -0
  288. package/sera-core/skills/teardown/sims/strandbeest-shared/stage.js +463 -0
  289. package/sera-core/skills/teardown/sims/v8-film/main.js +4 -0
  290. package/sera-core/skills/teardown/sims/v8-film/timeline.json +1 -0
  291. package/sera-core/skills/teardown/sims/v8-live/main.js +5 -0
  292. package/sera-core/skills/teardown/sims/v8-shared/console.js +339 -0
  293. package/sera-core/skills/teardown/sims/v8-shared/engine.js +624 -0
  294. package/sera-core/skills/teardown/sims/v8-shared/film.js +239 -0
  295. package/sera-core/skills/teardown/sims/v8-shared/kin.js +86 -0
  296. package/sera-core/skills/teardown/sims/v8-shared/live.js +374 -0
  297. package/sera-core/skills/teardown/sims/v8-shared/score.py +60 -0
  298. package/sera-core/skills/teardown/sims/v8-shared/stage.js +173 -0
  299. package/sera-core/skills/teardown/wave.mjs +67 -0
  300. package/sera-core/skills/toplu-degisiklik/SKILL.md +39 -0
  301. package/sera-core/skills/ui-ux-pro-max/LICENSE +21 -0
  302. package/sera-core/skills/ui-ux-pro-max/NOTICE +5 -0
  303. package/sera-core/skills/ui-ux-pro-max/SKILL.md +13 -0
  304. package/sera-core/skills/ui-ux-pro-max/references/pro-rules.md +117 -0
  305. package/sera-core/skills/ui-ux-pro-max/references/quick-reference.md +266 -0
  306. package/sera-core/skills/unslop/LICENSE.md +410 -0
  307. package/sera-core/skills/unslop/SKILL.md +217 -0
  308. package/sera-core/skills/unslop/references/effects.md +113 -0
  309. package/sera-core/skills/unslop/references/refs/unslop-dashboard-after.webp +0 -0
  310. package/sera-core/skills/unslop/references/refs/unslop-hero-after.webp +0 -0
  311. package/sera-core/skills/unslop/references/refs.md +16 -0
  312. package/sera-core/skills/unslop/references/rtl.md +72 -0
  313. package/sera-core/skills/unslop/references/signs.md +125 -0
  314. package/sera-core/skills/unslop/references/tokens.md +137 -0
  315. package/sera-core/skills/unslop/references/visuals.md +84 -0
  316. package/sera-core/skills/unslop/scripts/snapshot.mjs +197 -0
  317. package/sera-core/skills/uretken-sanat/SKILL.md +42 -0
  318. package/sera-core/skills/verification-before-completion/LICENSE +21 -0
  319. package/sera-core/skills/verification-before-completion/NOTICE +5 -0
  320. package/sera-core/skills/verification-before-completion/SKILL.md +120 -0
  321. package/sera-core/skills/web-yayin-listesi/SKILL.md +3 -0
  322. package/sera-core/src/app-master.ts +2 -2
  323. package/sera-core/src/app-verify.ts +33 -0
  324. package/sera-core/src/auto-memory.ts +249 -0
  325. package/sera-core/src/extension.ts +69 -3
  326. package/sera-core/src/generated/build-rules.ts +81 -17
  327. package/sera-core/src/generated/quality-probe.ts +2 -0
  328. package/sera-core/src/generated/zero-knowledge.ts +36 -9
  329. package/sera-core/src/image-tool.ts +124 -7
  330. package/sera-core/src/link-data-tools.ts +411 -0
  331. package/sera-core/src/skills.ts +54 -18
  332. package/sera-core/src/video-tool.ts +51 -0
  333. package/sera-core/src/zk.ts +7 -3
@@ -0,0 +1,351 @@
1
+ // The Skymaster gear as a page you drive: the film's gear, runway and console run in real time. TAKEOFF and LANDING
2
+ // start a sequence, the play button pauses it, the timeline scrubs it, SPEED sets its pace; the six views, the six
3
+ // display modes, an orbit you drag and a zoom on the wheel. Left alone it plays the film's script as an auto tour with
4
+ // the operator's cursor, looped; a click, drag, wheel or key hands control to the visitor, 25 s of quiet hands it back.
5
+ import {warmComposer} from '../kit/warm.js';
6
+ import {createConsole, DISPLAY, VIEWS} from './console.js';
7
+ import {camAt, displayAt, DURATION, makeConsoleFrame, makeCursor, mechAt, SCRIPT, seqAt, viewAt, VIEW_FN} from './film.js';
8
+ import {SEQ} from './flight.js';
9
+ import {G} from './gear.js';
10
+ import {createCessnaStage} from './stage.js';
11
+
12
+ const W = 1600;
13
+ const H = 900;
14
+ const IDLE = 25;
15
+ const D2R = Math.PI / 180;
16
+ const clamp = (x, a, b) => Math.min(b, Math.max(a, x));
17
+ const smoother = (x) => {
18
+ const u = clamp(x, 0, 1);
19
+ return u * u * u * (u * (u * 6 - 15) + 10);
20
+ };
21
+ const ss = (a, b, t) => smoother((t - a) / (b - a));
22
+ const wrap = (d) => ((((d + 180) % 360) + 360) % 360) - 180;
23
+ const SPEED = [0.1, 2];
24
+ const speedK = (v) => (v - SPEED[0]) / (SPEED[1] - SPEED[0]);
25
+
26
+ const CSS = (top) => `
27
+ html,body{background:#f2e6d2;overflow:hidden}
28
+ #app{position:absolute!important;inset:auto!important;left:0;top:0;width:${W}px;height:${H}px;transform-origin:0 0}
29
+ #gl{touch-action:none;cursor:grab}
30
+ #gl.drag{cursor:grabbing}
31
+ .bt{pointer-events:auto;cursor:pointer}
32
+ .bt:hover{filter:brightness(.96)}
33
+ .hit{position:absolute;pointer-events:auto;cursor:ew-resize}
34
+ .tourchip{position:absolute;left:800px;top:154px;transform:translateX(-50%);display:flex;align-items:center;gap:7px;height:22px;padding:0 11px;border:1px solid #eadfcd;border-radius:4px;background:rgba(252,249,244,.95);color:#2a2521;font:700 9px 'JetBrains Mono',monospace;letter-spacing:1.3px;white-space:nowrap;cursor:pointer;pointer-events:auto}
35
+ .tourchip i{display:block;width:6px;height:6px;border-radius:50%;background:#e3562a}
36
+ .tourchip.on i{animation:blink 1.2s steps(2) infinite}
37
+ @keyframes blink{50%{opacity:.15}}
38
+ .turn{position:fixed;left:0;right:0;bottom:18px;text-align:center;font:600 12px/1.4 'JetBrains Mono',monospace;letter-spacing:1px;color:#9b8f80;text-transform:uppercase;display:none}
39
+ @media (orientation:portrait) and (max-width:820px){.turn{display:block}}
40
+ `;
41
+
42
+ export function runLive() {
43
+ const top = Number(document.body.dataset.top || 0);
44
+ const style = document.createElement('style');
45
+ style.textContent = CSS(top);
46
+ document.head.appendChild(style);
47
+ const app = document.getElementById('app');
48
+ const canvas = document.createElement('canvas');
49
+ canvas.id = 'gl';
50
+ app.appendChild(canvas);
51
+ const st = createCessnaStage({canvas});
52
+ const ui = createConsole(app);
53
+ const tourCursor = makeCursor(ui);
54
+ const frameConsole = makeConsoleFrame(ui, st);
55
+
56
+ // ------------------------------------------------------------ quality tiers
57
+ const TIERS = [
58
+ {samples: 8, ao: true, shadow: 4096, pr: 2},
59
+ {samples: 4, ao: false, shadow: 2048, pr: 1.5},
60
+ {samples: 2, ao: false, shadow: 1024, pr: 1},
61
+ ];
62
+ const light = matchMedia('(pointer: coarse)').matches || Math.min(innerWidth, innerHeight) < 700;
63
+ let tier = light ? 2 : 0;
64
+ let scale = 1;
65
+ const fit = () => {
66
+ const h = innerHeight - top;
67
+ scale = Math.min(innerWidth / W, h / H);
68
+ app.style.transform = `translate(${(innerWidth - W * scale) / 2}px, ${top + (h - H * scale) / 2}px) scale(${scale})`;
69
+ st.resize(W, H, clamp((devicePixelRatio || 1) * scale, 0.75, TIERS[tier].pr));
70
+ };
71
+ const applyTier = () => {
72
+ const {pr, ...q} = TIERS[tier];
73
+ st.setQuality(q);
74
+ fit();
75
+ };
76
+ applyTier();
77
+ addEventListener('resize', fit);
78
+ const toStage = (cx, cy) => {
79
+ const r = app.getBoundingClientRect();
80
+ return [(cx - r.left) / scale, (cy - r.top) / scale];
81
+ };
82
+ const tourChip = document.createElement('div');
83
+ tourChip.className = 'tourchip';
84
+ ui.root.appendChild(tourChip);
85
+ const note = document.createElement('div');
86
+ note.className = 'turn';
87
+ note.textContent = 'Turn your phone sideways for the full console';
88
+ document.body.appendChild(note);
89
+
90
+ // ------------------------------------------------------------ state
91
+ let T = 0;
92
+ let seq = 'takeoff';
93
+ let tau = 0;
94
+ let speed = 1;
95
+ let paused = false;
96
+ let view = 'hero';
97
+ let viewAt0 = 0;
98
+ const disp = Object.fromEntries(DISPLAY.map((k) => [k, {on: 0, t: -9}]));
99
+ const off = {az: 0, el: 0, k: 1};
100
+ const cam = {...VIEW_FN.hero(0)};
101
+ let dist = 0;
102
+ let roll = 0;
103
+ let wheelW = 0;
104
+ let ring = {t: -9, x: 0, y: 0};
105
+ const eased = (k, dur = 0.7) => {
106
+ const d = disp[k];
107
+ const x = ss(d.t, d.t + dur, T);
108
+ return d.on ? x : 1 - x;
109
+ };
110
+ const pulse = (k) => (ring = {t: T, x: ui.spots[k][0], y: ui.spots[k][1]});
111
+
112
+ // ------------------------------------------------------------ the tour
113
+ const AP = {on: true, t0: 0, loop: 0, last: -1};
114
+ let lastInput = 0;
115
+ const startTour = () => {
116
+ AP.on = true;
117
+ AP.t0 = T;
118
+ AP.loop = 0;
119
+ AP.last = -1;
120
+ paused = false;
121
+ speed = 1;
122
+ Object.assign(off, {az: 0, el: 0, k: 1});
123
+ };
124
+ const takeOver = () => {
125
+ lastInput = T;
126
+ if (!AP.on) return;
127
+ AP.on = false;
128
+ const cyc = (T - AP.t0) % DURATION;
129
+ const [t0, v] = viewAt(cyc);
130
+ view = v;
131
+ viewAt0 = T - (cyc - t0);
132
+ };
133
+ tourChip.addEventListener('pointerdown', (e) => {
134
+ e.stopPropagation();
135
+ lastInput = T;
136
+ if (AP.on) takeOver();
137
+ else startTour();
138
+ });
139
+ addEventListener('pointerdown', (e) => {
140
+ if (e.target !== tourChip) takeOver();
141
+ });
142
+ // the tour's display toggles land in the same state the visitor drives, so a takeover keeps them
143
+ const syncDisplay = (cyc) => {
144
+ const want = displayAt(cyc);
145
+ for (const k of DISPLAY) {
146
+ if (disp[k].on !== want[k]) {
147
+ disp[k].on = want[k];
148
+ disp[k].t = T;
149
+ }
150
+ }
151
+ };
152
+
153
+ // ------------------------------------------------------------ controls
154
+ const startSeq = (s) => {
155
+ seq = s;
156
+ tau = 0;
157
+ paused = false;
158
+ };
159
+ for (const s of ['takeoff', 'landing'])
160
+ ui.btn[s].addEventListener('click', () => {
161
+ takeOver();
162
+ pulse(s);
163
+ startSeq(s);
164
+ });
165
+ for (const v of VIEWS)
166
+ ui.btn[v].addEventListener('click', () => {
167
+ takeOver();
168
+ pulse(v);
169
+ view = v;
170
+ viewAt0 = T;
171
+ Object.assign(off, {az: 0, el: 0, k: 1});
172
+ });
173
+ for (const k of DISPLAY)
174
+ ui.btn[k].addEventListener('click', () => {
175
+ takeOver();
176
+ pulse(k);
177
+ disp[k].on = disp[k].on ? 0 : 1;
178
+ disp[k].t = T;
179
+ });
180
+ ui.btn.play.addEventListener('click', () => {
181
+ takeOver();
182
+ pulse('play');
183
+ if (tau >= SEQ[seq].dur - 1e-3) tau = 0;
184
+ paused = !paused;
185
+ });
186
+ const slider = (x0, w, y, apply) => {
187
+ const d = document.createElement('div');
188
+ d.className = 'hit';
189
+ Object.assign(d.style, {left: `${x0 - 8}px`, top: `${y - 11}px`, width: `${w + 16}px`, height: '22px'});
190
+ const move = (e) => {
191
+ const [x] = toStage(e.clientX, e.clientY);
192
+ apply(clamp((x - x0) / w, 0, 1));
193
+ lastInput = T;
194
+ };
195
+ d.addEventListener('pointerdown', (e) => {
196
+ takeOver();
197
+ d.setPointerCapture(e.pointerId);
198
+ const up = () => {
199
+ removeEventListener('pointermove', move);
200
+ removeEventListener('pointerup', up);
201
+ };
202
+ addEventListener('pointermove', move);
203
+ addEventListener('pointerup', up);
204
+ move(e);
205
+ });
206
+ ui.root.appendChild(d);
207
+ };
208
+ slider(ui.TL.x, ui.TL.w, 821, (k) => {
209
+ tau = k * SEQ[seq].dur;
210
+ paused = true;
211
+ });
212
+ slider(ui.SP.x, ui.SP.w, 824, (k) => (speed = SPEED[0] + k * (SPEED[1] - SPEED[0])));
213
+ addEventListener('keydown', (e) => {
214
+ if (e.altKey || e.ctrlKey || e.metaKey) return;
215
+ const key = e.key.toLowerCase();
216
+ const v = {1: 'hero', 2: 'front', 3: 'plan', 4: 'top', 5: 'gearbox', 6: 'sidetube'}[key];
217
+ if (v) ui.btn[v].click();
218
+ else if (key === ' ') ui.btn.play.click();
219
+ else if (key === 't') ui.btn.takeoff.click();
220
+ else if (key === 'l') ui.btn.landing.click();
221
+ else if (key === 'f') ui.btn.fuselage.click();
222
+ else if (key === 'x') ui.btn.xray.click();
223
+ else if (key === 'e') ui.btn.exploded.click();
224
+ else return;
225
+ e.preventDefault();
226
+ });
227
+ let drag = null;
228
+ canvas.addEventListener('pointerdown', (e) => {
229
+ drag = {x: e.clientX, y: e.clientY};
230
+ canvas.setPointerCapture(e.pointerId);
231
+ canvas.classList.add('drag');
232
+ });
233
+ canvas.addEventListener('pointermove', (e) => {
234
+ if (!drag) return;
235
+ off.az += ((e.clientX - drag.x) / scale) * 0.3;
236
+ off.el = clamp(off.el + ((e.clientY - drag.y) / scale) * 0.2, -25, 60);
237
+ drag = {x: e.clientX, y: e.clientY};
238
+ lastInput = T;
239
+ });
240
+ const endDrag = () => {
241
+ drag = null;
242
+ canvas.classList.remove('drag');
243
+ };
244
+ canvas.addEventListener('pointerup', endDrag);
245
+ canvas.addEventListener('pointercancel', endDrag);
246
+ canvas.addEventListener(
247
+ 'wheel',
248
+ (e) => {
249
+ e.preventDefault();
250
+ takeOver();
251
+ off.k = clamp(off.k * Math.exp(e.deltaY * 0.0012), 0.4, 2.4);
252
+ },
253
+ {passive: false},
254
+ );
255
+
256
+ // ------------------------------------------------------------ the frame
257
+ startTour();
258
+ let last = performance.now();
259
+ const perf = {n: 0, sum: 0, slow: 0, age: 0};
260
+ const frame = (now) => {
261
+ const dt = Math.min(0.1, Math.max(0, (now - last) / 1000));
262
+ last = now;
263
+ T += dt;
264
+ if (tier < TIERS.length - 1) {
265
+ perf.age += dt;
266
+ if (perf.age > 0.6) {
267
+ perf.sum += dt;
268
+ perf.n++;
269
+ if (perf.sum >= 0.5 && perf.n >= 6) {
270
+ perf.slow = perf.sum / perf.n > 0.022 ? perf.slow + 1 : 0;
271
+ perf.sum = 0;
272
+ perf.n = 0;
273
+ if (perf.slow >= (perf.age < 6 ? 1 : 2)) {
274
+ tier++;
275
+ applyTier();
276
+ Object.assign(perf, {age: 0, slow: 0});
277
+ }
278
+ }
279
+ }
280
+ }
281
+
282
+ let tgt;
283
+ let cursor;
284
+ let since;
285
+ if (AP.on) {
286
+ const c = T - AP.t0;
287
+ const loop = Math.floor(c / DURATION);
288
+ const cyc = c - loop * DURATION;
289
+ if (loop > AP.loop) AP.loop = loop;
290
+ const s = seqAt(cyc);
291
+ seq = s.seq;
292
+ tau = s.tau;
293
+ syncDisplay(cyc);
294
+ tgt = camAt(cyc, displayAt(cyc).orbit);
295
+ const [t0, v] = viewAt(cyc);
296
+ view = v;
297
+ since = cyc - t0;
298
+ cursor = tourCursor(cyc);
299
+ if (AP.loop > 0 && cyc < 0.8) {
300
+ const end = tourCursor(DURATION - 0.01);
301
+ const k = ss(0, 0.8, cyc);
302
+ cursor = {...cursor, x: end.x + (cursor.x - end.x) * k, y: end.y + (cursor.y - end.y) * k};
303
+ }
304
+ } else {
305
+ if (T - lastInput > IDLE) startTour();
306
+ if (!paused) tau = Math.min(SEQ[seq].dur, tau + dt * speed);
307
+ since = T - viewAt0;
308
+ tgt = VIEW_FN[view](since);
309
+ tgt.az += off.az + (disp.orbit.on ? 14 * (T - disp.orbit.t) : 0);
310
+ tgt.el = clamp(tgt.el + off.el, -20, 88);
311
+ tgt.d *= off.k;
312
+ const rk = Math.max(0, 1 - (T - ring.t) / 0.55);
313
+ cursor = {x: -99, y: -99, press: false, ring: rk, ringX: ring.x, ringY: ring.y};
314
+ }
315
+ const m = mechAt(seq, tau);
316
+ // the runway and the wheels: rolled by the ground speed, the wheels coasting once airborne
317
+ const live = AP.on || !paused;
318
+ dist += live ? m.speed * dt * (AP.on ? 1 : speed) : 0;
319
+ wheelW = m.height < 0.005 ? m.speed / G.wheelR : wheelW * Math.exp(-dt / 1.2);
320
+ roll += live ? wheelW * dt * (AP.on ? 1 : speed) : 0;
321
+
322
+ const k = 1 - Math.exp(-dt / (AP.on ? 0.18 : 0.45));
323
+ cam.az += wrap(tgt.az - cam.az) * k;
324
+ for (const key of ['tx', 'ty', 'tz', 'el', 'd', 'sx', 'sy']) cam[key] += (tgt[key] - cam[key]) * k;
325
+ const explode = eased('exploded', 0.8);
326
+ st.frame(
327
+ {stroke: m.stroke, roll, height: m.height, dist, fuselage: eased('fuselage') * 0.9, xray: eased('xray'), explode, section: !!disp.section.on},
328
+ {...cam, az: cam.az * D2R, el: cam.el * D2R},
329
+ );
330
+ const display = Object.fromEntries(DISPLAY.map((x) => [x, disp[x].on]));
331
+ frameConsole(T, {seq, tau, mech: m, roll, view, display, explode, labels: eased('labels', 0.5) * ss(1.1, 1.7, since), cursor, paused: AP.on ? false : paused, speed: AP.on ? 1 : speed, speedK: speedK(AP.on ? 1 : speed)});
332
+ if (tourChip.classList.contains('on') !== AP.on || !tourChip.firstChild) {
333
+ tourChip.classList.toggle('on', AP.on);
334
+ tourChip.innerHTML = AP.on ? '<i></i>AUTO TOUR · CLICK TO TAKE OVER' : '▶ RESUME TOUR';
335
+ }
336
+ // the site page swaps its poster for the canvas on this
337
+ if (!window.SIM_SHOWN) {
338
+ window.SIM_SHOWN = true;
339
+ dispatchEvent(new Event('simframe'));
340
+ }
341
+ requestAnimationFrame(frame);
342
+ };
343
+ // every shader compiles at once off the main thread before the first frame (kit/warm.js)
344
+ warmComposer(st.renderer, st.composer, st.scene, st.camera).then(() => requestAnimationFrame(frame));
345
+ window.LIVE = {st, cam, startTour, takeOver, get tier() {
346
+ return tier;
347
+ }, get T() {
348
+ return T;
349
+ }};
350
+ void SCRIPT;
351
+ }
@@ -0,0 +1,41 @@
1
+ """Score for the Cessna 337 main landing gear film: a light bed (Dmaj9 chords, 96 bpm) at one level the whole way, a
2
+ hydraulic whine under every gear transit, a soft air at each lift-off, a tyre thud at each touchdown and a quiet
3
+ click on every button the operator presses.
4
+
5
+ python run_sfx.py sims/cessna-shared/score.py
6
+
7
+ Times from cessna-shared/film.js (SCRIPT) and flight.js (the sequences' own timings).
8
+ """
9
+
10
+ import os
11
+
12
+ from sfx.score_kit import airy, bed, chords, hz, motor, thud
13
+ from sfx.synth import click
14
+
15
+ TIMELINE = "../cessna-film/timeline.json"
16
+ OUT = os.path.join(os.environ.get("TEARDOWN_OUT", "teardown-out"), "cessna-score.wav")
17
+ TARGET_LUFS = -14.0
18
+ SEED = 17
19
+
20
+ CHORDS = chords("Dmaj9:D2 A2 C#3 E3 F#3/D1", "Bm9:B1 F#2 A2 C#3 D3/B0", "Gmaj7:G2 D3 F#3 B3/G1", "A6sus:A2 D3 E3 F#3 B3/A1")
21
+ MOTIF = [(0.5, hz("F#5")), (1.5, hz("A5")), (2.5, hz("E5"))]
22
+ CLICKS = (2.4, 5.4, 5.9, 6.5, 8.7, 10.9, 11.5, 12.7, 13.0, 13.4, 16.2, 17.8, 18.3, 18.7, 19.1)
23
+ TAKEOFFS = (0.0, 13.0)
24
+ LANDINGS = (5.4, 19.1)
25
+
26
+
27
+ def score(mix, tl):
28
+ dur = tl["duration"]
29
+ left, right, low, drums = bed(dur, 96, CHORDS, MOTIF, motif_voice="epiano", kicks=(0, 2.5), snares=(), hats=8, swing=0.0, keys_vel=0.7, keys_lp=3600)
30
+ mix.put_stereo(0, left, right, 0.12)
31
+ mix.put(0, low, 0.12)
32
+ mix.put(0, drums, 0.045)
33
+ for t0 in TAKEOFFS:
34
+ mix.put(t0 + 1.8, airy(1.6, 500, 1600, 0.6), 0.03)
35
+ mix.put(t0 + 2.3, motor(2.2, 190, 1300, 14), 0.02)
36
+ for t0 in LANDINGS:
37
+ mix.put(t0 + 0.6, motor(2.4, 175, 1200, 14), 0.02)
38
+ if t0 + 5.2 < dur - 0.3:
39
+ mix.put(t0 + 5.2, thud(80, 0.05, 0.4), 0.09)
40
+ for t in CLICKS:
41
+ mix.put(t, click(2400, 0.025), 0.055)
@@ -0,0 +1,248 @@
1
+ // The landing gear's stage: a warm peach studio over a runway (centreline dashes, edge bars, threshold letters drawn
2
+ // in a shader and a canvas), soft shadows, GTAO kept off the ground. frame(state, cam) poses the gear, slides the
3
+ // runway under it by the distance rolled and draws one frame.
4
+ import * as THREE from 'three';
5
+ import {EffectComposer} from 'three/addons/postprocessing/EffectComposer.js';
6
+ import {GTAOPass} from 'three/addons/postprocessing/GTAOPass.js';
7
+ import {OutputPass} from 'three/addons/postprocessing/OutputPass.js';
8
+ import {Pass} from 'three/addons/postprocessing/Pass.js';
9
+ import {RenderPass} from 'three/addons/postprocessing/RenderPass.js';
10
+ import {buildGear, GROUND} from './gear.js';
11
+
12
+ const V3 = THREE.Vector3;
13
+ export const COL = {bg: '#f2e6d2', ground: '#efe0c6', mark: '#d6bf9a', shadow: '#7a5a3a'};
14
+
15
+ const GROUND_VERT = /* glsl */ `varying vec3 vW; void main(){ vec4 w = modelMatrix * vec4(position, 1.0); vW = w.xyz; gl_Position = projectionMatrix * viewMatrix * w; }`;
16
+ const GROUND_FRAG = /* glsl */ `uniform vec3 uG; uniform vec3 uM; uniform vec3 uBg; uniform float uRoll; uniform vec3 uC; varying vec3 vW;
17
+ float box(vec2 p, vec2 b){ vec2 d = abs(p) - b; return max(d.x, d.y); }
18
+ void main(){
19
+ // runway frame: x across, z along; the runway slides under the gear by uRoll
20
+ float z = vW.z + uRoll;
21
+ float x = vW.x - 1.4;
22
+ float m = 0.0;
23
+ // centreline dashes, 0.4 wide, 3 m on 2 m off
24
+ float cz = mod(z, 5.0);
25
+ m = max(m, step(abs(x), 0.2) * step(cz, 3.0));
26
+ // edge bars, short blocks every 2.4 m
27
+ float ez = mod(z, 2.4);
28
+ m = max(m, step(abs(abs(x) - 6.0), 0.35) * step(ez, 1.2));
29
+ // touchdown zone stripes
30
+ float tz = mod(z + 1.0, 18.0);
31
+ m = max(m, step(abs(abs(x) - 2.6), 0.9) * step(abs(mod(x + 0.4, 0.8) - 0.4), 0.22) * step(tz, 4.0));
32
+ // a speckle so the ground reads as a surface
33
+ float n = fract(sin(dot(floor(vW.xz * 40.0), vec2(12.9898, 78.233))) * 43758.5453);
34
+ vec3 col = mix(uG, uM, m * 0.85) * (0.985 + 0.03 * n);
35
+ float d = length(vW.xz - uC.xz);
36
+ gl_FragColor = vec4(mix(col, uBg, smoothstep(5.0, 16.0, d)), 1.0);
37
+ }`;
38
+
39
+ // the airframe as a ghost: a fresnel shell, bright at the silhouette, nearly clear face on
40
+ const GHOST_VERT = /* glsl */ `varying vec3 vN; varying vec3 vV; void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vN = normalize(normalMatrix * normal); vV = normalize(-mv.xyz); gl_Position = projectionMatrix * mv; }`;
41
+ const GHOST_FRAG = /* glsl */ `uniform vec3 uCol; uniform float uA; varying vec3 vN; varying vec3 vV;
42
+ void main(){ float f = pow(1.0 - abs(dot(normalize(vN), normalize(vV))), 2.4); gl_FragColor = vec4(uCol, uA * (0.05 + 0.6 * f)); }`;
43
+ // the Skymaster's shape around the gear plate (the plate top is the belly, y = 0; the nose toward +z): a pod with the
44
+ // tractor engine forward and the pusher aft, a high wing, twin booms and the tail between them
45
+ function buildGhost(mat) {
46
+ const g = new THREE.Group();
47
+ const lathe = (prof, seg = 48) => new THREE.LatheGeometry(prof.map(([r, z]) => new THREE.Vector2(r, z)), seg);
48
+ const add = (geo, f) => {
49
+ const m = new THREE.Mesh(geo, mat);
50
+ m.renderOrder = 6;
51
+ f(m);
52
+ g.add(m);
53
+ return m;
54
+ };
55
+ // the pod along z (lathe about y, then turned onto z), a little flattened
56
+ const pod = lathe([[0.001, -2.6], [0.18, -2.5], [0.42, -2.0], [0.56, -1.1], [0.6, 0.0], [0.58, 1.0], [0.48, 1.8], [0.3, 2.35], [0.12, 2.6], [0.001, 2.65]]);
57
+ add(pod, (m) => {
58
+ m.rotation.x = Math.PI / 2;
59
+ m.scale.set(1, 1, 0.92);
60
+ m.position.set(0, 0.56, 0.2);
61
+ });
62
+ // the high wing
63
+ add(new THREE.BoxGeometry(9.2, 0.08, 0.95), (m) => m.position.set(0, 1.18, 0.15));
64
+ // twin booms and the tail
65
+ for (const x of [-1.25, 1.25]) {
66
+ add(new THREE.CylinderGeometry(0.1, 0.07, 3.6, 20), (m) => {
67
+ m.rotation.x = Math.PI / 2;
68
+ m.position.set(x, 1.05, -1.95);
69
+ });
70
+ add(new THREE.BoxGeometry(0.06, 0.75, 0.55), (m) => m.position.set(x, 1.38, -3.6));
71
+ }
72
+ add(new THREE.BoxGeometry(2.6, 0.05, 0.42), (m) => m.position.set(0, 1.62, -3.65));
73
+ // the two propellers' discs
74
+ add(new THREE.CylinderGeometry(0.85, 0.85, 0.01, 48), (m) => {
75
+ m.rotation.x = Math.PI / 2;
76
+ m.position.set(0, 0.62, 2.9);
77
+ });
78
+ add(new THREE.CylinderGeometry(0.85, 0.85, 0.01, 48), (m) => {
79
+ m.rotation.x = Math.PI / 2;
80
+ m.position.set(0, 0.62, -2.5);
81
+ });
82
+ return g;
83
+ }
84
+
85
+ export function createCessnaStage({canvas}) {
86
+ const renderer = new THREE.WebGLRenderer({canvas, antialias: false, preserveDrawingBuffer: true, powerPreference: 'high-performance'});
87
+ renderer.toneMapping = THREE.NeutralToneMapping;
88
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
89
+ renderer.shadowMap.enabled = true;
90
+ renderer.shadowMap.type = THREE.VSMShadowMap;
91
+ renderer.localClippingEnabled = true;
92
+ const scene = new THREE.Scene();
93
+ scene.background = new THREE.Color(COL.bg);
94
+ scene.fog = new THREE.Fog(COL.bg, 8, 22);
95
+ const camera = new THREE.PerspectiveCamera(28, 16 / 9, 0.02, 80);
96
+ const composer = new EffectComposer(renderer, new THREE.WebGLRenderTarget(4, 4, {type: THREE.HalfFloatType, samples: 8}));
97
+ composer.addPass(new RenderPass(scene, camera));
98
+ const gtao = new GTAOPass(scene, camera, 4, 4);
99
+ gtao.output = GTAOPass.OUTPUT.Default;
100
+ gtao.blendIntensity = 0.8;
101
+ gtao.updateGtaoMaterial({radius: 0.06, distanceExponent: 1.4, thickness: 0.6, scale: 1.0, samples: 16, distanceFallOff: 1.0, screenSpaceRadius: false});
102
+ gtao.updatePdMaterial({lumaPhi: 10, depthPhi: 2, normalPhi: 3, radius: 6, rings: 2, samples: 16});
103
+ class Toggle extends Pass {
104
+ constructor(fn) {
105
+ super();
106
+ this.needsSwap = false;
107
+ this.fn = fn;
108
+ }
109
+ render() {
110
+ this.fn();
111
+ }
112
+ }
113
+ const groundVis = (v) => () => {
114
+ ground.visible = v;
115
+ shade.visible = v;
116
+ for (const o of ghosts) o.visible = v && o.userData.on;
117
+ };
118
+ const ghosts = [];
119
+ composer.addPass(new Toggle(groundVis(false)));
120
+ composer.addPass(gtao);
121
+ composer.addPass(new Toggle(groundVis(true)));
122
+ composer.addPass(new OutputPass());
123
+
124
+ {
125
+ const env = new THREE.Scene();
126
+ env.background = new THREE.Color('#e9dcc6');
127
+ const box = (w, h, pos, k) => {
128
+ const m = new THREE.Mesh(new THREE.PlaneGeometry(w, h), new THREE.MeshBasicMaterial({color: new THREE.Color(1, 0.98, 0.95).multiplyScalar(k), side: THREE.DoubleSide}));
129
+ m.position.copy(pos);
130
+ m.lookAt(0, 0, 0);
131
+ env.add(m);
132
+ };
133
+ box(12, 12, new V3(0, 14, 2), 2.4);
134
+ box(3, 14, new V3(-12, 4, 6), 3.0);
135
+ box(3, 14, new V3(12, 4, -4), 2.0);
136
+ box(18, 2, new V3(0, 2, 14), 1.5);
137
+ const g = new THREE.Mesh(new THREE.CircleGeometry(40, 32), new THREE.MeshBasicMaterial({color: '#d8c6a8', side: THREE.DoubleSide}));
138
+ g.rotation.x = -Math.PI / 2;
139
+ g.position.y = -2;
140
+ env.add(g);
141
+ const pm = new THREE.PMREMGenerator(renderer);
142
+ scene.environment = pm.fromScene(env, 0.02).texture;
143
+ scene.environmentIntensity = 0.95;
144
+ pm.dispose();
145
+ }
146
+ const SUN_DIR = new V3(-0.35, 0.82, 0.45).normalize();
147
+ const sun = new THREE.DirectionalLight('#fff6ea', 2.3);
148
+ sun.castShadow = true;
149
+ const EXT = 1.6;
150
+ Object.assign(sun.shadow.camera, {left: -EXT, right: EXT, top: EXT, bottom: -EXT, near: 0.5, far: 20});
151
+ sun.shadow.mapSize.set(4096, 4096);
152
+ sun.shadow.radius = 10;
153
+ sun.shadow.blurSamples = 20;
154
+ sun.shadow.bias = -0.0003;
155
+ sun.shadow.normalBias = 0.002;
156
+ scene.add(sun, sun.target);
157
+ scene.add(new THREE.HemisphereLight('#fffaf2', '#d9c6a6', 0.65));
158
+
159
+ const groundMat = new THREE.ShaderMaterial({
160
+ vertexShader: GROUND_VERT,
161
+ fragmentShader: GROUND_FRAG,
162
+ uniforms: {uG: {value: new THREE.Color(COL.ground)}, uM: {value: new THREE.Color(COL.mark)}, uBg: {value: new THREE.Color(COL.bg)}, uRoll: {value: 0}, uC: {value: new V3()}},
163
+ toneMapped: false,
164
+ });
165
+ const ground = new THREE.Mesh(new THREE.PlaneGeometry(200, 200), groundMat);
166
+ ground.rotation.x = -Math.PI / 2;
167
+ scene.add(ground);
168
+ const shade = new THREE.Mesh(
169
+ new THREE.PlaneGeometry(200, 200),
170
+ new THREE.ShadowMaterial({color: COL.shadow, opacity: 0.3, polygonOffset: true, polygonOffsetFactor: -4, polygonOffsetUnits: -8}),
171
+ );
172
+ shade.rotation.x = -Math.PI / 2;
173
+ shade.receiveShadow = true;
174
+ scene.add(shade);
175
+
176
+ const gear = buildGear();
177
+ scene.add(gear.root);
178
+ const ghostMat = new THREE.ShaderMaterial({vertexShader: GHOST_VERT, fragmentShader: GHOST_FRAG, uniforms: {uCol: {value: new THREE.Color('#ffffff')}, uA: {value: 0}}, transparent: true, depthWrite: false, side: THREE.DoubleSide});
179
+ const ghost = buildGhost(ghostMat);
180
+ ghost.userData.on = false;
181
+ ghost.visible = false;
182
+ gear.root.add(ghost);
183
+ ghosts.push(ghost);
184
+
185
+ const size = {w: 1600, h: 900};
186
+ const resize = (w, h, pr) => {
187
+ size.w = w;
188
+ size.h = h;
189
+ renderer.setPixelRatio(pr);
190
+ renderer.setSize(w, h, false);
191
+ composer.setPixelRatio(pr);
192
+ composer.setSize(w, h);
193
+ camera.aspect = w / h;
194
+ camera.updateProjectionMatrix();
195
+ };
196
+ const tmp = new V3();
197
+ const right = new V3().crossVectors(new V3(0, 1, 0), SUN_DIR).normalize();
198
+ const upL = new V3().crossVectors(SUN_DIR, right);
199
+ let texel = (2 * EXT) / sun.shadow.mapSize.x;
200
+
201
+ // st: {stroke, roll (wheel spin), height (m above the down-locked ride), dist (m rolled)}
202
+ // cam: {tx, ty, tz, az, el, d (radians, metres), sx, sy}; the target is relative to the gear
203
+ const frame = (st, cam) => {
204
+ gear.update(st);
205
+ ghostMat.uniforms.uA.value = st.fuselage ?? 0;
206
+ ghost.userData.on = (st.fuselage ?? 0) > 0.01;
207
+ ghost.visible = ghost.userData.on;
208
+ const y = GROUND + (st.height ?? 0);
209
+ gear.root.position.set(0, y, 0);
210
+ groundMat.uniforms.uRoll.value = st.dist ?? 0;
211
+ const tx = cam.tx;
212
+ const ty = cam.ty + y;
213
+ const tz = cam.tz;
214
+ camera.position.set(tx + cam.d * Math.cos(cam.el) * Math.sin(cam.az), ty + cam.d * Math.sin(cam.el), tz + cam.d * Math.cos(cam.el) * Math.cos(cam.az));
215
+ camera.lookAt(tx, ty, tz);
216
+ camera.setViewOffset(size.w, size.h, -(cam.sx ?? 0), -(cam.sy ?? 0), size.w, size.h);
217
+ camera.updateMatrixWorld();
218
+ groundMat.uniforms.uC.value.set(tx, 0, tz);
219
+ tmp.set(0, y * 0.5, 0);
220
+ const rr = Math.round(tmp.dot(right) / texel) * texel;
221
+ const uu = Math.round(tmp.dot(upL) / texel) * texel;
222
+ sun.target.position.copy(right).multiplyScalar(rr).addScaledVector(upL, uu).addScaledVector(SUN_DIR, tmp.dot(SUN_DIR));
223
+ sun.position.copy(sun.target.position).addScaledVector(SUN_DIR, 8);
224
+ sun.target.updateMatrixWorld();
225
+ composer.render();
226
+ };
227
+ const pv = new V3();
228
+ const project = (x, y, z) => {
229
+ pv.set(x, y, z).project(camera);
230
+ if (pv.z > 1) return null;
231
+ return [(pv.x * 0.5 + 0.5) * size.w, (-pv.y * 0.5 + 0.5) * size.h];
232
+ };
233
+ const setQuality = ({samples, ao, shadow}) => {
234
+ if (samples !== undefined)
235
+ for (const t of [composer.renderTarget1, composer.renderTarget2]) {
236
+ t.samples = samples;
237
+ t.dispose();
238
+ }
239
+ if (ao !== undefined) gtao.enabled = ao;
240
+ if (shadow !== undefined) {
241
+ sun.shadow.mapSize.set(shadow, shadow);
242
+ sun.shadow.map?.dispose();
243
+ sun.shadow.map = null;
244
+ texel = (2 * EXT) / shadow;
245
+ }
246
+ };
247
+ return {renderer, scene, camera, gear, composer, gtao, sun, resize, frame, project, size, ghosts, setQuality};
248
+ }