@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/struct/3d/Plane.js
CHANGED
|
@@ -224,7 +224,7 @@ var Plane = /** @class */ (function () {
|
|
|
224
224
|
*/
|
|
225
225
|
Plane.prototype.splitPolyVS = function (polyVS) {
|
|
226
226
|
polyVS = __spreadArrays(polyVS);
|
|
227
|
-
mesh_1.indexable(polyVS);
|
|
227
|
+
mesh_1.MeshTool.indexable(polyVS);
|
|
228
228
|
var jd0 = -1; //找出第一个交点
|
|
229
229
|
var jdp0; //找出第一个交点
|
|
230
230
|
var lastOriention = this.orientationPoint(polyVS[0]);
|
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xort/cga",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Xtor Compute Geometry Algorithm Libary 计算几何算法库",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"pxy":"hpts -s 127.0.0.1:5006 -p 8002",
|
|
9
|
-
"release": "tsc && npm publish && git.sh",
|
|
10
|
-
"dev": "webpack-dev-server",
|
|
11
|
-
"build:dev": "webpack --mode development",
|
|
12
|
-
"build:prod": "webpack --mode production",
|
|
13
|
-
"build": "tsc && rollup -c",
|
|
14
|
-
"rollup": "rollup -c",
|
|
15
|
-
"docs:dev": "vuepress dev docs",
|
|
16
|
-
"docs:build": "vuepress build docs",
|
|
17
|
-
"deploy": "tsc && deploy.sh"
|
|
18
|
-
},
|
|
19
|
-
"private": false,
|
|
20
|
-
"repository": {
|
|
21
|
-
"type": "git",
|
|
22
|
-
"url": "https://github.com/yszhao91/cga.js"
|
|
23
|
-
},
|
|
24
|
-
"author": "Zhao YS",
|
|
25
|
-
"keywords": [
|
|
26
|
-
"cga",
|
|
27
|
-
"cgajs",
|
|
28
|
-
"cga.js",
|
|
29
|
-
"计算几何库",
|
|
30
|
-
"webgl",
|
|
31
|
-
"threejs",
|
|
32
|
-
"compute geometry algorithm",
|
|
33
|
-
"MIT",
|
|
34
|
-
"开源",
|
|
35
|
-
"gis"
|
|
36
|
-
],
|
|
37
|
-
"license": "MIT",
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@babel/core": "^7.10.2",
|
|
44
|
-
"@types/earcut": "^2.1.1",
|
|
45
|
-
"@types/uuid": "^7.0.3",
|
|
46
|
-
"bignumber.js": "^9.0.1",
|
|
47
|
-
"clean-webpack-plugin": "^3.0.0",
|
|
48
|
-
"copy-webpack-plugin": "^5.1.1",
|
|
49
|
-
"core-js": "^2.6.12",
|
|
50
|
-
"css-loader": "^3.5.3",
|
|
51
|
-
"element-ui": "^2.15.8",
|
|
52
|
-
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
|
53
|
-
"html-loader": "^1.1.0",
|
|
54
|
-
"html-webpack-plugin": "^4.2.0",
|
|
55
|
-
"rollup": "^1.27.14",
|
|
56
|
-
"rollup-plugin-babel": "^4.3.3",
|
|
57
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
|
58
|
-
"rollup-plugin-gzip": "^2.2.0",
|
|
59
|
-
"rollup-plugin-node-resolve": "^5.0.1",
|
|
60
|
-
"rollup-plugin-uglify": "^6.0.4",
|
|
61
|
-
"rollup-watch": "^4.3.1",
|
|
62
|
-
"style-loader": "^1.2.1",
|
|
63
|
-
"three": "^0.125.2",
|
|
64
|
-
"ts-loader": "^7.0.4",
|
|
65
|
-
"tsconfig-paths": "^3.9.0",
|
|
66
|
-
"tsconfig-paths-webpack-plugin": "3.2.0",
|
|
67
|
-
"typescript": "^3.9.2",
|
|
68
|
-
"vuepress": "^1.9.7",
|
|
69
|
-
"webpack": "^4.43.0",
|
|
70
|
-
"webpack-cli": "^3.3.11",
|
|
71
|
-
"webpack-dev-server": "^3.11.0"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xort/cga",
|
|
3
|
+
"version": "0.0.84",
|
|
4
|
+
"description": "Xtor Compute Geometry Algorithm Libary 计算几何算法库",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"pxy": "hpts -s 127.0.0.1:5006 -p 8002",
|
|
9
|
+
"release": "tsc && npm publish && git.sh",
|
|
10
|
+
"dev": "webpack-dev-server",
|
|
11
|
+
"build:dev": "webpack --mode development",
|
|
12
|
+
"build:prod": "webpack --mode production",
|
|
13
|
+
"build": "tsc && rollup -c",
|
|
14
|
+
"rollup": "rollup -c",
|
|
15
|
+
"docs:dev": "vuepress dev docs",
|
|
16
|
+
"docs:build": "vuepress build docs",
|
|
17
|
+
"deploy": "tsc && deploy.sh"
|
|
18
|
+
},
|
|
19
|
+
"private": false,
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/yszhao91/cga.js"
|
|
23
|
+
},
|
|
24
|
+
"author": "Zhao YS",
|
|
25
|
+
"keywords": [
|
|
26
|
+
"cga",
|
|
27
|
+
"cgajs",
|
|
28
|
+
"cga.js",
|
|
29
|
+
"计算几何库",
|
|
30
|
+
"webgl",
|
|
31
|
+
"threejs",
|
|
32
|
+
"compute geometry algorithm",
|
|
33
|
+
"MIT",
|
|
34
|
+
"开源",
|
|
35
|
+
"gis"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"decimal.js": "^10.3.1",
|
|
40
|
+
"earcut": "^2.2.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@babel/core": "^7.10.2",
|
|
44
|
+
"@types/earcut": "^2.1.1",
|
|
45
|
+
"@types/uuid": "^7.0.3",
|
|
46
|
+
"bignumber.js": "^9.0.1",
|
|
47
|
+
"clean-webpack-plugin": "^3.0.0",
|
|
48
|
+
"copy-webpack-plugin": "^5.1.1",
|
|
49
|
+
"core-js": "^2.6.12",
|
|
50
|
+
"css-loader": "^3.5.3",
|
|
51
|
+
"element-ui": "^2.15.8",
|
|
52
|
+
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
|
53
|
+
"html-loader": "^1.1.0",
|
|
54
|
+
"html-webpack-plugin": "^4.2.0",
|
|
55
|
+
"rollup": "^1.27.14",
|
|
56
|
+
"rollup-plugin-babel": "^4.3.3",
|
|
57
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
58
|
+
"rollup-plugin-gzip": "^2.2.0",
|
|
59
|
+
"rollup-plugin-node-resolve": "^5.0.1",
|
|
60
|
+
"rollup-plugin-uglify": "^6.0.4",
|
|
61
|
+
"rollup-watch": "^4.3.1",
|
|
62
|
+
"style-loader": "^1.2.1",
|
|
63
|
+
"three": "^0.125.2",
|
|
64
|
+
"ts-loader": "^7.0.4",
|
|
65
|
+
"tsconfig-paths": "^3.9.0",
|
|
66
|
+
"tsconfig-paths-webpack-plugin": "3.2.0",
|
|
67
|
+
"typescript": "^3.9.2",
|
|
68
|
+
"vuepress": "^1.9.7",
|
|
69
|
+
"webpack": "^4.43.0",
|
|
70
|
+
"webpack-cli": "^3.3.11",
|
|
71
|
+
"webpack-dev-server": "^3.11.0"
|
|
72
|
+
}
|
|
73
|
+
}
|
package/rollup.config.js
CHANGED
package/src/IKanimation/Bone.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Mat4 } from "src/math/Mat4";
|
|
2
|
-
import { Vec3 } from "src/math/Vec3";
|
|
3
|
-
import { Thing } from "src/render/thing";
|
|
4
2
|
import { TypedConstraint } from "./constaint/constraint";
|
|
5
3
|
|
|
6
4
|
/*
|
|
@@ -11,13 +9,11 @@ import { TypedConstraint } from "./constaint/constraint";
|
|
|
11
9
|
* @LastEditTime : 2021-03-23 16:19:09
|
|
12
10
|
* @FilePath : \cga.js\src\IKanimation\Bone.ts
|
|
13
11
|
*/
|
|
14
|
-
export class Bone
|
|
15
|
-
children: Bone[] = [];
|
|
12
|
+
export class Bone {
|
|
16
13
|
contraints: TypedConstraint[] = []
|
|
17
14
|
matrix: Mat4 = Mat4.Identity;
|
|
18
15
|
|
|
19
16
|
constructor() {
|
|
20
|
-
super();
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
|
package/src/alg/common.ts
CHANGED
|
@@ -79,18 +79,18 @@ export function boundingBox(points: Vec3[]) {
|
|
|
79
79
|
/**
|
|
80
80
|
*
|
|
81
81
|
* @param {*} points
|
|
82
|
-
* @param {*}
|
|
82
|
+
* @param {*} quat
|
|
83
83
|
* @param {Boolean} ref 是否是引用
|
|
84
84
|
*/
|
|
85
|
-
export function applyQuat(points: any | Vec3[],
|
|
85
|
+
export function applyQuat(points: any | Vec3[], quat: Quat, ref = true): Vec3 | any {
|
|
86
86
|
if (ref) {
|
|
87
87
|
points.flat(Infinity).forEach((point: Vec3 | any) => {
|
|
88
|
-
point.applyQuat(
|
|
88
|
+
point.applyQuat(quat);
|
|
89
89
|
});
|
|
90
90
|
return points;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
return applyQuat(clone(points),
|
|
93
|
+
return applyQuat(clone(points), quat)
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
package/src/alg/extrude.ts
CHANGED
|
@@ -13,14 +13,14 @@ import { quat, Quat } from '../math/Quat';
|
|
|
13
13
|
import { Path } from '../struct/3d/Path';
|
|
14
14
|
import { clone, rotateByUnitVectors, angle } from './common';
|
|
15
15
|
import { applyMat4, translate } from './pointset';
|
|
16
|
-
import {
|
|
16
|
+
import { MeshTool } from '../render/mesh';
|
|
17
17
|
import { AxisPlane, triangulation } from './trianglution';
|
|
18
18
|
import { flat, unique } from '../utils/array';
|
|
19
19
|
import { isDefined, isUndefined } from '../utils/types';
|
|
20
20
|
import { m4 } from '../math/Mat4';
|
|
21
21
|
import { IGeometry } from '../render/geometry';
|
|
22
22
|
import { RADIANS_PER_DEGREE } from '../math/Math';
|
|
23
|
-
import {vecs} from '../math/vecs';
|
|
23
|
+
import { vecs } from '../math/vecs';
|
|
24
24
|
import { ArrayList } from '../struct/data/ArrayList';
|
|
25
25
|
import { Distance } from '../basic/distance';
|
|
26
26
|
|
|
@@ -193,7 +193,7 @@ export function linkSides(options: ILinkSideOptions): IGeometry {
|
|
|
193
193
|
var orgHoles = options.orgHoles || (holess && holess[0]);
|
|
194
194
|
|
|
195
195
|
if (index)
|
|
196
|
-
indexable(allVertics, index);
|
|
196
|
+
MeshTool.indexable(allVertics, index);
|
|
197
197
|
|
|
198
198
|
for (var i = 0; i < length; i++) {
|
|
199
199
|
if (holess)
|
|
@@ -595,7 +595,7 @@ export function extrude_obsolete<T extends Vec3>(shape: ArrayList<T>, arg_path:
|
|
|
595
595
|
|
|
596
596
|
const gindex = { index: 0 };
|
|
597
597
|
var vertices = flat(shapeArray);
|
|
598
|
-
indexable(vertices, gindex);
|
|
598
|
+
MeshTool.indexable(vertices, gindex);
|
|
599
599
|
var { index } = linkSides({ shapes: shapeArray, shapeClosed: options.shapeClosed, pathClosed: options.isClosed2, orgShape: shape as any });
|
|
600
600
|
shapepath = new Path(shape as any);
|
|
601
601
|
var uvs = [];
|
|
@@ -635,9 +635,9 @@ export function extrude_obsolete<T extends Vec3>(shape: ArrayList<T>, arg_path:
|
|
|
635
635
|
sealStartTris.reverse();
|
|
636
636
|
|
|
637
637
|
if (options.sealStart)
|
|
638
|
-
indexable(startSeal, gindex);
|
|
638
|
+
MeshTool.indexable(startSeal, gindex);
|
|
639
639
|
if (options.sealEnd)
|
|
640
|
-
indexable(endSeal, gindex);
|
|
640
|
+
MeshTool.indexable(endSeal, gindex);
|
|
641
641
|
var sealEndTris = []
|
|
642
642
|
var hasVLen = vertices.length;
|
|
643
643
|
if (options.sealStart)
|
package/src/app.ts
CHANGED
|
@@ -92,16 +92,9 @@
|
|
|
92
92
|
import * as cga from "./index"
|
|
93
93
|
import { Vec3, v3 } from './math/Vec3';
|
|
94
94
|
import { GLView } from './glview';
|
|
95
|
-
import { Mesh, PlaneBufferGeometry, MeshBasicMaterial, DoubleSide,
|
|
95
|
+
import { Mesh, PlaneBufferGeometry, MeshBasicMaterial, DoubleSide, FrontSide, WebGLRenderTarget, MeshNormalMaterial, DepthTexture, MeshPhongMaterial, CanvasTexture, ShaderMaterial, } from 'three';
|
|
96
96
|
|
|
97
|
-
import {
|
|
98
|
-
import Delaunay from './alg/delaunay';
|
|
99
|
-
import { extrude, linkSides } from './alg/extrude';
|
|
100
|
-
import { Polyline } from './struct/3d/Polyline';
|
|
101
|
-
import { PI, PI_OVER_TWO, PI_TWO } from "./math/Math";
|
|
102
|
-
import { clone, scale, translate } from "./alg/common";
|
|
103
|
-
import { BufferGeometry } from "./render/geometry";
|
|
104
|
-
import { toGeoBuffer } from "./render/mesh";
|
|
97
|
+
import { extrude } from './alg/extrude';
|
|
105
98
|
|
|
106
99
|
|
|
107
100
|
// var a = Vec3.fromDegrees(-75.62898254394531, 40.02804946899414, 0.0);
|
|
@@ -211,7 +204,6 @@ var geometry = cga.toGeometryBuffer(geo);
|
|
|
211
204
|
geometry.computeVertexNormals();
|
|
212
205
|
|
|
213
206
|
import * as THREE from "three"
|
|
214
|
-
import { diamondMaterial } from "./diamondMaterialShader";
|
|
215
207
|
import { BreathLight } from "./effect/breath-light";
|
|
216
208
|
import { Mat4 } from "./math/Mat4";
|
|
217
209
|
import { Color } from "./index";
|
|
@@ -6,20 +6,17 @@
|
|
|
6
6
|
* @LastEditTime : 2021-03-11 10:54:11
|
|
7
7
|
* @FilePath : \cga.js\src\extends\geometryaid.ts
|
|
8
8
|
*/
|
|
9
|
-
import { toGeoBuffer, indexable } from '../render/mesh';
|
|
10
9
|
import { Vec3 } from '../math/Vec3';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { Polyline } from '../struct/3d/Polyline';
|
|
14
|
-
import { Polygon } from '../struct/3d/Polygon';
|
|
15
|
-
import { AxisPlane, triangulation } from '../alg/trianglution';
|
|
10
|
+
import { extrude_obsolete, IExtrudeOptions, linkSides } from '../alg/extrude';
|
|
11
|
+
import { AxisPlane } from '../alg/trianglution';
|
|
16
12
|
import { flat } from '../utils/array';
|
|
17
|
-
import { BufferGeometry,
|
|
13
|
+
import { BufferGeometry, IGeometry } from '../render/geometry';
|
|
18
14
|
import { ArrayList } from '../struct/data/ArrayList';
|
|
15
|
+
import { MeshTool } from '../render/mesh';
|
|
19
16
|
|
|
20
17
|
export function toGeometryBuffer(geo: IGeometry) {
|
|
21
18
|
|
|
22
|
-
var buffer: BufferGeometry = toGeoBuffer(geo.position, geo.index!, geo.uv)
|
|
19
|
+
var buffer: BufferGeometry = MeshTool.toGeoBuffer(geo.position, geo.index!, geo.uv)
|
|
23
20
|
|
|
24
21
|
return buffer
|
|
25
22
|
}
|
|
@@ -32,7 +29,7 @@ export function toGeometryBuffer(geo: IGeometry) {
|
|
|
32
29
|
*/
|
|
33
30
|
export function extrudeToGeometryBuffer(shape: ArrayList<Vec3>, arg_path: Array<Vec3>, options: IExtrudeOptions) {
|
|
34
31
|
var extrudeRes = extrude_obsolete(shape, arg_path, options);
|
|
35
|
-
return toGeoBuffer(extrudeRes.vertices, extrudeRes.index!, extrudeRes.uvs);
|
|
32
|
+
return MeshTool.toGeoBuffer(extrudeRes.vertices, extrudeRes.index!, extrudeRes.uvs);
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
|
|
@@ -59,7 +56,7 @@ export function linkToGeometry(shape: Array<Vec3>, shape1: | Array<Vec3>, axisPl
|
|
|
59
56
|
*/
|
|
60
57
|
export function linksToGeometry(shapes: Array<Vec3>[], pathClosed: boolean = true, shapeClosed: boolean = true) {
|
|
61
58
|
const vertices = flat(shapes);
|
|
62
|
-
indexable(vertices)
|
|
59
|
+
MeshTool.indexable(vertices)
|
|
63
60
|
const geo = linkSides({ shapes, shapeClosed: pathClosed, orgShape: shapes[0] });
|
|
64
61
|
|
|
65
62
|
const geometry = toGeometryBuffer(geo)
|
|
@@ -70,9 +67,9 @@ export function linksToGeometry(shapes: Array<Vec3>[], pathClosed: boolean = tru
|
|
|
70
67
|
// /**
|
|
71
68
|
// * 三角剖分后转成几何体
|
|
72
69
|
// * 只考虑XY平面
|
|
73
|
-
// * @param {*} boundary
|
|
74
|
-
// * @param {*} hole
|
|
75
|
-
// * @param {*} options
|
|
70
|
+
// * @param {*} boundary
|
|
71
|
+
// * @param {*} hole
|
|
72
|
+
// * @param {*} options
|
|
76
73
|
// */
|
|
77
74
|
// export function trianglutionToGeometryBuffer(boundary: any, holes: any[] = [], options: any = { normal: Vec3.UnitZ }) {
|
|
78
75
|
// var triangles = triangulation(boundary, holes, options)
|
package/src/index.ts
CHANGED
|
@@ -36,13 +36,11 @@ export * from "./struct/3d/Frustum"
|
|
|
36
36
|
export * from "./struct/3d/Sphere"
|
|
37
37
|
|
|
38
38
|
export * from "./alg/delaunator"
|
|
39
|
-
export * from "./alg/voronoi"
|
|
40
|
-
|
|
41
|
-
export * from "./render/eventhandler"
|
|
39
|
+
export * from "./alg/voronoi"
|
|
42
40
|
|
|
43
41
|
export * from "./extends/geometryaid"
|
|
44
42
|
|
|
45
43
|
//Geometry
|
|
46
|
-
export * from "./render/
|
|
44
|
+
export * from "./render/bufferAttribute"
|
|
47
45
|
export * from "./render/geometry"
|
|
48
46
|
export * from "./render/mesh"
|
package/src/math/Color.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { EventHandler } from "../render/eventhandler";
|
|
2
1
|
|
|
3
|
-
export class Color
|
|
2
|
+
export class Color {
|
|
4
3
|
_r: number = 0.0;
|
|
5
4
|
_g: number = 0.0;
|
|
6
5
|
_b: number = 0.0;
|
|
7
6
|
_a: number = 1.0;
|
|
8
7
|
|
|
9
|
-
constructor(r: number = 0, g: number = 0, b: number = 0, a: number = 1) {
|
|
10
|
-
super();
|
|
8
|
+
constructor(r: number = 0, g: number = 0, b: number = 0, a: number = 1) {
|
|
11
9
|
this._r = r;
|
|
12
10
|
this._g = g;
|
|
13
11
|
this._b = b;
|
|
@@ -25,7 +23,7 @@ export class Color extends EventHandler {
|
|
|
25
23
|
set r(value) {
|
|
26
24
|
if (this._r !== value) {
|
|
27
25
|
this._r = value;
|
|
28
|
-
this.fire('change', 'r', this._r, value)
|
|
26
|
+
// this.fire('change', 'r', this._r, value)
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
@@ -36,7 +34,7 @@ export class Color extends EventHandler {
|
|
|
36
34
|
set g(value) {
|
|
37
35
|
if (this._g !== value) {
|
|
38
36
|
this._g = value;
|
|
39
|
-
this.fire('change', 'g', this._g, value)
|
|
37
|
+
// this.fire('change', 'g', this._g, value)
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
|
|
@@ -47,7 +45,7 @@ export class Color extends EventHandler {
|
|
|
47
45
|
set b(value) {
|
|
48
46
|
if (this._b !== value) {
|
|
49
47
|
this._b = value;
|
|
50
|
-
this.fire('change', 'b', this._b, value)
|
|
48
|
+
// this.fire('change', 'b', this._b, value)
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
|
|
@@ -58,7 +56,7 @@ export class Color extends EventHandler {
|
|
|
58
56
|
set a(value) {
|
|
59
57
|
if (this._a !== value) {
|
|
60
58
|
this._a = value;
|
|
61
|
-
this.fire('change', 'a', this._a, value)
|
|
59
|
+
// this.fire('change', 'a', this._a, value)
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
|
package/src/math/Euler.ts
CHANGED
|
@@ -2,17 +2,16 @@ import { v3 } from "./Vec3";
|
|
|
2
2
|
import { clamp } from "./Math";
|
|
3
3
|
import { m4, Mat4 } from "./Mat4";
|
|
4
4
|
import { quat, Quat } from './Quat';
|
|
5
|
-
import { EventHandler } from "../render/eventhandler";
|
|
6
5
|
|
|
7
6
|
var _matrix = m4();
|
|
8
7
|
var _Quat = quat();
|
|
9
8
|
|
|
10
9
|
const RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"];
|
|
11
10
|
const DefaultOrder = "XYZ";
|
|
12
|
-
export class Euler
|
|
11
|
+
export class Euler {
|
|
13
12
|
isEuler: boolean = true;
|
|
14
13
|
constructor(public _x: number = 0, public _y: number = 0, public _z: number = 0, public _order = DefaultOrder) {
|
|
15
|
-
|
|
14
|
+
|
|
16
15
|
}
|
|
17
16
|
get x() {
|
|
18
17
|
return this._x;
|
|
@@ -21,7 +20,7 @@ export class Euler extends EventHandler {
|
|
|
21
20
|
set x(value) {
|
|
22
21
|
if (this._x !== value) {
|
|
23
22
|
this._x = value;
|
|
24
|
-
this.fire('change', 'x', this._x, value)
|
|
23
|
+
// this.fire('change', 'x', this._x, value)
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -32,7 +31,7 @@ export class Euler extends EventHandler {
|
|
|
32
31
|
set y(value) {
|
|
33
32
|
if (this._y !== value) {
|
|
34
33
|
this._y = value;
|
|
35
|
-
this.fire('change', 'y', this._y, value)
|
|
34
|
+
// this.fire('change', 'y', this._y, value)
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -43,7 +42,7 @@ export class Euler extends EventHandler {
|
|
|
43
42
|
set z(value) {
|
|
44
43
|
if (this._z !== value) {
|
|
45
44
|
this._z = value;
|
|
46
|
-
this.fire('change', 'z', this._z, value)
|
|
45
|
+
// this.fire('change', 'z', this._z, value)
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -54,7 +53,7 @@ export class Euler extends EventHandler {
|
|
|
54
53
|
|
|
55
54
|
set order(value) {
|
|
56
55
|
if (this._order !== value) {
|
|
57
|
-
this.fire('change', 'order', this._order, value)
|
|
56
|
+
// this.fire('change', 'order', this._order, value)
|
|
58
57
|
this._order = value;
|
|
59
58
|
}
|
|
60
59
|
}
|
|
@@ -65,7 +64,7 @@ export class Euler extends EventHandler {
|
|
|
65
64
|
this._z = z;
|
|
66
65
|
this._order = order || this._order;
|
|
67
66
|
|
|
68
|
-
this.fire('change')
|
|
67
|
+
// this.fire('change')
|
|
69
68
|
|
|
70
69
|
|
|
71
70
|
return this;
|
|
@@ -81,7 +80,7 @@ export class Euler extends EventHandler {
|
|
|
81
80
|
this._z = Euler._z;
|
|
82
81
|
this._order = Euler._order;
|
|
83
82
|
|
|
84
|
-
this.fire('change')
|
|
83
|
+
// this.fire('change')
|
|
85
84
|
|
|
86
85
|
return this;
|
|
87
86
|
}
|
|
@@ -170,9 +169,9 @@ export class Euler extends EventHandler {
|
|
|
170
169
|
|
|
171
170
|
this._order = order;
|
|
172
171
|
|
|
173
|
-
if (update !== false) this.fire('change')
|
|
172
|
+
if (update !== false)// this.fire('change')
|
|
174
173
|
|
|
175
|
-
|
|
174
|
+
return this;
|
|
176
175
|
}
|
|
177
176
|
|
|
178
177
|
setFromQuat(q: Quat, order?: any, update?: boolean) {
|
|
@@ -208,7 +207,7 @@ export class Euler extends EventHandler {
|
|
|
208
207
|
this._z = array[2];
|
|
209
208
|
if (array[3] !== undefined) this._order = array[3];
|
|
210
209
|
|
|
211
|
-
this.fire('change')
|
|
210
|
+
// this.fire('change')
|
|
212
211
|
|
|
213
212
|
return this;
|
|
214
213
|
}
|
package/src/math/HVec3.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* @Date : 2021-08-02 16:24:03
|
|
6
6
|
* @LastEditTime : 2021-08-03 11:32:10
|
|
7
7
|
* @FilePath : \cga.js\src\math\HVec3.ts
|
|
8
|
-
*/
|
|
9
|
-
import { EventHandler } from '../render/eventhandler';
|
|
8
|
+
*/
|
|
10
9
|
|
|
11
10
|
import Decimal from 'decimal.js';
|
|
12
11
|
// import { wgs84RadiiSquared } from '../gis/gis';
|
|
@@ -21,12 +20,11 @@ export interface IHVec4 extends IHVec3 {
|
|
|
21
20
|
w: Decimal;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
export class HVec3
|
|
23
|
+
export class HVec3 implements IHVec3 {
|
|
25
24
|
x: Decimal;
|
|
26
25
|
y: Decimal;
|
|
27
26
|
z: Decimal;
|
|
28
|
-
constructor(private _x: any = 0, private _y: any = 0, private _z: any = 0) {
|
|
29
|
-
super();
|
|
27
|
+
constructor(private _x: any = 0, private _y: any = 0, private _z: any = 0) {
|
|
30
28
|
this.x = new Decimal(_x);
|
|
31
29
|
this.y = new Decimal(_x);
|
|
32
30
|
this.z = new Decimal(_x);
|