@lewismoten/gamemaker-sandbox-tools 3.1.0 → 3.4.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/CHANGELOG.md +44 -0
- package/NOTICE.md +105 -3
- package/README.md +301 -15
- package/dist/audio-files.js +82 -0
- package/dist/audio.js +23 -138
- package/dist/block-merge.js +43 -0
- package/dist/color-reduce.js +44 -0
- package/dist/colors.js +87 -0
- package/dist/delta.js +75 -0
- package/dist/disk-diff.js +220 -0
- package/dist/drawing.js +83 -869
- package/dist/embroidery/compile.js +85 -0
- package/dist/embroidery/dst.js +79 -0
- package/dist/embroidery/exp.js +26 -0
- package/dist/embroidery/fill.js +49 -0
- package/dist/embroidery/geom.js +82 -0
- package/dist/embroidery/pes.js +79 -0
- package/dist/embroidery/satin.js +29 -0
- package/dist/embroidery/simulate.js +30 -0
- package/dist/embroidery/strokeFont.js +253 -0
- package/dist/embroidery/svg.js +24 -0
- package/dist/embroidery/types.js +13 -0
- package/dist/embroidery/units.js +26 -0
- package/dist/embroidery/validate.js +15 -0
- package/dist/formats/blocks.js +1 -103
- package/dist/formats/character.js +1 -83
- package/dist/formats/cmf.js +1 -37
- package/dist/formats/fli.js +1 -296
- package/dist/formats/fliLimits.js +1 -54
- package/dist/formats/game.js +1 -193
- package/dist/formats/gif.js +1 -125
- package/dist/formats/graphicScripts.js +1 -44
- package/dist/formats/map.js +1 -38
- package/dist/formats/monster.js +1 -69
- package/dist/formats/palette.js +1 -58
- package/dist/formats/recording.js +1 -17
- package/dist/formats/sound.js +1 -44
- package/dist/formats/voc.js +1 -303
- package/dist/gif-shrink.js +56 -0
- package/dist/image/png.js +42 -0
- package/dist/images.js +81 -43
- package/dist/kit/actors.js +19 -0
- package/dist/kit/align.js +204 -0
- package/dist/kit/blit.js +45 -0
- package/dist/kit/blockRoles.js +97 -0
- package/dist/kit/clips.js +40 -0
- package/dist/kit/coverPaint.js +18 -0
- package/dist/kit/disk.js +76 -0
- package/dist/kit/fadeOut.js +13 -0
- package/dist/kit/fliClips.js +133 -0
- package/dist/kit/fliShrink.js +277 -0
- package/dist/kit/gameSim.js +235 -0
- package/dist/kit/hopBot.js +142 -0
- package/dist/kit/levelGen.js +1423 -0
- package/dist/kit/levelGrid.js +33 -0
- package/dist/kit/levelPicture.js +27 -0
- package/dist/kit/menuVersion.js +19 -0
- package/dist/kit/microText.js +35 -0
- package/dist/kit/mumble.js +74 -0
- package/dist/kit/music.js +8 -0
- package/dist/kit/palRamps.js +32 -0
- package/dist/kit/palette.js +49 -0
- package/dist/kit/pcText.js +72 -0
- package/dist/kit/photo.js +150 -0
- package/dist/kit/pixels.js +79 -0
- package/dist/kit/png.js +40 -0
- package/dist/kit/quantize.js +72 -0
- package/dist/kit/raytrace.js +379 -0
- package/dist/kit/recordedDemo.js +10 -0
- package/dist/kit/reel.js +77 -0
- package/dist/kit/road3d.js +67 -0
- package/dist/kit/routeChecks.js +8 -0
- package/dist/kit/saveSlots.js +11 -0
- package/dist/kit/sceneInit.js +13 -0
- package/dist/kit/sceneSim.js +112 -0
- package/dist/kit/screenText.js +15 -0
- package/dist/kit/sdftext.js +237 -0
- package/dist/kit/shading.js +69 -0
- package/dist/kit/song.js +251 -0
- package/dist/kit/songFx.js +179 -0
- package/dist/kit/sound.js +52 -0
- package/dist/kit/synthParts.js +20 -0
- package/dist/kit/tar.js +53 -0
- package/dist/kit/textBounds.js +84 -0
- package/dist/kit/textfit.js +246 -0
- package/dist/kit/transforms.js +57 -0
- package/dist/kit/tune.js +21 -0
- package/dist/look-alike.js +50 -0
- package/dist/menu-version.js +4 -0
- package/dist/mesh/colorBodies.js +137 -0
- package/dist/mesh/decimate.js +207 -0
- package/dist/mesh/meshCheck.js +51 -0
- package/dist/mesh/overhang.js +41 -0
- package/dist/mesh/sampledField.js +12 -0
- package/dist/mesh/stl.js +36 -0
- package/dist/mesh/surfaceNets.js +79 -0
- package/dist/mesh/tetraMesh.js +62 -0
- package/dist/mesh/threeMf.js +58 -0
- package/dist/mesh/zipFile.js +52 -0
- package/dist/microFont.js +101 -0
- package/dist/music/compose.js +72 -0
- package/dist/pack/meshPack.js +198 -0
- package/dist/pack/threeMfPack.js +92 -0
- package/dist/palette-reserve.js +116 -0
- package/dist/palettes.js +138 -0
- package/dist/release-notes.js +40 -0
- package/dist/simulation.js +16 -2774
- package/dist/text.js +74 -0
- package/dist/types/audio.d.ts +4 -0
- package/dist/types/audioFiles.d.ts +22 -0
- package/dist/types/audioWav.d.ts +4 -0
- package/dist/types/blockMerge.d.ts +24 -0
- package/dist/types/colorReduce.d.ts +23 -0
- package/dist/types/{web/packages/tools/src/colors.d.ts → colors.d.ts} +6 -0
- package/dist/types/delta.d.ts +32 -0
- package/dist/types/diskDiff.d.ts +47 -0
- package/dist/types/drawing.d.ts +15 -0
- package/dist/types/embroidery/compile.d.ts +3 -0
- package/dist/types/embroidery/dst.d.ts +13 -0
- package/dist/types/embroidery/exp.d.ts +8 -0
- package/dist/types/embroidery/fill.d.ts +6 -0
- package/dist/types/embroidery/geom.d.ts +19 -0
- package/dist/types/embroidery/pes.d.ts +10 -0
- package/dist/types/embroidery/satin.d.ts +11 -0
- package/dist/types/embroidery/simulate.d.ts +19 -0
- package/dist/types/embroidery/strokeFont.d.ts +20 -0
- package/dist/types/embroidery/svg.d.ts +3 -0
- package/dist/types/embroidery/types.d.ts +70 -0
- package/dist/types/embroidery/units.d.ts +10 -0
- package/dist/types/embroidery/validate.d.ts +22 -0
- package/dist/types/formats/blocks.d.ts +1 -0
- package/dist/types/formats/character.d.ts +1 -0
- package/dist/types/formats/cmf.d.ts +1 -0
- package/dist/types/formats/fli.d.ts +1 -0
- package/dist/types/formats/fliLimits.d.ts +1 -0
- package/dist/types/formats/game.d.ts +1 -0
- package/dist/types/formats/gif.d.ts +1 -0
- package/dist/types/formats/graphicScripts.d.ts +1 -0
- package/dist/types/formats/map.d.ts +1 -0
- package/dist/types/formats/monster.d.ts +1 -0
- package/dist/types/formats/palette.d.ts +1 -0
- package/dist/types/formats/recording.d.ts +1 -0
- package/dist/types/formats/sound.d.ts +1 -0
- package/dist/types/formats/voc.d.ts +1 -0
- package/dist/types/gifShrink.d.ts +8 -0
- package/dist/types/image/animatedGif.d.ts +9 -0
- package/dist/types/image/surface.d.ts +26 -0
- package/dist/types/images.d.ts +13 -0
- package/dist/types/kit/actors.d.ts +7 -0
- package/dist/types/kit/align.d.ts +93 -0
- package/dist/types/kit/audioEvents.d.ts +26 -0
- package/dist/types/kit/blit.d.ts +20 -0
- package/dist/types/kit/blockRoles.d.ts +243 -0
- package/dist/types/{games/kit → kit}/clips.d.ts +1 -1
- package/dist/types/kit/coverPaint.d.ts +7 -0
- package/dist/types/kit/disk.d.ts +15 -0
- package/dist/types/kit/fadeOut.d.ts +12 -0
- package/dist/types/kit/fliClips.d.ts +32 -0
- package/dist/types/kit/fliShrink.d.ts +149 -0
- package/dist/types/{games/kit → kit}/gameSim.d.ts +9 -5
- package/dist/types/kit/hopBot.d.ts +72 -0
- package/dist/types/kit/laserClearance.d.ts +16 -0
- package/dist/types/kit/laserJoints.d.ts +39 -0
- package/dist/types/kit/laserLayout.d.ts +54 -0
- package/dist/types/kit/laserPixels.d.ts +52 -0
- package/dist/types/kit/laserPreview.d.ts +9 -0
- package/dist/types/kit/laserSvg.d.ts +35 -0
- package/dist/types/kit/levelGen/castle.d.ts +17 -0
- package/dist/types/kit/levelGen/dungeon.d.ts +11 -0
- package/dist/types/kit/levelGen/forest.d.ts +17 -0
- package/dist/types/kit/levelGen/furnish.d.ts +31 -0
- package/dist/types/kit/levelGen/grid.d.ts +46 -0
- package/dist/types/kit/levelGen/index.d.ts +138 -0
- package/dist/types/kit/levelGen/interior.d.ts +18 -0
- package/dist/types/kit/levelGen/jumpModel.d.ts +78 -0
- package/dist/types/kit/levelGen/needs.d.ts +44 -0
- package/dist/types/kit/levelGen/overworld.d.ts +21 -0
- package/dist/types/kit/levelGen/platform.d.ts +59 -0
- package/dist/types/kit/levelGen/platformCap.d.ts +13 -0
- package/dist/types/kit/levelGen/platformReach.d.ts +37 -0
- package/dist/types/kit/levelGen/props.d.ts +37 -0
- package/dist/types/kit/levelGen/town.d.ts +24 -0
- package/dist/types/kit/levelGrid.d.ts +16 -0
- package/dist/types/kit/levelPicture.d.ts +9 -0
- package/dist/types/kit/menuVersion.d.ts +7 -0
- package/dist/types/kit/microText.d.ts +18 -0
- package/dist/types/kit/mumble.d.ts +41 -0
- package/dist/types/kit/music.d.ts +1 -0
- package/dist/types/kit/palMerge.d.ts +10 -0
- package/dist/types/kit/palRamps.d.ts +28 -0
- package/dist/types/kit/pcText.d.ts +19 -0
- package/dist/types/kit/photo.d.ts +69 -0
- package/dist/types/kit/png.d.ts +7 -0
- package/dist/types/kit/quantize.d.ts +20 -0
- package/dist/types/kit/raytrace.d.ts +169 -0
- package/dist/types/kit/recordedDemo.d.ts +1 -0
- package/dist/types/kit/road3d.d.ts +71 -0
- package/dist/types/kit/routeChecks.d.ts +6 -0
- package/dist/types/kit/saveSlots.d.ts +17 -0
- package/dist/types/kit/sceneInit.d.ts +11 -0
- package/dist/types/{games/kit → kit}/sceneSim.d.ts +5 -5
- package/dist/types/kit/screenText.d.ts +3 -0
- package/dist/types/kit/sdftext.d.ts +34 -0
- package/dist/types/kit/shading.d.ts +23 -0
- package/dist/types/kit/shareBlocks.d.ts +20 -0
- package/dist/types/kit/song.d.ts +89 -0
- package/dist/types/kit/songFx.d.ts +99 -0
- package/dist/types/kit/synthParts.d.ts +7 -0
- package/dist/types/kit/tar.d.ts +13 -0
- package/dist/types/kit/textfit.d.ts +74 -0
- package/dist/types/kit/transforms.d.ts +8 -0
- package/dist/types/lookAlike.d.ts +31 -0
- package/dist/types/menuVersionEntry.d.ts +1 -0
- package/dist/types/mesh/colorBodies.d.ts +18 -0
- package/dist/types/mesh/decimate.d.ts +10 -0
- package/dist/types/mesh/fieldTrinket.d.ts +40 -0
- package/dist/types/mesh/figureShapes.d.ts +24 -0
- package/dist/types/mesh/mesh.d.ts +9 -0
- package/dist/types/mesh/meshCheck.d.ts +22 -0
- package/dist/types/mesh/overhang.d.ts +24 -0
- package/dist/types/mesh/pixelFigure.d.ts +41 -0
- package/dist/types/mesh/sampledField.d.ts +3 -0
- package/dist/types/mesh/sdfShapes.d.ts +20 -0
- package/dist/types/mesh/stl.d.ts +9 -0
- package/dist/types/mesh/strokeText.d.ts +8 -0
- package/dist/types/mesh/surfaceNets.d.ts +14 -0
- package/dist/types/mesh/tetraMesh.d.ts +4 -0
- package/dist/types/mesh/threeMf.d.ts +12 -0
- package/dist/types/mesh/trinketKinds.d.ts +72 -0
- package/dist/types/mesh/trinketTool.d.ts +26 -0
- package/dist/types/mesh/voxel.d.ts +10 -0
- package/dist/types/mesh/zipFile.d.ts +13 -0
- package/dist/types/microFont.d.ts +6 -0
- package/dist/types/pack/meshPack.d.ts +26 -0
- package/dist/types/pack/threeMfPack.d.ts +11 -0
- package/dist/types/palettePresetData.d.ts +4 -0
- package/dist/types/palettePresets.d.ts +12 -0
- package/dist/types/paletteReserve.d.ts +52 -0
- package/dist/types/palettes.d.ts +4 -0
- package/dist/types/releaseNotes.d.ts +3 -0
- package/dist/types/simulation.d.ts +6 -0
- package/dist/types/{web/packages/tools/src/text.d.ts → text.d.ts} +6 -6
- package/package.json +145 -15
- package/dist/binary-D7wuaC5g.js +0 -120
- package/dist/pixels-DzfIIUOl.js +0 -76
- package/dist/types/games/kit/blit.d.ts +0 -10
- package/dist/types/games/kit/music.d.ts +0 -1
- package/dist/types/games/kit/pcText.d.ts +0 -8
- package/dist/types/games/kit/shading.d.ts +0 -11
- package/dist/types/web/packages/tools/src/audio.d.ts +0 -3
- package/dist/types/web/packages/tools/src/drawing.d.ts +0 -10
- package/dist/types/web/packages/tools/src/images.d.ts +0 -2
- package/dist/types/web/packages/tools/src/microFont.d.ts +0 -1
- package/dist/types/web/packages/tools/src/simulation.d.ts +0 -3
- package/dist/types/web/scripts/cdGames.d.ts +0 -103
- package/dist/types/web/scripts/gameShots.d.ts +0 -12
- package/dist/types/web/scripts/ogImage.d.ts +0 -21
- package/dist/types/web/src/audio/cmfLoad.d.ts +0 -7
- package/dist/types/web/src/audio/cmfPlayer.d.ts +0 -69
- package/dist/types/web/src/audio/context.d.ts +0 -12
- package/dist/types/web/src/audio/engine.d.ts +0 -39
- package/dist/types/web/src/audio/music.worklet.d.ts +0 -14
- package/dist/types/web/src/audio/opl.d.ts +0 -37
- package/dist/types/web/src/audio/output.d.ts +0 -13
- package/dist/types/web/src/desk/boxes/boxFacts.d.ts +0 -85
- package/dist/types/web/src/dosPlayer/fileExtensions.d.ts +0 -44
- package/dist/types/web/src/dosPlayer/patchRules.d.ts +0 -24
- package/dist/types/web/src/dosPlayer/patchTable.d.ts +0 -80
- package/dist/types/web/src/edition.d.ts +0 -6
- package/dist/types/web/src/eggs/eggState.d.ts +0 -26
- package/dist/types/web/src/eggs/eggs.d.ts +0 -31
- package/dist/types/web/src/engine/character.d.ts +0 -30
- package/dist/types/web/src/engine/funcKeys.d.ts +0 -33
- package/dist/types/web/src/engine/game.d.ts +0 -52
- package/dist/types/web/src/engine/keys.d.ts +0 -17
- package/dist/types/web/src/engine/machine.d.ts +0 -99
- package/dist/types/web/src/engine/menus.d.ts +0 -46
- package/dist/types/web/src/engine/monsters.d.ts +0 -19
- package/dist/types/web/src/engine/playGain.d.ts +0 -11
- package/dist/types/web/src/engine/playerLook.d.ts +0 -26
- package/dist/types/web/src/engine/recorder.d.ts +0 -60
- package/dist/types/web/src/engine/render.d.ts +0 -8
- package/dist/types/web/src/engine/scene.d.ts +0 -156
- package/dist/types/web/src/engine/scroll.d.ts +0 -16
- package/dist/types/web/src/engine/showGraphic.d.ts +0 -39
- package/dist/types/web/src/engine/slowPc.d.ts +0 -62
- package/dist/types/web/src/engine/touch.d.ts +0 -33
- package/dist/types/web/src/engine/world.d.ts +0 -215
- package/dist/types/web/src/export/gameAbout.d.ts +0 -15
- package/dist/types/web/src/formats/binary.d.ts +0 -44
- package/dist/types/web/src/formats/blocks.d.ts +0 -52
- package/dist/types/web/src/formats/character.d.ts +0 -65
- package/dist/types/web/src/formats/cmf.d.ts +0 -33
- package/dist/types/web/src/formats/fli.d.ts +0 -45
- package/dist/types/web/src/formats/fliLimits.d.ts +0 -13
- package/dist/types/web/src/formats/game.d.ts +0 -72
- package/dist/types/web/src/formats/gif.d.ts +0 -15
- package/dist/types/web/src/formats/graphicScripts.d.ts +0 -18
- package/dist/types/web/src/formats/highscore.d.ts +0 -10
- package/dist/types/web/src/formats/map.d.ts +0 -24
- package/dist/types/web/src/formats/monster.d.ts +0 -48
- package/dist/types/web/src/formats/palette.d.ts +0 -15
- package/dist/types/web/src/formats/recording.d.ts +0 -7
- package/dist/types/web/src/formats/sound.d.ts +0 -13
- package/dist/types/web/src/formats/voc.d.ts +0 -13
- package/dist/types/web/src/gfx/cp437Glyphs.d.ts +0 -2
- package/dist/types/web/src/gfx/font8x8.d.ts +0 -2
- package/dist/types/web/src/gfx/levelPicture.d.ts +0 -81
- package/dist/types/web/src/gfx/screen.d.ts +0 -46
- package/dist/types/web/src/gfx/titlePicture.d.ts +0 -21
- package/dist/types/web/src/input/chords.d.ts +0 -22
- package/dist/types/web/src/input/deskMouse.d.ts +0 -14
- package/dist/types/web/src/input/keyboard.d.ts +0 -39
- package/dist/types/web/src/input/scancodes.d.ts +0 -3
- package/dist/types/web/src/manual/printables/types.d.ts +0 -277
- package/dist/types/web/src/project/bizarre.d.ts +0 -28
- package/dist/types/web/src/project/companion.d.ts +0 -35
- package/dist/types/web/src/project/diskFacts.d.ts +0 -30
- package/dist/types/web/src/project/files.d.ts +0 -124
- package/dist/types/web/src/project/gameFiles.d.ts +0 -49
- package/dist/types/web/src/project/gamePack.d.ts +0 -17
- package/dist/types/web/src/project/health.d.ts +0 -30
- package/dist/types/web/src/project/secretGames.d.ts +0 -19
- package/dist/types/web/src/project/storage.d.ts +0 -46
- package/dist/types/web/src/project/streamGame.d.ts +0 -38
- package/dist/types/web/src/project/zip.d.ts +0 -33
- package/dist/types/web/src/retro/dos/disks.d.ts +0 -33
- package/dist/types/web/src/retro/text/cp437.d.ts +0 -4
- package/dist/types/web/src/seededRandom.d.ts +0 -6
- package/dist/types/web/src/tinHearts/deskHearts.d.ts +0 -33
- package/dist/types/web/src/tinHearts/manifest.d.ts +0 -30
- package/dist/types/web/src/tinHearts/tinHearts.d.ts +0 -84
- package/dist/types/web/src/walkthrough/format.d.ts +0 -92
- package/dist/types/web/src/walkthrough/madeUpScores.d.ts +0 -6
- package/dist/types/web/src/walkthrough/runtime.d.ts +0 -134
- /package/dist/types/{web/src/assistant → image}/png.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/palette.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/pixels.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/reel.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/sound.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/textBounds.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/tune.d.ts +0 -0
- /package/dist/types/{web/src/audio → music}/compose.d.ts +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export declare const W = 320;
|
|
2
|
+
export declare const H = 200;
|
|
3
|
+
type RGB = [number, number, number];
|
|
4
|
+
/** A string PLAYGAME writes, in a palette index, at a pixel position. */
|
|
5
|
+
interface TextItem {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
col: number;
|
|
9
|
+
text: string;
|
|
10
|
+
/** The color PLAYGAME asked for (RGBRed and friends); flagged when the screen shows something else. */
|
|
11
|
+
want?: RGB;
|
|
12
|
+
/** Marker boxes (menu cursors) are solid fills, not glyphs. */
|
|
13
|
+
box?: {
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** One screen as shown: the picture under the text, the palette on the DAC and the text. */
|
|
19
|
+
export interface TextScreen {
|
|
20
|
+
/** Where it comes from, e.g. "help.lst > help.txt p1". */
|
|
21
|
+
name: string;
|
|
22
|
+
kind: 'page' | 'menu' | 'scores' | 'load' | 'save';
|
|
23
|
+
pixels: Uint8Array;
|
|
24
|
+
palette: Uint8Array;
|
|
25
|
+
texts: TextItem[];
|
|
26
|
+
}
|
|
27
|
+
export interface TextFitIssue {
|
|
28
|
+
screen: string;
|
|
29
|
+
text: string;
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
/** Background pixels near the letters that are not the paper under them. */
|
|
33
|
+
artPixels: number;
|
|
34
|
+
/** WCAG contrast ratio of the text color against its paper. */
|
|
35
|
+
contrast: number;
|
|
36
|
+
problems: string[];
|
|
37
|
+
}
|
|
38
|
+
interface TextFitOptions {
|
|
39
|
+
/** Pixels around each line that must be plain paper (default 2). */
|
|
40
|
+
margin?: number;
|
|
41
|
+
/** RGB distance (8-bit) from the paper that counts as art (default 72). */
|
|
42
|
+
artDistance?: number;
|
|
43
|
+
/** Art pixels tolerated per line (default 0). */
|
|
44
|
+
allowArt?: number;
|
|
45
|
+
/** Lowest contrast ratio allowed (default 3). */
|
|
46
|
+
minContrast?: number;
|
|
47
|
+
}
|
|
48
|
+
export declare function readDisk(dir: string): Map<string, Uint8Array>;
|
|
49
|
+
/**
|
|
50
|
+
* Every screen where PLAYGAME draws text over this game's pictures. `ink` is the text pages' RGB
|
|
51
|
+
* (6-bit), when a game's player patches color.rgb.purple.
|
|
52
|
+
*/
|
|
53
|
+
export declare function textScreens(files: Map<string, Uint8Array>, ink?: RGB): TextScreen[];
|
|
54
|
+
/** Marks every art pixel (not paper) inside a text zone; returns the issues. */
|
|
55
|
+
export declare function checkTextScreen(s: TextScreen, opts?: TextFitOptions, marks?: Uint8Array): TextFitIssue[];
|
|
56
|
+
/** The screen as the player sees it, as 8-bit RGB, with art pixels near text tinted magenta when `marks` is given. */
|
|
57
|
+
export declare function renderRgb(s: TextScreen, marks?: Uint8Array): Uint8Array;
|
|
58
|
+
/** A picture shown between levels (a level scene's intro or ending list), with its palette. */
|
|
59
|
+
export interface CardScreen {
|
|
60
|
+
name: string;
|
|
61
|
+
pixels: Uint8Array;
|
|
62
|
+
palette: Uint8Array;
|
|
63
|
+
}
|
|
64
|
+
/** The pictures every level scene shows around play (slots 9 and 10), as the player sees them. */
|
|
65
|
+
export declare function levelCards(files: Map<string, Uint8Array>): CardScreen[];
|
|
66
|
+
/**
|
|
67
|
+
* Words baked into a Starter card (games/kit/starter/screens.ts cardPicture) that run past its
|
|
68
|
+
* parchment box. The box is found from the pixel at (24, 16): the run of that color left, right,
|
|
69
|
+
* up and down. Text colors are the other colors inside the box; the frame's colors (read just
|
|
70
|
+
* outside the box above the text) are not counted. Returns a problem per side, or none. A picture
|
|
71
|
+
* with no such box (a card of another design) is skipped, since there is no box to measure.
|
|
72
|
+
*/
|
|
73
|
+
export declare function cardOverflow(c: CardScreen): string[];
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Pixels } from './pixels.js';
|
|
2
|
+
export declare function resampleBlit(dst: Pixels, src: Pixels, x: number, y: number, s: number, flip?: boolean): Pixels;
|
|
3
|
+
export declare function turn45(src: Pixels, scale?: number): Pixels;
|
|
4
|
+
export declare function turn90(src: Pixels): Pixels;
|
|
5
|
+
export declare function turn180(src: Pixels): Pixels;
|
|
6
|
+
export declare function flipX(src: Pixels): Pixels;
|
|
7
|
+
export declare function flipY(src: Pixels): Pixels;
|
|
8
|
+
export declare function rotate(src: Pixels, deg: number): Pixels;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Block } from '@lewismoten/gamemaker-sandbox-engine/formats/blocks';
|
|
2
|
+
import type { GameMap } from '@lewismoten/gamemaker-sandbox-engine/formats/map';
|
|
3
|
+
export interface LookInput {
|
|
4
|
+
blocks: Block[];
|
|
5
|
+
/** Every palette (768 bytes) a scene using this set shows. */
|
|
6
|
+
palettes: Uint8Array[];
|
|
7
|
+
/** Block numbers the set's maps draw, plus what they turn into (the closure). */
|
|
8
|
+
used: ReadonlySet<number>;
|
|
9
|
+
/** Numbers that must keep their number and picture game-wide (block 0, pickups, required and starting inventory). */
|
|
10
|
+
pinned: ReadonlySet<number>;
|
|
11
|
+
}
|
|
12
|
+
export interface LookGroup {
|
|
13
|
+
/** The block that stays: the pinned one if any, else the lowest number. */
|
|
14
|
+
keep: number;
|
|
15
|
+
/** The blocks that go; each is drawn exactly as `keep` is, and plays the same. */
|
|
16
|
+
fold: number[];
|
|
17
|
+
}
|
|
18
|
+
export interface LookResult {
|
|
19
|
+
groups: LookGroup[];
|
|
20
|
+
/** Groups left alone because two of their blocks are pinned. */
|
|
21
|
+
pinnedGroups: number[][];
|
|
22
|
+
/** Blocks of one shape in different colors (not folded). */
|
|
23
|
+
colorVariants: number[][];
|
|
24
|
+
}
|
|
25
|
+
export declare function findLookAlikes({ blocks, palettes, used, pinned }: LookInput): LookResult;
|
|
26
|
+
/** The set with every folded block gone: `to[n]` is where block n went (itself if it stayed), maps renumbered. */
|
|
27
|
+
export declare function applyFold(blocks: Block[], maps: GameMap[], groups: LookGroup[]): {
|
|
28
|
+
blocks: Block[];
|
|
29
|
+
maps: GameMap[];
|
|
30
|
+
to: number[];
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { stampMenuVersion, type MenuVersionSpot } from './kit/menuVersion.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Mesh, Vec3 } from './mesh.js';
|
|
2
|
+
export type Rgb = [number, number, number];
|
|
3
|
+
/** Up to `max` colors that stand for the mesh's triangle colors (by area), those closer than `merge` joined. */
|
|
4
|
+
export declare function pickPalette(mesh: Mesh, max?: number, merge?: number): Rgb[];
|
|
5
|
+
export interface BodiesOptions {
|
|
6
|
+
min: Vec3;
|
|
7
|
+
max: Vec3;
|
|
8
|
+
cell: number;
|
|
9
|
+
/** Thin each body's mesh to within this distance of its surface (see decimate.ts). */
|
|
10
|
+
simplify?: number;
|
|
11
|
+
/** The volume the bodies together should have (the whole figure's): they are grown a hair if the mesher left them short. */
|
|
12
|
+
volume?: number;
|
|
13
|
+
}
|
|
14
|
+
/** One closed body per palette color (a color with no solid of its own is left out). */
|
|
15
|
+
export declare function colorBodies(mesh: Mesh, palette: Rgb[], field: (x: number, y: number, z: number) => number, o: BodiesOptions): {
|
|
16
|
+
color: Rgb;
|
|
17
|
+
mesh: Mesh;
|
|
18
|
+
}[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Mesh } from './mesh.js';
|
|
2
|
+
export interface DecimateOptions {
|
|
3
|
+
/** The largest distance, in the mesh's units, a collapse may move the surface (the cost limit is its square, times the planes meeting there). */
|
|
4
|
+
maxError: number;
|
|
5
|
+
/** Colors further apart than this (0-255 steps) make an edge a color border to hold in place (default 30). */
|
|
6
|
+
colorStep?: number;
|
|
7
|
+
/** Never go below this many triangles (default 4). */
|
|
8
|
+
minTriangles?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function decimate(mesh: Mesh, o: DecimateOptions): Mesh;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type MeshReport } from './meshCheck.js';
|
|
2
|
+
import type { Mesh } from './mesh.js';
|
|
3
|
+
import { type Rgb } from './colorBodies.js';
|
|
4
|
+
import { type Overhang } from './overhang.js';
|
|
5
|
+
export type V3 = [number, number, number];
|
|
6
|
+
export interface FieldTrinketInput {
|
|
7
|
+
/** Signed distance in mm (negative inside); must be positive below z = 0 so the floor is flat. */
|
|
8
|
+
mm: (x: number, y: number, z: number) => number;
|
|
9
|
+
/** The 0-255 color of the surface at a point, given its outward normal. */
|
|
10
|
+
colorAt: (x: number, y: number, z: number, normal: V3) => Rgb;
|
|
11
|
+
/** The box the mesh is sampled in, in mm. */
|
|
12
|
+
box: {
|
|
13
|
+
min: V3;
|
|
14
|
+
max: V3;
|
|
15
|
+
};
|
|
16
|
+
/** Filament colors (at most four), when the automatic pick would join two the eye must tell apart. */
|
|
17
|
+
palette?: Rgb[];
|
|
18
|
+
/** The grid of the color bodies in mm (default 1.5): finer when the trinket has gaps or details under 1.5 mm. */
|
|
19
|
+
bodyCell?: number;
|
|
20
|
+
/** How many separate solids the trinket is made of (default 1): a coin cut into pieces is 3. */
|
|
21
|
+
pieces?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface FieldTrinket {
|
|
24
|
+
mesh: Mesh;
|
|
25
|
+
report: MeshReport;
|
|
26
|
+
/** The pieces left when the surface is eroded by half a millimeter (of at least a speck's size). */
|
|
27
|
+
erodedPieces: number;
|
|
28
|
+
/** Specks the eroded surface leaves: parts thinner than a millimeter that would not print. */
|
|
29
|
+
erodedSpecks: number;
|
|
30
|
+
overhang: Overhang;
|
|
31
|
+
bodies: {
|
|
32
|
+
color: Rgb;
|
|
33
|
+
mesh: Mesh;
|
|
34
|
+
}[];
|
|
35
|
+
wholeVolume: number;
|
|
36
|
+
field: (x: number, y: number, z: number) => number;
|
|
37
|
+
support?: Mesh;
|
|
38
|
+
}
|
|
39
|
+
/** Mesh and check a trinket's field. `cell` is the mesh's cell in mm (default 0.95). */
|
|
40
|
+
export declare function meshFieldTrinket(input: FieldTrinketInput, cell?: number): FieldTrinket;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Rgb } from './colorBodies.js';
|
|
2
|
+
import type { D3 } from './sdfShapes.js';
|
|
3
|
+
/** An ellipsoid centered at (cx, cy, cz) with radii rx, ry, rz (a close estimate of the distance, good for meshing). */
|
|
4
|
+
export declare const ellipsoid3: (cx: number, cy: number, cz: number, rx: number, ry: number, rz: number) => D3;
|
|
5
|
+
/** A rounded cone (a capsule that is r0 wide at a and r1 wide at b). */
|
|
6
|
+
export declare const roundCone3: (ax: number, ay: number, az: number, r0: number, bx: number, by: number, bz: number, r1: number) => D3;
|
|
7
|
+
/** The smooth union of fields: parts melt together over about `k` mm. */
|
|
8
|
+
export declare const smoothUnion3: (k: number, ...fs: D3[]) => D3;
|
|
9
|
+
/** A field turned about the z axis by `a` radians and moved by (dx, dy, dz). */
|
|
10
|
+
export declare const place3: (f: D3, a: number, dx?: number, dy?: number, dz?: number) => D3;
|
|
11
|
+
/** A field made bigger (or smaller) by `k`, about the origin. */
|
|
12
|
+
export declare const scale3: (f: D3, k: number) => D3;
|
|
13
|
+
export interface FigurePart {
|
|
14
|
+
d: D3;
|
|
15
|
+
color: Rgb;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A figure of colored parts: the parts melt together over `blend` mm, the floor is flattened onto z = 0, and a surface point
|
|
19
|
+
* takes the color of the part whose own surface it is nearest to (so a comb or an eye keeps its color where it meets the head).
|
|
20
|
+
*/
|
|
21
|
+
export declare function figure(parts: FigurePart[], blend?: number): {
|
|
22
|
+
mm: D3;
|
|
23
|
+
colorAt: (x: number, y: number, z: number) => Rgb;
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface Mesh {
|
|
2
|
+
/** x, y, z per vertex. */
|
|
3
|
+
positions: Float32Array;
|
|
4
|
+
/** Three vertex numbers per triangle. */
|
|
5
|
+
indices: Uint32Array;
|
|
6
|
+
/** Optional color per triangle: r, g, b (0-255) each. */
|
|
7
|
+
colors?: Uint8Array;
|
|
8
|
+
}
|
|
9
|
+
export type Vec3 = [number, number, number];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Mesh, Vec3 } from './mesh.js';
|
|
2
|
+
export interface MeshReport {
|
|
3
|
+
triangles: number;
|
|
4
|
+
vertices: number;
|
|
5
|
+
/** Edges that belong to one triangle or three or more (a closed mesh has none). */
|
|
6
|
+
badEdges: number;
|
|
7
|
+
/** Edges two triangles walk the same way (a flipped triangle). */
|
|
8
|
+
flippedEdges: number;
|
|
9
|
+
/** Triangles with no area. */
|
|
10
|
+
degenerate: number;
|
|
11
|
+
/** Separate pieces; a print wants 1 (or pieces that rest on the bed). */
|
|
12
|
+
pieces: number;
|
|
13
|
+
/** Triangles in each piece, largest first. */
|
|
14
|
+
pieceTriangles: number[];
|
|
15
|
+
min: Vec3;
|
|
16
|
+
max: Vec3;
|
|
17
|
+
/** Enclosed volume (positive when the triangles face outward). */
|
|
18
|
+
volume: number;
|
|
19
|
+
/** Surface area. */
|
|
20
|
+
area: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function inspectMesh(mesh: Mesh): MeshReport;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Mesh, Vec3 } from './mesh.js';
|
|
2
|
+
export interface Overhang {
|
|
3
|
+
/** Area of the faces tipped more than the limit from upright and off the bed, in the mesh's units squared. */
|
|
4
|
+
area: number;
|
|
5
|
+
/** Their share of the whole surface. */
|
|
6
|
+
share: number;
|
|
7
|
+
}
|
|
8
|
+
/** Faces whose normal points down past `limit` degrees from upright (45 is the usual FDM limit) and that are above the bed (z = 0). */
|
|
9
|
+
export declare function overhang(mesh: Mesh, limit?: number, bed?: number): Overhang;
|
|
10
|
+
export interface SupportOptions {
|
|
11
|
+
min: Vec3;
|
|
12
|
+
max: Vec3;
|
|
13
|
+
/** Voxel size. */
|
|
14
|
+
cell: number;
|
|
15
|
+
/** Air kept between a support and the model so they part cleanly. */
|
|
16
|
+
gap: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Support pillars for `field` (negative inside, floor at z = 0): under every part that leans out more than
|
|
20
|
+
* 45 degrees (a voxel with nothing solid straight below it or to its four sides below), a column straight
|
|
21
|
+
* down to the model or the bed, a voxel wider all round, kept `gap` away from the model. Undefined when
|
|
22
|
+
* nothing needs support.
|
|
23
|
+
*/
|
|
24
|
+
export declare function supportBody(field: (x: number, y: number, z: number) => number, o: SupportOptions): Mesh | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Mesh } from './mesh.js';
|
|
2
|
+
export declare const TRANSPARENT = 255;
|
|
3
|
+
export interface PixelPicture {
|
|
4
|
+
w: number;
|
|
5
|
+
h: number;
|
|
6
|
+
/** Palette index per pixel, row major from the top; 255 is empty. */
|
|
7
|
+
cells: Uint8Array;
|
|
8
|
+
/** 6-bit VGA palette (768 bytes). */
|
|
9
|
+
palette: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
export interface FigureOptions {
|
|
12
|
+
/** Most colors (the base counts as the outline color): 4, or 3. */
|
|
13
|
+
colors?: number;
|
|
14
|
+
/** Palette indices that must keep a color of their own, the first one being the outline and base; the rest of the colors are chosen farthest-first. */
|
|
15
|
+
keep?: number[];
|
|
16
|
+
/** Millimeters per pixel block. */
|
|
17
|
+
block?: number;
|
|
18
|
+
/** Blocks deep the figure is. */
|
|
19
|
+
layers?: number;
|
|
20
|
+
/** Rows of base plate under the feet. */
|
|
21
|
+
baseRows?: number;
|
|
22
|
+
/** Blocks the base sticks out each side, and front and back. */
|
|
23
|
+
baseMargin?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface Figure {
|
|
26
|
+
/** One closed mesh per color, darkest (outline and base) first. */
|
|
27
|
+
bodies: {
|
|
28
|
+
color: [number, number, number];
|
|
29
|
+
mesh: Mesh;
|
|
30
|
+
}[];
|
|
31
|
+
/** The whole solid as one mesh. */
|
|
32
|
+
solid: Mesh;
|
|
33
|
+
/** Cleaned color map (width x height, with the base), for previews: index into `bodies`, -1 empty. */
|
|
34
|
+
map: Int8Array;
|
|
35
|
+
w: number;
|
|
36
|
+
h: number;
|
|
37
|
+
droppedSpecks: number;
|
|
38
|
+
bridged: number;
|
|
39
|
+
}
|
|
40
|
+
/** The figure of a picture. */
|
|
41
|
+
export declare function pixelFigure(pic: PixelPicture, o?: FigureOptions): Figure;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NetsOptions } from './surfaceNets.js';
|
|
2
|
+
/** `field` sampled over the box; outside the grid the nearest sample is read, which is air. */
|
|
3
|
+
export declare function sampledField(field: (x: number, y: number, z: number) => number, o: Pick<NetsOptions, 'min' | 'max' | 'cell'>): (x: number, y: number, z: number) => number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type D2 = (x: number, y: number) => number;
|
|
2
|
+
export type D3 = (x: number, y: number, z: number) => number;
|
|
3
|
+
export declare const circle2: (r: number, cx?: number, cy?: number) => D2;
|
|
4
|
+
export declare const ring2: (r0: number, r1: number) => D2;
|
|
5
|
+
export declare const roundRect2: (hx: number, hy: number, r: number, cx?: number, cy?: number) => D2;
|
|
6
|
+
/** A capsule: the line from (ax, ay) to (bx, by), `r` wide each side. */
|
|
7
|
+
export declare const capsule2: (ax: number, ay: number, bx: number, by: number, r: number) => D2;
|
|
8
|
+
/** A convex or concave polygon (counter-clockwise or not), by points. */
|
|
9
|
+
export declare function polygon2(pts: [number, number][]): D2;
|
|
10
|
+
/** Lines of text in the 3x5 micro font, each pixel a rounded square `px` mm wide, the block centered on (cx, cy). Letters are `px` apart, lines 2 px. */
|
|
11
|
+
export declare function pixelText2(lines: string[], px: number, cx?: number, cy?: number, round?: number): D2;
|
|
12
|
+
/** A flat shape standing from z0 to z1. */
|
|
13
|
+
export declare const extrude: (d2: D2, z0: number, z1: number) => D3;
|
|
14
|
+
export declare const sphere3: (cx: number, cy: number, cz: number, r: number) => D3;
|
|
15
|
+
/** A box with rounded edges, centered, half sizes hx, hy, hz and corner radius r. */
|
|
16
|
+
export declare const roundBox3: (cx: number, cy: number, cz: number, hx: number, hy: number, hz: number, r: number) => D3;
|
|
17
|
+
export declare const union3: (...fs: D3[]) => D3;
|
|
18
|
+
export declare const subtract3: (a: D3, ...cuts: D3[]) => D3;
|
|
19
|
+
export declare const intersect3: (a: D3, b: D3) => D3;
|
|
20
|
+
export declare const union2: (...fs: D2[]) => D2;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Mesh } from './mesh.js';
|
|
2
|
+
export interface StlOptions {
|
|
3
|
+
/** Written into the header (80 bytes at most). */
|
|
4
|
+
name?: string;
|
|
5
|
+
}
|
|
6
|
+
/** The mesh as a binary STL file. */
|
|
7
|
+
export declare function writeStl(mesh: Mesh, options?: StlOptions): Uint8Array;
|
|
8
|
+
/** A binary STL read back, its corners that coincide joined into shared vertices. */
|
|
9
|
+
export declare function readStl(data: Uint8Array): Mesh;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type D2 } from './sdfShapes.js';
|
|
2
|
+
/** Lines of capitals, digits and marks, `cap` mm tall, drawn with a pen `pen` mm wide, the block centered on (cx, cy). */
|
|
3
|
+
export declare function strokeText2(lines: string[], cap: number, pen: number, cx?: number, cy?: number): D2;
|
|
4
|
+
/**
|
|
5
|
+
* Characters set round a circle of `radius` mm (their feet toward the middle), clockwise from `startDeg` (90 is the top),
|
|
6
|
+
* `stepDeg` apart: a decoder coin's ring of digits, or a coin's legend. Each is `cap` mm tall, drawn with a pen `pen` mm wide.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ringText2(text: string, radius: number, cap: number, pen: number, stepDeg: number, startDeg?: number): D2;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Mesh, Vec3 } from './mesh.js';
|
|
2
|
+
export interface NetsOptions {
|
|
3
|
+
/** The box to sample: the surface must lie inside it. */
|
|
4
|
+
min: Vec3;
|
|
5
|
+
max: Vec3;
|
|
6
|
+
/** The grid spacing, in the field's units. */
|
|
7
|
+
cell: number;
|
|
8
|
+
/** Retry a grid that splits the surface into more separate pieces than this (default: any number is fine). */
|
|
9
|
+
maxPieces?: number;
|
|
10
|
+
/** How many grids to try before settling for the best (default 30). */
|
|
11
|
+
attempts?: number;
|
|
12
|
+
}
|
|
13
|
+
/** The closed surface of `field` = 0 over the box. */
|
|
14
|
+
export declare function surfaceNets(field: (x: number, y: number, z: number) => number, o: NetsOptions): Mesh;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Mesh } from './mesh.js';
|
|
2
|
+
import type { NetsOptions } from './surfaceNets.js';
|
|
3
|
+
/** The closed surface of `field` = 0 over the box (the grid starts a fixed cell outside it). */
|
|
4
|
+
export declare function tetraMesh(field: (x: number, y: number, z: number) => number, o: Pick<NetsOptions, 'min' | 'max' | 'cell'>): Mesh;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Mesh } from './mesh.js';
|
|
2
|
+
import { type ZipCodec } from './zipFile.js';
|
|
3
|
+
export interface Part {
|
|
4
|
+
name: string;
|
|
5
|
+
mesh: Mesh;
|
|
6
|
+
/** 0-255 each. */
|
|
7
|
+
color: [number, number, number];
|
|
8
|
+
}
|
|
9
|
+
/** The parts as a 3MF file. */
|
|
10
|
+
export declare function write3mf(parts: Part[], title: string, codec?: ZipCodec): Uint8Array;
|
|
11
|
+
/** A 3MF written by `write3mf` read back (its parts, meshes and colors). */
|
|
12
|
+
export declare function read3mf(data: Uint8Array, codec?: ZipCodec): Part[];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type D2, type D3 } from './sdfShapes.js';
|
|
2
|
+
export interface FlatKind {
|
|
3
|
+
/** A 2D outline of the flat part (a circle, a rounded rectangle). */
|
|
4
|
+
outline: D2;
|
|
5
|
+
/** Thickness of the plate in mm. */
|
|
6
|
+
thick: number;
|
|
7
|
+
/** Width of the raised rim in mm (0 for none), and how far it stands above the face. */
|
|
8
|
+
rim?: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
/** Raised artwork (lettering, a crown) and how far it stands above the face. */
|
|
13
|
+
relief?: {
|
|
14
|
+
shape: D2;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
/** Sunk artwork and how deep it goes. */
|
|
18
|
+
engrave?: {
|
|
19
|
+
shape: D2;
|
|
20
|
+
depth: number;
|
|
21
|
+
};
|
|
22
|
+
/** Holes through the plate (a key-chain hole). */
|
|
23
|
+
holes?: D2[];
|
|
24
|
+
/** A recess in the back (the floor) for gluing in a pin back or a magnet, as a solid to cut away (see pinBack). */
|
|
25
|
+
pocket?: D3;
|
|
26
|
+
}
|
|
27
|
+
/** A plate with its rim, relief, engraving and holes: the face is at z = thick. */
|
|
28
|
+
export declare function plate(k: FlatKind): D3;
|
|
29
|
+
/** The outline for a key-chain tag: a rounded rectangle of half sizes hx, hy. */
|
|
30
|
+
export declare const tagOutline: (hx: number, hy: number, r: number) => D2;
|
|
31
|
+
export declare const holeAt: (x: number, y: number, r: number) => D2;
|
|
32
|
+
/**
|
|
33
|
+
* A die: a rounded cube of `size` mm with a dimple of radius `pipR` for each pip (the usual 1..6 on opposite faces summing to 7).
|
|
34
|
+
* The dimples are deep (about three quarters of a radius), so the pips read in plain light; `pips` is the union of them, to color
|
|
35
|
+
* the pips apart (a point on a dimple's surface has `pips` near zero).
|
|
36
|
+
*/
|
|
37
|
+
export declare function die(size: number, pipR: number, corner?: number): D3 & {
|
|
38
|
+
pips: D3;
|
|
39
|
+
};
|
|
40
|
+
/** A regular polygon outline (a hexagonal badge, a shield point up), `n` sides, radius `r`. */
|
|
41
|
+
export declare const regular2: (n: number, r: number, turn?: number) => D2;
|
|
42
|
+
/**
|
|
43
|
+
* The pocket for a pin back: a bar-shaped recess `len` mm long and `w` mm wide at the floor, centered on (cx, cy), to glue a
|
|
44
|
+
* bar pin into (give it as `pocket`). Its roof is a gable at 45 degrees, so it prints without supports.
|
|
45
|
+
*/
|
|
46
|
+
export declare const pinBack: (cx?: number, cy?: number, len?: number, w?: number) => D3;
|
|
47
|
+
/** A key-chain ring tab: a round lug of outer radius `r + wall` with a hole of radius `r`, at (x, y). Join `shape` to the outline with union2 and give `hole` to `holes`. */
|
|
48
|
+
export declare const ringTab: (x: number, y: number, r?: number, wall?: number) => {
|
|
49
|
+
shape: D2;
|
|
50
|
+
hole: D2;
|
|
51
|
+
};
|
|
52
|
+
export interface GemShape {
|
|
53
|
+
/** Sides of the table and girdle (6 or 8). */
|
|
54
|
+
sides: number;
|
|
55
|
+
/** Apothems in mm: the flat table the gem stands on, and the widest part (the girdle). */
|
|
56
|
+
table: number;
|
|
57
|
+
girdle: number;
|
|
58
|
+
/** Height of the crown (table to girdle) and of the pavilion (girdle to the point), in mm. */
|
|
59
|
+
crown: number;
|
|
60
|
+
pavilion: number;
|
|
61
|
+
/** Turn the pavilion's facets by half a side, as a brilliant cut does (default true). */
|
|
62
|
+
offset?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A faceted gem standing on its table (flat down), the crown flaring out as it rises and the pavilion narrowing to the point:
|
|
66
|
+
* the crown leans out at under 45 degrees from vertical, so it prints without supports. Also the shape of a crystal shard.
|
|
67
|
+
* `facet(x, y, z)` is the number of the facet a surface point belongs to, for coloring.
|
|
68
|
+
*/
|
|
69
|
+
export declare function gem(g: GemShape): {
|
|
70
|
+
field: D3;
|
|
71
|
+
facet: (x: number, y: number, z: number) => number;
|
|
72
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FieldTrinket } from './fieldTrinket.js';
|
|
2
|
+
export interface TrinketToolDef {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
blurb: string;
|
|
6
|
+
/** Printed height and width in mm, only to start the biggest first. */
|
|
7
|
+
height: number;
|
|
8
|
+
maxWidth: number;
|
|
9
|
+
/** How many separate solids it is (default 1), such as a coin printed in three pieces. */
|
|
10
|
+
pieces?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TrinketTool<D extends TrinketToolDef> {
|
|
13
|
+
/** The folder id in web/public/trinkets and the manifest's `game`. */
|
|
14
|
+
game: string;
|
|
15
|
+
/** The game's title, in the STL and 3MF names. */
|
|
16
|
+
gameTitle: string;
|
|
17
|
+
out: string;
|
|
18
|
+
/** The files, and folders (each file in them, sorted), the trinkets are made from: the key of the manifest. */
|
|
19
|
+
keyFiles: string[];
|
|
20
|
+
defs: D[];
|
|
21
|
+
make: (def: D) => FieldTrinket;
|
|
22
|
+
args: string[];
|
|
23
|
+
}
|
|
24
|
+
/** A hash of the sources, so an up-to-date set of trinkets is not made again. */
|
|
25
|
+
export declare function sourceKey(entries: string[]): string;
|
|
26
|
+
export declare function runTrinketTool<D extends TrinketToolDef>(tool: TrinketTool<D>): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Mesh } from './mesh.js';
|
|
2
|
+
export interface VoxelGrid {
|
|
3
|
+
nx: number;
|
|
4
|
+
ny: number;
|
|
5
|
+
nz: number;
|
|
6
|
+
/** True where a voxel is filled. Outside the grid is empty. */
|
|
7
|
+
has: (x: number, y: number, z: number) => boolean;
|
|
8
|
+
}
|
|
9
|
+
/** The surface of the filled voxels as a mesh. A voxel touching another only along an edge makes a non-manifold edge: avoid that in the grid. */
|
|
10
|
+
export declare function voxelMesh(g: VoxelGrid, size?: number): Mesh;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ZipEntry {
|
|
2
|
+
name: string;
|
|
3
|
+
data: Uint8Array;
|
|
4
|
+
}
|
|
5
|
+
export interface ZipCodec {
|
|
6
|
+
/** Raw deflate (no zlib header). */
|
|
7
|
+
deflate?: (data: Uint8Array) => Uint8Array;
|
|
8
|
+
/** Raw inflate, needed to read deflated entries. */
|
|
9
|
+
inflate?: (data: Uint8Array) => Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
export declare function crc32(data: Uint8Array): number;
|
|
12
|
+
export declare function writeZip(entries: ZipEntry[], codec?: ZipCodec): Uint8Array;
|
|
13
|
+
export declare function readZip(data: Uint8Array, codec?: ZipCodec): ZipEntry[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type MicroGlyphs = Readonly<Record<string, string>>;
|
|
2
|
+
export declare const MICRO_GLYPHS: MicroGlyphs;
|
|
3
|
+
/** Square letterforms for technical labels, with the full punctuation repertoire. */
|
|
4
|
+
export declare const MICRO_SQUARE_GLYPHS: MicroGlyphs;
|
|
5
|
+
/** Select an exact repertoire when preserving an existing font's fallback behavior. */
|
|
6
|
+
export declare function microGlyphs(characters: string, square?: boolean): MicroGlyphs;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Bytes of `size`-byte values split into planes: every value's first byte, then every second byte... */
|
|
2
|
+
export declare function toPlanes(data: Uint8Array, size: number): Uint8Array;
|
|
3
|
+
/** `toPlanes` undone. */
|
|
4
|
+
export declare function fromPlanes(data: Uint8Array, size: number): Uint8Array;
|
|
5
|
+
/** Vertex numbers as varints: each one's distance back from one past the highest so far, zigzagged; `starts` restart the count (a block per part). */
|
|
6
|
+
export declare function packIndices(ix: ArrayLike<number>, starts?: Set<number>): Uint8Array;
|
|
7
|
+
/** `count` vertex numbers from `packIndices`'s bytes. */
|
|
8
|
+
export declare function unpackIndices(data: Uint8Array, count: number, starts?: Set<number>): Uint32Array;
|
|
9
|
+
/** A binary STL packed: its header, a table of its distinct corners, each triangle's corner numbers and attribute, and any normal that is not the one worked out again. */
|
|
10
|
+
export declare function packStl(stl: Uint8Array): Uint8Array;
|
|
11
|
+
/** The binary STL `packStl` packed, byte for byte. */
|
|
12
|
+
export declare function unpackStl(pack: Uint8Array): Uint8Array;
|
|
13
|
+
/** Several named files in one pack (a ZIP's worth, to zip in the browser): each binary STL packed by `packStl`, the rest as they are. */
|
|
14
|
+
export declare function packFiles(files: {
|
|
15
|
+
name: string;
|
|
16
|
+
data: Uint8Array;
|
|
17
|
+
}[]): Uint8Array;
|
|
18
|
+
/** The files `packFiles` packed, each byte for byte. */
|
|
19
|
+
export declare function unpackFiles(pack: Uint8Array): {
|
|
20
|
+
name: string;
|
|
21
|
+
data: Uint8Array;
|
|
22
|
+
}[];
|
|
23
|
+
/** A file of float32s then uint32 vertex numbers (little-endian, as the phone kit's parts.bin), packed: the floats in byte planes, the numbers as varints counted afresh at each of `starts` (a part's first number). */
|
|
24
|
+
export declare function packFloatsAndIndices(bin: Uint8Array, floats: number, starts: number[]): Uint8Array;
|
|
25
|
+
/** The file `packFloatsAndIndices` packed, byte for byte. */
|
|
26
|
+
export declare function unpackFloatsAndIndices(pack: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Part } from '../mesh/threeMf.js';
|
|
2
|
+
import { type ZipCodec, type ZipEntry } from '../mesh/zipFile.js';
|
|
3
|
+
/** The files inside the 3MF write3mf writes for these parts, before any deflate (write3mf stores them when given no codec). */
|
|
4
|
+
export declare function threeMfEntries(parts: Part[], title: string): ZipEntry[];
|
|
5
|
+
/** A 3MF from write3mf, packed (deflate the result); throws when its inner files would not come back the same. */
|
|
6
|
+
export declare function pack3mf(file: Uint8Array, codec: Pick<ZipCodec, 'inflate'>): Uint8Array;
|
|
7
|
+
/** A packed 3MF's title and parts, ready for write3mf or threeMfEntries. */
|
|
8
|
+
export declare function unpack3mf(pack: Uint8Array): {
|
|
9
|
+
title: string;
|
|
10
|
+
parts: Part[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const ATARI_NTSC_RGB = "\n000000 404040 6c6c6c 909090 b0b0b0 c8c8c8 dcdcdc ececec\n444400 646410 848424 a0a034 b8b840 d0d050 e8e85c fcfc68\n702800 844414 985c28 ac783c bc8c4c cca05c dcb468 e8cc7c\n841800 983418 ac5030 c06848 d0805c e09470 eca880 fcbc94\n880000 9c2020 b03c3c c05858 d07070 e08888 eca0a0 fcb4b4\n78005c 8c2074 a03c88 b0589c c070b0 d084c0 dc9cd0 ecb0e0\n480078 602090 783ca4 8c58b8 a070cc b484dc c49cec d4b0fc\n140084 302098 4c3cac 6858c0 7c70d0 9488e0 a8a0ec bcb4fc\n000088 1c209c 3840b0 505cc0 6874d0 7c8ce0 90a4ec a4b8fc\n00187c 1c3890 3854a8 5070bc 6888cc 7c9cdc 90b4ec a4c8fc\n002c5c 1c4c78 386890 5084ac 689cc0 7cb4d4 90cce8 a4e0fc\n00402c 1c5c48 387c64 509c80 68b494 7cd0ac 90e4c0 a4fcd4\n003c00 205c20 407c40 5c9c5c 74b474 8cd08c a4e4a4 b8fcb8\n143800 345c1c 507c38 6c9850 84b468 9ccc7c b4e490 c8fca4\n2c3000 4c501c 687034 848c4c 9ca864 b4c078 ccd488 e0ec9c\n442800 644818 846830 a08444 b89c58 d0b46c e8cc7c fce08c\n";
|
|
2
|
+
export declare const ATARI_PAL_RGB = "\n000000 404040 6c6c6c 909090 b0b0b0 c8c8c8 dcdcdc ececec\n805800 947020 a8843c bc9c58 ccac70 dcc084 ecd09c fce0b0\n445c00 5c7820 74903c 8cac58 a0c070 b0d484 c0e89c d4fcb0\n703400 885020 a0683c b48458 c89870 dcac84 ecc09c fcd4b0\n006414 208034 3c9850 58b06c 70c484 84d89c 9ce8b4 b0fcc8\n700014 882034 a03c50 b4586c c87084 dc849c ec9cb4 fcb0c8\n005c5c 207474 3c8c8c 58a4a4 70b8b8 84c8c8 9cdcdc b0ecec\n70005c 842074 943c88 a8589c b470b0 c484c0 d09cd0 e0b0e0\n003c70 1c5888 3874a0 508cb4 68a4c8 7cb8dc 90ccec a4e0fc\n580070 6c2088 803ca0 9458b4 a470c8 b484dc c49cec d4b0fc\n002070 1c3c88 3858a0 5074b4 6888c8 7ca0dc 90b4ec a4c8fc\n3c0080 542094 6c3ca8 8058bc 9470cc a884dc b89cec c8b0fc\n000088 20209c 3c3cb0 5858c0 7070d0 8484e0 9c9cec b0b0fc\n";
|
|
3
|
+
export declare const NES_RGB = "\n575757 000c8e 0800a6 340096 550061 630015 5a0000 3c0e00\n112800 003b00 004200 003a05 002652 000000 a5a5a5 0041d9\n2f1eff 6704f2 9400b4 aa0057 a31800 803900 4b5b00 137600\n008100 007923 006288 ffffff 4a9fff 797eff af63ff dd55ff\nf757c2 f76a63 dc8810 aea900 78c400 4ad211 2fcf64 2fbdc4\n414141 b9ddff cad1ff dec6ff f0c0ff fcc0ee fdc6ca f5d0aa\ne4dd95 d0e892 bdeea2 b2eec0 b0e8e3 b3b3b3\n";
|
|
4
|
+
export declare const C64_RGB = "\n000000 ffffff fa3200 1de0ff a84bcc 68ba51 004ad0 ffe94d\nff5b00 c13e00 ff723e 605e62 8c937f b2ff90 458aff c3b8d7\n";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Palette } from '@lewismoten/gamemaker-sandbox-engine/formats/palette';
|
|
2
|
+
export interface PalettePreset {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly stem: string;
|
|
6
|
+
/** Occupied entries, including menu black; index 255 is always reserved. */
|
|
7
|
+
readonly entries: number;
|
|
8
|
+
readonly description: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const PALETTE_PRESETS: readonly PalettePreset[];
|
|
11
|
+
/** A fresh 768-byte VGA palette. Black is moved to index 0; unused entries and 255 are black. */
|
|
12
|
+
export declare function createPalettePreset(id: string): Palette;
|