melonjs 19.9.1 → 20.1.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 +25 -14
- package/build/application/application.d.ts +70 -16
- package/build/application/application.d.ts.map +1 -1
- package/build/application/defaultApplicationSettings.d.ts +2 -2
- package/build/application/settings.d.ts +150 -53
- package/build/application/settings.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +1 -1
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +13 -11
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/camera/effects/fade_effect.d.ts.map +1 -1
- package/build/camera/effects/mask_effect.d.ts.map +1 -1
- package/build/const.d.ts +55 -26
- package/build/const.d.ts.map +1 -1
- package/build/geometries/box3d.d.ts +156 -0
- package/build/geometries/box3d.d.ts.map +1 -0
- package/build/index.d.ts +34 -24
- package/build/index.d.ts.map +1 -1
- package/build/index.js +22171 -8029
- package/build/index.js.map +4 -4
- package/build/lang/deprecated.d.ts +4 -4
- package/build/lang/deprecated.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts +4 -0
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts +42 -6
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/gltf/srgb.d.ts +20 -0
- package/build/level/gltf/srgb.d.ts.map +1 -0
- package/build/level/level.d.ts +21 -2
- package/build/level/level.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +61 -13
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/loader.d.ts +49 -21
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/mtl.d.ts +18 -0
- package/build/loader/parsers/mtl.d.ts.map +1 -1
- package/build/loader/parsers/obj.d.ts +49 -0
- package/build/loader/parsers/obj.d.ts.map +1 -1
- package/build/loader/parsers/pbr.d.ts +63 -0
- package/build/loader/parsers/pbr.d.ts.map +1 -0
- package/build/loader/parsers/shader.d.ts +32 -24
- package/build/loader/parsers/shader.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +86 -1
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/broadphase/octree.d.ts +35 -0
- package/build/physics/broadphase/octree.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +123 -15
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts +186 -1
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/builtin/sat3d.d.ts +59 -0
- package/build/physics/builtin/sat3d.d.ts.map +1 -0
- package/build/physics/response.d.ts +32 -0
- package/build/physics/response.d.ts.map +1 -1
- package/build/physics/world.d.ts +1 -0
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +1 -0
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/groundshadow.d.ts +92 -0
- package/build/renderable/groundshadow.d.ts.map +1 -0
- package/build/renderable/instanced_mesh.d.ts +286 -0
- package/build/renderable/instanced_mesh.d.ts.map +1 -0
- package/build/renderable/mesh.d.ts +242 -23
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +6 -4
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +17 -6
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/system/device.d.ts +11 -40
- package/build/system/device.d.ts.map +1 -1
- package/build/system/platform.d.ts +0 -16
- package/build/system/platform.d.ts.map +1 -1
- package/build/utils/utils.d.ts +2 -0
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +22 -16
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/{webgl/effects → effects}/blur.d.ts +2 -2
- package/build/video/effects/blur.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/chromaticAberration.d.ts +2 -2
- package/build/video/effects/chromaticAberration.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/colorMatrix.d.ts +3 -3
- package/build/video/effects/colorMatrix.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/desaturate.d.ts +1 -1
- package/build/video/effects/desaturate.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/dissolve.d.ts +2 -2
- package/build/video/effects/dissolve.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/dropShadow.d.ts +2 -2
- package/build/video/effects/dropShadow.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/flash.d.ts +2 -2
- package/build/video/effects/flash.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/glow.d.ts +2 -2
- package/build/video/effects/glow.d.ts.map +1 -0
- package/build/video/effects/glsl_realization.d.ts +18 -0
- package/build/video/effects/glsl_realization.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/hologram.d.ts +2 -2
- package/build/video/effects/hologram.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/invert.d.ts +1 -1
- package/build/video/effects/invert.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/outline.d.ts +2 -2
- package/build/video/effects/outline.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/pixelate.d.ts +2 -2
- package/build/video/effects/pixelate.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/radialGradient.d.ts +3 -4
- package/build/video/effects/radialGradient.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/scanline.d.ts +2 -2
- package/build/video/effects/scanline.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/sepia.d.ts +1 -1
- package/build/video/effects/sepia.d.ts.map +1 -0
- package/build/video/{webgl → effects}/shadereffect.d.ts +133 -25
- package/build/video/effects/shadereffect.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/shine.d.ts +2 -2
- package/build/video/effects/shine.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/tintPulse.d.ts +2 -2
- package/build/video/effects/tintPulse.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/vignette.d.ts +2 -2
- package/build/video/effects/vignette.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/wave.d.ts +2 -2
- package/build/video/effects/wave.d.ts.map +1 -0
- package/build/video/effects/wgsl/layout.d.ts +28 -0
- package/build/video/effects/wgsl/layout.d.ts.map +1 -0
- package/build/video/effects/wgsl/parse.d.ts +9 -0
- package/build/video/effects/wgsl/parse.d.ts.map +1 -0
- package/build/video/effects/wgsl/scaffold.d.ts +43 -0
- package/build/video/effects/wgsl/scaffold.d.ts.map +1 -0
- package/build/video/effects/wgsl_realization.d.ts +83 -0
- package/build/video/effects/wgsl_realization.d.ts.map +1 -0
- package/build/video/gpu/batcher.d.ts +71 -0
- package/build/video/gpu/batcher.d.ts.map +1 -0
- package/build/video/gpu/instancerecord.d.ts +164 -0
- package/build/video/gpu/instancerecord.d.ts.map +1 -0
- package/build/video/gpu/meshchunk.d.ts +49 -0
- package/build/video/gpu/meshchunk.d.ts.map +1 -0
- package/build/video/gpu/meshvertex.d.ts +54 -0
- package/build/video/gpu/meshvertex.d.ts.map +1 -0
- package/build/video/gpu/primitives.d.ts +60 -0
- package/build/video/gpu/primitives.d.ts.map +1 -0
- package/build/video/gpu/quadcorners.d.ts +11 -0
- package/build/video/gpu/quadcorners.d.ts.map +1 -0
- package/build/video/gpu/textureslots.d.ts +122 -0
- package/build/video/gpu/textureslots.d.ts.map +1 -0
- package/build/video/gpu/texturestore.d.ts +139 -0
- package/build/video/gpu/texturestore.d.ts.map +1 -0
- package/build/video/gpu/topology.d.ts +43 -0
- package/build/video/gpu/topology.d.ts.map +1 -0
- package/build/video/gpu/vertexformat.d.ts +72 -0
- package/build/video/gpu/vertexformat.d.ts.map +1 -0
- package/build/video/gradient.d.ts +14 -5
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts +153 -8
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +7 -6
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +2 -2
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
- package/build/video/rendertarget/webglrendertarget.d.ts +38 -2
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webgpurendertarget.d.ts +83 -0
- package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -0
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +20 -2
- package/build/video/texture/cache.d.ts.map +1 -1
- package/build/video/texture/noise_texture2d.d.ts +2 -2
- package/build/video/utils/autodetect.d.ts.map +1 -1
- package/build/video/video.d.ts +1 -55
- package/build/video/video.d.ts.map +1 -1
- package/build/video/webgl/batchers/batcher.d.ts +132 -35
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +14 -0
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +63 -36
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +29 -20
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +308 -14
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/primitive_batcher.d.ts +2 -2
- package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts +0 -2
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +1 -1
- package/build/video/webgl/buffer/instance_buffer.d.ts +54 -0
- package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -0
- package/build/video/webgl/buffer/retained_geometry.d.ts +83 -0
- package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -0
- package/build/video/webgl/buffer/uniformblock.d.ts +81 -0
- package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -0
- package/build/video/webgl/buffer/vertexstate.d.ts +101 -0
- package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -0
- package/build/video/webgl/glshader.d.ts +101 -8
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/lighting/constants.d.ts +20 -8
- package/build/video/webgl/lighting/constants.d.ts.map +1 -1
- package/build/video/webgl/lighting/pack.d.ts +1 -1
- package/build/video/webgl/lighting/pack3d.d.ts +27 -11
- package/build/video/webgl/lighting/pack3d.d.ts.map +1 -1
- package/build/video/webgl/lighting/std140.d.ts +110 -0
- package/build/video/webgl/lighting/std140.d.ts.map +1 -0
- package/build/video/webgl/shaders/multitexture-lit.d.ts +7 -3
- package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -1
- package/build/video/webgl/texture/store.d.ts +52 -0
- package/build/video/webgl/texture/store.d.ts.map +1 -0
- package/build/video/webgl/utils/maxtextures.d.ts +37 -0
- package/build/video/webgl/utils/maxtextures.d.ts.map +1 -0
- package/build/video/webgl/utils/samplercache.d.ts +69 -0
- package/build/video/webgl/utils/samplercache.d.ts.map +1 -0
- package/build/video/webgl/utils/string.d.ts +16 -0
- package/build/video/webgl/utils/string.d.ts.map +1 -1
- package/build/video/webgl/utils/topology.d.ts +24 -0
- package/build/video/webgl/utils/topology.d.ts.map +1 -0
- package/build/video/webgl/utils/vertexformat.d.ts +27 -0
- package/build/video/webgl/utils/vertexformat.d.ts.map +1 -0
- package/build/video/webgl/webgl_renderer.d.ts +148 -30
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts +40 -0
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts +82 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/mesh_batcher.d.ts +301 -0
- package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/primitive_batcher.d.ts +39 -0
- package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts +143 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts +70 -0
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -0
- package/build/video/webgpu/buffer/arena.d.ts +64 -0
- package/build/video/webgpu/buffer/arena.d.ts.map +1 -0
- package/build/video/webgpu/buffer/instance_buffer.d.ts +65 -0
- package/build/video/webgpu/buffer/instance_buffer.d.ts.map +1 -0
- package/build/video/webgpu/buffer/retained_geometry.d.ts +55 -0
- package/build/video/webgpu/buffer/retained_geometry.d.ts.map +1 -0
- package/build/video/webgpu/buffer/uniformring.d.ts +68 -0
- package/build/video/webgpu/buffer/uniformring.d.ts.map +1 -0
- package/build/video/webgpu/effect_binding.d.ts +17 -0
- package/build/video/webgpu/effect_binding.d.ts.map +1 -0
- package/build/video/webgpu/pipeline/bindgroups.d.ts +36 -0
- package/build/video/webgpu/pipeline/bindgroups.d.ts.map +1 -0
- package/build/video/webgpu/pipeline/cache.d.ts +173 -0
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -0
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +90 -0
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts.map +1 -0
- package/build/video/webgpu/shaders/mesh-instanced.d.ts +60 -0
- package/build/video/webgpu/shaders/mesh-instanced.d.ts.map +1 -0
- package/build/video/webgpu/texture/compressed.d.ts +33 -0
- package/build/video/webgpu/texture/compressed.d.ts.map +1 -0
- package/build/video/webgpu/texture/frametexture.d.ts +65 -0
- package/build/video/webgpu/texture/frametexture.d.ts.map +1 -0
- package/build/video/webgpu/texture/store.d.ts +149 -0
- package/build/video/webgpu/texture/store.d.ts.map +1 -0
- package/build/video/webgpu/webgpu_renderer.d.ts +536 -0
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -0
- package/package.json +2 -2
- package/build/video/webgl/effects/blur.d.ts.map +0 -1
- package/build/video/webgl/effects/chromaticAberration.d.ts.map +0 -1
- package/build/video/webgl/effects/colorMatrix.d.ts.map +0 -1
- package/build/video/webgl/effects/desaturate.d.ts.map +0 -1
- package/build/video/webgl/effects/dissolve.d.ts.map +0 -1
- package/build/video/webgl/effects/dropShadow.d.ts.map +0 -1
- package/build/video/webgl/effects/flash.d.ts.map +0 -1
- package/build/video/webgl/effects/glow.d.ts.map +0 -1
- package/build/video/webgl/effects/hologram.d.ts.map +0 -1
- package/build/video/webgl/effects/invert.d.ts.map +0 -1
- package/build/video/webgl/effects/outline.d.ts.map +0 -1
- package/build/video/webgl/effects/pixelate.d.ts.map +0 -1
- package/build/video/webgl/effects/radialGradient.d.ts.map +0 -1
- package/build/video/webgl/effects/scanline.d.ts.map +0 -1
- package/build/video/webgl/effects/sepia.d.ts.map +0 -1
- package/build/video/webgl/effects/shine.d.ts.map +0 -1
- package/build/video/webgl/effects/tintPulse.d.ts.map +0 -1
- package/build/video/webgl/effects/vignette.d.ts.map +0 -1
- package/build/video/webgl/effects/wave.d.ts.map +0 -1
- package/build/video/webgl/shadereffect.d.ts.map +0 -1
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* additional import for TypeScript
|
|
3
|
+
* @import WebGLRenderer from "./../webgl_renderer.js";
|
|
4
|
+
* @import {Matrix3d} from "../../../math/matrix3d.ts";
|
|
5
|
+
* @import {VertexFormat} from "../../gpu/vertexformat.ts";
|
|
6
|
+
* @import {Topology} from "../../gpu/topology.ts";
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The base WebGL Batcher — manages shader programs, vertex attribute
|
|
10
|
+
* definitions, and vertex buffer batching for efficient GPU draw calls,
|
|
11
|
+
* realizing the backend-neutral {@link Batcher} lifecycle on GL state.
|
|
12
|
+
* Custom WebGL batchers extend this class.
|
|
13
|
+
* @augments Batcher
|
|
4
14
|
* @category Rendering
|
|
5
15
|
*/
|
|
6
|
-
export class Batcher {
|
|
16
|
+
export class WebGLBatcher extends Batcher {
|
|
17
|
+
/**
|
|
18
|
+
* @param {WebGLRenderer} renderer - the current WebGL renderer session
|
|
19
|
+
* @param {object} settings - additional settings to initialize this batcher (see {@link WebGLBatcher#init})
|
|
20
|
+
*/
|
|
21
|
+
constructor(renderer: WebGLRenderer, settings: object);
|
|
7
22
|
/**
|
|
23
|
+
* Initialize the batcher (called by the constructor)
|
|
8
24
|
* @param {WebGLRenderer} renderer - the current WebGL renderer session
|
|
9
25
|
* @param {object} settings - additional settings to initialize this batcher
|
|
10
26
|
* @param {object[]} settings.attributes - an array of attributes definition
|
|
@@ -20,7 +36,7 @@ export class Batcher {
|
|
|
20
36
|
* @param {boolean} [settings.indexed=false] - whether this batcher uses an index buffer for indexed drawing (drawElements)
|
|
21
37
|
* @param {string} [settings.projectionUniform="uProjectionMatrix"] - the name of the projection matrix uniform in the shader
|
|
22
38
|
*/
|
|
23
|
-
|
|
39
|
+
init(renderer: WebGLRenderer, settings: {
|
|
24
40
|
attributes: {
|
|
25
41
|
name: string;
|
|
26
42
|
size: number;
|
|
@@ -35,15 +51,9 @@ export class Batcher {
|
|
|
35
51
|
maxVertices?: number | undefined;
|
|
36
52
|
indexed?: boolean | undefined;
|
|
37
53
|
projectionUniform?: string | undefined;
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Initialize the batcher
|
|
41
|
-
* @ignore
|
|
42
|
-
*/
|
|
43
|
-
init(renderer: any, settings: any): void;
|
|
44
|
-
renderer: any;
|
|
54
|
+
}): void;
|
|
45
55
|
gl: any;
|
|
46
|
-
viewMatrix:
|
|
56
|
+
viewMatrix: Matrix3d | undefined;
|
|
47
57
|
/**
|
|
48
58
|
* the default shader created by this batcher
|
|
49
59
|
* @type {GLShader}
|
|
@@ -55,28 +65,38 @@ export class Batcher {
|
|
|
55
65
|
*/
|
|
56
66
|
currentShader: GLShader | undefined;
|
|
57
67
|
/**
|
|
58
|
-
*
|
|
68
|
+
* @param {Topology|number} value - a topology name or a GL primitive mode
|
|
69
|
+
*/
|
|
70
|
+
set mode(value: Topology | number);
|
|
71
|
+
/**
|
|
72
|
+
* Primitive type to render, as a GL enum (`gl.TRIANGLES`, `gl.LINES`, …).
|
|
73
|
+
*
|
|
74
|
+
* Assignable from either vocabulary — `batcher.mode = "line-list"` and
|
|
75
|
+
* `batcher.mode = gl.LINES` are equivalent — but always reads back as the
|
|
76
|
+
* GL enum, so existing comparisons keep working. Read
|
|
77
|
+
* {@link WebGLBatcher#topology} for the portable name.
|
|
59
78
|
* @type {number}
|
|
60
79
|
* @default gl.TRIANGLES
|
|
61
80
|
*/
|
|
62
|
-
mode: number
|
|
81
|
+
get mode(): number;
|
|
82
|
+
vertexState: WebGLVertexState | null | undefined;
|
|
63
83
|
/**
|
|
64
84
|
* an array of vertex attribute properties
|
|
65
|
-
* @see
|
|
85
|
+
* @see WebGLBatcher.addAttribute
|
|
66
86
|
* @type {Array.<Object>}
|
|
67
87
|
*/
|
|
68
88
|
attributes: Object[] | undefined;
|
|
69
89
|
/**
|
|
70
90
|
* the stride of a single vertex in bytes
|
|
71
91
|
* (will automatically be calculated as attributes definitions are added)
|
|
72
|
-
* @see
|
|
92
|
+
* @see WebGLBatcher.addAttribute
|
|
73
93
|
* @type {number}
|
|
74
94
|
*/
|
|
75
95
|
stride: number | undefined;
|
|
76
96
|
/**
|
|
77
97
|
* the size of a single vertex in floats
|
|
78
98
|
* (will automatically be calculated as attributes definitions are added)
|
|
79
|
-
* @see
|
|
99
|
+
* @see WebGLBatcher.addAttribute
|
|
80
100
|
* @type {number}
|
|
81
101
|
*/
|
|
82
102
|
vertexSize: number | undefined;
|
|
@@ -108,20 +128,49 @@ export class Batcher {
|
|
|
108
128
|
*/
|
|
109
129
|
indexBuffer: WebGLIndexBuffer | null | undefined;
|
|
110
130
|
/**
|
|
111
|
-
*
|
|
131
|
+
* The GL buffer this batcher uploads its vertex data into: its own
|
|
132
|
+
* buffer for indexed (mesh-family) batchers, otherwise the renderer's
|
|
133
|
+
* shared one.
|
|
134
|
+
* @type {WebGLBuffer}
|
|
112
135
|
* @ignore
|
|
113
136
|
*/
|
|
114
|
-
|
|
137
|
+
get uploadBuffer(): WebGLBuffer;
|
|
115
138
|
/**
|
|
116
|
-
*
|
|
139
|
+
* (Re)build this batcher's {@link WebGLVertexState} — the frozen vertex
|
|
140
|
+
* buffer layout (`attributes` + `stride`) realized as a GL vertex array
|
|
141
|
+
* object bound to this batcher's upload buffer and, for indexed
|
|
142
|
+
* batchers, its index buffer.
|
|
143
|
+
*
|
|
144
|
+
* Every shader hosted by this batcher must declare a prefix of that
|
|
145
|
+
* layout, in layout order (see {@link validateShaderLocations}) — the
|
|
146
|
+
* locations are frozen here at the default shader's mapping.
|
|
147
|
+
* @ignore
|
|
117
148
|
*/
|
|
118
|
-
|
|
149
|
+
createVertexState(): void;
|
|
119
150
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
151
|
+
* Validate (once per shader) that a hosted shader's attribute locations
|
|
152
|
+
* match this batcher's frozen vertex state. The engine's analogue of
|
|
153
|
+
* WebGPU's pipeline-creation validation: locations are bound in vertex
|
|
154
|
+
* source declaration order, so every shader hosted by this batcher must
|
|
155
|
+
* declare a prefix of the batcher's attribute layout, in layout order.
|
|
156
|
+
* A mismatched shader silently reads wrong vertex data — warn loudly.
|
|
157
|
+
* @ignore
|
|
123
158
|
*/
|
|
124
|
-
|
|
159
|
+
validateShaderLocations(shader: any): void;
|
|
160
|
+
validatedShaders: WeakSet<object> | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Ensure the draw about to be recorded runs on THIS batcher's program.
|
|
163
|
+
* Normally `bind()` guaranteed that, but an `ONCONTEXT_RESTORED`
|
|
164
|
+
* emission recompiles every live GLShader — each replaying its uniform
|
|
165
|
+
* snapshot on its OWN program — leaving whichever recompiled last
|
|
166
|
+
* really bound while the renderer's cache still named another. The
|
|
167
|
+
* renderer invalidates its program cache on that event, so this
|
|
168
|
+
* pointer compare re-issues `useProgram` exactly when the drift
|
|
169
|
+
* happened and costs two loads otherwise. Called by every flush path
|
|
170
|
+
* (the base and the quad override).
|
|
171
|
+
* @ignore
|
|
172
|
+
*/
|
|
173
|
+
syncProgram(): void;
|
|
125
174
|
/**
|
|
126
175
|
* Select the shader to use for compositing
|
|
127
176
|
* @see GLShader
|
|
@@ -130,14 +179,57 @@ export class Batcher {
|
|
|
130
179
|
useShader(shader: GLShader): void;
|
|
131
180
|
currentSamplerUnit: number | undefined;
|
|
132
181
|
/**
|
|
133
|
-
*
|
|
134
|
-
* @param {string} name - name of the attribute in the vertex shader
|
|
135
|
-
* @param {number} size - number of components per vertex attribute. Must be 1, 2, 3, or 4.
|
|
136
|
-
* @param {GLenum} type - data type of each component in the array
|
|
137
|
-
* @param {boolean} normalized - whether integer data values should be normalized into a certain range when being cast to a float
|
|
138
|
-
* @param {number} offset - offset in bytes of the first component in the vertex attribute array
|
|
182
|
+
* @param {Topology|number} value - a topology name or a GL primitive mode
|
|
139
183
|
*/
|
|
140
|
-
|
|
184
|
+
set topology(value: Topology | number);
|
|
185
|
+
/**
|
|
186
|
+
* How this batcher assembles vertices into primitives, in the
|
|
187
|
+
* backend-neutral vocabulary.
|
|
188
|
+
*
|
|
189
|
+
* `"line-loop"` and `"triangle-fan"` are engine extensions with no
|
|
190
|
+
* equivalent in modern GPU APIs — prefer the others for anything that must
|
|
191
|
+
* survive a backend change.
|
|
192
|
+
* @type {Topology}
|
|
193
|
+
* @default "triangle-list"
|
|
194
|
+
*/
|
|
195
|
+
get topology(): Topology;
|
|
196
|
+
/**
|
|
197
|
+
* Add a vertex attribute to this batcher's layout.
|
|
198
|
+
*
|
|
199
|
+
* Accepts either vocabulary. The backend-neutral form names the component
|
|
200
|
+
* type and count in one token, which is what a non-WebGL backend can
|
|
201
|
+
* consume directly and what lets a layout be written without a live
|
|
202
|
+
* rendering context:
|
|
203
|
+
*
|
|
204
|
+
* ```js
|
|
205
|
+
* batcher.addAttribute({ name: "aColor", format: "unorm8x4", offset: 20 });
|
|
206
|
+
* batcher.addAttribute("aColor", "unorm8x4", 20);
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* The GL form is supported indefinitely and behaves exactly as before:
|
|
210
|
+
*
|
|
211
|
+
* ```js
|
|
212
|
+
* batcher.addAttribute("aColor", 4, gl.UNSIGNED_BYTE, true, 20);
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* Records keep both spellings, so existing readers of `size` / `type` /
|
|
216
|
+
* `normalized` are unaffected. A GL combination with no portable name —
|
|
217
|
+
* three-component 8- and 16-bit types, which the neutral vocabulary does
|
|
218
|
+
* not define — is stored with `format: undefined` rather than an invented
|
|
219
|
+
* name that a backend could not honour.
|
|
220
|
+
*
|
|
221
|
+
* The layout is frozen once `init()` has built the vertex state, and each
|
|
222
|
+
* record is frozen on insertion: a batcher rebuilds its vertex state from
|
|
223
|
+
* these records after a context loss, so a later mutation would take
|
|
224
|
+
* effect at restore time rather than where it was written.
|
|
225
|
+
* @param {string|object} name - attribute name, or a descriptor object
|
|
226
|
+
* @param {number|VertexFormat} [size] - component count (GL form), or the format (neutral form)
|
|
227
|
+
* @param {GLenum|number} [type] - component type (GL form), or the byte offset (neutral form)
|
|
228
|
+
* @param {boolean} [normalized] - whether integers are scaled into `[0, 1]` / `[-1, 1]` (GL form only)
|
|
229
|
+
* @param {number} [offset] - byte offset of the attribute within a vertex (GL form)
|
|
230
|
+
* @throws {Error} when the layout is frozen, the format or GL type is unknown, or a descriptor contradicts itself
|
|
231
|
+
*/
|
|
232
|
+
addAttribute(name: string | object, size?: number | VertexFormat, type?: GLenum | number, normalized?: boolean, offset?: number, ...args: any[]): void;
|
|
141
233
|
/**
|
|
142
234
|
* set/change the current projection matrix
|
|
143
235
|
* @param {Matrix3d} matrix - the new projection matrix
|
|
@@ -154,11 +246,16 @@ export class Batcher {
|
|
|
154
246
|
* @param {number} [mode=gl.TRIANGLES] - the GL drawing mode
|
|
155
247
|
*/
|
|
156
248
|
flush(mode?: number): void;
|
|
249
|
+
#private;
|
|
157
250
|
}
|
|
158
|
-
export default
|
|
251
|
+
export default WebGLBatcher;
|
|
252
|
+
import { Batcher } from "../../gpu/batcher.js";
|
|
253
|
+
import type WebGLRenderer from "./../webgl_renderer.js";
|
|
254
|
+
import type { Matrix3d } from "../../../math/matrix3d.ts";
|
|
159
255
|
import GLShader from "../glshader.js";
|
|
256
|
+
import type { Topology } from "../../gpu/topology.ts";
|
|
257
|
+
import WebGLVertexState from "../buffer/vertexstate.js";
|
|
160
258
|
import VertexArrayBuffer from "../../buffer/vertex.js";
|
|
161
259
|
import WebGLIndexBuffer from "../buffer/index.js";
|
|
162
|
-
import type {
|
|
163
|
-
import type WebGLRenderer from "./../webgl_renderer.js";
|
|
260
|
+
import type { VertexFormat } from "../../gpu/vertexformat.ts";
|
|
164
261
|
//# sourceMappingURL=batcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH;IAgBC;;;OAGG;IACH,sBAHW,aAAa,YACb,MAAM,EAKhB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,eAfW,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,QA+IA;IAzIA,QAAqB;IAGrB,iCAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IA2X/B;;OAEG;IACH,gBAFW,QAAQ,GAAC,MAAM,EASzB;IAxBD;;;;;;;;;OASG;IACH,YAHU,MAAM,CAKf;IA/WC,iDAAuB;IAGxB;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IA4CtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,iDAAuB;IAgBxB;;;;;;OAMG;IACH,oBAHU,WAAW,CAKpB;IAED;;;;;;;;;;OAUG;IACH,0BAiBC;IAyFD;;;;;;;;OAQG;IACH,2CA0BC;IAxBC,8CAAqC;IA0BvC;;;;;;;;;;;OAWG;IACH,oBAaC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QAuBlB;IAHE,uCAA4B;IAmB/B;;OAEG;IACH,oBAFW,QAAQ,GAAC,MAAM,EAIzB;IAnBD;;;;;;;;;OASG;IACH,gBAHU,QAAQ,CAKjB;IAmCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,mBAPW,MAAM,GAAC,MAAM,SACb,MAAM,GAAC,YAAY,SACnB,MAAM,GAAC,MAAM,eACb,OAAO,WACP,MAAM,wBA4BhB;IAiJD;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;;OAIG;IACH,oBAFW,MAAM,EAAE,QAOlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAqEhB;;CACD;;wBAvwB6C,sBAAsB;+BAUtC,wBAAwB;8BAC3B,2BAA2B;qBAPjC,gBAAgB;8BASV,uBAAuB;6BAVrB,0BAA0B;8BAJzB,wBAAwB;6BAGzB,oBAAoB;kCAUlB,2BAA2B"}
|
|
@@ -11,8 +11,22 @@
|
|
|
11
11
|
* @category Rendering
|
|
12
12
|
*/
|
|
13
13
|
export default class LitMeshBatcher extends MeshBatcher {
|
|
14
|
+
lightBlock: UniformBlock | undefined;
|
|
15
|
+
_lightBlockProgram: any;
|
|
16
|
+
/**
|
|
17
|
+
* Point the active program's `Light3dBlock` at our uniform buffer.
|
|
18
|
+
*
|
|
19
|
+
* A block binding is program state, so it has to be re-established
|
|
20
|
+
* whenever the program changes: a context restore recompiles it, `init`
|
|
21
|
+
* re-runs on reset, and `useShader` can swap one in without a batcher
|
|
22
|
+
* transition. Comparing against the program we last bound covers all
|
|
23
|
+
* three — a pointer compare in the steady state.
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
_bindLightBlock(): void;
|
|
14
27
|
/** push the 12-float lit vertex, appending the mesh's world-space normal. @ignore */
|
|
15
28
|
_pushVertex(vertexData: any, x: any, y: any, z: any, u: any, v: any, color: any, mesh: any, i3: any): void;
|
|
16
29
|
}
|
|
17
30
|
import MeshBatcher from "./mesh_batcher.js";
|
|
31
|
+
import UniformBlock from "../buffer/uniformblock.js";
|
|
18
32
|
//# sourceMappingURL=lit_mesh_batcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lit_mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_mesh_batcher.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lit_mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_mesh_batcher.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;GAWG;AACH;IAuBE,qCAIC;IACD,wBAA8B;IAO/B;;;;;;;;;OASG;IACH,wBAQC;IAyCD,qFAAqF;IACrF,2GAaC;CA4DD;wBApMuB,mBAAmB;yBAPlB,2BAA2B"}
|
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
* Lit-aware variant of `QuadBatcher` for the SpriteIlluminator workflow.
|
|
7
7
|
*
|
|
8
8
|
* Adds a 5th vertex attribute (`aNormalTextureId`) so each quad knows
|
|
9
|
-
* which
|
|
10
|
-
*
|
|
11
|
-
* that the lit fragment shader iterates.
|
|
9
|
+
* which slot its normal map occupies, and owns the per-frame
|
|
10
|
+
* `Light2dBlock` uniform buffer that the lit fragment shader iterates.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
12
|
+
* Colors and normal maps share ONE slot pool the same size as `QuadBatcher`'s
|
|
13
|
+
* (#1585) — a normal map is allocated a unit like any other texture, and
|
|
14
|
+
* `aNormalTextureId` records which one. The `WebGLRenderer` only
|
|
16
15
|
* dispatches sprites here when the scene actually needs lighting (active
|
|
17
16
|
* `Light2d` AND the sprite has a `normalMap`); unlit sprites stay on
|
|
18
17
|
* `QuadBatcher` and pay nothing.
|
|
@@ -36,23 +35,37 @@ export default class LitQuadBatcher extends QuadBatcher {
|
|
|
36
35
|
* @ignore
|
|
37
36
|
*/
|
|
38
37
|
boundNormalVersions: number[] | undefined;
|
|
38
|
+
normalStore: WebGLTextureStore | undefined;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* the
|
|
44
|
-
*
|
|
45
|
-
* @type {Map<HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap, {tex: WebGLTexture, version: number}>}
|
|
40
|
+
* Which slot in the shared pool each normal-map source currently holds.
|
|
41
|
+
* Normal maps are not in the color `TextureCache` (they are raw sources
|
|
42
|
+
* with their own GL textures), so their unit assignment is tracked here
|
|
43
|
+
* while the unit itself comes from the same allocator the colors use.
|
|
44
|
+
* @type {Map<HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap, number>}
|
|
46
45
|
* @ignore
|
|
47
46
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
version: number;
|
|
51
|
-
}> | undefined;
|
|
47
|
+
normalUnits: Map<ImageBitmap | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas, number> | undefined;
|
|
48
|
+
_cacheEpoch: any;
|
|
52
49
|
_lightCount: number | undefined;
|
|
53
50
|
_maxLights: number | undefined;
|
|
51
|
+
lightBlock: UniformBlock | undefined;
|
|
52
|
+
_lightBlockProgram: any;
|
|
54
53
|
_onTexture2dDestroyed: ((source: any) => void) | null | undefined;
|
|
55
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Point the active program's `Light2dBlock` at our uniform buffer.
|
|
56
|
+
*
|
|
57
|
+
* A block binding is *program* state, and the program can change under us
|
|
58
|
+
* in three ways: a context restore recompiles it, `setBatcher` can host a
|
|
59
|
+
* {@link ShaderEffect} on this batcher, and `init` re-runs on reset. Rather
|
|
60
|
+
* than hook each of those, re-bind whenever the program is not the one we
|
|
61
|
+
* last bound — a pointer compare per `bind`, and self-healing.
|
|
62
|
+
*
|
|
63
|
+
* A hosted `ShaderEffect` is a plain unlit ES 1.00 program with no light
|
|
64
|
+
* block, so `bindTo` reports failure and we simply record it, leaving the
|
|
65
|
+
* next real lit program to bind normally.
|
|
66
|
+
* @ignore
|
|
67
|
+
*/
|
|
68
|
+
_bindLightBlock(): void;
|
|
56
69
|
/**
|
|
57
70
|
* Release the cached GL texture uploaded for the given normal-map source
|
|
58
71
|
* and clear any slot bookkeeping referencing it. Safe to call for images
|
|
@@ -61,24 +74,23 @@ export default class LitQuadBatcher extends QuadBatcher {
|
|
|
61
74
|
*/
|
|
62
75
|
evictNormalMap(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap): void;
|
|
63
76
|
/**
|
|
64
|
-
*
|
|
65
|
-
* to texture units `maxBatchTextures..2*maxBatchTextures-1`. Called
|
|
66
|
-
* from `init` and `reset`.
|
|
67
|
-
* @ignore
|
|
68
|
-
*/
|
|
69
|
-
bindNormalSamplers(): void;
|
|
70
|
-
/**
|
|
71
|
-
* Upload per-frame Light2d uniforms used by the lit fragment path.
|
|
77
|
+
* Upload the per-frame Light2d data used by the lit fragment path.
|
|
72
78
|
* Called once per camera per frame (before the world tree walk).
|
|
73
79
|
* Lights past `MAX_LIGHTS` are silently ignored.
|
|
74
80
|
*
|
|
75
81
|
* Coordinates must be supplied in the same space as the renderer's
|
|
76
82
|
* pre-projection vertex coords (i.e. camera-local / FBO-local),
|
|
77
83
|
* matching `Stage.drawLighting`'s convention.
|
|
84
|
+
*
|
|
85
|
+
* The data goes into the `Light2dBlock` uniform buffer, which is
|
|
86
|
+
* independent of which program is current — so unlike the uniform arrays
|
|
87
|
+
* this replaced, calling it does not disturb the active shader. The
|
|
88
|
+
* upload is skipped outright when the packed bytes are unchanged, so a
|
|
89
|
+
* scene whose lights are static still costs nothing per frame.
|
|
78
90
|
* @param {object} uniforms
|
|
79
91
|
* @param {Float32Array} uniforms.positions - flat array of `[x, y, radius, intensity]` per light, length = 4 * count
|
|
80
92
|
* @param {Float32Array} uniforms.colors - flat array of `[r, g, b]` per light, length = 3 * count
|
|
81
|
-
* @param {Float32Array} [uniforms.heights] - flat array of per-light height, length
|
|
93
|
+
* @param {Float32Array} [uniforms.heights] - flat array of per-light height, length >= count
|
|
82
94
|
* @param {number} uniforms.count - number of lights to render (clamped to MAX_LIGHTS)
|
|
83
95
|
* @param {number[]} [uniforms.ambient] - `[r, g, b]` ambient floor (0..1 each)
|
|
84
96
|
*/
|
|
@@ -97,22 +109,35 @@ export default class LitQuadBatcher extends QuadBatcher {
|
|
|
97
109
|
* but for normal-map textures which live outside the color
|
|
98
110
|
* `TextureCache` (cached per-image in `normalMapTextures`).
|
|
99
111
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} image - normal-map source
|
|
100
|
-
* @param {number} unit - GL texture unit
|
|
112
|
+
* @param {number} unit - GL texture unit the normal map is resolved to
|
|
101
113
|
*/
|
|
102
114
|
bindNormalMap(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap, unit: number): void;
|
|
103
115
|
/**
|
|
104
|
-
*
|
|
105
|
-
* for future `bindNormalMap` calls. Not meant to be called directly —
|
|
106
|
-
* `bindNormalMap` invokes this on the first use of a given image.
|
|
116
|
+
* Drop a normal map's slot claim and hand the unit back to the allocator.
|
|
107
117
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
118
|
+
* A normal map claims its unit through `allocateTextureUnit()`, which has no
|
|
119
|
+
* key to release against — so without this the unit stayed marked used for
|
|
120
|
+
* the rest of the session and the pool drained monotonically as normal maps
|
|
121
|
+
* came and went, until something forced a full reset.
|
|
111
122
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} image - normal-map source
|
|
112
|
-
* @
|
|
113
|
-
|
|
123
|
+
* @ignore
|
|
124
|
+
*/
|
|
125
|
+
releaseNormalUnit(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap): void;
|
|
126
|
+
/**
|
|
127
|
+
* Resolve a normal-map source to its slot in the shared pool, uploading and
|
|
128
|
+
* binding it if it is not already resident.
|
|
129
|
+
*
|
|
130
|
+
* A version-only bump (an animated source re-baking into the same canvas
|
|
131
|
+
* reference) re-uploads into the same GL handle and needs no flush —
|
|
132
|
+
* `version` only changes between frames, and the batch is flushed at every
|
|
133
|
+
* frame/camera boundary, so no in-flight vertex references stale content.
|
|
134
|
+
* A DIFFERENT source landing on a live slot does need the pending vertices
|
|
135
|
+
* drawn first.
|
|
136
|
+
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} normalMap - the source
|
|
137
|
+
* @returns {number} the slot to write into `aNormalTextureId`
|
|
138
|
+
* @ignore
|
|
114
139
|
*/
|
|
115
|
-
|
|
140
|
+
resolveNormalUnit(normalMap: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap): number;
|
|
116
141
|
/**
|
|
117
142
|
* Add a textured quad with optional paired normal map.
|
|
118
143
|
* @param {TextureAtlas} texture - Source texture atlas
|
|
@@ -131,5 +156,7 @@ export default class LitQuadBatcher extends QuadBatcher {
|
|
|
131
156
|
addQuad(texture: TextureAtlas, x: number, y: number, w: number, h: number, u0: number, v0: number, u1: number, v1: number, tint: number, reupload?: boolean, normalMap?: HTMLImageElement | HTMLCanvasElement | null): void;
|
|
132
157
|
}
|
|
133
158
|
import QuadBatcher from "./quad_batcher.js";
|
|
159
|
+
import { WebGLTextureStore } from "../texture/store.js";
|
|
160
|
+
import UniformBlock from "../buffer/uniformblock.js";
|
|
134
161
|
import type { TextureAtlas } from "./../../texture/atlas.js";
|
|
135
162
|
//# sourceMappingURL=lit_quad_batcher.d.ts.map
|
|
@@ -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":"AAcA;;;GAGG;AAEH;;;;;;;;;;;;;;GAcG;AACH;IA8DE;;;;;;OAMG;IACH,6GAAiD;IAEjD;;;;;;;OAOG;IACH,0CAAmD;IAmBnD,2CAAiD;IAEjD;;;;;;;OAOG;IACH,2GAA4B;IAC5B,iBAAoB;IAEpB,gCAAoB;IACpB,+BAA4B;IAkB5B,qCAIC;IACD,wBAA8B;IAW7B,kEAEC;IAoCH;;;;;;;;;;;;;OAaG;IACH,wBAQC;IAED;;;;;OAKG;IACH,sBAFW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAaxE;IA8ED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,2BANG;QAA+B,SAAS,EAAhC,YAAY;QACW,MAAM,EAA7B,YAAY;QACY,OAAO;QACd,KAAK,EAAtB,MAAM;QACc,OAAO;KACrC,QAMA;IAED;;;;;;;;;OASG;IACH,qBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAqChB;IAED;;;;;;;;;OASG;IACH,yBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAaxE;IAED;;;;;;;;;;;;;OAaG;IACH,6BAJW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,GAC5D,MAAM,CAsClB;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,QAsIjD;CA+DD;wBA3qBuB,mBAAmB;kCADT,qBAAqB;yBAT9B,2BAA2B;kCAcrB,0BAA0B"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Provides texture creation, binding, uploading, and deletion.
|
|
8
|
-
* @category Rendering
|
|
9
|
-
*/
|
|
10
|
-
export class MaterialBatcher extends Batcher {
|
|
1
|
+
export class MaterialBatcher extends WebGLBatcher {
|
|
2
|
+
/**
|
|
3
|
+
* Initialize the textured batcher
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
init(renderer: any, settings: any): void;
|
|
11
7
|
set currentTextureUnit(unit: number);
|
|
12
8
|
/**
|
|
13
9
|
* The GL texture unit currently active (`gl.activeTexture`). Tracked on
|
|
@@ -27,6 +23,17 @@ export class MaterialBatcher extends Batcher {
|
|
|
27
23
|
* @ignore
|
|
28
24
|
*/
|
|
29
25
|
boundTextures: any[] | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Units whose texture CONTENT changed since the last upload (a
|
|
28
|
+
* canvas re-bake announced via `CanvasRenderTarget.invalidate`).
|
|
29
|
+
* Consumed by {@link MaterialBatcher#uploadTexture}, which then
|
|
30
|
+
* re-uploads INTO the existing texture — with immutable storage a
|
|
31
|
+
* same-shape re-upload is a pure `texSubImage2D`, so a ticking
|
|
32
|
+
* Text / gradient re-bake never re-allocates.
|
|
33
|
+
* @type {Set<number>}
|
|
34
|
+
* @ignore
|
|
35
|
+
*/
|
|
36
|
+
dirtyUnits: Set<number> | undefined;
|
|
30
37
|
_onCacheReset: (() => void) | null | undefined;
|
|
31
38
|
/**
|
|
32
39
|
* Drop every cached texture binding after a {@link GPU_TEXTURE_CACHE_RESET}
|
|
@@ -37,14 +44,6 @@ export class MaterialBatcher extends Batcher {
|
|
|
37
44
|
* @ignore
|
|
38
45
|
*/
|
|
39
46
|
_onTextureCacheReset(): void;
|
|
40
|
-
/**
|
|
41
|
-
* Free resources used by the batcher. Currently unsubscribes the
|
|
42
|
-
* texture-cache-reset listener so a discarded batcher doesn't keep
|
|
43
|
-
* accumulating handlers (relevant on context loss / renderer
|
|
44
|
-
* teardown).
|
|
45
|
-
* @ignore
|
|
46
|
-
*/
|
|
47
|
-
destroy(): void;
|
|
48
47
|
/**
|
|
49
48
|
* Create a WebGL texture from an image
|
|
50
49
|
* @param {number} unit - Destination texture unit
|
|
@@ -81,7 +80,17 @@ export class MaterialBatcher extends Batcher {
|
|
|
81
80
|
* @param {number} [unit] - Texture unit to unbind from
|
|
82
81
|
* @returns {number} unit the unit number that was associated with the given texture
|
|
83
82
|
*/
|
|
84
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Announce that the SOURCE content behind `unit` changed (same object,
|
|
85
|
+
* new pixels — a canvas re-bake): the next {@link MaterialBatcher#uploadTexture}
|
|
86
|
+
* for it re-uploads into the existing texture in place instead of
|
|
87
|
+
* discarding it. The allocation-preserving counterpart of
|
|
88
|
+
* {@link MaterialBatcher#unbindTexture2D}.
|
|
89
|
+
* @param {number} unit - the texture unit whose content is stale
|
|
90
|
+
* @ignore
|
|
91
|
+
*/
|
|
92
|
+
markTextureDirty(unit: number): void;
|
|
93
|
+
unbindTexture2D(texture: any, unit: any): any;
|
|
85
94
|
/**
|
|
86
95
|
* Forget whatever texture this batcher believes is bound to `unit`, so the
|
|
87
96
|
* next bind to it re-issues the GL bind. Used when a GL texture unit is
|
|
@@ -112,6 +121,6 @@ export class MaterialBatcher extends Batcher {
|
|
|
112
121
|
*/
|
|
113
122
|
uploadTexture(texture: TextureAtlas | TextureResource, w?: number, h?: number, force?: boolean, flush?: boolean, repeat?: string): any;
|
|
114
123
|
}
|
|
115
|
-
import {
|
|
124
|
+
import { WebGLBatcher } from "./batcher.js";
|
|
116
125
|
import type { TextureAtlas } from "./../../texture/atlas.js";
|
|
117
126
|
//# sourceMappingURL=material_batcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAgCA;IACC;;;OAGG;IACH,yCAoDC;IAiCD,6BAPU,MAAM,EASf;IAlBD;;;;;;;;;;;OAWG;IACH,0BAHU,MAAM,CAKf;IA5EA;;;OAGG;IACH,iCAAuB;IAEvB;;;;;;;;;OASG;IACH,oCAA2B;IAwB1B,+CAEC;IAKH;;;;;;;OAOG;IACH,6BAKC;IAsDD;;;;;;;;;;;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,CAoKxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QAuCnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,yBAsBhB;IAED;;;;;OAKG;IACH;;;;;;;;OAQG;IACH,uBAHW,MAAM,QAKhB;IAED,8CAWC;IAED;;;;;;;;;;;OAWG;IACH,qBAHW,MAAM,QAQhB;IAED;;;;;;;;;;;;;;OAcG;IACH,uBAbW,YAAY,GAAC,eAAe,MAC5B,MAAM,MAGN,MAAM,UACN,OAAO,UACP,OAAO,WACP,MAAM,OA2GhB;CACD;6BApkB4B,cAAc;kCAIZ,0BAA0B"}
|