@xort/cga 0.0.76 → 0.0.79
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/dist/app.js +4 -1
- package/dist/math/Color.d.ts +7 -9
- package/dist/math/Color.js +54 -56
- package/package.json +2 -1
- package/src/app.ts +4 -1
- package/src/index.ts +1 -0
- package/src/math/Color.ts +60 -36
- package/dist/src/IKanimation/Bone.d.ts +0 -9
- package/dist/src/IKanimation/Bone.js +0 -40
- package/dist/src/IKanimation/CCDSolver.d.ts +0 -37
- package/dist/src/IKanimation/CCDSolver.js +0 -93
- package/dist/src/IKanimation/Joint.d.ts +0 -3
- package/dist/src/IKanimation/Joint.js +0 -17
- package/dist/src/IKanimation/constaint/constraint.d.ts +0 -10
- package/dist/src/IKanimation/constaint/constraint.js +0 -25
- package/dist/src/IKanimation/constaint/hinge.d.ts +0 -12
- package/dist/src/IKanimation/constaint/hinge.js +0 -46
- package/dist/src/IKanimation/constaint/slider.d.ts +0 -12
- package/dist/src/IKanimation/constaint/slider.js +0 -44
- package/dist/src/IKanimation/index.d.ts +0 -0
- package/dist/src/IKanimation/index.js +0 -9
- package/dist/src/IKanimation/isolver.d.ts +0 -4
- package/dist/src/IKanimation/isolver.js +0 -10
- package/dist/src/IKanimation/skeleton.d.ts +0 -13
- package/dist/src/IKanimation/skeleton.js +0 -31
- package/dist/src/alg/common.d.ts +0 -114
- package/dist/src/alg/common.js +0 -302
- package/dist/src/alg/curve.d.ts +0 -4
- package/dist/src/alg/curve.js +0 -11
- package/dist/src/alg/delaunator.d.ts +0 -29
- package/dist/src/alg/delaunator.js +0 -442
- package/dist/src/alg/delaunay.d.ts +0 -20
- package/dist/src/alg/delaunay.js +0 -199
- package/dist/src/alg/delaunayslow.d.ts +0 -18
- package/dist/src/alg/delaunayslow.js +0 -140
- package/dist/src/alg/extrude/extrude.d.ts +0 -3
- package/dist/src/alg/extrude/extrude.js +0 -17
- package/dist/src/alg/extrude.d.ts +0 -199
- package/dist/src/alg/extrude.js +0 -731
- package/dist/src/alg/offset/index.d.ts +0 -0
- package/dist/src/alg/offset/index.js +0 -9
- package/dist/src/alg/offset.d.ts +0 -0
- package/dist/src/alg/offset.js +0 -472
- package/dist/src/alg/pointset.d.ts +0 -94
- package/dist/src/alg/pointset.js +0 -223
- package/dist/src/alg/recognition.d.ts +0 -14
- package/dist/src/alg/recognition.js +0 -37
- package/dist/src/alg/result.d.ts +0 -22
- package/dist/src/alg/result.js +0 -2
- package/dist/src/alg/segmentset.d.ts +0 -11
- package/dist/src/alg/segmentset.js +0 -45
- package/dist/src/alg/sort.d.ts +0 -2
- package/dist/src/alg/sort.js +0 -14
- package/dist/src/alg/split.d.ts +0 -8
- package/dist/src/alg/split.js +0 -10
- package/dist/src/alg/trianglution.d.ts +0 -20
- package/dist/src/alg/trianglution.js +0 -77
- package/dist/src/alg/vol.d.ts +0 -6
- package/dist/src/alg/vol.js +0 -18
- package/dist/src/alg/voronoi.d.ts +0 -31
- package/dist/src/alg/voronoi.js +0 -418
- package/dist/src/app.d.ts +0 -1
- package/dist/src/app.js +0 -245
- package/dist/src/basic/distance.d.ts +0 -12
- package/dist/src/basic/distance.js +0 -42
- package/dist/src/csg/bsp.d.ts +0 -9
- package/dist/src/csg/bsp.js +0 -22
- package/dist/src/csg/node.d.ts +0 -12
- package/dist/src/csg/node.js +0 -75
- package/dist/src/csg/polygon.d.ts +0 -43
- package/dist/src/csg/polygon.js +0 -161
- package/dist/src/diamondMaterialShader.d.ts +0 -92
- package/dist/src/diamondMaterialShader.js +0 -118
- package/dist/src/effect/breath-light.d.ts +0 -4
- package/dist/src/effect/breath-light.js +0 -39
- package/dist/src/extends/geometryaid.d.ts +0 -28
- package/dist/src/extends/geometryaid.js +0 -80
- package/dist/src/extends/split.d.ts +0 -3
- package/dist/src/extends/split.js +0 -13
- package/dist/src/glview.d.ts +0 -112
- package/dist/src/glview.js +0 -564
- package/dist/src/index.d.ts +0 -36
- package/dist/src/index.js +0 -54
- package/dist/src/math/Euler.d.ts +0 -47
- package/dist/src/math/Euler.js +0 -245
- package/dist/src/math/HVec3.d.ts +0 -44
- package/dist/src/math/HVec3.js +0 -195
- package/dist/src/math/Mat3.d.ts +0 -29
- package/dist/src/math/Mat3.js +0 -244
- package/dist/src/math/Mat4.d.ts +0 -85
- package/dist/src/math/Mat4.js +0 -791
- package/dist/src/math/Math.d.ts +0 -130
- package/dist/src/math/Math.js +0 -198
- package/dist/src/math/Quat.d.ts +0 -83
- package/dist/src/math/Quat.js +0 -440
- package/dist/src/math/Vec.d.ts +0 -7
- package/dist/src/math/Vec.js +0 -43
- package/dist/src/math/Vec2.d.ts +0 -68
- package/dist/src/math/Vec2.js +0 -347
- package/dist/src/math/Vec3.d.ts +0 -232
- package/dist/src/math/Vec3.js +0 -1089
- package/dist/src/math/Vec4.d.ts +0 -81
- package/dist/src/math/Vec4.js +0 -494
- package/dist/src/math/vector.d.ts +0 -114
- package/dist/src/math/vector.js +0 -373
- package/dist/src/render/buffer-attribute.d.ts +0 -100
- package/dist/src/render/buffer-attribute.js +0 -340
- package/dist/src/render/eventhandler.d.ts +0 -78
- package/dist/src/render/eventhandler.js +0 -189
- package/dist/src/render/geometry.d.ts +0 -89
- package/dist/src/render/geometry.js +0 -775
- package/dist/src/render/mesh.d.ts +0 -25
- package/dist/src/render/mesh.js +0 -82
- package/dist/src/render/thing.d.ts +0 -34
- package/dist/src/render/thing.js +0 -196
- package/dist/src/render/types.d.ts +0 -2
- package/dist/src/render/types.js +0 -8
- package/dist/src/robust/plane.d.ts +0 -7
- package/dist/src/robust/plane.js +0 -17
- package/dist/src/robust/vec.d.ts +0 -15
- package/dist/src/robust/vec.js +0 -71
- package/dist/src/shape/arc.d.ts +0 -2
- package/dist/src/shape/arc.js +0 -14
- package/dist/src/struct/3d/Box.d.ts +0 -23
- package/dist/src/struct/3d/Box.js +0 -109
- package/dist/src/struct/3d/Capsule.d.ts +0 -12
- package/dist/src/struct/3d/Capsule.js +0 -36
- package/dist/src/struct/3d/Circle.d.ts +0 -34
- package/dist/src/struct/3d/Circle.js +0 -80
- package/dist/src/struct/3d/Disk.d.ts +0 -10
- package/dist/src/struct/3d/Disk.js +0 -22
- package/dist/src/struct/3d/Frustum.d.ts +0 -35
- package/dist/src/struct/3d/Frustum.js +0 -159
- package/dist/src/struct/3d/Line.d.ts +0 -40
- package/dist/src/struct/3d/Line.js +0 -339
- package/dist/src/struct/3d/Path.d.ts +0 -75
- package/dist/src/struct/3d/Path.js +0 -308
- package/dist/src/struct/3d/Plane.d.ts +0 -74
- package/dist/src/struct/3d/Plane.js +0 -295
- package/dist/src/struct/3d/Point.d.ts +0 -4
- package/dist/src/struct/3d/Point.js +0 -30
- package/dist/src/struct/3d/Polygon.d.ts +0 -8
- package/dist/src/struct/3d/Polygon.js +0 -55
- package/dist/src/struct/3d/Polyline.d.ts +0 -25
- package/dist/src/struct/3d/Polyline.js +0 -109
- package/dist/src/struct/3d/Ray.d.ts +0 -21
- package/dist/src/struct/3d/Ray.js +0 -262
- package/dist/src/struct/3d/Rectangle.d.ts +0 -7
- package/dist/src/struct/3d/Rectangle.js +0 -35
- package/dist/src/struct/3d/Segment.d.ts +0 -32
- package/dist/src/struct/3d/Segment.js +0 -334
- package/dist/src/struct/3d/Shape.d.ts +0 -4
- package/dist/src/struct/3d/Shape.js +0 -27
- package/dist/src/struct/3d/Sphere.d.ts +0 -11
- package/dist/src/struct/3d/Sphere.js +0 -30
- package/dist/src/struct/3d/Triangle.d.ts +0 -8
- package/dist/src/struct/3d/Triangle.js +0 -53
- package/dist/src/struct/data/ArrayList.d.ts +0 -42
- package/dist/src/struct/data/ArrayList.js +0 -172
- package/dist/src/struct/data/ArrayObject.d.ts +0 -30
- package/dist/src/struct/data/ArrayObject.js +0 -131
- package/dist/src/struct/data/type.d.ts +0 -13
- package/dist/src/struct/data/type.js +0 -18
- package/dist/src/utils/array.d.ts +0 -24
- package/dist/src/utils/array.js +0 -89
- package/dist/src/utils/types.d.ts +0 -24
- package/dist/src/utils/types.js +0 -20
- package/dist/src-gis/app.d.ts +0 -1
- package/dist/src-gis/app.js +0 -4
- package/dist/src-gis/core/Cartographic.d.ts +0 -20
- package/dist/src-gis/core/Cartographic.js +0 -52
- package/dist/src-gis/core/EllipsoidGeodesic.d.ts +0 -14
- package/dist/src-gis/core/EllipsoidGeodesic.js +0 -51
- package/dist/src-gis/core/EllipsoidTerrainProvider.d.ts +0 -10
- package/dist/src-gis/core/EllipsoidTerrainProvider.js +0 -29
- package/dist/src-gis/core/HeightmapTerrainData.d.ts +0 -3
- package/dist/src-gis/core/HeightmapTerrainData.js +0 -9
- package/dist/src-gis/core/Rectangle.d.ts +0 -45
- package/dist/src-gis/core/Rectangle.js +0 -127
- package/dist/src-gis/core/TaskProcessor.d.ts +0 -35
- package/dist/src-gis/core/TaskProcessor.js +0 -183
- package/dist/src-gis/gis.d.ts +0 -5
- package/dist/src-gis/gis.js +0 -12
- package/dist/src-gis/globe.d.ts +0 -12
- package/dist/src-gis/globe.js +0 -61
- package/dist/src-gis/math/Cartographic.d.ts +0 -8
- package/dist/src-gis/math/Cartographic.js +0 -26
- package/dist/src-gis/math/GVec3.d.ts +0 -12
- package/dist/src-gis/math/GVec3.js +0 -69
- package/dist/src-gis/math/ellipsoid.d.ts +0 -8
- package/dist/src-gis/math/ellipsoid.js +0 -14
- package/dist/src-gis/provider/DcTerrainProvider.d.ts +0 -15
- package/dist/src-gis/provider/DcTerrainProvider.js +0 -19
- package/dist/src-gis/provider/TerrainProvider.d.ts +0 -3
- package/dist/src-gis/provider/TerrainProvider.js +0 -17
- package/dist/src-gis/scene/DcImageryProvider.d.ts +0 -6
- package/dist/src-gis/scene/DcImageryProvider.js +0 -35
- package/dist/src-gis/scene/GeographicTilingScheme.d.ts +0 -21
- package/dist/src-gis/scene/GeographicTilingScheme.js +0 -46
- package/dist/src-gis/scene/Globe.d.ts +0 -34
- package/dist/src-gis/scene/Globe.js +0 -62
- package/dist/src-gis/scene/GlobeSurfaceShaderSet.d.ts +0 -6
- package/dist/src-gis/scene/GlobeSurfaceShaderSet.js +0 -11
- package/dist/src-gis/scene/GlobeSurfaceTileProvider.d.ts +0 -21
- package/dist/src-gis/scene/GlobeSurfaceTileProvider.js +0 -15
- package/dist/src-gis/scene/ImageryLayerCollection.d.ts +0 -21
- package/dist/src-gis/scene/ImageryLayerCollection.js +0 -87
- package/dist/src-gis/scene/ImageryProvider.d.ts +0 -4
- package/dist/src-gis/scene/ImageryProvider.js +0 -28
- package/dist/src-gis/scene/QuadtreeTile.d.ts +0 -48
- package/dist/src-gis/scene/QuadtreeTile.js +0 -137
- package/dist/src-gis/scene/UrlTemplateImageryProvider.d.ts +0 -9
- package/dist/src-gis/scene/UrlTemplateImageryProvider.js +0 -29
- package/dist/src-gis/scene/quadtree_primitive.d.ts +0 -14
- package/dist/src-gis/scene/quadtree_primitive.js +0 -50
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Distance = void 0;
|
|
7
|
-
var Vec3_1 = require("../math/Vec3");
|
|
8
|
-
var vector_1 = __importDefault(require("../math/vector"));
|
|
9
|
-
/*
|
|
10
|
-
* @Description : 如无必要,勿增实体
|
|
11
|
-
* @Author : 赵耀圣
|
|
12
|
-
* @QQ : 549184003
|
|
13
|
-
* @Date : 2021-09-30 10:54:56
|
|
14
|
-
* @LastEditTime : 2021-09-30 10:59:50
|
|
15
|
-
* @FilePath : \cga.js\src\alg\distance.ts
|
|
16
|
-
*/
|
|
17
|
-
var _vec3_1 = new Vec3_1.Vec3();
|
|
18
|
-
var Distance = /** @class */ (function () {
|
|
19
|
-
function Distance() {
|
|
20
|
-
}
|
|
21
|
-
Distance.Point2Point_Number = function (x0, y0, z0, x1, y1, z1) {
|
|
22
|
-
return vector_1.default.distance(x0, y0, z0, x1, y1, z1);
|
|
23
|
-
};
|
|
24
|
-
Distance.Point2Line_Number = function (x0, y0, z0, sox, soy, soz, sdx, sdy, sdz) {
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param point
|
|
29
|
-
* @param origin
|
|
30
|
-
* @param dir 默认已经正交化
|
|
31
|
-
*/
|
|
32
|
-
Distance.Point2Line_Vec3 = function (point, origin, dir, result) {
|
|
33
|
-
if (result === void 0) { result = new Vec3_1.Vec3; }
|
|
34
|
-
result.copy(point).sub(origin);
|
|
35
|
-
var len = result.dot(dir);
|
|
36
|
-
result.copy(dir).multiplyScalar(len);
|
|
37
|
-
result.add(point);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
return Distance;
|
|
41
|
-
}());
|
|
42
|
-
exports.Distance = Distance;
|
package/dist/src/csg/bsp.d.ts
DELETED
package/dist/src/csg/bsp.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BSP = void 0;
|
|
4
|
-
var node_1 = require("./node");
|
|
5
|
-
var BSP = /** @class */ (function () {
|
|
6
|
-
function BSP(faces) {
|
|
7
|
-
this.tree = new node_1.Node(faces);
|
|
8
|
-
}
|
|
9
|
-
//差
|
|
10
|
-
BSP.prototype.sub = function (other) {
|
|
11
|
-
var a = this.tree.clone();
|
|
12
|
-
var b = this.tree.clone();
|
|
13
|
-
};
|
|
14
|
-
//和
|
|
15
|
-
BSP.prototype.union = function (other) {
|
|
16
|
-
};
|
|
17
|
-
//交
|
|
18
|
-
BSP.prototype.intersect = function (other) {
|
|
19
|
-
};
|
|
20
|
-
return BSP;
|
|
21
|
-
}());
|
|
22
|
-
exports.BSP = BSP;
|
package/dist/src/csg/node.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Polygon } from "./polygon";
|
|
2
|
-
export declare class Node {
|
|
3
|
-
front: Node | undefined;
|
|
4
|
-
back: Node | undefined;
|
|
5
|
-
polygons: Polygon[];
|
|
6
|
-
divider: Polygon | undefined;
|
|
7
|
-
constructor(polygons?: Polygon[]);
|
|
8
|
-
clone(): Node;
|
|
9
|
-
invert(): void;
|
|
10
|
-
clipPolygons(polygons: Polygon[]): any;
|
|
11
|
-
clipTo(node: Node): void;
|
|
12
|
-
}
|
package/dist/src/csg/node.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @Description :
|
|
4
|
-
* @Author : 赵耀圣
|
|
5
|
-
* @QQ : 549184003
|
|
6
|
-
* @Date : 2021-08-03 10:18:26
|
|
7
|
-
* @LastEditTime : 2021-08-03 15:56:34
|
|
8
|
-
* @FilePath : \cga.js\src\csg\node.ts
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.Node = void 0;
|
|
12
|
-
var Node = /** @class */ (function () {
|
|
13
|
-
function Node(polygons) {
|
|
14
|
-
if (polygons === void 0) { polygons = []; }
|
|
15
|
-
this.polygons = polygons;
|
|
16
|
-
if (polygons && polygons.length > 0)
|
|
17
|
-
this.divider = polygons[0].clone();
|
|
18
|
-
var i = 0;
|
|
19
|
-
var plen = polygons.length;
|
|
20
|
-
var front = [], back = [];
|
|
21
|
-
if (this.divider)
|
|
22
|
-
for (i = 0; i < plen; i++) {
|
|
23
|
-
this.divider.splitPolygon(polygons[i], this.polygons, this.polygons, front, back);
|
|
24
|
-
}
|
|
25
|
-
if (front.length > 0) {
|
|
26
|
-
this.front = new Node(front);
|
|
27
|
-
}
|
|
28
|
-
if (back.length > 0) {
|
|
29
|
-
this.back = new Node(back);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
Node.prototype.clone = function () {
|
|
33
|
-
var node = new Node();
|
|
34
|
-
if (this.divider)
|
|
35
|
-
node.divider = this.divider.clone();
|
|
36
|
-
node.polygons = this.polygons.map(function (polygon) {
|
|
37
|
-
return polygon.clone();
|
|
38
|
-
});
|
|
39
|
-
node.front = this.front && this.front.clone();
|
|
40
|
-
node.back = this.back && this.back.clone();
|
|
41
|
-
return node;
|
|
42
|
-
};
|
|
43
|
-
Node.prototype.invert = function () {
|
|
44
|
-
var i, polygon_count, temp;
|
|
45
|
-
for (i = 0, polygon_count = this.polygons.length; i < polygon_count; i++) {
|
|
46
|
-
this.polygons[i].flip();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Node.prototype.clipPolygons = function (polygons) {
|
|
50
|
-
var i, plen, front = [], back = [];
|
|
51
|
-
if (!this.divider)
|
|
52
|
-
return polygons.slice();
|
|
53
|
-
front = [];
|
|
54
|
-
back = [];
|
|
55
|
-
for (i = 0, plen = polygons.length; i < plen; i++) {
|
|
56
|
-
this.divider.splitPolygon(polygons[i], front, back, front, back);
|
|
57
|
-
}
|
|
58
|
-
if (this.front)
|
|
59
|
-
front = this.front.clipPolygons(front);
|
|
60
|
-
if (this.back)
|
|
61
|
-
back = this.back.clipPolygons(back);
|
|
62
|
-
else
|
|
63
|
-
back = [];
|
|
64
|
-
return front.concat(back);
|
|
65
|
-
};
|
|
66
|
-
Node.prototype.clipTo = function (node) {
|
|
67
|
-
this.polygons = node.clipPolygons(this.polygons);
|
|
68
|
-
if (this.front)
|
|
69
|
-
this.front.clipTo(node);
|
|
70
|
-
if (this.back)
|
|
71
|
-
this.back.clipTo(node);
|
|
72
|
-
};
|
|
73
|
-
return Node;
|
|
74
|
-
}());
|
|
75
|
-
exports.Node = Node;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { HVec3 } from "src/math/HVec3";
|
|
2
|
-
import Decimal from "decimal.js";
|
|
3
|
-
declare enum Side {
|
|
4
|
-
COPLANAR = 0,
|
|
5
|
-
FRONT = 1,
|
|
6
|
-
BACK = 2,
|
|
7
|
-
SPANNING = 3
|
|
8
|
-
}
|
|
9
|
-
export declare class Polygon {
|
|
10
|
-
w: Decimal;
|
|
11
|
-
normal: HVec3;
|
|
12
|
-
vertices: HVec3[];
|
|
13
|
-
constructor(vertices?: HVec3[]);
|
|
14
|
-
calcPlane(): this;
|
|
15
|
-
flip(): this;
|
|
16
|
-
/**
|
|
17
|
-
* @description : 判断点与当前多边形所在的平面的位置关系
|
|
18
|
-
* @param {HVec3} vertex
|
|
19
|
-
* @return {*}
|
|
20
|
-
* @example :
|
|
21
|
-
*/
|
|
22
|
-
classifyVertex(vertex: HVec3): Side.COPLANAR | Side.FRONT | Side.BACK;
|
|
23
|
-
/**
|
|
24
|
-
* @description : 判断另一个多边形与当前多边形的位置关系
|
|
25
|
-
* @param {Polygon} polygon
|
|
26
|
-
* @return {*}
|
|
27
|
-
* @example :
|
|
28
|
-
*/
|
|
29
|
-
classifySide(polygon: Polygon): Side;
|
|
30
|
-
/**
|
|
31
|
-
* @description : 切割多边形
|
|
32
|
-
* @param {Polygon} polygon
|
|
33
|
-
* @param {Polygon} coplanar_front
|
|
34
|
-
* @param {Polygon} coplanar_back
|
|
35
|
-
* @param {Polygon} front
|
|
36
|
-
* @param {Polygon} back
|
|
37
|
-
* @return {*}
|
|
38
|
-
* @example :
|
|
39
|
-
*/
|
|
40
|
-
splitPolygon(polygon: Polygon, coplanar_front?: Polygon[], coplanar_back?: Polygon[], front?: Polygon[], back?: Polygon[]): void;
|
|
41
|
-
clone(): Polygon;
|
|
42
|
-
}
|
|
43
|
-
export {};
|
package/dist/src/csg/polygon.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Polygon = void 0;
|
|
7
|
-
var HVec3_1 = require("src/math/HVec3");
|
|
8
|
-
var decimal_js_1 = __importDefault(require("decimal.js"));
|
|
9
|
-
var EPSILON = new decimal_js_1.default(1e-15);
|
|
10
|
-
var Side;
|
|
11
|
-
(function (Side) {
|
|
12
|
-
Side[Side["COPLANAR"] = 0] = "COPLANAR";
|
|
13
|
-
Side[Side["FRONT"] = 1] = "FRONT";
|
|
14
|
-
Side[Side["BACK"] = 2] = "BACK";
|
|
15
|
-
Side[Side["SPANNING"] = 3] = "SPANNING";
|
|
16
|
-
})(Side || (Side = {}));
|
|
17
|
-
/*
|
|
18
|
-
* @Description : 高精度多边形
|
|
19
|
-
* @Author : 赵耀圣
|
|
20
|
-
* @QQ : 549184003
|
|
21
|
-
* @Date : 2021-08-03 11:11:59
|
|
22
|
-
* @LastEditTime : 2021-08-03 15:49:25
|
|
23
|
-
* @FilePath : \cga.js\src\csg\polygon.ts
|
|
24
|
-
*/
|
|
25
|
-
var Polygon = /** @class */ (function () {
|
|
26
|
-
function Polygon(vertices) {
|
|
27
|
-
if (vertices === void 0) { vertices = []; }
|
|
28
|
-
this.w = new decimal_js_1.default(0);
|
|
29
|
-
this.normal = new HVec3_1.HVec3;
|
|
30
|
-
this.vertices = vertices;
|
|
31
|
-
this.vertices = vertices;
|
|
32
|
-
if (vertices.length > 0) {
|
|
33
|
-
this.calcPlane();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
Polygon.prototype.calcPlane = function () {
|
|
37
|
-
var a = this.vertices[0], b = this.vertices[1], c = this.vertices[2];
|
|
38
|
-
this.normal = b.clone().sub(a).cross(c.clone().sub(a)).normalize();
|
|
39
|
-
this.w = this.normal.clone().dot(a);
|
|
40
|
-
return this;
|
|
41
|
-
};
|
|
42
|
-
Polygon.prototype.flip = function () {
|
|
43
|
-
this.normal.multiplyScalar(-1);
|
|
44
|
-
this.w.mul(-1);
|
|
45
|
-
this.vertices.reverse();
|
|
46
|
-
return this;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* @description : 判断点与当前多边形所在的平面的位置关系
|
|
50
|
-
* @param {HVec3} vertex
|
|
51
|
-
* @return {*}
|
|
52
|
-
* @example :
|
|
53
|
-
*/
|
|
54
|
-
Polygon.prototype.classifyVertex = function (vertex) {
|
|
55
|
-
var side_value = this.normal.dot(vertex).sub(this.w);
|
|
56
|
-
if (side_value.lessThan(-EPSILON)) {
|
|
57
|
-
return Side.BACK;
|
|
58
|
-
}
|
|
59
|
-
else if (side_value > EPSILON) {
|
|
60
|
-
return Side.FRONT;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return Side.COPLANAR;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* @description : 判断另一个多边形与当前多边形的位置关系
|
|
68
|
-
* @param {Polygon} polygon
|
|
69
|
-
* @return {*}
|
|
70
|
-
* @example :
|
|
71
|
-
*/
|
|
72
|
-
Polygon.prototype.classifySide = function (polygon) {
|
|
73
|
-
var vertex, classification, num_positive = 0, num_negative = 0;
|
|
74
|
-
var vslen = polygon.vertices.length;
|
|
75
|
-
var i;
|
|
76
|
-
for (i = 0; i < vslen; i++) {
|
|
77
|
-
vertex = polygon.vertices[i];
|
|
78
|
-
classification = this.classifyVertex(vertex);
|
|
79
|
-
if (classification === Side.FRONT) {
|
|
80
|
-
num_positive++;
|
|
81
|
-
}
|
|
82
|
-
else if (classification === Side.BACK) {
|
|
83
|
-
num_negative++;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (num_positive === vslen && num_negative === 0) {
|
|
87
|
-
return Side.FRONT;
|
|
88
|
-
}
|
|
89
|
-
else if (num_positive === 0 && num_negative === vslen) {
|
|
90
|
-
return Side.BACK;
|
|
91
|
-
}
|
|
92
|
-
else if (num_positive > 0 && num_negative > 0) {
|
|
93
|
-
return Side.SPANNING;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
return Side.COPLANAR;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* @description : 切割多边形
|
|
101
|
-
* @param {Polygon} polygon
|
|
102
|
-
* @param {Polygon} coplanar_front
|
|
103
|
-
* @param {Polygon} coplanar_back
|
|
104
|
-
* @param {Polygon} front
|
|
105
|
-
* @param {Polygon} back
|
|
106
|
-
* @return {*}
|
|
107
|
-
* @example :
|
|
108
|
-
*/
|
|
109
|
-
Polygon.prototype.splitPolygon = function (polygon, coplanar_front, coplanar_back, front, back) {
|
|
110
|
-
if (coplanar_front === void 0) { coplanar_front = []; }
|
|
111
|
-
if (coplanar_back === void 0) { coplanar_back = []; }
|
|
112
|
-
if (front === void 0) { front = []; }
|
|
113
|
-
if (back === void 0) { back = []; }
|
|
114
|
-
var classification = this.classifySide(polygon);
|
|
115
|
-
if (classification === Side.COPLANAR) {
|
|
116
|
-
(this.normal.dot(polygon.normal).greaterThan(0) ? coplanar_front : coplanar_back).push(polygon);
|
|
117
|
-
}
|
|
118
|
-
else if (classification === Side.FRONT) {
|
|
119
|
-
front.push(polygon);
|
|
120
|
-
}
|
|
121
|
-
else if (classification === Side.BACK) {
|
|
122
|
-
back.push(polygon);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
var i, j, ti, tj, vi, vj, t, v, f = [], b = [];
|
|
126
|
-
var vslen = void 0;
|
|
127
|
-
for (i = 0, vslen = polygon.vertices.length; i < vslen; i++) {
|
|
128
|
-
j = (i + 1) % vslen;
|
|
129
|
-
vi = polygon.vertices[i];
|
|
130
|
-
vj = polygon.vertices[j];
|
|
131
|
-
ti = this.classifyVertex(vi);
|
|
132
|
-
tj = this.classifyVertex(vj);
|
|
133
|
-
if (ti != Side.BACK)
|
|
134
|
-
f.push(vi);
|
|
135
|
-
if (ti != Side.FRONT)
|
|
136
|
-
b.push(vi);
|
|
137
|
-
if ((ti | tj) === Side.SPANNING) {
|
|
138
|
-
t = (this.w.sub(this.normal.dot(vi))).div(this.normal.dot(vj.clone().sub(vi)));
|
|
139
|
-
v = vi.lerp(vj, t);
|
|
140
|
-
f.push(v);
|
|
141
|
-
b.push(v);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (f.length >= 3)
|
|
145
|
-
front.push(new Polygon(f).calcPlane());
|
|
146
|
-
if (b.length >= 3)
|
|
147
|
-
back.push(new Polygon(b).calcPlane());
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
Polygon.prototype.clone = function () {
|
|
151
|
-
var i, vslen = this.vertices.length;
|
|
152
|
-
var polygon = new Polygon();
|
|
153
|
-
for (i = 0; i < vslen; i++) {
|
|
154
|
-
polygon.vertices.push(this.vertices[i].clone());
|
|
155
|
-
}
|
|
156
|
-
polygon.calcPlane();
|
|
157
|
-
return polygon;
|
|
158
|
-
};
|
|
159
|
-
return Polygon;
|
|
160
|
-
}());
|
|
161
|
-
exports.Polygon = Polygon;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
export declare const DiamondShader: {
|
|
3
|
-
defines: {
|
|
4
|
-
RAY_BOUNCES: number;
|
|
5
|
-
};
|
|
6
|
-
vertexShader: string;
|
|
7
|
-
fragmentShader: string;
|
|
8
|
-
uniforms: {
|
|
9
|
-
tCubeMapNormals: {
|
|
10
|
-
type: string;
|
|
11
|
-
value: null;
|
|
12
|
-
};
|
|
13
|
-
envMap: {
|
|
14
|
-
type: string;
|
|
15
|
-
value: null;
|
|
16
|
-
};
|
|
17
|
-
envRefractionMap: {
|
|
18
|
-
type: string;
|
|
19
|
-
value: null;
|
|
20
|
-
};
|
|
21
|
-
sphereMap: {
|
|
22
|
-
type: string;
|
|
23
|
-
value: null;
|
|
24
|
-
};
|
|
25
|
-
envMapIntensity: {
|
|
26
|
-
type: string;
|
|
27
|
-
value: number;
|
|
28
|
-
};
|
|
29
|
-
maxBounces: {
|
|
30
|
-
type: string;
|
|
31
|
-
value: number;
|
|
32
|
-
};
|
|
33
|
-
tanAngleSqCone: {
|
|
34
|
-
type: string;
|
|
35
|
-
value: number;
|
|
36
|
-
};
|
|
37
|
-
coneHeight: {
|
|
38
|
-
type: string;
|
|
39
|
-
value: number;
|
|
40
|
-
};
|
|
41
|
-
bDebugBounces: {
|
|
42
|
-
type: string;
|
|
43
|
-
value: boolean;
|
|
44
|
-
};
|
|
45
|
-
rIndexDelta: {
|
|
46
|
-
type: string;
|
|
47
|
-
value: number;
|
|
48
|
-
};
|
|
49
|
-
n2: {
|
|
50
|
-
type: string;
|
|
51
|
-
value: number;
|
|
52
|
-
};
|
|
53
|
-
radius: {
|
|
54
|
-
type: string;
|
|
55
|
-
value: number;
|
|
56
|
-
};
|
|
57
|
-
normalOffset: {
|
|
58
|
-
type: string;
|
|
59
|
-
value: number;
|
|
60
|
-
};
|
|
61
|
-
squashFactor: {
|
|
62
|
-
type: string;
|
|
63
|
-
value: number;
|
|
64
|
-
};
|
|
65
|
-
distanceOffset: {
|
|
66
|
-
type: string;
|
|
67
|
-
value: number;
|
|
68
|
-
};
|
|
69
|
-
geometryFactor: {
|
|
70
|
-
type: string;
|
|
71
|
-
value: number;
|
|
72
|
-
};
|
|
73
|
-
Absorbption: {
|
|
74
|
-
type: string;
|
|
75
|
-
value: THREE.Vector3;
|
|
76
|
-
};
|
|
77
|
-
colorCorrection: {
|
|
78
|
-
type: string;
|
|
79
|
-
value: THREE.Vector3;
|
|
80
|
-
};
|
|
81
|
-
boostFactors: {
|
|
82
|
-
type: string;
|
|
83
|
-
value: THREE.Vector3;
|
|
84
|
-
};
|
|
85
|
-
centreOffset: {
|
|
86
|
-
type: string;
|
|
87
|
-
value: THREE.Vector3;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
side: THREE.Side;
|
|
91
|
-
};
|
|
92
|
-
export declare const diamondMaterial: THREE.ShaderMaterial;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.diamondMaterial = exports.DiamondShader = void 0;
|
|
27
|
-
var THREE = __importStar(require("three"));
|
|
28
|
-
exports.DiamondShader = {
|
|
29
|
-
defines: {
|
|
30
|
-
RAY_BOUNCES: 5
|
|
31
|
-
},
|
|
32
|
-
vertexShader: ["varying vec2 vUv;", "varying vec3 Normal;", "varying vec3 worldNormal;", "varying vec3 vecPos;", "varying vec3 viewPos;", "void main() {", "vUv = uv;", "Normal = normal;", "worldNormal = (modelMatrix * vec4(normal,0.0)).xyz;", "vecPos = (modelMatrix * vec4(position, 1.0 )).xyz;", "viewPos = (modelViewMatrix * vec4(position, 1.0 )).xyz;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
|
|
33
|
-
fragmentShader: ["varying vec2 vUv;", "varying vec3 Normal;", "varying vec3 worldNormal;", "varying vec3 vecPos;", "varying vec3 viewPos;", "uniform samplerCube tCubeMapNormals;", "uniform samplerCube envMap;", "uniform samplerCube envRefractionMap;", "uniform sampler2D sphereMap;", "uniform float envMapIntensity;", "uniform float tanAngleSqCone;", "uniform float coneHeight;", "uniform int maxBounces;", "uniform mat4 modelMatrix;", "uniform mat4 invModelMatrix;", "uniform float n2;", "uniform float radius;", "uniform bool bDebugBounces;", "uniform float rIndexDelta;", "uniform float normalOffset;", "uniform float squashFactor;", "uniform float distanceOffset;", "uniform float geometryFactor;", "uniform vec3 Absorbption;", "uniform vec3 colorCorrection;", "uniform vec3 boostFactors;", "uniform vec3 centreOffset;", "vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {", "float dotNV = abs( dot( normal, viewDir ) );", "const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );", "const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );", "vec4 r = roughness * c0 + c1;", "float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;", "vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;", "return specularColor * AB.x + AB.y;", "}", "vec4 SampleSpecularReflection(vec4 specularColor, vec3 direction ) {", "direction.x *= -1.0;", "direction.z *= -1.0;", "vec3 tempDir = normalize(vec3(0., 0., 1.) + direction);", "vec4 sampleColorRGB = envMapIntensity * envMapTexelToLinear( textureCube( envMap, direction ) );", "vec4 sampleColorRefraction = envMapIntensity * ( texture2D( sphereMap, tempDir.xy * 0.5 + 0.5 ) );", "vec3 toneMappedColor = pow(toneMapping(sampleColorRGB.rgb),vec3(1./1.));", "return vec4(toneMappedColor, 1.0);", "}", "vec4 SampleSpecularContribution(vec4 specularColor, vec3 direction ) {", "direction = normalize(direction);", "direction.x *= -1.0;", "direction.z *= -1.0;", "vec4 sampleColorRGB = envMapIntensity * envMapTexelToLinear( textureCube( envMap, direction ) );", "vec3 tempDir = normalize(vec3(0., 0., 1.) + direction);", "float m = 2.8284271247461903 * sqrt( direction.z+1.0 );", "vec4 sampleColorRefraction = envMapIntensity * texture2D( sphereMap, clamp(direction.xy / m + 0.45, vec2(0.), vec2(1.)) );", "vec3 toneMappedColor = pow(toneMapping( sampleColorRGB.rgb ),vec3(1./1.));", "return vec4(toneMappedColor, 1.0);", "}", "vec3 intersectSphere(vec3 origin, vec3 direction) {", "origin -= centreOffset;", "direction.y /= squashFactor;", "float A = dot(direction, direction);", "float B = 2.0*dot(origin, direction);", "float C = dot(origin, origin) - radius * radius;", "float disc = B*B - 4.0 * A * C;", "if(disc > 0.0)", "{", "disc = sqrt(disc);", "float t1 = (-B + disc)*geometryFactor/A;", "float t2 = (-B - disc)*geometryFactor/A;", "float t = (t1 > t2) ? t1 : t2;", "direction.y *= squashFactor;", "return vec3(origin + centreOffset + direction * t);", "}", "return vec3(0.0);", "}", "vec3 debugBounces(int count) {", "vec3 color = vec3(1.,1.,1.);", "if(count == 1)", "color = vec3(0.0,1.0,0.0);", "else if(count == 2)", "color = vec3(0.0,0.0,1.0);", "else if(count == 3)", "color = vec3(1.0,1.0,0.0);", "else if(count == 4)", "color = vec3(0.0,1.0,1.0);", "else", "color = vec3(0.0,1.0,0.0);", "if(count ==0)", "color = vec3(1.0,0.0,0.0);", "return color;", "}", "vec3 traceRay(vec3 origin, vec3 direction, vec3 normal) {", "vec3 outColor = vec3(0.0);", "// Reflect/Refract ray entering the diamond", "const float n1 = 1.0;", "const float epsilon = 1e-4;", "float f0 = (2.4- n1)/(2.4 + n1);", "f0 *= f0;", "vec3 attenuationFactor = vec3(1.0);", "vec3 newDirection = refract(direction, normal, n1/n2);", "vec3 reflectedDirection = reflect(direction, normal);", "vec3 brdfReflected = BRDF_Specular_GGX_Environment(reflectedDirection, normal, vec3(f0), 0.0);", "vec3 brdfRefracted = BRDF_Specular_GGX_Environment(newDirection, -normal, vec3(f0), 0.0);", "attenuationFactor *= ( vec3(1.0) - brdfRefracted);", "outColor += SampleSpecularReflection(vec4(1.0), reflectedDirection ).rgb * brdfReflected;", "int count = 0;", "newDirection = (invModelMatrix * vec4(newDirection, 0.0)).xyz;", "newDirection = normalize(newDirection);", "origin = (invModelMatrix * vec4(origin, 1.0)).xyz;", "// ray bounces ", "for( int i=0; i<RAY_BOUNCES; i++) { ", "vec3 intersectedPos;", "intersectedPos = intersectSphere(origin + vec3(epsilon), newDirection);", "vec3 dist = intersectedPos - origin;", "vec3 d = normalize(intersectedPos - centreOffset);", "vec3 mappedNormal = textureCube( tCubeMapNormals, d ).xyz;", "mappedNormal = 2. * mappedNormal - 1.;", "mappedNormal.y += normalOffset;", "mappedNormal = normalize(mappedNormal);", "dist = (modelMatrix * vec4(dist, 1.)).xyz;", "float r = sqrt(dot(dist, dist));", "attenuationFactor *= exp(-r*Absorbption);", "// refract the ray at first intersection ", "vec3 oldOrigin = origin;", "origin = intersectedPos - normalize(intersectedPos - centreOffset) * distanceOffset;", "vec3 oldDir = newDirection;", "newDirection = refract(newDirection, mappedNormal, n2/n1);", "if( dot(newDirection, newDirection) == 0.0) { // Total Internal Reflection. Continue inside the diamond ", "newDirection = reflect(oldDir, mappedNormal);", "if(i == RAY_BOUNCES-1 ) //If the ray got trapped even after max iterations, simply sample along the outgoing refraction! ", "{", "vec3 brdfReflected = BRDF_Specular_GGX_Environment(-oldDir, mappedNormal, vec3(f0), 0.0);", "vec3 d1 = (modelMatrix * vec4(oldDir, 0.0)).xyz;", "outColor += SampleSpecularContribution(vec4(1.0), d1 ).rgb * colorCorrection * attenuationFactor * boostFactors * (vec3(1.0) - brdfReflected);", "//outColor = vec3(1.,0.,0.);", "//if(d1.y > 0.95) {", "//outColor += d1.y * vec3(1.,0.,0) * attenuationFactor * (vec3(1.0) - brdfReflected) * boostFactors;", "//}", "}", "} else { // Add the contribution from outgoing ray, and continue the reflected ray inside the diamond ", "vec3 brdfRefracted = BRDF_Specular_GGX_Environment(newDirection, -mappedNormal, vec3(f0), 0.0);", "// outgoing(refracted) ray's contribution ", "vec3 d1 = (modelMatrix * vec4(newDirection, 0.0)).xyz;", "vec3 colorG = SampleSpecularContribution(vec4(1.0), d1 ).rgb * ( vec3(1.0) - brdfRefracted);", "vec3 dir1 = refract(oldDir, mappedNormal, (n2+rIndexDelta)/n1);", "vec3 dir2 = refract(oldDir, mappedNormal, (n2-rIndexDelta)/n1);", "vec3 d2 = (modelMatrix * vec4(dir1, 0.0)).xyz;", "vec3 d3 = (modelMatrix * vec4(dir2, 0.0)).xyz;", "vec3 colorR = SampleSpecularContribution(vec4(1.0), d2 ).rgb * ( vec3(1.0) - brdfRefracted);", "vec3 colorB = SampleSpecularContribution(vec4(1.0), d3 ).rgb * ( vec3(1.0) - brdfRefracted);", "outColor += vec3(colorR.r, colorG.g, colorB.b) * colorCorrection * attenuationFactor * boostFactors;", "//outColor = oldDir;", "//new reflected ray inside the diamond ", "newDirection = reflect(oldDir, mappedNormal);", "vec3 brdfReflected = BRDF_Specular_GGX_Environment(newDirection, mappedNormal, vec3(f0), 0.0);", "attenuationFactor *= brdfReflected * boostFactors;", "count++;", "}", "}", "if(false)", "outColor = debugBounces(count);", "return outColor;", "}", "void main() {", "vec3 normalizedNormal = normalize(worldNormal);", "vec3 viewVector = normalize(vecPos - cameraPosition);", "vec3 color = traceRay(vecPos, viewVector, normalizedNormal);", "gl_FragColor = vec4(color.rgb,1.);", "#include <tonemapping_fragment>", "//#include <encodings_fragment>", "//gl_FragColor = textureCube(tCubeMapNormals, normalize(Normal));", "}"].join("\n"),
|
|
34
|
-
uniforms: {
|
|
35
|
-
tCubeMapNormals: {
|
|
36
|
-
type: "t",
|
|
37
|
-
value: null
|
|
38
|
-
},
|
|
39
|
-
envMap: {
|
|
40
|
-
type: "t",
|
|
41
|
-
value: null
|
|
42
|
-
},
|
|
43
|
-
envRefractionMap: {
|
|
44
|
-
type: "t",
|
|
45
|
-
value: null
|
|
46
|
-
},
|
|
47
|
-
sphereMap: {
|
|
48
|
-
type: "t",
|
|
49
|
-
value: null
|
|
50
|
-
},
|
|
51
|
-
envMapIntensity: {
|
|
52
|
-
type: "f",
|
|
53
|
-
value: 1
|
|
54
|
-
},
|
|
55
|
-
maxBounces: {
|
|
56
|
-
type: "i",
|
|
57
|
-
value: 1
|
|
58
|
-
},
|
|
59
|
-
tanAngleSqCone: {
|
|
60
|
-
type: "f",
|
|
61
|
-
value: 0
|
|
62
|
-
},
|
|
63
|
-
coneHeight: {
|
|
64
|
-
type: "f",
|
|
65
|
-
value: 0
|
|
66
|
-
},
|
|
67
|
-
bDebugBounces: {
|
|
68
|
-
type: "i",
|
|
69
|
-
value: !1
|
|
70
|
-
},
|
|
71
|
-
rIndexDelta: {
|
|
72
|
-
type: "f",
|
|
73
|
-
value: .012
|
|
74
|
-
},
|
|
75
|
-
n2: {
|
|
76
|
-
type: "f",
|
|
77
|
-
value: 2.4
|
|
78
|
-
},
|
|
79
|
-
radius: {
|
|
80
|
-
type: "f",
|
|
81
|
-
value: 1
|
|
82
|
-
},
|
|
83
|
-
normalOffset: {
|
|
84
|
-
type: "f",
|
|
85
|
-
value: 0
|
|
86
|
-
},
|
|
87
|
-
squashFactor: {
|
|
88
|
-
type: "f",
|
|
89
|
-
value: .98
|
|
90
|
-
},
|
|
91
|
-
distanceOffset: {
|
|
92
|
-
type: "f",
|
|
93
|
-
value: 0
|
|
94
|
-
},
|
|
95
|
-
geometryFactor: {
|
|
96
|
-
type: "f",
|
|
97
|
-
value: .28
|
|
98
|
-
},
|
|
99
|
-
Absorbption: {
|
|
100
|
-
type: "v3",
|
|
101
|
-
value: new THREE.Vector3(0, 0, 0)
|
|
102
|
-
},
|
|
103
|
-
colorCorrection: {
|
|
104
|
-
type: "v3",
|
|
105
|
-
value: new THREE.Vector3(1, 1, 1)
|
|
106
|
-
},
|
|
107
|
-
boostFactors: {
|
|
108
|
-
type: "v3",
|
|
109
|
-
value: new THREE.Vector3(.892, .892, .98595025)
|
|
110
|
-
},
|
|
111
|
-
centreOffset: {
|
|
112
|
-
type: "v3",
|
|
113
|
-
value: new THREE.Vector3(0, 0, 0)
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
side: THREE.DoubleSide
|
|
117
|
-
};
|
|
118
|
-
exports.diamondMaterial = new THREE.ShaderMaterial(exports.DiamondShader);
|
|
@@ -1,39 +0,0 @@
|
|
|
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
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");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.BreathLight = void 0;
|
|
19
|
-
var _three_0_125_2_three_1 = require("_three@0.125.2@three");
|
|
20
|
-
var BreathLight = /** @class */ (function (_super) {
|
|
21
|
-
__extends(BreathLight, _super);
|
|
22
|
-
function BreathLight() {
|
|
23
|
-
var _this = _super.call(this) || this;
|
|
24
|
-
var geometry = new _three_0_125_2_three_1.CircleBufferGeometry(1, 32);
|
|
25
|
-
geometry.rotateX(-Math.PI / 2);
|
|
26
|
-
var mat1 = new _three_0_125_2_three_1.MeshBasicMaterial({ color: 0x1f9ccf });
|
|
27
|
-
var mat2 = new _three_0_125_2_three_1.MeshBasicMaterial({ color: 0x1f9ccf, transparent: true, opacity: 0.7 });
|
|
28
|
-
var mat3 = new _three_0_125_2_three_1.MeshBasicMaterial({ color: 0x1f9ccf, transparent: true, opacity: 0.1 });
|
|
29
|
-
var mesh1 = new _three_0_125_2_three_1.Mesh(geometry, mat1);
|
|
30
|
-
var mesh2 = new _three_0_125_2_three_1.Mesh(geometry, mat2);
|
|
31
|
-
var mesh3 = new _three_0_125_2_three_1.Mesh(geometry, mat3);
|
|
32
|
-
mesh2.scale.set(2, 2, 2);
|
|
33
|
-
mesh3.scale.set(4, 4, 4);
|
|
34
|
-
_this.add(mesh1, mesh2, mesh3);
|
|
35
|
-
return _this;
|
|
36
|
-
}
|
|
37
|
-
return BreathLight;
|
|
38
|
-
}(_three_0_125_2_three_1.Object3D));
|
|
39
|
-
exports.BreathLight = BreathLight;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Vec3 } from '../math/Vec3';
|
|
2
|
-
import { IExtrudeOptions } from '../alg/extrude';
|
|
3
|
-
import { AxisPlane } from '../alg/trianglution';
|
|
4
|
-
import { BufferGeometry, IGeometry } from '../render/geometry';
|
|
5
|
-
import { ArrayList } from '../struct/data/ArrayList';
|
|
6
|
-
export declare function toGeometryBuffer(geo: IGeometry): BufferGeometry;
|
|
7
|
-
/**
|
|
8
|
-
* shape 挤压后转几何体
|
|
9
|
-
* @param {*} shape
|
|
10
|
-
* @param {*} arg_path
|
|
11
|
-
* @param {*} options
|
|
12
|
-
*/
|
|
13
|
-
export declare function extrudeToGeometryBuffer(shape: ArrayList<Vec3>, arg_path: Array<Vec3>, options: IExtrudeOptions): BufferGeometry;
|
|
14
|
-
/**
|
|
15
|
-
* 两个轮廓缝合
|
|
16
|
-
* @param {*} shape
|
|
17
|
-
* @param {*} arg_path
|
|
18
|
-
* @param {*} options
|
|
19
|
-
* @param {*} material
|
|
20
|
-
*/
|
|
21
|
-
export declare function linkToGeometry(shape: Array<Vec3>, shape1: Array<Vec3>, axisPlane?: AxisPlane, shapeClose?: boolean): BufferGeometry;
|
|
22
|
-
/**
|
|
23
|
-
* 多个轮廓缝合
|
|
24
|
-
* @param shapes
|
|
25
|
-
* @param isClose
|
|
26
|
-
* @param material
|
|
27
|
-
*/
|
|
28
|
-
export declare function linksToGeometry(shapes: Array<Vec3>[], pathClosed?: boolean, shapeClosed?: boolean): BufferGeometry;
|