@eturnity/eturnity_3d 6.30.0 → 6.31.1

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.
Files changed (39) hide show
  1. package/bitbucket-pipelines.yml +2 -2
  2. package/dist/assets/images/panels/longiSolarLR4_60HPH_350M.png +0 -0
  3. package/dist/assets/images/panels/longiSolarLR4_60HPH_370M.png +0 -0
  4. package/dist/assets/images/panels/reneSola_Virtus_2_JC320S_24_Bbw copy.png +0 -0
  5. package/dist/assets/images/panels/reneSola_Virtus_2_JC320S_24_Bbw.png +0 -0
  6. package/dist/assets/images/panels/uv.png +0 -0
  7. package/dist/assets/panels/longiSolarLR4_60HPH_350M.png +0 -0
  8. package/dist/assets/panels/longiSolarLR4_60HPH_370M.png +0 -0
  9. package/dist/assets/panels/reneSola_Virtus_2_JC320S_24_Bbw.png +0 -0
  10. package/dist/assets/panels/uv.png +0 -0
  11. package/dist/assets/theme.js +43 -0
  12. package/dist/assets/vue.svg +1 -0
  13. package/dist/css/main.d97599b7.css +1 -0
  14. package/dist/img/longiSolarLR4_60HPH_350M.85a84b2e.png +0 -0
  15. package/dist/img/longiSolarLR4_60HPH_370M.bf6b1f4e.png +0 -0
  16. package/dist/img/reneSola_Virtus_2_JC320S_24_Bbw.8b1892e0.png +0 -0
  17. package/dist/index.html +26 -0
  18. package/dist/main.js +60562 -0
  19. package/dist/main.js.map +1 -0
  20. package/dist/vite.svg +1 -0
  21. package/package.json +2 -2
  22. package/src/components/ThreeCanvasViewer.vue +6 -7
  23. package/src/helper/materialMixin.js +75 -0
  24. package/src/helper/materials.js +2 -1
  25. package/src/helper/render/background.js +2 -34
  26. package/src/helper/render/clear.js +2 -2
  27. package/src/helper/render/geometryHandler.js +50 -1
  28. package/src/helper/render/imageOverlay.js +126 -0
  29. package/src/helper/render/index.js +5 -1
  30. package/src/helper/render/loader.js +7 -62
  31. package/src/helper/render/mapProjection.js +86 -0
  32. package/src/helper/render/obstacle.js +2 -8
  33. package/src/helper/render/panel.js +2 -0
  34. package/src/helper/render/projectionMaterial.js +57 -0
  35. package/src/helper/render/roof.js +19 -8
  36. package/src/helper/render/texture.js +19 -0
  37. package/src/helper/renderMixin.js +46 -38
  38. package/src/store/hydrateData.js +10 -1
  39. package/src/store/three-d-module.js +9 -1
@@ -0,0 +1,57 @@
1
+ export default {
2
+ methods:{
3
+ reorderRoofMaterials(){
4
+ this.material.roof.sort((a,b)=>{
5
+ let aPrio=a.priority || 0
6
+ let bPrio=b.priority || 0
7
+ return aPrio-bPrio
8
+ })
9
+ },
10
+ async updateProjectionMaterials(){
11
+ this.setImageOverlayCameraPosition()
12
+ let materialPromises=[
13
+ this.getMapProjectionMaterial(),
14
+ this.getImageOverlayMaterial()
15
+ ]
16
+ let materials = await Promise.all(materialPromises)
17
+ this.mapProjectionMaterial = materials[0]
18
+ this.imageOverlayMaterial= materials[1]
19
+
20
+ let index=this.material.roof.findIndex(material=>material.userData.type=="mapProjectionMaterial")
21
+ if(this.mapProjectionMaterial){
22
+ if(index>=0){
23
+ this.material.roof[index]=this.mapProjectionMaterial
24
+ this.material.roof=[...this.material.roof]
25
+ }else{
26
+ this.material.roof=[...this.material.roof,this.mapProjectionMaterial]
27
+ this.reorderRoofMaterials()
28
+ }
29
+ }else if(index>=0){
30
+ this.material.roof[index].dispose()
31
+ this.material.roof.splice(index,1)
32
+ this.material.roof=[...this.material.roof]
33
+ this.reorderRoofMaterials()
34
+ }
35
+
36
+ index=this.material.roof.findIndex(material=> material.userData.type=="imageOverlayMaterial")
37
+ if(this.imageOverlayMaterial){
38
+ if(index>=0){
39
+ this.material.roof[index]=this.imageOverlayMaterial
40
+ this.material.roof=[...this.material.roof]
41
+ }else{
42
+ this.material.roof=[...this.material.roof,this.imageOverlayMaterial]
43
+ this.reorderRoofMaterials()
44
+ }
45
+ }else if(index>=0){
46
+ this.material.roof[index].dispose()
47
+ this.material.roof.splice(index,1)
48
+ this.material.roof=[...this.material.roof]
49
+ this.reorderRoofMaterials()
50
+ }
51
+ this.renderImageOverlayOnBackground()
52
+ this.applyTextureOnRoofs()
53
+ },
54
+
55
+
56
+ }
57
+ }
@@ -68,6 +68,19 @@ export default {
68
68
 
69
69
  return geometry
70
70
  },
71
+
72
+ applyTextureOnRoofs(){
73
+ this.roofs.forEach(roof=>{
74
+ //roofs
75
+ let mesh=this.meshes.roofMeshes[roof.id]
76
+ this.applyTextureOnMesh(this.material.roof,mesh)
77
+ //obstacle on roof
78
+ roof.holes.filter(p=>p.layer=="obstacle").forEach(obstacle=>{
79
+ let meshObstacle=this.meshes.obstacleMeshes[obstacle.id + '-' + roof.id + '_top']
80
+ this.applyTextureOnMesh(this.material.roof,meshObstacle)
81
+ })
82
+ })
83
+ },
71
84
  renderRoofs() {
72
85
  this.clearRemovedOnes('roofMeshes')
73
86
  this.roofs.forEach((roofPolygon) => {
@@ -82,17 +95,18 @@ export default {
82
95
  mesh = this.meshes.roofMeshes[roofPolygon.id]
83
96
  geometry = mesh.geometry
84
97
  geometry = this.updateRoofGeometry(geometry, roofPolygon)
98
+ //in order to be able to render multiple material on it (background and image overlay)
99
+
85
100
  mesh.geometry = geometry
86
- if(this.material.roof){
87
- mesh.material=this.material.roof
88
- if(this.material.roof && this.material.roof.project) this.material.roof.project(mesh)
89
- }
101
+ this.applyTextureOnMesh(this.material.roof,mesh)
102
+
90
103
  mesh.frustumCulled = false
91
104
  mesh.updateMatrix()
92
105
  }
93
106
  if (!this.meshes.roofMeshes[roofPolygon.id]) {
94
107
  //create
95
108
  geometry = this.createRoofGeometry(roofPolygon)
109
+
96
110
  if (geometry) {
97
111
  mesh = new THREE.Mesh(geometry, this.material.roof)
98
112
  mesh.userData.version = roofPolygon.version
@@ -101,10 +115,7 @@ export default {
101
115
  mesh.userData.polygonId = roofPolygon.id
102
116
  mesh.matrixAutoUpdate = false
103
117
  this.scene.add(mesh)
104
- if(this.material.roof){
105
- mesh.material=this.material.roof
106
- if(this.material.roof.project) this.material.roof.project(mesh)
107
- }
118
+ this.applyTextureOnMesh(this.material.roof,mesh)
108
119
  mesh.frustumCulled = false
109
120
  this.meshes.roofMeshes[roofPolygon.id] = mesh
110
121
  }
@@ -0,0 +1,19 @@
1
+ export default {
2
+ methods:{
3
+ applyTextureOnMesh(materials,mesh){
4
+ if(materials && materials.length>0){
5
+ let geometry=mesh.geometry
6
+ geometry.clearGroups();
7
+ for(let k=0;k<materials.length;k++){
8
+ geometry.addGroup( 0, Infinity, k )
9
+ }
10
+ mesh.material=materials
11
+ for(let m=0;m<materials.length;m++){
12
+ if(materials[m].project) {
13
+ materials[m].project(mesh)
14
+ }
15
+ }
16
+ }
17
+ },
18
+ }
19
+ }
@@ -36,10 +36,6 @@ export default {
36
36
  roofMarginMeshes: {},
37
37
  moduleFieldsMeshes: {}
38
38
  }
39
- if (this.wallColor) {
40
- let wallColor = new THREE.Color(this.wallColor)
41
- this.material.wall.color.set(wallColor)
42
- }
43
39
  },
44
40
 
45
41
  computed: {
@@ -48,7 +44,9 @@ export default {
48
44
  state.threeDModule.moduleTextureVersionId,
49
45
  wallColor: (state) => state.threeDModule.wallColor,
50
46
  selectedMapLayer: (state) => state.threeDModule.selectedMapLayer,
47
+ panelOpacity: (state) => state.threeDModule.panelOpacity,
51
48
  pvDataMemo: (state) => state.threeDModule.pvDataMemo
49
+
52
50
  }),
53
51
  ...mapGetters({
54
52
  selectedTool: 'getSelectedTool',
@@ -148,6 +146,7 @@ export default {
148
146
  case 'newModuleField':
149
147
  case 'reactivatePanel':
150
148
  case 'deactivatePanels': //params.panels
149
+ case 'changePanelOpacity':
151
150
  methodList.push({
152
151
  name: 'renderPanels',
153
152
  method: this.renderPanels,
@@ -203,9 +202,41 @@ export default {
203
202
  method: this.initialiseThreeMap,
204
203
  arg: []
205
204
  })
205
+ break
206
+ case 'changeMapProjection':
207
+ methodList.push({
208
+ name: 'changeMapProjection',
209
+ method: this.changeMapProjection,
210
+ arg: []
211
+ })
212
+ methodList.push({
213
+ name: 'applyTextureOnRoofs',
214
+ method: this.applyTextureOnRoofs,
215
+ arg: []
216
+ })
217
+ break
218
+ // methodList.push({
219
+ // name: 'removeImageOverlay',
220
+ // method: this.removeImageOverlay,
221
+ // arg: []
222
+ // })
223
+ // methodList.push({
224
+ // name: 'applyTextureOnBackground',
225
+ // method: this.renderImageOverlayOnBackground,
226
+ // arg: []
227
+ // })
228
+ // methodList.push({
229
+ // name: 'applyTextureOnRoofs',
230
+ // method: this.applyTextureOnRoofs,
231
+ // arg: []
232
+ // })
233
+ // break
234
+ case 'removeImageOverlay':
235
+ case 'changeImageOverlay':
236
+ case 'updateImageOverlay':
206
237
  methodList.push({
207
- name: 'updateProjectionMaterial',
208
- method: this.updateProjectionMaterial,
238
+ name: 'updateProjectionMaterials()',
239
+ method: this.updateProjectionMaterials,
209
240
  arg: []
210
241
  })
211
242
  break
@@ -225,11 +256,11 @@ export default {
225
256
  }
226
257
  },
227
258
  renderGeometry() {
228
- this.renderBackground()
229
259
  this.renderBuilding()
230
260
  this.renderModuleFields()
231
261
  this.renderPanels()
232
262
  this.renderRoofsMargin()
263
+ this.updateProjectionMaterials()
233
264
  },
234
265
  renderBuilding() {
235
266
  this.renderBase()
@@ -239,32 +270,10 @@ export default {
239
270
  this.renderEdges()
240
271
  this.renderFlatRoofs()
241
272
  },
242
-
243
- applyTextureOnRoofs() {
244
- this.roofs.forEach((roof) => {
245
- //roofs
246
- let mesh = this.meshes.roofMeshes[roof.id]
247
- mesh.material = this.material.roof
248
- if (this.material.roof && this.material.roof.project) {
249
- this.material.roof.project(mesh)
250
- }
251
- //obstacle on roof
252
- roof.holes
253
- .filter((p) => p.layer == 'obstacle')
254
- .forEach((obstacle) => {
255
- let meshObstacle =
256
- this.meshes.obstacleMeshes[obstacle.id + '-' + roof.id + '_top']
257
- meshObstacle.material = this.material.roof
258
- if (this.material.roof && this.material.roof.project)
259
- this.material.roof.project(meshObstacle)
260
- })
261
- })
262
- },
263
-
264
- async updateProjectionMaterial() {
265
- await this.loadProjectionMaterial()
273
+
274
+ async initializeProjectionMaterial(){
275
+ await this.updateProjectionMaterials()
266
276
  this.applyTextureOnRoofs()
267
- this.renderBackground()
268
277
  },
269
278
 
270
279
  getCanvasOffset() {
@@ -317,13 +326,9 @@ export default {
317
326
  }
318
327
  },
319
328
  watch: {
320
- wallColor(color) {
321
- let wallColor = new THREE.Color(color)
322
- this.material.wall.color.set(wallColor)
323
- },
324
329
  pvDataMemo: {
325
330
  handler(val) {
326
- this.loadNewTexture()
331
+ this.loadNewPanelTextures()
327
332
  }
328
333
  },
329
334
  'material.panel': {
@@ -357,7 +362,10 @@ export default {
357
362
  this.scene = null
358
363
  this.camera = null
359
364
  this.cameraprojection = null
360
- this.material.forEach((m) => m.dispose())
365
+ Object.values(this.material).forEach((m) =>{
366
+ if(m && m.dispose)
367
+ m.dispose()
368
+ } )
361
369
  this.material = null
362
370
  this.orbitControl = null
363
371
  this.raycaster = null
@@ -15,6 +15,7 @@ export async function hydrateData({ state, commit }, data) {
15
15
  let obstaclesResponse = data.obstacles
16
16
  let moduleFieldsResponse = data.moduleFields
17
17
  const layoutSettingResponse = data.layoutSettings
18
+ const imageOverlayResponse = data.imageOverlay
18
19
  //removing empty roof,obstacle and modulefield generated by BE on variant creation
19
20
  roofsResponse=roofsResponse.reduce((acc,cur)=>{
20
21
  if(cur.roof_outline.length>0){acc.push(cur)}
@@ -29,9 +30,17 @@ export async function hydrateData({ state, commit }, data) {
29
30
  return acc
30
31
  },[])
31
32
 
33
+ if (imageOverlayResponse && imageOverlayResponse.image_overlay_url) {
34
+ let imageOverlay = {
35
+ url: imageOverlayResponse.image_overlay_url,
36
+ uuid: imageOverlayResponse.image_overlay_uuid,
37
+ corners: imageOverlayResponse.image_overlay_settings.corners
38
+ }
39
+ commit('mutate_imageOverlay', imageOverlay)
40
+ }
41
+
32
42
  if (!!layoutSettingResponse) {
33
43
  const layoutSetting = layoutSettingResponse
34
- console.log(layoutSetting)
35
44
  const moduleTextureVersionId=layoutSetting.module_texture_version_id || 0
36
45
  commit('mutate_layoutSettings', layoutSetting)
37
46
  commit('mutate_moduleTextureVersionId',moduleTextureVersionId)
@@ -19,6 +19,7 @@ const init_state = {
19
19
  cancelTokenGlobal: '',
20
20
  globalProjectProperties: [],
21
21
  buildingLocation: null,
22
+ imageOverlay:null,
22
23
  layoutSettings: {
23
24
  base64_image_url: null,
24
25
  layout_latitude: null,
@@ -32,8 +33,10 @@ const init_state = {
32
33
  mountingDataMemo:[],
33
34
  moduleTextureVersionId:0,
34
35
  wallColor:'#454545',
36
+ panelOpacity:1,
35
37
  selectedMapLayer:null,
36
38
  globalProjectProperties: [],
39
+ imageOverlay:null
37
40
  }
38
41
 
39
42
  const state = init_state
@@ -86,7 +89,9 @@ const getters = {
86
89
  getBuildingLocation(state) {
87
90
  return state.buildingLocation
88
91
  },
89
-
92
+ getImageOverlay(state){
93
+ return state.imageOverlay
94
+ },
90
95
  getLayoutSettings(state) {
91
96
  return state.layoutSettings
92
97
  },
@@ -115,6 +120,9 @@ const mutations = {
115
120
  mutate_layoutSettings(state, value) {
116
121
  state.layoutSettings = value
117
122
  },
123
+ mutate_imageOverlay(state, value) {
124
+ state.imageOverlay = value
125
+ },
118
126
  mutate_selectedZoom(state, value) {
119
127
  state.selectedZoom = value
120
128
  },