@xort/cga 0.0.82 → 0.0.84
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/build/@xort_cga.js +639 -314
- package/deploy.sh +13 -1
- package/dist/IKanimation/Bone.d.ts +1 -3
- package/dist/IKanimation/Bone.js +4 -22
- package/dist/alg/common.d.ts +2 -2
- package/dist/alg/common.js +4 -4
- package/dist/alg/extrude.js +4 -4
- package/dist/extends/geometryaid.js +7 -15
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/math/Color.d.ts +1 -2
- package/dist/math/Color.js +14 -31
- package/dist/math/Euler.d.ts +4 -5
- package/dist/math/Euler.js +16 -34
- package/dist/math/HVec3.d.ts +1 -2
- package/dist/math/HVec3.js +13 -30
- package/dist/math/Quat.d.ts +1 -2
- package/dist/math/Quat.js +23 -43
- package/dist/math/Vec2.d.ts +4 -4
- package/dist/math/Vec2.js +7 -24
- package/dist/math/Vec3.d.ts +5 -9
- package/dist/math/Vec3.js +35 -52
- package/dist/math/Vec4.d.ts +4 -4
- package/dist/math/Vec4.js +11 -28
- package/dist/math/vecs.d.ts +21 -1
- package/dist/math/vecs.js +85 -3
- package/dist/render/{buffer-attribute.d.ts → bufferAttribute.d.ts} +8 -4
- package/dist/render/{buffer-attribute.js → bufferAttribute.js} +4 -0
- package/dist/render/geometry.d.ts +7 -9
- package/dist/render/geometry.js +22 -25
- package/dist/render/mesh.d.ts +23 -18
- package/dist/render/mesh.js +62 -57
- package/dist/render/types.d.ts +1 -0
- package/dist/struct/3d/Box.d.ts +1 -1
- package/dist/struct/3d/Plane.js +1 -1
- package/package.json +73 -73
- package/rollup.config.js +1 -1
- package/src/IKanimation/Bone.ts +1 -5
- package/src/alg/common.ts +4 -4
- package/src/alg/extrude.ts +6 -6
- package/src/app.ts +2 -10
- package/src/extends/geometryaid.ts +10 -13
- package/src/index.ts +2 -4
- package/src/math/Color.ts +6 -8
- package/src/math/Euler.ts +11 -12
- package/src/math/HVec3.ts +3 -5
- package/src/math/Quat.ts +18 -23
- package/src/math/Vec2.ts +7 -7
- package/src/math/Vec3.ts +37 -36
- package/src/math/Vec4.ts +9 -9
- package/src/math/vecs.ts +104 -4
- package/src/render/{buffer-attribute.ts → bufferAttribute.ts} +11 -4
- package/src/render/geometry.ts +18 -15
- package/src/render/mesh.ts +56 -54
- package/src/render/types.ts +2 -0
- package/src/struct/3d/Box.ts +1 -1
- package/src/struct/3d/Plane.ts +2 -4
- package/dist/math/Vec.d.ts +0 -7
- package/dist/math/Vec.js +0 -41
- package/dist/math/vector.d.ts +0 -114
- package/dist/math/vector.js +0 -371
- package/dist/render/eventhandler.d.ts +0 -78
- package/dist/render/eventhandler.js +0 -191
- package/dist/render/thing.d.ts +0 -34
- package/dist/render/thing.js +0 -194
- package/src/math/Vec.ts +0 -26
- package/src/render/eventhandler.ts +0 -196
- package/src/render/thing.ts +0 -204
package/src/math/Quat.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { clamp } from "./Math";
|
|
2
2
|
import { Euler } from './Euler';
|
|
3
|
-
import { EventHandler } from '../render/eventhandler';
|
|
4
3
|
|
|
5
|
-
export class Quat
|
|
4
|
+
export class Quat {
|
|
6
5
|
isQuat: boolean = true;
|
|
7
6
|
constructor(public _x: number = 0, public _y: number = 0, public _z: number = 0, public _w: number = 1) {
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
}
|
|
10
9
|
get x() {
|
|
11
10
|
return this._x;
|
|
@@ -14,7 +13,7 @@ export class Quat extends EventHandler {
|
|
|
14
13
|
set x(value) {
|
|
15
14
|
if (this._x !== value) {
|
|
16
15
|
this._x = value;
|
|
17
|
-
this.fire('change', 'x', this._x, value)
|
|
16
|
+
// this.fire('change', 'x', this._x, value)
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -25,7 +24,7 @@ export class Quat extends EventHandler {
|
|
|
25
24
|
set y(value) {
|
|
26
25
|
if (this._y !== value) {
|
|
27
26
|
this._y = value;
|
|
28
|
-
this.fire('change', 'y', this._y, value)
|
|
27
|
+
// this.fire('change', 'y', this._y, value)
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -36,7 +35,7 @@ export class Quat extends EventHandler {
|
|
|
36
35
|
set z(value) {
|
|
37
36
|
if (this._z !== value) {
|
|
38
37
|
this._z = value;
|
|
39
|
-
this.fire('change', 'z', this._z, value)
|
|
38
|
+
// this.fire('change', 'z', this._z, value)
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -47,7 +46,7 @@ export class Quat extends EventHandler {
|
|
|
47
46
|
set w(value) {
|
|
48
47
|
if (this._w !== value) {
|
|
49
48
|
this._w = value;
|
|
50
|
-
this.fire('change', 'w', this._w, value)
|
|
49
|
+
// this.fire('change', 'w', this._w, value)
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
|
|
@@ -134,7 +133,7 @@ export class Quat extends EventHandler {
|
|
|
134
133
|
this._z = z;
|
|
135
134
|
this._w = w;
|
|
136
135
|
|
|
137
|
-
this.fire("change", this);
|
|
136
|
+
// this.fire("change", this);
|
|
138
137
|
|
|
139
138
|
return this;
|
|
140
139
|
}
|
|
@@ -149,17 +148,12 @@ export class Quat extends EventHandler {
|
|
|
149
148
|
this._z = quat.z;
|
|
150
149
|
this._w = quat.w;
|
|
151
150
|
|
|
152
|
-
this.fire("change", this);
|
|
151
|
+
// this.fire("change", this);
|
|
153
152
|
|
|
154
153
|
return this;
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
setFromEuler(euler: Euler, update?: boolean) {
|
|
158
|
-
if (!(euler && euler.isEuler)) {
|
|
159
|
-
throw new Error(
|
|
160
|
-
"Quat: .setFromEuler() now expects an Euler rotation rather than a Vec3 and order."
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
157
|
|
|
164
158
|
var x = euler._x,
|
|
165
159
|
y = euler._y,
|
|
@@ -213,7 +207,8 @@ export class Quat extends EventHandler {
|
|
|
213
207
|
this._w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
214
208
|
}
|
|
215
209
|
|
|
216
|
-
if (update !== false)
|
|
210
|
+
// if (update !== false)
|
|
211
|
+
// this.fire("change", this);
|
|
217
212
|
|
|
218
213
|
return this;
|
|
219
214
|
}
|
|
@@ -231,7 +226,7 @@ export class Quat extends EventHandler {
|
|
|
231
226
|
this._z = axis.z * s;
|
|
232
227
|
this._w = Math.cos(halfAngle);
|
|
233
228
|
|
|
234
|
-
this.fire("change", this);
|
|
229
|
+
// this.fire("change", this);
|
|
235
230
|
|
|
236
231
|
return this;
|
|
237
232
|
}
|
|
@@ -284,7 +279,7 @@ export class Quat extends EventHandler {
|
|
|
284
279
|
this._z = 0.25 * s;
|
|
285
280
|
}
|
|
286
281
|
|
|
287
|
-
this.fire("change", this);
|
|
282
|
+
// this.fire("change", this);
|
|
288
283
|
|
|
289
284
|
return this;
|
|
290
285
|
}
|
|
@@ -357,7 +352,7 @@ export class Quat extends EventHandler {
|
|
|
357
352
|
this._y *= -1;
|
|
358
353
|
this._z *= -1;
|
|
359
354
|
|
|
360
|
-
this.fire("change", this);
|
|
355
|
+
// this.fire("change", this);
|
|
361
356
|
|
|
362
357
|
return this;
|
|
363
358
|
}
|
|
@@ -401,7 +396,7 @@ export class Quat extends EventHandler {
|
|
|
401
396
|
this._w = this._w * l;
|
|
402
397
|
}
|
|
403
398
|
|
|
404
|
-
this.fire("change", this);
|
|
399
|
+
// this.fire("change", this);
|
|
405
400
|
|
|
406
401
|
return this;
|
|
407
402
|
}
|
|
@@ -435,7 +430,7 @@ export class Quat extends EventHandler {
|
|
|
435
430
|
this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
|
|
436
431
|
this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
|
|
437
432
|
|
|
438
|
-
this.fire("change", this);
|
|
433
|
+
// this.fire("change", this);
|
|
439
434
|
|
|
440
435
|
return this;
|
|
441
436
|
}
|
|
@@ -483,7 +478,7 @@ export class Quat extends EventHandler {
|
|
|
483
478
|
this._z = s * z + t * this._z;
|
|
484
479
|
|
|
485
480
|
this.normalize();
|
|
486
|
-
this.fire("change", this);
|
|
481
|
+
// this.fire("change", this);
|
|
487
482
|
|
|
488
483
|
return this;
|
|
489
484
|
}
|
|
@@ -498,7 +493,7 @@ export class Quat extends EventHandler {
|
|
|
498
493
|
this._y = y * ratioA + this._y * ratioB;
|
|
499
494
|
this._z = z * ratioA + this._z * ratioB;
|
|
500
495
|
|
|
501
|
-
this.fire("change", this);
|
|
496
|
+
// this.fire("change", this);
|
|
502
497
|
|
|
503
498
|
return this;
|
|
504
499
|
}
|
|
@@ -519,7 +514,7 @@ export class Quat extends EventHandler {
|
|
|
519
514
|
this._z = array[offset + 2];
|
|
520
515
|
this._w = array[offset + 3];
|
|
521
516
|
|
|
522
|
-
this.fire("change", this);
|
|
517
|
+
// this.fire("change", this);
|
|
523
518
|
|
|
524
519
|
return this;
|
|
525
520
|
}
|
package/src/math/Vec2.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Mat3 } from './Mat3';
|
|
2
|
-
import {
|
|
3
|
-
export class Vec2
|
|
2
|
+
import { TypedArrayLike } from '../render/types';
|
|
3
|
+
export class Vec2 {
|
|
4
4
|
isVec2: boolean = true;
|
|
5
5
|
|
|
6
6
|
constructor(private _x: number = 0, private _y: number = 0) {
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
get x() {
|
|
@@ -14,7 +14,7 @@ export class Vec2 extends EventHandler {
|
|
|
14
14
|
set x(value) {
|
|
15
15
|
if (this._x !== value) {
|
|
16
16
|
this._x = value;
|
|
17
|
-
|
|
17
|
+
// this.fire('change', 'x', this._x, value)
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ export class Vec2 extends EventHandler {
|
|
|
25
25
|
set y(value) {
|
|
26
26
|
if (this._y !== value) {
|
|
27
27
|
this._y = value;
|
|
28
|
-
|
|
28
|
+
// this.fire('change', 'y', this._y, value)
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -361,14 +361,14 @@ export class Vec2 extends EventHandler {
|
|
|
361
361
|
return v.x === this._x && v.y === this._y;
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
-
fromArray(array:
|
|
364
|
+
fromArray(array: TypedArrayLike, offset: number = 0) {
|
|
365
365
|
this._x = array[offset];
|
|
366
366
|
this._y = array[offset + 1];
|
|
367
367
|
|
|
368
368
|
return this;
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
toArray(array:
|
|
371
|
+
toArray(array: TypedArrayLike = [], offset: number = 0) {
|
|
372
372
|
array[offset] = this._x;
|
|
373
373
|
array[offset + 1] = this._y;
|
|
374
374
|
|
package/src/math/Vec3.ts
CHANGED
|
@@ -7,14 +7,14 @@ import { DistanceResult } from '../alg/result';
|
|
|
7
7
|
import { Line, line } from '../struct/3d/Line';
|
|
8
8
|
import { Ray } from '../struct/3d/Ray';
|
|
9
9
|
import { Segment } from '../struct/3d/Segment';
|
|
10
|
-
import { Plane } from '../struct/3d/Plane';
|
|
11
|
-
import { EventHandler } from '../render/eventhandler';
|
|
10
|
+
import { Plane } from '../struct/3d/Plane';
|
|
12
11
|
import { Triangle } from '../struct/3d/Triangle';
|
|
13
12
|
import { Capsule } from '../struct/3d/Capsule';
|
|
14
13
|
import { Rectangle } from '../struct/3d/Rectangle';
|
|
15
14
|
import { Circle } from '../struct/3d/Circle';
|
|
16
15
|
import { Disk } from '../struct/3d/Disk';
|
|
17
16
|
import { Polyline } from '..';
|
|
17
|
+
import { TypedArrayLike } from '../render/types';
|
|
18
18
|
// import { wgs84RadiiSquared } from '../gis/gis';
|
|
19
19
|
export interface IVec2 {
|
|
20
20
|
x: number;
|
|
@@ -27,11 +27,12 @@ export interface IVec4 extends IVec3 {
|
|
|
27
27
|
w: number;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export class Vec3
|
|
30
|
+
export class Vec3 implements IVec3 {
|
|
31
31
|
|
|
32
32
|
constructor(private _x: number = 0, private _y: number = 0, private _z: number = 0) {
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
}
|
|
35
|
+
|
|
35
36
|
get x() {
|
|
36
37
|
return this._x;
|
|
37
38
|
}
|
|
@@ -39,7 +40,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
39
40
|
set x(value) {
|
|
40
41
|
if (this._x !== value) {
|
|
41
42
|
this._x = value;
|
|
42
|
-
this.fire('change', 'x', this._x, value)
|
|
43
|
+
// this.fire('change', 'x', this._x, value)
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -50,7 +51,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
50
51
|
set y(value) {
|
|
51
52
|
if (this._y !== value) {
|
|
52
53
|
this._y = value;
|
|
53
|
-
this.fire('change', 'y', this._y, value)
|
|
54
|
+
// this.fire('change', 'y', this._y, value)
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -61,7 +62,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
61
62
|
set z(value) {
|
|
62
63
|
if (this._z !== value) {
|
|
63
64
|
this._z = value;
|
|
64
|
-
this.fire('change', 'z', this._z, value)
|
|
65
|
+
// this.fire('change', 'z', this._z, value)
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -97,7 +98,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
97
98
|
this._x = x;
|
|
98
99
|
this._y = y;
|
|
99
100
|
this._z = z;
|
|
100
|
-
|
|
101
|
+
//// this.fire('change');
|
|
101
102
|
return this;
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -106,7 +107,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
106
107
|
this._y = scalar;
|
|
107
108
|
this._z = scalar;
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
// this.fire('change');
|
|
110
111
|
return this;
|
|
111
112
|
}
|
|
112
113
|
|
|
@@ -150,7 +151,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
150
151
|
this._y = v.y;
|
|
151
152
|
this._z = v.z;
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
// this.fire('change');
|
|
154
155
|
return this;
|
|
155
156
|
}
|
|
156
157
|
|
|
@@ -166,7 +167,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
166
167
|
this._y += v.y;
|
|
167
168
|
this._z += v.z;
|
|
168
169
|
|
|
169
|
-
|
|
170
|
+
// this.fire('change');
|
|
170
171
|
return this;
|
|
171
172
|
}
|
|
172
173
|
|
|
@@ -175,7 +176,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
175
176
|
this._y += s;
|
|
176
177
|
this._z += s;
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
// this.fire('change');
|
|
179
180
|
return this;
|
|
180
181
|
}
|
|
181
182
|
|
|
@@ -184,7 +185,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
184
185
|
this._y = a.y + b.y;
|
|
185
186
|
this._z = a.z + b.z;
|
|
186
187
|
|
|
187
|
-
|
|
188
|
+
// this.fire('change');
|
|
188
189
|
return this;
|
|
189
190
|
}
|
|
190
191
|
|
|
@@ -193,7 +194,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
193
194
|
this._y += v.y * s;
|
|
194
195
|
this._z += v.z * s;
|
|
195
196
|
|
|
196
|
-
|
|
197
|
+
// this.fire('change');
|
|
197
198
|
return this;
|
|
198
199
|
}
|
|
199
200
|
|
|
@@ -209,7 +210,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
209
210
|
this._y -= v.y;
|
|
210
211
|
this._z -= v.z;
|
|
211
212
|
|
|
212
|
-
|
|
213
|
+
// this.fire('change');
|
|
213
214
|
return this;
|
|
214
215
|
}
|
|
215
216
|
|
|
@@ -218,7 +219,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
218
219
|
this._y -= s;
|
|
219
220
|
this._z -= s;
|
|
220
221
|
|
|
221
|
-
|
|
222
|
+
// this.fire('change');
|
|
222
223
|
return this;
|
|
223
224
|
}
|
|
224
225
|
|
|
@@ -227,7 +228,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
227
228
|
this._y = a.y - b.y;
|
|
228
229
|
this._z = a.z - b.z;
|
|
229
230
|
|
|
230
|
-
|
|
231
|
+
// this.fire('change');
|
|
231
232
|
return this;
|
|
232
233
|
}
|
|
233
234
|
|
|
@@ -240,7 +241,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
240
241
|
this._y *= v.y;
|
|
241
242
|
this._z *= v.z;
|
|
242
243
|
|
|
243
|
-
|
|
244
|
+
// this.fire('change');
|
|
244
245
|
return this;
|
|
245
246
|
}
|
|
246
247
|
|
|
@@ -249,7 +250,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
249
250
|
this._y *= scalar;
|
|
250
251
|
this._z *= scalar;
|
|
251
252
|
|
|
252
|
-
|
|
253
|
+
// this.fire('change');
|
|
253
254
|
return this;
|
|
254
255
|
}
|
|
255
256
|
|
|
@@ -258,7 +259,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
258
259
|
this._y = a.y * b.y;
|
|
259
260
|
this._z = a.z * b.z;
|
|
260
261
|
|
|
261
|
-
|
|
262
|
+
// this.fire('change');
|
|
262
263
|
return this;
|
|
263
264
|
}
|
|
264
265
|
|
|
@@ -290,7 +291,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
290
291
|
this._y = e[1] * x + e[4] * y + e[7] * z;
|
|
291
292
|
this._z = e[2] * x + e[5] * y + e[8] * z;
|
|
292
293
|
|
|
293
|
-
|
|
294
|
+
// this.fire('change');
|
|
294
295
|
return this;
|
|
295
296
|
}
|
|
296
297
|
|
|
@@ -306,11 +307,11 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
306
307
|
this._y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;
|
|
307
308
|
this._z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;
|
|
308
309
|
|
|
309
|
-
|
|
310
|
+
// this.fire('change');
|
|
310
311
|
return this;
|
|
311
312
|
}
|
|
312
313
|
|
|
313
|
-
applyQuat(q:
|
|
314
|
+
applyQuat(q: Quat) {
|
|
314
315
|
var x = this._x,
|
|
315
316
|
y = this._y,
|
|
316
317
|
z = this._z;
|
|
@@ -332,7 +333,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
332
333
|
this._y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
|
|
333
334
|
this._z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
|
|
334
335
|
|
|
335
|
-
|
|
336
|
+
// this.fire('change');
|
|
336
337
|
return this;
|
|
337
338
|
}
|
|
338
339
|
|
|
@@ -361,7 +362,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
361
362
|
this._y = e[1] * x + e[5] * y + e[9] * z;
|
|
362
363
|
this._z = e[2] * x + e[6] * y + e[10] * z;
|
|
363
364
|
|
|
364
|
-
|
|
365
|
+
// this.fire('change');
|
|
365
366
|
return this.normalize();
|
|
366
367
|
}
|
|
367
368
|
|
|
@@ -370,7 +371,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
370
371
|
this._y /= v.y;
|
|
371
372
|
this._z /= v.z;
|
|
372
373
|
|
|
373
|
-
|
|
374
|
+
// this.fire('change');
|
|
374
375
|
return this;
|
|
375
376
|
}
|
|
376
377
|
|
|
@@ -383,7 +384,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
383
384
|
this._y = Math.min(this._y, v.y);
|
|
384
385
|
this._z = Math.min(this._z, v.z);
|
|
385
386
|
|
|
386
|
-
|
|
387
|
+
// this.fire('change');
|
|
387
388
|
return this;
|
|
388
389
|
}
|
|
389
390
|
|
|
@@ -392,7 +393,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
392
393
|
this._y = Math.max(this._y, v.y);
|
|
393
394
|
this._z = Math.max(this._z, v.z);
|
|
394
395
|
|
|
395
|
-
|
|
396
|
+
// this.fire('change');
|
|
396
397
|
return this;
|
|
397
398
|
}
|
|
398
399
|
|
|
@@ -403,7 +404,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
403
404
|
this._y = Math.max(min.y, Math.min(max.y, this._y));
|
|
404
405
|
this._z = Math.max(min.z, Math.min(max.z, this._z));
|
|
405
406
|
|
|
406
|
-
|
|
407
|
+
// this.fire('change');
|
|
407
408
|
return this;
|
|
408
409
|
}
|
|
409
410
|
|
|
@@ -412,7 +413,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
412
413
|
this._y = Math.max(minVal, Math.min(maxVal, this._y));
|
|
413
414
|
this._z = Math.max(minVal, Math.min(maxVal, this._z));
|
|
414
415
|
|
|
415
|
-
|
|
416
|
+
// this.fire('change');
|
|
416
417
|
return this;
|
|
417
418
|
}
|
|
418
419
|
|
|
@@ -429,7 +430,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
429
430
|
this._y = Math.floor(this._y);
|
|
430
431
|
this._z = Math.floor(this._z);
|
|
431
432
|
|
|
432
|
-
|
|
433
|
+
// this.fire('change');
|
|
433
434
|
return this;
|
|
434
435
|
}
|
|
435
436
|
|
|
@@ -438,7 +439,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
438
439
|
this._y = Math.ceil(this._y);
|
|
439
440
|
this._z = Math.ceil(this._z);
|
|
440
441
|
|
|
441
|
-
|
|
442
|
+
// this.fire('change');
|
|
442
443
|
return this;
|
|
443
444
|
}
|
|
444
445
|
|
|
@@ -447,7 +448,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
447
448
|
this._y = Math.round(this._y);
|
|
448
449
|
this._z = Math.round(this._z);
|
|
449
450
|
|
|
450
|
-
|
|
451
|
+
// this.fire('change');
|
|
451
452
|
return this;
|
|
452
453
|
}
|
|
453
454
|
|
|
@@ -456,7 +457,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
456
457
|
this._y = this._y < 0 ? Math.ceil(this._y) : Math.floor(this._y);
|
|
457
458
|
this._z = this._z < 0 ? Math.ceil(this._z) : Math.floor(this._z);
|
|
458
459
|
|
|
459
|
-
|
|
460
|
+
// this.fire('change');
|
|
460
461
|
return this;
|
|
461
462
|
}
|
|
462
463
|
|
|
@@ -465,7 +466,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
465
466
|
this._y = -this._y;
|
|
466
467
|
this._z = -this._z;
|
|
467
468
|
|
|
468
|
-
|
|
469
|
+
// this.fire('change');
|
|
469
470
|
return this;
|
|
470
471
|
}
|
|
471
472
|
|
|
@@ -771,7 +772,7 @@ export class Vec3 extends EventHandler implements IVec3 {
|
|
|
771
772
|
return this;
|
|
772
773
|
}
|
|
773
774
|
|
|
774
|
-
toArray(array:
|
|
775
|
+
toArray(array: TypedArrayLike = [], offset: number = 0) {
|
|
775
776
|
|
|
776
777
|
array[offset] = this._x;
|
|
777
778
|
array[offset + 1] = this._y;
|
package/src/math/Vec4.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypedArrayLike } from '../render/types';
|
|
2
2
|
|
|
3
|
-
export class Vec4
|
|
3
|
+
export class Vec4 {
|
|
4
4
|
isVec4: boolean = true;
|
|
5
5
|
|
|
6
6
|
constructor(private _x: number = 0, private _y: number = 0, private _z: number = 0, private _w: number = 1) {
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ export class Vec4 extends EventHandler {
|
|
|
15
15
|
set x(value) {
|
|
16
16
|
if (this._x !== value) {
|
|
17
17
|
this._x = value;
|
|
18
|
-
this.fire('change', 'x', this._x, value)
|
|
18
|
+
// this.fire('change', 'x', this._x, value)
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -26,7 +26,7 @@ export class Vec4 extends EventHandler {
|
|
|
26
26
|
set y(value) {
|
|
27
27
|
if (this._y !== value) {
|
|
28
28
|
this._y = value;
|
|
29
|
-
this.fire('change', 'y', this._y, value)
|
|
29
|
+
// this.fire('change', 'y', this._y, value)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ export class Vec4 extends EventHandler {
|
|
|
37
37
|
set z(value) {
|
|
38
38
|
if (this._z !== value) {
|
|
39
39
|
this._z = value;
|
|
40
|
-
this.fire('change', 'z', this._z, value)
|
|
40
|
+
// this.fire('change', 'z', this._z, value)
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -48,7 +48,7 @@ export class Vec4 extends EventHandler {
|
|
|
48
48
|
set w(value) {
|
|
49
49
|
if (this._w !== value) {
|
|
50
50
|
this._w = value;
|
|
51
|
-
this.fire('change', 'w', this._w, value)
|
|
51
|
+
// this.fire('change', 'w', this._w, value)
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -546,7 +546,7 @@ export class Vec4 extends EventHandler {
|
|
|
546
546
|
return v.x === this._x && v.y === this._y && v.z === this._z && v.w === this._w;
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
fromArray(array:
|
|
549
|
+
fromArray(array: TypedArrayLike, offset: number = 0) {
|
|
550
550
|
this._x = array[offset];
|
|
551
551
|
this._y = array[offset + 1];
|
|
552
552
|
this._z = array[offset + 2];
|
|
@@ -555,7 +555,7 @@ export class Vec4 extends EventHandler {
|
|
|
555
555
|
return this;
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
-
toArray(array:
|
|
558
|
+
toArray(array: TypedArrayLike = [], offset: number = 0) {
|
|
559
559
|
|
|
560
560
|
array[offset] = this._x;
|
|
561
561
|
array[offset + 1] = this._y;
|