three-base 2.0.112 → 2.0.114
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/PipeMesh/PipeMesh.d.ts +3 -1
- package/PipeMesh/PipeMesh.js +7 -5
- package/ThreeBase.js +2 -2
- package/package.json +1 -1
- package/threeLoader.js +1 -2
package/PipeMesh/PipeMesh.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { PathPointList } from "./PathPointList";
|
|
|
3
3
|
import { PathTubeGeometry } from "./PathTubeGeometry";
|
|
4
4
|
export type PipeMeshProps = {
|
|
5
5
|
vector3s: Array<Vector3>;
|
|
6
|
-
radius
|
|
6
|
+
radius?: number;
|
|
7
|
+
segments?: number;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* 创建基础的管道模型
|
|
@@ -13,6 +14,7 @@ export default class PipeMesh extends Mesh<PathTubeGeometry, Material> {
|
|
|
13
14
|
type: string;
|
|
14
15
|
vector3s: Array<Vector3>;
|
|
15
16
|
radius: number;
|
|
17
|
+
segments: number;
|
|
16
18
|
pathPointList: PathPointList;
|
|
17
19
|
material: Material;
|
|
18
20
|
set(props: PipeMeshProps): void;
|
package/PipeMesh/PipeMesh.js
CHANGED
|
@@ -16,8 +16,9 @@ export default class PipeMesh extends Mesh {
|
|
|
16
16
|
this.set(props);
|
|
17
17
|
}
|
|
18
18
|
type = "pipemesh";
|
|
19
|
-
vector3s = [];
|
|
20
|
-
radius = 1;
|
|
19
|
+
vector3s = []; // 管道上的点
|
|
20
|
+
radius = 1; //管道的半径
|
|
21
|
+
segments = 10; //管道的段数
|
|
21
22
|
pathPointList = new PathPointList();
|
|
22
23
|
material = new MeshLambertMaterial({
|
|
23
24
|
side: DoubleSide,
|
|
@@ -26,7 +27,8 @@ export default class PipeMesh extends Mesh {
|
|
|
26
27
|
// 设置数据
|
|
27
28
|
set(props) {
|
|
28
29
|
this.vector3s = props.vector3s;
|
|
29
|
-
this.radius = props.radius;
|
|
30
|
+
this.radius = props.radius || 1;
|
|
31
|
+
this.segments = props.segments || 10;
|
|
30
32
|
this.pathPointList.set(this.vector3s, props.radius * 2, 10);
|
|
31
33
|
this.geometry = new PathTubeGeometry({
|
|
32
34
|
pathPointList: this.pathPointList,
|
|
@@ -34,7 +36,7 @@ export default class PipeMesh extends Mesh {
|
|
|
34
36
|
arrow: true,
|
|
35
37
|
progress: 1,
|
|
36
38
|
radius: props.radius,
|
|
37
|
-
radialSegments:
|
|
39
|
+
radialSegments: this.segments,
|
|
38
40
|
},
|
|
39
41
|
usage: DynamicDrawUsage,
|
|
40
42
|
transparent: true,
|
|
@@ -43,7 +45,7 @@ export default class PipeMesh extends Mesh {
|
|
|
43
45
|
// 设置指定点的坐标
|
|
44
46
|
setVector(i, vector) {
|
|
45
47
|
this.vector3s[i].copy(vector);
|
|
46
|
-
this.pathPointList.set(this.vector3s, this.radius * 2,
|
|
48
|
+
this.pathPointList.set(this.vector3s, this.radius * 2, this.segments);
|
|
47
49
|
this.geometry.update(this.pathPointList, { radius: this.radius });
|
|
48
50
|
}
|
|
49
51
|
// 获取指定点的坐标
|
package/ThreeBase.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: xiaosihan
|
|
3
3
|
* @Date: 2021-12-20 13:38:22
|
|
4
4
|
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time:
|
|
5
|
+
* @Last Modified time: 2025-01-17 06:49:44
|
|
6
6
|
*/
|
|
7
7
|
import { round } from "lodash";
|
|
8
8
|
import { AxesHelper, Box3, DepthFormat, DepthTexture, EventDispatcher, GridHelper, LinearFilter, MOUSE, NoBlending, NormalBlending, OrthographicCamera, PerspectiveCamera, RGBAFormat, ReinhardToneMapping, SRGBColorSpace, Scene, TOUCH, UnsignedShortType, Vector2, Vector3, WebGLRenderTarget, WebGLRenderer, } from "three";
|
|
@@ -81,7 +81,7 @@ export default class ThreeBase extends EventDispatcher {
|
|
|
81
81
|
renderer = (() => {
|
|
82
82
|
const renderer = new WebGLRenderer({
|
|
83
83
|
alpha: true,
|
|
84
|
-
antialias:
|
|
84
|
+
antialias: true,
|
|
85
85
|
precision: "highp",
|
|
86
86
|
logarithmicDepthBuffer: true,
|
|
87
87
|
preserveDrawingBuffer: true,
|
package/package.json
CHANGED
package/threeLoader.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: xiaosihan
|
|
3
3
|
* @Date: 2022-04-07 16:42:26
|
|
4
4
|
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time:
|
|
5
|
+
* @Last Modified time: 2025-01-15 20:34:19
|
|
6
6
|
*/
|
|
7
7
|
import { CanvasTexture, DefaultLoadingManager, EventDispatcher, Mesh, MeshStandardMaterial, RepeatWrapping, SRGBColorSpace, TextureLoader, VideoTexture, } from "three";
|
|
8
8
|
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader";
|
|
@@ -435,7 +435,6 @@ class ThreeLoader extends EventDispatcher {
|
|
|
435
435
|
const plyNeedRotationX = await new Promise(async (resolve) => {
|
|
436
436
|
// 读取文件内容
|
|
437
437
|
const res = await axios.get(modelurl);
|
|
438
|
-
debugger;
|
|
439
438
|
// if (res.match(/\b(Blender|binary_little_endian)\b/)) {
|
|
440
439
|
// resolve(true);
|
|
441
440
|
// } else {
|