melonjs 19.8.0 → 19.9.1
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 +3 -0
- package/build/application/application.d.ts.map +1 -1
- package/build/application/resize.d.ts.map +1 -1
- package/build/audio/audio.d.ts +1 -1
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend.d.ts +21 -2
- package/build/audio/backend.d.ts.map +1 -1
- package/build/audio/playback.d.ts +8 -28
- package/build/audio/playback.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/geometries/path2d.d.ts +188 -75
- package/build/geometries/path2d.d.ts.map +1 -1
- package/build/geometries/rectangle.d.ts.map +1 -1
- package/build/index.d.ts +5 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3367 -634
- package/build/index.js.map +4 -4
- package/build/loader/cache.d.ts +1 -0
- package/build/loader/cache.d.ts.map +1 -1
- package/build/loader/loader.d.ts +61 -3
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/fetchdata.d.ts +14 -0
- package/build/loader/parsers/fetchdata.d.ts.map +1 -1
- package/build/loader/parsers/shader.d.ts +47 -0
- package/build/loader/parsers/shader.d.ts.map +1 -0
- package/build/loader/parsers/video.d.ts.map +1 -1
- package/build/math/color.d.ts.map +1 -1
- package/build/math/matrix2d.d.ts.map +1 -1
- package/build/math/noise.d.ts +141 -0
- package/build/math/noise.d.ts.map +1 -0
- package/build/math/observableVector2d.d.ts +1 -1
- package/build/math/observableVector2d.d.ts.map +1 -1
- package/build/math/observableVector3d.d.ts +1 -1
- package/build/math/observableVector3d.d.ts.map +1 -1
- package/build/math/vector2d.d.ts +1 -1
- package/build/math/vector2d.d.ts.map +1 -1
- package/build/math/vector3d.d.ts +1 -1
- package/build/math/vector3d.d.ts.map +1 -1
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +3 -1
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +4 -3
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/renderable/anchorPoint.d.ts +80 -0
- package/build/renderable/anchorPoint.d.ts.map +1 -0
- package/build/renderable/collectable.d.ts +7 -1
- package/build/renderable/collectable.d.ts.map +1 -1
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/entity/entity.d.ts +5 -2
- package/build/renderable/entity/entity.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts.map +1 -1
- package/build/renderable/imagelayer.d.ts +5 -2
- package/build/renderable/imagelayer.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +26 -2
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/nineslicesprite.d.ts +5 -7
- package/build/renderable/nineslicesprite.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +6 -1
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +13 -7
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +41 -5
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +24 -12
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/bitmaptextdata.d.ts +24 -1
- package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +50 -12
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/state/stage.d.ts.map +1 -1
- package/build/system/event.d.ts +18 -2
- package/build/system/event.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +4 -0
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/renderer.d.ts +41 -1
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +17 -6
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
- package/build/video/texture/atlas.d.ts +2 -1
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +55 -6
- package/build/video/texture/cache.d.ts.map +1 -1
- package/build/video/texture/frametexture.d.ts +73 -0
- package/build/video/texture/frametexture.d.ts.map +1 -0
- package/build/video/texture/noise_texture2d.d.ts +176 -0
- package/build/video/texture/noise_texture2d.d.ts.map +1 -0
- package/build/video/texture/parser/aseprite.d.ts.map +1 -1
- package/build/video/texture/texture2d.d.ts +83 -0
- package/build/video/texture/texture2d.d.ts.map +1 -0
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +30 -4
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +39 -3
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +13 -0
- package/build/video/webgl/buffer/index.d.ts.map +1 -1
- package/build/video/webgl/effects/hologram.d.ts +0 -5
- package/build/video/webgl/effects/hologram.d.ts.map +1 -1
- package/build/video/webgl/effects/shine.d.ts +0 -5
- package/build/video/webgl/effects/shine.d.ts.map +1 -1
- package/build/video/webgl/glshader.d.ts +29 -0
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/shadereffect.d.ts +183 -0
- package/build/video/webgl/shadereffect.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +41 -1
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -24,6 +24,23 @@
|
|
|
24
24
|
* mySprite.shader = pulse;
|
|
25
25
|
* // update the uniform each frame
|
|
26
26
|
* pulse.setUniform("uTime", time);
|
|
27
|
+
* @example
|
|
28
|
+
* // Shader builtins — no JS plumbing, no UV math:
|
|
29
|
+
* // `: screen_texture` keeps the sampler filled with everything drawn so
|
|
30
|
+
* // far (a back-buffer copy; one screen copy per draw of the effect),
|
|
31
|
+
* // `screen_uv` is this fragment's 0..1 screen position, and `noise_uv`
|
|
32
|
+
* // runs 0..1 across the sprite regardless of its atlas frame.
|
|
33
|
+
* const water = new ShaderEffect(renderer, `
|
|
34
|
+
* uniform sampler2D uNoise;
|
|
35
|
+
* uniform sampler2D screenTex : screen_texture;
|
|
36
|
+
* uniform float uTime;
|
|
37
|
+
* vec4 apply(vec4 color, vec2 uv) {
|
|
38
|
+
* vec2 flow = texture2D(uNoise, noise_uv + uTime * 0.25).rg;
|
|
39
|
+
* vec4 refracted = texture2D(screenTex, screen_uv + flow * 0.005);
|
|
40
|
+
* return refracted * texture2D(uSampler, uv + flow * 0.005);
|
|
41
|
+
* }
|
|
42
|
+
* `);
|
|
43
|
+
* water.setTexture("uNoise", noiseTexture.getTexture(), "repeat");
|
|
27
44
|
*/
|
|
28
45
|
export default class ShaderEffect {
|
|
29
46
|
/**
|
|
@@ -51,8 +68,56 @@ export default class ShaderEffect {
|
|
|
51
68
|
* @readonly
|
|
52
69
|
*/
|
|
53
70
|
readonly destroyed: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* When `true`, a renderable will NOT auto-destroy this effect when it is
|
|
73
|
+
* removed from its `postEffects` (via the `shader` setter,
|
|
74
|
+
* {@link Renderable#removePostEffect}, {@link Renderable#clearPostEffects})
|
|
75
|
+
* or when the renderable itself is destroyed. Set this on an effect shared
|
|
76
|
+
* across several renderables so one of them going away doesn't free the GL
|
|
77
|
+
* program still used by the others — you then own its lifecycle and call
|
|
78
|
+
* {@link destroy} yourself.
|
|
79
|
+
* @type {boolean}
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
shared: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* the renderer this effect was created for — kept so destroy and
|
|
85
|
+
* context-loss can release the texture units reserved on its cache
|
|
86
|
+
* for extra samplers ({@link setTexture}), and so {@link clone} can
|
|
87
|
+
* compile an independent copy
|
|
88
|
+
* @ignore
|
|
89
|
+
*/
|
|
90
|
+
_renderer: any;
|
|
91
|
+
/**
|
|
92
|
+
* the construction "recipe" (fragment body + precision), kept so
|
|
93
|
+
* {@link clone} can compile an independent copy. Stored before the
|
|
94
|
+
* Canvas-mode early return so cloning behaves consistently there too.
|
|
95
|
+
* @ignore
|
|
96
|
+
*/
|
|
97
|
+
_fragmentBody: string;
|
|
98
|
+
/** @ignore */
|
|
99
|
+
_precision: string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* samplers annotated `: screen_texture` — the renderer checks this to
|
|
102
|
+
* know when to refresh the shared frame capture before the effect draws
|
|
103
|
+
* @type {Array<{name: string, repeat: string}>}
|
|
104
|
+
* @ignore
|
|
105
|
+
*/
|
|
106
|
+
_screenTextureUniforms: Array<{
|
|
107
|
+
name: string;
|
|
108
|
+
repeat: string;
|
|
109
|
+
}>;
|
|
110
|
+
/** @ignore */
|
|
111
|
+
_hasNoiseUV: boolean | undefined;
|
|
54
112
|
/** @ignore */
|
|
55
113
|
_shader: GLShader | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* extra texture samplers bound via {@link setTexture}, keyed by the
|
|
116
|
+
* uniform name → `{ image, repeat, tex }` (`tex` is the uploaded GL
|
|
117
|
+
* texture, created lazily on first draw)
|
|
118
|
+
* @ignore
|
|
119
|
+
*/
|
|
120
|
+
_extraTextures: Map<any, any> | undefined;
|
|
56
121
|
/** @private */
|
|
57
122
|
private _onContextLost;
|
|
58
123
|
_enabledBeforeSuspend: boolean | undefined;
|
|
@@ -64,6 +129,123 @@ export default class ShaderEffect {
|
|
|
64
129
|
* @param {object|Float32Array} value - the value to assign to that uniform
|
|
65
130
|
*/
|
|
66
131
|
setUniform(name: string, value: object | Float32Array): void;
|
|
132
|
+
/**
|
|
133
|
+
* Set the shader's `uTime` uniform (elapsed time, in seconds). A convenience
|
|
134
|
+
* over `setUniform("uTime", ...)`; call it once per frame from your update
|
|
135
|
+
* loop to animate a shader that declares `uniform float uTime` (e.g. scrolling
|
|
136
|
+
* a static noise texture's UVs, pulsing, waving). Drive it with whatever clock
|
|
137
|
+
* you like — real time, a paused/scaled/scrubbed one.
|
|
138
|
+
*
|
|
139
|
+
* No-op if the shader does not declare a `uTime` uniform (nothing to update),
|
|
140
|
+
* or in Canvas mode. The engine does NOT call this for you — animation is
|
|
141
|
+
* opt-in, exactly like re-baking a {@link NoiseTexture2d} with `update(dt)`.
|
|
142
|
+
* @param {number} seconds - elapsed time in seconds
|
|
143
|
+
* @returns {ShaderEffect} this effect for chaining
|
|
144
|
+
* @example
|
|
145
|
+
* // a shader that scrolls a static seamless noise texture over time
|
|
146
|
+
* const flow = new me.ShaderEffect(renderer, `
|
|
147
|
+
* uniform float uTime;
|
|
148
|
+
* vec4 apply(vec4 color, vec2 uv) {
|
|
149
|
+
* return texture2D(uSampler, uv + vec2(uTime * 0.05, 0.0));
|
|
150
|
+
* }`);
|
|
151
|
+
* mySprite.shader = flow;
|
|
152
|
+
* // then in your Stage's update(dt):
|
|
153
|
+
* flow.setTime(me.timer.getTime() / 1000);
|
|
154
|
+
*/
|
|
155
|
+
setTime(seconds: number): ShaderEffect;
|
|
156
|
+
/**
|
|
157
|
+
* Feed the `noise_uv` builtin's frame rect for the object about to draw:
|
|
158
|
+
* the source texture dimensions, the destination (object) dimensions, and
|
|
159
|
+
* the frame's top-left UV origin. Called by the quad batchers per draw;
|
|
160
|
+
* a no-op unless this effect's fragment actually uses `noise_uv` (the
|
|
161
|
+
* `ME_*` uniforms only exist — and are only active — then).
|
|
162
|
+
* @param {number} sourceWidth - source texture width in pixels
|
|
163
|
+
* @param {number} sourceHeight - source texture height in pixels
|
|
164
|
+
* @param {number} objectWidth - destination (object) width in pixels
|
|
165
|
+
* @param {number} objectHeight - destination (object) height in pixels
|
|
166
|
+
* @param {number} u0 - the frame's left UV coordinate (flip-normalized)
|
|
167
|
+
* @param {number} v0 - the frame's top UV coordinate (flip-normalized)
|
|
168
|
+
* @ignore
|
|
169
|
+
*/
|
|
170
|
+
_setNoiseUVRect(sourceWidth: number, sourceHeight: number, objectWidth: number, objectHeight: number, u0: number, v0: number): void;
|
|
171
|
+
/**
|
|
172
|
+
* Apply the wrap mode a `: screen_texture(<repeat>)` annotation asked for
|
|
173
|
+
* onto the live capture handle. Captures are NPOT (canvas-sized), which
|
|
174
|
+
* WebGL 1 cannot repeat — warn once and keep the clamp there. The unit is
|
|
175
|
+
* force-activated first: the batcher's bind may have been skipped as
|
|
176
|
+
* redundant while the GL active unit points elsewhere.
|
|
177
|
+
* @ignore
|
|
178
|
+
*/
|
|
179
|
+
_applyCaptureWrap(batcher: any, glTex: any, entry: any): void;
|
|
180
|
+
_captureWrapWarned: boolean | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* Bind an **extra** texture to a named `sampler2D` uniform in this shader, so
|
|
183
|
+
* a custom effect can read a *second* texture — a noise map, mask, gradient,
|
|
184
|
+
* flow/lookup table — besides the sprite/target it post-processes (`uSampler`).
|
|
185
|
+
* The engine uploads, caches, and re-binds it to a reserved texture unit each
|
|
186
|
+
* time the effect draws, and points the sampler uniform at it — no raw WebGL
|
|
187
|
+
* texture-unit juggling.
|
|
188
|
+
*
|
|
189
|
+
* Declare the sampler in your fragment (`uniform sampler2D <name>;`) and pass
|
|
190
|
+
* that name here. Any engine texture works — a {@link Texture2d} asset
|
|
191
|
+
* (`NoiseTexture2d`, `TextureAtlas`, …) can be passed directly, or a raw
|
|
192
|
+
* drawable source. No-op in Canvas mode.
|
|
193
|
+
* @param {string} name - the `sampler2D` uniform name declared in the fragment
|
|
194
|
+
* @param {Texture2d|HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} image - the texture: an engine texture asset, or a raw drawable source
|
|
195
|
+
* @param {"repeat"|"repeat-x"|"repeat-y"|"no-repeat"} [repeat="no-repeat"] - wrap mode; use `"repeat"` for a tiled/scrolled texture (power-of-two size under WebGL 1)
|
|
196
|
+
* @returns {ShaderEffect} this effect for chaining
|
|
197
|
+
* @example
|
|
198
|
+
* // "water": distort the sprite by a static noise texture scrolled over time
|
|
199
|
+
* const noise = new me.NoiseTexture2d({ width: 256, height: 256, seamless: true });
|
|
200
|
+
* const water = new me.ShaderEffect(renderer, `
|
|
201
|
+
* uniform sampler2D uNoise;
|
|
202
|
+
* uniform float uTime;
|
|
203
|
+
* vec4 apply(vec4 color, vec2 uv) {
|
|
204
|
+
* vec2 flow = texture2D(uNoise, uv + uTime * 0.03).rg - 0.5;
|
|
205
|
+
* return texture2D(uSampler, uv + flow * 0.02);
|
|
206
|
+
* }`);
|
|
207
|
+
* water.setTexture("uNoise", noise, "repeat");
|
|
208
|
+
* waterSprite.shader = water;
|
|
209
|
+
* // each frame, in your Stage's update(dt):
|
|
210
|
+
* water.setTime(me.timer.getTime() / 1000);
|
|
211
|
+
*/
|
|
212
|
+
setTexture(name: string, image: Texture2d | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap, repeat?: "repeat" | "repeat-x" | "repeat-y" | "no-repeat"): ShaderEffect;
|
|
213
|
+
/**
|
|
214
|
+
* (Re)bind this effect's extra textures ({@link setTexture}) to reserved GL
|
|
215
|
+
* texture units and point their sampler uniforms at them. Called by the
|
|
216
|
+
* renderer right after this effect's shader is bound — for both the
|
|
217
|
+
* post-effect blit and the single-effect `customShader` sprite path — so the
|
|
218
|
+
* bindings survive the batcher's rotating color-texture pool.
|
|
219
|
+
* @param {object} batcher - the active batcher (owns the GL texture units)
|
|
220
|
+
* @ignore
|
|
221
|
+
*/
|
|
222
|
+
_prepareTextures(batcher: object): void;
|
|
223
|
+
_textureOverflowWarned: boolean | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Create an independent copy of this effect, compiled as its own GL
|
|
226
|
+
* program. Use it when several renderables need the same effect with
|
|
227
|
+
* *different* uniform values — a single instance has a single set of
|
|
228
|
+
* uniforms, shared by everything it is assigned to.
|
|
229
|
+
*
|
|
230
|
+
* The clone copies the **recipe**: the fragment source, float precision,
|
|
231
|
+
* every uniform value set so far, and any extra textures bound via
|
|
232
|
+
* {@link setTexture} (the clone uploads and owns its own GL copies).
|
|
233
|
+
* It does NOT copy **ownership or lifecycle** state — in particular the
|
|
234
|
+
* clone's {@link shared} flag is **always reset to `false`**, even when
|
|
235
|
+
* cloning a shared shader (such as one returned by `loader.getShader()`):
|
|
236
|
+
* the clone is caller-owned and will be auto-destroyed by the renderable
|
|
237
|
+
* it is assigned to, exactly like a hand-constructed effect. Set
|
|
238
|
+
* `shared = true` on the clone yourself if you intend to reuse it across
|
|
239
|
+
* several renderables.
|
|
240
|
+
* @returns {ShaderEffect} a new, caller-owned effect (`shared === false`)
|
|
241
|
+
* @example
|
|
242
|
+
* // the loader's shader is ONE shared program — one uniform state for all
|
|
243
|
+
* sprite.shader = loader.getShader("flash");
|
|
244
|
+
* // the boss needs its own intensity — clone a private, caller-owned copy
|
|
245
|
+
* boss.shader = loader.getShader("flash").clone();
|
|
246
|
+
* boss.shader.setUniform("uIntensity", 0.9);
|
|
247
|
+
*/
|
|
248
|
+
clone(): ShaderEffect;
|
|
67
249
|
/** @ignore */
|
|
68
250
|
bind(): void;
|
|
69
251
|
/** @ignore */
|
|
@@ -88,4 +270,5 @@ export default class ShaderEffect {
|
|
|
88
270
|
destroy(): void;
|
|
89
271
|
}
|
|
90
272
|
import GLShader from "./glshader.js";
|
|
273
|
+
import Texture2d from "../texture/texture2d.ts";
|
|
91
274
|
//# sourceMappingURL=shadereffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadereffect.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/shadereffect.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shadereffect.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/shadereffect.js"],"names":[],"mappings":"AAoHA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH;IAiCC;;;;;;OAMG;IACH,sBANW,aAAa,GAAC,c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AEC;IAED,cAAc;IACd,kBAEC;IAED,cAAc;IACd,oBAEC;IAED,cAAc;IACd,qBAEC;IAED,cAAc;IACd,uBAEC;IAED;;;;OAIG;IACH,gBA4BC;CACD;qBAlxBoB,eAAe;sBADd,yBAAyB"}
|
|
@@ -21,7 +21,8 @@ export default class WebGLRenderer extends Renderer {
|
|
|
21
21
|
* @type {Matrix3d}
|
|
22
22
|
* @ignore
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
_effectProjectionStack: Matrix3d;
|
|
25
|
+
_effectPassDepth: number;
|
|
25
26
|
/**
|
|
26
27
|
* sets or returns the shape used to join two line segments where they meet.
|
|
27
28
|
* Out of the three possible values for this property: "round", "bevel", and "miter", only "round" is supported for now in WebGL
|
|
@@ -57,6 +58,7 @@ export default class WebGLRenderer extends Renderer {
|
|
|
57
58
|
_clipAABB: Bounds;
|
|
58
59
|
_polyVerts: any[];
|
|
59
60
|
_currentGradient: any;
|
|
61
|
+
_maskVisibleRef: number;
|
|
60
62
|
/**
|
|
61
63
|
* The current transformation matrix used for transformations on the overall scene
|
|
62
64
|
* (alias to renderState.currentTransform for backward compatibility)
|
|
@@ -73,6 +75,15 @@ export default class WebGLRenderer extends Renderer {
|
|
|
73
75
|
* @type {WebGLProgram}
|
|
74
76
|
*/
|
|
75
77
|
currentProgram: WebGLProgram;
|
|
78
|
+
/**
|
|
79
|
+
* the GL texture unit currently active (`gl.activeTexture`) — global
|
|
80
|
+
* GL state, so tracked once per renderer and shared by every batcher
|
|
81
|
+
* through the `MaterialBatcher.currentTextureUnit` accessor. `-1`
|
|
82
|
+
* forces the next bind to re-issue `gl.activeTexture`.
|
|
83
|
+
* @type {number}
|
|
84
|
+
* @ignore
|
|
85
|
+
*/
|
|
86
|
+
_activeTextureUnit: number;
|
|
76
87
|
/**
|
|
77
88
|
* The list of active batchers
|
|
78
89
|
* @type {Map<Batcher>}
|
|
@@ -88,6 +99,7 @@ export default class WebGLRenderer extends Renderer {
|
|
|
88
99
|
get WebGLVersion(): number;
|
|
89
100
|
_lightShader: RadialGradientEffect | undefined;
|
|
90
101
|
_lightAtlas: TextureAtlas | undefined;
|
|
102
|
+
_frameTexture: FrameTexture | undefined;
|
|
91
103
|
_orthogonalTMXGPURenderer: OrthogonalTMXLayerGPURenderer | null | undefined;
|
|
92
104
|
/**
|
|
93
105
|
* Draw a TMX tile layer through whichever path the layer's `renderMode`
|
|
@@ -149,6 +161,32 @@ export default class WebGLRenderer extends Renderer {
|
|
|
149
161
|
* @ignore
|
|
150
162
|
*/
|
|
151
163
|
_getLightAtlas(): TextureAtlas;
|
|
164
|
+
/**
|
|
165
|
+
* The renderer-owned shared frame-capture slot, minted lazily so it has a
|
|
166
|
+
* stable identity from the moment an effect is constructed — before the
|
|
167
|
+
* first actual capture fills it (`glTexture` stays `null` until then, and
|
|
168
|
+
* the live-sampler bind path skips unfilled captures). `ShaderEffect`
|
|
169
|
+
* wires `: screen_texture` annotated samplers to this object.
|
|
170
|
+
* @returns {FrameTexture} the shared capture slot
|
|
171
|
+
* @ignore
|
|
172
|
+
*/
|
|
173
|
+
getSharedFrameTexture(): FrameTexture;
|
|
174
|
+
/**
|
|
175
|
+
* Forget the cached binding for GL texture `unit` on every batcher (except
|
|
176
|
+
* `except`). Call this whenever a texture is bound to a unit **directly** —
|
|
177
|
+
* bypassing the shared texture cache and its `GPU_TEXTURE_CACHE_RESET`
|
|
178
|
+
* coordination — as {@link WebGLRenderer#toFrameTexture}'s capture copy and
|
|
179
|
+
* {@link ShaderEffect#_prepareTextures}'s reserved extra samplers both do.
|
|
180
|
+
* Those binds land on the TOP of the unit range, which overlaps the lit quad
|
|
181
|
+
* batcher's normal-map units; without invalidation a later lit draw would
|
|
182
|
+
* assume its normal map is still resident there and skip re-binding it,
|
|
183
|
+
* sampling the directly-bound texture as a normal map (wrong lighting).
|
|
184
|
+
* @param {number} unit - the GL texture unit that was clobbered
|
|
185
|
+
* @param {Batcher} [except] - a batcher to skip (the one that just bound the
|
|
186
|
+
* texture — its own cache is already accurate)
|
|
187
|
+
* @ignore
|
|
188
|
+
*/
|
|
189
|
+
invalidateTextureUnit(unit: number, except?: Batcher): void;
|
|
152
190
|
/** @ignore */
|
|
153
191
|
endPostEffect(renderable: any): void;
|
|
154
192
|
/**
|
|
@@ -453,6 +491,7 @@ export default class WebGLRenderer extends Renderer {
|
|
|
453
491
|
* @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
|
|
454
492
|
*/
|
|
455
493
|
setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse, invert?: boolean): void;
|
|
494
|
+
_maskDepthWarned: boolean | undefined;
|
|
456
495
|
#private;
|
|
457
496
|
}
|
|
458
497
|
import Renderer from "./../renderer.js";
|
|
@@ -462,6 +501,7 @@ import type { Batcher } from "./batchers/batcher.js";
|
|
|
462
501
|
import TextureCache from "./../texture/cache.js";
|
|
463
502
|
import RadialGradientEffect from "./effects/radialGradient.js";
|
|
464
503
|
import { TextureAtlas } from "./../texture/atlas.js";
|
|
504
|
+
import { FrameTexture } from "./../texture/frametexture.js";
|
|
465
505
|
import OrthogonalTMXLayerGPURenderer from "./renderers/tmxlayer/orthogonal.js";
|
|
466
506
|
import { Color } from "./../../math/color.ts";
|
|
467
507
|
import type { Rect } from "./../../geometries/rectangle.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"AA0DA;;;GAGG;AACH;IAQE;;;;;OAKG;IACH,oBAJU,MAAM,CAIU;IAU1B;;;;OAIG;IACH,IAFU,qBAAqB,CAEI;IAYnC;;;;OAIG;IAIH,wBANU,QAAQ,CAMc;IAChC,yBAAyB;IASzB;;;;;OAKG;IACH,UAHU,MAAM,CAGO;IAEvB;;;OAGG;IACH,cA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OAAO,GAAC,IAAI,GAAC,OAAO,WACnC,OAAO,QA0DjB;IArCE,sCAA4B;;CAoD/B;qBAxzFoB,kBAAkB;yBAZd,wBAAwB;uBAC1B,yBAAyB;6BAyCtB,uBAAuB;yBA1BxB,uBAAuB;iCAYf,6BAA6B;6BAbpB,uBAAuB;6BAEpC,8BAA8B;0CAajB,oCAAoC;sBAhC7C,uBAAuB;0BAqCjC,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B;8BAC9B,wBAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melonjs",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.9.1",
|
|
4
4
|
"description": "melonJS Game Engine",
|
|
5
5
|
"homepage": "http://www.melonjs.org/",
|
|
6
6
|
"type": "module",
|
|
@@ -59,19 +59,19 @@
|
|
|
59
59
|
"howler": "2.2.4"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@types/howler": "^2.2.
|
|
62
|
+
"@types/howler": "^2.2.13",
|
|
63
63
|
"@types/node": "^25.6.0",
|
|
64
64
|
"concurrently": "^9.2.1",
|
|
65
65
|
"del-cli": "^7.0.0",
|
|
66
66
|
"esbuild": "^0.27.3",
|
|
67
67
|
"serve": "^14.2.6",
|
|
68
68
|
"tsconfig": "workspace:^",
|
|
69
|
-
"tsx": "^4.
|
|
70
|
-
"type-fest": "^5.
|
|
71
|
-
"typedoc": "^0.28.
|
|
69
|
+
"tsx": "^4.23.1",
|
|
70
|
+
"type-fest": "^5.8.0",
|
|
71
|
+
"typedoc": "^0.28.20",
|
|
72
72
|
"typescript": "^6.0.2",
|
|
73
|
-
"vite": "8.
|
|
74
|
-
"vite-plugin-glsl": "^1.6.
|
|
73
|
+
"vite": "8.1.5",
|
|
74
|
+
"vite-plugin-glsl": "^1.6.1"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"dev": "concurrently --raw \"pnpm build:watch\" \"pnpm tsc:watch\" \"pnpm doc:watch\"",
|