melonjs 19.8.0 → 19.9.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 +3 -0
- package/build/application/application.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/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 +3276 -594
- 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/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/entity/entity.d.ts +5 -2
- package/build/renderable/entity/entity.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 +10 -6
- 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/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 +5 -5
package/build/system/event.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Vector2d } from "../math/vector2d.ts";
|
|
|
7
7
|
import { Draggable } from "../renderable/draggable.js";
|
|
8
8
|
import type Stage from "../state/stage.ts";
|
|
9
9
|
import Renderer from "../video/renderer.js";
|
|
10
|
+
import type { Texture2dSource } from "../video/texture/texture2d.ts";
|
|
10
11
|
/**
|
|
11
12
|
* event when the DOM is Ready is booting
|
|
12
13
|
* @see event.on
|
|
@@ -334,10 +335,24 @@ export declare const GPU_TEXTURE_CACHE_RESET = "renderer.gpu.texturecachereset";
|
|
|
334
335
|
* `RenderPassEncoder` (clear loadOps replace `clear()` calls in WebGPU's
|
|
335
336
|
* declarative pass descriptors).
|
|
336
337
|
*
|
|
337
|
-
* Data passed:
|
|
338
|
+
* Data passed: the emitting renderer. Subscribers holding per-renderer
|
|
339
|
+
* state should ignore broadcasts from other renderer instances (several
|
|
340
|
+
* Applications can coexist on one page); a missing argument (legacy
|
|
341
|
+
* emitters) should be treated as "mine".
|
|
338
342
|
* @see event.on
|
|
339
343
|
*/
|
|
340
344
|
export declare const RENDER_TARGET_CHANGED = "renderer.target.changed";
|
|
345
|
+
/**
|
|
346
|
+
* Fired when a {@link Texture2d} asset is destroyed, with its backing
|
|
347
|
+
* drawable source. GPU-side caches keyed by source image — e.g. the lit
|
|
348
|
+
* batcher's per-image normal-map textures — subscribe to release the GL
|
|
349
|
+
* texture and drop their entry, so destroying a texture (a per-level
|
|
350
|
+
* {@link NoiseTexture2d}, for instance) doesn't leak GPU memory.
|
|
351
|
+
*
|
|
352
|
+
* Data passed: the destroyed texture's backing canvas/image
|
|
353
|
+
* @see event.on
|
|
354
|
+
*/
|
|
355
|
+
export declare const TEXTURE2D_DESTROYED = "texture2d.destroyed";
|
|
341
356
|
interface Events {
|
|
342
357
|
[DOM_READY]: () => void;
|
|
343
358
|
[BOOT]: () => void;
|
|
@@ -384,7 +399,8 @@ interface Events {
|
|
|
384
399
|
[ONCONTEXT_LOST]: (renderer: Renderer) => void;
|
|
385
400
|
[ONCONTEXT_RESTORED]: (renderer: Renderer) => void;
|
|
386
401
|
[GPU_TEXTURE_CACHE_RESET]: () => void;
|
|
387
|
-
[RENDER_TARGET_CHANGED]: () => void;
|
|
402
|
+
[RENDER_TARGET_CHANGED]: (renderer?: object) => void;
|
|
403
|
+
[TEXTURE2D_DESTROYED]: (source: Texture2dSource) => void;
|
|
388
404
|
}
|
|
389
405
|
/**
|
|
390
406
|
* Add a listener for a given event.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/system/event.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH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nB,OAAO,CAAC,EAAE,GAAG,WAGb"}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* @import {Line} from "./../../geometries/line.ts";
|
|
7
7
|
* @import {Ellipse} from "./../../geometries/ellipse.ts";
|
|
8
8
|
* @import {Matrix2d} from "../../math/matrix2d.ts";
|
|
9
|
+
* @import {Bounds} from "../../physics/bounds.ts";
|
|
10
|
+
* @import {default as Texture2d} from "../texture/texture2d.ts";
|
|
9
11
|
*/
|
|
10
12
|
/**
|
|
11
13
|
* a canvas renderer object
|
|
@@ -14,6 +16,7 @@
|
|
|
14
16
|
export default class CanvasRenderer extends Renderer {
|
|
15
17
|
cache: TextureCache;
|
|
16
18
|
_lightCache: WeakMap<object, any> | undefined;
|
|
19
|
+
_frameTexture: any;
|
|
17
20
|
/**
|
|
18
21
|
* Reset the canvas transform to identity
|
|
19
22
|
*/
|
|
@@ -329,5 +332,6 @@ import type { RoundRect } from "./../../geometries/roundrect.ts";
|
|
|
329
332
|
import type { Polygon } from "../../geometries/polygon.ts";
|
|
330
333
|
import type { Line } from "./../../geometries/line.ts";
|
|
331
334
|
import type { Ellipse } from "./../../geometries/ellipse.ts";
|
|
335
|
+
import type { Bounds } from "../../physics/bounds.ts";
|
|
332
336
|
import type { Matrix2d } from "../../math/matrix2d.ts";
|
|
333
337
|
//# sourceMappingURL=canvas_renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/canvas/canvas_renderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canvas_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/canvas/canvas_renderer.js"],"names":[],"mappings":"AAaA;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH;IAcE,oBAAmC;IA4CnC,8CAA4B;IAyE1B,mBAA0B;IAsB7B;;OAEG;IACH,uBAEC;IAED;;;;;OAKG;IACH,sBAFW,QAAQ,QAclB;IAED;;;;;;;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O,QAgGjB;IApFC,2CAAkC;CAgGpC;qBAl/CoB,kBAAkB;yBACd,uBAAuB;sBAV1B,uBAAuB;0BAetB,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B;4BAEhC,yBAAyB;8BADvB,wBAAwB"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @import {Line} from "./../geometries/line.ts";
|
|
9
9
|
* @import {Ellipse} from "./../geometries/ellipse.ts";
|
|
10
10
|
* @import {Bounds} from "./../physics/bounds.ts";
|
|
11
|
+
* @import {default as Texture2d} from "./texture/texture2d.ts";
|
|
11
12
|
*/
|
|
12
13
|
/**
|
|
13
14
|
* a base renderer object
|
|
@@ -665,6 +666,44 @@ declare class Renderer {
|
|
|
665
666
|
* renderer.toDataURL().then((dataURL) => console.log(dataURL));
|
|
666
667
|
*/
|
|
667
668
|
toDataURL(type?: string, quality?: number): Promise<any>;
|
|
669
|
+
/**
|
|
670
|
+
* Capture the current frame — everything drawn to the active framebuffer /
|
|
671
|
+
* canvas so far — into a {@link Texture2d}, on the GPU where possible (no
|
|
672
|
+
* `readPixels` round-trip). The fourth member of the {@link Renderer#toDataURL}
|
|
673
|
+
* / {@link Renderer#toBlob} / {@link Renderer#toImageBitmap} family — "the
|
|
674
|
+
* current frame as X" — and the only one whose result can stay GPU-resident,
|
|
675
|
+
* ready to feed a shader as a screen texture (water refraction, heat haze,
|
|
676
|
+
* frosted glass).
|
|
677
|
+
*
|
|
678
|
+
* Abstract on the base renderer: the concrete backends implement it —
|
|
679
|
+
* {@link WebGLRenderer#toFrameTexture} (a `copyTexImage2D` into a live GPU
|
|
680
|
+
* texture, bound as an extra sampler via {@link ShaderEffect#setTexture}) and
|
|
681
|
+
* {@link CanvasRenderer#toFrameTexture} (an offscreen-canvas copy, for family
|
|
682
|
+
* parity — custom shaders don't run under Canvas).
|
|
683
|
+
* @param {object} [options]
|
|
684
|
+
* @param {Texture2d|null} [options.target] - controls the destination: omit
|
|
685
|
+
* for the shared renderer slot (default); pass a capture previously
|
|
686
|
+
* returned by this method to refresh it in place; pass `null` to mint a
|
|
687
|
+
* fresh, caller-owned capture
|
|
688
|
+
* @param {Bounds|{x: number, y: number, width: number, height: number}} [options.region] - capture
|
|
689
|
+
* only this sub-region of the frame — a {@link Bounds} (or any
|
|
690
|
+
* `{x, y, width, height}`); from a {@link Rect} pass `rect.getBounds()`.
|
|
691
|
+
* NOTE the origin differs by backend: WebGL uses framebuffer coords
|
|
692
|
+
* (**bottom-left** origin), Canvas uses **top-left** — relevant under
|
|
693
|
+
* `video.AUTO`.
|
|
694
|
+
* @returns {Texture2d} a texture holding the captured frame
|
|
695
|
+
* @example
|
|
696
|
+
* effect.setTexture("uScene", renderer.toFrameTexture());
|
|
697
|
+
*/
|
|
698
|
+
toFrameTexture(options?: {
|
|
699
|
+
target?: Texture2d | null | undefined;
|
|
700
|
+
region?: Bounds | {
|
|
701
|
+
x: number;
|
|
702
|
+
y: number;
|
|
703
|
+
width: number;
|
|
704
|
+
height: number;
|
|
705
|
+
} | undefined;
|
|
706
|
+
}): Texture2d;
|
|
668
707
|
}
|
|
669
708
|
declare namespace Renderer {
|
|
670
709
|
let _whitePixel: any;
|
|
@@ -673,7 +712,7 @@ export default Renderer;
|
|
|
673
712
|
import CanvasRenderTarget from "./rendertarget/canvasrendertarget.js";
|
|
674
713
|
import { Vector2d } from "../math/vector2d.ts";
|
|
675
714
|
import type RenderTargetPool from "./rendertarget/render_target_pool.js";
|
|
676
|
-
import Path2D from "./../geometries/path2d.
|
|
715
|
+
import Path2D from "./../geometries/path2d.ts";
|
|
677
716
|
import { Color } from "./../math/color.ts";
|
|
678
717
|
import RenderState from "./renderstate.js";
|
|
679
718
|
import { Matrix3d } from "../math/matrix3d.ts";
|
|
@@ -684,4 +723,5 @@ import type { RoundRect } from "./../geometries/roundrect.ts";
|
|
|
684
723
|
import type { Polygon } from "../geometries/polygon.ts";
|
|
685
724
|
import type { Line } from "./../geometries/line.ts";
|
|
686
725
|
import type { Ellipse } from "./../geometries/ellipse.ts";
|
|
726
|
+
import type { default as Texture2d } from "./texture/texture2d.ts";
|
|
687
727
|
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/video/renderer.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/video/renderer.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;GAGG;AACH;IAiQC;;;;;;;;;;;;OAYG;IACH,2BANW,MAAM,UACN,MAAM,0BACN,OAAO,GAEL,iBAAiB,GAAC,eAAe,CAI7C;IAED;;;;;;;;;;;;OAYG;IACH,wBAFa,iBAAiB,GAAC,eAAe,CAgB7C;IA5SD;;OAEG;IACH,sBAFW,mBAAmB,EAsJ7B;IAnJA;;;;OAIG;IACH,cAFU,kBAAkB,CAS3B;IAED;;;;OAIG;IACH,iBAFU,MAAM,CAEO;IAEvB;;;;OAIG;IACH,oBAFU,MAAM,CAE6C;IAE7D;;;;OAIG;IACH,YAHU,QAAQ,CAGsD;IAExE;;;;OAIG;IACH,gBAFU,OAAO,CAES;IAE1B;;;;OAIG;IACH,aAFU,MAAM,GAAC,SAAS,CAEE;IAE5B;;;;;;OAMG;IACH,cAHU,QAAQ,GAAC,YAAY,GAAC,SAAS,CAGZ;IAE7B;;;;;OAKG;IACH,mBAHU,gBAAgB,GAAC,IAAI,CAGF;IAE7B;;;OAGG;IACH,QAFU,MAAM,CAEU;IAE1B;;;;OAIG;IACH,MAFU,MAAM,CAEK;IAErB;;;;;OAKG;IACH,iBAFU,KAAK,CAOd;IAED;;;;OAIG;IACH,aAFU,WAAW,CAEe;IAGpC,oBAAiD;IACjD,mBAA+C;IAC/C,4CAAqD;IAErD;;;;;;;;;OASG;IACH,WAHU,MAAM,CAGE;IAElB;;OA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IAED;;;;;;;;;;;;;;;OAeG;IACH,gBAHW,MAAM,QAgBhB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;;OAQG;IACH,qBANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;OAOG;IACH,iBANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IAEH,yBAfG;QAAiC,MAAM;QAIwC,MAAM;eAAlE,MAAM;eAAK,MAAM;mBAAS,MAAM;oBAAU,MAAM;;KAMnE,GAAU,SAAS,CAOrB;CACD;;;;;+BA1nC8B,sCAAsC;yBAL5C,qBAAqB;kCAQb,sCAAsC;mBAXpD,2BAA2B;sBACxB,oBAAoB;wBAMlB,kBAAkB;yBALjB,qBAAqB;0BAavB,8BAA8B;yBAT5B,eAAe;4BAcf,wBAAwB;+BAJrB,8BAA8B;6BAChC,0BAA0B;0BAC7B,yBAAyB;6BACtB,4BAA4B;0CAEf,wBAAwB"}
|
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
* Renderer-agnostic — the actual RenderTarget creation is delegated to a
|
|
7
7
|
* factory function provided by the renderer (WebGL, WebGPU, etc.).
|
|
8
8
|
*
|
|
9
|
-
* Camera effects use pool indices 0 and 1 (capture + ping-pong)
|
|
10
|
-
*
|
|
9
|
+
* Camera effects use pool indices 0 and 1 (capture + ping-pong); sprite
|
|
10
|
+
* effects use indices 2 and 3, and each NESTED sprite pass (a multi-effect
|
|
11
|
+
* renderable drawn inside another multi-effect renderable) gets its own pair
|
|
12
|
+
* above that (4/5, 6/7, …), tracked by a stack of active bases so begin/end
|
|
13
|
+
* pairs compose like save/restore.
|
|
11
14
|
* Render targets are lazily created and resized to match the required dimensions.
|
|
12
15
|
* @ignore
|
|
13
16
|
*/
|
|
@@ -20,10 +23,18 @@ export default class RenderTargetPool {
|
|
|
20
23
|
_factory: (arg0: number, arg1: number) => RenderTarget;
|
|
21
24
|
/** @type {RenderTarget[]} */
|
|
22
25
|
_pool: RenderTarget[];
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* active pass bases, innermost last — a STACK, so nested begin/end
|
|
28
|
+
* pairs unwind correctly (two scalars silently corrupted the pool on
|
|
29
|
+
* nested passes: the inner end() popped the outer pass's slot)
|
|
30
|
+
* @type {number[]}
|
|
31
|
+
*/
|
|
32
|
+
_baseStack: number[];
|
|
33
|
+
/**
|
|
34
|
+
* The base index of the innermost active pass, or -1 when none.
|
|
35
|
+
* @returns {number}
|
|
36
|
+
*/
|
|
37
|
+
get activeBase(): number;
|
|
27
38
|
/**
|
|
28
39
|
* Get or create a render target at the given pool index, resized to the given dimensions.
|
|
29
40
|
* @param {number} index - pool index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render_target_pool.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/render_target_pool.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"render_target_pool.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/render_target_pool.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH;IACC;;OAEG;IACH,qBAFW,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,KAAG,YAAY,EAchD;IAXA,qDAAqD;IACrD,UADW,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,KAAG,YAAY,CAC1B;IACvB,6BAA6B;IAC7B,OADW,YAAY,EAAE,CACV;IACf;;;;;OAKG;IACH,YAFU,MAAM,EAAE,CAEE;IAGrB;;;OAGG;IACH,kBAFa,MAAM,CAMlB;IAED;;;;;;OAMG;IACH,WALW,MAAM,SACN,MAAM,UACN,MAAM,GACJ,YAAY,CASxB;IAED;;;;;;;;OAQG;IACH,gBANW,OAAO,eACP,MAAM,SACN,MAAM,UACN,MAAM,GACJ,YAAY,CAuBxB;IAED;;;OAGG;IACH,oBAFa,YAAY,GAAC,SAAS,CAQlC;IAED;;;OAGG;IACH,qBAFa,YAAY,GAAC,SAAS,CAQlC;IAED;;;;OAIG;IACH,OAFa,YAAY,GAAC,IAAI,CAS7B;IAED;;;;OAIG;IACH,iBAHW,MAAM,UACN,MAAM,QAQhB;IAED;;OAEG;IACH,gBAQC;CACD;8BA3J4B,mBAAmB"}
|
|
@@ -42,7 +42,7 @@ export function identifyFormat(app: any): "melonJS" | "texturepacker" | "shoebox
|
|
|
42
42
|
* );
|
|
43
43
|
* @category Game Objects
|
|
44
44
|
*/
|
|
45
|
-
export class TextureAtlas {
|
|
45
|
+
export class TextureAtlas extends Texture2d {
|
|
46
46
|
/**
|
|
47
47
|
* @param {object|object[]} atlases - atlas information. See {@link loader.getJSON}
|
|
48
48
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|CompressedImage|string|OffscreenCanvas[]|HTMLImageElement[]|HTMLCanvasElement[]|string[]} [src=atlas.meta.image] - Image source
|
|
@@ -266,6 +266,7 @@ export class TextureAtlas {
|
|
|
266
266
|
getAnimationSettings(names?: string[] | number[]): object;
|
|
267
267
|
createAnimationFromName(names: any, settings: any): Sprite;
|
|
268
268
|
}
|
|
269
|
+
import Texture2d from "./texture2d.ts";
|
|
269
270
|
import Sprite from "./../../renderable/sprite.js";
|
|
270
271
|
import type NineSliceSprite from "./../../renderable/nineslicesprite.js";
|
|
271
272
|
//# sourceMappingURL=atlas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas.d.ts","sourceRoot":"","sources":["../../../src/video/texture/atlas.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"atlas.d.ts","sourceRoot":"","sources":["../../../src/video/texture/atlas.js"],"names":[],"mappings":"AAUA;;;GAGG;AAEH;;;GAGG;AACH;;;;;;;;;;;;;;;;;;;EAoBC;AAED;;;GAGG;AACH,+FAYC;AAED;;;;;;;;;;GAUG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;;;;;OA6BG;IACH;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,6BAnBW,MAAM,EAAE,GAAC,MAAM,EAAE,GAGf,MAAM,CAkFlB;IAED,2DAiDC;CACD;sBA5rBqB,gBAAgB;mBALnB,8BAA8B;iCASjB,uCAAuC"}
|
|
@@ -13,6 +13,7 @@ declare class TextureCache {
|
|
|
13
13
|
tinted: Map<any, any>;
|
|
14
14
|
units: Map<any, any>;
|
|
15
15
|
usedUnits: Set<any>;
|
|
16
|
+
reservedUnits: Map<any, any>;
|
|
16
17
|
max_size: number;
|
|
17
18
|
/**
|
|
18
19
|
* @ignore
|
|
@@ -22,6 +23,22 @@ declare class TextureCache {
|
|
|
22
23
|
* @ignore
|
|
23
24
|
*/
|
|
24
25
|
allocateTextureUnit(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Reserve a texture unit so {@link allocateTextureUnit} never hands it to a
|
|
28
|
+
* color texture — used by `ShaderEffect.setTexture` to hold high units for
|
|
29
|
+
* its extra samplers. Reference-counted, so a unit shared by several effects
|
|
30
|
+
* stays reserved until the last one releases it.
|
|
31
|
+
* @param {number} unit - the texture unit to reserve
|
|
32
|
+
* @ignore
|
|
33
|
+
*/
|
|
34
|
+
reserveUnit(unit: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Release a unit previously held by {@link reserveUnit}. The unit becomes
|
|
37
|
+
* allocatable again once its last holder releases it.
|
|
38
|
+
* @param {number} unit - the texture unit to release
|
|
39
|
+
* @ignore
|
|
40
|
+
*/
|
|
41
|
+
releaseUnit(unit: number): void;
|
|
25
42
|
/**
|
|
26
43
|
* Reset all texture unit assignments without clearing the texture cache.
|
|
27
44
|
* Used by multi-texture batching when the shader's sampler range is exceeded.
|
|
@@ -31,21 +48,53 @@ declare class TextureCache {
|
|
|
31
48
|
/**
|
|
32
49
|
* @ignore
|
|
33
50
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
51
|
+
* Frees the single `(source, repeat)` unit matching the texture's
|
|
52
|
+
* current `repeat` field — deliberately granular, so freeing one live
|
|
53
|
+
* consumer (e.g. one of two patterns with different repeats over the
|
|
54
|
+
* same image) never evicts the other's unit. When a SOURCE goes away
|
|
55
|
+
* entirely, use {@link freeAllUnits} instead — a source can hold units
|
|
56
|
+
* under several repeat modes (per-mesh `textureRepeat` overrides,
|
|
57
|
+
* #1503) that this granular free would leave pinned.
|
|
38
58
|
*/
|
|
39
59
|
freeTextureUnit(texture: any): void;
|
|
40
60
|
/**
|
|
41
61
|
* @ignore
|
|
62
|
+
*
|
|
63
|
+
* Free every texture unit allocated for the texture's source, across
|
|
64
|
+
* ALL repeat modes. A single source can hold several `(source, repeat)`
|
|
65
|
+
* units — patterns with different repeats over one image, or meshes
|
|
66
|
+
* sampling one image with per-mesh `textureRepeat` overrides (#1503) —
|
|
67
|
+
* and the source going away invalidates all of them at once.
|
|
68
|
+
*/
|
|
69
|
+
freeAllUnits(texture: any): void;
|
|
70
|
+
/**
|
|
71
|
+
* @ignore
|
|
72
|
+
* @param {string} [repeat] - overrides the texture's own `repeat` for the
|
|
73
|
+
* unit lookup — sampler state per use (a mesh's `textureRepeat`), so one
|
|
74
|
+
* source can be sampled with several wrap modes without mutating the
|
|
75
|
+
* shared atlas (#1503). Omit to use `texture.repeat`.
|
|
76
|
+
*
|
|
77
|
+
* Hot-path note: `getUnit` / `peekUnit` are called per-texture per-draw,
|
|
78
|
+
* so the `(source, repeat)` lookup is inlined here rather than going
|
|
79
|
+
* through a helper that allocates a `{source, repeat}` object per call.
|
|
80
|
+
*/
|
|
81
|
+
getUnit(texture: any, repeat?: string): any;
|
|
82
|
+
/**
|
|
83
|
+
* @ignore
|
|
84
|
+
* return every texture unit allocated for the given texture's source,
|
|
85
|
+
* across ALL repeat modes — the unload-time counterpart of the per-use
|
|
86
|
+
* `getUnit(texture, repeat)` override (#1503): a single source can hold
|
|
87
|
+
* one unit per wrap mode it was sampled with, and per-repeat `peekUnit`
|
|
88
|
+
* lookups would only ever find the one matching the texture's current
|
|
89
|
+
* `repeat` field. Not a hot path (allocates the result array).
|
|
42
90
|
*/
|
|
43
|
-
|
|
91
|
+
peekAllUnits(texture: any): any[];
|
|
44
92
|
/**
|
|
45
93
|
* @ignore
|
|
46
94
|
* return the texture unit for the given texture, or -1 if not allocated
|
|
95
|
+
* @param {string} [repeat] - same per-use wrap override as {@link getUnit}
|
|
47
96
|
*/
|
|
48
|
-
peekUnit(texture: any): any;
|
|
97
|
+
peekUnit(texture: any, repeat?: string): any;
|
|
49
98
|
/**
|
|
50
99
|
* @ignore
|
|
51
100
|
* cache the textureAltas for the given image
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/video/texture/cache.js"],"names":[],"mappings":";AAeA;;;GAGG;AACH;IACC;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/video/texture/cache.js"],"names":[],"mappings":";AAeA;;;GAGG;AACH;IACC;;OAEG;IACH,8CA4BC;IA1BA,cAAwB;IAExB,qBAAgC;IAChC,sBAAuB;IAavB,qBAAsB;IACtB,oBAA0B;IAM1B,6BAA8B;IAC9B,iBAAwB;IAIzB;;OAEG;IACH,cAKC;IAED;;OAEG;IACH,8BA4BC;IAED;;;;;;;OAOG;IACH,kBAHW,MAAM,QAKhB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,QAUhB;IAED;;;;OAIG;IACH,6BAIC;IAED;;;;;;;;;;OAUG;IACH,oCAaC;IAED;;;;;;;;OAQG;IACH,iCASC;IAED;;;;;;;;;;OAUG;IACH,+BATW,MAAM,OAuBhB;IAED;;;;;;;;OAQG;IACH,kCAIC;IAED;;;;OAIG;IACH,gCAFW,MAAM,OAShB;IAED;;;OAGG;IACH,yCAEC;IAED;;OAEG;IACH,yBAEC;IAED;;;OAGG;IACH,iCAwCC;IAED;;OAEG;IACH,yBAkBC;IAED;;OAEG;IACH,gCAcC;CACD;8BAjV6B,+BAA+B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A GPU-resident texture holding a captured frame — the value returned by
|
|
3
|
+
* {@link WebGLRenderer#toFrameTexture}. Its backing is a live `WebGLTexture`
|
|
4
|
+
* that the renderer refreshes **in place** on each capture, so a shader that
|
|
5
|
+
* has bound it once (via {@link ShaderEffect#setTexture}) keeps sampling the
|
|
6
|
+
* latest frame with no re-bind.
|
|
7
|
+
*
|
|
8
|
+
* Not part of the public class surface: obtain instances from
|
|
9
|
+
* `renderer.toFrameTexture()` and treat them as opaque {@link Texture2d}
|
|
10
|
+
* values. The `isGPUResident` flag is the discriminant `setTexture` uses to
|
|
11
|
+
* take its live-bind path (bind the existing handle) instead of uploading a
|
|
12
|
+
* static copy.
|
|
13
|
+
* @augments Texture2d
|
|
14
|
+
* @ignore
|
|
15
|
+
*/
|
|
16
|
+
export class FrameTexture extends Texture2d {
|
|
17
|
+
/**
|
|
18
|
+
* @param {WebGLRenderer} renderer - the owning renderer (for the GL context)
|
|
19
|
+
* @param {number} width - capture width in pixels
|
|
20
|
+
* @param {number} height - capture height in pixels
|
|
21
|
+
*/
|
|
22
|
+
constructor(renderer: WebGLRenderer, width: number, height: number);
|
|
23
|
+
_renderer: WebGLRenderer;
|
|
24
|
+
/** @type {number} */
|
|
25
|
+
width: number;
|
|
26
|
+
/** @type {number} */
|
|
27
|
+
height: number;
|
|
28
|
+
/**
|
|
29
|
+
* the live backing texture, (re)filled by `renderer.toFrameTexture` and
|
|
30
|
+
* bound (never re-uploaded) by consumers
|
|
31
|
+
* @type {WebGLTexture|null}
|
|
32
|
+
*/
|
|
33
|
+
glTexture: WebGLTexture | null;
|
|
34
|
+
/**
|
|
35
|
+
* marks this as a live GPU-resident source — see {@link ShaderEffect#setTexture}
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
*/
|
|
38
|
+
isGPUResident: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The opaque GPU-resident backing — itself.
|
|
41
|
+
* @returns {FrameTexture}
|
|
42
|
+
*/
|
|
43
|
+
getTexture(): FrameTexture;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The Canvas-renderer counterpart of {@link FrameTexture}: a captured frame
|
|
47
|
+
* backed by an offscreen `<canvas>` copy of the drawing buffer, keeping the
|
|
48
|
+
* `toFrameTexture` family renderer-complete. A drawable source (not
|
|
49
|
+
* GPU-resident), so it flows through the normal image path; custom shaders
|
|
50
|
+
* don't run under the Canvas renderer, so this exists for API parity and
|
|
51
|
+
* CPU-side reuse (e.g. drawing the captured frame back onto the scene).
|
|
52
|
+
* @augments Texture2d
|
|
53
|
+
* @ignore
|
|
54
|
+
*/
|
|
55
|
+
export class CanvasFrameTexture extends Texture2d {
|
|
56
|
+
/**
|
|
57
|
+
* @param {HTMLCanvasElement|OffscreenCanvas} canvas - the backing copy
|
|
58
|
+
*/
|
|
59
|
+
constructor(canvas: HTMLCanvasElement | OffscreenCanvas);
|
|
60
|
+
/** @type {HTMLCanvasElement|OffscreenCanvas} */
|
|
61
|
+
canvas: HTMLCanvasElement | OffscreenCanvas;
|
|
62
|
+
/** @type {number} */
|
|
63
|
+
width: number;
|
|
64
|
+
/** @type {number} */
|
|
65
|
+
height: number;
|
|
66
|
+
/**
|
|
67
|
+
* The backing canvas copy.
|
|
68
|
+
* @returns {HTMLCanvasElement|OffscreenCanvas}
|
|
69
|
+
*/
|
|
70
|
+
getTexture(): HTMLCanvasElement | OffscreenCanvas;
|
|
71
|
+
}
|
|
72
|
+
import Texture2d from "./texture2d.ts";
|
|
73
|
+
//# sourceMappingURL=frametexture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frametexture.d.ts","sourceRoot":"","sources":["../../../src/video/texture/frametexture.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH;IACC;;;;OAIG;IACH,sBAJW,aAAa,SACb,MAAM,UACN,MAAM,EAoBhB;IAhBA,yBAAyB;IACzB,qBAAqB;IACrB,OADW,MAAM,CACC;IAClB,qBAAqB;IACrB,QADW,MAAM,CACG;IACpB;;;;OAIG;IACH,WAFU,YAAY,GAAC,IAAI,CAEN;IACrB;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAG1B;;;OAGG;IACH,cAFa,YAAY,CAIxB;CAaD;AAED;;;;;;;;;GASG;AACH;IACC;;OAEG;IACH,oBAFW,iBAAiB,GAAC,eAAe,EAU3C;IANA,gDAAgD;IAChD,QADW,iBAAiB,GAAC,eAAe,CACxB;IACpB,qBAAqB;IACrB,OADW,MAAM,CACQ;IACzB,qBAAqB;IACrB,QADW,MAAM,CACU;IAG5B;;;OAGG;IACH,cAFa,iBAAiB,GAAC,eAAe,CAI7C;CACD;sBA/FqB,gBAAgB"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export default NoiseTexture2d;
|
|
2
|
+
/**
|
|
3
|
+
* A {@link Texture2d} that bakes a {@link Noise} field into a drawable canvas —
|
|
4
|
+
* usable directly as a sprite image, a normal map, an image layer, or a custom
|
|
5
|
+
* shader sampler.
|
|
6
|
+
*
|
|
7
|
+
* The bake runs on the CPU (renderer-agnostic, works under both the Canvas and
|
|
8
|
+
* WebGL backends) and produces an `HTMLCanvasElement` returned by
|
|
9
|
+
* {@link NoiseTexture2d#getTexture}. Three output modes:
|
|
10
|
+
* - **grayscale** (default) — the noise value mapped to `[0, 255]`.
|
|
11
|
+
* - **colorRamp** — the noise value mapped through a {@link Gradient}.
|
|
12
|
+
* - **asNormalMap** — the noise treated as a height field and encoded as
|
|
13
|
+
* tangent-space surface normals (RGB), for per-pixel lighting via
|
|
14
|
+
* {@link Sprite#normalMap} + {@link Light2d}.
|
|
15
|
+
*
|
|
16
|
+
* With `seamless: true` the texture's edges are cross-faded so it tiles with a
|
|
17
|
+
* much-reduced seam (an approximate, not pixel-exact, wrap); `seamlessBlendSkirt`
|
|
18
|
+
* controls how wide that edge blend band is. With `animated: true` the field is
|
|
19
|
+
* sampled in 3D (`getNoise3d`) using an internal `time` as the third axis —
|
|
20
|
+
* call {@link NoiseTexture2d#update} from your update loop to evolve it. Each
|
|
21
|
+
* re-bake bumps a `version` the renderer reads, so the GPU texture re-uploads
|
|
22
|
+
* automatically (and only when it actually changed — the three.js
|
|
23
|
+
* `Texture.needsUpdate` model).
|
|
24
|
+
*
|
|
25
|
+
* Note: live re-upload is currently wired through the lit **normal-map**
|
|
26
|
+
* pipeline ({@link Sprite#normalMap} + {@link Light2d}). An `animated` texture
|
|
27
|
+
* used as a plain color `image` bakes a static snapshot — the color texture
|
|
28
|
+
* cache does not yet honor `version` — so animate normals, not albedos, for now.
|
|
29
|
+
* @augments Texture2d
|
|
30
|
+
* @category Game Objects
|
|
31
|
+
* @example
|
|
32
|
+
* // a seamless water normal map fed to a lit sprite
|
|
33
|
+
* const ripples = new me.NoiseTexture2d({
|
|
34
|
+
* width: 256, height: 256,
|
|
35
|
+
* type: "simplex", octaves: 4, frequency: 0.03,
|
|
36
|
+
* seamless: true, asNormalMap: true, bumpStrength: 2, animated: true, speed: 0.6,
|
|
37
|
+
* });
|
|
38
|
+
* const water = new me.Sprite(x, y, { image: albedo, normalMap: ripples });
|
|
39
|
+
* // drive it yourself from your Stage's update(dt):
|
|
40
|
+
* ripples.update(dt);
|
|
41
|
+
*/
|
|
42
|
+
declare class NoiseTexture2d extends Texture2d {
|
|
43
|
+
/**
|
|
44
|
+
* @param {object} [settings] - configuration; any {@link Noise} setting
|
|
45
|
+
* (`type`, `seed`, `frequency`/`scale`, `octaves`, `gain`/`persistence`,
|
|
46
|
+
* `lacunarity`, `fractalType`, domain-warp settings) is forwarded when no
|
|
47
|
+
* `noise` instance is given.
|
|
48
|
+
* @param {number} [settings.width=256] - baked texture width in pixels
|
|
49
|
+
* @param {number} [settings.height=256] - baked texture height in pixels
|
|
50
|
+
* @param {Noise} [settings.noise] - an existing {@link Noise} to bake; when
|
|
51
|
+
* omitted one is built from the forwarded settings
|
|
52
|
+
* @param {boolean} [settings.seamless=false] - tile cleanly in both axes
|
|
53
|
+
* @param {number} [settings.seamlessBlendSkirt=0.1] - edge blend band width
|
|
54
|
+
* as a fraction (0..1) of the smaller dimension, when `seamless`
|
|
55
|
+
* @param {boolean} [settings.invert=false] - invert the noise value (`1 - v`)
|
|
56
|
+
* @param {boolean} [settings.asNormalMap=false] - encode as a normal map
|
|
57
|
+
* @param {number} [settings.bumpStrength=1] - normal steepness when `asNormalMap`
|
|
58
|
+
* @param {Gradient} [settings.colorRamp] - map the noise value to a color
|
|
59
|
+
* @param {boolean} [settings.animated=false] - sample in 3D (`getNoise3d`)
|
|
60
|
+
* using an internal `time` as the third axis, advanced by {@link NoiseTexture2d#update}
|
|
61
|
+
* @param {number} [settings.speed=1] - animation speed in noise z-units per
|
|
62
|
+
* second (only used while `animated`)
|
|
63
|
+
*/
|
|
64
|
+
constructor(settings?: {
|
|
65
|
+
width?: number | undefined;
|
|
66
|
+
height?: number | undefined;
|
|
67
|
+
noise?: Noise | undefined;
|
|
68
|
+
seamless?: boolean | undefined;
|
|
69
|
+
seamlessBlendSkirt?: number | undefined;
|
|
70
|
+
invert?: boolean | undefined;
|
|
71
|
+
asNormalMap?: boolean | undefined;
|
|
72
|
+
bumpStrength?: number | undefined;
|
|
73
|
+
colorRamp?: any;
|
|
74
|
+
animated?: boolean | undefined;
|
|
75
|
+
speed?: number | undefined;
|
|
76
|
+
});
|
|
77
|
+
/** baked texture width in pixels @type {number} */
|
|
78
|
+
width: number;
|
|
79
|
+
/** baked texture height in pixels @type {number} */
|
|
80
|
+
height: number;
|
|
81
|
+
/** the noise field baked by this texture @type {Noise} */
|
|
82
|
+
noise: Noise;
|
|
83
|
+
/** tile cleanly in both axes @type {boolean} */
|
|
84
|
+
seamless: boolean;
|
|
85
|
+
/** edge blend band width (0..1 of the smaller dimension) @type {number} */
|
|
86
|
+
seamlessBlendSkirt: number;
|
|
87
|
+
/** invert the noise value @type {boolean} */
|
|
88
|
+
invert: boolean;
|
|
89
|
+
/** encode the field as a tangent-space normal map @type {boolean} */
|
|
90
|
+
asNormalMap: boolean;
|
|
91
|
+
/** normal steepness when `asNormalMap` @type {number} */
|
|
92
|
+
bumpStrength: number;
|
|
93
|
+
/** optional color ramp applied to the noise value @type {Gradient|null} */
|
|
94
|
+
colorRamp: Gradient | null;
|
|
95
|
+
/** sample the field in 3D using `time` as the third axis @type {boolean} */
|
|
96
|
+
animated: boolean;
|
|
97
|
+
/** animation speed in noise z-units per second @type {number} */
|
|
98
|
+
speed: number;
|
|
99
|
+
/** the current animation time (third sampling axis) @type {number} */
|
|
100
|
+
time: number;
|
|
101
|
+
/** the baked output canvas (reused across re-bakes) @type {HTMLCanvasElement|null} @ignore */
|
|
102
|
+
_canvas: HTMLCanvasElement | null;
|
|
103
|
+
/** reused ImageData scratch (avoids a per-bake allocation) @type {ImageData|null} @ignore */
|
|
104
|
+
_imageData: ImageData | null;
|
|
105
|
+
/** reused height-field scratch (avoids a per-bake allocation) @type {Float32Array|null} @ignore */
|
|
106
|
+
_heights: Float32Array | null;
|
|
107
|
+
/** content revision, bumped on every bake and stamped on the canvas so
|
|
108
|
+
* the renderer re-uploads the GPU texture when it changes @type {number} @ignore */
|
|
109
|
+
_version: number;
|
|
110
|
+
/**
|
|
111
|
+
* The current content revision, bumped on every {@link NoiseTexture2d#bake}.
|
|
112
|
+
* Also stamped on the baked canvas (`getTexture().version`) so the renderer
|
|
113
|
+
* re-uploads the GPU texture only when it actually changed.
|
|
114
|
+
* @returns {number}
|
|
115
|
+
*/
|
|
116
|
+
get version(): number;
|
|
117
|
+
/**
|
|
118
|
+
* (Re)bake the texture from the current settings into the (reused) output
|
|
119
|
+
* canvas. Called once on construction; {@link NoiseTexture2d#update} calls it
|
|
120
|
+
* again per frame for animated textures.
|
|
121
|
+
* @returns {NoiseTexture2d} this texture for chaining
|
|
122
|
+
*/
|
|
123
|
+
bake(): NoiseTexture2d;
|
|
124
|
+
/**
|
|
125
|
+
* Advance an animated texture by `dt` milliseconds and re-bake it. The
|
|
126
|
+
* re-bake bumps the texture's `version`, so the renderer re-uploads the GPU
|
|
127
|
+
* texture automatically on the next draw — no renderer/app handle needed.
|
|
128
|
+
*
|
|
129
|
+
* This is NOT auto-called by the engine; drive it from your own update loop
|
|
130
|
+
* (e.g. {@link Stage#update}) for animated textures. No-op when not `animated`.
|
|
131
|
+
* @param {number} dt - elapsed time since the last update, in milliseconds
|
|
132
|
+
* @returns {NoiseTexture2d} this texture for chaining
|
|
133
|
+
*/
|
|
134
|
+
update(dt: number): NoiseTexture2d;
|
|
135
|
+
/**
|
|
136
|
+
* Raw noise sample at a texture pixel (2D, or 3D when animated). The time
|
|
137
|
+
* axis is divided by the noise frequency so that, after `getNoise3d` scales
|
|
138
|
+
* all coords by frequency, the field evolves at `speed` noise-units/second —
|
|
139
|
+
* decoupled from the spatial frequency (otherwise low-frequency textures
|
|
140
|
+
* would animate imperceptibly slowly).
|
|
141
|
+
* @ignore
|
|
142
|
+
*/
|
|
143
|
+
_rawNoise(x: any, y: any): number;
|
|
144
|
+
/**
|
|
145
|
+
* x-axis seamless blend: in the right skirt band, cross-fade toward the
|
|
146
|
+
* wrapped (period-shifted) sample so the left and right edges meet.
|
|
147
|
+
* @ignore
|
|
148
|
+
*/
|
|
149
|
+
_blendX(x: any, y: any, w: any, sk: any): any;
|
|
150
|
+
/**
|
|
151
|
+
* Sample the noise into a `[0, 1]` height field. When `seamless`, a skirt
|
|
152
|
+
* cross-fade near the far edges blends opposite edges so the texture tiles
|
|
153
|
+
* with a much-reduced seam.
|
|
154
|
+
* @returns {Float32Array} the per-pixel height field (length `width*height`)
|
|
155
|
+
* @ignore
|
|
156
|
+
*/
|
|
157
|
+
_buildHeightField(): Float32Array;
|
|
158
|
+
/** @ignore */
|
|
159
|
+
_writeGrayscale(data: any, heights: any): void;
|
|
160
|
+
/** @ignore */
|
|
161
|
+
_writeColorRamp(data: any, heights: any): void;
|
|
162
|
+
/**
|
|
163
|
+
* Encode the height field as a tangent-space normal map (RGB), with screen-Y
|
|
164
|
+
* flipped to normal-map Y-up so it round-trips through the lit shader's
|
|
165
|
+
* `rgb * 2 - 1` decode. Neighbor samples wrap when `seamless`.
|
|
166
|
+
* @ignore
|
|
167
|
+
*/
|
|
168
|
+
_writeNormalMap(data: any, heights: any): void;
|
|
169
|
+
/**
|
|
170
|
+
* @returns {HTMLCanvasElement} the baked texture canvas
|
|
171
|
+
*/
|
|
172
|
+
getTexture(): HTMLCanvasElement;
|
|
173
|
+
}
|
|
174
|
+
import Texture2d from "./texture2d.ts";
|
|
175
|
+
import { Noise } from "../../math/noise.ts";
|
|
176
|
+
//# sourceMappingURL=noise_texture2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noise_texture2d.d.ts","sourceRoot":"","sources":["../../../src/video/texture/noise_texture2d.js"],"names":[],"mappings":";AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH;IACC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,uBAhBG;QAA0B,KAAK;QACL,MAAM;QACP,KAAK;QAEH,QAAQ;QACT,kBAAkB;QAEjB,MAAM;QACN,WAAW;QACZ,YAAY;QACV,SAAS;QACV,QAAQ;QAET,KAAK;KAEjC,EA4CA;IAxCA,mDAAmD;IACnD,OADyC,MAAM,CACb;IAClC,oDAAoD;IACpD,QAD0C,MAAM,CACZ;IACpC,0DAA0D;IAC1D,OADiD,KAAK,CAEiB;IACvE,gDAAgD;IAChD,UADqC,OAAO,CACF;IAC1C,2EAA2E;IAC3E,oBADiE,MAAM,CAItE;IACD,6CAA6C;IAC7C,QADkC,OAAO,CACH;IACtC,qEAAqE;IACrE,aAD0D,OAAO,CACjB;IAChD,yDAAyD;IACzD,cAD+C,MAAM,CACL;IAChD,2EAA2E;IAC3E,WAD0D,QAAQ,GAAC,IAAI,CAC5B;IAC3C,4EAA4E;IAC5E,UADiE,OAAO,CAC9B;IAC1C,iEAAiE;IACjE,OADuD,MAAM,CAC7B;IAChC,sEAAsE;IACtE,MAD4D,MAAM,CACrD;IAEb,8FAA8F;IAC9F,SAD4D,iBAAiB,GAAC,IAAI,CAC/D;IACnB,6FAA6F;IAC7F,YADmE,SAAS,GAAC,IAAI,CAC3D;IACtB,mGAAmG;IACnG,UADsE,YAAY,GAAC,IAAI,CACnE;IACpB;wFACoF;IACpF,UADkE,MAAM,CACvD;IAKlB;;;;;OAKG;IACH,eAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,QAFa,cAAc,CAiC1B;IAED;;;;;;;;;OASG;IACH,WAHW,MAAM,GACJ,cAAc,CAQ1B;IAED;;;;;;;OAOG;IACH,kCAMC;IAED;;;;OAIG;IACH,8CAOC;IAED;;;;;;OAMG;IACH,qBAHa,YAAY,CA2CxB;IAED,cAAc;IACd,+CASC;IAED,cAAc;IACd,+CAWC;IAED;;;;;OAKG;IACH,+CA+BC;IAED;;OAEG;IACH,cAFa,iBAAiB,CAI7B;CAcD;sBA5VqB,gBAAgB;sBAFhB,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aseprite.d.ts","sourceRoot":"","sources":["../../../../src/video/texture/parser/aseprite.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,oCALW,MAAM,gBACN,YAAY,GACV,MAAM,
|
|
1
|
+
{"version":3,"file":"aseprite.d.ts","sourceRoot":"","sources":["../../../../src/video/texture/parser/aseprite.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,oCALW,MAAM,gBACN,YAAY,GACV,MAAM,CAsFlB"}
|