@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/dist/math/Quat.js
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.quat = exports.Quat = void 0;
|
|
17
4
|
var Math_1 = require("./Math");
|
|
18
|
-
var
|
|
19
|
-
var Quat = /** @class */ (function (_super) {
|
|
20
|
-
__extends(Quat, _super);
|
|
5
|
+
var Quat = /** @class */ (function () {
|
|
21
6
|
function Quat(_x, _y, _z, _w) {
|
|
22
7
|
if (_x === void 0) { _x = 0; }
|
|
23
8
|
if (_y === void 0) { _y = 0; }
|
|
24
9
|
if (_z === void 0) { _z = 0; }
|
|
25
10
|
if (_w === void 0) { _w = 1; }
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_this.isQuat = true;
|
|
32
|
-
return _this;
|
|
11
|
+
this._x = _x;
|
|
12
|
+
this._y = _y;
|
|
13
|
+
this._z = _z;
|
|
14
|
+
this._w = _w;
|
|
15
|
+
this.isQuat = true;
|
|
33
16
|
}
|
|
34
17
|
Object.defineProperty(Quat.prototype, "x", {
|
|
35
18
|
get: function () {
|
|
@@ -38,7 +21,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
38
21
|
set: function (value) {
|
|
39
22
|
if (this._x !== value) {
|
|
40
23
|
this._x = value;
|
|
41
|
-
this.fire('change', 'x', this._x, value)
|
|
24
|
+
// this.fire('change', 'x', this._x, value)
|
|
42
25
|
}
|
|
43
26
|
},
|
|
44
27
|
enumerable: false,
|
|
@@ -51,7 +34,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
51
34
|
set: function (value) {
|
|
52
35
|
if (this._y !== value) {
|
|
53
36
|
this._y = value;
|
|
54
|
-
this.fire('change', 'y', this._y, value)
|
|
37
|
+
// this.fire('change', 'y', this._y, value)
|
|
55
38
|
}
|
|
56
39
|
},
|
|
57
40
|
enumerable: false,
|
|
@@ -64,7 +47,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
64
47
|
set: function (value) {
|
|
65
48
|
if (this._z !== value) {
|
|
66
49
|
this._z = value;
|
|
67
|
-
this.fire('change', 'z', this._z, value)
|
|
50
|
+
// this.fire('change', 'z', this._z, value)
|
|
68
51
|
}
|
|
69
52
|
},
|
|
70
53
|
enumerable: false,
|
|
@@ -77,7 +60,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
77
60
|
set: function (value) {
|
|
78
61
|
if (this._w !== value) {
|
|
79
62
|
this._w = value;
|
|
80
|
-
this.fire('change', 'w', this._w, value)
|
|
63
|
+
// this.fire('change', 'w', this._w, value)
|
|
81
64
|
}
|
|
82
65
|
},
|
|
83
66
|
enumerable: false,
|
|
@@ -136,7 +119,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
136
119
|
this._y = y;
|
|
137
120
|
this._z = z;
|
|
138
121
|
this._w = w;
|
|
139
|
-
this.fire("change", this);
|
|
122
|
+
// this.fire("change", this);
|
|
140
123
|
return this;
|
|
141
124
|
};
|
|
142
125
|
Quat.prototype.clone = function () {
|
|
@@ -147,13 +130,10 @@ var Quat = /** @class */ (function (_super) {
|
|
|
147
130
|
this._y = quat.y;
|
|
148
131
|
this._z = quat.z;
|
|
149
132
|
this._w = quat.w;
|
|
150
|
-
this.fire("change", this);
|
|
133
|
+
// this.fire("change", this);
|
|
151
134
|
return this;
|
|
152
135
|
};
|
|
153
136
|
Quat.prototype.setFromEuler = function (euler, update) {
|
|
154
|
-
if (!(euler && euler.isEuler)) {
|
|
155
|
-
throw new Error("Quat: .setFromEuler() now expects an Euler rotation rather than a Vec3 and order.");
|
|
156
|
-
}
|
|
157
137
|
var x = euler._x, y = euler._y, z = euler._z, order = euler.order;
|
|
158
138
|
// http://www.mathworks.com/matlabcentral/fileexchange/
|
|
159
139
|
// 20696-function-to-convert-between-dcm-Euler-angles-Quats-and-Euler-Vecs/
|
|
@@ -202,8 +182,8 @@ var Quat = /** @class */ (function (_super) {
|
|
|
202
182
|
this._z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
203
183
|
this._w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
204
184
|
}
|
|
205
|
-
if (update !== false)
|
|
206
|
-
|
|
185
|
+
// if (update !== false)
|
|
186
|
+
// this.fire("change", this);
|
|
207
187
|
return this;
|
|
208
188
|
};
|
|
209
189
|
Quat.prototype.setFromAxisAngle = function (axis, angle) {
|
|
@@ -214,7 +194,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
214
194
|
this._y = axis.y * s;
|
|
215
195
|
this._z = axis.z * s;
|
|
216
196
|
this._w = Math.cos(halfAngle);
|
|
217
|
-
this.fire("change", this);
|
|
197
|
+
// this.fire("change", this);
|
|
218
198
|
return this;
|
|
219
199
|
};
|
|
220
200
|
Quat.prototype.setFromRotationMat = function (m) {
|
|
@@ -249,7 +229,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
249
229
|
this._y = (m23 + m32) / s;
|
|
250
230
|
this._z = 0.25 * s;
|
|
251
231
|
}
|
|
252
|
-
this.fire("change", this);
|
|
232
|
+
// this.fire("change", this);
|
|
253
233
|
return this;
|
|
254
234
|
};
|
|
255
235
|
Quat.prototype.setFromUnitVecs = function (vFrom, vTo) {
|
|
@@ -303,7 +283,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
303
283
|
this._x *= -1;
|
|
304
284
|
this._y *= -1;
|
|
305
285
|
this._z *= -1;
|
|
306
|
-
this.fire("change", this);
|
|
286
|
+
// this.fire("change", this);
|
|
307
287
|
return this;
|
|
308
288
|
};
|
|
309
289
|
Quat.prototype.dot = function (v) {
|
|
@@ -336,7 +316,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
336
316
|
this._z = this._z * l;
|
|
337
317
|
this._w = this._w * l;
|
|
338
318
|
}
|
|
339
|
-
this.fire("change", this);
|
|
319
|
+
// this.fire("change", this);
|
|
340
320
|
return this;
|
|
341
321
|
};
|
|
342
322
|
Quat.prototype.multiply = function (q, p) {
|
|
@@ -356,7 +336,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
356
336
|
this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
|
|
357
337
|
this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
|
|
358
338
|
this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
|
|
359
|
-
this.fire("change", this);
|
|
339
|
+
// this.fire("change", this);
|
|
360
340
|
return this;
|
|
361
341
|
};
|
|
362
342
|
Quat.prototype.slerp = function (qb, t) {
|
|
@@ -392,7 +372,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
392
372
|
this._y = s * y + t * this._y;
|
|
393
373
|
this._z = s * z + t * this._z;
|
|
394
374
|
this.normalize();
|
|
395
|
-
this.fire("change", this);
|
|
375
|
+
// this.fire("change", this);
|
|
396
376
|
return this;
|
|
397
377
|
}
|
|
398
378
|
var sinHalfTheta = Math.sqrt(sqrSinHalfTheta);
|
|
@@ -402,7 +382,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
402
382
|
this._x = x * ratioA + this._x * ratioB;
|
|
403
383
|
this._y = y * ratioA + this._y * ratioB;
|
|
404
384
|
this._z = z * ratioA + this._z * ratioB;
|
|
405
|
-
this.fire("change", this);
|
|
385
|
+
// this.fire("change", this);
|
|
406
386
|
return this;
|
|
407
387
|
};
|
|
408
388
|
Quat.prototype.equals = function (quat) {
|
|
@@ -417,7 +397,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
417
397
|
this._y = array[offset + 1];
|
|
418
398
|
this._z = array[offset + 2];
|
|
419
399
|
this._w = array[offset + 3];
|
|
420
|
-
this.fire("change", this);
|
|
400
|
+
// this.fire("change", this);
|
|
421
401
|
return this;
|
|
422
402
|
};
|
|
423
403
|
Quat.prototype.toArray = function (array, offset) {
|
|
@@ -430,7 +410,7 @@ var Quat = /** @class */ (function (_super) {
|
|
|
430
410
|
return array;
|
|
431
411
|
};
|
|
432
412
|
return Quat;
|
|
433
|
-
}(
|
|
413
|
+
}());
|
|
434
414
|
exports.Quat = Quat;
|
|
435
415
|
function quat(x, y, z, w) {
|
|
436
416
|
return new Quat(x, y, z, w);
|
package/dist/math/Vec2.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Mat3 } from './Mat3';
|
|
2
|
-
import {
|
|
3
|
-
export declare class Vec2
|
|
2
|
+
import { TypedArrayLike } from '../render/types';
|
|
3
|
+
export declare class Vec2 {
|
|
4
4
|
private _x;
|
|
5
5
|
private _y;
|
|
6
6
|
isVec2: boolean;
|
|
@@ -60,8 +60,8 @@ export declare class Vec2 extends EventHandler {
|
|
|
60
60
|
lerp(v: Vec2, alpha: number): this;
|
|
61
61
|
lerpVecs(v1: Vec2, v2: Vec2, alpha: number): this;
|
|
62
62
|
equals(v: Vec2): boolean;
|
|
63
|
-
fromArray(array:
|
|
64
|
-
toArray(array?:
|
|
63
|
+
fromArray(array: TypedArrayLike, offset?: number): this;
|
|
64
|
+
toArray(array?: TypedArrayLike, offset?: number): TypedArrayLike;
|
|
65
65
|
fromBufferAttribute(attribute: any, index: number, offset: any): this;
|
|
66
66
|
rotateAround(center: Vec2, angle: number): this;
|
|
67
67
|
}
|
package/dist/math/Vec2.js
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.v2 = exports.Vec2 = void 0;
|
|
17
|
-
var
|
|
18
|
-
var Vec2 = /** @class */ (function (_super) {
|
|
19
|
-
__extends(Vec2, _super);
|
|
4
|
+
var Vec2 = /** @class */ (function () {
|
|
20
5
|
function Vec2(_x, _y) {
|
|
21
6
|
if (_x === void 0) { _x = 0; }
|
|
22
7
|
if (_y === void 0) { _y = 0; }
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.isVec2 = true;
|
|
27
|
-
return _this;
|
|
8
|
+
this._x = _x;
|
|
9
|
+
this._y = _y;
|
|
10
|
+
this.isVec2 = true;
|
|
28
11
|
}
|
|
29
12
|
Object.defineProperty(Vec2.prototype, "x", {
|
|
30
13
|
get: function () {
|
|
@@ -33,7 +16,7 @@ var Vec2 = /** @class */ (function (_super) {
|
|
|
33
16
|
set: function (value) {
|
|
34
17
|
if (this._x !== value) {
|
|
35
18
|
this._x = value;
|
|
36
|
-
this.fire('change', 'x', this._x, value)
|
|
19
|
+
// this.fire('change', 'x', this._x, value)
|
|
37
20
|
}
|
|
38
21
|
},
|
|
39
22
|
enumerable: false,
|
|
@@ -46,7 +29,7 @@ var Vec2 = /** @class */ (function (_super) {
|
|
|
46
29
|
set: function (value) {
|
|
47
30
|
if (this._y !== value) {
|
|
48
31
|
this._y = value;
|
|
49
|
-
this.fire('change', 'y', this._y, value)
|
|
32
|
+
// this.fire('change', 'y', this._y, value)
|
|
50
33
|
}
|
|
51
34
|
},
|
|
52
35
|
enumerable: false,
|
|
@@ -337,7 +320,7 @@ var Vec2 = /** @class */ (function (_super) {
|
|
|
337
320
|
return this;
|
|
338
321
|
};
|
|
339
322
|
return Vec2;
|
|
340
|
-
}(
|
|
323
|
+
}());
|
|
341
324
|
exports.Vec2 = Vec2;
|
|
342
325
|
function v2() {
|
|
343
326
|
return new Vec2();
|
package/dist/math/Vec3.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Quat } from './Quat';
|
|
1
2
|
import { Mat3 } from './Mat3';
|
|
2
3
|
import { Mat4 } from './Mat4';
|
|
3
4
|
import { Euler } from './Euler';
|
|
@@ -6,13 +7,13 @@ import { Line } from '../struct/3d/Line';
|
|
|
6
7
|
import { Ray } from '../struct/3d/Ray';
|
|
7
8
|
import { Segment } from '../struct/3d/Segment';
|
|
8
9
|
import { Plane } from '../struct/3d/Plane';
|
|
9
|
-
import { EventHandler } from '../render/eventhandler';
|
|
10
10
|
import { Triangle } from '../struct/3d/Triangle';
|
|
11
11
|
import { Capsule } from '../struct/3d/Capsule';
|
|
12
12
|
import { Rectangle } from '../struct/3d/Rectangle';
|
|
13
13
|
import { Circle } from '../struct/3d/Circle';
|
|
14
14
|
import { Disk } from '../struct/3d/Disk';
|
|
15
15
|
import { Polyline } from '..';
|
|
16
|
+
import { TypedArrayLike } from '../render/types';
|
|
16
17
|
export interface IVec2 {
|
|
17
18
|
x: number;
|
|
18
19
|
y: number;
|
|
@@ -23,7 +24,7 @@ export interface IVec3 extends IVec2 {
|
|
|
23
24
|
export interface IVec4 extends IVec3 {
|
|
24
25
|
w: number;
|
|
25
26
|
}
|
|
26
|
-
export declare class Vec3
|
|
27
|
+
export declare class Vec3 implements IVec3 {
|
|
27
28
|
private _x;
|
|
28
29
|
private _y;
|
|
29
30
|
private _z;
|
|
@@ -62,12 +63,7 @@ export declare class Vec3 extends EventHandler implements IVec3 {
|
|
|
62
63
|
applyNormalMat(m: Mat3): this;
|
|
63
64
|
applyMat3(m: Mat3): this;
|
|
64
65
|
applyMat4(m: Mat4): this;
|
|
65
|
-
applyQuat(q:
|
|
66
|
-
x: any;
|
|
67
|
-
y: any;
|
|
68
|
-
z: any;
|
|
69
|
-
w: any;
|
|
70
|
-
}): this;
|
|
66
|
+
applyQuat(q: Quat): this;
|
|
71
67
|
project(camera: {
|
|
72
68
|
matrixWorldInverse: any;
|
|
73
69
|
projectionMat: any;
|
|
@@ -161,7 +157,7 @@ export declare class Vec3 extends EventHandler implements IVec3 {
|
|
|
161
157
|
}, index: number): this;
|
|
162
158
|
equals(v: Vec3): boolean;
|
|
163
159
|
fromArray(array: ArrayLike<number>, offset?: number): this;
|
|
164
|
-
toArray(array?:
|
|
160
|
+
toArray(array?: TypedArrayLike, offset?: number): TypedArrayLike;
|
|
165
161
|
fromBufferAttribute(attribute: {
|
|
166
162
|
getX: (arg0: any) => number;
|
|
167
163
|
getY: (arg0: any) => number;
|
package/dist/math/Vec3.js
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.v3 = exports.Vec3 = void 0;
|
|
17
4
|
var Quat_1 = require("./Quat");
|
|
18
5
|
var Math_1 = require("./Math");
|
|
19
6
|
var Segment_1 = require("../struct/3d/Segment");
|
|
20
|
-
var
|
|
21
|
-
var Vec3 = /** @class */ (function (_super) {
|
|
22
|
-
__extends(Vec3, _super);
|
|
7
|
+
var Vec3 = /** @class */ (function () {
|
|
23
8
|
function Vec3(_x, _y, _z) {
|
|
24
9
|
if (_x === void 0) { _x = 0; }
|
|
25
10
|
if (_y === void 0) { _y = 0; }
|
|
26
11
|
if (_z === void 0) { _z = 0; }
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_this._z = _z;
|
|
31
|
-
return _this;
|
|
12
|
+
this._x = _x;
|
|
13
|
+
this._y = _y;
|
|
14
|
+
this._z = _z;
|
|
32
15
|
}
|
|
33
16
|
Object.defineProperty(Vec3.prototype, "x", {
|
|
34
17
|
get: function () {
|
|
@@ -37,7 +20,7 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
37
20
|
set: function (value) {
|
|
38
21
|
if (this._x !== value) {
|
|
39
22
|
this._x = value;
|
|
40
|
-
this.fire('change', 'x', this._x, value)
|
|
23
|
+
// this.fire('change', 'x', this._x, value)
|
|
41
24
|
}
|
|
42
25
|
},
|
|
43
26
|
enumerable: false,
|
|
@@ -50,7 +33,7 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
50
33
|
set: function (value) {
|
|
51
34
|
if (this._y !== value) {
|
|
52
35
|
this._y = value;
|
|
53
|
-
this.fire('change', 'y', this._y, value)
|
|
36
|
+
// this.fire('change', 'y', this._y, value)
|
|
54
37
|
}
|
|
55
38
|
},
|
|
56
39
|
enumerable: false,
|
|
@@ -63,7 +46,7 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
63
46
|
set: function (value) {
|
|
64
47
|
if (this._z !== value) {
|
|
65
48
|
this._z = value;
|
|
66
|
-
this.fire('change', 'z', this._z, value)
|
|
49
|
+
// this.fire('change', 'z', this._z, value)
|
|
67
50
|
}
|
|
68
51
|
},
|
|
69
52
|
enumerable: false,
|
|
@@ -116,14 +99,14 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
116
99
|
this._x = x;
|
|
117
100
|
this._y = y;
|
|
118
101
|
this._z = z;
|
|
119
|
-
this.fire('change');
|
|
102
|
+
//// this.fire('change');
|
|
120
103
|
return this;
|
|
121
104
|
};
|
|
122
105
|
Vec3.prototype.setScalar = function (scalar) {
|
|
123
106
|
this._x = scalar;
|
|
124
107
|
this._y = scalar;
|
|
125
108
|
this._z = scalar;
|
|
126
|
-
this.fire('change');
|
|
109
|
+
// this.fire('change');
|
|
127
110
|
return this;
|
|
128
111
|
};
|
|
129
112
|
Vec3.prototype.setComponent = function (index, value) {
|
|
@@ -161,7 +144,7 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
161
144
|
this._x = v.x;
|
|
162
145
|
this._y = v.y;
|
|
163
146
|
this._z = v.z;
|
|
164
|
-
this.fire('change');
|
|
147
|
+
// this.fire('change');
|
|
165
148
|
return this;
|
|
166
149
|
};
|
|
167
150
|
Vec3.prototype.add = function (v, w) {
|
|
@@ -172,28 +155,28 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
172
155
|
this._x += v.x;
|
|
173
156
|
this._y += v.y;
|
|
174
157
|
this._z += v.z;
|
|
175
|
-
this.fire('change');
|
|
158
|
+
// this.fire('change');
|
|
176
159
|
return this;
|
|
177
160
|
};
|
|
178
161
|
Vec3.prototype.addScalar = function (s) {
|
|
179
162
|
this._x += s;
|
|
180
163
|
this._y += s;
|
|
181
164
|
this._z += s;
|
|
182
|
-
this.fire('change');
|
|
165
|
+
// this.fire('change');
|
|
183
166
|
return this;
|
|
184
167
|
};
|
|
185
168
|
Vec3.prototype.addVecs = function (a, b) {
|
|
186
169
|
this._x = a.x + b.x;
|
|
187
170
|
this._y = a.y + b.y;
|
|
188
171
|
this._z = a.z + b.z;
|
|
189
|
-
this.fire('change');
|
|
172
|
+
// this.fire('change');
|
|
190
173
|
return this;
|
|
191
174
|
};
|
|
192
175
|
Vec3.prototype.addScaledVec = function (v, s) {
|
|
193
176
|
this._x += v.x * s;
|
|
194
177
|
this._y += v.y * s;
|
|
195
178
|
this._z += v.z * s;
|
|
196
|
-
this.fire('change');
|
|
179
|
+
// this.fire('change');
|
|
197
180
|
return this;
|
|
198
181
|
};
|
|
199
182
|
Vec3.prototype.sub = function (v, w) {
|
|
@@ -204,21 +187,21 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
204
187
|
this._x -= v.x;
|
|
205
188
|
this._y -= v.y;
|
|
206
189
|
this._z -= v.z;
|
|
207
|
-
this.fire('change');
|
|
190
|
+
// this.fire('change');
|
|
208
191
|
return this;
|
|
209
192
|
};
|
|
210
193
|
Vec3.prototype.subScalar = function (s) {
|
|
211
194
|
this._x -= s;
|
|
212
195
|
this._y -= s;
|
|
213
196
|
this._z -= s;
|
|
214
|
-
this.fire('change');
|
|
197
|
+
// this.fire('change');
|
|
215
198
|
return this;
|
|
216
199
|
};
|
|
217
200
|
Vec3.prototype.subVecs = function (a, b) {
|
|
218
201
|
this._x = a.x - b.x;
|
|
219
202
|
this._y = a.y - b.y;
|
|
220
203
|
this._z = a.z - b.z;
|
|
221
|
-
this.fire('change');
|
|
204
|
+
// this.fire('change');
|
|
222
205
|
return this;
|
|
223
206
|
};
|
|
224
207
|
Vec3.prototype.multiply = function (v, w) {
|
|
@@ -228,21 +211,21 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
228
211
|
this._x *= v.x;
|
|
229
212
|
this._y *= v.y;
|
|
230
213
|
this._z *= v.z;
|
|
231
|
-
this.fire('change');
|
|
214
|
+
// this.fire('change');
|
|
232
215
|
return this;
|
|
233
216
|
};
|
|
234
217
|
Vec3.prototype.multiplyScalar = function (scalar) {
|
|
235
218
|
this._x *= scalar;
|
|
236
219
|
this._y *= scalar;
|
|
237
220
|
this._z *= scalar;
|
|
238
|
-
this.fire('change');
|
|
221
|
+
// this.fire('change');
|
|
239
222
|
return this;
|
|
240
223
|
};
|
|
241
224
|
Vec3.prototype.multiplyVecs = function (a, b) {
|
|
242
225
|
this._x = a.x * b.x;
|
|
243
226
|
this._y = a.y * b.y;
|
|
244
227
|
this._z = a.z * b.z;
|
|
245
|
-
this.fire('change');
|
|
228
|
+
// this.fire('change');
|
|
246
229
|
return this;
|
|
247
230
|
};
|
|
248
231
|
Vec3.prototype.applyEuler = function (euler) {
|
|
@@ -263,7 +246,7 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
263
246
|
this._x = e[0] * x + e[3] * y + e[6] * z;
|
|
264
247
|
this._y = e[1] * x + e[4] * y + e[7] * z;
|
|
265
248
|
this._z = e[2] * x + e[5] * y + e[8] * z;
|
|
266
|
-
this.fire('change');
|
|
249
|
+
// this.fire('change');
|
|
267
250
|
return this;
|
|
268
251
|
};
|
|
269
252
|
Vec3.prototype.applyMat4 = function (m) {
|
|
@@ -273,7 +256,7 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
273
256
|
this._x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;
|
|
274
257
|
this._y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;
|
|
275
258
|
this._z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;
|
|
276
|
-
this.fire('change');
|
|
259
|
+
// this.fire('change');
|
|
277
260
|
return this;
|
|
278
261
|
};
|
|
279
262
|
Vec3.prototype.applyQuat = function (q) {
|
|
@@ -288,7 +271,7 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
288
271
|
this._x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
|
|
289
272
|
this._y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
|
|
290
273
|
this._z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
|
|
291
|
-
this.fire('change');
|
|
274
|
+
// this.fire('change');
|
|
292
275
|
return this;
|
|
293
276
|
};
|
|
294
277
|
Vec3.prototype.project = function (camera) {
|
|
@@ -305,14 +288,14 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
305
288
|
this._x = e[0] * x + e[4] * y + e[8] * z;
|
|
306
289
|
this._y = e[1] * x + e[5] * y + e[9] * z;
|
|
307
290
|
this._z = e[2] * x + e[6] * y + e[10] * z;
|
|
308
|
-
this.fire('change');
|
|
291
|
+
// this.fire('change');
|
|
309
292
|
return this.normalize();
|
|
310
293
|
};
|
|
311
294
|
Vec3.prototype.divide = function (v) {
|
|
312
295
|
this._x /= v.x;
|
|
313
296
|
this._y /= v.y;
|
|
314
297
|
this._z /= v.z;
|
|
315
|
-
this.fire('change');
|
|
298
|
+
// this.fire('change');
|
|
316
299
|
return this;
|
|
317
300
|
};
|
|
318
301
|
Vec3.prototype.divideScalar = function (scalar) {
|
|
@@ -322,14 +305,14 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
322
305
|
this._x = Math.min(this._x, v.x);
|
|
323
306
|
this._y = Math.min(this._y, v.y);
|
|
324
307
|
this._z = Math.min(this._z, v.z);
|
|
325
|
-
this.fire('change');
|
|
308
|
+
// this.fire('change');
|
|
326
309
|
return this;
|
|
327
310
|
};
|
|
328
311
|
Vec3.prototype.max = function (v) {
|
|
329
312
|
this._x = Math.max(this._x, v.x);
|
|
330
313
|
this._y = Math.max(this._y, v.y);
|
|
331
314
|
this._z = Math.max(this._z, v.z);
|
|
332
|
-
this.fire('change');
|
|
315
|
+
// this.fire('change');
|
|
333
316
|
return this;
|
|
334
317
|
};
|
|
335
318
|
Vec3.prototype.clamp = function (min, max) {
|
|
@@ -337,14 +320,14 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
337
320
|
this._x = Math.max(min.x, Math.min(max.x, this._x));
|
|
338
321
|
this._y = Math.max(min.y, Math.min(max.y, this._y));
|
|
339
322
|
this._z = Math.max(min.z, Math.min(max.z, this._z));
|
|
340
|
-
this.fire('change');
|
|
323
|
+
// this.fire('change');
|
|
341
324
|
return this;
|
|
342
325
|
};
|
|
343
326
|
Vec3.prototype.clampScalar = function (minVal, maxVal) {
|
|
344
327
|
this._x = Math.max(minVal, Math.min(maxVal, this._x));
|
|
345
328
|
this._y = Math.max(minVal, Math.min(maxVal, this._y));
|
|
346
329
|
this._z = Math.max(minVal, Math.min(maxVal, this._z));
|
|
347
|
-
this.fire('change');
|
|
330
|
+
// this.fire('change');
|
|
348
331
|
return this;
|
|
349
332
|
};
|
|
350
333
|
Vec3.prototype.clampLength = function (min, max) {
|
|
@@ -355,35 +338,35 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
355
338
|
this._x = Math.floor(this._x);
|
|
356
339
|
this._y = Math.floor(this._y);
|
|
357
340
|
this._z = Math.floor(this._z);
|
|
358
|
-
this.fire('change');
|
|
341
|
+
// this.fire('change');
|
|
359
342
|
return this;
|
|
360
343
|
};
|
|
361
344
|
Vec3.prototype.ceil = function () {
|
|
362
345
|
this._x = Math.ceil(this._x);
|
|
363
346
|
this._y = Math.ceil(this._y);
|
|
364
347
|
this._z = Math.ceil(this._z);
|
|
365
|
-
this.fire('change');
|
|
348
|
+
// this.fire('change');
|
|
366
349
|
return this;
|
|
367
350
|
};
|
|
368
351
|
Vec3.prototype.round = function () {
|
|
369
352
|
this._x = Math.round(this._x);
|
|
370
353
|
this._y = Math.round(this._y);
|
|
371
354
|
this._z = Math.round(this._z);
|
|
372
|
-
this.fire('change');
|
|
355
|
+
// this.fire('change');
|
|
373
356
|
return this;
|
|
374
357
|
};
|
|
375
358
|
Vec3.prototype.roundToZero = function () {
|
|
376
359
|
this._x = this._x < 0 ? Math.ceil(this._x) : Math.floor(this._x);
|
|
377
360
|
this._y = this._y < 0 ? Math.ceil(this._y) : Math.floor(this._y);
|
|
378
361
|
this._z = this._z < 0 ? Math.ceil(this._z) : Math.floor(this._z);
|
|
379
|
-
this.fire('change');
|
|
362
|
+
// this.fire('change');
|
|
380
363
|
return this;
|
|
381
364
|
};
|
|
382
365
|
Vec3.prototype.negate = function () {
|
|
383
366
|
this._x = -this._x;
|
|
384
367
|
this._y = -this._y;
|
|
385
368
|
this._z = -this._z;
|
|
386
|
-
this.fire('change');
|
|
369
|
+
// this.fire('change');
|
|
387
370
|
return this;
|
|
388
371
|
};
|
|
389
372
|
Vec3.prototype.dot = function (v) {
|
|
@@ -1077,7 +1060,7 @@ var Vec3 = /** @class */ (function (_super) {
|
|
|
1077
1060
|
return result;
|
|
1078
1061
|
};
|
|
1079
1062
|
return Vec3;
|
|
1080
|
-
}(
|
|
1063
|
+
}());
|
|
1081
1064
|
exports.Vec3 = Vec3;
|
|
1082
1065
|
var _vec = v3();
|
|
1083
1066
|
var _quat = Quat_1.quat();
|
package/dist/math/Vec4.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class Vec4
|
|
1
|
+
import { TypedArrayLike } from '../render/types';
|
|
2
|
+
export declare class Vec4 {
|
|
3
3
|
private _x;
|
|
4
4
|
private _y;
|
|
5
5
|
private _z;
|
|
@@ -74,8 +74,8 @@ export declare class Vec4 extends EventHandler {
|
|
|
74
74
|
lerp(v: Vec4, alpha: number): this;
|
|
75
75
|
lerpVecs(v1: Vec4, v2: any, alpha: any): Vec4;
|
|
76
76
|
equals(v: Vec4): boolean;
|
|
77
|
-
fromArray(array:
|
|
78
|
-
toArray(array?:
|
|
77
|
+
fromArray(array: TypedArrayLike, offset?: number): this;
|
|
78
|
+
toArray(array?: TypedArrayLike, offset?: number): TypedArrayLike;
|
|
79
79
|
fromBufferAttribute(attribute: any, index: any, offset: undefined): this;
|
|
80
80
|
}
|
|
81
81
|
export declare function v4(x?: number, y?: number, z?: number, w?: number): Vec4;
|