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
|
@@ -59,7 +59,66 @@ declare class Detector {
|
|
|
59
59
|
y: number;
|
|
60
60
|
};
|
|
61
61
|
depth: number;
|
|
62
|
+
overlapNZ: number;
|
|
63
|
+
overlapZ: number;
|
|
64
|
+
normalZ: number;
|
|
65
|
+
indexShapeA: number;
|
|
66
|
+
indexShapeB: number;
|
|
67
|
+
isTriggerContact: boolean;
|
|
62
68
|
}[];
|
|
69
|
+
/**
|
|
70
|
+
* Shape-pair contacts that were overlapping in the previous step (#1596).
|
|
71
|
+
* Keyed by `_shapePairKey`, diffed against `_frameShapeSeen` in
|
|
72
|
+
* `endFrame()` to fire `onShapeCollisionEnd`. Populated only when someone
|
|
73
|
+
* subscribes, so a game that does not use the feature keeps these empty.
|
|
74
|
+
* @ignore
|
|
75
|
+
*/
|
|
76
|
+
_activeShapePairs: Map<any, any>;
|
|
77
|
+
/** @ignore */
|
|
78
|
+
_frameShapeSeen: Map<any, any>;
|
|
79
|
+
/**
|
|
80
|
+
* Two-slot pool of receiver-symmetric shape-contact views, mirroring
|
|
81
|
+
* `_symViews`: `a` is the receiver, `b` the partner, and `shapeA` /
|
|
82
|
+
* `indexShapeA` are always the RECEIVER's shape. Two slots because both
|
|
83
|
+
* sides may be live at once when a handler mutates the world.
|
|
84
|
+
* @ignore
|
|
85
|
+
*/
|
|
86
|
+
_shapeViews: {
|
|
87
|
+
a: null;
|
|
88
|
+
b: null;
|
|
89
|
+
shapeA: null;
|
|
90
|
+
shapeB: null;
|
|
91
|
+
overlap: number;
|
|
92
|
+
overlapN: {
|
|
93
|
+
x: number;
|
|
94
|
+
y: number;
|
|
95
|
+
};
|
|
96
|
+
overlapV: {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
};
|
|
100
|
+
normal: {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
};
|
|
104
|
+
depth: number;
|
|
105
|
+
overlapNZ: number;
|
|
106
|
+
overlapZ: number;
|
|
107
|
+
normalZ: number;
|
|
108
|
+
indexShapeA: number;
|
|
109
|
+
indexShapeB: number;
|
|
110
|
+
isTrigger: boolean;
|
|
111
|
+
}[];
|
|
112
|
+
/**
|
|
113
|
+
* The pair currently being enumerated, so the contact callback can be a
|
|
114
|
+
* single pre-bound function rather than a closure allocated per body pair
|
|
115
|
+
* per frame.
|
|
116
|
+
* @ignore
|
|
117
|
+
*/
|
|
118
|
+
_contactObjA: Container | Renderable | Entity | Sprite | NineSliceSprite | null;
|
|
119
|
+
_contactObjB: any;
|
|
120
|
+
/** @ignore */
|
|
121
|
+
_onShapeContact: (shapeA: any, indexA: any, shapeB: any, indexB: any, isTrigger: any, res: any) => void;
|
|
63
122
|
/**
|
|
64
123
|
* Populate one of the pooled symmetric views from a SAT response.
|
|
65
124
|
* `flip=false` builds the view for `response.a`'s side (legacy
|
|
@@ -86,6 +145,12 @@ declare class Detector {
|
|
|
86
145
|
y: number;
|
|
87
146
|
};
|
|
88
147
|
depth: number;
|
|
148
|
+
overlapNZ: number;
|
|
149
|
+
overlapZ: number;
|
|
150
|
+
normalZ: number;
|
|
151
|
+
indexShapeA: number;
|
|
152
|
+
indexShapeB: number;
|
|
153
|
+
isTriggerContact: boolean;
|
|
89
154
|
};
|
|
90
155
|
/**
|
|
91
156
|
* Called by the adapter at the start of a physics step. Resets the
|
|
@@ -102,6 +167,38 @@ declare class Detector {
|
|
|
102
167
|
* @ignore
|
|
103
168
|
*/
|
|
104
169
|
endFrame(): void;
|
|
170
|
+
/**
|
|
171
|
+
* Identity-only shape-contact view for `onShapeCollisionEnd`: the shapes
|
|
172
|
+
* have separated, so every geometric field is zeroed rather than left
|
|
173
|
+
* holding the last overlap, which would read as a live contact.
|
|
174
|
+
* @ignore
|
|
175
|
+
*/
|
|
176
|
+
_fillEndedView(slot: any, receiver: any, partner: any, ownShape: any, otherShape: any): {
|
|
177
|
+
a: null;
|
|
178
|
+
b: null;
|
|
179
|
+
shapeA: null;
|
|
180
|
+
shapeB: null;
|
|
181
|
+
overlap: number;
|
|
182
|
+
overlapN: {
|
|
183
|
+
x: number;
|
|
184
|
+
y: number;
|
|
185
|
+
};
|
|
186
|
+
overlapV: {
|
|
187
|
+
x: number;
|
|
188
|
+
y: number;
|
|
189
|
+
};
|
|
190
|
+
normal: {
|
|
191
|
+
x: number;
|
|
192
|
+
y: number;
|
|
193
|
+
};
|
|
194
|
+
depth: number;
|
|
195
|
+
overlapNZ: number;
|
|
196
|
+
overlapZ: number;
|
|
197
|
+
normalZ: number;
|
|
198
|
+
indexShapeA: number;
|
|
199
|
+
indexShapeB: number;
|
|
200
|
+
isTrigger: boolean;
|
|
201
|
+
};
|
|
105
202
|
/**
|
|
106
203
|
* Build a stable order-independent key for a pair of renderables,
|
|
107
204
|
* using their GUID. Returns undefined if either lacks a GUID (defensive
|
|
@@ -109,6 +206,94 @@ declare class Detector {
|
|
|
109
206
|
* @ignore
|
|
110
207
|
*/
|
|
111
208
|
_pairKey(a: any, b: any): string | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* Re-run the narrowphase for a remembered shape pair and repopulate
|
|
211
|
+
* `response` from it.
|
|
212
|
+
*
|
|
213
|
+
* The scan clears `response` on every test, so whichever pair won has to be
|
|
214
|
+
* measured again before handlers and the solver read it. Indices are looked
|
|
215
|
+
* up here rather than carried from the scan because an enumeration handler
|
|
216
|
+
* may have mutated either body in between: `removeShape()` re-indexes, and
|
|
217
|
+
* `destroy()` empties the array outright. A shape that is no longer on its
|
|
218
|
+
* body has no contact left to resolve, so this reports failure and the
|
|
219
|
+
* caller falls through instead of throwing.
|
|
220
|
+
* @ignore
|
|
221
|
+
* @returns {boolean} true when the pair was re-measured
|
|
222
|
+
*/
|
|
223
|
+
_retest(bodyA: any, bodyB: any, shapeA: any, shapeB: any, response: any): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Stable, order-independent key for one SHAPE pair (#1596).
|
|
226
|
+
*
|
|
227
|
+
* The renderable GUIDs order the pair, exactly as `_pairKey` does, and the
|
|
228
|
+
* two shape ids MUST swap alongside them: keying `guidA|guidB|idA|idB`
|
|
229
|
+
* without that swap gives the same physical contact two different keys
|
|
230
|
+
* depending on which object the outer loop visited first, and the contact
|
|
231
|
+
* would then End and Start every step.
|
|
232
|
+
*
|
|
233
|
+
* Shape identity is `_contactId`, stamped once in `Body#addShape` and never
|
|
234
|
+
* derived from array position, because `removeShape()` re-indexes every
|
|
235
|
+
* surviving shape.
|
|
236
|
+
* @ignore
|
|
237
|
+
*/
|
|
238
|
+
_shapePairKey(a: any, b: any, shapeA: any, shapeB: any): string | undefined;
|
|
239
|
+
/**
|
|
240
|
+
* True when an object subscribes to any shape-contact event.
|
|
241
|
+
*
|
|
242
|
+
* This is the opt-in gate: `collides()` only runs the full M x N scan when
|
|
243
|
+
* this returns true for one of the two objects, so an application that
|
|
244
|
+
* never declares these handlers performs exactly the narrowphase work it
|
|
245
|
+
* did before the feature existed.
|
|
246
|
+
* @ignore
|
|
247
|
+
*/
|
|
248
|
+
_wantsShapeContacts(obj: any): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Populate a pooled shape-contact view, same flip convention as
|
|
251
|
+
* `_fillSymView`: `flip=false` builds the view for `response.a`'s side,
|
|
252
|
+
* `flip=true` for `response.b`'s, so `shapeA` is always the receiver's.
|
|
253
|
+
* @ignore
|
|
254
|
+
*/
|
|
255
|
+
_fillShapeView(slot: any, satResponse: any, flip: any, shapeA: any, shapeB: any, isTrigger: any): {
|
|
256
|
+
a: null;
|
|
257
|
+
b: null;
|
|
258
|
+
shapeA: null;
|
|
259
|
+
shapeB: null;
|
|
260
|
+
overlap: number;
|
|
261
|
+
overlapN: {
|
|
262
|
+
x: number;
|
|
263
|
+
y: number;
|
|
264
|
+
};
|
|
265
|
+
overlapV: {
|
|
266
|
+
x: number;
|
|
267
|
+
y: number;
|
|
268
|
+
};
|
|
269
|
+
normal: {
|
|
270
|
+
x: number;
|
|
271
|
+
y: number;
|
|
272
|
+
};
|
|
273
|
+
depth: number;
|
|
274
|
+
overlapNZ: number;
|
|
275
|
+
overlapZ: number;
|
|
276
|
+
normalZ: number;
|
|
277
|
+
indexShapeA: number;
|
|
278
|
+
indexShapeB: number;
|
|
279
|
+
isTrigger: boolean;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Fire Start / Active for one overlapping shape pair. Called back from
|
|
283
|
+
* `collides()` once per pair, in scan order.
|
|
284
|
+
* @ignore
|
|
285
|
+
*/
|
|
286
|
+
_dispatchShapeContact(shapeA: any, shapeB: any, isTrigger: any, response: any): void;
|
|
287
|
+
/**
|
|
288
|
+
* Drop the references the enumeration callback reads.
|
|
289
|
+
*
|
|
290
|
+
* They are plain fields rather than a per-pair closure so the hot path
|
|
291
|
+
* allocates nothing, which means they outlive the pair unless cleared, and
|
|
292
|
+
* would hold two renderables (and everything they reach) against garbage
|
|
293
|
+
* collection until the next subscribed pair happened to overwrite them.
|
|
294
|
+
* @ignore
|
|
295
|
+
*/
|
|
296
|
+
_clearContactPair(): void;
|
|
112
297
|
/**
|
|
113
298
|
* determine if two objects should collide (based on both respective objects body collision mask and type).<br>
|
|
114
299
|
* you can redefine this function if you need any specific rules over what should collide with what.
|
|
@@ -123,7 +308,7 @@ declare class Detector {
|
|
|
123
308
|
* @param {Body} bodyB - a reference to body B.
|
|
124
309
|
* @returns {boolean} true if colliding
|
|
125
310
|
*/
|
|
126
|
-
collides(bodyA: Body, bodyB: Body, response?: ResponseObject): boolean;
|
|
311
|
+
collides(bodyA: Body, bodyB: Body, response?: ResponseObject, onContact?: undefined): boolean;
|
|
127
312
|
/**
|
|
128
313
|
* find all the collisions for the specified object using a broadphase algorithm
|
|
129
314
|
* @ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../../src/physics/builtin/detector.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../../src/physics/builtin/detector.js"],"names":[],"mappings":";AAyEA;;GAEG;AACH;IACC;;OAEG;IACH,mBAFW,SAAS,EA2JnB;IAvJA,iBAAkB;IAElB;;;;OAIG;IACH,UAFU,cAAc,CAEY;IAEpC;;;;;OAKG;IACH,4BAA6B;IAC7B;;;;OAIG;IACH,0BAA2B;IAC3B;;;;;;;;;;;;;;OAcG;IACH;;;;;;;;;;;;;;;;;;;;;;;QAsCC;IAED;;;;;;OAMG;IACH,iCAAkC;IAClC,cAAc;IACd,+BAAgC;IAEhC;;;;;;OAMG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;QAmCC;IAED;;;;;OAKG;IACH,gFAAwB;IACxB,kBAAwB;IACxB,cAAc;IACd,wGASC;IAGF;;;;;;;;OAQG;IACH;;;;;;;;;;;;;;;;;;;;;;;MA0CC;IAED;;;;;OAKG;IACH,mBAGC;IAED;;;;;;OAMG;IACH,iBA0DC;IAED;;;;;OAKG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;MAsBC;IAED;;;;;OAKG;IACH,6CAOC;IAED;;;;;;;;;;;;;OAaG;IACH,0EAFa,OAAO,CAuBnB;IAED;;;;;;;;;;;;;OAaG;IACH,4EAqBC;IAED;;;;;;;;OAQG;IACH,uCAMC;IAED;;;;;OAKG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;MA2CC;IAED;;;;OAIG;IACH,qFAyCC;IAED;;;;;;;;OAQG;IACH,0BAGC;IAED;;;;;;OAMG;IACH,iBAJW,UAAU,GAAC,SAAS,GAAC,MAAM,GAAC,MAAM,GAAC,eAAe,KAClD,UAAU,GAAC,SAAS,GAAC,MAAM,GAAC,MAAM,GAAC,eAAe,GAChD,OAAO,CAiBnB;IAED;;;;;OAKG;IACH,gBAJW,IAAI,SACJ,IAAI,qDACF,OAAO,CAyJnB;IAED;;;;;OAKG;IACH,iBAHW,UAAU,GAAC,SAAS,GAAC,MAAM,GAAC,MAAM,GAAC,eAAe,GAChD,OAAO,CA0PnB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,cArBW,IAAI,WACJ,KAAK,CAAE,UAAU,CAAC,GAChB,KAAK,CAAE,UAAU,CAAC,CAqC9B;CACD;2BA3gCyB,+BAA+B;2BA7D9B,gBAAgB;4BA8DhB,gCAAgC;wBAFpC,mCAAmC;wBAGnC,4BAA4B;iCACnB,qCAAqC;0BAC9C,0BAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raycast.d.ts","sourceRoot":"","sources":["../../../src/physics/builtin/raycast.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AA+KrC,wBAAgB,YAAY,CAC3B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACT,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"raycast.d.ts","sourceRoot":"","sources":["../../../src/physics/builtin/raycast.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AA+KrC,wBAAgB,YAAY,CAC3B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACT,UAAU,EAAE,CAoHd"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check whether two axis-aligned 3D boxes collide.
|
|
3
|
+
*
|
|
4
|
+
* This is the only narrowphase in the engine that can produce a **Z**
|
|
5
|
+
* pushback. The separating-axis set of two AABBs is just the three world axes,
|
|
6
|
+
* so there is no projection loop: penetration on each axis is
|
|
7
|
+
* `(halfA + halfB) - |centerDelta|`, a non-positive value on any axis means
|
|
8
|
+
* separated, and the minimum translation vector is the axis with the smallest
|
|
9
|
+
* positive penetration.
|
|
10
|
+
*
|
|
11
|
+
* The MTV is a single axis, so exactly one of `overlapN.x`, `overlapN.y` and
|
|
12
|
+
* `overlapNZ` comes back non-zero — see {@link ResponseObject#overlapNZ}. When
|
|
13
|
+
* that axis is Z the 2D fields stay at zero, which is what makes a legacy 2D
|
|
14
|
+
* `onCollision` handler safely inert on a depth-only contact rather than
|
|
15
|
+
* wrong.
|
|
16
|
+
* @ignore
|
|
17
|
+
* @param {Renderable} a - a reference to the object A.
|
|
18
|
+
* @param {Box3d} boxA - a reference to the object A Box3d to be tested
|
|
19
|
+
* @param {Renderable} b - a reference to the object B.
|
|
20
|
+
* @param {Box3d} boxB - a reference to the object B Box3d to be tested
|
|
21
|
+
* @param {object} [response] - Response object that will be populated if they intersect.
|
|
22
|
+
* @returns {boolean} true if they intersect, false if they don't.
|
|
23
|
+
*/
|
|
24
|
+
export function testBox3dBox3d(a: Renderable, boxA: Box3d, b: Renderable, boxB: Box3d, response?: object): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Check whether a {@link Box3d} collides with a planar shape.
|
|
27
|
+
*
|
|
28
|
+
* The planar shape is treated as **unbounded along Z** — an infinitely
|
|
29
|
+
* extruded prism of its own outline — so the pair reduces to the ordinary 2D
|
|
30
|
+
* test between the box's XY footprint and that outline, and the box's z can
|
|
31
|
+
* never make it miss. See {@link Box3d} for why that is the compatible
|
|
32
|
+
* reading: it is what keeps an existing 2D game's world shapes colliding
|
|
33
|
+
* unchanged the moment one `Box3d` body is introduced.
|
|
34
|
+
*
|
|
35
|
+
* `overlapZ` is left at `0` by construction, since neither participant has a
|
|
36
|
+
* finite depth to resolve against.
|
|
37
|
+
* @ignore
|
|
38
|
+
*/
|
|
39
|
+
export function testBox3dPolygon(a: any, boxA: any, b: any, polyB: any, response: any): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Planar-shape-first form of {@link testBox3dPolygon}.
|
|
42
|
+
* @ignore
|
|
43
|
+
*/
|
|
44
|
+
export function testPolygonBox3d(a: any, polyA: any, b: any, boxB: any, response: any): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* {@link Box3d} against an {@link Ellipse}, with the ellipse unbounded along
|
|
47
|
+
* Z. See {@link testBox3dPolygon}.
|
|
48
|
+
* @ignore
|
|
49
|
+
*/
|
|
50
|
+
export function testBox3dEllipse(a: any, boxA: any, b: any, ellipseB: any, response: any): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* {@link Ellipse} against a {@link Box3d}, with the ellipse unbounded along
|
|
53
|
+
* Z. See {@link testBox3dPolygon}.
|
|
54
|
+
* @ignore
|
|
55
|
+
*/
|
|
56
|
+
export function testEllipseBox3d(a: any, ellipseA: any, b: any, boxB: any, response: any): boolean;
|
|
57
|
+
import type Renderable from "../../renderable/renderable.js";
|
|
58
|
+
import type { Box3d } from "../../geometries/box3d.ts";
|
|
59
|
+
//# sourceMappingURL=sat3d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sat3d.d.ts","sourceRoot":"","sources":["../../../src/physics/builtin/sat3d.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,kCAPW,UAAU,QACV,KAAK,KACL,UAAU,QACV,KAAK,aACL,MAAM,GACJ,OAAO,CA6EnB;AAED;;;;;;;;;;;;;GAaG;AACH,gGAEC;AAED;;;GAGG;AACH,gGAEC;AAED;;;;GAIG;AACH,mGAEC;AAED;;;;GAIG;AACH,mGAEC;4BAtK0B,gCAAgC;2BAHnC,2BAA2B"}
|
|
@@ -23,6 +23,14 @@ export type ResponseObject = {
|
|
|
23
23
|
* The shortest colliding axis (unit-vector)
|
|
24
24
|
*/
|
|
25
25
|
overlapN: Vector2d;
|
|
26
|
+
/**
|
|
27
|
+
* The Z component of the shortest colliding axis, as a unit scalar (`-1`, `0` or `1`). Always `0` for a collision between planar shapes
|
|
28
|
+
*/
|
|
29
|
+
overlapNZ: number;
|
|
30
|
+
/**
|
|
31
|
+
* The Z component of the overlap vector (i.e. `overlapNZ * overlap`). Always `0` for a collision between planar shapes
|
|
32
|
+
*/
|
|
33
|
+
overlapZ: number;
|
|
26
34
|
/**
|
|
27
35
|
* Whether the first object is entirely inside the second
|
|
28
36
|
*/
|
|
@@ -48,6 +56,8 @@ export type ResponseObject = {
|
|
|
48
56
|
* @property {number} overlap Magnitude of the overlap on the shortest colliding axis
|
|
49
57
|
* @property {Vector2d} overlapV The overlap vector (i.e. `overlapN.scale(overlap, overlap)`). If this vector is subtracted from the position of a, a and b will no longer be colliding
|
|
50
58
|
* @property {Vector2d} overlapN The shortest colliding axis (unit-vector)
|
|
59
|
+
* @property {number} overlapNZ The Z component of the shortest colliding axis, as a unit scalar (`-1`, `0` or `1`). Always `0` for a collision between planar shapes
|
|
60
|
+
* @property {number} overlapZ The Z component of the overlap vector (i.e. `overlapNZ * overlap`). Always `0` for a collision between planar shapes
|
|
51
61
|
* @property {boolean} aInB Whether the first object is entirely inside the second
|
|
52
62
|
* @property {boolean} bInA Whether the second object is entirely inside the first
|
|
53
63
|
* @property {number} indexShapeA The index of the colliding shape for the object a body
|
|
@@ -58,10 +68,32 @@ declare class ResponseObject {
|
|
|
58
68
|
b: any;
|
|
59
69
|
overlapN: Vector2d;
|
|
60
70
|
overlapV: Vector2d;
|
|
71
|
+
/**
|
|
72
|
+
* Z half of the minimum translation axis.
|
|
73
|
+
*
|
|
74
|
+
* Z arrives as **scalars beside** `overlapN` / `overlapV` rather than
|
|
75
|
+
* by widening them to {@link Vector3d}, because `Vector3d` is not a
|
|
76
|
+
* subclass of {@link Vector2d} — retyping them would break every
|
|
77
|
+
* existing consumer of a 2D collision response.
|
|
78
|
+
*
|
|
79
|
+
* The minimum translation axis is a single axis, so at most one of
|
|
80
|
+
* `overlapN.x`, `overlapN.y` and `overlapNZ` is ever non-zero. The 2D
|
|
81
|
+
* invariant `overlapV = overlapN * overlap` therefore extends
|
|
82
|
+
* unchanged as `overlapZ = overlapNZ * overlap`, and a collision
|
|
83
|
+
* resolved along Z leaves `overlapN` / `overlapV` at zero — a legacy
|
|
84
|
+
* 2D handler reading them applies no push, which is correct, because
|
|
85
|
+
* there is no 2D push to apply.
|
|
86
|
+
*
|
|
87
|
+
* Only ever non-zero when both shapes are a {@link Box3d}; every
|
|
88
|
+
* planar shape pair leaves these at `0`.
|
|
89
|
+
*/
|
|
90
|
+
overlapNZ: number;
|
|
91
|
+
overlapZ: number;
|
|
61
92
|
aInB: boolean;
|
|
62
93
|
bInA: boolean;
|
|
63
94
|
indexShapeA: number;
|
|
64
95
|
indexShapeB: number;
|
|
96
|
+
isTriggerContact: boolean;
|
|
65
97
|
overlap: number;
|
|
66
98
|
/**
|
|
67
99
|
* Set some values of the response back to their defaults. <br>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/physics/response.js"],"names":[],"mappings":";;;;;;;;OAKc,UAAU;;;;OACV,UAAU;;;;aACV,MAAM;;;;cACN,QAAQ;;;;cACR,QAAQ;;;;
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/physics/response.js"],"names":[],"mappings":";;;;;;;;OAKc,UAAU;;;;OACV,UAAU;;;;aACV,MAAM;;;;cACN,QAAQ;;;;cACR,QAAQ;;;;eACR,MAAM;;;;cACN,MAAM;;;;UACN,OAAO;;;;UACP,OAAO;;;;iBACP,MAAM;;;;iBACN,MAAM;;AAbpB;;;;;;;;;;;;;;GAcG;AACH;IAEE,OAAa;IACb,OAAa;IACb,mBAA8B;IAC9B,mBAA8B;IAC9B;;;;;;;;;;;;;;;;;;OAkBG;IACH,kBAAkB;IAClB,iBAAiB;IACjB,cAAgB;IAChB,cAAgB;IAChB,oBAAqB;IACrB,oBAAqB;IACrB,0BAA6B;IAC7B,gBAA+B;IAGhC;;;;;;;;OAQG;IACH,gBAFa,MAAM,CAelB;CACD;yBA3EwB,qBAAqB"}
|
package/build/physics/world.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ export default class World extends Container {
|
|
|
100
100
|
* @type {import("./broadphase/broadphase.ts").Broadphase}
|
|
101
101
|
*/
|
|
102
102
|
broadphase: import("./broadphase/broadphase.ts").Broadphase;
|
|
103
|
+
onLevelLoaded: () => void;
|
|
103
104
|
/**
|
|
104
105
|
* Active physics bodies in this simulation. Backed by the active
|
|
105
106
|
* adapter; mutating this set directly is no longer the recommended
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../../src/physics/world.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../../src/physics/world.js"],"names":[],"mappings":"AA8BA;;;GAGG;AACH;IACC;;;;;;OAMG;IACH,gBANW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,YACN,cAAc,EAuIxB;IArHA;;;OAGG;IACH,KAFU,WAAW,CAED;IAEpB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QANU,MAAM,CAMO;IAEvB;;;;;OAKG;IACH,YAAa;IAEb;;;;;;;OAOG;IACH,WAHU,OAAO,CAGK;IAEtB;;;;;;;;;;;;;;OAcG;IACH,YAHU,OAAO,CAGK;IAEtB;;;;;;OAMG;IACH,SAFU,cAAc,CAEsB;IAG9C;;;;;;;;;;;;;;;OAeG;IACH,YAFU,OAAO,4BAA4B,EAAE,UAAU,CAEjB;IAcxC,0BAMC;IA2CF;;;;;;;;;;;OAWG;IACH,cAFa,GAAG,CAAC,IAAI,CAAC,CAOrB;IASD,eALa,QAAQ,EAOpB;IATD;;;OAGG;IACH,eAFa,QAAQ,CAIpB;IAKD;;;;OAIG;IACH,gBAFa,QAAQ,GAAG,SAAS,CAIhC;IAsCD;;;;;;;OAOG;IACH,cAHW,IAAI,GACF,KAAK,CASjB;IAED;;;;;OAKG;IACH,iBAHW,IAAI,GACF,KAAK,CASjB;IAED;;;;;OAKG;IACH,yBAIC;IAuBD;;;OAGG;IACH,SAFW,MAAM,QAWhB;CACD;sBAjXqB,4BAA4B;6BAatB,iCAAiC;oCAI1B,cAAc;sBAH5B,mBAAmB;8BAEX,qBAAqB;0BADzB,uBAAuB"}
|
|
@@ -104,6 +104,7 @@ export default class Container extends Renderable {
|
|
|
104
104
|
* this.backgroundColor.setColor(255, 0, 0);
|
|
105
105
|
*/
|
|
106
106
|
backgroundColor: Color;
|
|
107
|
+
onCanvasResize: (() => void) | undefined;
|
|
107
108
|
set sortOn(value: "x" | "y" | "z" | "depth");
|
|
108
109
|
/**
|
|
109
110
|
* The property of the child object that should be used to sort on
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA8GA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA8GA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,EA+GjB;IAxGA;;;OAGG;IACH,iBAAuB;IAEvB;;;;OAIG;IACH,MAHU,OAAO,CAGD;IAEhB;;;OAGG;IACH,4BAAyB;IAEzB;;;;;OAKG;IACH,SAHU,MAAM,CAGE;IAClB,wCAA8B;IAE9B;;;;OAIG;IACH,UAHU,OAAO,CAGG;IAEpB;;;;OAIG;IACH,WAHU,OAAO,CAGI;IAErB;;;;OAIG;IACH,UAHU,OAAO,CAGI;IAErB;;;OAGG;IACH,0BAEC;IAED;;;;;;OAMG;IACH,yBAHU,OAAO,CAGmB;IAEpC;;;;;;;OAOG;IACH,iBANU,KAAK,CAMmC;IAqBjD,yCAMC;IAiCH,kBANU,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,OAAO,EAmB5B;IAzCD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,cAHU,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,OAAO,CAK5B;IAgBD;;OAEG;IACH,cAmBC;IAED;;;;;;;;;;;;;OAaG;IACH,gBAJW,UAAU,GAAC,MAAM,GAAC,MAAM,GAAC,WAAW,GAAC,OAAO,GAAC,SAAS,GAAC,UAAU,GAAC,e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;6BACR,kBAAkB;yBACtB,cAAc;+BACR,gBAAgB;gCACf,gBAAgB;iCACf,sBAAsB;4BAC3B,iBAAiB;4BACjB,iBAAiB;+BAEd,uBAAuB;iCACrB,yBAAyB;8BAC5B,sBAAsB;sBAC9B,gBAAgB;4BACV,sBAAsB;4BACxB,wBAAwB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bake (once) a radial alpha ramp: opaque white at the centre, fading to
|
|
3
|
+
* fully transparent at the rim.
|
|
4
|
+
*
|
|
5
|
+
* White rather than black because the colour comes from the draw tint — that
|
|
6
|
+
* way the same bake serves a black shadow, a tinted one, or a coloured pool
|
|
7
|
+
* of light, and nothing has to be re-baked to change it.
|
|
8
|
+
* @returns {HTMLCanvasElement|OffscreenCanvas} the shared falloff canvas
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
export function getShadowFalloff(): HTMLCanvasElement | OffscreenCanvas;
|
|
12
|
+
/**
|
|
13
|
+
* Drop the shared bake. Only the tests need this — the canvas is CPU-side and
|
|
14
|
+
* costs 64 KB, so an application never has a reason to release it.
|
|
15
|
+
* @ignore
|
|
16
|
+
*/
|
|
17
|
+
export function resetShadowFalloff(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Whether a mesh's geometry has any vertical extent at all.
|
|
20
|
+
*
|
|
21
|
+
* The test a **blanket** opt-in needs: a ground shadow says "this object is
|
|
22
|
+
* standing above the floor", and a flat plane lying in the floor is the floor.
|
|
23
|
+
* Shadowing it with itself smears a blob the size of the whole ground across
|
|
24
|
+
* it, which is what a scene-wide `castGroundShadow` would otherwise do to
|
|
25
|
+
* every glTF scene that ships one. A per-object opt-in bypasses this — that
|
|
26
|
+
* one is an explicit instruction.
|
|
27
|
+
*
|
|
28
|
+
* Deliberately model-space and unrotated: the caller asks about the geometry,
|
|
29
|
+
* not about where it currently sits.
|
|
30
|
+
* @param {Float32Array} vertices - model-space vertex positions (x, y, z)
|
|
31
|
+
* @param {number} vertexCount - how many vertices to read
|
|
32
|
+
* @returns {boolean} true when the geometry is not flat in Y
|
|
33
|
+
* @ignore
|
|
34
|
+
*/
|
|
35
|
+
export function hasVerticalExtent(vertices: Float32Array, vertexCount: number): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Borrow the shadow quad for a renderer, building it on first use.
|
|
38
|
+
*
|
|
39
|
+
* Cached **on the renderer**, not at module level, for two reasons: a `Mesh`
|
|
40
|
+
* resolves its texture through the active renderer's texture cache, so a
|
|
41
|
+
* module-level one would bind itself to whichever application happened to
|
|
42
|
+
* construct it first; and hanging it off the renderer means it dies with the
|
|
43
|
+
* renderer instead of outliving it.
|
|
44
|
+
*
|
|
45
|
+
* Two are kept — lit and unlit — so the shadow can be drawn through whichever
|
|
46
|
+
* mesh batcher its owner is already using. Sharing one unlit quad between lit
|
|
47
|
+
* owners would force a `litMesh → mesh → litMesh` batcher transition per
|
|
48
|
+
* shadowed object, each costing a bind/unbind pair and a flush: far more than
|
|
49
|
+
* the single draw the shadow is supposed to be.
|
|
50
|
+
*
|
|
51
|
+
* Retained geometry is keyed per mesh object, so one quad uploads once and
|
|
52
|
+
* every shadow in the scene redraws it at a different matrix for free.
|
|
53
|
+
* @param {object} renderer - the active renderer
|
|
54
|
+
* @param {boolean} lit - whether the owning mesh draws lit
|
|
55
|
+
* @param {Function} MeshClass - the `Mesh` constructor (passed in to avoid a
|
|
56
|
+
* circular import: `Mesh` owns the shadow, not the other way round)
|
|
57
|
+
* @returns {object} the shared shadow quad for that tier
|
|
58
|
+
* @ignore
|
|
59
|
+
*/
|
|
60
|
+
export function getShadowQuad(renderer: object, lit: boolean, MeshClass: Function): object;
|
|
61
|
+
/**
|
|
62
|
+
* The blob quad an `InstancedMesh` draws from — sized to the prototype's own
|
|
63
|
+
* footprint (#1515).
|
|
64
|
+
*
|
|
65
|
+
* The shared quad is a unit square, and the instanced vertex stage scales it by
|
|
66
|
+
* each record's horizontal scale alone. That silently assumes the prototype
|
|
67
|
+
* geometry is exactly 1 unit across, which is true of almost nothing: glTF
|
|
68
|
+
* meshes load with `normalize: false` and keep their authored size, so a tree
|
|
69
|
+
* 3 units wide got a blob sized for a 1-unit tree. It also skipped the contact
|
|
70
|
+
* spread and the minor-axis floor the per-object tier applies, so the SAME
|
|
71
|
+
* asset drew a different shadow depending on whether it was instanced.
|
|
72
|
+
*
|
|
73
|
+
* Baking the extents into four vertices fixes it with no shader change and no
|
|
74
|
+
* per-draw uniform: retained geometry is keyed per mesh object, so this uploads
|
|
75
|
+
* once per `InstancedMesh` and is redrawn for free.
|
|
76
|
+
* @param {object} mesh - the InstancedMesh casting the shadows
|
|
77
|
+
* @param {Function} MeshClass - the `Mesh` constructor (avoids a circular import)
|
|
78
|
+
* @param {number} halfX - model-space half-extent along X, spread applied
|
|
79
|
+
* @param {number} halfZ - model-space half-extent along Z, spread applied
|
|
80
|
+
* @param {number} version - the prototype's geometry version
|
|
81
|
+
* @returns {object} the quad to draw this scatter's blobs from
|
|
82
|
+
* @ignore
|
|
83
|
+
*/
|
|
84
|
+
export function getInstancedShadowQuad(mesh: object, MeshClass: Function, halfX: number, halfZ: number, version: number): object;
|
|
85
|
+
/**
|
|
86
|
+
* Release the shadow quads a renderer built, if any. Called from renderer
|
|
87
|
+
* teardown so the retained GPU geometry goes with it.
|
|
88
|
+
* @param {object} renderer - the renderer being torn down
|
|
89
|
+
* @ignore
|
|
90
|
+
*/
|
|
91
|
+
export function releaseShadowQuads(renderer: object): void;
|
|
92
|
+
//# sourceMappingURL=groundshadow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groundshadow.d.ts","sourceRoot":"","sources":["../../src/renderable/groundshadow.js"],"names":[],"mappings":"AAyCA;;;;;;;;;GASG;AACH,oCAHa,iBAAiB,GAAC,eAAe,CAsC7C;AAED;;;;GAIG;AACH,2CAEC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,4CALW,YAAY,eACZ,MAAM,GACJ,OAAO,CA8BnB;AAiBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wCAPW,MAAM,OACN,OAAO,wBAGL,MAAM,CAiClB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,6CARW,MAAM,8BAEN,MAAM,SACN,MAAM,WACN,MAAM,GACJ,MAAM,CAsClB;AAED;;;;;GAKG;AACH,6CAHW,MAAM,QAUhB"}
|