@eturnity/eturnity_3d 0.0.6 → 0.0.7
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
CHANGED
|
@@ -62,7 +62,7 @@ export default {
|
|
|
62
62
|
this.renderer.domElement.style.width = '100%'
|
|
63
63
|
this.renderer.domElement.style.height = '100%'
|
|
64
64
|
|
|
65
|
-
this.initialiseThree()
|
|
65
|
+
this.initialiseThree(false)
|
|
66
66
|
this.loadProjectionMaterial()
|
|
67
67
|
this.initialiseThreeMap()
|
|
68
68
|
await this.loadTextureFromModuleFields()
|
package/src/helper/threeMixin.js
CHANGED
|
@@ -20,50 +20,49 @@ export default {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
//add background_map
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
23
|
+
this.background_map=new THREE.Group();
|
|
24
|
+
//plane
|
|
25
|
+
let sizeInMm={width:2000000,height:2000000}
|
|
26
|
+
|
|
27
|
+
if(this.layoutSettings.background_map_settings && this.layoutSettings.background_map_settings.sizeInMm){
|
|
28
|
+
sizeInMm=this.layoutSettings.background_map_settings.sizeInMm
|
|
29
|
+
}
|
|
30
|
+
let planeGeometry = new THREE.PlaneGeometry(sizeInMm.height/1000, sizeInMm.width/1000)
|
|
31
|
+
let planeMaterial = new THREE.MeshBasicMaterial( {
|
|
32
|
+
color: 0xf0f0f0,
|
|
33
|
+
opacity: 1
|
|
34
|
+
})
|
|
35
|
+
this.meshes.backgroundMesh = new THREE.Mesh(planeGeometry, planeMaterial)
|
|
36
|
+
|
|
37
|
+
this.meshes.backgroundMesh.position.z=0.1
|
|
38
|
+
|
|
39
|
+
//helper grid
|
|
40
|
+
let helper = new THREE.GridHelper(2000, 100)
|
|
41
|
+
helper.material.opacity = 0.25
|
|
42
|
+
helper.material.transparent = true
|
|
43
|
+
helper.rotateX(-Math.PI / 2)
|
|
44
|
+
helper.position.z=-0.1
|
|
45
|
+
this.scene.add(helper)
|
|
46
|
+
this.background_map.add( this.meshes.backgroundMesh )
|
|
47
|
+
this.background_map.add( helper )
|
|
48
|
+
clearThreeObjects(helper)
|
|
49
|
+
helper=null
|
|
50
|
+
|
|
51
|
+
//Extention of the map with geo-map
|
|
52
|
+
if(this.selectedMapLayer && !['googleLayerRoadmap','googleLayer','googleLayerTerrain'].includes(this.selectedMapLayer.key)){
|
|
53
|
+
this.provider = new CustomProvider('',this.selectedMapLayer.key);
|
|
55
54
|
// Create the map view and add it to your THREE scene
|
|
56
55
|
this.three_map = new MapView(MapView.PLANAR, this.provider);
|
|
57
56
|
this.three_map.rotateX(Math.PI / 2)
|
|
58
57
|
const coef=Math.cos(this.layoutSettings.layout_latitude*Math.PI/180)
|
|
59
58
|
this.three_map.scale.set(2*20015111.9287618*coef, 1, 2*20015111.9287618*coef);
|
|
60
59
|
var coords = UnitsUtils.datumsToSpherical(this.layoutSettings.layout_latitude, this.layoutSettings.layout_longitude)
|
|
61
|
-
|
|
62
60
|
this.three_map.position.set(-coords.x*coef,-coords.y*coef,-0.1)
|
|
63
61
|
this.scene.add(this.three_map)
|
|
62
|
+
}else{
|
|
63
|
+
|
|
64
64
|
}
|
|
65
65
|
this.scene.add(this.background_map)
|
|
66
|
-
|
|
67
66
|
},
|
|
68
67
|
initSky() {
|
|
69
68
|
// Add Sky
|
|
@@ -90,7 +89,7 @@ export default {
|
|
|
90
89
|
uniforms['sunPosition'].value.copy(sun)
|
|
91
90
|
sun=null
|
|
92
91
|
},
|
|
93
|
-
initialiseThree() {
|
|
92
|
+
initialiseThree(isInteractive = true) {
|
|
94
93
|
|
|
95
94
|
//this.loader.crossOrigin = null
|
|
96
95
|
|
|
@@ -126,8 +125,10 @@ export default {
|
|
|
126
125
|
|
|
127
126
|
//sky
|
|
128
127
|
this.initSky()
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
if(isInteractive){
|
|
129
|
+
this.orbitControl=new OrbitControls(this.camera, this.renderer.domElement)
|
|
130
|
+
this.orbitControl.maxPolarAngle=Math.PI/2
|
|
131
|
+
}
|
|
131
132
|
window.addEventListener('resize', this.onWindowResize, false)
|
|
132
133
|
|
|
133
134
|
ambientLight.dispose()
|