@yangyongtao/gaea 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +158 -67
  2. package/package.json +28 -7
  3. package/public/Gaea.apple-touch-icon.png +0 -0
  4. package/public/Gaea.apple-touch-icon.png.import +35 -0
  5. package/public/Gaea.audio.worklet.js +211 -0
  6. package/public/Gaea.html +245 -0
  7. package/public/Gaea.icon.png +0 -0
  8. package/public/Gaea.icon.png.import +35 -0
  9. package/public/Gaea.js +782 -0
  10. package/public/Gaea.png +0 -0
  11. package/public/Gaea.png.import +35 -0
  12. package/public/Gaea.worker.js +1 -0
  13. package/public/GaeaApp.html +275 -0
  14. package/public/GaeaMethods.js +4342 -0
  15. package/public/GaeaModule.html +276 -0
  16. package/public/config.js +76 -0
  17. package/public/constants.js +185 -0
  18. package/public/favicon.ico +0 -0
  19. package/public/image/1.png +0 -0
  20. package/public/image/12-min-min.gif +0 -0
  21. package/public/image/3.png +0 -0
  22. package/public/image/labelImg//345/217/263/350/276/271.png +0 -0
  23. package/public/image/labelImg//345/267/246/350/276/271.png +0 -0
  24. package/public/image/labelImg//346/260/264/344/275/215.png +0 -0
  25. package/public/image/screenIcon//345/205/266/344/273/226.png +0 -0
  26. package/public/image/screenIcon//345/256/211/345/205/250/347/233/221/346/265/213/350/201/232/345/220/210-/347/272/242.png +0 -0
  27. package/public/image/screenIcon//345/256/211/345/205/250/347/233/221/346/265/213/350/201/232/345/220/210-/347/273/277.png +0 -0
  28. package/public/image/screenIcon//346/212/242/351/231/251/345/215/225/344/275/215.png +0 -0
  29. package/public/image/screenIcon//346/226/255/351/235/242.png +0 -0
  30. package/public/image/screenIcon//346/227/240/344/272/272/346/234/272.png +0 -0
  31. package/public/image/screenIcon//346/227/240/344/272/272/346/234/272/345/237/272/345/234/260.png +0 -0
  32. package/public/image/screenIcon//346/260/264/345/272/223/347/253/231.png +0 -0
  33. package/public/image/screenIcon//346/260/264/346/226/207/346/265/213/347/253/231.png +0 -0
  34. package/public/image/screenIcon//346/260/264/351/227/270.png +0 -0
  35. package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/346/227/240/346/225/260/346/215/256.png +0 -0
  36. package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/346/255/243/345/270/270.png +0 -0
  37. package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/350/266/205/344/277/235.png +0 -0
  38. package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/350/266/205/350/255/246.png +0 -0
  39. package/public/image/screenIcon//346/263/265/347/253/231-/347/201/260.png +0 -0
  40. package/public/image/screenIcon//346/263/265/347/253/231-/347/273/277.png +0 -0
  41. package/public/image/screenIcon//346/265/201/351/207/217/346/265/213/347/253/231.png +0 -0
  42. package/public/image/screenIcon//346/265/267/345/241/230-1/347/272/247.png +0 -0
  43. package/public/image/screenIcon//346/265/267/345/241/230-2/347/272/247.png +0 -0
  44. package/public/image/screenIcon//346/265/267/345/241/230-3/347/272/247.png +0 -0
  45. package/public/image/screenIcon//346/265/267/345/241/230-4/347/272/247.png +0 -0
  46. package/public/image/screenIcon//346/265/267/345/241/230-5/347/272/247.png +0 -0
  47. package/public/image/screenIcon//346/265/267/345/241/230-/346/251/231.png +0 -0
  48. package/public/image/screenIcon//346/265/267/345/241/230-/347/272/242.png +0 -0
  49. package/public/image/screenIcon//346/265/267/345/241/230-/347/273/277.png +0 -0
  50. package/public/image/screenIcon//346/265/267/345/241/230-/350/247/204/346/250/241/344/273/245/344/270/213.png +0 -0
  51. package/public/image/screenIcon//346/265/267/345/241/230-/351/273/204.png +0 -0
  52. package/public/image/screenIcon//346/265/267/345/241/230.png +0 -0
  53. package/public/image/screenIcon//346/275/256/344/275/215.png +0 -0
  54. package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/346/227/240/346/225/260/346/215/256.png +0 -0
  55. package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/346/255/243/345/270/270.png +0 -0
  56. package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/350/266/205/344/277/235.png +0 -0
  57. package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/350/266/205/350/255/246.png +0 -0
  58. package/public/image/screenIcon//347/211/251/350/265/204/344/273/223/345/272/223.png +0 -0
  59. package/public/image/screenIcon//347/220/203/346/234/272-/345/205/263.png +0 -0
  60. package/public/image/screenIcon//347/220/203/346/234/272-/345/274/200.png +0 -0
  61. package/public/image/screenIcon//347/220/203/346/234/272-/347/272/242.png +0 -0
  62. package/public/image/screenIcon//350/247/206/351/242/221/347/233/221/346/216/247.png +0 -0
  63. package/public/image/screenIcon//351/227/270/351/227/250-/347/201/260.png +0 -0
  64. package/public/image/screenIcon//351/227/270/351/227/250-/347/273/277.png +0 -0
  65. package/public/image/screenIcon//351/230/262/346/264/252/344/273/223/345/272/223.png +0 -0
  66. package/public/image/screenIcon//351/232/220/346/202/243.png +0 -0
  67. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/346/265/205/350/223/235.png +0 -0
  68. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/201/260.png +0 -0
  69. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/262/211.png +0 -0
  70. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/272/242.png +0 -0
  71. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/273/277.png +0 -0
  72. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/350/223/235.png +0 -0
  73. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/351/273/204.png +0 -0
  74. package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/351/273/221.png +0 -0
  75. package/public/image/screenIcon//351/243/216/351/200/237.png +0 -0
  76. package/public/image/screenIcon//351/243/216/351/200/237/346/265/213/347/253/231.png +0 -0
  77. package/public/image//346/260/264/346/226/207.gif +0 -0
  78. package/public/image//350/211/262/345/270/246.png +0 -0
  79. package/public/index.html +22 -0
  80. package/public/index.js +185662 -0
  81. package/public/jsWebControl-1.0.0.min.js +31 -0
  82. package/public/jsencrypt.min.js +1 -0
  83. package/public/math/Box2.js +203 -0
  84. package/public/math/Box3.js +532 -0
  85. package/public/math/Color.js +605 -0
  86. package/public/math/ColorManagement.js +74 -0
  87. package/public/math/Cylindrical.js +61 -0
  88. package/public/math/EngineUtils.js +81 -0
  89. package/public/math/Euler.js +315 -0
  90. package/public/math/Frustum.js +162 -0
  91. package/public/math/Interpolant.js +241 -0
  92. package/public/math/Line3.js +115 -0
  93. package/public/math/MathUtils.js +345 -0
  94. package/public/math/Matrix3.js +365 -0
  95. package/public/math/Matrix4.js +858 -0
  96. package/public/math/Plane.js +205 -0
  97. package/public/math/Quaternion.js +724 -0
  98. package/public/math/Ray.js +493 -0
  99. package/public/math/Sphere.js +243 -0
  100. package/public/math/Spherical.js +86 -0
  101. package/public/math/SphericalHarmonics3.js +243 -0
  102. package/public/math/Triangle.js +299 -0
  103. package/public/math/Vector2.js +464 -0
  104. package/public/math/Vector3.js +715 -0
  105. package/public/math/Vector4.js +644 -0
  106. package/public/math/interpolants/CubicInterpolant.js +151 -0
  107. package/public/math/interpolants/DiscreteInterpolant.js +26 -0
  108. package/public/math/interpolants/LinearInterpolant.js +38 -0
  109. package/public/math/interpolants/QuaternionLinearInterpolant.js +39 -0
  110. package/public/static/Cloud.png +0 -0
  111. package/public/static/Global2.jpg +0 -0
  112. package/public/static/css/main.css +170 -0
  113. package/public/static/geojson//346/265/267/345/241/230.geojson +99 -0
  114. package/public/static/img/loading.gif +0 -0
  115. package/public/static/js/app.js +359 -0
  116. package/public/static/js/appcontroller.js +207 -0
  117. package/public/static/js/dist/game.dev.js +137 -0
  118. package/public/static/js/env.js +74 -0
  119. package/public/static/js/event/event.js +107 -0
  120. package/public/static/js/init.js +8 -0
  121. package/public/static/js/initcloudmorph.js +1 -0
  122. package/public/static/js/log.js +35 -0
  123. package/public/static/js/network/ajax.js +29 -0
  124. package/public/static/js/network/rtcp.js +172 -0
  125. package/public/static/js/network/socket.js +106 -0
  126. package/public/web-control.min.js +2 -0
  127. package/scripts/postinstall.mjs +127 -0
  128. package/src/GaeaMethods.js +68 -405
  129. package/src/components/FlyAlongRoute.vue +1 -0
  130. package/src/components/WeatherControl.vue +2 -0
  131. package/src/directives/vDrag.js +70 -0
  132. package/src/index.js +1 -8
  133. package/src/plugin.js +16 -0
  134. package/src/utils.js +10 -21
  135. package/src/vite-plugin.js +117 -0
  136. package/public/static/1111.res +0 -0
  137. package/src/config.js +0 -40
@@ -0,0 +1,858 @@
1
+ import { Vector3 } from './Vector3.js';
2
+
3
+ class Matrix4 {
4
+
5
+ constructor() {
6
+ Matrix4.prototype.isMatrix4 = true;
7
+ this.elements = [
8
+
9
+ 1, 0, 0, 0,
10
+ 0, 1, 0, 0,
11
+ 0, 0, 1, 0,
12
+ 0, 0, 0, 1
13
+
14
+ ];
15
+ arguments.length === 0 ? this.identity() : this.fromArray( arguments );
16
+ }
17
+
18
+ set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
19
+
20
+ const te = this.elements;
21
+
22
+ te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;
23
+ te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;
24
+ te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;
25
+ te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;
26
+
27
+ return this;
28
+
29
+ }
30
+
31
+ identity() {
32
+
33
+ this.set(
34
+
35
+ 1, 0, 0, 0,
36
+ 0, 1, 0, 0,
37
+ 0, 0, 1, 0,
38
+ 0, 0, 0, 1
39
+
40
+ );
41
+
42
+ return this;
43
+
44
+ }
45
+
46
+ clone() {
47
+
48
+ return new Matrix4().fromArray( this.elements );
49
+
50
+ }
51
+
52
+ copy( m ) {
53
+
54
+ const te = this.elements;
55
+ const me = m.elements;
56
+
57
+ te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];
58
+ te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];
59
+ te[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];
60
+ te[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];
61
+
62
+ return this;
63
+
64
+ }
65
+
66
+ copyPosition( m ) {
67
+
68
+ const te = this.elements, me = m.elements;
69
+
70
+ te[ 12 ] = me[ 12 ];
71
+ te[ 13 ] = me[ 13 ];
72
+ te[ 14 ] = me[ 14 ];
73
+
74
+ return this;
75
+
76
+ }
77
+
78
+ setFromMatrix3( m ) {
79
+
80
+ const me = m.elements;
81
+
82
+ this.set(
83
+
84
+ me[ 0 ], me[ 3 ], me[ 6 ], 0,
85
+ me[ 1 ], me[ 4 ], me[ 7 ], 0,
86
+ me[ 2 ], me[ 5 ], me[ 8 ], 0,
87
+ 0, 0, 0, 1
88
+
89
+ );
90
+
91
+ return this;
92
+
93
+ }
94
+
95
+ extractBasis( xAxis, yAxis, zAxis ) {
96
+
97
+ xAxis.setFromMatrixColumn( this, 0 );
98
+ yAxis.setFromMatrixColumn( this, 1 );
99
+ zAxis.setFromMatrixColumn( this, 2 );
100
+
101
+ return this;
102
+
103
+ }
104
+
105
+ makeBasis( xAxis, yAxis, zAxis ) {
106
+
107
+ this.set(
108
+ xAxis.x, yAxis.x, zAxis.x, 0,
109
+ xAxis.y, yAxis.y, zAxis.y, 0,
110
+ xAxis.z, yAxis.z, zAxis.z, 0,
111
+ 0, 0, 0, 1
112
+ );
113
+
114
+ return this;
115
+
116
+ }
117
+
118
+ extractRotation( m ) {
119
+
120
+ // this method does not support reflection matrices
121
+
122
+ const te = this.elements;
123
+ const me = m.elements;
124
+
125
+ const scaleX = 1 / _v1.setFromMatrixColumn( m, 0 ).length();
126
+ const scaleY = 1 / _v1.setFromMatrixColumn( m, 1 ).length();
127
+ const scaleZ = 1 / _v1.setFromMatrixColumn( m, 2 ).length();
128
+
129
+ te[ 0 ] = me[ 0 ] * scaleX;
130
+ te[ 1 ] = me[ 1 ] * scaleX;
131
+ te[ 2 ] = me[ 2 ] * scaleX;
132
+ te[ 3 ] = 0;
133
+
134
+ te[ 4 ] = me[ 4 ] * scaleY;
135
+ te[ 5 ] = me[ 5 ] * scaleY;
136
+ te[ 6 ] = me[ 6 ] * scaleY;
137
+ te[ 7 ] = 0;
138
+
139
+ te[ 8 ] = me[ 8 ] * scaleZ;
140
+ te[ 9 ] = me[ 9 ] * scaleZ;
141
+ te[ 10 ] = me[ 10 ] * scaleZ;
142
+ te[ 11 ] = 0;
143
+
144
+ te[ 12 ] = 0;
145
+ te[ 13 ] = 0;
146
+ te[ 14 ] = 0;
147
+ te[ 15 ] = 1;
148
+
149
+ return this;
150
+
151
+ }
152
+
153
+ makeRotationFromEuler( euler ) {
154
+
155
+ const te = this.elements;
156
+
157
+ const x = euler.x, y = euler.y, z = euler.z;
158
+ const a = Math.cos( x ), b = Math.sin( x );
159
+ const c = Math.cos( y ), d = Math.sin( y );
160
+ const e = Math.cos( z ), f = Math.sin( z );
161
+
162
+ if ( euler.order === 'XYZ' ) {
163
+
164
+ const ae = a * e, af = a * f, be = b * e, bf = b * f;
165
+
166
+ te[ 0 ] = c * e;
167
+ te[ 4 ] = - c * f;
168
+ te[ 8 ] = d;
169
+
170
+ te[ 1 ] = af + be * d;
171
+ te[ 5 ] = ae - bf * d;
172
+ te[ 9 ] = - b * c;
173
+
174
+ te[ 2 ] = bf - ae * d;
175
+ te[ 6 ] = be + af * d;
176
+ te[ 10 ] = a * c;
177
+
178
+ } else if ( euler.order === 'YXZ' ) {
179
+
180
+ const ce = c * e, cf = c * f, de = d * e, df = d * f;
181
+
182
+ te[ 0 ] = ce + df * b;
183
+ te[ 4 ] = de * b - cf;
184
+ te[ 8 ] = a * d;
185
+
186
+ te[ 1 ] = a * f;
187
+ te[ 5 ] = a * e;
188
+ te[ 9 ] = - b;
189
+
190
+ te[ 2 ] = cf * b - de;
191
+ te[ 6 ] = df + ce * b;
192
+ te[ 10 ] = a * c;
193
+
194
+ } else if ( euler.order === 'ZXY' ) {
195
+
196
+ const ce = c * e, cf = c * f, de = d * e, df = d * f;
197
+
198
+ te[ 0 ] = ce - df * b;
199
+ te[ 4 ] = - a * f;
200
+ te[ 8 ] = de + cf * b;
201
+
202
+ te[ 1 ] = cf + de * b;
203
+ te[ 5 ] = a * e;
204
+ te[ 9 ] = df - ce * b;
205
+
206
+ te[ 2 ] = - a * d;
207
+ te[ 6 ] = b;
208
+ te[ 10 ] = a * c;
209
+
210
+ } else if ( euler.order === 'ZYX' ) {
211
+
212
+ const ae = a * e, af = a * f, be = b * e, bf = b * f;
213
+
214
+ te[ 0 ] = c * e;
215
+ te[ 4 ] = be * d - af;
216
+ te[ 8 ] = ae * d + bf;
217
+
218
+ te[ 1 ] = c * f;
219
+ te[ 5 ] = bf * d + ae;
220
+ te[ 9 ] = af * d - be;
221
+
222
+ te[ 2 ] = - d;
223
+ te[ 6 ] = b * c;
224
+ te[ 10 ] = a * c;
225
+
226
+ } else if ( euler.order === 'YZX' ) {
227
+
228
+ const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
229
+
230
+ te[ 0 ] = c * e;
231
+ te[ 4 ] = bd - ac * f;
232
+ te[ 8 ] = bc * f + ad;
233
+
234
+ te[ 1 ] = f;
235
+ te[ 5 ] = a * e;
236
+ te[ 9 ] = - b * e;
237
+
238
+ te[ 2 ] = - d * e;
239
+ te[ 6 ] = ad * f + bc;
240
+ te[ 10 ] = ac - bd * f;
241
+
242
+ } else if ( euler.order === 'XZY' ) {
243
+
244
+ const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
245
+
246
+ te[ 0 ] = c * e;
247
+ te[ 4 ] = - f;
248
+ te[ 8 ] = d * e;
249
+
250
+ te[ 1 ] = ac * f + bd;
251
+ te[ 5 ] = a * e;
252
+ te[ 9 ] = ad * f - bc;
253
+
254
+ te[ 2 ] = bc * f - ad;
255
+ te[ 6 ] = b * e;
256
+ te[ 10 ] = bd * f + ac;
257
+
258
+ }
259
+
260
+ // bottom row
261
+ te[ 3 ] = 0;
262
+ te[ 7 ] = 0;
263
+ te[ 11 ] = 0;
264
+
265
+ // last column
266
+ te[ 12 ] = 0;
267
+ te[ 13 ] = 0;
268
+ te[ 14 ] = 0;
269
+ te[ 15 ] = 1;
270
+
271
+ return this;
272
+
273
+ }
274
+
275
+ makeRotationFromQuaternion( q ) {
276
+
277
+ return this.compose( _zero, q, _one );
278
+
279
+ }
280
+
281
+ lookAt( eye, target, up ) {
282
+
283
+ const te = this.elements;
284
+
285
+ _z.subVectors( eye, target );
286
+
287
+ if ( _z.lengthSq() === 0 ) {
288
+
289
+ // eye and target are in the same position
290
+
291
+ _z.z = 1;
292
+
293
+ }
294
+
295
+ _z.normalize();
296
+ _x.crossVectors( up, _z );
297
+
298
+ if ( _x.lengthSq() === 0 ) {
299
+
300
+ // up and z are parallel
301
+
302
+ if ( Math.abs( up.z ) === 1 ) {
303
+
304
+ _z.x += 0.0001;
305
+
306
+ } else {
307
+
308
+ _z.z += 0.0001;
309
+
310
+ }
311
+
312
+ _z.normalize();
313
+ _x.crossVectors( up, _z );
314
+
315
+ }
316
+
317
+ _x.normalize();
318
+ _y.crossVectors( _z, _x );
319
+
320
+ te[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;
321
+ te[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;
322
+ te[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;
323
+
324
+ return this;
325
+
326
+ }
327
+
328
+ multiply( m ) {
329
+
330
+ return this.multiplyMatrices( this, m );
331
+
332
+ }
333
+
334
+ premultiply( m ) {
335
+
336
+ return this.multiplyMatrices( m, this );
337
+
338
+ }
339
+
340
+ multiplyMatrices( a, b ) {
341
+
342
+ const ae = a.elements;
343
+ const be = b.elements;
344
+ const te = this.elements;
345
+
346
+ const a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];
347
+ const a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];
348
+ const a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];
349
+ const a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];
350
+
351
+ const b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];
352
+ const b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];
353
+ const b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];
354
+ const b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];
355
+
356
+ te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
357
+ te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
358
+ te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
359
+ te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
360
+
361
+ te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
362
+ te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
363
+ te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
364
+ te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
365
+
366
+ te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
367
+ te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
368
+ te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
369
+ te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
370
+
371
+ te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
372
+ te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
373
+ te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
374
+ te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
375
+
376
+ return this;
377
+
378
+ }
379
+
380
+ multiplyScalar( s ) {
381
+
382
+ const te = this.elements;
383
+
384
+ te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;
385
+ te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;
386
+ te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;
387
+ te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;
388
+
389
+ return this;
390
+
391
+ }
392
+
393
+ determinant() {
394
+
395
+ const te = this.elements;
396
+
397
+ const n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];
398
+ const n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];
399
+ const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];
400
+ const n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];
401
+
402
+ //TODO: make this more efficient
403
+ //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
404
+
405
+ return (
406
+ n41 * (
407
+ + n14 * n23 * n32
408
+ - n13 * n24 * n32
409
+ - n14 * n22 * n33
410
+ + n12 * n24 * n33
411
+ + n13 * n22 * n34
412
+ - n12 * n23 * n34
413
+ ) +
414
+ n42 * (
415
+ + n11 * n23 * n34
416
+ - n11 * n24 * n33
417
+ + n14 * n21 * n33
418
+ - n13 * n21 * n34
419
+ + n13 * n24 * n31
420
+ - n14 * n23 * n31
421
+ ) +
422
+ n43 * (
423
+ + n11 * n24 * n32
424
+ - n11 * n22 * n34
425
+ - n14 * n21 * n32
426
+ + n12 * n21 * n34
427
+ + n14 * n22 * n31
428
+ - n12 * n24 * n31
429
+ ) +
430
+ n44 * (
431
+ - n13 * n22 * n31
432
+ - n11 * n23 * n32
433
+ + n11 * n22 * n33
434
+ + n13 * n21 * n32
435
+ - n12 * n21 * n33
436
+ + n12 * n23 * n31
437
+ )
438
+
439
+ );
440
+
441
+ }
442
+
443
+ transpose() {
444
+
445
+ const te = this.elements;
446
+ let tmp;
447
+
448
+ tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;
449
+ tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;
450
+ tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;
451
+
452
+ tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;
453
+ tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;
454
+ tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;
455
+
456
+ return this;
457
+
458
+ }
459
+
460
+ setPosition( x, y, z ) {
461
+
462
+ const te = this.elements;
463
+
464
+ if ( x.isVector3 ) {
465
+
466
+ te[ 12 ] = x.x;
467
+ te[ 13 ] = x.y;
468
+ te[ 14 ] = x.z;
469
+
470
+ } else {
471
+
472
+ te[ 12 ] = x;
473
+ te[ 13 ] = y;
474
+ te[ 14 ] = z;
475
+
476
+ }
477
+
478
+ return this;
479
+
480
+ }
481
+
482
+ invert() {
483
+
484
+ // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
485
+ const te = this.elements,
486
+
487
+ n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],
488
+ n12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],
489
+ n13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],
490
+ n14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],
491
+
492
+ t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,
493
+ t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,
494
+ t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,
495
+ t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;
496
+
497
+ const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;
498
+
499
+ if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
500
+
501
+ const detInv = 1 / det;
502
+
503
+ te[ 0 ] = t11 * detInv;
504
+ te[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;
505
+ te[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;
506
+ te[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;
507
+
508
+ te[ 4 ] = t12 * detInv;
509
+ te[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;
510
+ te[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;
511
+ te[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;
512
+
513
+ te[ 8 ] = t13 * detInv;
514
+ te[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;
515
+ te[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;
516
+ te[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;
517
+
518
+ te[ 12 ] = t14 * detInv;
519
+ te[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;
520
+ te[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;
521
+ te[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;
522
+
523
+ return this;
524
+
525
+ }
526
+
527
+ scale( v ) {
528
+
529
+ const te = this.elements;
530
+ const x = v.x, y = v.y, z = v.z;
531
+
532
+ te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;
533
+ te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;
534
+ te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;
535
+ te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;
536
+
537
+ return this;
538
+
539
+ }
540
+
541
+ getMaxScaleOnAxis() {
542
+
543
+ const te = this.elements;
544
+
545
+ const scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];
546
+ const scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];
547
+ const scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];
548
+
549
+ return Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );
550
+
551
+ }
552
+
553
+ makeTranslation( x, y, z ) {
554
+
555
+ this.set(
556
+
557
+ 1, 0, 0, x,
558
+ 0, 1, 0, y,
559
+ 0, 0, 1, z,
560
+ 0, 0, 0, 1
561
+
562
+ );
563
+
564
+ return this;
565
+
566
+ }
567
+
568
+ makeRotationX( theta ) {
569
+
570
+ const c = Math.cos( theta ), s = Math.sin( theta );
571
+
572
+ this.set(
573
+
574
+ 1, 0, 0, 0,
575
+ 0, c, - s, 0,
576
+ 0, s, c, 0,
577
+ 0, 0, 0, 1
578
+
579
+ );
580
+
581
+ return this;
582
+
583
+ }
584
+
585
+ makeRotationY( theta ) {
586
+
587
+ const c = Math.cos( theta ), s = Math.sin( theta );
588
+
589
+ this.set(
590
+
591
+ c, 0, s, 0,
592
+ 0, 1, 0, 0,
593
+ - s, 0, c, 0,
594
+ 0, 0, 0, 1
595
+
596
+ );
597
+
598
+ return this;
599
+
600
+ }
601
+
602
+ makeRotationZ( theta ) {
603
+
604
+ const c = Math.cos( theta ), s = Math.sin( theta );
605
+
606
+ this.set(
607
+
608
+ c, - s, 0, 0,
609
+ s, c, 0, 0,
610
+ 0, 0, 1, 0,
611
+ 0, 0, 0, 1
612
+
613
+ );
614
+
615
+ return this;
616
+
617
+ }
618
+
619
+ makeRotationAxis( axis, angle ) {
620
+
621
+ // Based on http://www.gamedev.net/reference/articles/article1199.asp
622
+
623
+ const c = Math.cos( angle );
624
+ const s = Math.sin( angle );
625
+ const t = 1 - c;
626
+ const x = axis.x, y = axis.y, z = axis.z;
627
+ const tx = t * x, ty = t * y;
628
+
629
+ this.set(
630
+
631
+ tx * x + c, tx * y - s * z, tx * z + s * y, 0,
632
+ tx * y + s * z, ty * y + c, ty * z - s * x, 0,
633
+ tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
634
+ 0, 0, 0, 1
635
+
636
+ );
637
+
638
+ return this;
639
+
640
+ }
641
+
642
+ makeScale( x, y, z ) {
643
+
644
+ this.set(
645
+
646
+ x, 0, 0, 0,
647
+ 0, y, 0, 0,
648
+ 0, 0, z, 0,
649
+ 0, 0, 0, 1
650
+
651
+ );
652
+
653
+ return this;
654
+
655
+ }
656
+
657
+ makeShear( xy, xz, yx, yz, zx, zy ) {
658
+
659
+ this.set(
660
+
661
+ 1, yx, zx, 0,
662
+ xy, 1, zy, 0,
663
+ xz, yz, 1, 0,
664
+ 0, 0, 0, 1
665
+
666
+ );
667
+
668
+ return this;
669
+
670
+ }
671
+
672
+ compose( position, quaternion, scale ) {
673
+
674
+ const te = this.elements;
675
+
676
+ const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;
677
+ const x2 = x + x, y2 = y + y, z2 = z + z;
678
+ const xx = x * x2, xy = x * y2, xz = x * z2;
679
+ const yy = y * y2, yz = y * z2, zz = z * z2;
680
+ const wx = w * x2, wy = w * y2, wz = w * z2;
681
+
682
+ const sx = scale.x, sy = scale.y, sz = scale.z;
683
+
684
+ te[ 0 ] = ( 1 - ( yy + zz ) ) * sx;
685
+ te[ 1 ] = ( xy + wz ) * sx;
686
+ te[ 2 ] = ( xz - wy ) * sx;
687
+ te[ 3 ] = 0;
688
+
689
+ te[ 4 ] = ( xy - wz ) * sy;
690
+ te[ 5 ] = ( 1 - ( xx + zz ) ) * sy;
691
+ te[ 6 ] = ( yz + wx ) * sy;
692
+ te[ 7 ] = 0;
693
+
694
+ te[ 8 ] = ( xz + wy ) * sz;
695
+ te[ 9 ] = ( yz - wx ) * sz;
696
+ te[ 10 ] = ( 1 - ( xx + yy ) ) * sz;
697
+ te[ 11 ] = 0;
698
+
699
+ te[ 12 ] = position.x;
700
+ te[ 13 ] = position.y;
701
+ te[ 14 ] = position.z;
702
+ te[ 15 ] = 1;
703
+
704
+ return this;
705
+
706
+ }
707
+
708
+ decompose( position, quaternion, scale ) {
709
+
710
+ const te = this.elements;
711
+
712
+ let sx = _v1.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();
713
+ const sy = _v1.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();
714
+ const sz = _v1.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();
715
+
716
+ // if determine is negative, we need to invert one scale
717
+ const det = this.determinant();
718
+ if ( det < 0 ) sx = - sx;
719
+
720
+ position.x = te[ 12 ];
721
+ position.y = te[ 13 ];
722
+ position.z = te[ 14 ];
723
+
724
+ // scale the rotation part
725
+ _m1.copy( this );
726
+
727
+ const invSX = 1 / sx;
728
+ const invSY = 1 / sy;
729
+ const invSZ = 1 / sz;
730
+
731
+ _m1.elements[ 0 ] *= invSX;
732
+ _m1.elements[ 1 ] *= invSX;
733
+ _m1.elements[ 2 ] *= invSX;
734
+
735
+ _m1.elements[ 4 ] *= invSY;
736
+ _m1.elements[ 5 ] *= invSY;
737
+ _m1.elements[ 6 ] *= invSY;
738
+
739
+ _m1.elements[ 8 ] *= invSZ;
740
+ _m1.elements[ 9 ] *= invSZ;
741
+ _m1.elements[ 10 ] *= invSZ;
742
+
743
+ quaternion.setFromRotationMatrix( _m1 );
744
+
745
+ scale.x = sx;
746
+ scale.y = sy;
747
+ scale.z = sz;
748
+
749
+ return this;
750
+
751
+ }
752
+
753
+ makePerspective( left, right, top, bottom, near, far ) {
754
+
755
+ const te = this.elements;
756
+ const x = 2 * near / ( right - left );
757
+ const y = 2 * near / ( top - bottom );
758
+
759
+ const a = ( right + left ) / ( right - left );
760
+ const b = ( top + bottom ) / ( top - bottom );
761
+ const c = - ( far + near ) / ( far - near );
762
+ const d = - 2 * far * near / ( far - near );
763
+
764
+ te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
765
+ te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
766
+ te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
767
+ te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
768
+
769
+ return this;
770
+
771
+ }
772
+
773
+ makeOrthographic( left, right, top, bottom, near, far ) {
774
+
775
+ const te = this.elements;
776
+ const w = 1.0 / ( right - left );
777
+ const h = 1.0 / ( top - bottom );
778
+ const p = 1.0 / ( far - near );
779
+
780
+ const x = ( right + left ) * w;
781
+ const y = ( top + bottom ) * h;
782
+ const z = ( far + near ) * p;
783
+
784
+ te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
785
+ te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
786
+ te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z;
787
+ te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
788
+
789
+ return this;
790
+
791
+ }
792
+
793
+ equals( matrix ) {
794
+
795
+ const te = this.elements;
796
+ const me = matrix.elements;
797
+
798
+ for ( let i = 0; i < 16; i ++ ) {
799
+
800
+ if ( te[ i ] !== me[ i ] ) return false;
801
+
802
+ }
803
+
804
+ return true;
805
+
806
+ }
807
+
808
+ fromArray( array, offset = 0 ) {
809
+
810
+ for ( let i = 0; i < 16; i ++ ) {
811
+
812
+ this.elements[ i ] = array[ i + offset ];
813
+
814
+ }
815
+
816
+ return this;
817
+
818
+ }
819
+
820
+ toArray( array = [], offset = 0 ) {
821
+
822
+ const te = this.elements;
823
+
824
+ array[ offset ] = te[ 0 ];
825
+ array[ offset + 1 ] = te[ 1 ];
826
+ array[ offset + 2 ] = te[ 2 ];
827
+ array[ offset + 3 ] = te[ 3 ];
828
+
829
+ array[ offset + 4 ] = te[ 4 ];
830
+ array[ offset + 5 ] = te[ 5 ];
831
+ array[ offset + 6 ] = te[ 6 ];
832
+ array[ offset + 7 ] = te[ 7 ];
833
+
834
+ array[ offset + 8 ] = te[ 8 ];
835
+ array[ offset + 9 ] = te[ 9 ];
836
+ array[ offset + 10 ] = te[ 10 ];
837
+ array[ offset + 11 ] = te[ 11 ];
838
+
839
+ array[ offset + 12 ] = te[ 12 ];
840
+ array[ offset + 13 ] = te[ 13 ];
841
+ array[ offset + 14 ] = te[ 14 ];
842
+ array[ offset + 15 ] = te[ 15 ];
843
+
844
+ return array;
845
+
846
+ }
847
+
848
+ }
849
+
850
+ const _v1 = /*@__PURE__*/ new Vector3();
851
+ const _m1 = /*@__PURE__*/ new Matrix4();
852
+ const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
853
+ const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
854
+ const _x = /*@__PURE__*/ new Vector3();
855
+ const _y = /*@__PURE__*/ new Vector3();
856
+ const _z = /*@__PURE__*/ new Vector3();
857
+
858
+ export { Matrix4 };