@xort/cga 0.0.71 → 0.0.74
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/{cga.js → @xort_cga.js} +13798 -13792
- package/dist/IKanimation/Bone.js +3 -1
- package/dist/IKanimation/CCDSolver.js +2 -2
- package/dist/IKanimation/constaint/hinge.js +3 -1
- package/dist/IKanimation/constaint/slider.js +3 -1
- package/dist/alg/common.js +2 -2
- package/dist/alg/extrude.js +56 -54
- package/dist/alg/pointset.js +5 -5
- package/dist/alg/trianglution.js +12 -10
- package/dist/app.js +14 -10
- package/dist/diamondMaterialShader.js +6 -2
- package/dist/effect/breath-light.js +3 -1
- package/dist/extends/geometryaid.js +7 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -2
- package/dist/math/Color.d.ts +29 -0
- package/dist/math/Color.js +201 -0
- package/dist/math/Euler.js +12 -10
- package/dist/math/HVec3.js +3 -1
- package/dist/math/Mat3.js +1 -1
- package/dist/math/Mat4.js +6 -6
- package/dist/math/Quat.js +4 -2
- package/dist/math/Vec.js +3 -1
- package/dist/math/Vec2.js +3 -1
- package/dist/math/Vec3.js +7 -5
- package/dist/math/Vec4.js +3 -1
- package/dist/math/vector.js +9 -7
- package/dist/render/buffer-attribute.js +12 -28
- package/dist/render/eventhandler.d.ts +2 -2
- package/dist/render/eventhandler.js +14 -8
- package/dist/render/geometry.d.ts +1 -1
- package/dist/render/geometry.js +2 -2
- package/dist/render/mesh.js +11 -9
- package/dist/render/thing.js +10 -8
- package/dist/render/types.js +2 -1
- package/dist/struct/3d/Box.js +3 -3
- package/dist/struct/3d/Capsule.js +3 -1
- package/dist/struct/3d/Circle.js +2 -2
- package/dist/struct/3d/Disk.js +1 -1
- package/dist/struct/3d/Line.js +4 -4
- package/dist/struct/3d/Path.js +13 -11
- package/dist/struct/3d/Plane.js +12 -10
- package/dist/struct/3d/Point.js +3 -1
- package/dist/struct/3d/Polygon.js +3 -1
- package/dist/struct/3d/Polyline.js +3 -1
- package/dist/struct/3d/Rectangle.js +3 -1
- package/dist/struct/3d/Segment.js +9 -7
- package/dist/struct/3d/Shape.js +3 -1
- package/dist/struct/3d/Sphere.js +1 -1
- package/dist/struct/3d/Triangle.js +3 -1
- package/dist/struct/data/ArrayList.js +11 -9
- package/dist/struct/data/ArrayObject.js +3 -1
- package/docs/guide/README.md +6 -6
- package/docs/guide/distLineAll.md +5 -5
- package/docs/guide/distPointAll.md +6 -6
- package/docs/guide/distRayAll.md +4 -4
- package/docs/guide/distSegmentAll.md +1 -1
- package/git.sh +2 -2
- package/package.json +2 -2
- package/readme.md +8 -8
- package/rollup.config.js +1 -1
- package/src/index.ts +3 -0
- package/src/math/Color.ts +157 -0
- package/src/render/eventhandler.ts +5 -2
- package/src/render/geometry.ts +2 -2
package/dist/IKanimation/Bone.js
CHANGED
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -32,7 +32,7 @@ var CCDSolver = /** @class */ (function () {
|
|
|
32
32
|
CCDSolver.prototype.calcAngle = function (v1, v2, dir) {
|
|
33
33
|
var vc1 = v1.clone();
|
|
34
34
|
var vc2 = v2.clone();
|
|
35
|
-
var angle = Math_1.clamp(vc1.normalize().dot(vc2.normalize()), -1, 1);
|
|
35
|
+
var angle = (0, Math_1.clamp)(vc1.normalize().dot(vc2.normalize()), -1, 1);
|
|
36
36
|
angle = Math.acos(angle);
|
|
37
37
|
if (vc1.cross(vc2).dot(dir) < 0)
|
|
38
38
|
return -angle;
|
|
@@ -59,7 +59,7 @@ var CCDSolver = /** @class */ (function () {
|
|
|
59
59
|
CCDSolver.prototype.solveRotation = function (target, zeroPos, effector, contraints) {
|
|
60
60
|
var dir0 = effector.clone().sub(zeroPos).normalize();
|
|
61
61
|
var dir1 = target.clone().sub(zeroPos).normalize();
|
|
62
|
-
var rotationAxis = Vec3_1.v3().cross(dir0, dir1).normalize();
|
|
62
|
+
var rotationAxis = (0, Vec3_1.v3)().cross(dir0, dir1).normalize();
|
|
63
63
|
_plane.setFromPointNormal(zeroPos, rotationAxis);
|
|
64
64
|
//最近点
|
|
65
65
|
var closestDir = this.projectPlane(target, rotationAxis);
|
|
@@ -11,10 +11,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
11
11
|
var extendStatics = function (d, b) {
|
|
12
12
|
extendStatics = Object.setPrototypeOf ||
|
|
13
13
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
14
|
-
function (d, b) { for (var p in b) if (
|
|
14
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
15
15
|
return extendStatics(d, b);
|
|
16
16
|
};
|
|
17
17
|
return function (d, b) {
|
|
18
|
+
if (typeof b !== "function" && b !== null)
|
|
19
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18
20
|
extendStatics(d, b);
|
|
19
21
|
function __() { this.constructor = d; }
|
|
20
22
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
package/dist/alg/common.js
CHANGED
|
@@ -16,13 +16,13 @@ var XYZSort = function (e1, e2) {
|
|
|
16
16
|
else
|
|
17
17
|
return e1.z - e2.z;
|
|
18
18
|
};
|
|
19
|
-
var _vector = Vec3_1.v3();
|
|
19
|
+
var _vector = (0, Vec3_1.v3)();
|
|
20
20
|
/**
|
|
21
21
|
* 数组深度复制
|
|
22
22
|
* @param {Array} array
|
|
23
23
|
*/
|
|
24
24
|
function clone(array) {
|
|
25
|
-
if (!types_1.isDefined(array))
|
|
25
|
+
if (!(0, types_1.isDefined)(array))
|
|
26
26
|
return array;
|
|
27
27
|
if (Array.isArray(array)) {
|
|
28
28
|
var result = new Array();
|
package/dist/alg/extrude.js
CHANGED
|
@@ -18,12 +18,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
18
18
|
};
|
|
19
19
|
return __assign.apply(this, arguments);
|
|
20
20
|
};
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
22
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
23
|
+
if (ar || !(i in from)) {
|
|
24
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
25
|
+
ar[i] = from[i];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
27
29
|
};
|
|
28
30
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -81,7 +83,7 @@ function linkSide(options) {
|
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
else {
|
|
84
|
-
if (types_1.isDefined(side0[0].index)) {
|
|
86
|
+
if ((0, types_1.isDefined)(side0[0].index)) {
|
|
85
87
|
//含索引的顶点
|
|
86
88
|
for (var i = 0; i < length; i++) {
|
|
87
89
|
var v00 = side0[i];
|
|
@@ -156,7 +158,7 @@ function linkSides(options) {
|
|
|
156
158
|
var orgShape = options.orgShape || shapes[0];
|
|
157
159
|
var orgHoles = options.orgHoles || (holess && holess[0]);
|
|
158
160
|
if (index)
|
|
159
|
-
mesh_1.indexable(allVertics, index);
|
|
161
|
+
(0, mesh_1.indexable)(allVertics, index);
|
|
160
162
|
for (var i = 0; i < length; i++) {
|
|
161
163
|
if (holess)
|
|
162
164
|
triangles.push.apply(triangles, linkSide({ side0: shapes[i], side1: shapes[(i + 1) % shapes.length], holes0: holess[i], holes1: holess[(i + 1) % shapes.length], shapeClosed: options.shapeClosed }));
|
|
@@ -164,13 +166,13 @@ function linkSides(options) {
|
|
|
164
166
|
triangles.push.apply(triangles, linkSide({ side0: shapes[i], side1: shapes[(i + 1) % shapes.length], shapeClosed: options.shapeClosed }));
|
|
165
167
|
}
|
|
166
168
|
if (options.sealStart) {
|
|
167
|
-
var startShape = common_1.clone(shapes[0]);
|
|
169
|
+
var startShape = (0, common_1.clone)(shapes[0]);
|
|
168
170
|
allVertics.push(startShape);
|
|
169
171
|
if (holess && holess[0]) {
|
|
170
|
-
var startHoles = common_1.clone(holess[0]);
|
|
172
|
+
var startHoles = (0, common_1.clone)(holess[0]);
|
|
171
173
|
allVertics.push(startHoles);
|
|
172
174
|
}
|
|
173
|
-
var startTris = trianglution_1.triangulation(orgShape, orgHoles, { feature: trianglution_1.AxisPlane.XYZ });
|
|
175
|
+
var startTris = (0, trianglution_1.triangulation)(orgShape, orgHoles, { feature: trianglution_1.AxisPlane.XYZ });
|
|
174
176
|
if (index) {
|
|
175
177
|
startTris.forEach(function (v, i) {
|
|
176
178
|
startTris[i] = v + (index === null || index === void 0 ? void 0 : index.index);
|
|
@@ -184,13 +186,13 @@ function linkSides(options) {
|
|
|
184
186
|
triangles.push.apply(triangles, startTris.reverse());
|
|
185
187
|
}
|
|
186
188
|
if (options.sealEnd) {
|
|
187
|
-
var endShape = common_1.clone(shapes[shapes.length - 1]);
|
|
189
|
+
var endShape = (0, common_1.clone)(shapes[shapes.length - 1]);
|
|
188
190
|
allVertics.push(endShape);
|
|
189
191
|
if (holess && holess[0]) {
|
|
190
|
-
var endHoles = common_1.clone(common_1.clone(holess[holess.length - 1]));
|
|
192
|
+
var endHoles = (0, common_1.clone)((0, common_1.clone)(holess[holess.length - 1]));
|
|
191
193
|
allVertics.push(endHoles);
|
|
192
194
|
}
|
|
193
|
-
var endTris = trianglution_1.triangulation(orgShape, orgHoles, { feature: trianglution_1.AxisPlane.XYZ });
|
|
195
|
+
var endTris = (0, trianglution_1.triangulation)(orgShape, orgHoles, { feature: trianglution_1.AxisPlane.XYZ });
|
|
194
196
|
if (index) {
|
|
195
197
|
endTris.forEach(function (v, i) {
|
|
196
198
|
endTris[i] = v + (index === null || index === void 0 ? void 0 : index.index);
|
|
@@ -289,7 +291,7 @@ function linkSides(options) {
|
|
|
289
291
|
default:
|
|
290
292
|
break;
|
|
291
293
|
}
|
|
292
|
-
uvs.push.apply(uvs,
|
|
294
|
+
uvs.push.apply(uvs, __spreadArray(__spreadArray([], sealUvs, false), sealUvs, false));
|
|
293
295
|
}
|
|
294
296
|
var indices = triangles || [];
|
|
295
297
|
// if (isDefined(shapes[0][0].index)) {
|
|
@@ -316,12 +318,12 @@ var defaultExtrudeOption = {
|
|
|
316
318
|
sealEnd: false,
|
|
317
319
|
normal: Vec3_1.Vec3.UnitZ,
|
|
318
320
|
};
|
|
319
|
-
var _matrix = Mat4_1.m4();
|
|
320
|
-
var _matrix1 = Mat4_1.m4();
|
|
321
|
-
var _quat = Quat_1.quat();
|
|
322
|
-
var _quat1 = Quat_1.quat();
|
|
323
|
-
var _vec1 = Vec3_1.v3();
|
|
324
|
-
var _vec2 = Vec3_1.v3();
|
|
321
|
+
var _matrix = (0, Mat4_1.m4)();
|
|
322
|
+
var _matrix1 = (0, Mat4_1.m4)();
|
|
323
|
+
var _quat = (0, Quat_1.quat)();
|
|
324
|
+
var _quat1 = (0, Quat_1.quat)();
|
|
325
|
+
var _vec1 = (0, Vec3_1.v3)();
|
|
326
|
+
var _vec2 = (0, Vec3_1.v3)();
|
|
325
327
|
/**
|
|
326
328
|
* @description : 挤压形状生成几何体
|
|
327
329
|
* @param {IExtrudeOptionsEx} options
|
|
@@ -368,8 +370,8 @@ function extrude(options) {
|
|
|
368
370
|
}
|
|
369
371
|
}
|
|
370
372
|
var ups = options.ups || [];
|
|
371
|
-
if (types_1.isUndefined(shapePath.first.z)) {
|
|
372
|
-
shapePath.array = shapePath.array.map(function (e) { return Vec3_1.v3(e.x, e.y, 0); });
|
|
373
|
+
if ((0, types_1.isUndefined)(shapePath.first.z)) {
|
|
374
|
+
shapePath.array = shapePath.array.map(function (e) { return (0, Vec3_1.v3)(e.x, e.y, 0); });
|
|
373
375
|
options.normal = options.normal || Vec3_1.Vec3.UnitZ;
|
|
374
376
|
}
|
|
375
377
|
var up = options.up;
|
|
@@ -379,17 +381,17 @@ function extrude(options) {
|
|
|
379
381
|
var point = path.get(i);
|
|
380
382
|
var direction = point.direction;
|
|
381
383
|
var upi = void 0;
|
|
382
|
-
upi = ups[i] || up || Vec3_1.v3().crossVecs(right, direction);
|
|
384
|
+
upi = ups[i] || up || (0, Vec3_1.v3)().crossVecs(right, direction);
|
|
383
385
|
var righti = right;
|
|
384
386
|
if (!right)
|
|
385
|
-
righti = Vec3_1.v3().crossVecs(upi, direction).normalize();
|
|
387
|
+
righti = (0, Vec3_1.v3)().crossVecs(upi, direction).normalize();
|
|
386
388
|
_matrix.makeBasis(righti, upi, direction);
|
|
387
389
|
_matrix.setPosition(point);
|
|
388
390
|
var new_shape = shapePath.clone();
|
|
389
391
|
new_shape.applyMat4(_matrix);
|
|
390
392
|
shapes.push(new_shape);
|
|
391
393
|
if (options.holes) {
|
|
392
|
-
var mholes = pointset_1.applyMat4(options.holes, _matrix, false);
|
|
394
|
+
var mholes = (0, pointset_1.applyMat4)(options.holes, _matrix, false);
|
|
393
395
|
newholes.push(mholes);
|
|
394
396
|
}
|
|
395
397
|
}
|
|
@@ -433,7 +435,7 @@ function extrude_obsolete(shape, arg_path, options) {
|
|
|
433
435
|
if (!isCCW)
|
|
434
436
|
shape.reverse();
|
|
435
437
|
var normal = options.normal;
|
|
436
|
-
var startSeal = common_1.clone(shape);
|
|
438
|
+
var startSeal = (0, common_1.clone)(shape);
|
|
437
439
|
var shapepath = new Path_1.Path(shape);
|
|
438
440
|
var insertNum = 0;
|
|
439
441
|
for (var i = 1; i < shapepath.length - 1; i++) { //大角度插入点 角度过大为了呈现flat shader的效果
|
|
@@ -455,21 +457,21 @@ function extrude_obsolete(shape, arg_path, options) {
|
|
|
455
457
|
for (var i = 0; i < path.length; i++) {
|
|
456
458
|
var node = path[i];
|
|
457
459
|
var dir = node.tangent;
|
|
458
|
-
var newShape = common_1.clone(shape);
|
|
459
|
-
common_1.rotateByUnitVectors(newShape, normal, dir);
|
|
460
|
+
var newShape = (0, common_1.clone)(shape);
|
|
461
|
+
(0, common_1.rotateByUnitVectors)(newShape, normal, dir);
|
|
460
462
|
if (options.fixedY) {
|
|
461
463
|
var v = Vec3_1.Vec3.UnitX;
|
|
462
|
-
common_1.rotateByUnitVectors([v], normal, dir);
|
|
464
|
+
(0, common_1.rotateByUnitVectors)([v], normal, dir);
|
|
463
465
|
var v1 = v.clone();
|
|
464
466
|
v1.y = 0;
|
|
465
|
-
common_1.rotateByUnitVectors(newShape, v, v1);
|
|
467
|
+
(0, common_1.rotateByUnitVectors)(newShape, v, v1);
|
|
466
468
|
}
|
|
467
|
-
pointset_1.translate(newShape, node);
|
|
469
|
+
(0, pointset_1.translate)(newShape, node);
|
|
468
470
|
shapeArray.push(newShape);
|
|
469
471
|
}
|
|
470
472
|
var gindex = { index: 0 };
|
|
471
|
-
var vertices = array_1.flat(shapeArray);
|
|
472
|
-
mesh_1.indexable(vertices, gindex);
|
|
473
|
+
var vertices = (0, array_1.flat)(shapeArray);
|
|
474
|
+
(0, mesh_1.indexable)(vertices, gindex);
|
|
473
475
|
var index = linkSides({ shapes: shapeArray, shapeClosed: options.shapeClosed, pathClosed: options.isClosed2, orgShape: shape }).index;
|
|
474
476
|
shapepath = new Path_1.Path(shape);
|
|
475
477
|
var uvs = [];
|
|
@@ -478,34 +480,34 @@ function extrude_obsolete(shape, arg_path, options) {
|
|
|
478
480
|
uvs.push(shapepath.get(j).tlen * options.textureScale.x, path.get(i).tlen * options.textureScale.y);
|
|
479
481
|
}
|
|
480
482
|
}
|
|
481
|
-
var sealUv = common_1.clone(startSeal);
|
|
483
|
+
var sealUv = (0, common_1.clone)(startSeal);
|
|
482
484
|
if (normal.dot(Vec3_1.Vec3.UnitZ) < 1 - 1e-4)
|
|
483
|
-
common_1.rotateByUnitVectors(sealUv, normal, Vec3_1.Vec3.UnitZ);
|
|
484
|
-
var endSeal = common_1.clone(startSeal);
|
|
485
|
-
common_1.rotateByUnitVectors(startSeal, normal, path[0].tangent);
|
|
485
|
+
(0, common_1.rotateByUnitVectors)(sealUv, normal, Vec3_1.Vec3.UnitZ);
|
|
486
|
+
var endSeal = (0, common_1.clone)(startSeal);
|
|
487
|
+
(0, common_1.rotateByUnitVectors)(startSeal, normal, path[0].tangent);
|
|
486
488
|
if (options.fixedY) {
|
|
487
489
|
var v = Vec3_1.Vec3.UnitX;
|
|
488
|
-
common_1.rotateByUnitVectors([v], normal, path[0].tangent);
|
|
490
|
+
(0, common_1.rotateByUnitVectors)([v], normal, path[0].tangent);
|
|
489
491
|
var v1 = v.clone();
|
|
490
492
|
v1.y = 0;
|
|
491
|
-
common_1.rotateByUnitVectors(startSeal, v, v1);
|
|
493
|
+
(0, common_1.rotateByUnitVectors)(startSeal, v, v1);
|
|
492
494
|
}
|
|
493
|
-
pointset_1.translate(startSeal, path[0]);
|
|
494
|
-
common_1.rotateByUnitVectors(endSeal, normal, path.get(-1).tangent);
|
|
495
|
+
(0, pointset_1.translate)(startSeal, path[0]);
|
|
496
|
+
(0, common_1.rotateByUnitVectors)(endSeal, normal, path.get(-1).tangent);
|
|
495
497
|
if (options.fixedY) {
|
|
496
498
|
var v = Vec3_1.Vec3.UnitX;
|
|
497
|
-
common_1.rotateByUnitVectors([v], normal, path.get(-1).tangent);
|
|
499
|
+
(0, common_1.rotateByUnitVectors)([v], normal, path.get(-1).tangent);
|
|
498
500
|
var v1 = v.clone();
|
|
499
501
|
v1.y = 0;
|
|
500
|
-
common_1.rotateByUnitVectors(endSeal, v, v1);
|
|
502
|
+
(0, common_1.rotateByUnitVectors)(endSeal, v, v1);
|
|
501
503
|
}
|
|
502
|
-
pointset_1.translate(endSeal, path.get(-1));
|
|
503
|
-
var sealStartTris = trianglution_1.triangulation(sealUv, [], { normal: normal });
|
|
504
|
+
(0, pointset_1.translate)(endSeal, path.get(-1));
|
|
505
|
+
var sealStartTris = (0, trianglution_1.triangulation)(sealUv, [], { normal: normal });
|
|
504
506
|
sealStartTris.reverse();
|
|
505
507
|
if (options.sealStart)
|
|
506
|
-
mesh_1.indexable(startSeal, gindex);
|
|
508
|
+
(0, mesh_1.indexable)(startSeal, gindex);
|
|
507
509
|
if (options.sealEnd)
|
|
508
|
-
mesh_1.indexable(endSeal, gindex);
|
|
510
|
+
(0, mesh_1.indexable)(endSeal, gindex);
|
|
509
511
|
var sealEndTris = [];
|
|
510
512
|
var hasVLen = vertices.length;
|
|
511
513
|
if (options.sealStart)
|
|
@@ -567,10 +569,10 @@ var EndType;
|
|
|
567
569
|
*/
|
|
568
570
|
function extrudeNext(options) {
|
|
569
571
|
options = __assign({ sealEnd: true, sealStart: true, shapeClosed: true, pathClosed: false, generateUV: true, autoIndex: true, axisPlane: trianglution_1.AxisPlane.XY, smoothAngle: 30 * Math_1.RADIANS_PER_DEGREE, enableSmooth: false }, options);
|
|
570
|
-
var path = options.shapeCenter ? pointset_1.translate(options.path, options.shapeCenter, false) : options.path;
|
|
572
|
+
var path = options.shapeCenter ? (0, pointset_1.translate)(options.path, options.shapeCenter, false) : options.path;
|
|
571
573
|
var shape = options.shape;
|
|
572
|
-
array_1.unique(path, function (a, b) { return a.equals(b); });
|
|
573
|
-
array_1.unique(shape, function (a, b) { return a.equals(b); });
|
|
574
|
+
(0, array_1.unique)(path, function (a, b) { return a.equals(b); });
|
|
575
|
+
(0, array_1.unique)(shape, function (a, b) { return a.equals(b); });
|
|
574
576
|
var pathPath = new Path_1.Path(path, options.pathClosed, true);
|
|
575
577
|
var starti = options.shapeClosed ? 0 : 1;
|
|
576
578
|
var shapePath = new Path_1.Path(shape, options.shapeClosed);
|
|
@@ -582,13 +584,13 @@ function extrudeNext(options) {
|
|
|
582
584
|
}
|
|
583
585
|
}
|
|
584
586
|
options.normal = options.normal || Vec3_1.Vec3.UnitZ;
|
|
585
|
-
if (types_1.isUndefined(shapePath.first.z)) {
|
|
586
|
-
shapePath.array = shapePath.array.map(function (e) { return Vec3_1.v3(e.x, e.y, 0); });
|
|
587
|
+
if ((0, types_1.isUndefined)(shapePath.first.z)) {
|
|
588
|
+
shapePath.array = shapePath.array.map(function (e) { return (0, Vec3_1.v3)(e.x, e.y, 0); });
|
|
587
589
|
}
|
|
588
590
|
var up = options.up;
|
|
589
591
|
var right = options.right;
|
|
590
592
|
var shapes = [], newholes = [];
|
|
591
|
-
var accMat = Mat4_1.m4();
|
|
593
|
+
var accMat = (0, Mat4_1.m4)();
|
|
592
594
|
/**
|
|
593
595
|
* 如果路径闭合 要考虑首尾shape矩阵变化后还能一致吻合
|
|
594
596
|
*/
|
package/dist/alg/pointset.js
CHANGED
|
@@ -7,7 +7,7 @@ var Math_1 = require("../math/Math");
|
|
|
7
7
|
var Line_1 = require("../struct/3d/Line");
|
|
8
8
|
var Plane_1 = require("../struct/3d/Plane");
|
|
9
9
|
var common_1 = require("./common");
|
|
10
|
-
var _Vec = Vec3_1.v3();
|
|
10
|
+
var _Vec = (0, Vec3_1.v3)();
|
|
11
11
|
/**
|
|
12
12
|
* 点排序函数
|
|
13
13
|
* @param {Vec*} a
|
|
@@ -53,7 +53,7 @@ function applyQuat(points, quat, ref) {
|
|
|
53
53
|
});
|
|
54
54
|
return points;
|
|
55
55
|
}
|
|
56
|
-
return applyQuat(common_1.clone(points), quat);
|
|
56
|
+
return applyQuat((0, common_1.clone)(points), quat);
|
|
57
57
|
}
|
|
58
58
|
exports.applyQuat = applyQuat;
|
|
59
59
|
/**
|
|
@@ -70,7 +70,7 @@ function translate(points, distance, ref) {
|
|
|
70
70
|
});
|
|
71
71
|
return points;
|
|
72
72
|
}
|
|
73
|
-
return translate(common_1.clone(points));
|
|
73
|
+
return translate((0, common_1.clone)(points));
|
|
74
74
|
}
|
|
75
75
|
exports.translate = translate;
|
|
76
76
|
/**
|
|
@@ -112,7 +112,7 @@ function applyMat4(points, mat4, ref) {
|
|
|
112
112
|
});
|
|
113
113
|
return points;
|
|
114
114
|
}
|
|
115
|
-
return applyMat4(common_1.clone(points), mat4);
|
|
115
|
+
return applyMat4((0, common_1.clone)(points), mat4);
|
|
116
116
|
}
|
|
117
117
|
exports.applyMat4 = applyMat4;
|
|
118
118
|
/**
|
|
@@ -177,7 +177,7 @@ function projectOnPlane(points, plane, projectDirect, ref) {
|
|
|
177
177
|
return points;
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
180
|
-
return projectOnPlane(common_1.clone(points), plane, projectDirect);
|
|
180
|
+
return projectOnPlane((0, common_1.clone)(points), plane, projectDirect);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
exports.projectOnPlane = projectOnPlane;
|
package/dist/alg/trianglution.js
CHANGED
|
@@ -10,12 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
19
21
|
};
|
|
20
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -53,13 +55,13 @@ function triangulation(inboundary, holes, options) {
|
|
|
53
55
|
var dim = options.dim;
|
|
54
56
|
var normal = options.normal;
|
|
55
57
|
if (normal && normal.dot(Vec3_1.Vec3.UnitZ) < 1 - Math_1.delta4) {
|
|
56
|
-
boundary = common_1.clone(inboundary);
|
|
57
|
-
common_1.rotateByUnitVectors(boundary, normal, Vec3_1.Vec3.UnitZ);
|
|
58
|
+
boundary = (0, common_1.clone)(inboundary);
|
|
59
|
+
(0, common_1.rotateByUnitVectors)(boundary, normal, Vec3_1.Vec3.UnitZ);
|
|
58
60
|
}
|
|
59
61
|
else {
|
|
60
62
|
boundary = inboundary;
|
|
61
63
|
}
|
|
62
|
-
var allV =
|
|
64
|
+
var allV = __spreadArray(__spreadArray([], boundary, true), (0, array_1.flat)(holes), true);
|
|
63
65
|
var vertextNumbers = vector_1.default.verctorToNumbers(allV, feature);
|
|
64
66
|
var holesIndex = [];
|
|
65
67
|
var baseIndex = boundary.length;
|
|
@@ -69,7 +71,7 @@ function triangulation(inboundary, holes, options) {
|
|
|
69
71
|
// holesIndex.push(baseIndex + hole.length);
|
|
70
72
|
baseIndex += hole.length;
|
|
71
73
|
}
|
|
72
|
-
var result = earcut_1.default(vertextNumbers, holesIndex, dim);
|
|
74
|
+
var result = (0, earcut_1.default)(vertextNumbers, holesIndex, dim);
|
|
73
75
|
return result;
|
|
74
76
|
}
|
|
75
77
|
exports.triangulation = triangulation;
|
package/dist/app.js
CHANGED
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
// // document.write(v.toString());
|
|
7
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
8
|
if (k2 === undefined) k2 = k;
|
|
9
|
-
Object.
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
10
14
|
}) : (function(o, m, k, k2) {
|
|
11
15
|
if (k2 === undefined) k2 = k;
|
|
12
16
|
o[k2] = m[k];
|
|
@@ -19,7 +23,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
19
23
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
24
|
if (mod && mod.__esModule) return mod;
|
|
21
25
|
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
27
|
__setModuleDefault(result, mod);
|
|
24
28
|
return result;
|
|
25
29
|
};
|
|
@@ -143,7 +147,7 @@ glv.run();
|
|
|
143
147
|
// polyline.offset(1)
|
|
144
148
|
var shape1 = [new cga.Vec3(-10, -10, 0), new cga.Vec3(10, -10, 0), new cga.Vec3(10, 10, 0), new cga.Vec3(-10, 10, 0)];
|
|
145
149
|
var path1 = [new cga.Vec3(), new cga.Vec3(0, 0, 100)];
|
|
146
|
-
extrude_1.extrude({ shape: shape1, path: path1, enableSmooth: true });
|
|
150
|
+
(0, extrude_1.extrude)({ shape: shape1, path: path1, enableSmooth: true });
|
|
147
151
|
var dizhu = function (bottomR, topR, bh, gh, th) {
|
|
148
152
|
var bq = [];
|
|
149
153
|
var tq = [];
|
|
@@ -166,19 +170,19 @@ var dizhu = function (bottomR, topR, bh, gh, th) {
|
|
|
166
170
|
var geometry = cga.toGeometryBuffer(geo);
|
|
167
171
|
return geometry;
|
|
168
172
|
};
|
|
169
|
-
var shape = [Vec3_1.v3(-5, 0, 0), Vec3_1.v3(5, 0, 0), Vec3_1.v3(5, 0, 0), Vec3_1.v3(5, 10, 0), Vec3_1.v3(5, 10, 0), Vec3_1.v3(-5, 10, 0), Vec3_1.v3(-5, 10, 0)];
|
|
170
|
-
var hole3 = [Vec3_1.v3(-4, 5, 0), Vec3_1.v3(-1, 5, 0), Vec3_1.v3(-1, 5, 0), Vec3_1.v3(-4, 9, 0), Vec3_1.v3(-4, 9, 0), Vec3_1.v3(-4, 5, 0)];
|
|
171
|
-
var hole1 = [Vec3_1.v3(1, 5, 0), Vec3_1.v3(4, 5, 0), Vec3_1.v3(4, 5, 0), Vec3_1.v3(4, 9, 0), Vec3_1.v3(4, 9, 0), Vec3_1.v3(1, 9, 0), Vec3_1.v3(1, 9, 0), Vec3_1.v3(1, 5, 0)];
|
|
172
|
-
var hole2 = [Vec3_1.v3(-4, 1, 0), Vec3_1.v3(4, 1, 0), Vec3_1.v3(4, 1, 0), Vec3_1.v3(4, 4, 0), Vec3_1.v3(4, 4, 0), Vec3_1.v3(-4, 4, 0), Vec3_1.v3(-4, 4, 0), Vec3_1.v3(-4, 1, 0)];
|
|
173
|
+
var shape = [(0, Vec3_1.v3)(-5, 0, 0), (0, Vec3_1.v3)(5, 0, 0), (0, Vec3_1.v3)(5, 0, 0), (0, Vec3_1.v3)(5, 10, 0), (0, Vec3_1.v3)(5, 10, 0), (0, Vec3_1.v3)(-5, 10, 0), (0, Vec3_1.v3)(-5, 10, 0)];
|
|
174
|
+
var hole3 = [(0, Vec3_1.v3)(-4, 5, 0), (0, Vec3_1.v3)(-1, 5, 0), (0, Vec3_1.v3)(-1, 5, 0), (0, Vec3_1.v3)(-4, 9, 0), (0, Vec3_1.v3)(-4, 9, 0), (0, Vec3_1.v3)(-4, 5, 0)];
|
|
175
|
+
var hole1 = [(0, Vec3_1.v3)(1, 5, 0), (0, Vec3_1.v3)(4, 5, 0), (0, Vec3_1.v3)(4, 5, 0), (0, Vec3_1.v3)(4, 9, 0), (0, Vec3_1.v3)(4, 9, 0), (0, Vec3_1.v3)(1, 9, 0), (0, Vec3_1.v3)(1, 9, 0), (0, Vec3_1.v3)(1, 5, 0)];
|
|
176
|
+
var hole2 = [(0, Vec3_1.v3)(-4, 1, 0), (0, Vec3_1.v3)(4, 1, 0), (0, Vec3_1.v3)(4, 1, 0), (0, Vec3_1.v3)(4, 4, 0), (0, Vec3_1.v3)(4, 4, 0), (0, Vec3_1.v3)(-4, 4, 0), (0, Vec3_1.v3)(-4, 4, 0), (0, Vec3_1.v3)(-4, 1, 0)];
|
|
173
177
|
var holes = [hole1, hole2, hole3];
|
|
174
178
|
var path = [];
|
|
175
179
|
var ia = Math.PI / 100;
|
|
176
180
|
for (var i = 0; i <= 100; i++) {
|
|
177
181
|
var x = Math.cos(ia * i) * 50 + 50;
|
|
178
182
|
var y = Math.sin(ia * i) * 50;
|
|
179
|
-
path.push(Vec3_1.v3(x, y, 0));
|
|
183
|
+
path.push((0, Vec3_1.v3)(x, y, 0));
|
|
180
184
|
}
|
|
181
|
-
var geo = extrude_1.extrude({ shape: shape, path: path, right: Vec3_1.Vec3.UnitZ, sealStart: true });
|
|
185
|
+
var geo = (0, extrude_1.extrude)({ shape: shape, path: path, right: Vec3_1.Vec3.UnitZ, sealStart: true });
|
|
182
186
|
// var geo = dizhu(1.8, 0.9, 0.3, 0.5, 10);
|
|
183
187
|
var geometry = cga.toGeometryBuffer(geo);
|
|
184
188
|
geometry.computeVertexNormals();
|
|
@@ -230,7 +234,7 @@ planeGeo.translate(0, 5, -1);
|
|
|
230
234
|
var mesh = new three_1.Mesh(planeGeo, shapeMaterial);
|
|
231
235
|
glv.add(mesh);
|
|
232
236
|
var m = new Mat4_1.Mat4();
|
|
233
|
-
var geo = extrude_1.extrude({ shape: shape, path: path, right: Vec3_1.Vec3.UnitZ, sealStart: true });
|
|
237
|
+
var geo = (0, extrude_1.extrude)({ shape: shape, path: path, right: Vec3_1.Vec3.UnitZ, sealStart: true });
|
|
234
238
|
var geometry = cga.toGeometryBuffer(geo);
|
|
235
239
|
geometry.computeVertexNormals();
|
|
236
240
|
var tgeo = new THREE.BufferGeometry();
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
19
|
if (mod && mod.__esModule) return mod;
|
|
16
20
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
22
|
__setModuleDefault(result, mod);
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -14,7 +14,7 @@ var extrude_1 = require("../alg/extrude");
|
|
|
14
14
|
var trianglution_1 = require("../alg/trianglution");
|
|
15
15
|
var array_1 = require("../utils/array");
|
|
16
16
|
function toGeometryBuffer(geo) {
|
|
17
|
-
var buffer = mesh_1.toGeoBuffer(geo.position, geo.index, geo.uv);
|
|
17
|
+
var buffer = (0, mesh_1.toGeoBuffer)(geo.position, geo.index, geo.uv);
|
|
18
18
|
return buffer;
|
|
19
19
|
}
|
|
20
20
|
exports.toGeometryBuffer = toGeometryBuffer;
|
|
@@ -25,8 +25,8 @@ exports.toGeometryBuffer = toGeometryBuffer;
|
|
|
25
25
|
* @param {*} options
|
|
26
26
|
*/
|
|
27
27
|
function extrudeToGeometryBuffer(shape, arg_path, options) {
|
|
28
|
-
var extrudeRes = extrude_1.extrude_obsolete(shape, arg_path, options);
|
|
29
|
-
return mesh_1.toGeoBuffer(extrudeRes.vertices, extrudeRes.index, extrudeRes.uvs);
|
|
28
|
+
var extrudeRes = (0, extrude_1.extrude_obsolete)(shape, arg_path, options);
|
|
29
|
+
return (0, mesh_1.toGeoBuffer)(extrudeRes.vertices, extrudeRes.index, extrudeRes.uvs);
|
|
30
30
|
}
|
|
31
31
|
exports.extrudeToGeometryBuffer = extrudeToGeometryBuffer;
|
|
32
32
|
/**
|
|
@@ -39,7 +39,7 @@ exports.extrudeToGeometryBuffer = extrudeToGeometryBuffer;
|
|
|
39
39
|
function linkToGeometry(shape, shape1, axisPlane, shapeClose) {
|
|
40
40
|
if (axisPlane === void 0) { axisPlane = trianglution_1.AxisPlane.XY; }
|
|
41
41
|
if (shapeClose === void 0) { shapeClose = false; }
|
|
42
|
-
var geo = extrude_1.linkSides({ shapes: [shape, shape1], shapeClosed: shapeClose, orgShape: shape, axisPlane: axisPlane });
|
|
42
|
+
var geo = (0, extrude_1.linkSides)({ shapes: [shape, shape1], shapeClosed: shapeClose, orgShape: shape, axisPlane: axisPlane });
|
|
43
43
|
var geometry = toGeometryBuffer(geo);
|
|
44
44
|
return geometry;
|
|
45
45
|
}
|
|
@@ -53,9 +53,9 @@ exports.linkToGeometry = linkToGeometry;
|
|
|
53
53
|
function linksToGeometry(shapes, pathClosed, shapeClosed) {
|
|
54
54
|
if (pathClosed === void 0) { pathClosed = true; }
|
|
55
55
|
if (shapeClosed === void 0) { shapeClosed = true; }
|
|
56
|
-
var vertices = array_1.flat(shapes);
|
|
57
|
-
mesh_1.indexable(vertices);
|
|
58
|
-
var geo = extrude_1.linkSides({ shapes: shapes, shapeClosed: pathClosed, orgShape: shapes[0] });
|
|
56
|
+
var vertices = (0, array_1.flat)(shapes);
|
|
57
|
+
(0, mesh_1.indexable)(vertices);
|
|
58
|
+
var geo = (0, extrude_1.linkSides)({ shapes: shapes, shapeClosed: pathClosed, orgShape: shapes[0] });
|
|
59
59
|
var geometry = toGeometryBuffer(geo);
|
|
60
60
|
return geometry;
|
|
61
61
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./math/Mat4";
|
|
|
7
7
|
export * from "./math/Quat";
|
|
8
8
|
export * from "./math/Math";
|
|
9
9
|
export * from "./math/Euler";
|
|
10
|
+
export * from "./math/Color";
|
|
10
11
|
export * from "./math/vector";
|
|
11
12
|
export * from "./alg/common";
|
|
12
13
|
export * from "./alg/result";
|
|
@@ -30,6 +31,7 @@ export * from "./struct/3d/Frustum";
|
|
|
30
31
|
export * from "./struct/3d/Sphere";
|
|
31
32
|
export * from "./alg/delaunator";
|
|
32
33
|
export * from "./alg/voronoi";
|
|
34
|
+
export * from "./render/eventhandler";
|
|
33
35
|
export * from "./extends/geometryaid";
|
|
34
36
|
export * from "./render/buffer-attribute";
|
|
35
37
|
export * from "./render/geometry";
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./utils/array"), exports);
|
|
@@ -19,6 +23,7 @@ __exportStar(require("./math/Mat4"), exports);
|
|
|
19
23
|
__exportStar(require("./math/Quat"), exports);
|
|
20
24
|
__exportStar(require("./math/Math"), exports);
|
|
21
25
|
__exportStar(require("./math/Euler"), exports);
|
|
26
|
+
__exportStar(require("./math/Color"), exports);
|
|
22
27
|
//common
|
|
23
28
|
__exportStar(require("./math/vector"), exports);
|
|
24
29
|
__exportStar(require("./alg/common"), exports);
|
|
@@ -43,6 +48,7 @@ __exportStar(require("./struct/3d/Frustum"), exports);
|
|
|
43
48
|
__exportStar(require("./struct/3d/Sphere"), exports);
|
|
44
49
|
__exportStar(require("./alg/delaunator"), exports);
|
|
45
50
|
__exportStar(require("./alg/voronoi"), exports);
|
|
51
|
+
__exportStar(require("./render/eventhandler"), exports);
|
|
46
52
|
__exportStar(require("./extends/geometryaid"), exports);
|
|
47
53
|
//Geometry
|
|
48
54
|
__exportStar(require("./render/buffer-attribute"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EventHandler } from "src/render/eventhandler";
|
|
2
|
+
export declare function hue2rgb(p: number, q: number, t: number): number;
|
|
3
|
+
export declare function SRGBToLinear(c: number): number;
|
|
4
|
+
export declare function LinearToSRGB(c: number): number;
|
|
5
|
+
export declare class Color extends EventHandler {
|
|
6
|
+
private _r;
|
|
7
|
+
private _g;
|
|
8
|
+
private _b;
|
|
9
|
+
private _a;
|
|
10
|
+
get isColor(): boolean;
|
|
11
|
+
constructor(_r?: number, _g?: number, _b?: number, _a?: number);
|
|
12
|
+
get r(): number;
|
|
13
|
+
set r(value: number);
|
|
14
|
+
get g(): number;
|
|
15
|
+
set g(value: number);
|
|
16
|
+
get b(): number;
|
|
17
|
+
set b(value: number);
|
|
18
|
+
get a(): number;
|
|
19
|
+
set a(value: number);
|
|
20
|
+
set(value: any): this;
|
|
21
|
+
setHex(hex: number): this;
|
|
22
|
+
setRGB(r: number, g: number, b: number, a?: number): this;
|
|
23
|
+
clone(): any;
|
|
24
|
+
copy(color: this): this;
|
|
25
|
+
equals(c: this): boolean;
|
|
26
|
+
toArray(array?: number[], offset?: number): number[];
|
|
27
|
+
getHex(): number;
|
|
28
|
+
toJSON(): number;
|
|
29
|
+
}
|