@mavonengine/editor 0.0.9 → 0.0.11
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/dist/Editor/Network/NetworkOverlay.d.ts +54 -0
- package/dist/Editor/Network/SyncStore.d.ts +22 -0
- package/dist/Editor/Network/serverApi.d.ts +14 -0
- package/dist/Editor/Plugins/pluginsApi.d.ts +49 -0
- package/dist/Editor/Server/routesApi.d.ts +23 -0
- package/dist/Editor/UI/ActivityBar.d.ts +6 -1
- package/dist/Editor/UI/Network/NetworkPanel.d.ts +5 -0
- package/dist/Editor/UI/Network/Timeline.d.ts +14 -0
- package/dist/Editor/UI/Network/format.d.ts +14 -0
- package/dist/Editor/UI/Network/useRecords.d.ts +13 -0
- package/dist/Editor/UI/Plugins/InstallDialog.d.ts +22 -0
- package/dist/Editor/UI/Plugins/Markdown.d.ts +3 -0
- package/dist/Editor/UI/Plugins/PluginsPanel.d.ts +8 -0
- package/dist/Editor/UI/Server/ServerPanel.d.ts +9 -0
- package/dist/Editor.css +1 -1
- package/dist/Editor.d.ts +3 -0
- package/dist/Editor.mjs +226 -1449
- package/dist/{global-l94NfB94.mjs → global-CRVwkYpo.mjs} +2 -5
- package/dist/mount-DAt7SAfm.mjs +15421 -0
- package/dist/panels-DFsnKBKK.mjs +75 -0
- package/package.json +1 -1
- package/dist/mount-CnirMLg0.mjs +0 -35603
- package/dist/panels-BqmX3eap.mjs +0 -45
package/dist/Editor.mjs
CHANGED
|
@@ -1,1401 +1,17 @@
|
|
|
1
|
-
import { a as e,
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { SCENE_SAVE_PATH as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
super(e, t), this.movementSpeed = 1, this.rollSpeed = .005, this.dragToLook = !1, this.autoForward = !1, this._moveState = {
|
|
13
|
-
up: 0,
|
|
14
|
-
down: 0,
|
|
15
|
-
left: 0,
|
|
16
|
-
right: 0,
|
|
17
|
-
forward: 0,
|
|
18
|
-
back: 0,
|
|
19
|
-
pitchUp: 0,
|
|
20
|
-
pitchDown: 0,
|
|
21
|
-
yawLeft: 0,
|
|
22
|
-
yawRight: 0,
|
|
23
|
-
rollLeft: 0,
|
|
24
|
-
rollRight: 0
|
|
25
|
-
}, this._moveVector = new A(0, 0, 0), this._rotationVector = new A(0, 0, 0), this._lastQuaternion = new E(), this._lastPosition = new A(), this._status = 0, this._onKeyDown = ue.bind(this), this._onKeyUp = de.bind(this), this._onPointerMove = pe.bind(this), this._onPointerDown = fe.bind(this), this._onPointerUp = me.bind(this), this._onPointerCancel = he.bind(this), this._onContextMenu = ge.bind(this), t !== null && this.connect(t);
|
|
26
|
-
}
|
|
27
|
-
connect(e) {
|
|
28
|
-
super.connect(e), window.addEventListener("keydown", this._onKeyDown), window.addEventListener("keyup", this._onKeyUp), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.addEventListener("pointercancel", this._onPointerCancel), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.style.touchAction = "none";
|
|
29
|
-
}
|
|
30
|
-
disconnect() {
|
|
31
|
-
window.removeEventListener("keydown", this._onKeyDown), window.removeEventListener("keyup", this._onKeyUp), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerCancel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.domElement.style.touchAction = "";
|
|
32
|
-
}
|
|
33
|
-
dispose() {
|
|
34
|
-
this.disconnect();
|
|
35
|
-
}
|
|
36
|
-
update(e) {
|
|
37
|
-
if (this.enabled === !1) return;
|
|
38
|
-
let t = this.object, n = e * this.movementSpeed, r = e * this.rollSpeed;
|
|
39
|
-
t.translateX(this._moveVector.x * n), t.translateY(this._moveVector.y * n), t.translateZ(this._moveVector.z * n), ce.set(this._rotationVector.x * r, this._rotationVector.y * r, this._rotationVector.z * r, 1).normalize(), t.quaternion.multiply(ce), (this._lastPosition.distanceToSquared(t.position) > se || 8 * (1 - this._lastQuaternion.dot(t.quaternion)) > se) && (this.dispatchEvent(P), this._lastQuaternion.copy(t.quaternion), this._lastPosition.copy(t.position));
|
|
40
|
-
}
|
|
41
|
-
_updateMovementVector() {
|
|
42
|
-
let e = this._moveState.forward || this.autoForward && !this._moveState.back ? 1 : 0;
|
|
43
|
-
this._moveVector.x = -this._moveState.left + this._moveState.right, this._moveVector.y = -this._moveState.down + this._moveState.up, this._moveVector.z = -e + this._moveState.back;
|
|
44
|
-
}
|
|
45
|
-
_updateRotationVector() {
|
|
46
|
-
this._rotationVector.x = -this._moveState.pitchDown + this._moveState.pitchUp, this._rotationVector.y = -this._moveState.yawRight + this._moveState.yawLeft, this._rotationVector.z = -this._moveState.rollRight + this._moveState.rollLeft;
|
|
47
|
-
}
|
|
48
|
-
_getContainerDimensions() {
|
|
49
|
-
return this.domElement == document ? {
|
|
50
|
-
size: [window.innerWidth, window.innerHeight],
|
|
51
|
-
offset: [0, 0]
|
|
52
|
-
} : {
|
|
53
|
-
size: [this.domElement.offsetWidth, this.domElement.offsetHeight],
|
|
54
|
-
offset: [this.domElement.offsetLeft, this.domElement.offsetTop]
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
function ue(e) {
|
|
59
|
-
if (!(e.altKey || this.enabled === !1)) {
|
|
60
|
-
switch (e.code) {
|
|
61
|
-
case "ShiftLeft":
|
|
62
|
-
case "ShiftRight":
|
|
63
|
-
this.movementSpeedMultiplier = .1;
|
|
64
|
-
break;
|
|
65
|
-
case "KeyW":
|
|
66
|
-
this._moveState.forward = 1;
|
|
67
|
-
break;
|
|
68
|
-
case "KeyS":
|
|
69
|
-
this._moveState.back = 1;
|
|
70
|
-
break;
|
|
71
|
-
case "KeyA":
|
|
72
|
-
this._moveState.left = 1;
|
|
73
|
-
break;
|
|
74
|
-
case "KeyD":
|
|
75
|
-
this._moveState.right = 1;
|
|
76
|
-
break;
|
|
77
|
-
case "KeyR":
|
|
78
|
-
this._moveState.up = 1;
|
|
79
|
-
break;
|
|
80
|
-
case "KeyF":
|
|
81
|
-
this._moveState.down = 1;
|
|
82
|
-
break;
|
|
83
|
-
case "ArrowUp":
|
|
84
|
-
this._moveState.pitchUp = 1;
|
|
85
|
-
break;
|
|
86
|
-
case "ArrowDown":
|
|
87
|
-
this._moveState.pitchDown = 1;
|
|
88
|
-
break;
|
|
89
|
-
case "ArrowLeft":
|
|
90
|
-
this._moveState.yawLeft = 1;
|
|
91
|
-
break;
|
|
92
|
-
case "ArrowRight":
|
|
93
|
-
this._moveState.yawRight = 1;
|
|
94
|
-
break;
|
|
95
|
-
case "KeyQ":
|
|
96
|
-
this._moveState.rollLeft = 1;
|
|
97
|
-
break;
|
|
98
|
-
case "KeyE": this._moveState.rollRight = 1;
|
|
99
|
-
}
|
|
100
|
-
this._updateMovementVector(), this._updateRotationVector();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function de(e) {
|
|
104
|
-
if (this.enabled !== !1) {
|
|
105
|
-
switch (e.code) {
|
|
106
|
-
case "ShiftLeft":
|
|
107
|
-
case "ShiftRight":
|
|
108
|
-
this.movementSpeedMultiplier = 1;
|
|
109
|
-
break;
|
|
110
|
-
case "KeyW":
|
|
111
|
-
this._moveState.forward = 0;
|
|
112
|
-
break;
|
|
113
|
-
case "KeyS":
|
|
114
|
-
this._moveState.back = 0;
|
|
115
|
-
break;
|
|
116
|
-
case "KeyA":
|
|
117
|
-
this._moveState.left = 0;
|
|
118
|
-
break;
|
|
119
|
-
case "KeyD":
|
|
120
|
-
this._moveState.right = 0;
|
|
121
|
-
break;
|
|
122
|
-
case "KeyR":
|
|
123
|
-
this._moveState.up = 0;
|
|
124
|
-
break;
|
|
125
|
-
case "KeyF":
|
|
126
|
-
this._moveState.down = 0;
|
|
127
|
-
break;
|
|
128
|
-
case "ArrowUp":
|
|
129
|
-
this._moveState.pitchUp = 0;
|
|
130
|
-
break;
|
|
131
|
-
case "ArrowDown":
|
|
132
|
-
this._moveState.pitchDown = 0;
|
|
133
|
-
break;
|
|
134
|
-
case "ArrowLeft":
|
|
135
|
-
this._moveState.yawLeft = 0;
|
|
136
|
-
break;
|
|
137
|
-
case "ArrowRight":
|
|
138
|
-
this._moveState.yawRight = 0;
|
|
139
|
-
break;
|
|
140
|
-
case "KeyQ":
|
|
141
|
-
this._moveState.rollLeft = 0;
|
|
142
|
-
break;
|
|
143
|
-
case "KeyE": this._moveState.rollRight = 0;
|
|
144
|
-
}
|
|
145
|
-
this._updateMovementVector(), this._updateRotationVector();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function fe(e) {
|
|
149
|
-
if (this.enabled !== !1) {
|
|
150
|
-
if (this.dragToLook) this._status++;
|
|
151
|
-
else {
|
|
152
|
-
switch (e.button) {
|
|
153
|
-
case 0:
|
|
154
|
-
this._moveState.forward = 1;
|
|
155
|
-
break;
|
|
156
|
-
case 2: this._moveState.back = 1;
|
|
157
|
-
}
|
|
158
|
-
this._updateMovementVector();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function pe(e) {
|
|
163
|
-
if (this.enabled !== !1 && (!this.dragToLook || this._status > 0)) {
|
|
164
|
-
let t = this._getContainerDimensions(), n = t.size[0] / 2, r = t.size[1] / 2;
|
|
165
|
-
this._moveState.yawLeft = -(e.pageX - t.offset[0] - n) / n, this._moveState.pitchDown = (e.pageY - t.offset[1] - r) / r, this._updateRotationVector();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function me(e) {
|
|
169
|
-
if (this.enabled !== !1) {
|
|
170
|
-
if (this.dragToLook) this._status--, this._moveState.yawLeft = this._moveState.pitchDown = 0;
|
|
171
|
-
else {
|
|
172
|
-
switch (e.button) {
|
|
173
|
-
case 0:
|
|
174
|
-
this._moveState.forward = 0;
|
|
175
|
-
break;
|
|
176
|
-
case 2: this._moveState.back = 0;
|
|
177
|
-
}
|
|
178
|
-
this._updateMovementVector();
|
|
179
|
-
}
|
|
180
|
-
this._updateRotationVector();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function he() {
|
|
184
|
-
this.enabled !== !1 && (this.dragToLook ? (this._status = 0, this._moveState.yawLeft = this._moveState.pitchDown = 0) : (this._moveState.forward = 0, this._moveState.back = 0, this._updateMovementVector()), this._updateRotationVector());
|
|
185
|
-
}
|
|
186
|
-
function ge(e) {
|
|
187
|
-
this.enabled !== !1 && e.preventDefault();
|
|
188
|
-
}
|
|
189
|
-
// ../../node_modules/three/examples/jsm/controls/TransformControls.js
|
|
190
|
-
var F = new re(), I = new A(), L = new A(), R = new E(), _e = {
|
|
191
|
-
X: new A(1, 0, 0),
|
|
192
|
-
Y: new A(0, 1, 0),
|
|
193
|
-
Z: new A(0, 0, 1)
|
|
194
|
-
}, z = { type: "change" }, ve = {
|
|
195
|
-
type: "mouseDown",
|
|
196
|
-
mode: null
|
|
197
|
-
}, ye = {
|
|
198
|
-
type: "mouseUp",
|
|
199
|
-
mode: null
|
|
200
|
-
}, be = { type: "objectChange" }, xe = class extends d {
|
|
201
|
-
constructor(e, t = null) {
|
|
202
|
-
super(void 0, t);
|
|
203
|
-
let n = new Ae(this);
|
|
204
|
-
this._root = n;
|
|
205
|
-
let r = new je();
|
|
206
|
-
this._gizmo = r, n.add(r);
|
|
207
|
-
let i = new Me();
|
|
208
|
-
this._plane = i, n.add(i);
|
|
209
|
-
let a = this;
|
|
210
|
-
function o(e, t) {
|
|
211
|
-
let n = t;
|
|
212
|
-
Object.defineProperty(a, e, {
|
|
213
|
-
get: function() {
|
|
214
|
-
return n === void 0 ? t : n;
|
|
215
|
-
},
|
|
216
|
-
set: function(t) {
|
|
217
|
-
n !== t && (n = t, i[e] = t, r[e] = t, a.dispatchEvent({
|
|
218
|
-
type: e + "-changed",
|
|
219
|
-
value: t
|
|
220
|
-
}), a.dispatchEvent(z));
|
|
221
|
-
}
|
|
222
|
-
}), a[e] = t, i[e] = t, r[e] = t;
|
|
223
|
-
}
|
|
224
|
-
o("camera", e), o("object", void 0), o("enabled", !0), o("axis", null), o("mode", "translate"), o("translationSnap", null), o("rotationSnap", null), o("scaleSnap", null), o("space", "world"), o("size", 1), o("dragging", !1), o("showX", !0), o("showY", !0), o("showZ", !0), o("showXY", !0), o("showYZ", !0), o("showXZ", !0), o("minX", -Infinity), o("maxX", Infinity), o("minY", -Infinity), o("maxY", Infinity), o("minZ", -Infinity), o("maxZ", Infinity);
|
|
225
|
-
let s = new A(), c = new A(), l = new E(), u = new E(), d = new A(), f = new E(), p = new A(), m = new A(), h = new A(), g = new A();
|
|
226
|
-
o("worldPosition", s), o("worldPositionStart", c), o("worldQuaternion", l), o("worldQuaternionStart", u), o("cameraPosition", d), o("cameraQuaternion", f), o("pointStart", p), o("pointEnd", m), o("rotationAxis", h), o("rotationAngle", 0), o("eye", g), this._offset = new A(), this._startNorm = new A(), this._endNorm = new A(), this._cameraScale = new A(), this._parentPosition = new A(), this._parentQuaternion = new E(), this._parentQuaternionInv = new E(), this._parentScale = new A(), this._worldScaleStart = new A(), this._worldQuaternionInv = new E(), this._worldScale = new A(), this._positionStart = new A(), this._quaternionStart = new E(), this._scaleStart = new A(), this._getPointer = Se.bind(this), this._onPointerDown = we.bind(this), this._onPointerHover = Ce.bind(this), this._onPointerMove = Te.bind(this), this._onPointerUp = Ee.bind(this), t !== null && this.connect(t);
|
|
227
|
-
}
|
|
228
|
-
connect(e) {
|
|
229
|
-
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "none";
|
|
230
|
-
}
|
|
231
|
-
disconnect() {
|
|
232
|
-
this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerHover), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "";
|
|
233
|
-
}
|
|
234
|
-
getHelper() {
|
|
235
|
-
return this._root;
|
|
236
|
-
}
|
|
237
|
-
pointerHover(e) {
|
|
238
|
-
if (this.object === void 0 || this.dragging === !0) return;
|
|
239
|
-
e !== null && F.setFromCamera(e, this.camera);
|
|
240
|
-
let t = B(this._gizmo.picker[this.mode], F);
|
|
241
|
-
this.axis = t ? t.object.name : null;
|
|
242
|
-
}
|
|
243
|
-
pointerDown(e) {
|
|
244
|
-
if (!(this.object === void 0 || this.dragging === !0 || e != null && e.button !== 0) && this.axis !== null) {
|
|
245
|
-
e !== null && F.setFromCamera(e, this.camera);
|
|
246
|
-
let t = B(this._plane, F, !0);
|
|
247
|
-
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, ve.mode = this.mode, this.dispatchEvent(ve);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
pointerMove(e) {
|
|
251
|
-
let t = this.axis, n = this.mode, r = this.object, i = this.space;
|
|
252
|
-
if (n === "scale" ? i = "local" : (t === "E" || t === "XYZE" || t === "XYZ") && (i = "world"), r === void 0 || t === null || this.dragging === !1 || e !== null && e.button !== -1) return;
|
|
253
|
-
e !== null && F.setFromCamera(e, this.camera);
|
|
254
|
-
let a = B(this._plane, F, !0);
|
|
255
|
-
if (a) {
|
|
256
|
-
if (this.pointEnd.copy(a.point).sub(this.worldPositionStart), n === "translate") this._offset.copy(this.pointEnd).sub(this.pointStart), i === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), i === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), r.position.copy(this._offset).add(this._positionStart), this.translationSnap && (i === "local" && (r.position.applyQuaternion(R.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (r.position.x = Math.round(r.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (r.position.y = Math.round(r.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (r.position.z = Math.round(r.position.z / this.translationSnap) * this.translationSnap), r.position.applyQuaternion(this._quaternionStart)), i === "world" && (r.parent && r.position.add(I.setFromMatrixPosition(r.parent.matrixWorld)), t.search("X") !== -1 && (r.position.x = Math.round(r.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (r.position.y = Math.round(r.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (r.position.z = Math.round(r.position.z / this.translationSnap) * this.translationSnap), r.parent && r.position.sub(I.setFromMatrixPosition(r.parent.matrixWorld)))), r.position.x = Math.max(this.minX, Math.min(this.maxX, r.position.x)), r.position.y = Math.max(this.minY, Math.min(this.maxY, r.position.y)), r.position.z = Math.max(this.minZ, Math.min(this.maxZ, r.position.z));
|
|
257
|
-
else if (n === "scale") {
|
|
258
|
-
if (t.search("XYZ") !== -1) {
|
|
259
|
-
let e = this.pointEnd.length() / this.pointStart.length();
|
|
260
|
-
this.pointEnd.dot(this.pointStart) < 0 && (e *= -1), L.set(e, e, e);
|
|
261
|
-
} else I.copy(this.pointStart), L.copy(this.pointEnd), I.applyQuaternion(this._worldQuaternionInv), L.applyQuaternion(this._worldQuaternionInv), L.divide(I), t.search("X") === -1 && (L.x = 1), t.search("Y") === -1 && (L.y = 1), t.search("Z") === -1 && (L.z = 1);
|
|
262
|
-
r.scale.copy(this._scaleStart).multiply(L), this.scaleSnap && (t.search("X") !== -1 && (r.scale.x = Math.round(r.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Y") !== -1 && (r.scale.y = Math.round(r.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Z") !== -1 && (r.scale.z = Math.round(r.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
|
|
263
|
-
} else if (n === "rotate") {
|
|
264
|
-
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
265
|
-
let e = 20 / this.worldPosition.distanceTo(I.setFromMatrixPosition(this.camera.matrixWorld)), n = !1;
|
|
266
|
-
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(I.copy(this.rotationAxis).cross(this.eye)) * e) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(_e[t]), I.copy(_e[t]), i === "local" && I.applyQuaternion(this.worldQuaternion), I.cross(this.eye), I.length() === 0 ? n = !0 : this.rotationAngle = this._offset.dot(I.normalize()) * e), (t === "E" || n) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), i === "local" && t !== "E" && t !== "XYZE" ? (r.quaternion.copy(this._quaternionStart), r.quaternion.multiply(R.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), r.quaternion.copy(R.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), r.quaternion.multiply(this._quaternionStart).normalize());
|
|
267
|
-
}
|
|
268
|
-
this.dispatchEvent(z), this.dispatchEvent(be);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
pointerUp(e) {
|
|
272
|
-
(e === null || e.button === 0) && (this.dragging && this.axis !== null && (ye.mode = this.mode, this.dispatchEvent(ye)), this.dragging = !1, this.axis = null);
|
|
273
|
-
}
|
|
274
|
-
dispose() {
|
|
275
|
-
this.disconnect(), this._root.dispose();
|
|
276
|
-
}
|
|
277
|
-
attach(e) {
|
|
278
|
-
return this.object = e, this._root.visible = !0, this;
|
|
279
|
-
}
|
|
280
|
-
detach() {
|
|
281
|
-
return this.object = void 0, this.axis = null, this._root.visible = !1, this;
|
|
282
|
-
}
|
|
283
|
-
reset() {
|
|
284
|
-
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(z), this.dispatchEvent(be), this.pointStart.copy(this.pointEnd));
|
|
285
|
-
}
|
|
286
|
-
getRaycaster() {
|
|
287
|
-
return F;
|
|
288
|
-
}
|
|
289
|
-
getMode() {
|
|
290
|
-
return this.mode;
|
|
291
|
-
}
|
|
292
|
-
setMode(e) {
|
|
293
|
-
this.mode = e;
|
|
294
|
-
}
|
|
295
|
-
setTranslationSnap(e) {
|
|
296
|
-
this.translationSnap = e;
|
|
297
|
-
}
|
|
298
|
-
setRotationSnap(e) {
|
|
299
|
-
this.rotationSnap = e;
|
|
300
|
-
}
|
|
301
|
-
setScaleSnap(e) {
|
|
302
|
-
this.scaleSnap = e;
|
|
303
|
-
}
|
|
304
|
-
setSize(e) {
|
|
305
|
-
this.size = e;
|
|
306
|
-
}
|
|
307
|
-
setSpace(e) {
|
|
308
|
-
this.space = e;
|
|
309
|
-
}
|
|
310
|
-
setColors(e, t, n, r) {
|
|
311
|
-
let i = this._gizmo.materialLib;
|
|
312
|
-
i.xAxis.color.set(e), i.yAxis.color.set(t), i.zAxis.color.set(n), i.active.color.set(r), i.xAxisTransparent.color.set(e), i.yAxisTransparent.color.set(t), i.zAxisTransparent.color.set(n), i.activeTransparent.color.set(r), i.xAxis._color && i.xAxis._color.set(e), i.yAxis._color && i.yAxis._color.set(t), i.zAxis._color && i.zAxis._color.set(n), i.active._color && i.active._color.set(r), i.xAxisTransparent._color && i.xAxisTransparent._color.set(e), i.yAxisTransparent._color && i.yAxisTransparent._color.set(t), i.zAxisTransparent._color && i.zAxisTransparent._color.set(n), i.activeTransparent._color && i.activeTransparent._color.set(r);
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
function Se(e) {
|
|
316
|
-
if (this.domElement.ownerDocument.pointerLockElement) return {
|
|
317
|
-
x: 0,
|
|
318
|
-
y: 0,
|
|
319
|
-
button: e.button
|
|
320
|
-
};
|
|
321
|
-
{
|
|
322
|
-
let t = this.domElement.getBoundingClientRect();
|
|
323
|
-
return {
|
|
324
|
-
x: (e.clientX - t.left) / t.width * 2 - 1,
|
|
325
|
-
y: -(e.clientY - t.top) / t.height * 2 + 1,
|
|
326
|
-
button: e.button
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function Ce(e) {
|
|
331
|
-
if (this.enabled) switch (e.pointerType) {
|
|
332
|
-
case "mouse":
|
|
333
|
-
case "pen": this.pointerHover(this._getPointer(e));
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
function we(e) {
|
|
337
|
-
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(e.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(e)), this.pointerDown(this._getPointer(e)));
|
|
338
|
-
}
|
|
339
|
-
function Te(e) {
|
|
340
|
-
this.enabled && this.pointerMove(this._getPointer(e));
|
|
341
|
-
}
|
|
342
|
-
function Ee(e) {
|
|
343
|
-
this.enabled && (this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(e)));
|
|
344
|
-
}
|
|
345
|
-
function B(e, t, n) {
|
|
346
|
-
let r = t.intersectObject(e, !0);
|
|
347
|
-
for (let e = 0; e < r.length; e++) if (r[e].object.visible || n) return r[e];
|
|
348
|
-
return !1;
|
|
349
|
-
}
|
|
350
|
-
var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new E(), W = new E(), G = new A(), ke = new v(), K = new A(1, 0, 0), q = new A(0, 1, 0), J = new A(0, 0, 1), Y = new A(), X = new A(), Z = new A(), Ae = class extends S {
|
|
351
|
-
constructor(e) {
|
|
352
|
-
super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
|
|
353
|
-
}
|
|
354
|
-
updateMatrixWorld(e) {
|
|
355
|
-
let t = this.controls;
|
|
356
|
-
t.object !== void 0 && (t.object.updateMatrixWorld(), t.object.parent === null ? console.error("TransformControls: The attached 3D object must be a part of the scene graph.") : t.object.parent.matrixWorld.decompose(t._parentPosition, t._parentQuaternion, t._parentScale), t.object.matrixWorld.decompose(t.worldPosition, t.worldQuaternion, t._worldScale), t._parentQuaternionInv.copy(t._parentQuaternion).invert(), t._worldQuaternionInv.copy(t.worldQuaternion).invert()), t.camera.updateMatrixWorld(), t.camera.matrixWorld.decompose(t.cameraPosition, t.cameraQuaternion, t._cameraScale), t.camera.isOrthographicCamera ? t.camera.getWorldDirection(t.eye).negate() : t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(), super.updateMatrixWorld(e);
|
|
357
|
-
}
|
|
358
|
-
dispose() {
|
|
359
|
-
this.traverse(function(e) {
|
|
360
|
-
e.geometry && e.geometry.dispose(), e.material && e.material.dispose();
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}, je = class extends S {
|
|
364
|
-
constructor() {
|
|
365
|
-
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
366
|
-
let e = new te({
|
|
367
|
-
depthTest: !1,
|
|
368
|
-
depthWrite: !1,
|
|
369
|
-
fog: !1,
|
|
370
|
-
toneMapped: !1,
|
|
371
|
-
transparent: !0
|
|
372
|
-
}), t = new ee({
|
|
373
|
-
depthTest: !1,
|
|
374
|
-
depthWrite: !1,
|
|
375
|
-
fog: !1,
|
|
376
|
-
toneMapped: !1,
|
|
377
|
-
transparent: !0
|
|
378
|
-
}), n = e.clone();
|
|
379
|
-
n.opacity = .15;
|
|
380
|
-
let r = t.clone();
|
|
381
|
-
r.opacity = .5;
|
|
382
|
-
let i = e.clone();
|
|
383
|
-
i.color.setHex(16711680);
|
|
384
|
-
let a = e.clone();
|
|
385
|
-
a.color.setHex(65280);
|
|
386
|
-
let o = e.clone();
|
|
387
|
-
o.color.setHex(255);
|
|
388
|
-
let s = e.clone();
|
|
389
|
-
s.color.setHex(16711680), s.opacity = .5;
|
|
390
|
-
let u = e.clone();
|
|
391
|
-
u.color.setHex(65280), u.opacity = .5;
|
|
392
|
-
let d = e.clone();
|
|
393
|
-
d.color.setHex(255), d.opacity = .5;
|
|
394
|
-
let p = e.clone();
|
|
395
|
-
p.opacity = .25;
|
|
396
|
-
let m = e.clone();
|
|
397
|
-
m.color.setHex(16776960), m.opacity = .25;
|
|
398
|
-
let g = e.clone();
|
|
399
|
-
g.color.setHex(16776960);
|
|
400
|
-
let v = e.clone();
|
|
401
|
-
v.color.setHex(7895160), this.materialLib = {
|
|
402
|
-
xAxis: i,
|
|
403
|
-
yAxis: a,
|
|
404
|
-
zAxis: o,
|
|
405
|
-
active: g,
|
|
406
|
-
xAxisTransparent: s,
|
|
407
|
-
yAxisTransparent: u,
|
|
408
|
-
zAxisTransparent: d,
|
|
409
|
-
activeTransparent: m
|
|
410
|
-
};
|
|
411
|
-
let b = new f(0, .04, .1, 12);
|
|
412
|
-
b.translate(0, .05, 0);
|
|
413
|
-
let x = new c(.08, .08, .08);
|
|
414
|
-
x.translate(0, .04, 0);
|
|
415
|
-
let w = new l();
|
|
416
|
-
w.setAttribute("position", new h([
|
|
417
|
-
0,
|
|
418
|
-
0,
|
|
419
|
-
0,
|
|
420
|
-
1,
|
|
421
|
-
0,
|
|
422
|
-
0
|
|
423
|
-
], 3));
|
|
424
|
-
let T = new f(.0075, .0075, .5, 3);
|
|
425
|
-
T.translate(0, .25, 0);
|
|
426
|
-
function E(e, t) {
|
|
427
|
-
let n = new O(e, .0075, 3, 64, t * Math.PI * 2);
|
|
428
|
-
return n.rotateY(Math.PI / 2), n.rotateX(Math.PI / 2), n;
|
|
429
|
-
}
|
|
430
|
-
function ne() {
|
|
431
|
-
let e = new l();
|
|
432
|
-
return e.setAttribute("position", new h([
|
|
433
|
-
0,
|
|
434
|
-
0,
|
|
435
|
-
0,
|
|
436
|
-
1,
|
|
437
|
-
1,
|
|
438
|
-
1
|
|
439
|
-
], 3)), e;
|
|
440
|
-
}
|
|
441
|
-
let re = {
|
|
442
|
-
X: [
|
|
443
|
-
[
|
|
444
|
-
new y(b, i),
|
|
445
|
-
[
|
|
446
|
-
.5,
|
|
447
|
-
0,
|
|
448
|
-
0
|
|
449
|
-
],
|
|
450
|
-
[
|
|
451
|
-
0,
|
|
452
|
-
0,
|
|
453
|
-
-Math.PI / 2
|
|
454
|
-
]
|
|
455
|
-
],
|
|
456
|
-
[
|
|
457
|
-
new y(b, i),
|
|
458
|
-
[
|
|
459
|
-
-.5,
|
|
460
|
-
0,
|
|
461
|
-
0
|
|
462
|
-
],
|
|
463
|
-
[
|
|
464
|
-
0,
|
|
465
|
-
0,
|
|
466
|
-
Math.PI / 2
|
|
467
|
-
]
|
|
468
|
-
],
|
|
469
|
-
[
|
|
470
|
-
new y(T, i),
|
|
471
|
-
[
|
|
472
|
-
0,
|
|
473
|
-
0,
|
|
474
|
-
0
|
|
475
|
-
],
|
|
476
|
-
[
|
|
477
|
-
0,
|
|
478
|
-
0,
|
|
479
|
-
-Math.PI / 2
|
|
480
|
-
]
|
|
481
|
-
]
|
|
482
|
-
],
|
|
483
|
-
Y: [
|
|
484
|
-
[new y(b, a), [
|
|
485
|
-
0,
|
|
486
|
-
.5,
|
|
487
|
-
0
|
|
488
|
-
]],
|
|
489
|
-
[
|
|
490
|
-
new y(b, a),
|
|
491
|
-
[
|
|
492
|
-
0,
|
|
493
|
-
-.5,
|
|
494
|
-
0
|
|
495
|
-
],
|
|
496
|
-
[
|
|
497
|
-
Math.PI,
|
|
498
|
-
0,
|
|
499
|
-
0
|
|
500
|
-
]
|
|
501
|
-
],
|
|
502
|
-
[new y(T, a)]
|
|
503
|
-
],
|
|
504
|
-
Z: [
|
|
505
|
-
[
|
|
506
|
-
new y(b, o),
|
|
507
|
-
[
|
|
508
|
-
0,
|
|
509
|
-
0,
|
|
510
|
-
.5
|
|
511
|
-
],
|
|
512
|
-
[
|
|
513
|
-
Math.PI / 2,
|
|
514
|
-
0,
|
|
515
|
-
0
|
|
516
|
-
]
|
|
517
|
-
],
|
|
518
|
-
[
|
|
519
|
-
new y(b, o),
|
|
520
|
-
[
|
|
521
|
-
0,
|
|
522
|
-
0,
|
|
523
|
-
-.5
|
|
524
|
-
],
|
|
525
|
-
[
|
|
526
|
-
-Math.PI / 2,
|
|
527
|
-
0,
|
|
528
|
-
0
|
|
529
|
-
]
|
|
530
|
-
],
|
|
531
|
-
[
|
|
532
|
-
new y(T, o),
|
|
533
|
-
null,
|
|
534
|
-
[
|
|
535
|
-
Math.PI / 2,
|
|
536
|
-
0,
|
|
537
|
-
0
|
|
538
|
-
]
|
|
539
|
-
]
|
|
540
|
-
],
|
|
541
|
-
XYZ: [[new y(new C(.1, 0), p), [
|
|
542
|
-
0,
|
|
543
|
-
0,
|
|
544
|
-
0
|
|
545
|
-
]]],
|
|
546
|
-
XY: [[new y(new c(.15, .15, .01), d), [
|
|
547
|
-
.15,
|
|
548
|
-
.15,
|
|
549
|
-
0
|
|
550
|
-
]]],
|
|
551
|
-
YZ: [[
|
|
552
|
-
new y(new c(.15, .15, .01), s),
|
|
553
|
-
[
|
|
554
|
-
0,
|
|
555
|
-
.15,
|
|
556
|
-
.15
|
|
557
|
-
],
|
|
558
|
-
[
|
|
559
|
-
0,
|
|
560
|
-
Math.PI / 2,
|
|
561
|
-
0
|
|
562
|
-
]
|
|
563
|
-
]],
|
|
564
|
-
XZ: [[
|
|
565
|
-
new y(new c(.15, .15, .01), u),
|
|
566
|
-
[
|
|
567
|
-
.15,
|
|
568
|
-
0,
|
|
569
|
-
.15
|
|
570
|
-
],
|
|
571
|
-
[
|
|
572
|
-
-Math.PI / 2,
|
|
573
|
-
0,
|
|
574
|
-
0
|
|
575
|
-
]
|
|
576
|
-
]]
|
|
577
|
-
}, D = {
|
|
578
|
-
X: [[
|
|
579
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
580
|
-
[
|
|
581
|
-
.3,
|
|
582
|
-
0,
|
|
583
|
-
0
|
|
584
|
-
],
|
|
585
|
-
[
|
|
586
|
-
0,
|
|
587
|
-
0,
|
|
588
|
-
-Math.PI / 2
|
|
589
|
-
]
|
|
590
|
-
], [
|
|
591
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
592
|
-
[
|
|
593
|
-
-.3,
|
|
594
|
-
0,
|
|
595
|
-
0
|
|
596
|
-
],
|
|
597
|
-
[
|
|
598
|
-
0,
|
|
599
|
-
0,
|
|
600
|
-
Math.PI / 2
|
|
601
|
-
]
|
|
602
|
-
]],
|
|
603
|
-
Y: [[new y(new f(.2, 0, .6, 4), n), [
|
|
604
|
-
0,
|
|
605
|
-
.3,
|
|
606
|
-
0
|
|
607
|
-
]], [
|
|
608
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
609
|
-
[
|
|
610
|
-
0,
|
|
611
|
-
-.3,
|
|
612
|
-
0
|
|
613
|
-
],
|
|
614
|
-
[
|
|
615
|
-
0,
|
|
616
|
-
0,
|
|
617
|
-
Math.PI
|
|
618
|
-
]
|
|
619
|
-
]],
|
|
620
|
-
Z: [[
|
|
621
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
622
|
-
[
|
|
623
|
-
0,
|
|
624
|
-
0,
|
|
625
|
-
.3
|
|
626
|
-
],
|
|
627
|
-
[
|
|
628
|
-
Math.PI / 2,
|
|
629
|
-
0,
|
|
630
|
-
0
|
|
631
|
-
]
|
|
632
|
-
], [
|
|
633
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
634
|
-
[
|
|
635
|
-
0,
|
|
636
|
-
0,
|
|
637
|
-
-.3
|
|
638
|
-
],
|
|
639
|
-
[
|
|
640
|
-
-Math.PI / 2,
|
|
641
|
-
0,
|
|
642
|
-
0
|
|
643
|
-
]
|
|
644
|
-
]],
|
|
645
|
-
XYZ: [[new y(new C(.2, 0), n)]],
|
|
646
|
-
XY: [[new y(new c(.2, .2, .01), n), [
|
|
647
|
-
.15,
|
|
648
|
-
.15,
|
|
649
|
-
0
|
|
650
|
-
]]],
|
|
651
|
-
YZ: [[
|
|
652
|
-
new y(new c(.2, .2, .01), n),
|
|
653
|
-
[
|
|
654
|
-
0,
|
|
655
|
-
.15,
|
|
656
|
-
.15
|
|
657
|
-
],
|
|
658
|
-
[
|
|
659
|
-
0,
|
|
660
|
-
Math.PI / 2,
|
|
661
|
-
0
|
|
662
|
-
]
|
|
663
|
-
]],
|
|
664
|
-
XZ: [[
|
|
665
|
-
new y(new c(.2, .2, .01), n),
|
|
666
|
-
[
|
|
667
|
-
.15,
|
|
668
|
-
0,
|
|
669
|
-
.15
|
|
670
|
-
],
|
|
671
|
-
[
|
|
672
|
-
-Math.PI / 2,
|
|
673
|
-
0,
|
|
674
|
-
0
|
|
675
|
-
]
|
|
676
|
-
]]
|
|
677
|
-
}, ae = {
|
|
678
|
-
START: [[
|
|
679
|
-
new y(new C(.01, 2), r),
|
|
680
|
-
null,
|
|
681
|
-
null,
|
|
682
|
-
null,
|
|
683
|
-
"helper"
|
|
684
|
-
]],
|
|
685
|
-
END: [[
|
|
686
|
-
new y(new C(.01, 2), r),
|
|
687
|
-
null,
|
|
688
|
-
null,
|
|
689
|
-
null,
|
|
690
|
-
"helper"
|
|
691
|
-
]],
|
|
692
|
-
DELTA: [[
|
|
693
|
-
new _(ne(), r),
|
|
694
|
-
null,
|
|
695
|
-
null,
|
|
696
|
-
null,
|
|
697
|
-
"helper"
|
|
698
|
-
]],
|
|
699
|
-
X: [[
|
|
700
|
-
new _(w, r),
|
|
701
|
-
[
|
|
702
|
-
-1e3,
|
|
703
|
-
0,
|
|
704
|
-
0
|
|
705
|
-
],
|
|
706
|
-
null,
|
|
707
|
-
[
|
|
708
|
-
1e6,
|
|
709
|
-
1,
|
|
710
|
-
1
|
|
711
|
-
],
|
|
712
|
-
"helper"
|
|
713
|
-
]],
|
|
714
|
-
Y: [[
|
|
715
|
-
new _(w, r),
|
|
716
|
-
[
|
|
717
|
-
0,
|
|
718
|
-
-1e3,
|
|
719
|
-
0
|
|
720
|
-
],
|
|
721
|
-
[
|
|
722
|
-
0,
|
|
723
|
-
0,
|
|
724
|
-
Math.PI / 2
|
|
725
|
-
],
|
|
726
|
-
[
|
|
727
|
-
1e6,
|
|
728
|
-
1,
|
|
729
|
-
1
|
|
730
|
-
],
|
|
731
|
-
"helper"
|
|
732
|
-
]],
|
|
733
|
-
Z: [[
|
|
734
|
-
new _(w, r),
|
|
735
|
-
[
|
|
736
|
-
0,
|
|
737
|
-
0,
|
|
738
|
-
-1e3
|
|
739
|
-
],
|
|
740
|
-
[
|
|
741
|
-
0,
|
|
742
|
-
-Math.PI / 2,
|
|
743
|
-
0
|
|
744
|
-
],
|
|
745
|
-
[
|
|
746
|
-
1e6,
|
|
747
|
-
1,
|
|
748
|
-
1
|
|
749
|
-
],
|
|
750
|
-
"helper"
|
|
751
|
-
]]
|
|
752
|
-
}, k = {
|
|
753
|
-
XYZE: [[
|
|
754
|
-
new y(E(.5, 1), v),
|
|
755
|
-
null,
|
|
756
|
-
[
|
|
757
|
-
0,
|
|
758
|
-
Math.PI / 2,
|
|
759
|
-
0
|
|
760
|
-
]
|
|
761
|
-
]],
|
|
762
|
-
X: [[new y(E(.5, .5), i)]],
|
|
763
|
-
Y: [[
|
|
764
|
-
new y(E(.5, .5), a),
|
|
765
|
-
null,
|
|
766
|
-
[
|
|
767
|
-
0,
|
|
768
|
-
0,
|
|
769
|
-
-Math.PI / 2
|
|
770
|
-
]
|
|
771
|
-
]],
|
|
772
|
-
Z: [[
|
|
773
|
-
new y(E(.5, .5), o),
|
|
774
|
-
null,
|
|
775
|
-
[
|
|
776
|
-
0,
|
|
777
|
-
Math.PI / 2,
|
|
778
|
-
0
|
|
779
|
-
]
|
|
780
|
-
]],
|
|
781
|
-
E: [[
|
|
782
|
-
new y(E(.75, 1), m),
|
|
783
|
-
null,
|
|
784
|
-
[
|
|
785
|
-
0,
|
|
786
|
-
Math.PI / 2,
|
|
787
|
-
0
|
|
788
|
-
]
|
|
789
|
-
]]
|
|
790
|
-
}, A = { AXIS: [[
|
|
791
|
-
new _(w, r),
|
|
792
|
-
[
|
|
793
|
-
-1e3,
|
|
794
|
-
0,
|
|
795
|
-
0
|
|
796
|
-
],
|
|
797
|
-
null,
|
|
798
|
-
[
|
|
799
|
-
1e6,
|
|
800
|
-
1,
|
|
801
|
-
1
|
|
802
|
-
],
|
|
803
|
-
"helper"
|
|
804
|
-
]] }, j = {
|
|
805
|
-
XYZE: [[new y(new ie(.25, 10, 8), n)]],
|
|
806
|
-
X: [[
|
|
807
|
-
new y(new O(.5, .1, 4, 24), n),
|
|
808
|
-
[
|
|
809
|
-
0,
|
|
810
|
-
0,
|
|
811
|
-
0
|
|
812
|
-
],
|
|
813
|
-
[
|
|
814
|
-
0,
|
|
815
|
-
-Math.PI / 2,
|
|
816
|
-
-Math.PI / 2
|
|
817
|
-
]
|
|
818
|
-
]],
|
|
819
|
-
Y: [[
|
|
820
|
-
new y(new O(.5, .1, 4, 24), n),
|
|
821
|
-
[
|
|
822
|
-
0,
|
|
823
|
-
0,
|
|
824
|
-
0
|
|
825
|
-
],
|
|
826
|
-
[
|
|
827
|
-
Math.PI / 2,
|
|
828
|
-
0,
|
|
829
|
-
0
|
|
830
|
-
]
|
|
831
|
-
]],
|
|
832
|
-
Z: [[
|
|
833
|
-
new y(new O(.5, .1, 4, 24), n),
|
|
834
|
-
[
|
|
835
|
-
0,
|
|
836
|
-
0,
|
|
837
|
-
0
|
|
838
|
-
],
|
|
839
|
-
[
|
|
840
|
-
0,
|
|
841
|
-
0,
|
|
842
|
-
-Math.PI / 2
|
|
843
|
-
]
|
|
844
|
-
]],
|
|
845
|
-
E: [[new y(new O(.75, .1, 2, 24), n)]]
|
|
846
|
-
}, M = {
|
|
847
|
-
X: [
|
|
848
|
-
[
|
|
849
|
-
new y(x, i),
|
|
850
|
-
[
|
|
851
|
-
.5,
|
|
852
|
-
0,
|
|
853
|
-
0
|
|
854
|
-
],
|
|
855
|
-
[
|
|
856
|
-
0,
|
|
857
|
-
0,
|
|
858
|
-
-Math.PI / 2
|
|
859
|
-
]
|
|
860
|
-
],
|
|
861
|
-
[
|
|
862
|
-
new y(T, i),
|
|
863
|
-
[
|
|
864
|
-
0,
|
|
865
|
-
0,
|
|
866
|
-
0
|
|
867
|
-
],
|
|
868
|
-
[
|
|
869
|
-
0,
|
|
870
|
-
0,
|
|
871
|
-
-Math.PI / 2
|
|
872
|
-
]
|
|
873
|
-
],
|
|
874
|
-
[
|
|
875
|
-
new y(x, i),
|
|
876
|
-
[
|
|
877
|
-
-.5,
|
|
878
|
-
0,
|
|
879
|
-
0
|
|
880
|
-
],
|
|
881
|
-
[
|
|
882
|
-
0,
|
|
883
|
-
0,
|
|
884
|
-
Math.PI / 2
|
|
885
|
-
]
|
|
886
|
-
]
|
|
887
|
-
],
|
|
888
|
-
Y: [
|
|
889
|
-
[new y(x, a), [
|
|
890
|
-
0,
|
|
891
|
-
.5,
|
|
892
|
-
0
|
|
893
|
-
]],
|
|
894
|
-
[new y(T, a)],
|
|
895
|
-
[
|
|
896
|
-
new y(x, a),
|
|
897
|
-
[
|
|
898
|
-
0,
|
|
899
|
-
-.5,
|
|
900
|
-
0
|
|
901
|
-
],
|
|
902
|
-
[
|
|
903
|
-
0,
|
|
904
|
-
0,
|
|
905
|
-
Math.PI
|
|
906
|
-
]
|
|
907
|
-
]
|
|
908
|
-
],
|
|
909
|
-
Z: [
|
|
910
|
-
[
|
|
911
|
-
new y(x, o),
|
|
912
|
-
[
|
|
913
|
-
0,
|
|
914
|
-
0,
|
|
915
|
-
.5
|
|
916
|
-
],
|
|
917
|
-
[
|
|
918
|
-
Math.PI / 2,
|
|
919
|
-
0,
|
|
920
|
-
0
|
|
921
|
-
]
|
|
922
|
-
],
|
|
923
|
-
[
|
|
924
|
-
new y(T, o),
|
|
925
|
-
[
|
|
926
|
-
0,
|
|
927
|
-
0,
|
|
928
|
-
0
|
|
929
|
-
],
|
|
930
|
-
[
|
|
931
|
-
Math.PI / 2,
|
|
932
|
-
0,
|
|
933
|
-
0
|
|
934
|
-
]
|
|
935
|
-
],
|
|
936
|
-
[
|
|
937
|
-
new y(x, o),
|
|
938
|
-
[
|
|
939
|
-
0,
|
|
940
|
-
0,
|
|
941
|
-
-.5
|
|
942
|
-
],
|
|
943
|
-
[
|
|
944
|
-
-Math.PI / 2,
|
|
945
|
-
0,
|
|
946
|
-
0
|
|
947
|
-
]
|
|
948
|
-
]
|
|
949
|
-
],
|
|
950
|
-
XY: [[new y(new c(.15, .15, .01), d), [
|
|
951
|
-
.15,
|
|
952
|
-
.15,
|
|
953
|
-
0
|
|
954
|
-
]]],
|
|
955
|
-
YZ: [[
|
|
956
|
-
new y(new c(.15, .15, .01), s),
|
|
957
|
-
[
|
|
958
|
-
0,
|
|
959
|
-
.15,
|
|
960
|
-
.15
|
|
961
|
-
],
|
|
962
|
-
[
|
|
963
|
-
0,
|
|
964
|
-
Math.PI / 2,
|
|
965
|
-
0
|
|
966
|
-
]
|
|
967
|
-
]],
|
|
968
|
-
XZ: [[
|
|
969
|
-
new y(new c(.15, .15, .01), u),
|
|
970
|
-
[
|
|
971
|
-
.15,
|
|
972
|
-
0,
|
|
973
|
-
.15
|
|
974
|
-
],
|
|
975
|
-
[
|
|
976
|
-
-Math.PI / 2,
|
|
977
|
-
0,
|
|
978
|
-
0
|
|
979
|
-
]
|
|
980
|
-
]],
|
|
981
|
-
XYZ: [[new y(new c(.1, .1, .1), p)]]
|
|
982
|
-
}, N = {
|
|
983
|
-
X: [[
|
|
984
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
985
|
-
[
|
|
986
|
-
.3,
|
|
987
|
-
0,
|
|
988
|
-
0
|
|
989
|
-
],
|
|
990
|
-
[
|
|
991
|
-
0,
|
|
992
|
-
0,
|
|
993
|
-
-Math.PI / 2
|
|
994
|
-
]
|
|
995
|
-
], [
|
|
996
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
997
|
-
[
|
|
998
|
-
-.3,
|
|
999
|
-
0,
|
|
1000
|
-
0
|
|
1001
|
-
],
|
|
1002
|
-
[
|
|
1003
|
-
0,
|
|
1004
|
-
0,
|
|
1005
|
-
Math.PI / 2
|
|
1006
|
-
]
|
|
1007
|
-
]],
|
|
1008
|
-
Y: [[new y(new f(.2, 0, .6, 4), n), [
|
|
1009
|
-
0,
|
|
1010
|
-
.3,
|
|
1011
|
-
0
|
|
1012
|
-
]], [
|
|
1013
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
1014
|
-
[
|
|
1015
|
-
0,
|
|
1016
|
-
-.3,
|
|
1017
|
-
0
|
|
1018
|
-
],
|
|
1019
|
-
[
|
|
1020
|
-
0,
|
|
1021
|
-
0,
|
|
1022
|
-
Math.PI
|
|
1023
|
-
]
|
|
1024
|
-
]],
|
|
1025
|
-
Z: [[
|
|
1026
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
1027
|
-
[
|
|
1028
|
-
0,
|
|
1029
|
-
0,
|
|
1030
|
-
.3
|
|
1031
|
-
],
|
|
1032
|
-
[
|
|
1033
|
-
Math.PI / 2,
|
|
1034
|
-
0,
|
|
1035
|
-
0
|
|
1036
|
-
]
|
|
1037
|
-
], [
|
|
1038
|
-
new y(new f(.2, 0, .6, 4), n),
|
|
1039
|
-
[
|
|
1040
|
-
0,
|
|
1041
|
-
0,
|
|
1042
|
-
-.3
|
|
1043
|
-
],
|
|
1044
|
-
[
|
|
1045
|
-
-Math.PI / 2,
|
|
1046
|
-
0,
|
|
1047
|
-
0
|
|
1048
|
-
]
|
|
1049
|
-
]],
|
|
1050
|
-
XY: [[new y(new c(.2, .2, .01), n), [
|
|
1051
|
-
.15,
|
|
1052
|
-
.15,
|
|
1053
|
-
0
|
|
1054
|
-
]]],
|
|
1055
|
-
YZ: [[
|
|
1056
|
-
new y(new c(.2, .2, .01), n),
|
|
1057
|
-
[
|
|
1058
|
-
0,
|
|
1059
|
-
.15,
|
|
1060
|
-
.15
|
|
1061
|
-
],
|
|
1062
|
-
[
|
|
1063
|
-
0,
|
|
1064
|
-
Math.PI / 2,
|
|
1065
|
-
0
|
|
1066
|
-
]
|
|
1067
|
-
]],
|
|
1068
|
-
XZ: [[
|
|
1069
|
-
new y(new c(.2, .2, .01), n),
|
|
1070
|
-
[
|
|
1071
|
-
.15,
|
|
1072
|
-
0,
|
|
1073
|
-
.15
|
|
1074
|
-
],
|
|
1075
|
-
[
|
|
1076
|
-
-Math.PI / 2,
|
|
1077
|
-
0,
|
|
1078
|
-
0
|
|
1079
|
-
]
|
|
1080
|
-
]],
|
|
1081
|
-
XYZ: [[new y(new c(.2, .2, .2), n), [
|
|
1082
|
-
0,
|
|
1083
|
-
0,
|
|
1084
|
-
0
|
|
1085
|
-
]]]
|
|
1086
|
-
}, oe = {
|
|
1087
|
-
X: [[
|
|
1088
|
-
new _(w, r),
|
|
1089
|
-
[
|
|
1090
|
-
-1e3,
|
|
1091
|
-
0,
|
|
1092
|
-
0
|
|
1093
|
-
],
|
|
1094
|
-
null,
|
|
1095
|
-
[
|
|
1096
|
-
1e6,
|
|
1097
|
-
1,
|
|
1098
|
-
1
|
|
1099
|
-
],
|
|
1100
|
-
"helper"
|
|
1101
|
-
]],
|
|
1102
|
-
Y: [[
|
|
1103
|
-
new _(w, r),
|
|
1104
|
-
[
|
|
1105
|
-
0,
|
|
1106
|
-
-1e3,
|
|
1107
|
-
0
|
|
1108
|
-
],
|
|
1109
|
-
[
|
|
1110
|
-
0,
|
|
1111
|
-
0,
|
|
1112
|
-
Math.PI / 2
|
|
1113
|
-
],
|
|
1114
|
-
[
|
|
1115
|
-
1e6,
|
|
1116
|
-
1,
|
|
1117
|
-
1
|
|
1118
|
-
],
|
|
1119
|
-
"helper"
|
|
1120
|
-
]],
|
|
1121
|
-
Z: [[
|
|
1122
|
-
new _(w, r),
|
|
1123
|
-
[
|
|
1124
|
-
0,
|
|
1125
|
-
0,
|
|
1126
|
-
-1e3
|
|
1127
|
-
],
|
|
1128
|
-
[
|
|
1129
|
-
0,
|
|
1130
|
-
-Math.PI / 2,
|
|
1131
|
-
0
|
|
1132
|
-
],
|
|
1133
|
-
[
|
|
1134
|
-
1e6,
|
|
1135
|
-
1,
|
|
1136
|
-
1
|
|
1137
|
-
],
|
|
1138
|
-
"helper"
|
|
1139
|
-
]]
|
|
1140
|
-
};
|
|
1141
|
-
function P(e) {
|
|
1142
|
-
let t = new S();
|
|
1143
|
-
for (let n in e) for (let r = e[n].length; r--;) {
|
|
1144
|
-
let i = e[n][r][0].clone(), a = e[n][r][1], o = e[n][r][2], s = e[n][r][3], c = e[n][r][4];
|
|
1145
|
-
i.name = n, i.tag = c, a && i.position.set(a[0], a[1], a[2]), o && i.rotation.set(o[0], o[1], o[2]), s && i.scale.set(s[0], s[1], s[2]), i.updateMatrix();
|
|
1146
|
-
let l = i.geometry.clone();
|
|
1147
|
-
l.applyMatrix4(i.matrix), i.geometry = l, i.renderOrder = Infinity, i.position.set(0, 0, 0), i.rotation.set(0, 0, 0), i.scale.set(1, 1, 1), t.add(i);
|
|
1148
|
-
}
|
|
1149
|
-
return t;
|
|
1150
|
-
}
|
|
1151
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = P(re)), this.add(this.gizmo.rotate = P(k)), this.add(this.gizmo.scale = P(M)), this.add(this.picker.translate = P(D)), this.add(this.picker.rotate = P(j)), this.add(this.picker.scale = P(N)), this.add(this.helper.translate = P(ae)), this.add(this.helper.rotate = P(A)), this.add(this.helper.scale = P(oe)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
1152
|
-
}
|
|
1153
|
-
updateMatrixWorld(e) {
|
|
1154
|
-
let t = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : W;
|
|
1155
|
-
this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
|
|
1156
|
-
let n = [];
|
|
1157
|
-
n = n.concat(this.picker[this.mode].children), n = n.concat(this.gizmo[this.mode].children), n = n.concat(this.helper[this.mode].children);
|
|
1158
|
-
for (let e = 0; e < n.length; e++) {
|
|
1159
|
-
let r = n[e];
|
|
1160
|
-
r.visible = !0, r.rotation.set(0, 0, 0), r.position.copy(this.worldPosition);
|
|
1161
|
-
let i;
|
|
1162
|
-
if (i = this.camera.isOrthographicCamera ? (this.camera.top - this.camera.bottom) / this.camera.zoom : this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), r.scale.set(1, 1, 1).multiplyScalar(i * this.size / 4), r.tag === "helper") r.visible = !1, r.name === "AXIS" ? (r.visible = !!this.axis, this.axis === "X" && (R.setFromEuler(V.set(0, 0, 0)), r.quaternion.copy(t).multiply(R), Math.abs(H.copy(K).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "Y" && (R.setFromEuler(V.set(0, 0, Math.PI / 2)), r.quaternion.copy(t).multiply(R), Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "Z" && (R.setFromEuler(V.set(0, Math.PI / 2, 0)), r.quaternion.copy(t).multiply(R), Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "XYZE" && (R.setFromEuler(V.set(0, Math.PI / 2, 0)), H.copy(this.rotationAxis), r.quaternion.setFromRotationMatrix(Oe.lookAt(De, H, q)), r.quaternion.multiply(R), r.visible = this.dragging), this.axis === "E" && (r.visible = !1)) : r.name === "START" ? (r.position.copy(this.worldPositionStart), r.visible = this.dragging) : r.name === "END" ? (r.position.copy(this.worldPosition), r.visible = this.dragging) : r.name === "DELTA" ? (r.position.copy(this.worldPositionStart), r.quaternion.copy(this.worldQuaternionStart), I.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), I.applyQuaternion(this.worldQuaternionStart.clone().invert()), r.scale.copy(I), r.visible = this.dragging) : (r.quaternion.copy(t), this.dragging ? r.position.copy(this.worldPositionStart) : r.position.copy(this.worldPosition), this.axis && (r.visible = this.axis.search(r.name) !== -1));
|
|
1163
|
-
else {
|
|
1164
|
-
if (r.quaternion.copy(t), this.mode === "translate" || this.mode === "scale") {
|
|
1165
|
-
let e = .99, n = .2;
|
|
1166
|
-
r.name === "X" && Math.abs(H.copy(K).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "Y" && Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "Z" && Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "XY" && Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "YZ" && Math.abs(H.copy(K).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "XZ" && Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1);
|
|
1167
|
-
} else this.mode === "rotate" && (U.copy(t), H.copy(this.eye).applyQuaternion(R.copy(t).invert()), r.name.search("E") !== -1 && r.quaternion.setFromRotationMatrix(Oe.lookAt(this.eye, De, q)), r.name === "X" && (R.setFromAxisAngle(K, Math.atan2(-H.y, H.z)), R.multiplyQuaternions(U, R), r.quaternion.copy(R)), r.name === "Y" && (R.setFromAxisAngle(q, Math.atan2(H.x, H.z)), R.multiplyQuaternions(U, R), r.quaternion.copy(R)), r.name === "Z" && (R.setFromAxisAngle(J, Math.atan2(H.y, H.x)), R.multiplyQuaternions(U, R), r.quaternion.copy(R)));
|
|
1168
|
-
r.visible = r.visible && (r.name.indexOf("X") === -1 || this.showX), r.visible = r.visible && (r.name.indexOf("Y") === -1 || this.showY), r.visible = r.visible && (r.name.indexOf("Z") === -1 || this.showZ), r.visible = r.visible && (r.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), r.visible = r.visible && (r.name.indexOf("XY") === -1 || this.showXY), r.visible = r.visible && (r.name.indexOf("YZ") === -1 || this.showYZ), r.visible = r.visible && (r.name.indexOf("XZ") === -1 || this.showXZ), r.material._color = r.material._color || r.material.color.clone(), r.material._opacity = r.material._opacity || r.material.opacity, r.material.color.copy(r.material._color), r.material.opacity = r.material._opacity, this.enabled && this.axis && (r.name === this.axis || this.axis.split("").some(function(e) {
|
|
1169
|
-
return r.name === e;
|
|
1170
|
-
})) && (r.material.color.copy(this.materialLib.active.color), r.material.opacity = 1);
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
super.updateMatrixWorld(e);
|
|
1174
|
-
}
|
|
1175
|
-
}, Me = class extends y {
|
|
1176
|
-
constructor() {
|
|
1177
|
-
super(new T(1e5, 1e5, 2, 2), new te({
|
|
1178
|
-
visible: !1,
|
|
1179
|
-
wireframe: !0,
|
|
1180
|
-
side: p,
|
|
1181
|
-
transparent: !0,
|
|
1182
|
-
opacity: .1,
|
|
1183
|
-
toneMapped: !1
|
|
1184
|
-
})), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
|
|
1185
|
-
}
|
|
1186
|
-
updateMatrixWorld(e) {
|
|
1187
|
-
let t = this.space;
|
|
1188
|
-
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), Y.copy(K).applyQuaternion(t === "local" ? this.worldQuaternion : W), X.copy(q).applyQuaternion(t === "local" ? this.worldQuaternion : W), Z.copy(J).applyQuaternion(t === "local" ? this.worldQuaternion : W), H.copy(X), this.mode) {
|
|
1189
|
-
case "translate":
|
|
1190
|
-
case "scale":
|
|
1191
|
-
switch (this.axis) {
|
|
1192
|
-
case "X":
|
|
1193
|
-
H.copy(this.eye).cross(Y), G.copy(Y).cross(H);
|
|
1194
|
-
break;
|
|
1195
|
-
case "Y":
|
|
1196
|
-
H.copy(this.eye).cross(X), G.copy(X).cross(H);
|
|
1197
|
-
break;
|
|
1198
|
-
case "Z":
|
|
1199
|
-
H.copy(this.eye).cross(Z), G.copy(Z).cross(H);
|
|
1200
|
-
break;
|
|
1201
|
-
case "XY":
|
|
1202
|
-
G.copy(Z);
|
|
1203
|
-
break;
|
|
1204
|
-
case "YZ":
|
|
1205
|
-
G.copy(Y);
|
|
1206
|
-
break;
|
|
1207
|
-
case "XZ":
|
|
1208
|
-
H.copy(Z), G.copy(X);
|
|
1209
|
-
break;
|
|
1210
|
-
case "XYZ":
|
|
1211
|
-
case "E": G.set(0, 0, 0);
|
|
1212
|
-
}
|
|
1213
|
-
break;
|
|
1214
|
-
default: G.set(0, 0, 0);
|
|
1215
|
-
}
|
|
1216
|
-
G.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (ke.lookAt(I.set(0, 0, 0), G, H), this.quaternion.setFromRotationMatrix(ke)), super.updateMatrixWorld(e);
|
|
1217
|
-
}
|
|
1218
|
-
}, Ne = class {
|
|
1219
|
-
constructor() {
|
|
1220
|
-
this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
|
|
1221
|
-
}
|
|
1222
|
-
setSize() {}
|
|
1223
|
-
render() {
|
|
1224
|
-
console.error("THREE.Pass: .render() must be implemented in derived pass.");
|
|
1225
|
-
}
|
|
1226
|
-
dispose() {}
|
|
1227
|
-
}, Pe = new w(-1, 1, 1, -1, 0, 1), Fe = new class extends l {
|
|
1228
|
-
constructor() {
|
|
1229
|
-
super(), this.setAttribute("position", new h([
|
|
1230
|
-
-1,
|
|
1231
|
-
3,
|
|
1232
|
-
0,
|
|
1233
|
-
-1,
|
|
1234
|
-
-1,
|
|
1235
|
-
0,
|
|
1236
|
-
3,
|
|
1237
|
-
-1,
|
|
1238
|
-
0
|
|
1239
|
-
], 3)), this.setAttribute("uv", new h([
|
|
1240
|
-
0,
|
|
1241
|
-
2,
|
|
1242
|
-
0,
|
|
1243
|
-
0,
|
|
1244
|
-
2,
|
|
1245
|
-
0
|
|
1246
|
-
], 2));
|
|
1247
|
-
}
|
|
1248
|
-
}(), Ie = class {
|
|
1249
|
-
constructor(e) {
|
|
1250
|
-
this._mesh = new y(Fe, e);
|
|
1251
|
-
}
|
|
1252
|
-
dispose() {
|
|
1253
|
-
this._mesh.geometry.dispose();
|
|
1254
|
-
}
|
|
1255
|
-
render(e) {
|
|
1256
|
-
e.render(this._mesh, Pe);
|
|
1257
|
-
}
|
|
1258
|
-
get material() {
|
|
1259
|
-
return this._mesh.material;
|
|
1260
|
-
}
|
|
1261
|
-
set material(e) {
|
|
1262
|
-
this._mesh.material = e;
|
|
1263
|
-
}
|
|
1264
|
-
}, Le = {
|
|
1265
|
-
name: "CopyShader",
|
|
1266
|
-
uniforms: {
|
|
1267
|
-
tDiffuse: { value: null },
|
|
1268
|
-
opacity: { value: 1 }
|
|
1269
|
-
},
|
|
1270
|
-
vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
1271
|
-
fragmentShader: "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = opacity * texel;\n\n\n }"
|
|
1272
|
-
}, Re = class e extends Ne {
|
|
1273
|
-
constructor(e, t, n, r) {
|
|
1274
|
-
super(), this.renderScene = t, this.renderCamera = n, this.selectedObjects = r === void 0 ? [] : r, this.visibleEdgeColor = new u(1, 1, 1), this.hiddenEdgeColor = new u(.1, .04, .02), this.edgeGlow = 0, this.usePatternTexture = !1, this.patternTexture = null, this.edgeThickness = 1, this.edgeStrength = 3, this.downSampleRatio = 2, this.pulsePeriod = 0, this._visibilityCache = /* @__PURE__ */ new Map(), this._selectionCache = /* @__PURE__ */ new Set(), this.resolution = e === void 0 ? new k(256, 256) : new k(e.x, e.y);
|
|
1275
|
-
let i = Math.round(this.resolution.x / this.downSampleRatio), a = Math.round(this.resolution.y / this.downSampleRatio);
|
|
1276
|
-
this.renderTargetMaskBuffer = new j(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.depthMaterial = new b(), this.depthMaterial.side = p, this.depthMaterial.depthPacking = ne, this.depthMaterial.blending = x, this.prepareMaskMaterial = this._getPrepareMaskMaterial(), this.prepareMaskMaterial.side = p, this.prepareMaskMaterial.fragmentShader = s(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.renderTargetDepthBuffer = new j(this.resolution.x, this.resolution.y, { type: g }), this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth", this.renderTargetDepthBuffer.texture.generateMipmaps = !1, this.renderTargetMaskDownSampleBuffer = new j(i, a, { type: g }), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new j(i, a, { type: g }), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new j(Math.round(i / 2), Math.round(a / 2), { type: g }), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new j(i, a, { type: g }), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new j(Math.round(i / 2), Math.round(a / 2), { type: g }), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1, this.separableBlurMaterial1 = this._getSeparableBlurMaterial(4), this.separableBlurMaterial1.uniforms.texSize.value.set(i, a), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeparableBlurMaterial(4), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(i / 2), Math.round(a / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = 4, this.overlayMaterial = this._getOverlayMaterial();
|
|
1277
|
-
let o = Le;
|
|
1278
|
-
this.copyUniforms = ae.clone(o.uniforms), this.materialCopy = new D({
|
|
1279
|
-
uniforms: this.copyUniforms,
|
|
1280
|
-
vertexShader: o.vertexShader,
|
|
1281
|
-
fragmentShader: o.fragmentShader,
|
|
1282
|
-
blending: x,
|
|
1283
|
-
depthTest: !1,
|
|
1284
|
-
depthWrite: !1
|
|
1285
|
-
}), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new u(), this.oldClearAlpha = 1, this._fsQuad = new Ie(null), this.tempPulseColor1 = new u(), this.tempPulseColor2 = new u(), this.textureMatrix = new v();
|
|
1286
|
-
function s(e, t) {
|
|
1287
|
-
let n = t.isPerspectiveCamera ? "perspective" : "orthographic";
|
|
1288
|
-
return e.replace(/DEPTH_TO_VIEW_Z/g, n + "DepthToViewZ");
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
dispose() {
|
|
1292
|
-
this.renderTargetMaskBuffer.dispose(), this.renderTargetDepthBuffer.dispose(), this.renderTargetMaskDownSampleBuffer.dispose(), this.renderTargetBlurBuffer1.dispose(), this.renderTargetBlurBuffer2.dispose(), this.renderTargetEdgeBuffer1.dispose(), this.renderTargetEdgeBuffer2.dispose(), this.depthMaterial.dispose(), this.prepareMaskMaterial.dispose(), this.edgeDetectionMaterial.dispose(), this.separableBlurMaterial1.dispose(), this.separableBlurMaterial2.dispose(), this.overlayMaterial.dispose(), this.materialCopy.dispose(), this._fsQuad.dispose();
|
|
1293
|
-
}
|
|
1294
|
-
setSize(e, t) {
|
|
1295
|
-
this.renderTargetMaskBuffer.setSize(e, t), this.renderTargetDepthBuffer.setSize(e, t);
|
|
1296
|
-
let n = Math.round(e / this.downSampleRatio), r = Math.round(t / this.downSampleRatio);
|
|
1297
|
-
this.renderTargetMaskDownSampleBuffer.setSize(n, r), this.renderTargetBlurBuffer1.setSize(n, r), this.renderTargetEdgeBuffer1.setSize(n, r), this.separableBlurMaterial1.uniforms.texSize.value.set(n, r), n = Math.round(n / 2), r = Math.round(r / 2), this.renderTargetBlurBuffer2.setSize(n, r), this.renderTargetEdgeBuffer2.setSize(n, r), this.separableBlurMaterial2.uniforms.texSize.value.set(n, r);
|
|
1298
|
-
}
|
|
1299
|
-
render(t, n, r, i, a) {
|
|
1300
|
-
if (this.selectedObjects.length > 0) {
|
|
1301
|
-
t.getClearColor(this._oldClearColor), this.oldClearAlpha = t.getClearAlpha();
|
|
1302
|
-
let n = t.autoClear;
|
|
1303
|
-
t.autoClear = !1, a && t.state.buffers.stencil.setTest(!1), t.setClearColor(16777215, 1), this._updateSelectionCache(), this._changeVisibilityOfSelectedObjects(!1);
|
|
1304
|
-
let i = this.renderScene.background, o = this.renderScene.overrideMaterial;
|
|
1305
|
-
if (this.renderScene.background = null, this.renderScene.overrideMaterial = this.depthMaterial, t.setRenderTarget(this.renderTargetDepthBuffer), t.clear(), t.render(this.renderScene, this.renderCamera), this._changeVisibilityOfSelectedObjects(!0), this._visibilityCache.clear(), this._updateTextureMatrix(), this._changeVisibilityOfNonSelectedObjects(!1), this.renderScene.overrideMaterial = this.prepareMaskMaterial, this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near, this.renderCamera.far), this.prepareMaskMaterial.uniforms.depthTexture.value = this.renderTargetDepthBuffer.texture, this.prepareMaskMaterial.uniforms.textureMatrix.value = this.textureMatrix, t.setRenderTarget(this.renderTargetMaskBuffer), t.clear(), t.render(this.renderScene, this.renderCamera), this._changeVisibilityOfNonSelectedObjects(!0), this._visibilityCache.clear(), this._selectionCache.clear(), this.renderScene.background = i, this.renderScene.overrideMaterial = o, this._fsQuad.material = this.materialCopy, this.copyUniforms.tDiffuse.value = this.renderTargetMaskBuffer.texture, t.setRenderTarget(this.renderTargetMaskDownSampleBuffer), t.clear(), this._fsQuad.render(t), this.tempPulseColor1.copy(this.visibleEdgeColor), this.tempPulseColor2.copy(this.hiddenEdgeColor), this.pulsePeriod > 0) {
|
|
1306
|
-
let e = 1.25 / 2 + Math.cos(performance.now() * .01 / this.pulsePeriod) * .75 / 2;
|
|
1307
|
-
this.tempPulseColor1.multiplyScalar(e), this.tempPulseColor2.multiplyScalar(e);
|
|
1308
|
-
}
|
|
1309
|
-
this._fsQuad.material = this.edgeDetectionMaterial, this.edgeDetectionMaterial.uniforms.maskTexture.value = this.renderTargetMaskDownSampleBuffer.texture, this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height), this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value = this.tempPulseColor1, this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value = this.tempPulseColor2, t.setRenderTarget(this.renderTargetEdgeBuffer1), t.clear(), this._fsQuad.render(t), this._fsQuad.material = this.separableBlurMaterial1, this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = e.BlurDirectionX, this.separableBlurMaterial1.uniforms.kernelRadius.value = this.edgeThickness, t.setRenderTarget(this.renderTargetBlurBuffer1), t.clear(), this._fsQuad.render(t), this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetBlurBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = e.BlurDirectionY, t.setRenderTarget(this.renderTargetEdgeBuffer1), t.clear(), this._fsQuad.render(t), this._fsQuad.material = this.separableBlurMaterial2, this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial2.uniforms.direction.value = e.BlurDirectionX, t.setRenderTarget(this.renderTargetBlurBuffer2), t.clear(), this._fsQuad.render(t), this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetBlurBuffer2.texture, this.separableBlurMaterial2.uniforms.direction.value = e.BlurDirectionY, t.setRenderTarget(this.renderTargetEdgeBuffer2), t.clear(), this._fsQuad.render(t), this._fsQuad.material = this.overlayMaterial, this.overlayMaterial.uniforms.maskTexture.value = this.renderTargetMaskBuffer.texture, this.overlayMaterial.uniforms.edgeTexture1.value = this.renderTargetEdgeBuffer1.texture, this.overlayMaterial.uniforms.edgeTexture2.value = this.renderTargetEdgeBuffer2.texture, this.overlayMaterial.uniforms.patternTexture.value = this.patternTexture, this.overlayMaterial.uniforms.edgeStrength.value = this.edgeStrength, this.overlayMaterial.uniforms.edgeGlow.value = this.edgeGlow, this.overlayMaterial.uniforms.usePatternTexture.value = this.usePatternTexture, a && t.state.buffers.stencil.setTest(!0), t.setRenderTarget(r), this._fsQuad.render(t), t.setClearColor(this._oldClearColor, this.oldClearAlpha), t.autoClear = n;
|
|
1310
|
-
}
|
|
1311
|
-
this.renderToScreen && (this._fsQuad.material = this.materialCopy, this.copyUniforms.tDiffuse.value = r.texture, t.setRenderTarget(null), this._fsQuad.render(t));
|
|
1312
|
-
}
|
|
1313
|
-
_updateSelectionCache() {
|
|
1314
|
-
let e = this._selectionCache;
|
|
1315
|
-
function t(t) {
|
|
1316
|
-
t.isMesh && e.add(t);
|
|
1317
|
-
}
|
|
1318
|
-
e.clear();
|
|
1319
|
-
for (let e = 0; e < this.selectedObjects.length; e++) this.selectedObjects[e].traverse(t);
|
|
1320
|
-
}
|
|
1321
|
-
_changeVisibilityOfSelectedObjects(e) {
|
|
1322
|
-
let t = this._visibilityCache;
|
|
1323
|
-
for (let n of this._selectionCache) e === !0 ? n.visible = t.get(n) : (t.set(n, n.visible), n.visible = e);
|
|
1324
|
-
}
|
|
1325
|
-
_changeVisibilityOfNonSelectedObjects(e) {
|
|
1326
|
-
let t = this._visibilityCache, n = this._selectionCache;
|
|
1327
|
-
function r(r) {
|
|
1328
|
-
if (r.isPoints || r.isLine || r.isLine2) e === !0 ? r.visible = t.get(r) : (t.set(r, r.visible), r.visible = e);
|
|
1329
|
-
else if ((r.isMesh || r.isSprite) && !n.has(r)) {
|
|
1330
|
-
let n = r.visible;
|
|
1331
|
-
(e === !1 || t.get(r) === !0) && (r.visible = e), t.set(r, n);
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
this.renderScene.traverse(r);
|
|
1335
|
-
}
|
|
1336
|
-
_updateTextureMatrix() {
|
|
1337
|
-
this.textureMatrix.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), this.textureMatrix.multiply(this.renderCamera.projectionMatrix), this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse);
|
|
1338
|
-
}
|
|
1339
|
-
_getPrepareMaskMaterial() {
|
|
1340
|
-
return new D({
|
|
1341
|
-
uniforms: {
|
|
1342
|
-
depthTexture: { value: null },
|
|
1343
|
-
cameraNearFar: { value: new k(.5, .5) },
|
|
1344
|
-
textureMatrix: { value: null }
|
|
1345
|
-
},
|
|
1346
|
-
vertexShader: "#include <batching_pars_vertex>\n #include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n\n varying vec4 projTexCoord;\n varying vec4 vPosition;\n uniform mat4 textureMatrix;\n\n void main() {\n\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n\n vPosition = mvPosition;\n\n vec4 worldPosition = vec4( transformed, 1.0 );\n\n #ifdef USE_INSTANCING\n\n worldPosition = instanceMatrix * worldPosition;\n\n #endif\n\n worldPosition = modelMatrix * worldPosition;\n\n projTexCoord = textureMatrix * worldPosition;\n\n }",
|
|
1347
|
-
fragmentShader: "#include <packing>\n varying vec4 vPosition;\n varying vec4 projTexCoord;\n uniform sampler2D depthTexture;\n uniform vec2 cameraNearFar;\n\n void main() {\n\n float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n float viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n float depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n gl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n }"
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
_getEdgeDetectionMaterial() {
|
|
1351
|
-
return new D({
|
|
1352
|
-
uniforms: {
|
|
1353
|
-
maskTexture: { value: null },
|
|
1354
|
-
texSize: { value: new k(.5, .5) },
|
|
1355
|
-
visibleEdgeColor: { value: new A(1, 1, 1) },
|
|
1356
|
-
hiddenEdgeColor: { value: new A(1, 1, 1) }
|
|
1357
|
-
},
|
|
1358
|
-
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
1359
|
-
fragmentShader: "varying vec2 vUv;\n\n uniform sampler2D maskTexture;\n uniform vec2 texSize;\n uniform vec3 visibleEdgeColor;\n uniform vec3 hiddenEdgeColor;\n\n void main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r)*0.5;\n float diff2 = (c3.r - c4.r)*0.5;\n float d = length( vec2(diff1, diff2) );\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibilityFactor = min(a1, a2);\n vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n }"
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
_getSeparableBlurMaterial(e) {
|
|
1363
|
-
return new D({
|
|
1364
|
-
defines: { MAX_RADIUS: e },
|
|
1365
|
-
uniforms: {
|
|
1366
|
-
colorTexture: { value: null },
|
|
1367
|
-
texSize: { value: new k(.5, .5) },
|
|
1368
|
-
direction: { value: new k(.5, .5) },
|
|
1369
|
-
kernelRadius: { value: 1 }
|
|
1370
|
-
},
|
|
1371
|
-
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
1372
|
-
fragmentShader: "#include <common>\n varying vec2 vUv;\n uniform sampler2D colorTexture;\n uniform vec2 texSize;\n uniform vec2 direction;\n uniform float kernelRadius;\n\n float gaussianPdf(in float x, in float sigma) {\n return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n }\n\n void main() {\n vec2 invSize = 1.0 / texSize;\n float sigma = kernelRadius/2.0;\n float weightSum = gaussianPdf(0.0, sigma);\n vec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n vec2 uvOffset = delta;\n for( int i = 1; i <= MAX_RADIUS; i ++ ) {\n float x = kernelRadius * float(i) / float(MAX_RADIUS);\n float w = gaussianPdf(x, sigma);\n vec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n vec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n diffuseSum += ((sample1 + sample2) * w);\n weightSum += (2.0 * w);\n uvOffset += delta;\n }\n gl_FragColor = diffuseSum/weightSum;\n }"
|
|
1373
|
-
});
|
|
1374
|
-
}
|
|
1375
|
-
_getOverlayMaterial() {
|
|
1376
|
-
return new D({
|
|
1377
|
-
uniforms: {
|
|
1378
|
-
maskTexture: { value: null },
|
|
1379
|
-
edgeTexture1: { value: null },
|
|
1380
|
-
edgeTexture2: { value: null },
|
|
1381
|
-
patternTexture: { value: null },
|
|
1382
|
-
edgeStrength: { value: 1 },
|
|
1383
|
-
edgeGlow: { value: 1 },
|
|
1384
|
-
usePatternTexture: { value: 0 }
|
|
1385
|
-
},
|
|
1386
|
-
vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
1387
|
-
fragmentShader: "varying vec2 vUv;\n\n uniform sampler2D maskTexture;\n uniform sampler2D edgeTexture1;\n uniform sampler2D edgeTexture2;\n uniform sampler2D patternTexture;\n uniform float edgeStrength;\n uniform float edgeGlow;\n uniform bool usePatternTexture;\n\n void main() {\n vec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n vec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n vec4 maskColor = texture2D(maskTexture, vUv);\n vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n vec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n if(usePatternTexture)\n finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n gl_FragColor = finalColor;\n }",
|
|
1388
|
-
blending: s,
|
|
1389
|
-
depthTest: !1,
|
|
1390
|
-
depthWrite: !1,
|
|
1391
|
-
transparent: !0
|
|
1392
|
-
});
|
|
1393
|
-
}
|
|
1394
|
-
};
|
|
1395
|
-
Re.BlurDirectionX = new k(1, 0), Re.BlurDirectionY = new k(0, 1);
|
|
1
|
+
import { a as e, c as t, l as n, r } from "./panels-DFsnKBKK.mjs";
|
|
2
|
+
import i from "@mavonengine/core/Editor/EditorHelper";
|
|
3
|
+
import a from "@mavonengine/core/Game";
|
|
4
|
+
import { SCENE_SAVE_PATH as o } from "@mavonengine/core/Plugins/types";
|
|
5
|
+
import s from "@mavonengine/core/Utils/EventEmitter";
|
|
6
|
+
import { BoxGeometry as c, BufferGeometry as l, EdgesGeometry as u, Float32BufferAttribute as d, Group as f, Line as p, LineBasicMaterial as m, LineLoop as h, LineSegments as g, Matrix4 as _, Mesh as v, Object3D as y, Vector2 as b, Vector3 as x } from "three";
|
|
7
|
+
import { FlyControls as S } from "three/examples/jsm/controls/FlyControls.js";
|
|
8
|
+
import { TransformControls as C } from "three/examples/jsm/controls/TransformControls.js";
|
|
9
|
+
import { OutlinePass as w } from "three/examples/jsm/postprocessing/OutlinePass.js";
|
|
10
|
+
import { lightType as T, primitiveType as E } from "@mavonengine/core/Scene/builtinSceneObjects";
|
|
11
|
+
import { SCENE_FORMAT_VERSION as D } from "@mavonengine/core/Scene/types";
|
|
1396
12
|
// src/Editor/demoScene.ts
|
|
1397
|
-
var
|
|
1398
|
-
function
|
|
13
|
+
var O = "main";
|
|
14
|
+
function k(e, t, n, r) {
|
|
1399
15
|
return {
|
|
1400
16
|
id: e,
|
|
1401
17
|
type: t,
|
|
@@ -1415,19 +31,19 @@ function $(e, t, n, r) {
|
|
|
1415
31
|
...r ? { props: r } : {}
|
|
1416
32
|
};
|
|
1417
33
|
}
|
|
1418
|
-
function
|
|
1419
|
-
let e = 5 * .707, t = (e, t, n) =>
|
|
34
|
+
function A() {
|
|
35
|
+
let e = 5 * .707, t = (e, t, n) => k(e, E(t), n, { castShadow: !0 });
|
|
1420
36
|
return {
|
|
1421
|
-
version:
|
|
1422
|
-
name:
|
|
37
|
+
version: D,
|
|
38
|
+
name: O,
|
|
1423
39
|
settings: {},
|
|
1424
40
|
objects: [
|
|
1425
|
-
|
|
41
|
+
k("ambient_light", T("AmbientLight"), [
|
|
1426
42
|
0,
|
|
1427
43
|
5,
|
|
1428
44
|
0
|
|
1429
45
|
]),
|
|
1430
|
-
|
|
46
|
+
k("sun", T("DirectionalLightShadow"), [
|
|
1431
47
|
10,
|
|
1432
48
|
15,
|
|
1433
49
|
5
|
|
@@ -1435,7 +51,7 @@ function ze() {
|
|
|
1435
51
|
intensity: 5,
|
|
1436
52
|
castShadow: !0
|
|
1437
53
|
}),
|
|
1438
|
-
|
|
54
|
+
k("ground", E("Plane"), [
|
|
1439
55
|
0,
|
|
1440
56
|
0,
|
|
1441
57
|
0
|
|
@@ -1493,34 +109,195 @@ function ze() {
|
|
|
1493
109
|
]
|
|
1494
110
|
};
|
|
1495
111
|
}
|
|
112
|
+
// src/Editor/Network/SyncStore.ts
|
|
113
|
+
var j = class {
|
|
114
|
+
constructor(e = 250, n = t) {
|
|
115
|
+
this.intervalMs = e, this.load = n, this.state = {}, this.listeners = /* @__PURE__ */ new Set(), this.loading = !1, this.get = () => this.state, this.subscribe = (e) => (this.listeners.add(e), this.timer || (this.timer = setInterval(() => void this.refresh(), this.intervalMs), this.refresh()), () => {
|
|
116
|
+
this.listeners.delete(e), !this.listeners.size && this.timer && (clearInterval(this.timer), this.timer = void 0);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async refresh() {
|
|
120
|
+
if (!this.loading) {
|
|
121
|
+
this.loading = !0;
|
|
122
|
+
try {
|
|
123
|
+
this.state = { sync: await this.load() };
|
|
124
|
+
} catch (e) {
|
|
125
|
+
let t = e.message;
|
|
126
|
+
if (this.state.error === t && !this.state.sync) return;
|
|
127
|
+
this.state = { error: t };
|
|
128
|
+
} finally {
|
|
129
|
+
this.loading = !1;
|
|
130
|
+
}
|
|
131
|
+
this.listeners.forEach((e) => e());
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}, M = {
|
|
135
|
+
synced: 5163440,
|
|
136
|
+
stale: 13537656,
|
|
137
|
+
untracked: 8947848
|
|
138
|
+
}, N = 31436, P = 16777215, F = 16009031, I = 96, L = 2e3, R = .01, z = "editor-network-overlay";
|
|
139
|
+
function B(e, t, n, r) {
|
|
140
|
+
if (n) {
|
|
141
|
+
let t = r ? n.players.find((e) => e.id === r) : void 0;
|
|
142
|
+
if (t) return t.id === e.id || t.tracked.includes(e.id) ? "synced" : "untracked";
|
|
143
|
+
let i = n.entities.find((t) => t.id === e.id);
|
|
144
|
+
if (i && !i.player && i.trackedBy === 0 && n.players.length > 0) return "untracked";
|
|
145
|
+
}
|
|
146
|
+
return t !== null && t - e.tick > 1 ? "stale" : "synced";
|
|
147
|
+
}
|
|
148
|
+
function V() {
|
|
149
|
+
let e = {
|
|
150
|
+
ghosts: !1,
|
|
151
|
+
rings: !1,
|
|
152
|
+
viewAs: null
|
|
153
|
+
};
|
|
154
|
+
try {
|
|
155
|
+
return {
|
|
156
|
+
...e,
|
|
157
|
+
...JSON.parse(localStorage.getItem(z) ?? "{}"),
|
|
158
|
+
viewAs: null
|
|
159
|
+
};
|
|
160
|
+
} catch {
|
|
161
|
+
return e;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
var H = class extends s {
|
|
165
|
+
constructor(e = new j(), t = V()) {
|
|
166
|
+
super(), this.group = new f(), this.ghosts = /* @__PURE__ */ new Map(), this.rings = /* @__PURE__ */ new Map(), this.errorMaterial = U(F), this.ringMaterial = U(N), this.ringSelectedMaterial = U(P), this.sync = e, this._options = t, this.group.name = "NetworkOverlay", this.group.userData.isEditorInternal = !0;
|
|
167
|
+
let n = new c(1, 1, 1);
|
|
168
|
+
n.translate(0, .5, 0), this.boxGeometry = new u(n), n.dispose();
|
|
169
|
+
let r = [];
|
|
170
|
+
for (let e = 0; e < I; e++) {
|
|
171
|
+
let t = e / I * Math.PI * 2;
|
|
172
|
+
r.push(Math.cos(t), 0, Math.sin(t));
|
|
173
|
+
}
|
|
174
|
+
this.ringGeometry = new l().setAttribute("position", new d(r, 3)), this.materials = {
|
|
175
|
+
synced: U(M.synced),
|
|
176
|
+
stale: U(M.stale),
|
|
177
|
+
untracked: U(M.untracked)
|
|
178
|
+
}, this.applyOptions();
|
|
179
|
+
}
|
|
180
|
+
get options() {
|
|
181
|
+
return this._options;
|
|
182
|
+
}
|
|
183
|
+
setOptions(e) {
|
|
184
|
+
this._options = {
|
|
185
|
+
...this._options,
|
|
186
|
+
...e
|
|
187
|
+
};
|
|
188
|
+
try {
|
|
189
|
+
localStorage.setItem(z, JSON.stringify({
|
|
190
|
+
ghosts: this._options.ghosts,
|
|
191
|
+
rings: this._options.rings
|
|
192
|
+
}));
|
|
193
|
+
} catch {}
|
|
194
|
+
this.applyOptions(), this.trigger("changed", this._options);
|
|
195
|
+
}
|
|
196
|
+
get active() {
|
|
197
|
+
return this._options.ghosts || this._options.rings;
|
|
198
|
+
}
|
|
199
|
+
applyOptions() {
|
|
200
|
+
let e = a.instance().scene;
|
|
201
|
+
this.active && !this.group.parent ? (e.add(this.group), this.unsubscribe = this.sync.subscribe(() => {})) : !this.active && this.group.parent && (e.remove(this.group), this.unsubscribe?.(), this.unsubscribe = void 0);
|
|
202
|
+
}
|
|
203
|
+
update() {
|
|
204
|
+
this.active && (this.group.parent || a.instance().scene.add(this.group), this.updateGhosts(), this.updateRings());
|
|
205
|
+
}
|
|
206
|
+
updateGhosts() {
|
|
207
|
+
let e = a.instance().network, t = this._options.ghosts ? e?.serverView : void 0, { sync: n } = this.sync.get(), r = a.instance().world.entities.items, i = performance.now(), o = /* @__PURE__ */ new Set();
|
|
208
|
+
for (let e of t?.entities.values() ?? []) {
|
|
209
|
+
let a = r.get(e.id);
|
|
210
|
+
if (!a && i - e.receivedAt > L) continue;
|
|
211
|
+
o.add(e.id);
|
|
212
|
+
let s = this.ghosts.get(e.id) ?? this.createGhost(e.id);
|
|
213
|
+
s.box.position.set(e.position.x, e.position.y, e.position.z), s.box.rotation.set(e.rotation.x, e.rotation.y, e.rotation.z), s.box.scale.set(e.scale.x, e.scale.y * 2, e.scale.z), s.box.material = this.materials[B(e, t.tick, n, this._options.viewAs)];
|
|
214
|
+
let c = a ? a.position.distanceTo(s.box.position) : 0;
|
|
215
|
+
if (s.error.visible = c > R, s.error.visible) {
|
|
216
|
+
let t = s.error.geometry.getAttribute("position");
|
|
217
|
+
t.setXYZ(0, e.position.x, e.position.y, e.position.z), t.setXYZ(1, a.position.x, a.position.y, a.position.z), t.needsUpdate = !0;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
for (let [e, t] of this.ghosts) o.has(e) || (this.group.remove(t.box, t.error), t.error.geometry.dispose(), this.ghosts.delete(e));
|
|
221
|
+
}
|
|
222
|
+
createGhost(e) {
|
|
223
|
+
let t = W(new g(this.boxGeometry, this.materials.synced));
|
|
224
|
+
t.name = `ServerGhost:${e}`;
|
|
225
|
+
let n = new l().setAttribute("position", new d([
|
|
226
|
+
0,
|
|
227
|
+
0,
|
|
228
|
+
0,
|
|
229
|
+
0,
|
|
230
|
+
0,
|
|
231
|
+
0
|
|
232
|
+
], 3)), r = W(new p(n, this.errorMaterial));
|
|
233
|
+
r.frustumCulled = !1, r.visible = !1;
|
|
234
|
+
let i = {
|
|
235
|
+
box: t,
|
|
236
|
+
error: r
|
|
237
|
+
};
|
|
238
|
+
return this.group.add(t, r), this.ghosts.set(e, i), i;
|
|
239
|
+
}
|
|
240
|
+
updateRings() {
|
|
241
|
+
let { sync: e } = this.sync.get(), t = this._options.rings && e?.syncDistance ? e.players : [], n = /* @__PURE__ */ new Set();
|
|
242
|
+
for (let r of t) {
|
|
243
|
+
n.add(r.id);
|
|
244
|
+
let t = this.rings.get(r.id);
|
|
245
|
+
t || (t = W(new h(this.ringGeometry, this.ringMaterial)), t.name = `SyncRing:${r.id}`, this.rings.set(r.id, t), this.group.add(t)), t.position.set(r.position.x, r.position.y + .05, r.position.z), t.scale.setScalar(e.syncDistance), t.material = r.id === this._options.viewAs ? this.ringSelectedMaterial : this.ringMaterial;
|
|
246
|
+
}
|
|
247
|
+
for (let [e, t] of this.rings) n.has(e) || (this.group.remove(t), this.rings.delete(e));
|
|
248
|
+
}
|
|
249
|
+
get counts() {
|
|
250
|
+
return {
|
|
251
|
+
ghosts: this.ghosts.size,
|
|
252
|
+
rings: this.rings.size
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
dispose() {
|
|
256
|
+
this.unsubscribe?.(), this.unsubscribe = void 0, this.group.removeFromParent(), this.ghosts.forEach((e) => e.error.geometry.dispose()), this.ghosts.clear(), this.rings.clear(), this.boxGeometry.dispose(), this.ringGeometry.dispose(), Object.values(this.materials).forEach((e) => e.dispose()), this.errorMaterial.dispose(), this.ringMaterial.dispose(), this.ringSelectedMaterial.dispose();
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
function U(e) {
|
|
260
|
+
return new m({
|
|
261
|
+
color: e,
|
|
262
|
+
depthTest: !1,
|
|
263
|
+
depthWrite: !1,
|
|
264
|
+
transparent: !0,
|
|
265
|
+
toneMapped: !1
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function W(e) {
|
|
269
|
+
return e.raycast = () => {}, e.renderOrder = 999, e.userData.isEditorInternal = !0, e;
|
|
270
|
+
}
|
|
1496
271
|
// src/Editor.ts
|
|
1497
|
-
var
|
|
272
|
+
var G = class t extends s {
|
|
1498
273
|
static registerPanel(e) {
|
|
1499
|
-
return
|
|
274
|
+
return r(e);
|
|
1500
275
|
}
|
|
1501
276
|
static registerListener() {
|
|
1502
|
-
|
|
1503
|
-
(e.code === "Insert" || e.code === "Period") && (
|
|
277
|
+
a.instance().input.on("keydown", (e) => {
|
|
278
|
+
(e.code === "Insert" || e.code === "Period") && (a.instance().editor = new t());
|
|
1504
279
|
});
|
|
1505
280
|
}
|
|
1506
281
|
constructor() {
|
|
1507
|
-
super(), this.activeToolMode = "translate", this.shadeMode = "solid", this.originalMaterials = /* @__PURE__ */ new Map(), this.shadeOverrideMaterials = /* @__PURE__ */ new Map(), this.flatColors = /* @__PURE__ */ new Map(), this.helpers = [], this.lightHelpers = [], this._showHelpers = !0, this.abort = new AbortController(), this.activeAssetCategory = "Object",
|
|
1508
|
-
let e =
|
|
1509
|
-
e ? e.rebuild() : this.clearGame(), this.initEditorScene(), e || this.openDefaultScene(),
|
|
1510
|
-
this.reactRoot = e(
|
|
282
|
+
super(), this.activeToolMode = "translate", this.shadeMode = "solid", this.originalMaterials = /* @__PURE__ */ new Map(), this.shadeOverrideMaterials = /* @__PURE__ */ new Map(), this.flatColors = /* @__PURE__ */ new Map(), this.helpers = [], this.lightHelpers = [], this._showHelpers = !0, this.abort = new AbortController(), this.activeAssetCategory = "Object", a.instance().editor = this, a.instance().logger?.info("Booting Editor"), a.instance().trigger("editorBoot", this), a.instance().trigger("uiDestroy", this);
|
|
283
|
+
let e = a.instance().activeScene;
|
|
284
|
+
e ? e.rebuild() : this.clearGame(), this.initEditorScene(), e || this.openDefaultScene(), a.instance().contextMenuAbort.abort(), a.instance().uiRoot.innerHTML = "", a.instance().uiRoot.style.opacity = "1", document.title = "MavonEngine | Editor", document.getElementsByTagName("body")[0].removeAttribute("onContextMenu"), Promise.all([import("./mount-DAt7SAfm.mjs"), import("./global-CRVwkYpo.mjs").then((e) => e.t)]).then(([{ mountEditorUI: e }]) => {
|
|
285
|
+
this.reactRoot = e(a.instance().uiRoot);
|
|
286
|
+
}).catch((e) => {
|
|
287
|
+
a.instance().logger?.error(`The editor's UI could not be loaded: ${e?.stack ?? e}`);
|
|
1511
288
|
});
|
|
1512
289
|
}
|
|
1513
290
|
initEditorScene() {
|
|
1514
|
-
|
|
291
|
+
a.instance().camera.instance.position.set(20, 10, 20), a.instance().camera.instance.rotation.set(0, 0, 0), a.instance().camera.instance.rotateY(Math.PI / 360 * 90), a.instance().camera.instance.rotateX(Math.PI / 360 * -45), this.outlinePass = new w(new b(a.instance().sizes.width, a.instance().sizes.height), a.instance().scene, a.instance().camera.instance), a.instance().renderer.composer.addPass(this.outlinePass), this.initFlyControls(), this.networkOverlay = new H(), this.watchScene(a.instance().activeScene), a.instance().on("sceneLoaded", (e) => {
|
|
1515
292
|
this.deselect(), this.watchScene(e), this.trigger("sceneChanged");
|
|
1516
293
|
}), window.addEventListener("keydown", (e) => {
|
|
1517
294
|
(e.ctrlKey || e.metaKey) && e.code === "KeyS" && (e.preventDefault(), this.saveScene());
|
|
1518
|
-
}, { signal: this.abort.signal }), this.trigger("sceneChanged"),
|
|
1519
|
-
e.target ===
|
|
1520
|
-
}),
|
|
295
|
+
}, { signal: this.abort.signal }), this.trigger("sceneChanged"), a.instance().input.on("mousedown", (e) => {
|
|
296
|
+
e.target === a.instance().canvas && this.handleCanvasClick(e);
|
|
297
|
+
}), a.instance().input.on("keydown", (e) => {
|
|
1521
298
|
e.code === "Escape" && this.activeItem && this.deselect();
|
|
1522
299
|
}), this.handleItemDelete(), this.on("setTransformMode", (e) => {
|
|
1523
|
-
this.activeToolMode = e, this.transformControls?.setMode(e),
|
|
300
|
+
this.activeToolMode = e, this.transformControls?.setMode(e), a.instance().logger?.info(`Setting editor tool mode: ${e}`);
|
|
1524
301
|
}), this.on("setShadeMode", (e) => {
|
|
1525
302
|
this.applyShadeMode(e);
|
|
1526
303
|
}), this.on("assetDropped", () => {
|
|
@@ -1528,27 +305,27 @@ var Be = class s extends o {
|
|
|
1528
305
|
}), this.initAssetsFilter();
|
|
1529
306
|
}
|
|
1530
307
|
initAssetsFilter() {
|
|
1531
|
-
this.availableAssetCategories = [...new Set(Object.entries(
|
|
308
|
+
this.availableAssetCategories = [...new Set(Object.entries(a.instance().resources.items).map(([e, t]) => t.constructor.name))];
|
|
1532
309
|
}
|
|
1533
310
|
setActiveAssetCategory(e) {
|
|
1534
311
|
this.activeAssetCategory = e;
|
|
1535
312
|
}
|
|
1536
313
|
applyShadeMode(e) {
|
|
1537
|
-
this.shadeMode = e,
|
|
314
|
+
this.shadeMode = e, n(a.instance().scene, e, this.originalMaterials, this.shadeOverrideMaterials, this.flatColors);
|
|
1538
315
|
}
|
|
1539
316
|
initFlyControls() {
|
|
1540
|
-
this.flyControls = new
|
|
317
|
+
this.flyControls = new S(a.instance().camera.instance, a.instance().canvas), this.flyControls.autoForward = !1, this.flyControls.dragToLook = !0, this.flyControls.movementSpeed = 10, this.flyControls.rollSpeed = .5;
|
|
1541
318
|
}
|
|
1542
319
|
handleItemDelete() {
|
|
1543
|
-
|
|
320
|
+
a.instance().input.on("keydown", (e) => {
|
|
1544
321
|
if (e.code === "Delete" && this.activeItem) {
|
|
1545
322
|
let e = this.activeItem;
|
|
1546
|
-
for (; e.parent && e.parent !==
|
|
323
|
+
for (; e.parent && e.parent !== a.instance().scene;) e = e.parent;
|
|
1547
324
|
e.traverse((e) => {
|
|
1548
|
-
e instanceof
|
|
325
|
+
e instanceof v && (e.geometry?.dispose(), Array.isArray(e.material) ? e.material.forEach((e) => e.dispose()) : e.material?.dispose());
|
|
1549
326
|
}), this.deselect();
|
|
1550
|
-
let t =
|
|
1551
|
-
n &&
|
|
327
|
+
let t = i.from(e), n = a.instance().activeScene, r = n?.entryOfObject3D(e) ?? (t?.owner && n?.getEntries().find((e) => e.object === t.owner));
|
|
328
|
+
n && r ? n.remove(r.data.id) : t?.owner ? t.owner.destroy() : (t && (t.dispose(), this.helpers = this.helpers.filter((e) => e !== t)), a.instance().scene.remove(e)), this.trigger("sceneChanged");
|
|
1552
329
|
}
|
|
1553
330
|
});
|
|
1554
331
|
}
|
|
@@ -1561,37 +338,37 @@ var Be = class s extends o {
|
|
|
1561
338
|
handleCanvasClick(e) {
|
|
1562
339
|
if (e.button === 0) {
|
|
1563
340
|
if (this.transformControls && (this.transformControls.dragging || this.transformControls.axis !== null)) return;
|
|
1564
|
-
let e =
|
|
1565
|
-
e instanceof
|
|
341
|
+
let e = a.instance().input.getPointerWorldPosition(void 0, null, !0);
|
|
342
|
+
e instanceof y ? this.selectObject(e) : this.deselect();
|
|
1566
343
|
}
|
|
1567
344
|
}
|
|
1568
345
|
handleHelperTool() {
|
|
1569
346
|
if (!this.transformControls) {
|
|
1570
|
-
this.transformControls = new
|
|
347
|
+
this.transformControls = new C(a.instance().camera.instance, a.instance().canvas), this.transformControls.addEventListener("dragging-changed", (e) => {
|
|
1571
348
|
this.flyControls.enabled = !e.value, e.value || this.initFlyControls();
|
|
1572
349
|
});
|
|
1573
350
|
let e = this.transformControls.getHelper();
|
|
1574
|
-
e.userData.isEditorInternal = !0,
|
|
351
|
+
e.userData.isEditorInternal = !0, a.instance().scene.add(e);
|
|
1575
352
|
}
|
|
1576
353
|
this.transformControls.setMode(this.activeToolMode), this.transformControls.attach(this.activeItem);
|
|
1577
354
|
}
|
|
1578
355
|
addPanel(e) {
|
|
1579
|
-
return
|
|
356
|
+
return r(e);
|
|
1580
357
|
}
|
|
1581
358
|
removePanel(t) {
|
|
1582
359
|
e(t);
|
|
1583
360
|
}
|
|
1584
361
|
saveScene(e = fetch) {
|
|
1585
|
-
let t =
|
|
1586
|
-
if (!t) return
|
|
362
|
+
let t = a.instance().activeScene;
|
|
363
|
+
if (!t) return a.instance().logger?.warn("No scene to save"), Promise.resolve(!1);
|
|
1587
364
|
if (this.saving) return this.saving;
|
|
1588
365
|
let n = t.source ?? "main", r = t.serialize();
|
|
1589
366
|
this.trigger("sceneSaving", { name: n });
|
|
1590
|
-
let
|
|
367
|
+
let i = (e) => (a.instance().logger?.error(`Could not save scene ${n}: ${e}`), this.trigger("sceneSaveFailed", {
|
|
1591
368
|
name: n,
|
|
1592
369
|
error: e
|
|
1593
370
|
}), !1);
|
|
1594
|
-
return this.saving = e(
|
|
371
|
+
return this.saving = e(o, {
|
|
1595
372
|
method: "POST",
|
|
1596
373
|
headers: { "Content-Type": "application/json" },
|
|
1597
374
|
body: JSON.stringify({
|
|
@@ -1599,29 +376,29 @@ var Be = class s extends o {
|
|
|
1599
376
|
scene: r
|
|
1600
377
|
})
|
|
1601
378
|
}).then(async (e) => {
|
|
1602
|
-
let
|
|
1603
|
-
return e.ok ? (t.source = n, t.markSaved(r),
|
|
379
|
+
let o = await e.json().catch(() => ({}));
|
|
380
|
+
return e.ok ? (t.source = n, t.markSaved(r), a.instance().logger?.info(`Saved scene ${n} to ${o.file ?? n}`), this.trigger("sceneSaved", {
|
|
1604
381
|
name: n,
|
|
1605
|
-
file:
|
|
1606
|
-
}), !0) : o
|
|
1607
|
-
}, (e) =>
|
|
382
|
+
file: o.file
|
|
383
|
+
}), !0) : i(o.error ?? `${e.status} ${e.statusText}`);
|
|
384
|
+
}, (e) => i(e.message)).finally(() => {
|
|
1608
385
|
this.saving = void 0;
|
|
1609
386
|
}), this.saving;
|
|
1610
387
|
}
|
|
1611
388
|
async openDefaultScene() {
|
|
1612
389
|
try {
|
|
1613
|
-
await
|
|
390
|
+
await a.instance().openScene(O);
|
|
1614
391
|
} catch {
|
|
1615
|
-
|
|
392
|
+
a.instance().logger?.info(`No scenes/${O}.json yet, opening a demo scene. Save it with Ctrl+S`), a.instance().loadScene(A(), O);
|
|
1616
393
|
}
|
|
1617
394
|
}
|
|
1618
395
|
watchScene(e) {
|
|
1619
396
|
e?.on("changed", () => this.trigger("sceneChanged"));
|
|
1620
397
|
}
|
|
1621
398
|
clearGame() {
|
|
1622
|
-
|
|
1623
|
-
e instanceof
|
|
1624
|
-
}),
|
|
399
|
+
a.instance().world.destroy(), a.instance().world.entities.items.clear(), a.instance().scene.traverse((e) => {
|
|
400
|
+
e instanceof v && (e.geometry?.dispose(), Array.isArray(e.material) ? e.material.forEach((e) => e.dispose()) : e.material?.dispose());
|
|
401
|
+
}), a.instance().scene.clear();
|
|
1625
402
|
}
|
|
1626
403
|
addHelper(e) {
|
|
1627
404
|
this.helpers.push(e), this._showHelpers || (e.mesh.visible = !1, e.label.domElement.style.display = "none");
|
|
@@ -1641,15 +418,15 @@ var Be = class s extends o {
|
|
|
1641
418
|
}), this.lightHelpers.forEach((t) => t.visible = e);
|
|
1642
419
|
}
|
|
1643
420
|
update(e) {
|
|
1644
|
-
this.updateCamera(e), this.helpers.forEach((t) => t.update(e));
|
|
421
|
+
this.updateCamera(e), this.helpers.forEach((t) => t.update(e)), this.networkOverlay.update();
|
|
1645
422
|
}
|
|
1646
423
|
updateCamera(e) {
|
|
1647
424
|
this.flyControls.update(e);
|
|
1648
|
-
let t =
|
|
1649
|
-
t.getWorldDirection(n), t.quaternion.setFromRotationMatrix(new
|
|
425
|
+
let t = a.instance().camera.instance, n = new x();
|
|
426
|
+
t.getWorldDirection(n), t.quaternion.setFromRotationMatrix(new _().lookAt(new x(), n, new x(0, 1, 0)));
|
|
1650
427
|
}
|
|
1651
428
|
destroy() {
|
|
1652
|
-
this.abort.abort(), this.reactRoot.unmount(), this.outlinePass.dispose(), this.shadeOverrideMaterials.forEach((e) => e.dispose()), this.shadeOverrideMaterials.clear(), this.originalMaterials.clear(), this.flatColors.clear();
|
|
429
|
+
this.abort.abort(), this.reactRoot.unmount(), this.outlinePass.dispose(), this.networkOverlay.dispose(), this.shadeOverrideMaterials.forEach((e) => e.dispose()), this.shadeOverrideMaterials.clear(), this.originalMaterials.clear(), this.flatColors.clear();
|
|
1653
430
|
}
|
|
1654
431
|
};
|
|
1655
|
-
export {
|
|
432
|
+
export { G as default, r as registerEditorPanel, e as unregisterEditorPanel };
|