melonjs 20.8.0 → 20.10.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/README.md +1 -0
- package/build/application/application.d.ts +66 -8
- package/build/application/application.d.ts.map +1 -1
- package/build/application/defaultApplicationSettings.d.ts +1 -0
- package/build/application/defaultApplicationSettings.d.ts.map +1 -1
- package/build/application/resize.d.ts +25 -0
- package/build/application/resize.d.ts.map +1 -1
- package/build/application/scaleMethods.d.ts +13 -3
- package/build/application/scaleMethods.d.ts.map +1 -1
- package/build/application/settings.d.ts +68 -13
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +29 -5
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/autopause.d.ts +36 -0
- package/build/audio/autopause.d.ts.map +1 -0
- package/build/audio/backend/engine.d.ts +10 -0
- package/build/audio/backend/engine.d.ts.map +1 -1
- package/build/audio/backend/sound.d.ts.map +1 -1
- package/build/audio/backend/spatial.d.ts.map +1 -1
- package/build/audio/context.d.ts +35 -0
- package/build/audio/context.d.ts.map +1 -0
- package/build/audio/playback.d.ts.map +1 -1
- package/build/audio/procedural.d.ts.map +1 -1
- package/build/audio/spatial.d.ts +87 -0
- package/build/audio/spatial.d.ts.map +1 -0
- package/build/audio/state.d.ts +1 -0
- package/build/audio/state.d.ts.map +1 -1
- package/build/audio/types.d.ts +46 -6
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/effects/fade_effect.d.ts.map +1 -1
- package/build/camera/effects/mask_effect.d.ts.map +1 -1
- package/build/camera/effects/shake_effect.d.ts.map +1 -1
- package/build/geometries/box3d.d.ts +1 -1
- package/build/geometries/box3d.d.ts.map +1 -1
- package/build/geometries/ellipse.d.ts +1 -1
- package/build/geometries/ellipse.d.ts.map +1 -1
- package/build/geometries/line.d.ts +1 -1
- package/build/geometries/line.d.ts.map +1 -1
- package/build/geometries/point.d.ts +1 -1
- package/build/geometries/point.d.ts.map +1 -1
- package/build/geometries/polygon.d.ts +1 -1
- package/build/geometries/polygon.d.ts.map +1 -1
- package/build/geometries/rectangle.d.ts +1 -1
- package/build/geometries/rectangle.d.ts.map +1 -1
- package/build/geometries/roundrect.d.ts +1 -1
- package/build/geometries/roundrect.d.ts.map +1 -1
- package/build/geometries/sphere.d.ts +1 -1
- package/build/geometries/sphere.d.ts.map +1 -1
- package/build/index.d.ts +9 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +38737 -35039
- package/build/index.js.map +4 -4
- package/build/input/gamepad.d.ts +129 -3
- package/build/input/gamepad.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts +5 -4
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/tiled/TMXObjectFactory.d.ts +3 -2
- package/build/level/tiled/TMXObjectFactory.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +1 -4
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/loader/cache.d.ts +220 -0
- package/build/loader/cache.d.ts.map +1 -1
- package/build/loader/loader.d.ts +20 -349
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts +115 -0
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/math/color.d.ts +1 -1
- package/build/math/color.d.ts.map +1 -1
- package/build/math/matrix2d.d.ts +1 -1
- package/build/math/matrix2d.d.ts.map +1 -1
- package/build/math/matrix3d.d.ts +1 -1
- package/build/math/matrix3d.d.ts.map +1 -1
- package/build/math/observableVector2d.d.ts +14 -2
- package/build/math/observableVector2d.d.ts.map +1 -1
- package/build/math/observableVector3d.d.ts +15 -1
- package/build/math/observableVector3d.d.ts.map +1 -1
- package/build/math/vector2d.d.ts +31 -1
- package/build/math/vector2d.d.ts.map +1 -1
- package/build/math/vector3d.d.ts +38 -1
- package/build/math/vector3d.d.ts.map +1 -1
- package/build/math/vertex.d.ts.map +1 -1
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +7 -1
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +35 -0
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/bounds.d.ts +1 -1
- package/build/physics/bounds.d.ts.map +1 -1
- package/build/physics/broadphase/octree.d.ts +24 -0
- package/build/physics/broadphase/octree.d.ts.map +1 -1
- package/build/physics/broadphase/quadtree.d.ts +31 -0
- package/build/physics/broadphase/quadtree.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +14 -0
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/pool.d.ts +4 -0
- package/build/pool.d.ts.map +1 -1
- package/build/renderable/colorlayer.d.ts +13 -0
- package/build/renderable/colorlayer.d.ts.map +1 -1
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/groundshadow.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +56 -0
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +97 -11
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +47 -3
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +2 -1
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +6 -2
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +63 -2
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/bitmaptextdata.d.ts +1 -1
- package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
- package/build/renderable/text/glypheffect.d.ts +44 -0
- package/build/renderable/text/glypheffect.d.ts.map +1 -0
- package/build/renderable/text/text.d.ts +17 -0
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/trail.d.ts.map +1 -1
- package/build/renderable/trail3d.d.ts +174 -0
- package/build/renderable/trail3d.d.ts.map +1 -0
- package/build/renderable/trigger.d.ts +2 -1
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/panelpaint.d.ts +5 -0
- package/build/renderable/ui/panelpaint.d.ts.map +1 -0
- package/build/renderable/ui/progressbar.d.ts +2 -4
- package/build/renderable/ui/progressbar.d.ts.map +1 -1
- package/build/renderable/ui/uipanel.d.ts +245 -0
- package/build/renderable/ui/uipanel.d.ts.map +1 -0
- package/build/renderable/ui/uitextbutton.d.ts +30 -1
- package/build/renderable/ui/uitextbutton.d.ts.map +1 -1
- package/build/state/state.d.ts.map +1 -1
- package/build/system/bootstrap.d.ts.map +1 -1
- package/build/system/legacy_pool.d.ts +22 -2
- package/build/system/legacy_pool.d.ts.map +1 -1
- package/build/system/pool.d.ts +5 -8
- package/build/system/pool.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +1 -1
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/effects/squish.d.ts +74 -0
- package/build/video/effects/squish.d.ts.map +1 -0
- package/build/video/effects/tintPulse.d.ts +0 -5
- package/build/video/effects/tintPulse.d.ts.map +1 -1
- package/build/video/effects/wave.d.ts +0 -5
- package/build/video/effects/wave.d.ts.map +1 -1
- package/build/video/gpu/batcher.d.ts +8 -2
- package/build/video/gpu/batcher.d.ts.map +1 -1
- package/build/video/gradient.d.ts +1 -0
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts +16 -3
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
- package/build/video/rendertarget/rendertarget.d.ts +12 -5
- package/build/video/rendertarget/rendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webgpurendertarget.d.ts +6 -12
- package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -1
- package/build/video/texture/atlas.d.ts +1 -1
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/texture2d.d.ts +6 -0
- package/build/video/texture/texture2d.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +2 -11
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +5 -0
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +21 -0
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/deletable.d.ts +15 -0
- package/build/video/webgl/buffer/deletable.d.ts.map +1 -0
- package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -1
- package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -1
- package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -1
- package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -1
- package/build/video/webgpu/texture/compressed.d.ts.map +1 -1
- package/build/video/webgpu/texture/store.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +2 -2
- package/skills/AGENTS.md +1 -1
- package/skills/melonjs/SKILL.md +2 -0
- package/skills/melonjs-3d/SKILL.md +192 -18
- package/skills/melonjs-3d-assets/SKILL.md +36 -2
- package/skills/melonjs-audio/SKILL.md +229 -8
- package/skills/melonjs-camera-and-drawing/SKILL.md +73 -3
- package/skills/melonjs-display-and-scaling/SKILL.md +273 -0
- package/skills/melonjs-effects-and-shaders/SKILL.md +54 -10
- package/skills/melonjs-events/SKILL.md +8 -6
- package/skills/melonjs-input/SKILL.md +100 -4
- package/skills/melonjs-loading-assets/SKILL.md +22 -4
- package/skills/melonjs-math/SKILL.md +313 -0
- package/skills/melonjs-particles-and-trails/SKILL.md +88 -14
- package/skills/melonjs-performance/SKILL.md +57 -22
- package/skills/melonjs-physics/SKILL.md +2 -1
- package/skills/melonjs-renderables/SKILL.md +6 -1
- package/skills/melonjs-scenes-and-state/SKILL.md +14 -3
- package/skills/melonjs-sprites-and-animation/SKILL.md +9 -4
- package/skills/melonjs-tilemaps/SKILL.md +40 -12
- package/skills/melonjs-ui-and-text/SKILL.md +382 -4
package/build/input/gamepad.d.ts
CHANGED
|
@@ -71,16 +71,27 @@ export declare const GAMEPAD: {
|
|
|
71
71
|
* @param button - Button/Axis definition
|
|
72
72
|
* @param button.type - "buttons" or "axes"
|
|
73
73
|
* @param button.code - button or axis code id
|
|
74
|
-
* @param button.threshold -
|
|
74
|
+
* @param button.threshold - how far past the deadzone the axis must travel to
|
|
75
|
+
* trigger the keycode. It is ADDED to {@link input.setGamepadDeadzone}, it does
|
|
76
|
+
* not replace it, so with the default deadzone of 0.1 a threshold of 0.5 fires
|
|
77
|
+
* at 0.6 of full deflection. Its SIGN picks the half of the axis to watch:
|
|
78
|
+
* negative for left/up, positive for right/down, and the two halves are bound
|
|
79
|
+
* separately. Ignored for `"buttons"`, which take the browser's own pressed
|
|
80
|
+
* state; the deadzone reaches a button only where a non-standard mapping
|
|
81
|
+
* routes an axis onto one through its `analog` array.
|
|
75
82
|
* @param keyCode - (See {@link input.KEY})
|
|
83
|
+
* @throws {Error} if `keyCode` has no action bound to it yet — call
|
|
84
|
+
* {@link input.bindKey} first.
|
|
76
85
|
* @example
|
|
77
86
|
* // enable the keyboard
|
|
78
87
|
* me.input.bindKey(me.input.KEY.X, "shoot");
|
|
79
88
|
* ...
|
|
80
89
|
* // map the lower face button on the first gamepad to the X key
|
|
81
90
|
* me.input.bindGamepad(0, {type:"buttons", code: me.input.GAMEPAD.BUTTONS.FACE_1}, me.input.KEY.X);
|
|
82
|
-
* // map the left
|
|
91
|
+
* // map the left half of the stick to LEFT, firing at 0.6 of full travel
|
|
92
|
+
* // (0.1 deadzone + 0.5 threshold), and the right half to RIGHT
|
|
83
93
|
* me.input.bindGamepad(0, {type:"axes", code: me.input.GAMEPAD.AXES.LX, threshold: -0.5}, me.input.KEY.LEFT);
|
|
94
|
+
* me.input.bindGamepad(0, {type:"axes", code: me.input.GAMEPAD.AXES.LX, threshold: 0.5}, me.input.KEY.RIGHT);
|
|
84
95
|
* @category Input
|
|
85
96
|
*/
|
|
86
97
|
export declare function bindGamepad(index: number, button: {
|
|
@@ -90,17 +101,33 @@ export declare function bindGamepad(index: number, button: {
|
|
|
90
101
|
}, keyCode: number): void;
|
|
91
102
|
/**
|
|
92
103
|
* unbind the defined keycode
|
|
104
|
+
*
|
|
105
|
+
* Takes the `type` the binding was made with, because a button code and an
|
|
106
|
+
* axis code are both small integers from different sets and they collide:
|
|
107
|
+
* `GAMEPAD.AXES.LX` and `GAMEPAD.BUTTONS.FACE_1` are both 0. Without it an
|
|
108
|
+
* axis could not be unbound at all, and asking for one by its code removed
|
|
109
|
+
* whatever button happened to share the number.
|
|
93
110
|
* @param index - Gamepad index
|
|
94
111
|
* @param button - (See {@link input.GAMEPAD})
|
|
112
|
+
* @param type - which table the binding is in, `"buttons"` by default
|
|
95
113
|
* @example
|
|
96
114
|
* me.input.unbindGamepad(0, me.input.GAMEPAD.BUTTONS.FACE_1);
|
|
115
|
+
* me.input.unbindGamepad(0, me.input.GAMEPAD.AXES.LX, "axes");
|
|
97
116
|
* @category Input
|
|
98
117
|
*/
|
|
99
|
-
export declare function unbindGamepad(index: number, button: number): void;
|
|
118
|
+
export declare function unbindGamepad(index: number, button: number, type?: "buttons" | "axes"): void;
|
|
100
119
|
/**
|
|
101
120
|
* Set deadzone for analog gamepad inputs<br>
|
|
102
121
|
* The default deadzone is 0.1 (10%) Analog values less than this will be ignored
|
|
122
|
+
*
|
|
123
|
+
* For axes it is the floor that a binding's own `threshold` is added to: one
|
|
124
|
+
* bound with `threshold: 0.5` under this default fires at 0.6, so raising it
|
|
125
|
+
* moves every axis binding with it. An ordinary button never consults it at
|
|
126
|
+
* all, since its pressed state comes from the browser; it reaches a button
|
|
127
|
+
* only where a non-standard mapping routes an axis onto one through its
|
|
128
|
+
* `analog` array.
|
|
103
129
|
* @param value - Deadzone value
|
|
130
|
+
* @see {@link input.bindGamepad}
|
|
104
131
|
* @category Input
|
|
105
132
|
*/
|
|
106
133
|
export declare function setGamepadDeadzone(value: number): void;
|
|
@@ -135,5 +162,104 @@ export declare function setGamepadDeadzone(value: number): void;
|
|
|
135
162
|
* });
|
|
136
163
|
*/
|
|
137
164
|
export declare const setGamepadMapping: (id: string, mapping: Partial<GamepadMapping>) => void;
|
|
165
|
+
/**
|
|
166
|
+
* Options for {@link input.vibrateGamepad}.
|
|
167
|
+
* @category Input
|
|
168
|
+
*/
|
|
169
|
+
export interface GamepadVibration {
|
|
170
|
+
/** how long the effect runs, milliseconds */
|
|
171
|
+
duration?: number;
|
|
172
|
+
/** the heavy, low-frequency motor, `0` to `1` */
|
|
173
|
+
strongMagnitude?: number;
|
|
174
|
+
/** the light, high-frequency motor, `0` to `1` */
|
|
175
|
+
weakMagnitude?: number;
|
|
176
|
+
/** how long to wait before it starts, milliseconds */
|
|
177
|
+
startDelay?: number;
|
|
178
|
+
/** left trigger motor, `0` to `1`. `"trigger-rumble"` only */
|
|
179
|
+
leftTrigger?: number;
|
|
180
|
+
/** right trigger motor, `0` to `1`. `"trigger-rumble"` only */
|
|
181
|
+
rightTrigger?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Which effect to play. `"dual-rumble"` is the one every haptic pad
|
|
184
|
+
* supports; `"trigger-rumble"` drives the motors inside the triggers and
|
|
185
|
+
* is not widely implemented.
|
|
186
|
+
*/
|
|
187
|
+
type?: GamepadHapticEffectType;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Whether the pad at this index can vibrate.
|
|
191
|
+
*
|
|
192
|
+
* For deciding what to OFFER — a rumble toggle in an options screen, say.
|
|
193
|
+
* Nothing needs to call it before {@link input.vibrateGamepad}, which is a
|
|
194
|
+
* no-op on a pad without motors.
|
|
195
|
+
* @param index - Gamepad index
|
|
196
|
+
* @returns true when there is haptic hardware to drive
|
|
197
|
+
* @category Input
|
|
198
|
+
*/
|
|
199
|
+
export declare function hasGamepadVibration(index: number): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Vibrate a gamepad.
|
|
202
|
+
*
|
|
203
|
+
* Safe to call blind: with no pad in that slot, no motors, or a browser
|
|
204
|
+
* without the Gamepad API at all, it resolves `false` and does nothing. That
|
|
205
|
+
* is the whole error path, so game code never has to branch on support.
|
|
206
|
+
*
|
|
207
|
+
* Magnitudes default to FULL, unlike the underlying web API where every
|
|
208
|
+
* parameter defaults to zero and a bare `playEffect("dual-rumble")` is a
|
|
209
|
+
* silent no-op. `vibrateGamepad(0)` vibrates.
|
|
210
|
+
*
|
|
211
|
+
* A second call preempts the first on the same pad, which is what makes a
|
|
212
|
+
* rapid series of hits read as a rapid series of hits rather than a queue.
|
|
213
|
+
* That is for DISTINCT events: a sustained rumble should be one effect with
|
|
214
|
+
* a long `duration`, not a call per frame, which would spend a promise and a
|
|
215
|
+
* preempted effect every frame to produce one continuous one.
|
|
216
|
+
* @param index - Gamepad index
|
|
217
|
+
* @param options - how hard and how long; see {@link GamepadVibration}
|
|
218
|
+
* @returns whether the effect ran to completion. `false` covers unsupported,
|
|
219
|
+
* preempted by a later call, and rejected by the device alike — a rumble is
|
|
220
|
+
* feedback, and nothing sensible branches on which of those happened.
|
|
221
|
+
* @example
|
|
222
|
+
* // a short, sharp knock
|
|
223
|
+
* input.vibrateGamepad(0, { duration: 90, strongMagnitude: 0.4, weakMagnitude: 0.8 });
|
|
224
|
+
* // and a long heavy one for something big
|
|
225
|
+
* input.vibrateGamepad(0, { duration: 600, strongMagnitude: 1, weakMagnitude: 0.5 });
|
|
226
|
+
* @category Input
|
|
227
|
+
*/
|
|
228
|
+
export declare function vibrateGamepad(index: number, options?: GamepadVibration): Promise<boolean>;
|
|
229
|
+
/**
|
|
230
|
+
* Stop whatever a gamepad is currently playing.
|
|
231
|
+
*
|
|
232
|
+
* For cutting a long effect short — the player pausing, or a run ending under
|
|
233
|
+
* a rumble that would otherwise outlive it. A no-op where there is nothing to
|
|
234
|
+
* stop.
|
|
235
|
+
* @param index - Gamepad index
|
|
236
|
+
* @category Input
|
|
237
|
+
*/
|
|
238
|
+
export declare function stopGamepadVibration(index: number): void;
|
|
239
|
+
/**
|
|
240
|
+
* The index of the pad the player is actually using.
|
|
241
|
+
*
|
|
242
|
+
* Slots are handed out in plug order, so index 0 is a guess rather than an
|
|
243
|
+
* answer: a wheel, a spare pad or a keyboard-shaped device left plugged in
|
|
244
|
+
* can hold slot 0 for a whole session while the player presses buttons on
|
|
245
|
+
* slot 1. Nothing in the browser reports which is "the" controller, and the
|
|
246
|
+
* one thing that identifies it is use.
|
|
247
|
+
*
|
|
248
|
+
* So this reports the last pad to produce a BOUND input, falling back to the
|
|
249
|
+
* first connected one before anything has been pressed, and to -1 when there
|
|
250
|
+
* is no pad at all. Pass it wherever an index is wanted —
|
|
251
|
+
* {@link input.vibrateGamepad} most of all, since rumbling the wrong pad is
|
|
252
|
+
* both useless and impossible to notice in testing.
|
|
253
|
+
*
|
|
254
|
+
* It follows bound inputs only, which is what makes it an answer about the
|
|
255
|
+
* player rather than about electrical noise: a resting stick on a worn pad
|
|
256
|
+
* reports movement for ever, and would otherwise claim to be the active one.
|
|
257
|
+
* @returns the gamepad index, or -1 when no gamepad is connected
|
|
258
|
+
* @example
|
|
259
|
+
* // rumble whichever pad the player is holding
|
|
260
|
+
* input.vibrateGamepad(input.activeGamepad(), { duration: 120 });
|
|
261
|
+
* @category Input
|
|
262
|
+
*/
|
|
263
|
+
export declare function activeGamepad(): number;
|
|
138
264
|
export {};
|
|
139
265
|
//# sourceMappingURL=gamepad.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gamepad.d.ts","sourceRoot":"","sources":["../../src/input/gamepad.ts"],"names":[],"mappings":"AAWA,UAAU,cAAc;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACtE;
|
|
1
|
+
{"version":3,"file":"gamepad.d.ts","sourceRoot":"","sources":["../../src/input/gamepad.ts"],"names":[],"mappings":"AAWA,UAAU,cAAc;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACtE;AAoSD;;GAEG;AACH,eAAO,MAAM,OAAO;IACnB;;;;;;;;OAQG;;;;;;;;;;;IAYH;;;;;;;;;;;OAWG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BM,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE;IAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EACtE,OAAO,EAAE,MAAM,GACb,IAAI,CAuDN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,SAAS,GAAG,MAAkB,GAClC,IAAI,CAQN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAC/B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,KAC5B,IAAiB,CAAC;AAEvB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,IAAI,CAAC,EAAE,uBAAuB,CAAC;CAC/B;AAsDD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,gBAAqB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAelB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAOxD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAkBtC"}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
export default class GLTFModel extends Container {
|
|
35
35
|
/**
|
|
36
|
-
* @param {import("../../loader/
|
|
36
|
+
* @param {import("../../loader/parsers/gltf.js").GLTFData} data - the parsed glTF descriptor, as returned by {@link loader.getGLTF}
|
|
37
37
|
* @param {object} [options]
|
|
38
38
|
* @param {number} [options.scale=1] - pixels per glTF unit (uniform scene scale)
|
|
39
39
|
* @param {boolean} [options.rightHanded=true] - glTF Y-up → engine Y-down via a rotation (no mirror)
|
|
@@ -42,14 +42,14 @@ export default class GLTFModel extends Container {
|
|
|
42
42
|
* @param {number} [options.shadowGroundY] - world Y of the floor those shadows land on
|
|
43
43
|
* @param {number} [options.shadowOpacity=0.45] - opacity of those shadows before any height fade
|
|
44
44
|
* @param {number} [options.shadowScale=1] - size multiplier for those shadows (see {@link Mesh#shadowScale})
|
|
45
|
-
* @param {number} [options.shadowOffset=0] - how far to slide them along their direction, in multiples of each blob's own radius; needs `shadowGroundY` (see {@link Mesh#shadowOffset})
|
|
45
|
+
* @param {number} [options.shadowOffset=0] - how far to slide them along their direction, in multiples of each blob's own radius; needs `shadowGroundY` (see {@link Mesh#shadowOffset}). `shadowGroundPoint` is deliberately not a scene option: one floor point shared by every part would stack their blobs on a single spot
|
|
46
46
|
* @param {number} [options.shadowStretch=1] - how much longer they are along that direction, clamped to 3
|
|
47
47
|
* @param {number} [options.shadowDirectionX=0] - x of the ground direction they are cast along
|
|
48
48
|
* @param {number} [options.shadowDirectionZ=0] - z of the ground direction they are cast along
|
|
49
49
|
* @param {number[]|Vector3d} [options.shadowGroundNormal] - the UP normal of the floor those shadows land on; needs `shadowGroundY` (see {@link Mesh#shadowGroundNormal})
|
|
50
50
|
* @param {Light3d} [options.shadowLight] - a {@link Light3d} to take that direction from instead
|
|
51
51
|
*/
|
|
52
|
-
constructor(data: import("../../loader/
|
|
52
|
+
constructor(data: import("../../loader/parsers/gltf.js").GLTFData, options?: {
|
|
53
53
|
scale?: number | undefined;
|
|
54
54
|
rightHanded?: boolean | undefined;
|
|
55
55
|
lit?: boolean | undefined;
|
|
@@ -61,7 +61,7 @@ export default class GLTFModel extends Container {
|
|
|
61
61
|
shadowStretch?: number | undefined;
|
|
62
62
|
shadowDirectionX?: number | undefined;
|
|
63
63
|
shadowDirectionZ?: number | undefined;
|
|
64
|
-
shadowGroundNormal?: number[] | Vector3d;
|
|
64
|
+
shadowGroundNormal?: number[] | Vector3d | undefined;
|
|
65
65
|
shadowLight?: any;
|
|
66
66
|
});
|
|
67
67
|
/**
|
|
@@ -138,4 +138,5 @@ export default class GLTFModel extends Container {
|
|
|
138
138
|
}
|
|
139
139
|
import Container from "../../renderable/container.js";
|
|
140
140
|
import type { AnimationOptionsInput } from "../../renderable/animation.ts";
|
|
141
|
+
import type { Vector3d } from "../../math/vector3d.ts";
|
|
141
142
|
//# sourceMappingURL=GLTFModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLTFModel.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFModel.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GLTFModel.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFModel.js"],"names":[],"mappings":"AA+DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH;IACC;;;;;;;;;;;;;;;;OAgBG;IACH,kBAhBW,OAAO,8BAA8B,EAAE,QAAQ,YAEvD;QAAyB,KAAK;QACJ,WAAW;QACX,GAAG;QACH,gBAAgB;QACjB,aAAa;QACb,aAAa;QACb,WAAW;QACX,YAAY;QACZ,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QACL,kBAAkB;QAC5B,WAAW;KACvC,EAyRA;IA5QA;;;OAGG;IACH,eAAoD;IA0CpD;;;;OAIG;IACH,YAA8B;IAC9B;;;;OAIG;IACH,YAA8B;IAC9B;;;;OAIG;IACH,gBAAqB;IACrB;;;;OAIG;IACH,gBAAqB;IACrB;;;;;;;OAOG;IACH,WAAgB;IAahB;;;;;;;;;;;;OAYG;IACH,gBAAkC;IAClC;;;OAGG;IACH,iBAAwD;IAExD;;;OAGG;IACH,iBAAyD;IAwFzD;;;;OAIG;IACH,SAAc;IAiBd;;;;OAIG;IACH,gBAHU,MAAM,CAGO;IAEvB;;;;OAIG;IACH,gBAHU,OAAO,CAGU;IAE3B;;;;OAIG;IAIH;;;OAGG;IACH;;;;MAAsD;IACtD;;;;OAIG;IACH,oGAA0B;IAC1B;;;;OAIG;IACH,mBAAsB;IAOvB;;;;;OAKG;IACH,qBAJa,MAAM,EAAE,CAMpB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;;;;;;OAeG;IACH,0BAXW,MAAM,YACN,qBAAqB,iBACrB,OAAO,GACL,SAAS,CAgErB;IAED;;;;;;;;;;;;;OAaG;IACH,YATW,MAAM,YACN,qBAAqB,GACnB,SAAS,CAarB;IAED;;;;OAIG;IACH,SAFa,SAAS,CAKrB;IAED;;;;;;OAMG;IACH,QAFa,SAAS,CAarB;IAkDD;;;;;;OAMG;IACH;;;;;;;;;;;;;;;OAeG;IACH,WAFa,OAAO,CAInB;IAkDD;;;OAGG;IACH,cAOC;IAED;;;;;;;;;;;;;;OAcG;IACH,eAJa,MAAM,EAAE,CA4BpB;IAED;;;;;OAKG;IACH,4DAqBC;IAED;;;;;;;OAOG;IACH,2CAJa,MAAM,EAAE,CAyCpB;IAED;;;;;;;;OAQG;IACH,+CAYC;CACD;sBAzyBqB,+BAA+B;2CASX,+BAA+B;8BAC9C,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLTFScene.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFScene.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GLTFScene.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFScene.js"],"names":[],"mappings":"AA0aA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,oCALW,aAAa,aACb,MAAM,QAyChB;AA5dD;;;;;;GAMG;AACH;;;;;;;;;GASG;AACH;IAwCC;;;;;;;;;;;;;OAaG;IACH,oBAJU,aAAa,CAAC,MAAM,CAAC,CAyB5B;IA1EH;;OAEG;IACH,qBAFW,MAAM,EAkBhB;IAfA;;;OAGG;IACH,MAFU,MAAM,CAEG;IACnB;;;OAGG;IACH,QAFU,MAAM,CAEI;IACpB;;;OAGG;IACH,MAFU,MAAM,CAEY;IAG7B;;;;OAIG;IACH,cAFa,MAAM,GAAC,SAAS,CAI5B;IAED;;;;OAIG;IACH,qBAEC;IAuCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,iBAtDW,SAAS,YAEjB;QAAyB,KAAK;QACJ,WAAW;QAEX,MAAM;QAQP,mBAAmB;QAQlB,gBAAgB;QAMjB,aAAa;QAIb,aAAa;QACb,WAAW;QACX,YAAY;QACZ,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QACL,kBAAkB;QAC5B,WAAW;KACrC,QA2LF;IAED;;;;;;;;;;;;;OAaG;IACH,sBAPW,SAAS,SACT,MAAM,SACN,MAAM,WACN,MAAM,QAsEhB;IAED;;;;;;OAMG;IACH,gBAAY;CACZ;0BApayB,oCAAoC;2BAOpC,+BAA+B;8BAG9B,wBAAwB;wBAd3B,2BAA2B"}
|
|
@@ -51,9 +51,10 @@ export function registerTiledObjectFactory(type: string, factory: Function): voi
|
|
|
51
51
|
* registerTiledObjectClass("Enemy", Enemy);
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
|
-
* //
|
|
54
|
+
* // the older spelling: `pool.register` registers a Tiled factory as a side
|
|
55
|
+
* // effect, and additionally makes the class RECYCLABLE, which this registry
|
|
56
|
+
* // alone does not do
|
|
55
57
|
* pool.register("CoinEntity", CoinEntity, true);
|
|
56
|
-
* // CoinEntity is now available both in the pool AND as a Tiled object factory
|
|
57
58
|
*/
|
|
58
59
|
export function registerTiledObjectClass(name: string, Constructor: Function): void;
|
|
59
60
|
//# sourceMappingURL=TMXObjectFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TMXObjectFactory.d.ts","sourceRoot":"","sources":["../../../src/level/tiled/TMXObjectFactory.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TMXObjectFactory.d.ts","sourceRoot":"","sources":["../../../src/level/tiled/TMXObjectFactory.js"],"names":[],"mappings":"AA2CA;;;;;;;GAOG;AACH,0CALW,MAAM,GACJ,OAAO,GAAC,MAAM,EAAE,CAiB5B;AAED;;;;;;;;;;;;;GAaG;AACH,2CALW,MAAM,GACJ,MAAM,CAuBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,iDApBW,MAAM,2BAgChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,+CAbW,MAAM,+BA0ChB;AAsBD;;;;;;;;GAQG;AACH,gDALW,MAAM,+BAWhB;AAoED;;;;;;;;GAQG;AACH,0CANW,MAAM,OACN,UAAU,GACR,UAAU,CAsBtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TMXTileMap.d.ts","sourceRoot":"","sources":["../../../src/level/tiled/TMXTileMap.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TMXTileMap.d.ts","sourceRoot":"","sources":["../../../src/level/tiled/TMXTileMap.js"],"names":[],"mappings":"AAiJA;;;;GAIG;AACH;IACC;;;;;;;;;;;OAWG;IACH,oBAJU,aAAa,CAAC,MAAM,CAAC,CAIsC;IAErE;;;;;;;;OAQG;IACH,qBARW,MAAM,QACN,MAAM,EAiKhB;IAzJA;;;;OAIG;IACH,aAAgB;IAEhB;;;OAGG;IACH,MAFU,MAAM,CAEG;IAEnB;;;OAGG;IACH,QAFU,MAAM,CAEG;IAEnB;;;OAGG;IACH,MAFU,MAAM,CAEO;IAEvB;;;OAGG;IACH,MAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,WAFU,MAAM,CAEgB;IAEhC;;;OAGG;IACH,YAFU,MAAM,CAEkB;IAElC;;;;OAIG;IACH,UAHU,MAAM,CAGmB;IAEnC;;;;OAIG;IACH,aAHU,MAAM,CAGmB;IAEnC;;;;OAIG;IACH,OAHU,MAAM,CAGe;IAE/B;;;;OAIG;IACH,OAHU,MAAM,CAGe;IAE/B;;;;;OAKG;IACH,aAHU,MAAM,CAGmC;IAEnD;;;OAGG;IACH,SAFU,MAAM,CAEgB;IAEhC;;;OAGG;IACH,cAFU,MAAM,CAE0B;IAE1C;;;OAGG;IACH,OAFU,MAAM,CAEO;IAGvB,6CAAoB;IAInB,cAAgB;IAIhB,oBAAsB;IAIvB,kBAA8C;IAG9C,iCAAmD;IAGnD,sBAAwC;IACxC,iBAAmC;IACnC,kBAAqC;IAGrC,eAAoD;IAGpD,cAA8B;IAC9B,eAAgC;IAGhC,qBAA2C;IAwB3C,qBAAwB;IAGzB;;;OAGG;IACH,eAFa,WAAW,CAUvB;IAHC,0LAAuC;IAKzC;;;OAGG;IACH,aAFa,MAAM,CAKlB;IAED;;;;OAIG;IACH,gCA2DC;IAED;;;;;;;;;;;OAWG;IACH,iBATW,SAAS,YACT,OAAO,sBACP,OAAO,QAgFjB;IAED;;;;;;;;;OASG;IACH,qBAJW,OAAO,GAEL,UAAU,EAAE,CA4GxB;IAED;;;OAGG;IACH,aAFa,QAAQ,EAAE,CAMtB;IAED;;OAEG;IACH,gBAKC;CACD;4BAtnB2B,sBAAsB;4BAIzB,yBAAyB;6BAEtB,2BAA2B;sBAhBjC,+BAA+B;4BAe1B,gCAAgC;qBARtC,eAAe"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* additional import for TypeScript
|
|
3
3
|
* @import {Bounds} from "../../../physics/bounds.ts";
|
|
4
|
+
* @import TMXTileMap from "../TMXTileMap.js";
|
|
4
5
|
*/
|
|
5
6
|
/**
|
|
6
7
|
* an Oblique Map Renderer (Tiled 1.12+)
|
|
@@ -9,10 +10,6 @@
|
|
|
9
10
|
* @category Tilemap
|
|
10
11
|
*/
|
|
11
12
|
export default class TMXObliqueRenderer extends TMXOrthogonalRenderer {
|
|
12
|
-
/**
|
|
13
|
-
* @param {TMXTileMap} map - the TMX map
|
|
14
|
-
*/
|
|
15
|
-
constructor(map: TMXTileMap);
|
|
16
13
|
/**
|
|
17
14
|
* horizontal pixel offset per tile row
|
|
18
15
|
* @type {number}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TMXObliqueRenderer.d.ts","sourceRoot":"","sources":["../../../../src/level/tiled/renderer/TMXObliqueRenderer.js"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"TMXObliqueRenderer.d.ts","sourceRoot":"","sources":["../../../../src/level/tiled/renderer/TMXObliqueRenderer.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH;;;;;GAKG;AACH;IAOE;;;OAGG;IACH,OAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,OAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,QAFU,MAAM,CAEsD;IAEtE;;;OAGG;IACH,QAFU,MAAM,CAEoD;IAEpE;;;;;OAKG;IACH,MAJU,MAAM,CAIyB;CA6M1C;kCA/PiC,4BAA4B"}
|
package/build/loader/cache.d.ts
CHANGED
|
@@ -1,3 +1,219 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* return the specified TMX/TSX object
|
|
4
|
+
* @param {string} elt - name of the tmx/tsx element ("map1");
|
|
5
|
+
* @returns {object} requested element or null if not found
|
|
6
|
+
* @category Assets
|
|
7
|
+
*/
|
|
8
|
+
export function getTMX(elt: string): object;
|
|
9
|
+
/**
|
|
10
|
+
* return the specified Binary object
|
|
11
|
+
* @param {string} elt - name of the binary object ("ymTrack");
|
|
12
|
+
* @returns {object} requested element or null if not found
|
|
13
|
+
* @category Assets
|
|
14
|
+
*/
|
|
15
|
+
export function getBinary(elt: string): object;
|
|
16
|
+
/**
|
|
17
|
+
* return the specified Image Object
|
|
18
|
+
* @param {string} image - name of the Image element ("tileset-platformer");
|
|
19
|
+
* @returns {HTMLImageElement|CompressedImage|null} requested element or null if not found
|
|
20
|
+
* @category Assets
|
|
21
|
+
*/
|
|
22
|
+
export function getImage(image: string): HTMLImageElement | CompressedImage | null;
|
|
23
|
+
/**
|
|
24
|
+
* return the specified JSON Object
|
|
25
|
+
* @param {string} elt - name of the json file
|
|
26
|
+
* @returns {JSON}
|
|
27
|
+
* @category Assets
|
|
28
|
+
*/
|
|
29
|
+
export function getJSON(elt: string): JSON;
|
|
30
|
+
/**
|
|
31
|
+
* return the specified OBJ model data
|
|
32
|
+
* @param {string} elt - name of the OBJ file (as specified in the preload list)
|
|
33
|
+
* @returns {object} parsed OBJ data with `vertices` (Float32Array), `uvs` (Float32Array), `indices` (Uint16Array), and `vertexCount` (number), or null if not found
|
|
34
|
+
* @category Assets
|
|
35
|
+
* @example
|
|
36
|
+
* // 1. preload the OBJ model and its texture
|
|
37
|
+
* me.loader.preload([
|
|
38
|
+
* { name: "cube", type: "obj", src: "models/cube.obj" },
|
|
39
|
+
* { name: "cube", type: "image", src: "models/cube_texture.png" },
|
|
40
|
+
* ], () => {
|
|
41
|
+
* // 2. create a Mesh using the preloaded model name
|
|
42
|
+
* const mesh = new me.Mesh(400, 300, {
|
|
43
|
+
* model: "cube", // references the preloaded OBJ
|
|
44
|
+
* texture: "cube", // references the preloaded image
|
|
45
|
+
* width: 200,
|
|
46
|
+
* height: 200,
|
|
47
|
+
* });
|
|
48
|
+
* me.game.world.addChild(mesh);
|
|
49
|
+
*
|
|
50
|
+
* // 3. or access the raw parsed data directly
|
|
51
|
+
* const data = me.loader.getOBJ("cube");
|
|
52
|
+
* // data.vertices — Float32Array of x,y,z positions
|
|
53
|
+
* // data.uvs — Float32Array of u,v texture coordinates
|
|
54
|
+
* // data.indices — Uint16Array of triangle vertex indices
|
|
55
|
+
* // data.vertexCount — number of unique vertices
|
|
56
|
+
* // data.groups — usemtl material groups ({materialName, start, count} index ranges)
|
|
57
|
+
* });
|
|
58
|
+
*/
|
|
59
|
+
export function getOBJ(elt: string): object;
|
|
60
|
+
/**
|
|
61
|
+
* return the parsed glTF/GLB scene descriptor for the given asset name.
|
|
62
|
+
*
|
|
63
|
+
* The descriptor is `{ nodes, cameras, lights, bounds, graph, animations }`:
|
|
64
|
+
* - `nodes` — one entry per mesh primitive, each carrying its accumulated
|
|
65
|
+
* `world` transform (16 floats, column-major), `vertices`, `normals`,
|
|
66
|
+
* `uvs`, `indices`, `vertexCount`, a decoded baseColor `image` (or `null`),
|
|
67
|
+
* and a `doubleSided` flag.
|
|
68
|
+
* - `cameras` — glTF cameras, each with its `world` transform + perspective
|
|
69
|
+
* parameters.
|
|
70
|
+
* - `lights` — parsed `KHR_lights_punctual` lights (`type`, `color`,
|
|
71
|
+
* `intensity`, `range`, spot cone angles, world-space
|
|
72
|
+
* `direction`/`position`, `name`); empty without the extension. The
|
|
73
|
+
* level director instantiates directional, point and spot lights
|
|
74
|
+
* automatically (see {@link level.load} options).
|
|
75
|
+
* - `bounds` — world-space `{ min, max }` (glTF units), handy for framing.
|
|
76
|
+
*
|
|
77
|
+
* Most code never needs this: a preloaded glTF/GLB auto-registers with the
|
|
78
|
+
* {@link level} director, so the whole scene loads into a container in one
|
|
79
|
+
* call via `me.level.load(name)` — exactly like a Tiled map. Reach for
|
|
80
|
+
* `getGLTF` only when you want to inspect the raw descriptor (e.g. to frame
|
|
81
|
+
* a `Camera3d` from the embedded camera).
|
|
82
|
+
* @param {string} elt - name of the glTF/GLB file (as specified in the preload list)
|
|
83
|
+
* @returns {GLTFData|null} the parsed scene descriptor, or `null` if not found
|
|
84
|
+
* @category Assets
|
|
85
|
+
* @example
|
|
86
|
+
* me.loader.preload(
|
|
87
|
+
* [{ name: "diorama", type: "glb", src: "scenes/diorama.glb" }],
|
|
88
|
+
* () => {
|
|
89
|
+
* // load the whole scene into the world (view under a Camera3d)
|
|
90
|
+
* me.level.load("diorama", { scale: 32 });
|
|
91
|
+
*
|
|
92
|
+
* // ...or inspect the raw descriptor for custom framing
|
|
93
|
+
* const scene = me.loader.getGLTF("diorama");
|
|
94
|
+
* const { min, max } = scene.bounds;
|
|
95
|
+
* },
|
|
96
|
+
* );
|
|
97
|
+
*/
|
|
98
|
+
export function getGLTF(elt: string): GLTFData | null;
|
|
99
|
+
/**
|
|
100
|
+
* Return the precompiled `ShaderEffect` for the given "shader" asset —
|
|
101
|
+
* compiled once during preloading, ready to assign to a renderable or
|
|
102
|
+
* camera `shader` property.
|
|
103
|
+
*
|
|
104
|
+
* **This returns a SHARED instance**: the *same* `ShaderEffect` object on
|
|
105
|
+
* every call, owned by the loader (its `shared` flag is `true`). That means:
|
|
106
|
+
* - it is safe to assign to any number of renderables — none of their
|
|
107
|
+
* cleanup paths will auto-destroy it, only {@link loader.unload} /
|
|
108
|
+
* {@link loader.unloadAll} free it (and its GL program);
|
|
109
|
+
* - all of them share ONE set of uniform values — `setUniform` on it
|
|
110
|
+
* affects every renderable using the shader.
|
|
111
|
+
*
|
|
112
|
+
* When a renderable needs its **own** uniform values, make a private,
|
|
113
|
+
* caller-owned copy with `ShaderEffect.clone()` — the clone's `shared` flag
|
|
114
|
+
* is reset to `false`, so it is auto-destroyed with the renderable it is
|
|
115
|
+
* assigned to, like any hand-constructed effect.
|
|
116
|
+
*
|
|
117
|
+
* A shader asset declared as a **complete program** — a
|
|
118
|
+
* `{vertex, fragment}` GLSL pair and/or a full `wgsl` module (see the
|
|
119
|
+
* example) — compiles into a raw {@link GLShader} instead, carrying one
|
|
120
|
+
* realization per GPU backend (`isWebGL` / `isWebGPU`): the type the
|
|
121
|
+
* hosted paths take directly (a `Mesh` custom shader,
|
|
122
|
+
* `renderer.customShader`, a custom batcher). Same shared-instance
|
|
123
|
+
* semantics, and `GLShader.clone()` likewise yields a caller-owned copy.
|
|
124
|
+
*
|
|
125
|
+
* Degradation is never fatal: a fragment-body asset without a body in the
|
|
126
|
+
* active renderer's language (or on Canvas) is an inert `ShaderEffect`
|
|
127
|
+
* stub, and a complete-program asset without a realization for the active
|
|
128
|
+
* backend is an inert `GLShader` — assigning either just keeps the
|
|
129
|
+
* built-in rendering. Note that shader assets require an initialized
|
|
130
|
+
* Application (`await app.init()`) — an inherent precondition of the
|
|
131
|
+
* preload flow, since the loading screen itself needs the renderer.
|
|
132
|
+
* @param {string} elt - name of the shader asset (as specified in the preload list)
|
|
133
|
+
* @returns {ShaderEffect|GLShader|null} the shared, precompiled shader, or `null` if not found
|
|
134
|
+
* @category Assets
|
|
135
|
+
* @example
|
|
136
|
+
* me.loader.preload([
|
|
137
|
+
* // from a file (or data: URI)
|
|
138
|
+
* { name: "waterRipple", type: "shader", src: "shaders/waterRipple.frag" },
|
|
139
|
+
* // or inline GLSL via the `data` field
|
|
140
|
+
* { name: "flash", type: "shader", data: `
|
|
141
|
+
* uniform float uIntensity;
|
|
142
|
+
* vec4 apply(vec4 color, vec2 uv) { return mix(color, vec4(1.0), uIntensity); }
|
|
143
|
+
* ` },
|
|
144
|
+
* // or a complete program — a {vertex, fragment} GLSL pair and/or a
|
|
145
|
+
* // full WGSL module → one GLShader carrying both realizations; the
|
|
146
|
+
* // active renderer hosts the one it speaks
|
|
147
|
+
* { name: "toonMesh", type: "shader", src: {
|
|
148
|
+
* vertex: "shaders/toon.vert",
|
|
149
|
+
* fragment: "shaders/toon.frag",
|
|
150
|
+
* wgsl: "shaders/toon.wgsl",
|
|
151
|
+
* } },
|
|
152
|
+
* ], () => {
|
|
153
|
+
* // one shared program — same uniform state for every user
|
|
154
|
+
* mySprite.addPostEffect(me.loader.getShader("waterRipple"));
|
|
155
|
+
* // private copy with its own uniforms (caller-owned, shared = false)
|
|
156
|
+
* boss.addPostEffect(me.loader.getShader("flash").clone());
|
|
157
|
+
* // a complete program hosts on a mesh, replacing the built-in shading
|
|
158
|
+
* myMesh.addPostEffect(me.loader.getShader("toonMesh"));
|
|
159
|
+
* });
|
|
160
|
+
*/
|
|
161
|
+
export function getShader(elt: string): ShaderEffect | GLShader | null;
|
|
162
|
+
/**
|
|
163
|
+
* return the specified MTL material data
|
|
164
|
+
* @param {string} elt - name of the MTL file (as specified in the preload list)
|
|
165
|
+
* @returns {object} map of material names to properties (`Kd`, `d`, `map_Kd`), or null if not found
|
|
166
|
+
* @category Assets
|
|
167
|
+
* @example
|
|
168
|
+
* // 1. preload OBJ + MTL + texture
|
|
169
|
+
* me.loader.preload([
|
|
170
|
+
* { name: "fox", type: "obj", src: "models/fox.obj" },
|
|
171
|
+
* { name: "fox", type: "mtl", src: "models/fox.mtl" },
|
|
172
|
+
* { name: "colormap", type: "image", src: "models/colormap.png" },
|
|
173
|
+
* ], () => {
|
|
174
|
+
* // 2. create a Mesh with material — texture, tint, opacity auto-applied
|
|
175
|
+
* const mesh = new me.Mesh(400, 300, {
|
|
176
|
+
* model: "fox",
|
|
177
|
+
* material: "fox",
|
|
178
|
+
* texture: "colormap",
|
|
179
|
+
* width: 200,
|
|
180
|
+
* height: 200,
|
|
181
|
+
* });
|
|
182
|
+
*
|
|
183
|
+
* // 3. or access the raw material data directly
|
|
184
|
+
* const materials = me.loader.getMTL("fox");
|
|
185
|
+
* // materials["colormap"].Kd — [r, g, b] diffuse color (0-1 range)
|
|
186
|
+
* // materials["colormap"].d — opacity (0-1)
|
|
187
|
+
* // materials["colormap"].Ke — [r, g, b] emissive color (glow, applied as Mesh.emissive)
|
|
188
|
+
* // materials["colormap"].map_Kd — resolved texture URL
|
|
189
|
+
* });
|
|
190
|
+
*/
|
|
191
|
+
export function getMTL(elt: string): object;
|
|
192
|
+
/**
|
|
193
|
+
* return the specified Video Object
|
|
194
|
+
* @param {string} elt - name of the video file
|
|
195
|
+
* @returns {HTMLVideoElement}
|
|
196
|
+
* @category Assets
|
|
197
|
+
*/
|
|
198
|
+
export function getVideo(elt: string): HTMLVideoElement;
|
|
199
|
+
/**
|
|
200
|
+
* return the specified FontFace Object
|
|
201
|
+
* @param {string} elt - name of the font file
|
|
202
|
+
* @returns {FontFace}
|
|
203
|
+
* @category Assets
|
|
204
|
+
*/
|
|
205
|
+
export function getFont(elt: string): FontFace;
|
|
206
|
+
/**
|
|
207
|
+
* additional imports for TypeScript
|
|
208
|
+
*
|
|
209
|
+
* Type-only, so they add no runtime edge and this module stays importable
|
|
210
|
+
* from anywhere. Without them the unions below silently degrade to `any` in
|
|
211
|
+
* the generated declarations, which `tsc` does not report.
|
|
212
|
+
* @import {CompressedImage} from "./parsers/compressed_textures/compressed_image.js";
|
|
213
|
+
* @import {GLTFData} from "./parsers/gltf.js";
|
|
214
|
+
* @import GLShader from "../video/webgl/glshader.js";
|
|
215
|
+
* @import ShaderEffect from "../video/effects/shadereffect.js";
|
|
216
|
+
*/
|
|
1
217
|
/**
|
|
2
218
|
* where all preloaded content is cached
|
|
3
219
|
*/
|
|
@@ -11,4 +227,8 @@ export const objList: {};
|
|
|
11
227
|
export const mtlList: {};
|
|
12
228
|
export const gltfList: {};
|
|
13
229
|
export const shaderList: {};
|
|
230
|
+
import type { CompressedImage } from "./parsers/compressed_textures/compressed_image.js";
|
|
231
|
+
import type { GLTFData } from "./parsers/gltf.js";
|
|
232
|
+
import type ShaderEffect from "../video/effects/shadereffect.js";
|
|
233
|
+
import type GLShader from "../video/webgl/glshader.js";
|
|
14
234
|
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/loader/cache.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/loader/cache.js"],"names":[],"mappings":"AAsFA;;;;;;;;;;GAUG;AACH,+BANW,MAAM,QACN,MAAM,GACJ,OAAO,CAOnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,kCANW,MAAM,QACN,MAAM,GACJ,OAAO,CAWnB;AAED;;;;;;;;;GASG;AACH,iCALW,MAAM,GACJ,MAAM,EAAE,CAOpB;AAeD;;;;;GAKG;AACH,4BAJW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;GAKG;AACH,+BAJW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;GAKG;AACH,gCAJW,MAAM,GACJ,gBAAgB,GAAC,eAAe,GAAC,IAAI,CAWjD;AAED;;;;;GAKG;AACH,6BAJW,MAAM,GACJ,IAAI,CAUhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,4BA3BW,MAAM,GACJ,MAAM,CAiClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,6BAhBW,MAAM,GACJ,QAAQ,GAAC,IAAI,CAqBzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,+BA7BW,MAAM,GACJ,YAAY,GAAC,QAAQ,GAAC,IAAI,CAkCtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,4BA3BW,MAAM,GACJ,MAAM,CAgClB;AAED;;;;;GAKG;AACH,8BAJW,MAAM,GACJ,gBAAgB,CAU5B;AAED;;;;;GAKG;AACH,6BAJW,MAAM,GACJ,QAAQ,CAUpB;AAlbD;;;;;;;;;;GAUG;AAEH;;GAEG;AAGH,yBAA0B;AAG1B,yBAA0B;AAG1B,yBAA0B;AAG1B,0BAA2B;AAG3B,2BAA4B;AAG5B,0BAA2B;AAG3B,yBAA0B;AAG1B,yBAA0B;AAG1B,0BAA2B;AAK3B,4BAA6B;AAyB7B;;;;;;;;;;GAUG;AACH,2BAJU,SAAS,MAAM,EAAE,CAIyC;qCA5ElC,mDAAmD;8BAC1D,mBAAmB;8BAEjB,kCAAkC;0BADtC,4BAA4B"}
|