mage-engine 3.25.1 → 3.25.3
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/.claude/worktrees/fix-onstart-error-handling/.github/workflows/test.yml +29 -0
- package/.claude/worktrees/fix-onstart-error-handling/.nvmrc +1 -0
- package/.claude/worktrees/fix-onstart-error-handling/.prettierrc.js +20 -0
- package/.claude/worktrees/fix-onstart-error-handling/LICENSE +35 -0
- package/.claude/worktrees/fix-onstart-error-handling/README.md +56 -0
- package/.claude/worktrees/fix-onstart-error-handling/__mocks__/three.js +178 -0
- package/.claude/worktrees/fix-onstart-error-handling/dist/ammo.js +991 -0
- package/.claude/worktrees/fix-onstart-error-handling/eslint.config.js +73 -0
- package/.claude/worktrees/fix-onstart-error-handling/jest.config.js +31 -0
- package/.claude/worktrees/fix-onstart-error-handling/package.json +96 -0
- package/dist/mage.js +40 -12
- package/package.json +1 -1
|
@@ -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 @@
|
|
|
1
|
+
14.19.3
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
printWidth: 100,
|
|
5
|
+
trailingComma: "all",
|
|
6
|
+
arrowParens: "avoid",
|
|
7
|
+
semi: true,
|
|
8
|
+
tabWidth: 4,
|
|
9
|
+
|
|
10
|
+
overrides: [
|
|
11
|
+
{
|
|
12
|
+
files: ["*.md"],
|
|
13
|
+
options: { printWidth: 120 },
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
files: [".toolsharerc"],
|
|
17
|
+
options: { parser: "yaml" },
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Copyright (c) 2015 - 2018 by Marco Stagni and contributors.
|
|
2
|
+
|
|
3
|
+
Some rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are
|
|
7
|
+
met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* The names of the contributors may not be used to endorse or
|
|
18
|
+
promote products derived from this software without specific
|
|
19
|
+
prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
22
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
24
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
25
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Mage contains third party software in the 'app/vendor' directory: each
|
|
35
|
+
file/module in this directory is distributed under its original license.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Mage
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Mage is a game engine built on top of THREEJS. It features all you need to create fully interactive 3D application that can be distributed via web, desktop or mobile.
|
|
12
|
+
|
|
13
|
+
[Documentation](https://www.mage.studio/docs)
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
The engine is under heavy development. The best way to stay up to date with changes, new features and bug fixes is to [join the Discord server](https://discord.gg/NR5ZDGFG5j).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Licence
|
|
21
|
+
|
|
22
|
+
Copyright (c) 2015 - 2018 by Marco Stagni and contributors.
|
|
23
|
+
|
|
24
|
+
Some rights reserved.
|
|
25
|
+
|
|
26
|
+
Redistribution and use in source and binary forms, with or without
|
|
27
|
+
modification, are permitted provided that the following conditions are
|
|
28
|
+
met:
|
|
29
|
+
|
|
30
|
+
* Redistributions of source code must retain the above copyright
|
|
31
|
+
notice, this list of conditions and the following disclaimer.
|
|
32
|
+
|
|
33
|
+
* Redistributions in binary form must reproduce the above
|
|
34
|
+
copyright notice, this list of conditions and the following
|
|
35
|
+
disclaimer in the documentation and/or other materials provided
|
|
36
|
+
with the distribution.
|
|
37
|
+
|
|
38
|
+
* The names of the contributors may not be used to endorse or
|
|
39
|
+
promote products derived from this software without specific
|
|
40
|
+
prior written permission.
|
|
41
|
+
|
|
42
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
43
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
44
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
45
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
46
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
47
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
48
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
49
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
50
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
51
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
52
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Mage contains third party software in the 'app/vendor' directory: each
|
|
56
|
+
file/module in this directory is distributed under its original license.
|
|
@@ -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
|
+
};
|