@eturnity/eturnity_3d 6.31.1 → 6.31.2
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/package.json +1 -1
- package/src/config.js +1 -1
- package/src/helper/render/edge.js +42 -56
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -65,7 +65,7 @@ export const maxMargin=2500
|
|
|
65
65
|
export const node3DRadius=0.05
|
|
66
66
|
export const beamColor="#ffffff"
|
|
67
67
|
export const node3DColor="white"
|
|
68
|
-
export const beamOpacity=0.
|
|
68
|
+
export const beamOpacity=0.4
|
|
69
69
|
export const node3dOpacity=0.3
|
|
70
70
|
export const dimMarginColor='#ff000020'
|
|
71
71
|
export const defaultTextureUrl=require('./assets/images/panels/reneSola_Virtus_2_JC320S_24_Bbw.png')
|
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
2
|
export default {
|
|
3
3
|
methods:{
|
|
4
|
+
setCylinderPosition(cylinder,edge){
|
|
5
|
+
const point_0 = new THREE.Vector3(
|
|
6
|
+
edge.outline[0].x / 1000,
|
|
7
|
+
edge.outline[0].y / 1000,
|
|
8
|
+
edge.outline[0].z / 1000
|
|
9
|
+
)
|
|
10
|
+
const point_1 = new THREE.Vector3(
|
|
11
|
+
edge.outline[1].x / 1000,
|
|
12
|
+
edge.outline[1].y / 1000,
|
|
13
|
+
edge.outline[1].z / 1000
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
const midPoint = point_0.clone().add(point_1).multiplyScalar(0.5)
|
|
17
|
+
var direction = new THREE.Vector3().subVectors(point_1, point_0)
|
|
18
|
+
let length = direction.length()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
//cylinder.rotation.set(arrow.rotation)
|
|
25
|
+
var axis = new THREE.Vector3(0, 1, 0)
|
|
26
|
+
cylinder.quaternion.setFromUnitVectors(
|
|
27
|
+
axis,
|
|
28
|
+
direction.clone().normalize()
|
|
29
|
+
)
|
|
30
|
+
//cylinder.position.set(new THREE.Vector3().addVectors( pointX, direction.multiplyScalar(0.5) ))
|
|
31
|
+
cylinder.position.copy(midPoint.clone())
|
|
32
|
+
let oldLength = cylinder.userData.cylinderLength
|
|
33
|
+
let newLength = length
|
|
34
|
+
if (!oldLength || oldLength != 0) {
|
|
35
|
+
cylinder.scale.set(1, newLength, 1)
|
|
36
|
+
cylinder.userData.cylinderLength = newLength
|
|
37
|
+
}
|
|
38
|
+
cylinder.updateMatrix()
|
|
39
|
+
return cylinder
|
|
40
|
+
},
|
|
4
41
|
renderEdges() {
|
|
5
42
|
this.clearEdgesRemovedOnes('edgeMeshes')
|
|
6
43
|
let cylinder
|
|
@@ -14,67 +51,16 @@ export default {
|
|
|
14
51
|
cylinder = this.meshes.edgeMeshes[edge.id]
|
|
15
52
|
if (cylinder) {
|
|
16
53
|
//update
|
|
17
|
-
|
|
18
|
-
edge.outline[0].x / 1000,
|
|
19
|
-
edge.outline[0].y / 1000,
|
|
20
|
-
edge.outline[0].z / 1000
|
|
21
|
-
)
|
|
22
|
-
const point_1 = new THREE.Vector3(
|
|
23
|
-
edge.outline[1].x / 1000,
|
|
24
|
-
edge.outline[1].y / 1000,
|
|
25
|
-
edge.outline[1].z / 1000
|
|
26
|
-
)
|
|
27
|
-
const midPoint = point_0.clone().add(point_1).multiplyScalar(0.5)
|
|
28
|
-
var direction = new THREE.Vector3().subVectors(point_1, point_0)
|
|
29
|
-
let length = direction.length()
|
|
30
|
-
//cylinder.rotation.set(arrow.rotation)
|
|
31
|
-
var axis = new THREE.Vector3(0, 1, 0)
|
|
32
|
-
cylinder.quaternion.setFromUnitVectors(
|
|
33
|
-
axis,
|
|
34
|
-
direction.clone().normalize()
|
|
35
|
-
)
|
|
36
|
-
//cylinder.position.set(new THREE.Vector3().addVectors( pointX, direction.multiplyScalar(0.5) ))
|
|
37
|
-
cylinder.position.copy(midPoint.clone())
|
|
38
|
-
let oldLength = cylinder.userData.cylinderLength
|
|
39
|
-
let newLength = length
|
|
40
|
-
if (oldLength != 0) {
|
|
41
|
-
let scaleRatio = newLength / oldLength
|
|
42
|
-
//let scaleVector=direction.multiplyScalar(scaleRatio-1)
|
|
43
|
-
cylinder.scale.set(1, newLength, 1)
|
|
44
|
-
cylinder.userData.cylinderLength = newLength
|
|
45
|
-
}
|
|
46
|
-
cylinder.updateMatrix()
|
|
54
|
+
this.setCylinderPosition(cylinder,edge)
|
|
47
55
|
//change cylinder length
|
|
48
56
|
} else {
|
|
49
|
-
|
|
50
|
-
edge.outline[0].x / 1000,
|
|
51
|
-
edge.outline[0].y / 1000,
|
|
52
|
-
edge.outline[0].z / 1000
|
|
53
|
-
)
|
|
54
|
-
const point_1 = new THREE.Vector3(
|
|
55
|
-
edge.outline[1].x / 1000,
|
|
56
|
-
edge.outline[1].y / 1000,
|
|
57
|
-
edge.outline[1].z / 1000
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
const midPoint = point_0.clone().add(point_1).multiplyScalar(0.5)
|
|
61
|
-
var direction = new THREE.Vector3().subVectors(point_1, point_0)
|
|
62
|
-
let length = direction.length()
|
|
57
|
+
|
|
63
58
|
const geometry = new THREE.CylinderGeometry(0.1, 0.1, 1, 6)
|
|
64
59
|
cylinder = new THREE.Mesh(geometry, material)
|
|
65
|
-
cylinder.
|
|
66
|
-
|
|
67
|
-
//cylinder.rotation.set(arrow.rotation)
|
|
68
|
-
var axis = new THREE.Vector3(0, 1, 0)
|
|
69
|
-
cylinder.quaternion.setFromUnitVectors(
|
|
70
|
-
axis,
|
|
71
|
-
direction.clone().normalize()
|
|
72
|
-
)
|
|
73
|
-
//cylinder.position.set(new THREE.Vector3().addVectors( pointX, direction.multiplyScalar(0.5) ))
|
|
74
|
-
cylinder.position.copy(midPoint.clone())
|
|
75
|
-
//cylinder.position.set(edge.outline[0].x/1000, edge.outline[0].y/1000, edge.outline[0].z/1000);
|
|
60
|
+
cylinder=this.setCylinderPosition(cylinder,edge)
|
|
61
|
+
|
|
76
62
|
cylinder.userData.edgeId = edge.id
|
|
77
|
-
|
|
63
|
+
|
|
78
64
|
this.meshes.edgeMeshes[edge.id] = cylinder
|
|
79
65
|
this.scene.add(cylinder)
|
|
80
66
|
|