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
|
@@ -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"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile-time-only brand key; no runtime value can hold it.
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
declare const gpuResidentBrand: unique symbol;
|
|
6
|
+
/**
|
|
7
|
+
* An opaque, GPU-resident texture backing — the source a GPU-resident
|
|
8
|
+
* {@link Texture2d} resolves to (for example the framebuffer copy
|
|
9
|
+
* {@link WebGLRenderer#toFrameTexture} produces). Such a backing uploads/binds
|
|
10
|
+
* itself through the texture cache instead of being read back to the CPU. Its
|
|
11
|
+
* concrete shape is an engine internal that may change between releases:
|
|
12
|
+
* obtain values from the engine and pass them back to the engine — do not
|
|
13
|
+
* construct or inspect them.
|
|
14
|
+
*
|
|
15
|
+
* Nominally branded with a `unique symbol`, so only engine-provided values
|
|
16
|
+
* satisfy the type — a plain object is NOT assignable, keeping
|
|
17
|
+
* {@link Texture2dSource} (and {@link Texture2d#getTexture}) honestly typed.
|
|
18
|
+
*/
|
|
19
|
+
export interface GPUResidentTexture {
|
|
20
|
+
/**
|
|
21
|
+
* Phantom nominal brand — never present at runtime.
|
|
22
|
+
* @ignore
|
|
23
|
+
*/
|
|
24
|
+
readonly [gpuResidentBrand]: true;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The backing source a {@link Texture2d} resolves to through
|
|
28
|
+
* {@link Texture2d#getTexture}: a drawable (canvas/image) for CPU-backed
|
|
29
|
+
* assets, or an opaque {@link GPUResidentTexture} for GPU-resident ones.
|
|
30
|
+
*/
|
|
31
|
+
export type Texture2dSource = HTMLCanvasElement | HTMLImageElement | OffscreenCanvas | ImageBitmap | GPUResidentTexture;
|
|
32
|
+
/**
|
|
33
|
+
* Abstract base for a 2D texture asset — an object that owns a texture
|
|
34
|
+
* source and can be used anywhere the engine expects an image:
|
|
35
|
+
* {@link Sprite#image}, {@link Sprite#normalMap}, an {@link ImageLayer}, or
|
|
36
|
+
* bound as a sampler uniform in a custom shader (see
|
|
37
|
+
* {@link ShaderEffect#setTexture}).
|
|
38
|
+
*
|
|
39
|
+
* A `Texture2d` is recognized via `instanceof` and resolved to its backing
|
|
40
|
+
* source through {@link Texture2d#getTexture} — so passing the asset object
|
|
41
|
+
* directly (`{ image: myTexture }`) works the same as passing a raw
|
|
42
|
+
* `HTMLCanvasElement`. Raw DOM image/canvas sources and the loader's decoded
|
|
43
|
+
* `CompressedImage` data are accepted too, but are not part of this class
|
|
44
|
+
* hierarchy.
|
|
45
|
+
*
|
|
46
|
+
* Most assets are **CPU-backed** and resolve to a drawable canvas/image — those
|
|
47
|
+
* are the ones assignable to {@link Sprite#image} / {@link Sprite#normalMap} /
|
|
48
|
+
* an {@link ImageLayer} (which upload the drawable through the texture cache).
|
|
49
|
+
* Subclasses may also be **GPU-resident**, resolving to an opaque renderer
|
|
50
|
+
* backing that never leaves the GPU (e.g. the capture returned by
|
|
51
|
+
* `renderer.toFrameTexture()`). A GPU-resident texture is **not** a drawable
|
|
52
|
+
* source: use it as a custom-shader sampler via {@link ShaderEffect#setTexture}
|
|
53
|
+
* (which binds its live GL handle), NOT as `Sprite#image`. The contract admits
|
|
54
|
+
* both (a future WebGPU backend follows the same shape with a `GPUTexture`).
|
|
55
|
+
*
|
|
56
|
+
* Concrete implementations:
|
|
57
|
+
* - {@link TextureAtlas} — packed multi-region sprite sheet (CPU-backed)
|
|
58
|
+
* @category Game Objects
|
|
59
|
+
*/
|
|
60
|
+
export default abstract class Texture2d {
|
|
61
|
+
/**
|
|
62
|
+
* Return the backing source for this texture — a drawable canvas/image for
|
|
63
|
+
* CPU-backed assets (assignable to {@link Sprite#image} /
|
|
64
|
+
* {@link Sprite#normalMap} / an {@link ImageLayer}), or an opaque
|
|
65
|
+
* GPU-resident backing for GPU-resident ones (bind those as a custom-shader
|
|
66
|
+
* sampler via {@link ShaderEffect#setTexture}; they are not drawable sources).
|
|
67
|
+
* @returns the backing source
|
|
68
|
+
*/
|
|
69
|
+
abstract getTexture(): Texture2dSource;
|
|
70
|
+
/**
|
|
71
|
+
* Release any GPU/CPU resources held by this texture. The texture must not
|
|
72
|
+
* be used after calling destroy.
|
|
73
|
+
*
|
|
74
|
+
* Broadcasts {@link event.TEXTURE2D_DESTROYED} with the backing source so
|
|
75
|
+
* GPU-side caches keyed by source image (e.g. the lit batcher's normal-map
|
|
76
|
+
* textures) release what they hold for it. Subclasses that own additional
|
|
77
|
+
* resources override this and call `super.destroy()` FIRST — the source
|
|
78
|
+
* must still be resolvable when the event fires.
|
|
79
|
+
*/
|
|
80
|
+
destroy(): void;
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=texture2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texture2d.d.ts","sourceRoot":"","sources":["../../../src/video/texture/texture2d.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,CAAC,MAAM,gBAAgB,EAAE,OAAO,MAAM,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACxB,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,WAAW,GACX,kBAAkB,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,SAAS;IACtC;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,IAAI,eAAe;IAEtC;;;;;;;;;OASG;IACH,OAAO,IAAI,IAAI;CAGf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;OAeG;IACH,sBAfW,aAAa,YAErB;QAA2B,UAAU,EACrC;YAAoC,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACuB,UAAU,EAAvC,OAAO;YACqB,MAAM,EAAlC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SACd;QAA0B,WAAW;QACV,OAAO;QACR,iBAAiB;KAC7C,EAGA;IAED;;;OAGG;IACH,yCA6HC;IA3HA,cAAwB;IAGxB,QAAqB;IAGrB,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAqCtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,iDAAuB;IAUxB;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;OAeG;IACH,sBAfW,aAAa,YAErB;QAA2B,UAAU,EACrC;YAAoC,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACuB,UAAU,EAAvC,OAAO;YACqB,MAAM,EAAlC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SACd;QAA0B,WAAW;QACV,OAAO;QACR,iBAAiB;KAC7C,EAGA;IAED;;;OAGG;IACH,yCA6HC;IA3HA,cAAwB;IAGxB,QAAqB;IAGrB,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAqCtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,iDAAuB;IAUxB;;;OAGG;IACH,cAoBC;IAED;;OAEG;IACH,aAYC;IAED;;;;OAIG;IACH,eAaC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QA8BlB;IAHE,uCAA4B;IAK/B;;;;;;;OAOG;IACH,mBANW,MAAM,QACN,MAAM,QACN,MAAM,cACN,OAAO,UACP,MAAM,QA+BhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;;OAIG;IACH,oBAFW,MAAM,EAAE,QAOlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAgFhB;CACD;;qBA9ZoB,gBAAgB;8BAFP,wBAAwB;6BACzB,oBAAoB;8BAMtB,2BAA2B;+BADxB,wBAAwB"}
|
|
@@ -28,13 +28,38 @@ export default class LitQuadBatcher extends QuadBatcher {
|
|
|
28
28
|
*/
|
|
29
29
|
boundNormalMaps: (ImageBitmap | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | null)[] | undefined;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Per-slot content `version` of the normal map currently bound there. An
|
|
32
|
+
* animated source keeps a stable canvas reference across re-bakes but
|
|
33
|
+
* bumps its `version`, so `addQuad` compares this (not just the reference)
|
|
34
|
+
* to know when to re-bind/re-upload. `-1` = nothing bound.
|
|
35
|
+
* @type {number[]}
|
|
33
36
|
* @ignore
|
|
34
37
|
*/
|
|
35
|
-
|
|
38
|
+
boundNormalVersions: number[] | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Map from a normal-map source image to its uploaded GL texture and the
|
|
41
|
+
* source `version` it was uploaded at. A source that bumps its `version`
|
|
42
|
+
* (e.g. an animated {@link NoiseTexture2d}) is re-uploaded on next bind —
|
|
43
|
+
* the three.js `Texture.needsUpdate` model, scoped to normal maps which
|
|
44
|
+
* live outside the color `TextureCache`.
|
|
45
|
+
* @type {Map<HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap, {tex: WebGLTexture, version: number}>}
|
|
46
|
+
* @ignore
|
|
47
|
+
*/
|
|
48
|
+
normalMapTextures: Map<ImageBitmap | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas, {
|
|
49
|
+
tex: WebGLTexture;
|
|
50
|
+
version: number;
|
|
51
|
+
}> | undefined;
|
|
36
52
|
_lightCount: number | undefined;
|
|
37
53
|
_maxLights: number | undefined;
|
|
54
|
+
_onTexture2dDestroyed: ((source: any) => void) | null | undefined;
|
|
55
|
+
_normalRangeReserved: boolean | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Release the cached GL texture uploaded for the given normal-map source
|
|
58
|
+
* and clear any slot bookkeeping referencing it. Safe to call for images
|
|
59
|
+
* that were never bound.
|
|
60
|
+
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} image - normal-map source
|
|
61
|
+
*/
|
|
62
|
+
evictNormalMap(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap): void;
|
|
38
63
|
/**
|
|
39
64
|
* Bind the paired normal sampler uniforms (`uNormalSampler0..N-1`)
|
|
40
65
|
* to texture units `maxBatchTextures..2*maxBatchTextures-1`. Called
|
|
@@ -85,8 +110,9 @@ export default class LitQuadBatcher extends QuadBatcher {
|
|
|
85
110
|
* encoding for any non-opaque texel.
|
|
86
111
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} image - normal-map source
|
|
87
112
|
* @param {number} unit - GL texture unit (already offset by `maxBatchTextures`)
|
|
113
|
+
* @param {number} [version=0] - the source revision being uploaded
|
|
88
114
|
*/
|
|
89
|
-
uploadNormalMap(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap, unit: number): void;
|
|
115
|
+
uploadNormalMap(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap, unit: number, version?: number): void;
|
|
90
116
|
/**
|
|
91
117
|
* Add a textured quad with optional paired normal map.
|
|
92
118
|
* @param {TextureAtlas} texture - Source texture atlas
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lit_quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_quad_batcher.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lit_quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_quad_batcher.js"],"names":[],"mappings":"AAMA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAsEE;;;;;;OAMG;IACH,6GAAmD;IAEnD;;;;;;;OAOG;IACH,0CAAqD;IAErD;;;;;;;;OAQG;IACH;aAHoF,YAAY;iBAAW,MAAM;mBAG/E;IAElC,gCAAoB;IACpB,+BAA4B;IAQ3B,kEAEC;IAiCD,0CAAgC;IAoBlC;;;;;OAKG;IACH,sBAFW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAcxE;IAED;;;;;OAKG;IACH,2BAOC;IA4DD;;;;;;;;;;;;;;OAcG;IACH,2BANG;QAA+B,SAAS,EAAhC,YAAY;QACW,MAAM,EAA7B,YAAY;QACY,OAAO;QACd,KAAK,EAAtB,MAAM;QACc,OAAO;KACrC,QAgBA;IAED;;;;;;;;;OASG;IACH,qBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAiBhB;IAED;;;;;;;;;;;OAWG;IACH,uBAJW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,YACN,MAAM,QAwBhB;IAED;;;;;;;;;;;;;;OAcG;IACH,iBAbW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,cACP,gBAAgB,GAAC,iBAAiB,GAAC,IAAI,QAwIjD;CA8DD;wBA1kBoC,mBAAmB;kCAIzB,0BAA0B"}
|
|
@@ -8,17 +8,35 @@
|
|
|
8
8
|
* @category Rendering
|
|
9
9
|
*/
|
|
10
10
|
export class MaterialBatcher extends Batcher {
|
|
11
|
+
set currentTextureUnit(unit: number);
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* The GL texture unit currently active (`gl.activeTexture`). Tracked on
|
|
14
|
+
* the RENDERER, not per batcher: the active unit is global GL state
|
|
15
|
+
* shared by every batcher instance, and a per-batcher copy desyncs as
|
|
16
|
+
* soon as another batcher (or a blit, or an FBO pass) moves the active
|
|
17
|
+
* unit — the stale copy then lets `bindTexture2D` skip `gl.activeTexture`
|
|
18
|
+
* and bind (or upload) a texture onto whatever unit is REALLY active.
|
|
19
|
+
* Symptom was video force-re-uploads overwriting a mesh texture with
|
|
20
|
+
* video frames after a mesh pass.
|
|
21
|
+
* @type {number}
|
|
13
22
|
* @ignore
|
|
14
23
|
*/
|
|
15
|
-
currentTextureUnit:
|
|
24
|
+
get currentTextureUnit(): number;
|
|
16
25
|
/**
|
|
17
26
|
* bound textures by unit
|
|
18
27
|
* @ignore
|
|
19
28
|
*/
|
|
20
29
|
boundTextures: any[] | undefined;
|
|
21
30
|
_onCacheReset: (() => void) | null | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Drop every cached texture binding after a {@link GPU_TEXTURE_CACHE_RESET}
|
|
33
|
+
* (the shared texture cache reassigned units — our per-unit view is stale).
|
|
34
|
+
* Subclasses that pair extra samplers to units (lit normal maps) override to
|
|
35
|
+
* forget those too; without that they'd assume the extra texture is still
|
|
36
|
+
* resident and skip re-binding it after the reset.
|
|
37
|
+
* @ignore
|
|
38
|
+
*/
|
|
39
|
+
_onTextureCacheReset(): void;
|
|
22
40
|
/**
|
|
23
41
|
* Free resources used by the batcher. Currently unsubscribes the
|
|
24
42
|
* texture-cache-reset listener so a discarded batcher doesn't keep
|
|
@@ -64,6 +82,19 @@ export class MaterialBatcher extends Batcher {
|
|
|
64
82
|
* @returns {number} unit the unit number that was associated with the given texture
|
|
65
83
|
*/
|
|
66
84
|
unbindTexture2D(texture?: WebGLTexture, unit?: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Forget whatever texture this batcher believes is bound to `unit`, so the
|
|
87
|
+
* next bind to it re-issues the GL bind. Used when a GL texture unit is
|
|
88
|
+
* clobbered OUTSIDE this batcher's own accounting — e.g.
|
|
89
|
+
* {@link WebGLRenderer#toFrameTexture}, which binds its capture to a scratch
|
|
90
|
+
* unit directly (not via the shared texture cache), so a different batcher's
|
|
91
|
+
* unit cache would otherwise skip a needed re-bind. Subclasses that pair
|
|
92
|
+
* extra samplers to the same unit (lit normal maps) override to drop those
|
|
93
|
+
* too.
|
|
94
|
+
* @param {number} unit - the GL texture unit to invalidate
|
|
95
|
+
* @ignore
|
|
96
|
+
*/
|
|
97
|
+
invalidateUnit(unit: number): void;
|
|
67
98
|
/**
|
|
68
99
|
* @ignore
|
|
69
100
|
* @param {TextureAtlas|TextureResource} texture
|
|
@@ -73,8 +104,13 @@ export class MaterialBatcher extends Batcher {
|
|
|
73
104
|
* @param {number} [h] - same as `w`.
|
|
74
105
|
* @param {boolean} [force=false]
|
|
75
106
|
* @param {boolean} [flush=true]
|
|
107
|
+
* @param {string} [repeat] - per-use wrap-mode override (a mesh's
|
|
108
|
+
* `textureRepeat`, #1503) — sampled with this wrap without mutating
|
|
109
|
+
* the shared atlas's `repeat`. The texture-unit cache keys by
|
|
110
|
+
* `(source, repeat)`, so each wrap gets its own unit + GL texture.
|
|
111
|
+
* Omit to use `texture.repeat`.
|
|
76
112
|
*/
|
|
77
|
-
uploadTexture(texture: TextureAtlas | TextureResource, w?: number, h?: number, force?: boolean, flush?: boolean): any;
|
|
113
|
+
uploadTexture(texture: TextureAtlas | TextureResource, w?: number, h?: number, force?: boolean, flush?: boolean, repeat?: string): any;
|
|
78
114
|
}
|
|
79
115
|
import { Batcher } from "./batcher.js";
|
|
80
116
|
import type { TextureAtlas } from "./../../texture/atlas.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;GAIG;AACH;
|
|
1
|
+
{"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;GAIG;AACH;IA6EC,6BAPU,MAAM,EASf;IAlBD;;;;;;;;;;;OAWG;IACH,0BAHU,MAAM,CAKf;IA/DA;;;OAGG;IACH,iCAAuB;IAwBtB,+CAEC;IAKH;;;;;;;OAOG;IACH,6BAIC;IAsBD;;;;;;OAMG;IACH,gBAKC;IAmBD;;;;;;;;;;;OAWG;IACH,sBAVW,MAAM,WACN,8DAAM,iBAAiB,GAAC,SAAS,GAAC,UAAU,EAAE,GAAC,YAAY,EAAE,UAC7D,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,uBACN,OAAO,WACP,OAAO,kCACL,YAAY,CAmKxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QAgCnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,yBAsBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;;;;;;;;;;OAWG;IACH,qBAHW,MAAM,QAQhB;IAED;;;;;;;;;;;;;;OAcG;IACH,uBAbW,YAAY,GAAC,eAAe,MAC5B,MAAM,MAGN,MAAM,UACN,OAAO,UACP,OAAO,WACP,MAAM,OAsDhB;CACD;wBAzduB,cAAc;kCAIP,0BAA0B"}
|
|
@@ -33,7 +33,7 @@ export default class MeshBatcher extends MaterialBatcher {
|
|
|
33
33
|
currentEmissiveR: any;
|
|
34
34
|
currentEmissiveG: any;
|
|
35
35
|
currentEmissiveB: any;
|
|
36
|
-
_onTargetChanged: (() => void) | null | undefined;
|
|
36
|
+
_onTargetChanged: ((emitter: any) => void) | null | undefined;
|
|
37
37
|
/**
|
|
38
38
|
* The vertex attribute layout. The base (unlit) mesh batcher is
|
|
39
39
|
* `aVertex` (3) + `aRegion` (2) + `aColor` (4) = 9 floats. Subclasses
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/mesh_batcher.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/mesh_batcher.js"],"names":[],"mappings":"AAyFA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACC;;;OAGG;IACH,0BAsCC;IA5BA,wBAA4B;IAI5B,sBAA0B;IAC1B,sBAA0B;IAC1B,sBAA0B;IAYzB,8DAOC;IAKH;;;;;OAKG;IACH;;;;;;QAgCC;IAED;;;;OAIG;IACH;;;MAEC;IAED;;;;;;;;;OASG;IACH,6BAWC;IAyDD;;;;;;;;;;;;;;;OAeG;IACH,wBAXW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,SACN,MAAM,SACN,MAAM,OACN,MAAM,QAKhB;IAED;;;;;;;;;;;;;;OAcG;IACH,cAHW,MAAM,QACN,MAAM,QA+JhB;CACD;gCA3d+B,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/primitive_batcher.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAsCC;IALA;;;OAGG;IACH,sBAAyB;IA0B1B;;;;;OAKG;IACH,mBAJW,MAAM,SACN,KAAK,EAAE,gBACP,MAAM,
|
|
1
|
+
{"version":3,"file":"primitive_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/primitive_batcher.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAsCC;IALA;;;OAGG;IACH,sBAAyB;IA0B1B;;;;;OAKG;IACH,mBAJW,MAAM,SACN,KAAK,EAAE,gBACP,MAAM,QAoDhB;;CAyMD;wBAjVuB,cAAc;2BAId,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAMA;;;GAGG;AAUH,iCAKE;AAEF;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BA0DC;IAzDA;;;;OAIG;IACH,qCAA0D;IA2C1D;;;;;OAKG;IACH,qCAA2B;IAK5B;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAMA;;;GAGG;AAUH,iCAKE;AAEF;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BA0DC;IAzDA;;;;OAIG;IACH,qCAA0D;IA2C1D;;;;;OAKG;IACH,qCAA2B;IAK5B;;;;OAIG;IACH,0BAcC;IAED;;;;OAIG;IACH,0BAIC;IAED;;;;;;;OAOG;IACH,kBAFW,QAAQ,GAAC,YAAY,QAK/B;IAyDD;;;;;;;;;;OAUG;IACH,oBAPW,YAAY,KACZ,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,QAAQ,GAAC,YAAY,QAkE/B;IAED;;;;;;;;;;;;;OAaG;IACH,iBAZW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,QAwEjB;CACD;yBAtWwB,2BAA2B;gCAIpB,uBAAuB;kCAIxB,0BAA0B"}
|
|
@@ -20,6 +20,19 @@ export default class WebGLIndexBuffer extends IndexBuffer {
|
|
|
20
20
|
* Bind this index buffer
|
|
21
21
|
*/
|
|
22
22
|
bind(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Replace the underlying GL buffer with a fresh one, deleting the old.
|
|
25
|
+
* Needed on context restore — the old buffer object belongs to the lost
|
|
26
|
+
* context and every upload through it would silently fail. Also keeps
|
|
27
|
+
* plain resets leak-free (`deleteBuffer` on a lost-context object is a
|
|
28
|
+
* harmless no-op).
|
|
29
|
+
*/
|
|
30
|
+
recreate(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Delete the underlying GL buffer. The index buffer must not be used
|
|
33
|
+
* after calling destroy.
|
|
34
|
+
*/
|
|
35
|
+
destroy(): void;
|
|
23
36
|
}
|
|
24
37
|
import IndexBuffer from "../../buffer/index.js";
|
|
25
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/buffer/index.js"],"names":[],"mappings":"AAEA;;;GAGG;AAEH;IACC;;;;OAIG;IACH,gBAJW,qBAAqB,GAAC,sBAAsB,cAC5C,MAAM,cACN,OAAO,EAOjB;IAHA,mDAAY;IACZ,kBAA2D;IAC3D,oBAA+B;IAiBhC;;OAEG;IACH,eAOC;IAED;;OAEG;IACH,aAEC;CACD;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/buffer/index.js"],"names":[],"mappings":"AAEA;;;GAGG;AAEH;IACC;;;;OAIG;IACH,gBAJW,qBAAqB,GAAC,sBAAsB,cAC5C,MAAM,cACN,OAAO,EAOjB;IAHA,mDAAY;IACZ,kBAA2D;IAC3D,oBAA+B;IAiBhC;;OAEG;IACH,eAOC;IAED;;OAEG;IACH,aAEC;IAED;;;;;;OAMG;IACH,iBAIC;IAED;;;OAGG;IACH,gBAGC;CACD;wBA1EuB,uBAAuB"}
|
|
@@ -22,11 +22,6 @@ export default class HologramEffect extends ShaderEffect {
|
|
|
22
22
|
color?: number[] | undefined;
|
|
23
23
|
intensity?: number | undefined;
|
|
24
24
|
});
|
|
25
|
-
/**
|
|
26
|
-
* set the current time (call each frame for animation)
|
|
27
|
-
* @param {number} time - time in seconds
|
|
28
|
-
*/
|
|
29
|
-
setTime(time: number): void;
|
|
30
25
|
/**
|
|
31
26
|
* set the hologram tint color
|
|
32
27
|
* @param {number[]} color - color as [r, g, b] (0.0–1.0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hologram.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/hologram.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH;IACC;;;;;OAKG;IACH,sBALW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAA2B,KAAK;QACP,SAAS;KACpC,EAyBA;IAED;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"hologram.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/hologram.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH;IACC;;;;;OAKG;IACH,sBALW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAA2B,KAAK;QACP,SAAS;KACpC,EAyBA;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAIlB;CACD;yBAvDwB,oBAAoB"}
|
|
@@ -57,11 +57,6 @@ export default class ShineEffect extends ShaderEffect {
|
|
|
57
57
|
pulseDepth?: number | undefined;
|
|
58
58
|
pulseSpeed?: number | undefined;
|
|
59
59
|
});
|
|
60
|
-
/**
|
|
61
|
-
* set the current time (call each frame for animation)
|
|
62
|
-
* @param {number} time - time in seconds
|
|
63
|
-
*/
|
|
64
|
-
setTime(time: number): void;
|
|
65
60
|
/**
|
|
66
61
|
* set the shine color
|
|
67
62
|
* @param {number[]} color - shine color as [r, g, b] (0.0–1.0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shine.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/shine.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH;IACC;;;;;;;;;;;OAWG;IACH,sBAXW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAA2B,KAAK;QACP,KAAK;QACL,KAAK;QACL,SAAS;QACT,KAAK;QACL,KAAK;QACL,UAAU;QACV,UAAU;KACrC,EAuDA;IAED;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"shine.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/shine.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH;IACC;;;;;;;;;;;OAWG;IACH,sBAXW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAA2B,KAAK;QACP,KAAK;QACL,KAAK;QACL,SAAS;QACT,KAAK;QACL,KAAK;QACL,UAAU;QACV,UAAU;KACrC,EAuDA;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAIlB;IAED;;;OAGG;IACH,gBAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,oBAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,gBAFW,MAAM,QAIhB;CACD;yBA1IwB,oBAAoB"}
|
|
@@ -45,6 +45,17 @@ export default class GLShader {
|
|
|
45
45
|
* @readonly
|
|
46
46
|
*/
|
|
47
47
|
readonly destroyed: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* When `true`, a renderable will NOT auto-destroy this shader when it is
|
|
50
|
+
* removed from its `postEffects` (via the `shader` setter,
|
|
51
|
+
* `removePostEffect`, `clearPostEffects`) or when the renderable itself
|
|
52
|
+
* is destroyed. Set this on a shader shared across several renderables so
|
|
53
|
+
* one of them going away doesn't free the GL program still used by the
|
|
54
|
+
* others — you then own its lifecycle and call {@link destroy} yourself.
|
|
55
|
+
* @type {boolean}
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
shared: boolean;
|
|
48
59
|
/**
|
|
49
60
|
* `true` while the WebGL context is lost (and until it's
|
|
50
61
|
* restored). The GL program/attributes/uniforms are released
|
|
@@ -113,6 +124,24 @@ export default class GLShader {
|
|
|
113
124
|
* @param {number} stride - the size of a single vertex in bytes
|
|
114
125
|
*/
|
|
115
126
|
setVertexAttributes(gl: WebGLRenderingContext, attributes: object[], stride: number): void;
|
|
127
|
+
/**
|
|
128
|
+
* Create an independent copy of this shader, compiled as its own GL
|
|
129
|
+
* program from the same vertex + fragment sources (and precision), with
|
|
130
|
+
* every uniform value set so far replayed onto the copy. Use it when
|
|
131
|
+
* several renderables need the same custom shader with *different*
|
|
132
|
+
* uniform values — a single instance has a single set of uniforms.
|
|
133
|
+
*
|
|
134
|
+
* Ownership and lifecycle state do NOT carry over: the clone's
|
|
135
|
+
* {@link shared} flag is **always reset to `false`**, even when cloning
|
|
136
|
+
* a shared shader — the clone is caller-owned and will be auto-destroyed
|
|
137
|
+
* by the renderable it is assigned to, unless you explicitly set
|
|
138
|
+
* `shared = true` on it yourself. Note that `ShaderEffect` (which wraps
|
|
139
|
+
* a GLShader by composition) has its own `clone()` with the same
|
|
140
|
+
* semantics, which additionally copies its effect-level state (extra
|
|
141
|
+
* `setTexture` bindings).
|
|
142
|
+
* @returns {GLShader} a new, caller-owned shader (`shared === false`)
|
|
143
|
+
*/
|
|
144
|
+
clone(): GLShader;
|
|
116
145
|
/**
|
|
117
146
|
* destroy this shader objects resources (program, attributes, uniforms).
|
|
118
147
|
* Idempotent — calling destroy twice (or after a context-lost suspend)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBA1BW,qBAAqB,UACrB,MAAM,YACN,MAAM,cACN,MAAM,
|
|
1
|
+
{"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBA1BW,qBAAqB,UACrB,MAAM,YACN,MAAM,cACN,MAAM,EAqFhB;IA7DA;;;OAGG;IACH,IAFU,qBAAqB,CAEnB;IAEZ;;;;;;;OAOG;IACH,oBAHU,OAAO,CAGK;IAEtB;;;;;;;;;OASG;IACH,QAHU,OAAO,CAGE;IAEnB;;;;;;;;;;OAUG;IACH,oBAHU,OAAO,CAGK;IAGtB,sBAA2B;IAC3B,wBAA+B;IAC/B,+BAA2B;IAG3B,mBAAwC;IAKvC,sBAAmB;IACnB,iBAAoB;IACpB,qBAAsB;IASxB;;;;;;OAMG;IACH,iBA0CC;IAzCA,YAGC;IACD,cAGC;IAoCF;;;;;OAKG;IACH,uBAgBC;IAED;;;;;OAKG;IACH,2BAMC;IAED;;OAEG;IACH,aAKC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,KAAK,CAYjB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,GAAC,YAAY,QA0C7B;IAED;;;;;OAKG;IACH,wBAJW,qBAAqB,cACrB,MAAM,EAAE,UACR,MAAM,QAmBhB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,SAFa,QAAQ,CAyBpB;IAED;;;;;OAKG;IACH,gBA2BC;CACD"}
|