@codexo/exojs 0.14.0 → 0.15.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/CHANGELOG.md +132 -0
- package/README.md +2 -4
- package/dist/esm/animation/Tween.d.ts.map +1 -1
- package/dist/esm/animation/Tween.js +0 -1
- package/dist/esm/animation/Tween.js.map +1 -1
- package/dist/esm/animation/TweenManager.d.ts +44 -5
- package/dist/esm/animation/TweenManager.d.ts.map +1 -1
- package/dist/esm/animation/TweenManager.js +57 -5
- package/dist/esm/animation/TweenManager.js.map +1 -1
- package/dist/esm/animation/TweenSequencer.d.ts +139 -0
- package/dist/esm/animation/TweenSequencer.d.ts.map +1 -0
- package/dist/esm/animation/TweenSequencer.js +305 -0
- package/dist/esm/animation/TweenSequencer.js.map +1 -0
- package/dist/esm/animation/index.d.ts +1 -0
- package/dist/esm/animation/index.d.ts.map +1 -1
- package/dist/esm/audio/WorkletEffect.d.ts +34 -20
- package/dist/esm/audio/WorkletEffect.d.ts.map +1 -1
- package/dist/esm/audio/WorkletEffect.js +92 -25
- package/dist/esm/audio/WorkletEffect.js.map +1 -1
- package/dist/esm/core/Application.d.ts +43 -5
- package/dist/esm/core/Application.d.ts.map +1 -1
- package/dist/esm/core/Application.js +83 -9
- package/dist/esm/core/Application.js.map +1 -1
- package/dist/esm/core/BuildInfo.js +2 -2
- package/dist/esm/core/Codec.d.ts +41 -0
- package/dist/esm/core/Codec.d.ts.map +1 -0
- package/dist/esm/core/Codec.js +79 -0
- package/dist/esm/core/Codec.js.map +1 -0
- package/dist/esm/core/FixedTimestep.d.ts +28 -0
- package/dist/esm/core/FixedTimestep.d.ts.map +1 -0
- package/dist/esm/core/FixedTimestep.js +62 -0
- package/dist/esm/core/FixedTimestep.js.map +1 -0
- package/dist/esm/core/Scene.d.ts +14 -0
- package/dist/esm/core/Scene.d.ts.map +1 -1
- package/dist/esm/core/Scene.js +18 -0
- package/dist/esm/core/Scene.js.map +1 -1
- package/dist/esm/core/SceneManager.d.ts +7 -0
- package/dist/esm/core/SceneManager.d.ts.map +1 -1
- package/dist/esm/core/SceneManager.js +20 -4
- package/dist/esm/core/SceneManager.js.map +1 -1
- package/dist/esm/core/SceneNode.d.ts +36 -6
- package/dist/esm/core/SceneNode.d.ts.map +1 -1
- package/dist/esm/core/SceneNode.js +63 -11
- package/dist/esm/core/SceneNode.js.map +1 -1
- package/dist/esm/core/Stage.d.ts +7 -0
- package/dist/esm/core/Stage.d.ts.map +1 -1
- package/dist/esm/core/SystemRegistry.d.ts +5 -0
- package/dist/esm/core/SystemRegistry.d.ts.map +1 -1
- package/dist/esm/core/SystemRegistry.js +10 -0
- package/dist/esm/core/SystemRegistry.js.map +1 -1
- package/dist/esm/core/index.d.ts +4 -0
- package/dist/esm/core/index.d.ts.map +1 -1
- package/dist/esm/core/logging.d.ts +34 -0
- package/dist/esm/core/logging.d.ts.map +1 -0
- package/dist/esm/core/logging.js +59 -0
- package/dist/esm/core/logging.js.map +1 -0
- package/dist/esm/core/serialization/commonFields.d.ts.map +1 -1
- package/dist/esm/core/serialization/commonFields.js +6 -0
- package/dist/esm/core/serialization/commonFields.js.map +1 -1
- package/dist/esm/core/serialization/renderingSerializers.d.ts.map +1 -1
- package/dist/esm/core/serialization/renderingSerializers.js +14 -5
- package/dist/esm/core/serialization/renderingSerializers.js.map +1 -1
- package/dist/esm/index.js +7 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/input/Gamepad.d.ts +10 -0
- package/dist/esm/input/Gamepad.d.ts.map +1 -1
- package/dist/esm/input/Gamepad.js +12 -0
- package/dist/esm/input/Gamepad.js.map +1 -1
- package/dist/esm/input/InputManager.d.ts.map +1 -1
- package/dist/esm/input/InputManager.js +5 -0
- package/dist/esm/input/InputManager.js.map +1 -1
- package/dist/esm/input/InteractionManager.js +4 -4
- package/dist/esm/input/InteractionManager.js.map +1 -1
- package/dist/esm/math/collision-detection.js +1 -1
- package/dist/esm/rendering/BackendTargetPass.d.ts +1 -1
- package/dist/esm/rendering/BackendTargetPass.d.ts.map +1 -1
- package/dist/esm/rendering/CallbackRenderPass.d.ts +14 -10
- package/dist/esm/rendering/CallbackRenderPass.d.ts.map +1 -1
- package/dist/esm/rendering/CallbackRenderPass.js +16 -11
- package/dist/esm/rendering/CallbackRenderPass.js.map +1 -1
- package/dist/esm/rendering/DrawContext.d.ts +48 -0
- package/dist/esm/rendering/DrawContext.d.ts.map +1 -0
- package/dist/esm/rendering/PassContext.d.ts +42 -0
- package/dist/esm/rendering/PassContext.d.ts.map +1 -0
- package/dist/esm/rendering/PassContext.js +48 -0
- package/dist/esm/rendering/PassContext.js.map +1 -0
- package/dist/esm/rendering/RenderBackend.d.ts +14 -0
- package/dist/esm/rendering/RenderBackend.d.ts.map +1 -1
- package/dist/esm/rendering/RenderNode.d.ts.map +1 -1
- package/dist/esm/rendering/RenderNode.js +2 -2
- package/dist/esm/rendering/RenderNode.js.map +1 -1
- package/dist/esm/rendering/RenderNodePass.d.ts +1 -1
- package/dist/esm/rendering/RenderNodePass.d.ts.map +1 -1
- package/dist/esm/rendering/RenderingContext.d.ts +47 -16
- package/dist/esm/rendering/RenderingContext.d.ts.map +1 -1
- package/dist/esm/rendering/RenderingContext.js +134 -36
- package/dist/esm/rendering/RenderingContext.js.map +1 -1
- package/dist/esm/rendering/TransformBuffer.d.ts +23 -0
- package/dist/esm/rendering/TransformBuffer.d.ts.map +1 -1
- package/dist/esm/rendering/TransformBuffer.js +58 -0
- package/dist/esm/rendering/TransformBuffer.js.map +1 -1
- package/dist/esm/rendering/View.d.ts +38 -0
- package/dist/esm/rendering/View.d.ts.map +1 -1
- package/dist/esm/rendering/View.js +37 -0
- package/dist/esm/rendering/View.js.map +1 -1
- package/dist/esm/rendering/filters/WebGpuShaderFilter.d.ts.map +1 -1
- package/dist/esm/rendering/filters/WebGpuShaderFilter.js +9 -2
- package/dist/esm/rendering/filters/WebGpuShaderFilter.js.map +1 -1
- package/dist/esm/rendering/material/MeshMaterial.d.ts +20 -1
- package/dist/esm/rendering/material/MeshMaterial.d.ts.map +1 -1
- package/dist/esm/rendering/material/MeshMaterial.js +17 -0
- package/dist/esm/rendering/material/MeshMaterial.js.map +1 -1
- package/dist/esm/rendering/material/SpriteMaterial.d.ts +20 -1
- package/dist/esm/rendering/material/SpriteMaterial.d.ts.map +1 -1
- package/dist/esm/rendering/material/SpriteMaterial.js +17 -0
- package/dist/esm/rendering/material/SpriteMaterial.js.map +1 -1
- package/dist/esm/rendering/plan/RenderEffectExecutor.d.ts.map +1 -1
- package/dist/esm/rendering/plan/RenderEffectExecutor.js +7 -2
- package/dist/esm/rendering/plan/RenderEffectExecutor.js.map +1 -1
- package/dist/esm/rendering/plan/RenderInstruction.d.ts +5 -2
- package/dist/esm/rendering/plan/RenderInstruction.d.ts.map +1 -1
- package/dist/esm/rendering/plan/RenderPlanBuilder.d.ts.map +1 -1
- package/dist/esm/rendering/plan/RenderPlanBuilder.js +23 -5
- package/dist/esm/rendering/plan/RenderPlanBuilder.js.map +1 -1
- package/dist/esm/rendering/plan/RenderScope.d.ts +7 -0
- package/dist/esm/rendering/plan/RenderScope.d.ts.map +1 -1
- package/dist/esm/rendering/primitives/Graphics.d.ts +10 -1
- package/dist/esm/rendering/primitives/Graphics.d.ts.map +1 -1
- package/dist/esm/rendering/primitives/Graphics.js +30 -9
- package/dist/esm/rendering/primitives/Graphics.js.map +1 -1
- package/dist/esm/rendering/public.d.ts +5 -5
- package/dist/esm/rendering/public.d.ts.map +1 -1
- package/dist/esm/rendering/sprite/AnimatedSprite.d.ts +56 -19
- package/dist/esm/rendering/sprite/AnimatedSprite.d.ts.map +1 -1
- package/dist/esm/rendering/sprite/AnimatedSprite.js +121 -31
- package/dist/esm/rendering/sprite/AnimatedSprite.js.map +1 -1
- package/dist/esm/rendering/text/BitmapText.d.ts.map +1 -1
- package/dist/esm/rendering/text/BitmapText.js +2 -0
- package/dist/esm/rendering/text/BitmapText.js.map +1 -1
- package/dist/esm/rendering/text/HTMLText.d.ts.map +1 -1
- package/dist/esm/rendering/text/HTMLText.js +2 -2
- package/dist/esm/rendering/text/HTMLText.js.map +1 -1
- package/dist/esm/rendering/text/Text.d.ts.map +1 -1
- package/dist/esm/rendering/text/Text.js +2 -0
- package/dist/esm/rendering/text/Text.js.map +1 -1
- package/dist/esm/rendering/types.d.ts +37 -13
- package/dist/esm/rendering/types.d.ts.map +1 -1
- package/dist/esm/rendering/types.js +37 -13
- package/dist/esm/rendering/types.js.map +1 -1
- package/dist/esm/rendering/webgl2/WebGl2BackdropBlendCompositor.d.ts +41 -0
- package/dist/esm/rendering/webgl2/WebGl2BackdropBlendCompositor.d.ts.map +1 -0
- package/dist/esm/rendering/webgl2/WebGl2BackdropBlendCompositor.js +222 -0
- package/dist/esm/rendering/webgl2/WebGl2BackdropBlendCompositor.js.map +1 -0
- package/dist/esm/rendering/webgl2/WebGl2Backend.d.ts +34 -1
- package/dist/esm/rendering/webgl2/WebGl2Backend.d.ts.map +1 -1
- package/dist/esm/rendering/webgl2/WebGl2Backend.js +108 -60
- package/dist/esm/rendering/webgl2/WebGl2Backend.js.map +1 -1
- package/dist/esm/rendering/webgl2/WebGl2TextRenderer.d.ts.map +1 -1
- package/dist/esm/rendering/webgl2/WebGl2TextRenderer.js +50 -11
- package/dist/esm/rendering/webgl2/WebGl2TextRenderer.js.map +1 -1
- package/dist/esm/rendering/webgl2/glsl/backdrop-blend.frag.js +4 -0
- package/dist/esm/rendering/webgl2/glsl/backdrop-blend.frag.js.map +1 -0
- package/dist/esm/rendering/webgl2/glsl/backdrop-blend.vert.js +4 -0
- package/dist/esm/rendering/webgl2/glsl/backdrop-blend.vert.js.map +1 -0
- package/dist/esm/rendering/webgl2/glsl/text.vert.js +1 -1
- package/dist/esm/rendering/webgpu/WebGpuBackdropBlendCompositor.d.ts +72 -0
- package/dist/esm/rendering/webgpu/WebGpuBackdropBlendCompositor.d.ts.map +1 -0
- package/dist/esm/rendering/webgpu/WebGpuBackdropBlendCompositor.js +494 -0
- package/dist/esm/rendering/webgpu/WebGpuBackdropBlendCompositor.js.map +1 -0
- package/dist/esm/rendering/webgpu/WebGpuBackend.d.ts +27 -0
- package/dist/esm/rendering/webgpu/WebGpuBackend.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuBackend.js +157 -60
- package/dist/esm/rendering/webgpu/WebGpuBackend.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuBlendState.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuBlendState.js +5 -29
- package/dist/esm/rendering/webgpu/WebGpuBlendState.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuMaskCompositor.d.ts +2 -0
- package/dist/esm/rendering/webgpu/WebGpuMaskCompositor.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuMaskCompositor.js +2 -1
- package/dist/esm/rendering/webgpu/WebGpuMaskCompositor.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuMeshRenderer.d.ts +4 -0
- package/dist/esm/rendering/webgpu/WebGpuMeshRenderer.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuMeshRenderer.js +3 -1
- package/dist/esm/rendering/webgpu/WebGpuMeshRenderer.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuNineSliceSpriteRenderer.d.ts +2 -0
- package/dist/esm/rendering/webgpu/WebGpuNineSliceSpriteRenderer.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuNineSliceSpriteRenderer.js +2 -1
- package/dist/esm/rendering/webgpu/WebGpuNineSliceSpriteRenderer.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuPassCoordinator.d.ts +8 -0
- package/dist/esm/rendering/webgpu/WebGpuPassCoordinator.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuPassCoordinator.js +20 -0
- package/dist/esm/rendering/webgpu/WebGpuPassCoordinator.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuRepeatingSpriteRenderer.d.ts +6 -0
- package/dist/esm/rendering/webgpu/WebGpuRepeatingSpriteRenderer.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuRepeatingSpriteRenderer.js +4 -1
- package/dist/esm/rendering/webgpu/WebGpuRepeatingSpriteRenderer.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.d.ts +2 -0
- package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.js +2 -1
- package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuStencilClipper.d.ts +2 -0
- package/dist/esm/rendering/webgpu/WebGpuStencilClipper.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuStencilClipper.js +2 -1
- package/dist/esm/rendering/webgpu/WebGpuStencilClipper.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuTextRenderer.d.ts +2 -0
- package/dist/esm/rendering/webgpu/WebGpuTextRenderer.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuTextRenderer.js +3 -2
- package/dist/esm/rendering/webgpu/WebGpuTextRenderer.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuTransformStorage.d.ts +3 -1
- package/dist/esm/rendering/webgpu/WebGpuTransformStorage.d.ts.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuTransformStorage.js +29 -5
- package/dist/esm/rendering/webgpu/WebGpuTransformStorage.js.map +1 -1
- package/dist/esm/resources/Loader.d.ts +13 -0
- package/dist/esm/resources/Loader.d.ts.map +1 -1
- package/dist/esm/resources/Loader.js +67 -7
- package/dist/esm/resources/Loader.js.map +1 -1
- package/dist/esm/ui/ScrollContainer.d.ts +63 -0
- package/dist/esm/ui/ScrollContainer.d.ts.map +1 -0
- package/dist/esm/ui/ScrollContainer.js +99 -0
- package/dist/esm/ui/ScrollContainer.js.map +1 -0
- package/dist/esm/ui/Tooltip.d.ts +67 -0
- package/dist/esm/ui/Tooltip.d.ts.map +1 -0
- package/dist/esm/ui/Tooltip.js +133 -0
- package/dist/esm/ui/Tooltip.js.map +1 -0
- package/dist/esm/ui/index.d.ts +4 -0
- package/dist/esm/ui/index.d.ts.map +1 -1
- package/dist/exo.esm.js +1 -1
- package/dist/exo.esm.js.map +1 -1
- package/dist/exo.iife.js +45202 -0
- package/dist/exo.iife.js.map +1 -0
- package/dist/exo.iife.min.js +2 -0
- package/dist/exo.iife.min.js.map +1 -0
- package/package.json +15 -3
- package/dist/esm/rendering/Camera.d.ts +0 -34
- package/dist/esm/rendering/Camera.d.ts.map +0 -1
- package/dist/esm/rendering/Camera.js +0 -38
- package/dist/esm/rendering/Camera.js.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed-timestep accumulator (Gaffer's "Fix Your Timestep"). Converts the
|
|
3
|
+
* variable per-frame delta into a whole number of fixed-size steps, carrying the
|
|
4
|
+
* sub-step remainder across frames as an interpolation {@link FixedTimestep.alpha}.
|
|
5
|
+
*
|
|
6
|
+
* Pure timing logic — no scene or signal coupling — so the loop can drive it and
|
|
7
|
+
* tests can exercise the step/alpha maths directly. The {@link maxSteps} cap is
|
|
8
|
+
* the spiral-of-death guard: when a frame is so long it would need more than
|
|
9
|
+
* `maxSteps` catch-up steps, the surplus whole-step backlog is dropped rather
|
|
10
|
+
* than accumulated (which would make the next frame even longer).
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
class FixedTimestep {
|
|
15
|
+
_stepMs;
|
|
16
|
+
_maxSteps;
|
|
17
|
+
_accumulatorMs = 0;
|
|
18
|
+
constructor(_stepMs, _maxSteps) {
|
|
19
|
+
this._stepMs = _stepMs;
|
|
20
|
+
this._maxSteps = _maxSteps;
|
|
21
|
+
if (!(_stepMs > 0) || !Number.isFinite(_stepMs)) {
|
|
22
|
+
throw new RangeError(`FixedTimestep: step must be a positive finite number of ms, received ${_stepMs}.`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** The fixed step size in milliseconds. */
|
|
26
|
+
get stepMs() {
|
|
27
|
+
return this._stepMs;
|
|
28
|
+
}
|
|
29
|
+
/** Leftover fraction `[0, 1)` of a step — the render interpolation factor. */
|
|
30
|
+
get alpha() {
|
|
31
|
+
return this._accumulatorMs / this._stepMs;
|
|
32
|
+
}
|
|
33
|
+
/** Add a frame's elapsed time and return how many fixed steps to run now (capped at `maxSteps`). */
|
|
34
|
+
advance(frameDeltaMs) {
|
|
35
|
+
this._accumulatorMs += frameDeltaMs;
|
|
36
|
+
// Tolerance so an accumulator that lands a rounding-error below a whole
|
|
37
|
+
// multiple of the step (e.g. 3×step) still yields that many steps.
|
|
38
|
+
const epsilon = this._stepMs * 1e-9;
|
|
39
|
+
let steps = 0;
|
|
40
|
+
while (this._accumulatorMs >= this._stepMs - epsilon && steps < this._maxSteps) {
|
|
41
|
+
this._accumulatorMs -= this._stepMs;
|
|
42
|
+
steps++;
|
|
43
|
+
}
|
|
44
|
+
// Capped: drop the whole-step backlog, keep only the sub-step remainder so
|
|
45
|
+
// alpha stays in [0, 1) and the next frame does not replay the lost time.
|
|
46
|
+
if (this._accumulatorMs > this._stepMs) {
|
|
47
|
+
this._accumulatorMs %= this._stepMs;
|
|
48
|
+
}
|
|
49
|
+
// Clamp the tiny negative the epsilon subtraction can leave.
|
|
50
|
+
if (this._accumulatorMs < 0) {
|
|
51
|
+
this._accumulatorMs = 0;
|
|
52
|
+
}
|
|
53
|
+
return steps;
|
|
54
|
+
}
|
|
55
|
+
/** Clear the accumulator (e.g. on start/resume so a paused gap is not caught up). */
|
|
56
|
+
reset() {
|
|
57
|
+
this._accumulatorMs = 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { FixedTimestep };
|
|
62
|
+
//# sourceMappingURL=FixedTimestep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fix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zB;AAEA,QAAA,OAAO,KAAK;IACd;;IAGO,KAAK,GAAA;AACV,QAAA,IAAI,CAAC,cAAc,GAAG,CAAC;IACzB;AACD;;;;"}
|
package/dist/esm/core/Scene.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { Loader } from '#resources/Loader';
|
|
|
7
7
|
import { UIRoot } from '#ui/UIRoot';
|
|
8
8
|
import type { Application } from './Application';
|
|
9
9
|
import { type SerializedScene } from './serialization/types';
|
|
10
|
+
import { Signal } from './Signal';
|
|
10
11
|
import { SystemRegistry } from './SystemRegistry';
|
|
11
12
|
import type { Time } from './Time';
|
|
12
13
|
import type { Destroyable } from './types';
|
|
@@ -65,6 +66,10 @@ export declare class Scene {
|
|
|
65
66
|
* (show a panel on `scene.ui`, then set `scene.paused = true`).
|
|
66
67
|
*/
|
|
67
68
|
paused: boolean;
|
|
69
|
+
/** Dispatched after the scene finishes loading (after load() and init() complete). */
|
|
70
|
+
readonly onLoad: Signal<[]>;
|
|
71
|
+
/** Dispatched when the scene is about to be unloaded. */
|
|
72
|
+
readonly onUnload: Signal<[]>;
|
|
68
73
|
private _inputs;
|
|
69
74
|
private _tweens;
|
|
70
75
|
private _systems;
|
|
@@ -175,6 +180,15 @@ export declare class Scene {
|
|
|
175
180
|
* positions, advance timers, drive AI here. Override in subclass.
|
|
176
181
|
*/
|
|
177
182
|
update(_delta: Time): void;
|
|
183
|
+
/**
|
|
184
|
+
* Fixed-timestep logic hook. Called zero or more times per frame with a
|
|
185
|
+
* constant `delta` ({@link Application.fixedTimeStep}) before {@link Scene.update},
|
|
186
|
+
* so physics and deterministic gameplay advance at a frame-rate-independent
|
|
187
|
+
* rate. Put `physicsWorld.step(delta)` and movement here; leave camera, UI and
|
|
188
|
+
* purely visual work in {@link Scene.update}. Default is a no-op. Override in
|
|
189
|
+
* subclass.
|
|
190
|
+
*/
|
|
191
|
+
fixedUpdate(_delta: Time): void;
|
|
178
192
|
/**
|
|
179
193
|
* Explicit per-frame rendering entry point. Override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Scene.js
CHANGED
|
@@ -3,6 +3,7 @@ import { UIRoot } from '../ui/UIRoot.js';
|
|
|
3
3
|
import { DisposalScope } from './DisposalScope.js';
|
|
4
4
|
import { serializeTree, migrate, deserializeInto } from './serialization/serialize.js';
|
|
5
5
|
import { SERIALIZATION_VERSION } from './serialization/types.js';
|
|
6
|
+
import { Signal } from './Signal.js';
|
|
6
7
|
import { SystemRegistry } from './SystemRegistry.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -93,6 +94,10 @@ class Scene {
|
|
|
93
94
|
* (show a panel on `scene.ui`, then set `scene.paused = true`).
|
|
94
95
|
*/
|
|
95
96
|
paused = false;
|
|
97
|
+
/** Dispatched after the scene finishes loading (after load() and init() complete). */
|
|
98
|
+
onLoad = new Signal();
|
|
99
|
+
/** Dispatched when the scene is about to be unloaded. */
|
|
100
|
+
onUnload = new Signal();
|
|
96
101
|
_inputs = null;
|
|
97
102
|
_tweens = null;
|
|
98
103
|
_systems = null;
|
|
@@ -277,6 +282,17 @@ class Scene {
|
|
|
277
282
|
update(_delta) {
|
|
278
283
|
// override in subclass
|
|
279
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Fixed-timestep logic hook. Called zero or more times per frame with a
|
|
287
|
+
* constant `delta` ({@link Application.fixedTimeStep}) before {@link Scene.update},
|
|
288
|
+
* so physics and deterministic gameplay advance at a frame-rate-independent
|
|
289
|
+
* rate. Put `physicsWorld.step(delta)` and movement here; leave camera, UI and
|
|
290
|
+
* purely visual work in {@link Scene.update}. Default is a no-op. Override in
|
|
291
|
+
* subclass.
|
|
292
|
+
*/
|
|
293
|
+
fixedUpdate(_delta) {
|
|
294
|
+
// override in subclass
|
|
295
|
+
}
|
|
280
296
|
/**
|
|
281
297
|
* Explicit per-frame rendering entry point. Override to choose
|
|
282
298
|
* what gets rendered.
|
|
@@ -310,6 +326,8 @@ class Scene {
|
|
|
310
326
|
this._inputs = null;
|
|
311
327
|
this._tweens = null;
|
|
312
328
|
this._systems = null;
|
|
329
|
+
this.onLoad.destroy();
|
|
330
|
+
this.onUnload.destroy();
|
|
313
331
|
this._root.destroy();
|
|
314
332
|
this._app = null;
|
|
315
333
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scene.js","sources":["../../../../src/core/Scene.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Scene.js","sources":["../../../../src/core/Scene.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAiBA;;;AAGG;AACH,MAAM,WAAW,CAAA;AAGqB,IAAA,MAAA;AAFnB,IAAA,SAAS,GAAG,IAAI,GAAG,EAAgB;AAEpD,IAAA,WAAA,CAAoC,MAAa,EAAA;QAAb,IAAA,CAAA,MAAM,GAAN,MAAM;IAAU;AAE7C,IAAA,OAAO,CAAC,OAA+C,EAAE,QAAiC,EAAE,OAA6B,EAAA;QAC9H,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChF;AAEO,IAAA,QAAQ,CAAC,OAA+C,EAAE,QAAiC,EAAE,OAA6B,EAAA;QAC/H,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjF;AAEO,IAAA,MAAM,CAAC,OAA+C,EAAE,QAAiC,EAAE,OAA6B,EAAA;QAC7H,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/E;AAEO,IAAA,SAAS,CAAC,OAA+C,EAAE,QAAiC,EAAE,OAA6B,EAAA;QAChI,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,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AAM,CAAC,MAAY,EAAA;;IAE1B;AAEA;;;;;;;AAOG;AACI,IAAA,WAAW,CAAC,MAAY,EAAA;;IAE/B;AAEA;;;;;;;;;;;;;;AAcG;AACI,IAAA,IAAI,CAAC,QAA0B,EAAA;;IAEtC;AAEA;;;;AAIG;AACI,IAAA,MAAM,CAAC,OAAe,EAAA;;IAE7B;IAEO,OAAO,GAAA;;;AAGZ,QAAA,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;AACxB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI;AACnB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI;AACnB,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;AACpB,QAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;AACrB,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;AACvB,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;AACpB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;IAClB;AACD;;;;"}
|
|
@@ -63,6 +63,13 @@ export declare class SceneManager {
|
|
|
63
63
|
* UI layer on top.
|
|
64
64
|
*/
|
|
65
65
|
update(delta: Time): this;
|
|
66
|
+
/**
|
|
67
|
+
* Drive one fixed-timestep step on the active scene (unless paused). Called
|
|
68
|
+
* zero or more times per frame by the {@link Application} loop, ahead of
|
|
69
|
+
* {@link SceneManager.update}. No drawing or transition advance happens here —
|
|
70
|
+
* those are per-frame, not per fixed step.
|
|
71
|
+
*/
|
|
72
|
+
fixedUpdate(delta: Time): this;
|
|
66
73
|
destroy(): void;
|
|
67
74
|
private _prepareScene;
|
|
68
75
|
private _disposeScene;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneManager.d.ts","sourceRoot":"","sources":["../../../src/core/SceneManager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CA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AG,IAAI,EAE1C;IAED;;;;;OAKG;IACU,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BxF;;;;;OAKG;IACI,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI;IAkDhC;;;;;OAKG;IACI,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI;IAU9B,OAAO,IAAI,IAAI;YAkBR,aAAa;YAwDb,aAAa;YAgBb,2BAA2B;YAgB3B,kBAAkB;IAiChC,OAAO,CAAC,kBAAkB;YAyBZ,wBAAwB;IA2BtC,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,wBAAwB;CAoBjC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Mesh } from '../rendering/mesh/Mesh.js';
|
|
2
2
|
import { Color } from './Color.js';
|
|
3
|
+
import { logger } from './logging.js';
|
|
3
4
|
import { Scene } from './Scene.js';
|
|
4
5
|
import { Signal } from './Signal.js';
|
|
5
6
|
|
|
@@ -94,7 +95,7 @@ class SceneManager {
|
|
|
94
95
|
const updateResult = scene.update(delta);
|
|
95
96
|
if (!this._asyncUpdateWarned.has(scene) && updateResult instanceof Promise) {
|
|
96
97
|
this._asyncUpdateWarned.add(scene);
|
|
97
|
-
|
|
98
|
+
logger.warn('scene', `Scene.update() returned a Promise. update() must be synchronous — async logic here breaks frame timing and silently drops errors. Move async work into load() or init() instead.`);
|
|
98
99
|
}
|
|
99
100
|
// Tick the scene's systems (e.g. a physics world) after its update().
|
|
100
101
|
scene._tickSystems(delta);
|
|
@@ -103,7 +104,7 @@ class SceneManager {
|
|
|
103
104
|
const drawResult = scene.draw(this._app.rendering);
|
|
104
105
|
if (!this._asyncDrawWarned.has(scene) && drawResult instanceof Promise) {
|
|
105
106
|
this._asyncDrawWarned.add(scene);
|
|
106
|
-
|
|
107
|
+
logger.warn('scene', `Scene.draw() returned a Promise. draw() must be synchronous — an async draw() produces incomplete frames and silently drops errors.`);
|
|
107
108
|
}
|
|
108
109
|
// Auto-render the scene's screen-fixed UI layer above its content.
|
|
109
110
|
scene._peekUI()?._render(this._app.rendering);
|
|
@@ -117,6 +118,19 @@ class SceneManager {
|
|
|
117
118
|
}
|
|
118
119
|
return this;
|
|
119
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Drive one fixed-timestep step on the active scene (unless paused). Called
|
|
123
|
+
* zero or more times per frame by the {@link Application} loop, ahead of
|
|
124
|
+
* {@link SceneManager.update}. No drawing or transition advance happens here —
|
|
125
|
+
* those are per-frame, not per fixed step.
|
|
126
|
+
*/
|
|
127
|
+
fixedUpdate(delta) {
|
|
128
|
+
const scene = this._activeScene;
|
|
129
|
+
if (scene !== null && !scene.paused) {
|
|
130
|
+
scene.fixedUpdate(delta);
|
|
131
|
+
}
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
120
134
|
destroy() {
|
|
121
135
|
if (this._transition) {
|
|
122
136
|
const transition = this._transition;
|
|
@@ -137,7 +151,7 @@ class SceneManager {
|
|
|
137
151
|
await scene.load(this._app.loader);
|
|
138
152
|
await scene.init(this._app.loader);
|
|
139
153
|
if (scene.root.children.length > 0 && scene.draw === Scene.prototype.draw) {
|
|
140
|
-
|
|
154
|
+
logger.warn('scene', `Scene.root has ${scene.root.children.length} child(ren) after init() but draw() is not overridden. Scene.root is not auto-rendered — call context.render(this.root) inside draw().`);
|
|
141
155
|
}
|
|
142
156
|
// Bind the scene's root to the app's interaction manager so its nodes
|
|
143
157
|
// route picking/bounds notifications to this Application (no global).
|
|
@@ -147,6 +161,7 @@ class SceneManager {
|
|
|
147
161
|
if (ui !== null) {
|
|
148
162
|
this._app.interaction.attachUIRoot(ui);
|
|
149
163
|
}
|
|
164
|
+
scene.onLoad.dispatch();
|
|
150
165
|
}
|
|
151
166
|
catch (error) {
|
|
152
167
|
let cleanupError = null;
|
|
@@ -175,6 +190,7 @@ class SceneManager {
|
|
|
175
190
|
}
|
|
176
191
|
}
|
|
177
192
|
async _disposeScene(scene) {
|
|
193
|
+
scene.onUnload.dispatch();
|
|
178
194
|
this.onStopScene.dispatch(scene);
|
|
179
195
|
await scene.unload(this._app.loader);
|
|
180
196
|
const ui = scene._peekUI();
|
|
@@ -195,7 +211,7 @@ class SceneManager {
|
|
|
195
211
|
await this._disposeScene(scene);
|
|
196
212
|
}
|
|
197
213
|
catch (error) {
|
|
198
|
-
|
|
214
|
+
logger.error('scene', 'SceneManager.destroy() failed to unload the active scene.', error instanceof Error ? error : undefined);
|
|
199
215
|
}
|
|
200
216
|
}
|
|
201
217
|
async _runWithTransition(action, transition) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneManager.js","sources":["../../../../src/core/SceneManager.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SceneManager.js","sources":["../../../../src/core/SceneManager.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAwCA,MAAM,qBAAsB,SAAQ,IAAI,CAAA;AACtB,IAAA,MAAM,CAAC,OAAsB,EAAA;AAC3C,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QACpB;AAEA,QAAA,OAAO,IAAI;IACb;AACD;AAED,MAAM,iBAAiB,GAAG,MACxB,IAAI,qBAAqB,CAAC;;IAExB,QAAQ,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpD,IAAA,OAAO,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7C,CAAA,CAAC;AAEJ,MAAM,6BAA6B,GAAG,GAAG;AAEzC;;;;;;;;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AC,CAAC,GAAG,MAAM,CAAC,GAAG;AACxB,QAAA,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI;AACzB,QAAA,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM;AAC3B,QAAA,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK;AAC1B,QAAA,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM;AAE3B,QAAA,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACjG,QAAA,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;IACzB;AACD;;;;"}
|
|
@@ -5,7 +5,7 @@ import { Interval } from '#math/Interval';
|
|
|
5
5
|
import { Matrix } from '#math/Matrix';
|
|
6
6
|
import { ObservableVector, type ObservableVectorOwner } from '#math/ObservableVector';
|
|
7
7
|
import { Rectangle } from '#math/Rectangle';
|
|
8
|
-
import
|
|
8
|
+
import { Vector } from '#math/Vector';
|
|
9
9
|
import type { Container } from '#rendering/Container';
|
|
10
10
|
import type { View } from '#rendering/View';
|
|
11
11
|
import { Bounds } from './Bounds';
|
|
@@ -35,10 +35,10 @@ declare enum SceneNodeTransformFlags {
|
|
|
35
35
|
* for this node and every {@link Container} ancestor up the parent chain.
|
|
36
36
|
* The caches rebuild lazily on the next read.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
38
|
+
* Collision and hit-testing take the cheaper AABB path when the node's *world*
|
|
39
|
+
* box is axis-aligned (its own and any inherited rotation compose to a multiple
|
|
40
|
+
* of 90° with no skew) and the oriented-quad SAT path otherwise. The public
|
|
41
|
+
* `isAlignedBox` getter reports that predicate for this node's own rotation only.
|
|
42
42
|
*
|
|
43
43
|
* `_invalidate*` methods are exported as `public` for friend-class access
|
|
44
44
|
* from {@link Container} and {@link InteractionManager}; treat them as
|
|
@@ -69,6 +69,9 @@ export declare class SceneNode implements Collidable, ObservableVectorOwner {
|
|
|
69
69
|
private _parentNode;
|
|
70
70
|
private _zIndex;
|
|
71
71
|
private _cullable;
|
|
72
|
+
private _cullArea;
|
|
73
|
+
/** Lazily-built oriented bounding box (the local bounds under the global transform) for rotated-node SAT. */
|
|
74
|
+
private _orientedBounds;
|
|
72
75
|
/**
|
|
73
76
|
* Optional human-readable identity for this node. Defaults to `null`.
|
|
74
77
|
*
|
|
@@ -104,8 +107,19 @@ export declare class SceneNode implements Collidable, ObservableVectorOwner {
|
|
|
104
107
|
set visible(visible: boolean);
|
|
105
108
|
get zIndex(): number;
|
|
106
109
|
set zIndex(zIndex: number);
|
|
110
|
+
/**
|
|
111
|
+
* When `false`, this node is never culled by the viewport check and is
|
|
112
|
+
* always considered in-view. Defaults to `true`.
|
|
113
|
+
*/
|
|
107
114
|
get cullable(): boolean;
|
|
108
115
|
set cullable(cullable: boolean);
|
|
116
|
+
/**
|
|
117
|
+
* Custom rectangle used for viewport cull intersection test.
|
|
118
|
+
* When set, replaces the default node bounds in cull checks.
|
|
119
|
+
* Set to `null` to restore default bounds-based culling.
|
|
120
|
+
*/
|
|
121
|
+
get cullArea(): Rectangle | null;
|
|
122
|
+
set cullArea(rect: Rectangle | null);
|
|
109
123
|
/**
|
|
110
124
|
* Horizontal skew angle in degrees. Shears the node along the X axis
|
|
111
125
|
* (positive values lean the top edge right). Combines correctly with
|
|
@@ -138,12 +152,28 @@ export declare class SceneNode implements Collidable, ObservableVectorOwner {
|
|
|
138
152
|
getGlobalTransform(): Matrix;
|
|
139
153
|
getNormals(): Vector[];
|
|
140
154
|
project(axis: Vector, result?: Interval): Interval;
|
|
155
|
+
/**
|
|
156
|
+
* The node's oriented bounding box: the four local-bounds corners under the
|
|
157
|
+
* global transform, as a {@link Polygon}. Used by the SAT collision path so a
|
|
158
|
+
* rotated node tests its true oriented axes instead of the loose AABB. Built
|
|
159
|
+
* lazily and refreshed in place; only ever reached for non-axis-aligned nodes.
|
|
160
|
+
*/
|
|
161
|
+
private _orientedBoundsPolygon;
|
|
162
|
+
/**
|
|
163
|
+
* Whether the node's *world* box is axis-aligned — its own and every inherited
|
|
164
|
+
* rotation/skew compose to a transform that maps axes to axes (a multiple of
|
|
165
|
+
* 90°, no shear). When true the AABB equals the oriented box, so the cheaper
|
|
166
|
+
* AABB collision/hit-test path is exact; otherwise the oriented-quad SAT path
|
|
167
|
+
* is used. Unlike {@link isAlignedBox} (this node's own rotation only), this
|
|
168
|
+
* accounts for a rotated ancestor.
|
|
169
|
+
*/
|
|
170
|
+
private _isWorldAligned;
|
|
141
171
|
intersectsWith(target: Collidable): boolean;
|
|
142
172
|
collidesWith(target: Collidable): CollisionResponse | null;
|
|
143
173
|
/**
|
|
144
174
|
* Hit-test the world-space point `(x, y)` against this node.
|
|
145
175
|
*
|
|
146
|
-
* For axis-aligned nodes (
|
|
176
|
+
* For world-axis-aligned nodes (own and inherited rotation a multiple of 90°
|
|
147
177
|
* and no skew) the AABB equals the oriented box, so the cheap
|
|
148
178
|
* {@link getBounds} test is exact. For rotated or skewed nodes the point is
|
|
149
179
|
* mapped back into local space with the inverse of the global transform and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNode.d.ts","sourceRoot":"","sources":["../../../src/core/SceneNode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC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ACtE,wBAAwB,IAAI,IAAI;IAmBvC,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,aAAa;CAMtB"}
|
|
@@ -4,8 +4,10 @@ import { Flags } from '../math/Flags.js';
|
|
|
4
4
|
import { Interval } from '../math/Interval.js';
|
|
5
5
|
import { Matrix } from '../math/Matrix.js';
|
|
6
6
|
import { ObservableVector } from '../math/ObservableVector.js';
|
|
7
|
+
import { Polygon } from '../math/Polygon.js';
|
|
7
8
|
import { Rectangle } from '../math/Rectangle.js';
|
|
8
9
|
import { degreesToRadians, trimRotation } from '../math/utils.js';
|
|
10
|
+
import { Vector } from '../math/Vector.js';
|
|
9
11
|
import { Bounds } from './Bounds.js';
|
|
10
12
|
|
|
11
13
|
// Internal: dirty-flag bits used by SceneNode's transform cache.
|
|
@@ -35,6 +37,8 @@ var SceneNodeVectorChannel;
|
|
|
35
37
|
SceneNodeVectorChannel[SceneNodeVectorChannel["Origin"] = 2] = "Origin";
|
|
36
38
|
SceneNodeVectorChannel[SceneNodeVectorChannel["Anchor"] = 3] = "Anchor";
|
|
37
39
|
})(SceneNodeVectorChannel || (SceneNodeVectorChannel = {}));
|
|
40
|
+
/** Shared scratch for the four oriented corners — written then copied into a node's polygon (single-threaded). */
|
|
41
|
+
const orientedCorners = [new Vector(), new Vector(), new Vector(), new Vector()];
|
|
38
42
|
/**
|
|
39
43
|
* Transform-bearing leaf in the scene-graph hierarchy. Carries position,
|
|
40
44
|
* rotation, scale, skew, origin, and a 2-component {@link Vector} `anchor`
|
|
@@ -48,10 +52,10 @@ var SceneNodeVectorChannel;
|
|
|
48
52
|
* for this node and every {@link Container} ancestor up the parent chain.
|
|
49
53
|
* The caches rebuild lazily on the next read.
|
|
50
54
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
+
* Collision and hit-testing take the cheaper AABB path when the node's *world*
|
|
56
|
+
* box is axis-aligned (its own and any inherited rotation compose to a multiple
|
|
57
|
+
* of 90° with no skew) and the oriented-quad SAT path otherwise. The public
|
|
58
|
+
* `isAlignedBox` getter reports that predicate for this node's own rotation only.
|
|
55
59
|
*
|
|
56
60
|
* `_invalidate*` methods are exported as `public` for friend-class access
|
|
57
61
|
* from {@link Container} and {@link InteractionManager}; treat them as
|
|
@@ -82,6 +86,9 @@ class SceneNode {
|
|
|
82
86
|
_parentNode = null;
|
|
83
87
|
_zIndex = 0;
|
|
84
88
|
_cullable = true;
|
|
89
|
+
_cullArea = null;
|
|
90
|
+
/** Lazily-built oriented bounding box (the local bounds under the global transform) for rotated-node SAT. */
|
|
91
|
+
_orientedBounds = null;
|
|
85
92
|
/**
|
|
86
93
|
* Optional human-readable identity for this node. Defaults to `null`.
|
|
87
94
|
*
|
|
@@ -159,12 +166,27 @@ class SceneNode {
|
|
|
159
166
|
this._zIndex = zIndex;
|
|
160
167
|
}
|
|
161
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* When `false`, this node is never culled by the viewport check and is
|
|
171
|
+
* always considered in-view. Defaults to `true`.
|
|
172
|
+
*/
|
|
162
173
|
get cullable() {
|
|
163
174
|
return this._cullable;
|
|
164
175
|
}
|
|
165
176
|
set cullable(cullable) {
|
|
166
177
|
this._cullable = cullable;
|
|
167
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Custom rectangle used for viewport cull intersection test.
|
|
181
|
+
* When set, replaces the default node bounds in cull checks.
|
|
182
|
+
* Set to `null` to restore default bounds-based culling.
|
|
183
|
+
*/
|
|
184
|
+
get cullArea() {
|
|
185
|
+
return this._cullArea;
|
|
186
|
+
}
|
|
187
|
+
set cullArea(rect) {
|
|
188
|
+
this._cullArea = rect;
|
|
189
|
+
}
|
|
168
190
|
/**
|
|
169
191
|
* Horizontal skew angle in degrees. Shears the node along the X axis
|
|
170
192
|
* (positive values lean the top edge right). Combines correctly with
|
|
@@ -304,13 +326,41 @@ class SceneNode {
|
|
|
304
326
|
return this._globalTransform;
|
|
305
327
|
}
|
|
306
328
|
getNormals() {
|
|
307
|
-
return this.getBounds().getNormals();
|
|
329
|
+
return this._isWorldAligned() ? this.getBounds().getNormals() : this._orientedBoundsPolygon().getNormals();
|
|
308
330
|
}
|
|
309
331
|
project(axis, result = new Interval()) {
|
|
310
|
-
return this.getBounds().project(axis, result);
|
|
332
|
+
return this._isWorldAligned() ? this.getBounds().project(axis, result) : this._orientedBoundsPolygon().project(axis, result);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* The node's oriented bounding box: the four local-bounds corners under the
|
|
336
|
+
* global transform, as a {@link Polygon}. Used by the SAT collision path so a
|
|
337
|
+
* rotated node tests its true oriented axes instead of the loose AABB. Built
|
|
338
|
+
* lazily and refreshed in place; only ever reached for non-axis-aligned nodes.
|
|
339
|
+
*/
|
|
340
|
+
_orientedBoundsPolygon() {
|
|
341
|
+
const bounds = this.getLocalBounds();
|
|
342
|
+
const matrix = this.getGlobalTransform();
|
|
343
|
+
orientedCorners[0].set(bounds.left, bounds.top).transform(matrix);
|
|
344
|
+
orientedCorners[1].set(bounds.right, bounds.top).transform(matrix);
|
|
345
|
+
orientedCorners[2].set(bounds.right, bounds.bottom).transform(matrix);
|
|
346
|
+
orientedCorners[3].set(bounds.left, bounds.bottom).transform(matrix);
|
|
347
|
+
return (this._orientedBounds ??= new Polygon()).setPoints(orientedCorners);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Whether the node's *world* box is axis-aligned — its own and every inherited
|
|
351
|
+
* rotation/skew compose to a transform that maps axes to axes (a multiple of
|
|
352
|
+
* 90°, no shear). When true the AABB equals the oriented box, so the cheaper
|
|
353
|
+
* AABB collision/hit-test path is exact; otherwise the oriented-quad SAT path
|
|
354
|
+
* is used. Unlike {@link isAlignedBox} (this node's own rotation only), this
|
|
355
|
+
* accounts for a rotated ancestor.
|
|
356
|
+
*/
|
|
357
|
+
_isWorldAligned() {
|
|
358
|
+
const matrix = this.getGlobalTransform();
|
|
359
|
+
const epsilon = 1e-9;
|
|
360
|
+
return (Math.abs(matrix.b) < epsilon && Math.abs(matrix.c) < epsilon) || (Math.abs(matrix.a) < epsilon && Math.abs(matrix.d) < epsilon);
|
|
311
361
|
}
|
|
312
362
|
intersectsWith(target) {
|
|
313
|
-
if (this.
|
|
363
|
+
if (this._isWorldAligned()) {
|
|
314
364
|
return this.getBounds().intersectsWith(target);
|
|
315
365
|
}
|
|
316
366
|
switch (target.collisionType) {
|
|
@@ -333,7 +383,7 @@ class SceneNode {
|
|
|
333
383
|
}
|
|
334
384
|
}
|
|
335
385
|
collidesWith(target) {
|
|
336
|
-
if (this.
|
|
386
|
+
if (this._isWorldAligned()) {
|
|
337
387
|
return this.getBounds().collidesWith(target);
|
|
338
388
|
}
|
|
339
389
|
switch (target.collisionType) {
|
|
@@ -352,7 +402,7 @@ class SceneNode {
|
|
|
352
402
|
/**
|
|
353
403
|
* Hit-test the world-space point `(x, y)` against this node.
|
|
354
404
|
*
|
|
355
|
-
* For axis-aligned nodes (
|
|
405
|
+
* For world-axis-aligned nodes (own and inherited rotation a multiple of 90°
|
|
356
406
|
* and no skew) the AABB equals the oriented box, so the cheap
|
|
357
407
|
* {@link getBounds} test is exact. For rotated or skewed nodes the point is
|
|
358
408
|
* mapped back into local space with the inverse of the global transform and
|
|
@@ -363,7 +413,7 @@ class SceneNode {
|
|
|
363
413
|
* empty AABB corners of a rotated node.
|
|
364
414
|
*/
|
|
365
415
|
contains(x, y) {
|
|
366
|
-
if (this.
|
|
416
|
+
if (this._isWorldAligned()) {
|
|
367
417
|
return this.getBounds().contains(x, y);
|
|
368
418
|
}
|
|
369
419
|
const matrix = this.getGlobalTransform();
|
|
@@ -384,7 +434,8 @@ class SceneNode {
|
|
|
384
434
|
if (!this._cullable) {
|
|
385
435
|
return true;
|
|
386
436
|
}
|
|
387
|
-
|
|
437
|
+
const bounds = this._cullArea ?? this.getBounds();
|
|
438
|
+
return view.getBounds().intersectsWith(bounds);
|
|
388
439
|
}
|
|
389
440
|
destroy() {
|
|
390
441
|
this._transform.destroy();
|
|
@@ -396,6 +447,7 @@ class SceneNode {
|
|
|
396
447
|
this._localBounds.destroy();
|
|
397
448
|
this._bounds.destroy();
|
|
398
449
|
this._anchor.destroy();
|
|
450
|
+
this._orientedBounds?.destroy();
|
|
399
451
|
}
|
|
400
452
|
/**
|
|
401
453
|
* Set this node's owning {@link Stage} (the per-Application service bundle).
|