@woosh/meep-engine 2.122.5 → 2.122.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/geom/3d/SurfacePoint3.js +2 -2
- package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +4 -4
- package/src/core/geom/Vector3.d.ts +56 -40
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector3.js +100 -96
- package/src/core/math/spline/v3_computeCatmullRomSplineUniformDistance.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +2 -2
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +2 -2
- package/src/engine/navigation/ecs/components/Path.js +1 -1
package/package.json
CHANGED
|
@@ -77,8 +77,8 @@ export class SurfacePoint3 {
|
|
|
77
77
|
* @param {number} [offset=0]
|
|
78
78
|
*/
|
|
79
79
|
fromArray(array, offset = 0) {
|
|
80
|
-
this.position.
|
|
81
|
-
this.normal.
|
|
80
|
+
this.position.fromArray(array, offset);
|
|
81
|
+
this.normal.fromArray(array, offset + 3);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -105,7 +105,7 @@ export function frustum3_computeNearestPointToPoint(result, planes, target_x, ta
|
|
|
105
105
|
|
|
106
106
|
plane3_three_compute_convex_3_plane_intersection(scratch_v3_array, 0, plane_0, plane_1, plane_2);
|
|
107
107
|
|
|
108
|
-
result.
|
|
108
|
+
result.fromArray(scratch_v3_array, 0)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
return false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Miniball } from "../../../packing/miniball/Miniball.js";
|
|
2
|
-
import { PointSet } from "../../../packing/miniball/PointSet.js";
|
|
3
|
-
import { ConicRay } from "../../../ConicRay.js";
|
|
4
1
|
import { array_copy } from "../../../../collection/array/array_copy.js";
|
|
5
2
|
import { min2 } from "../../../../math/min2.js";
|
|
3
|
+
import { ConicRay } from "../../../ConicRay.js";
|
|
4
|
+
import { Miniball } from "../../../packing/miniball/Miniball.js";
|
|
5
|
+
import { PointSet } from "../../../packing/miniball/PointSet.js";
|
|
6
6
|
import { v3_angle_between } from "../../../vec3/v3_angle_between.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -52,7 +52,7 @@ export function computeTriangleClusterNormalBoundingCone(result, faces) {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
result_direction.
|
|
55
|
+
result_direction.fromArray(miniball_center, 0);
|
|
56
56
|
const center_vector_magnitude = result_direction.length();
|
|
57
57
|
|
|
58
58
|
if (center_vector_magnitude === 0) {
|
|
@@ -64,16 +64,47 @@ export class Vector3 {
|
|
|
64
64
|
readonly onChanged: Signal<number, number, number, number, number, number>;
|
|
65
65
|
/**
|
|
66
66
|
*
|
|
67
|
-
* @param {number
|
|
68
|
-
|
|
67
|
+
* @param {number} v
|
|
68
|
+
*/
|
|
69
|
+
set 0(v: number);
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @return {number}
|
|
73
|
+
*/
|
|
74
|
+
get 0(): number;
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @param {number} v
|
|
78
|
+
*/
|
|
79
|
+
set 1(v: number);
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
* @return {number}
|
|
83
|
+
*/
|
|
84
|
+
get 1(): number;
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* @param {number} v
|
|
88
|
+
*/
|
|
89
|
+
set 2(v: number);
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @return {number}
|
|
69
93
|
*/
|
|
70
|
-
|
|
94
|
+
get 2(): number;
|
|
71
95
|
/**
|
|
72
96
|
*
|
|
73
97
|
* @param {number[]|Float32Array} array
|
|
74
|
-
* @param {number} offset
|
|
98
|
+
* @param {number} [offset]
|
|
99
|
+
* @returns {this}
|
|
75
100
|
*/
|
|
76
|
-
|
|
101
|
+
fromArray(array: number[] | Float32Array, offset?: number): this;
|
|
102
|
+
/**
|
|
103
|
+
* @param {number[]|Float32Array|ArrayLike} [array]
|
|
104
|
+
* @param {number} [offset]
|
|
105
|
+
* @returns {number[]}
|
|
106
|
+
*/
|
|
107
|
+
toArray(array?: number[] | Float32Array | ArrayLike<any>, offset?: number): number[];
|
|
77
108
|
/**
|
|
78
109
|
*
|
|
79
110
|
* @param {number} x
|
|
@@ -205,17 +236,17 @@ export class Vector3 {
|
|
|
205
236
|
*/
|
|
206
237
|
divide(other: Vector3): this;
|
|
207
238
|
/**
|
|
208
|
-
*
|
|
239
|
+
* Add a scalar value to each component of the vector
|
|
209
240
|
* @param {number} val
|
|
210
241
|
* @returns {this}
|
|
211
242
|
*/
|
|
212
|
-
|
|
243
|
+
addScalar(val: number): this;
|
|
213
244
|
/**
|
|
214
|
-
*
|
|
245
|
+
* Subtract scalar value from each component of the vector
|
|
215
246
|
* @param {number} val
|
|
216
247
|
* @returns {this}
|
|
217
248
|
*/
|
|
218
|
-
|
|
249
|
+
subScalar(val: number): this;
|
|
219
250
|
/**
|
|
220
251
|
*
|
|
221
252
|
* @returns {Vector3}
|
|
@@ -509,48 +540,33 @@ export class Vector3 {
|
|
|
509
540
|
*/
|
|
510
541
|
fromBinaryBufferFloat32(buffer: BinaryBuffer): void;
|
|
511
542
|
hash(): number;
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
set 1(v: number);
|
|
515
|
-
get 1(): number;
|
|
516
|
-
set 2(v: number);
|
|
517
|
-
get 2(): number;
|
|
518
|
-
/**
|
|
519
|
-
*
|
|
520
|
-
* @param {THREE.Matrix4} matrix4
|
|
521
|
-
* @deprecated use {@link @applyMatrix4} directly instead, pass `mat.elements`
|
|
522
|
-
*/
|
|
523
|
-
applyMatrix4_three(matrix4: THREE.Matrix4): void;
|
|
524
|
-
/**
|
|
525
|
-
* @deprecated use non-three.js version instead
|
|
526
|
-
* @param {THREE.Matrix4} m
|
|
527
|
-
*/
|
|
528
|
-
transformDirection_three(m: THREE.Matrix4): void;
|
|
543
|
+
distanceToSquared: (other: Vector3) => number;
|
|
544
|
+
lengthSq: () => number;
|
|
529
545
|
/**
|
|
530
|
-
* @
|
|
531
|
-
* @
|
|
532
|
-
* @returns {Vector3}
|
|
546
|
+
* @readonly
|
|
547
|
+
* @deprecated Use {@link fromArray} instead
|
|
533
548
|
*/
|
|
534
|
-
|
|
549
|
+
readonly readFromArray: (array: number[] | Float32Array, offset?: number) => Vector3;
|
|
535
550
|
/**
|
|
536
|
-
* @
|
|
537
|
-
* @
|
|
551
|
+
* @readonly
|
|
552
|
+
* @deprecated Use {@link toArray} instead
|
|
538
553
|
*/
|
|
539
|
-
|
|
540
|
-
distanceToSquared: (other: Vector3) => number;
|
|
541
|
-
lengthSq: () => number;
|
|
542
|
-
fromArray: (array: number[] | Float32Array, offset?: number) => void;
|
|
543
|
-
toArray: (array?: number[] | Float32Array, offset?: number) => number[] | Float32Array<ArrayBufferLike>;
|
|
554
|
+
readonly writeToArray: (array?: number[] | Float32Array | ArrayLike<any>, offset?: number) => number[];
|
|
544
555
|
/**
|
|
545
|
-
* @
|
|
556
|
+
* @readonly
|
|
557
|
+
* @deprecated use {@link toArray} instead
|
|
546
558
|
*/
|
|
547
|
-
asArray: (array?: number[] | Float32Array
|
|
559
|
+
readonly asArray: (array?: number[] | Float32Array | ArrayLike<any>, offset?: number) => number[];
|
|
548
560
|
/**
|
|
549
561
|
* @readonly
|
|
550
562
|
* @type {boolean}
|
|
551
563
|
*/
|
|
552
564
|
readonly isVector3: boolean;
|
|
553
|
-
|
|
565
|
+
/**
|
|
566
|
+
*
|
|
567
|
+
* @return {Generator<number>}
|
|
568
|
+
*/
|
|
569
|
+
[Symbol.iterator](): Generator<number>;
|
|
554
570
|
}
|
|
555
571
|
export namespace Vector3 {
|
|
556
572
|
let zero: Vector3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vector3.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector3.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH;
|
|
1
|
+
{"version":3,"file":"Vector3.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector3.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH;IA4+BI;;;;;OAKG;IACH,cAJW,OAAO,GAAC,OAAO,KACf,OAAO,GAAC,OAAO,GACb,MAAM,CAIlB;IAED;;;;;OAKG;IACH,mBAJW,OAAO,KACP,OAAO,GACL,MAAM,CAIlB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,EAAE,WACR,MAAM,GACJ,OAAO,CAQnB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,OAAO,CAInB;IAphCD;;;;;;OAMG;IACH,gBALW,MAAM,MACN,MAAM,MACN,MAAM,EAuChB;IA1BG;;;;OAIG;IACH,YAFU,MAAM,CAEN;IAEV;;;;OAIG;IACH,YAFU,MAAM,CAEN;IAEV;;;;OAIG;IACH,YAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,oBAFU,MAAM,CAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,CAAC,CAE9B;IA2BjC;;;OAGG;IACH,SAFW,MAAM,EAIhB;IA9BD;;;OAGG;IACH,SAFY,MAAM,CAIjB;IA0BD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IA9BD;;;OAGG;IACH,SAFY,MAAM,CAIjB;IA0BD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IA9BD;;;OAGG;IACH,SAFY,MAAM,CAIjB;IAsCD;;;;;OAKG;IACH,iBAJW,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,GACJ,IAAI,CAQhB;IAED;;;;OAIG;IACH,gBAJW,MAAM,EAAE,GAAC,YAAY,iBAAU,WAC/B,MAAM,GACJ,MA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,eAFW;QAAC,CAAC,EAAC,MAAM,CAAC;QAAC,CAAC,EAAC,MAAM,CAAC;QAAC,CAAC,EAAC,MAAM,CAAA;KAAC,GAAC,MAAM,QAS/C;IAED,mBAEC;IAED;;;;OAIG;IACH,uBAHW,YAAY,QAOtB;IAED;;;;OAIG;IACH,yBAHW,YAAY,QAStB;IAED;;;;OAIG;IACH,8BAHW,YAAY,QAOtB;IAED;;;;OAIG;IACH,gCAHW,YAAY,QAStB;IAED,eAMC;IAgDL,2BA5de,OAAO,KACL,MAAM,CA2dY;IAEnC,gBA9iBiB,MAAM,CA8iBG;IAC1B;;;OAGG;IACH,gCAr7Be,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,aAo7BU;IAC/B;;;OAGG;IACH,gCA76Be,MAAM,EAAE,GAAC,YAAY,iBAAU,WAC/B,MAAM,KACJ,MAAM,EAAE,CA26BK;IAC9B;;;OAGG;IACH,2BAl7Be,MAAM,EAAE,GAAC,YAAY,iBAAU,WAC/B,MAAM,KACJ,MAAM,EAAE,CAg7BA;IA2DzB;;;OAGG;IACH,oBAFU,OAAO,CAEU;IA5gCvB;;;OAGG;IACH,qBAFY,SAAS,CAAC,MAAM,CAAC,CAQ5B;CA86BJ;;cA0BS,OAAO;aAOP,OAAO;mBAOP,OAAO;YAMP,OAAO;cAMP,OAAO;cAMP,OAAO;eAMP,OAAO;iBAMP,OAAO;cAMP,OAAO;kBAYP,MAAM;;;mBAjoCG,4BAA4B"}
|
package/src/core/geom/Vector3.js
CHANGED
|
@@ -64,13 +64,74 @@ export class Vector3 {
|
|
|
64
64
|
this.onChanged = new Signal();
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @return {number}
|
|
70
|
+
*/
|
|
71
|
+
get 0() {
|
|
72
|
+
return this.x;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @return {number}
|
|
78
|
+
*/
|
|
79
|
+
get 1() {
|
|
80
|
+
return this.y;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @return {number}
|
|
86
|
+
*/
|
|
87
|
+
get 2() {
|
|
88
|
+
return this.z;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param {number} v
|
|
94
|
+
*/
|
|
95
|
+
set 0(v) {
|
|
96
|
+
this.x = v;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
* @param {number} v
|
|
102
|
+
*/
|
|
103
|
+
set 1(v) {
|
|
104
|
+
this.y = v;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
*
|
|
109
|
+
* @param {number} v
|
|
110
|
+
*/
|
|
111
|
+
set 2(v) {
|
|
112
|
+
this.z = v;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* @return {Generator<number>}
|
|
118
|
+
*/
|
|
119
|
+
* [Symbol.iterator]() {
|
|
120
|
+
|
|
121
|
+
yield this.x;
|
|
122
|
+
yield this.y;
|
|
123
|
+
yield this.z;
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
67
127
|
/**
|
|
68
128
|
*
|
|
69
129
|
* @param {number[]|Float32Array} array
|
|
70
|
-
* @param {number} offset
|
|
130
|
+
* @param {number} [offset]
|
|
131
|
+
* @returns {this}
|
|
71
132
|
*/
|
|
72
|
-
|
|
73
|
-
this.set(
|
|
133
|
+
fromArray(array, offset = 0) {
|
|
134
|
+
return this.set(
|
|
74
135
|
array[offset],
|
|
75
136
|
array[offset + 1],
|
|
76
137
|
array[offset + 2]
|
|
@@ -78,11 +139,11 @@ export class Vector3 {
|
|
|
78
139
|
}
|
|
79
140
|
|
|
80
141
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @param {number[]
|
|
83
|
-
* @
|
|
142
|
+
* @param {number[]|Float32Array|ArrayLike} [array]
|
|
143
|
+
* @param {number} [offset]
|
|
144
|
+
* @returns {number[]}
|
|
84
145
|
*/
|
|
85
|
-
|
|
146
|
+
toArray(array = [], offset = 0) {
|
|
86
147
|
array[offset] = this.x;
|
|
87
148
|
array[offset + 1] = this.y;
|
|
88
149
|
array[offset + 2] = this.z;
|
|
@@ -118,7 +179,10 @@ export class Vector3 {
|
|
|
118
179
|
this.z = z;
|
|
119
180
|
|
|
120
181
|
if (this.onChanged.hasHandlers()) {
|
|
121
|
-
this.onChanged.send6(
|
|
182
|
+
this.onChanged.send6(
|
|
183
|
+
x, y, z,
|
|
184
|
+
oldX, oldY, oldZ
|
|
185
|
+
);
|
|
122
186
|
}
|
|
123
187
|
|
|
124
188
|
}
|
|
@@ -324,21 +388,21 @@ export class Vector3 {
|
|
|
324
388
|
}
|
|
325
389
|
|
|
326
390
|
/**
|
|
327
|
-
*
|
|
391
|
+
* Add a scalar value to each component of the vector
|
|
328
392
|
* @param {number} val
|
|
329
393
|
* @returns {this}
|
|
330
394
|
*/
|
|
331
|
-
|
|
332
|
-
return this.set(this.x
|
|
395
|
+
addScalar(val) {
|
|
396
|
+
return this.set(this.x + val, this.y + val, this.z + val);
|
|
333
397
|
}
|
|
334
398
|
|
|
335
399
|
/**
|
|
336
|
-
*
|
|
400
|
+
* Subtract scalar value from each component of the vector
|
|
337
401
|
* @param {number} val
|
|
338
402
|
* @returns {this}
|
|
339
403
|
*/
|
|
340
|
-
|
|
341
|
-
return this.
|
|
404
|
+
subScalar(val) {
|
|
405
|
+
return this.addScalar(-val);
|
|
342
406
|
}
|
|
343
407
|
|
|
344
408
|
/**
|
|
@@ -534,11 +598,7 @@ export class Vector3 {
|
|
|
534
598
|
distanceSqrTo(other) {
|
|
535
599
|
assert.defined(other, "other");
|
|
536
600
|
|
|
537
|
-
|
|
538
|
-
const dy = this.y - other.y;
|
|
539
|
-
const dz = this.z - other.z;
|
|
540
|
-
|
|
541
|
-
return v3_length_sqr(dx, dy, dz);
|
|
601
|
+
return this._distanceSqrTo(other.x, other.y, other.z);
|
|
542
602
|
}
|
|
543
603
|
|
|
544
604
|
/**
|
|
@@ -549,7 +609,11 @@ export class Vector3 {
|
|
|
549
609
|
* @return {number}
|
|
550
610
|
*/
|
|
551
611
|
_distanceSqrTo(x, y, z) {
|
|
552
|
-
return v3_length_sqr(
|
|
612
|
+
return v3_length_sqr(
|
|
613
|
+
this.x - x,
|
|
614
|
+
this.y - y,
|
|
615
|
+
this.z - z
|
|
616
|
+
);
|
|
553
617
|
}
|
|
554
618
|
|
|
555
619
|
/**
|
|
@@ -672,7 +736,7 @@ export class Vector3 {
|
|
|
672
736
|
const _y = (m4[1] * x + m4[5] * y + m4[9] * z + m4[13]) * w;
|
|
673
737
|
const _z = (m4[2] * x + m4[6] * y + m4[10] * z + m4[14]) * w;
|
|
674
738
|
|
|
675
|
-
|
|
739
|
+
return this.set(_x, _y, _z);
|
|
676
740
|
}
|
|
677
741
|
|
|
678
742
|
/**
|
|
@@ -729,7 +793,7 @@ export class Vector3 {
|
|
|
729
793
|
const _y = matrix4[13];
|
|
730
794
|
const _z = matrix4[14];
|
|
731
795
|
|
|
732
|
-
|
|
796
|
+
return this.set(_x, _y, _z);
|
|
733
797
|
}
|
|
734
798
|
|
|
735
799
|
/**
|
|
@@ -859,7 +923,7 @@ export class Vector3 {
|
|
|
859
923
|
const _y = radius * cos_phi;
|
|
860
924
|
const _z = radius * sin_phi * cos_theta;
|
|
861
925
|
|
|
862
|
-
|
|
926
|
+
return this.set(_x, _y, _z);
|
|
863
927
|
}
|
|
864
928
|
|
|
865
929
|
/**
|
|
@@ -958,39 +1022,6 @@ export class Vector3 {
|
|
|
958
1022
|
return x ^ (y << 1) ^ (z << 2);
|
|
959
1023
|
}
|
|
960
1024
|
|
|
961
|
-
|
|
962
|
-
get 0() {
|
|
963
|
-
return this.x;
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
get 1() {
|
|
967
|
-
return this.y;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
get 2() {
|
|
971
|
-
return this.z;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
set 0(v) {
|
|
975
|
-
this.x = v;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
set 1(v) {
|
|
979
|
-
this.y = v;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
set 2(v) {
|
|
983
|
-
this.z = v;
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
* [Symbol.iterator]() {
|
|
987
|
-
|
|
988
|
-
yield this.x;
|
|
989
|
-
yield this.y;
|
|
990
|
-
yield this.z;
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
|
|
994
1025
|
/**
|
|
995
1026
|
* Dot product
|
|
996
1027
|
* @param {Vector3|Vector4} a
|
|
@@ -1033,42 +1064,6 @@ export class Vector3 {
|
|
|
1033
1064
|
static fromScalar(value) {
|
|
1034
1065
|
return new Vector3(value, value, value);
|
|
1035
1066
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
/**
|
|
1039
|
-
*
|
|
1040
|
-
* @param {THREE.Matrix4} matrix4
|
|
1041
|
-
* @deprecated use {@link @applyMatrix4} directly instead, pass `mat.elements`
|
|
1042
|
-
*/
|
|
1043
|
-
applyMatrix4_three(matrix4) {
|
|
1044
|
-
throw new Error("use applyMatrix4 instead")
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
/**
|
|
1048
|
-
* @deprecated use non-three.js version instead
|
|
1049
|
-
* @param {THREE.Matrix4} m
|
|
1050
|
-
*/
|
|
1051
|
-
transformDirection_three(m) {
|
|
1052
|
-
throw new Error("use applyDirectionMatrix4 instead")
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* @deprecated use non-three.js version instead
|
|
1057
|
-
* @param {THREE.Matrix3} m
|
|
1058
|
-
* @returns {Vector3}
|
|
1059
|
-
*/
|
|
1060
|
-
applyMatrix3_three(m) {
|
|
1061
|
-
throw new Error("use applyMatrix3 instead")
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
/**
|
|
1065
|
-
* @deprecated use non-three.js version instead
|
|
1066
|
-
* @param {THREE.Matrix4} matrix4
|
|
1067
|
-
*/
|
|
1068
|
-
threejs_setFromMatrixPosition(matrix4) {
|
|
1069
|
-
throw new Error("use setFromMatrixPosition instead")
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
1067
|
}
|
|
1073
1068
|
|
|
1074
1069
|
// Aliases
|
|
@@ -1076,12 +1071,21 @@ export class Vector3 {
|
|
|
1076
1071
|
Vector3.prototype.distanceToSquared = Vector3.prototype.distanceSqrTo;
|
|
1077
1072
|
|
|
1078
1073
|
Vector3.prototype.lengthSq = Vector3.prototype.lengthSqr;
|
|
1079
|
-
Vector3.prototype.fromArray = Vector3.prototype.readFromArray;
|
|
1080
|
-
Vector3.prototype.toArray = Vector3.prototype.writeToArray;
|
|
1081
1074
|
/**
|
|
1082
|
-
* @
|
|
1075
|
+
* @readonly
|
|
1076
|
+
* @deprecated Use {@link fromArray} instead
|
|
1077
|
+
*/
|
|
1078
|
+
Vector3.prototype.readFromArray = Vector3.prototype.fromArray;
|
|
1079
|
+
/**
|
|
1080
|
+
* @readonly
|
|
1081
|
+
* @deprecated Use {@link toArray} instead
|
|
1082
|
+
*/
|
|
1083
|
+
Vector3.prototype.writeToArray = Vector3.prototype.toArray;
|
|
1084
|
+
/**
|
|
1085
|
+
* @readonly
|
|
1086
|
+
* @deprecated use {@link toArray} instead
|
|
1083
1087
|
*/
|
|
1084
|
-
Vector3.prototype.asArray = Vector3.prototype.
|
|
1088
|
+
Vector3.prototype.asArray = Vector3.prototype.toArray;
|
|
1085
1089
|
|
|
1086
1090
|
|
|
1087
1091
|
/**
|
|
@@ -900,7 +900,7 @@ export class ParticleEmitter {
|
|
|
900
900
|
//compute position for particle
|
|
901
901
|
emissionFunction(random, scratch_v3_array, 0);
|
|
902
902
|
|
|
903
|
-
v3position.
|
|
903
|
+
v3position.fromArray(scratch_v3_array, 0);
|
|
904
904
|
|
|
905
905
|
//apply layer transform
|
|
906
906
|
v3position.multiply(layer.scale);
|
|
@@ -1016,7 +1016,7 @@ export class ParticleEmitter {
|
|
|
1016
1016
|
//compute position for particle
|
|
1017
1017
|
emissionFunction(random, scratch_v3_array, 0);
|
|
1018
1018
|
|
|
1019
|
-
v3position.
|
|
1019
|
+
v3position.fromArray(scratch_v3_array, 0);
|
|
1020
1020
|
|
|
1021
1021
|
//apply layer transform
|
|
1022
1022
|
v3position.multiply(layer.scale);
|
|
@@ -223,7 +223,7 @@ function addSpotLight(position, direction, color, distance = 1, angle = 1, penum
|
|
|
223
223
|
|
|
224
224
|
const light = new SpotLight();
|
|
225
225
|
|
|
226
|
-
light.position.
|
|
226
|
+
light.position.fromArray(position, 0);
|
|
227
227
|
|
|
228
228
|
light.angle.set(
|
|
229
229
|
angle
|
|
@@ -231,7 +231,7 @@ function addSpotLight(position, direction, color, distance = 1, angle = 1, penum
|
|
|
231
231
|
light.penumbra.set(penumbra);
|
|
232
232
|
light.distance.set(distance);
|
|
233
233
|
light.intensity.set(intensity);
|
|
234
|
-
light.direction.
|
|
234
|
+
light.direction.fromArray(direction, 0);
|
|
235
235
|
|
|
236
236
|
if (typeof color === "number") {
|
|
237
237
|
light.color.fromUint(color);
|
|
@@ -515,7 +515,7 @@ class Path {
|
|
|
515
515
|
|
|
516
516
|
computeNonuniformCatmullRomSplineSample(scratch_array_4, scratch_array_0, scratch_array_1, scratch_array_2, scratch_array_3, 3, t, 0.5);
|
|
517
517
|
|
|
518
|
-
result.
|
|
518
|
+
result.fromArray(scratch_array_4, 0);
|
|
519
519
|
|
|
520
520
|
return (t < 0 && i1 !== max_index);
|
|
521
521
|
}
|