mage-engine 3.24.4 → 3.24.6
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/.github/workflows/test.yml +29 -0
- package/__mocks__/three.js +178 -0
- package/coverage/clover.xml +3094 -0
- package/coverage/coverage-final.json +60 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/entities/Element.js.html +3463 -0
- package/coverage/lcov-report/entities/Entity.js.html +2740 -0
- package/coverage/lcov-report/entities/animations/AnimationHandler.js.html +1006 -0
- package/coverage/lcov-report/entities/animations/SpriteAnimationHandler.js.html +91 -0
- package/coverage/lcov-report/entities/animations/index.html +131 -0
- package/coverage/lcov-report/entities/animations/lib/NodeFrame.js.html +214 -0
- package/coverage/lcov-report/entities/animations/lib/index.html +116 -0
- package/coverage/lcov-report/entities/base/AnimatedSprite.js.html +220 -0
- package/coverage/lcov-report/entities/base/Axes.js.html +316 -0
- package/coverage/lcov-report/entities/base/Box.js.html +253 -0
- package/coverage/lcov-report/entities/base/Cone.js.html +304 -0
- package/coverage/lcov-report/entities/base/Cube.js.html +217 -0
- package/coverage/lcov-report/entities/base/CurveLine.js.html +166 -0
- package/coverage/lcov-report/entities/base/Cylinder.js.html +259 -0
- package/coverage/lcov-report/entities/base/Grid.js.html +190 -0
- package/coverage/lcov-report/entities/base/HelperSprite.js.html +163 -0
- package/coverage/lcov-report/entities/base/Label.js.html +373 -0
- package/coverage/lcov-report/entities/base/Line.js.html +334 -0
- package/coverage/lcov-report/entities/base/Plane.js.html +265 -0
- package/coverage/lcov-report/entities/base/Sphere.js.html +217 -0
- package/coverage/lcov-report/entities/base/Sprite.js.html +445 -0
- package/coverage/lcov-report/entities/base/index.html +326 -0
- package/coverage/lcov-report/entities/base/index.js.html +172 -0
- package/coverage/lcov-report/entities/camera.js.html +751 -0
- package/coverage/lcov-report/entities/constants.js.html +655 -0
- package/coverage/lcov-report/entities/index.html +176 -0
- package/coverage/lcov-report/entities/index.js.html +187 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/images/Images.js.html +724 -0
- package/coverage/lcov-report/images/index.html +116 -0
- package/coverage/lcov-report/index.html +266 -0
- package/coverage/lcov-report/lib/Color.js.html +187 -0
- package/coverage/lcov-report/lib/array.js.html +97 -0
- package/coverage/lcov-report/lib/colliders.js.html +217 -0
- package/coverage/lcov-report/lib/constants.js.html +1171 -0
- package/coverage/lcov-report/lib/dom.js.html +202 -0
- package/coverage/lcov-report/lib/easing.js.html +229 -0
- package/coverage/lcov-report/lib/features.js.html +826 -0
- package/coverage/lcov-report/lib/functions.js.html +130 -0
- package/coverage/lcov-report/lib/index.html +401 -0
- package/coverage/lcov-report/lib/location.js.html +127 -0
- package/coverage/lcov-report/lib/map.js.html +172 -0
- package/coverage/lcov-report/lib/math.js.html +511 -0
- package/coverage/lcov-report/lib/meshUtils.js.html +685 -0
- package/coverage/lcov-report/lib/messages.js.html +415 -0
- package/coverage/lcov-report/lib/network.js.html +136 -0
- package/coverage/lcov-report/lib/object.js.html +187 -0
- package/coverage/lcov-report/lib/palettes.js.html +259 -0
- package/coverage/lcov-report/lib/query.js.html +172 -0
- package/coverage/lcov-report/lib/strings.js.html +139 -0
- package/coverage/lcov-report/lib/url.js.html +85 -0
- package/coverage/lcov-report/lib/utils/assets.js.html +94 -0
- package/coverage/lcov-report/lib/utils/index.html +116 -0
- package/coverage/lcov-report/lib/uuid.js.html +112 -0
- package/coverage/lcov-report/models/Models.js.html +1489 -0
- package/coverage/lcov-report/models/SkeletonUtils.js.html +1879 -0
- package/coverage/lcov-report/models/index.html +131 -0
- package/coverage/lcov-report/physics/constants.js.html +307 -0
- package/coverage/lcov-report/physics/hitbox.js.html +235 -0
- package/coverage/lcov-report/physics/index.html +176 -0
- package/coverage/lcov-report/physics/index.js.html +1324 -0
- package/coverage/lcov-report/physics/messages.js.html +238 -0
- package/coverage/lcov-report/physics/utils.js.html +679 -0
- package/coverage/lcov-report/physics/worker/effects.js.html +325 -0
- package/coverage/lcov-report/physics/worker/elements.js.html +694 -0
- package/coverage/lcov-report/physics/worker/index.html +176 -0
- package/coverage/lcov-report/physics/worker/lib/dispatcher.js.html +160 -0
- package/coverage/lcov-report/physics/worker/lib/index.html +131 -0
- package/coverage/lcov-report/physics/worker/lib/math.js.html +109 -0
- package/coverage/lcov-report/physics/worker/player.js.html +301 -0
- package/coverage/lcov-report/physics/worker/vehicles.js.html +832 -0
- package/coverage/lcov-report/physics/worker/world.js.html +796 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +6368 -0
- package/dist/mage.js +8012 -9023
- package/eslint.config.js +73 -0
- package/jest.config.js +31 -0
- package/package.json +17 -5
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [master, main]
|
|
6
|
+
push:
|
|
7
|
+
branches: [master, main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Use Node.js 20
|
|
17
|
+
uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version: 20
|
|
20
|
+
cache: npm
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm ci
|
|
24
|
+
|
|
25
|
+
- name: Lint
|
|
26
|
+
run: npm run lint
|
|
27
|
+
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: npm test
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Lightweight mock of THREE.js for unit tests.
|
|
2
|
+
// Only stubs the APIs actually used by src/lib/ modules.
|
|
3
|
+
// Grow this file incrementally as more tests need additional THREE APIs.
|
|
4
|
+
|
|
5
|
+
class Vector3 {
|
|
6
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
7
|
+
this.x = x;
|
|
8
|
+
this.y = y;
|
|
9
|
+
this.z = z;
|
|
10
|
+
}
|
|
11
|
+
set(x, y, z) { this.x = x; this.y = y; this.z = z; return this; }
|
|
12
|
+
clone() { return new Vector3(this.x, this.y, this.z); }
|
|
13
|
+
add(v) { this.x += v.x; this.y += v.y; this.z += v.z; return this; }
|
|
14
|
+
sub(v) { this.x -= v.x; this.y -= v.y; this.z -= v.z; return this; }
|
|
15
|
+
normalize() {
|
|
16
|
+
const len = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
17
|
+
if (len > 0) { this.x /= len; this.y /= len; this.z /= len; }
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
multiplyScalar(s) { this.x *= s; this.y *= s; this.z *= s; return this; }
|
|
21
|
+
lerp(v, t) {
|
|
22
|
+
this.x += (v.x - this.x) * t;
|
|
23
|
+
this.y += (v.y - this.y) * t;
|
|
24
|
+
this.z += (v.z - this.z) * t;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class Vector2 {
|
|
30
|
+
constructor(x = 0, y = 0) {
|
|
31
|
+
this.x = x;
|
|
32
|
+
this.y = y;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const MathUtils = {
|
|
37
|
+
lerp: (x, y, t) => x + (y - x) * t,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
class Color {
|
|
41
|
+
constructor(color) {
|
|
42
|
+
this.value = color;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
class AnimationMixer {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.time = 0;
|
|
49
|
+
}
|
|
50
|
+
clipAction() {
|
|
51
|
+
return {
|
|
52
|
+
reset: function() { return this; },
|
|
53
|
+
setLoop: function() { return this; },
|
|
54
|
+
setEffectiveTimeScale: function() { return this; },
|
|
55
|
+
setEffectiveWeight: function() { return this; },
|
|
56
|
+
play: function() {},
|
|
57
|
+
stop: function() {},
|
|
58
|
+
fadeIn: function() { return this; },
|
|
59
|
+
fadeOut: function() { return this; },
|
|
60
|
+
isRunning: function() { return false; },
|
|
61
|
+
time: 0,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
stopAllAction() {}
|
|
65
|
+
addEventListener() {}
|
|
66
|
+
update() {}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
class AnimationClip {
|
|
70
|
+
static findByName(clips, name) {
|
|
71
|
+
return clips.find(c => c.name === name);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
class EventDispatcher {
|
|
76
|
+
constructor() {
|
|
77
|
+
this._listeners = {};
|
|
78
|
+
}
|
|
79
|
+
addEventListener(type, listener) {
|
|
80
|
+
if (!this._listeners[type]) this._listeners[type] = [];
|
|
81
|
+
this._listeners[type].push(listener);
|
|
82
|
+
}
|
|
83
|
+
removeEventListener(type, listener) {
|
|
84
|
+
if (this._listeners[type]) {
|
|
85
|
+
this._listeners[type] = this._listeners[type].filter(l => l !== listener);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
dispatchEvent(event) {
|
|
89
|
+
if (this._listeners[event.type]) {
|
|
90
|
+
this._listeners[event.type].forEach(l => l(event));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
class Quaternion {
|
|
96
|
+
constructor(x = 0, y = 0, z = 0, w = 1) {
|
|
97
|
+
this.x = x; this.y = y; this.z = z; this.w = w;
|
|
98
|
+
}
|
|
99
|
+
identity() { this.x = 0; this.y = 0; this.z = 0; this.w = 1; return this; }
|
|
100
|
+
copy(q) { this.x = q.x; this.y = q.y; this.z = q.z; this.w = q.w; return this; }
|
|
101
|
+
clone() { return new Quaternion(this.x, this.y, this.z, this.w); }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
class Euler {
|
|
105
|
+
constructor(x = 0, y = 0, z = 0, order = "XYZ") {
|
|
106
|
+
this.x = x; this.y = y; this.z = z; this.order = order;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
class Matrix4 {
|
|
111
|
+
constructor() {
|
|
112
|
+
this.elements = [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1];
|
|
113
|
+
}
|
|
114
|
+
identity() { this.elements = [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]; return this; }
|
|
115
|
+
getInverse() { return this; }
|
|
116
|
+
multiplyMatrices() { return this; }
|
|
117
|
+
setFromMatrixScale() { return this; }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Material stubs
|
|
121
|
+
class MeshBasicMaterial { constructor(opts) { Object.assign(this, opts); } }
|
|
122
|
+
class MeshLambertMaterial { constructor(opts) { Object.assign(this, opts); } }
|
|
123
|
+
class MeshPhongMaterial { constructor(opts) { Object.assign(this, opts); } }
|
|
124
|
+
class MeshDepthMaterial { constructor(opts) { Object.assign(this, opts); } }
|
|
125
|
+
class MeshStandardMaterial { constructor(opts) { Object.assign(this, opts); } }
|
|
126
|
+
class MeshToonMaterial { constructor(opts) { Object.assign(this, opts); } }
|
|
127
|
+
|
|
128
|
+
// Encoding constants
|
|
129
|
+
const LinearEncoding = 3000;
|
|
130
|
+
const sRGBEncoding = 3001;
|
|
131
|
+
const GammaEncoding = 3007;
|
|
132
|
+
const RGBEEncoding = 3002;
|
|
133
|
+
const RGBM7Encoding = 3004;
|
|
134
|
+
const RGBM16Encoding = 3005;
|
|
135
|
+
const RGBDEncoding = 3006;
|
|
136
|
+
const BasicDepthPacking = 3200;
|
|
137
|
+
const RGBADepthPacking = 3201;
|
|
138
|
+
|
|
139
|
+
// Side constants
|
|
140
|
+
const FrontSide = 0;
|
|
141
|
+
const BackSide = 1;
|
|
142
|
+
const DoubleSide = 2;
|
|
143
|
+
|
|
144
|
+
const LoopRepeat = 2201;
|
|
145
|
+
const LoopOnce = 2200;
|
|
146
|
+
|
|
147
|
+
module.exports = {
|
|
148
|
+
Vector3,
|
|
149
|
+
Vector2,
|
|
150
|
+
Quaternion,
|
|
151
|
+
Euler,
|
|
152
|
+
Matrix4,
|
|
153
|
+
MathUtils,
|
|
154
|
+
Color,
|
|
155
|
+
AnimationMixer,
|
|
156
|
+
AnimationClip,
|
|
157
|
+
EventDispatcher,
|
|
158
|
+
MeshBasicMaterial,
|
|
159
|
+
MeshLambertMaterial,
|
|
160
|
+
MeshPhongMaterial,
|
|
161
|
+
MeshDepthMaterial,
|
|
162
|
+
MeshStandardMaterial,
|
|
163
|
+
MeshToonMaterial,
|
|
164
|
+
LinearEncoding,
|
|
165
|
+
sRGBEncoding,
|
|
166
|
+
GammaEncoding,
|
|
167
|
+
RGBEEncoding,
|
|
168
|
+
RGBM7Encoding,
|
|
169
|
+
RGBM16Encoding,
|
|
170
|
+
RGBDEncoding,
|
|
171
|
+
BasicDepthPacking,
|
|
172
|
+
RGBADepthPacking,
|
|
173
|
+
FrontSide,
|
|
174
|
+
BackSide,
|
|
175
|
+
DoubleSide,
|
|
176
|
+
LoopRepeat,
|
|
177
|
+
LoopOnce,
|
|
178
|
+
};
|