kitchen-simulator 5.0.0-test.4 → 5.0.0-test.5

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 (406) hide show
  1. package/package.json +1 -2
  2. package/src/@history.js +0 -3
  3. package/src/AppContext.js +0 -5
  4. package/src/KitchenConfigurator.jsx +0 -1517
  5. package/src/KitchenConfiguratorApp.jsx +0 -443
  6. package/src/actions/area-actions.js +0 -15
  7. package/src/actions/export.js +0 -38
  8. package/src/actions/groups-actions.js +0 -102
  9. package/src/actions/holes-actions.js +0 -152
  10. package/src/actions/items-actions.js +0 -393
  11. package/src/actions/lines-actions.js +0 -103
  12. package/src/actions/project-actions.js +0 -391
  13. package/src/actions/scene-actions.js +0 -44
  14. package/src/actions/user-actions.js +0 -75
  15. package/src/actions/vertices-actions.js +0 -34
  16. package/src/actions/viewer2d-actions.js +0 -79
  17. package/src/actions/viewer3d-actions.js +0 -32
  18. package/src/catalog/areas/area/planner-element.jsx +0 -43
  19. package/src/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
  20. package/src/catalog/areas/area/textures/grass.jpg +0 -0
  21. package/src/catalog/areas/area/textures/parquet.jpg +0 -0
  22. package/src/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
  23. package/src/catalog/areas/area/textures/tile1.jpg +0 -0
  24. package/src/catalog/back.png +0 -0
  25. package/src/catalog/catalog.js +0 -258
  26. package/src/catalog/doors.png +0 -0
  27. package/src/catalog/doorways.png +0 -0
  28. package/src/catalog/envMap/nx.hdr +0 -0
  29. package/src/catalog/envMap/ny.hdr +0 -0
  30. package/src/catalog/envMap/nz.hdr +0 -0
  31. package/src/catalog/envMap/px.hdr +0 -0
  32. package/src/catalog/envMap/py.hdr +0 -0
  33. package/src/catalog/envMap/pz.hdr +0 -0
  34. package/src/catalog/factories/area-factory-3d.js +0 -252
  35. package/src/catalog/factories/area-factory.jsx +0 -102
  36. package/src/catalog/factories/export.js +0 -9
  37. package/src/catalog/factories/wall-factory-3d.js +0 -296
  38. package/src/catalog/factories/wall-factory.jsx +0 -321
  39. package/src/catalog/holes/door-closet/planner-element.jsx +0 -251
  40. package/src/catalog/holes/door-double/door_double.png +0 -0
  41. package/src/catalog/holes/door-double/planner-element.jsx +0 -391
  42. package/src/catalog/holes/door-exterior/planner-element.jsx +0 -245
  43. package/src/catalog/holes/door-interior/planner-element.jsx +0 -256
  44. package/src/catalog/holes/door-panic/panicDoor.png +0 -0
  45. package/src/catalog/holes/door-panic/planner-element.jsx +0 -594
  46. package/src/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  47. package/src/catalog/holes/door-panic-double/planner-element.jsx +0 -574
  48. package/src/catalog/holes/door-sliding/planner-element.jsx +0 -256
  49. package/src/catalog/holes/doorway-framed/planner-element.jsx +0 -169
  50. package/src/catalog/holes/doorway-frameless/planner-element.jsx +0 -116
  51. package/src/catalog/holes/gate/gate.jpg +0 -0
  52. package/src/catalog/holes/window-clear/planner-element.jsx +0 -181
  53. package/src/catalog/holes/window-clear/texture.png +0 -0
  54. package/src/catalog/holes/window-cross/planner-element.jsx +0 -180
  55. package/src/catalog/holes/window-cross/texture.png +0 -0
  56. package/src/catalog/holes/window-double-hung/planner-element.jsx +0 -366
  57. package/src/catalog/holes/window-double-hung/texture.png +0 -0
  58. package/src/catalog/holes/window-vertical/planner-element.jsx +0 -290
  59. package/src/catalog/holes/window-vertical/texture.png +0 -0
  60. package/src/catalog/lines/wall/planner-element.jsx +0 -73
  61. package/src/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
  62. package/src/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
  63. package/src/catalog/lines/wall/textures/bricks.jpg +0 -0
  64. package/src/catalog/lines/wall/textures/bricks2.jpg +0 -0
  65. package/src/catalog/lines/wall/textures/bricks3.jpg +0 -0
  66. package/src/catalog/lines/wall/textures/morden-normal.jpg +0 -0
  67. package/src/catalog/lines/wall/textures/morden.jpg +0 -0
  68. package/src/catalog/lines/wall/textures/painted-normal.jpg +0 -0
  69. package/src/catalog/lines/wall/textures/painted.jpg +0 -0
  70. package/src/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
  71. package/src/catalog/lines/wall/textures/plaster.jpg +0 -0
  72. package/src/catalog/lines/wall/wall.png +0 -0
  73. package/src/catalog/molding/molding-dcm/planner-element.jsx +0 -35
  74. package/src/catalog/molding/molding-dcm/texture.png +0 -0
  75. package/src/catalog/molding/molding-fbm/planner-element.jsx +0 -35
  76. package/src/catalog/molding/molding-fbm/texture.png +0 -0
  77. package/src/catalog/molding/molding-lrm/planner-element.jsx +0 -35
  78. package/src/catalog/molding/molding-lrm/texture.png +0 -0
  79. package/src/catalog/properties/export.js +0 -33
  80. package/src/catalog/properties/property-checkbox.jsx +0 -123
  81. package/src/catalog/properties/property-color.jsx +0 -52
  82. package/src/catalog/properties/property-enum.jsx +0 -87
  83. package/src/catalog/properties/property-hidden.jsx +0 -22
  84. package/src/catalog/properties/property-lenght-measure.jsx +0 -113
  85. package/src/catalog/properties/property-length-measure.jsx +0 -129
  86. package/src/catalog/properties/property-length-measure_hole.jsx +0 -110
  87. package/src/catalog/properties/property-number.jsx +0 -63
  88. package/src/catalog/properties/property-read-only.jsx +0 -37
  89. package/src/catalog/properties/property-string.jsx +0 -59
  90. package/src/catalog/properties/property-toggle.jsx +0 -51
  91. package/src/catalog/properties/shared-property-style.js +0 -13
  92. package/src/catalog/utils/FuseUtils.js +0 -61
  93. package/src/catalog/utils/exporter.js +0 -173
  94. package/src/catalog/utils/geom-utils.js +0 -301
  95. package/src/catalog/utils/item-loader.jsx +0 -2122
  96. package/src/catalog/utils/load-obj.js +0 -113
  97. package/src/catalog/utils/mtl-loader.js +0 -462
  98. package/src/catalog/utils/obj-loader.js +0 -544
  99. package/src/catalog/windows.png +0 -0
  100. package/src/class/FuseUtils.js +0 -61
  101. package/src/class/area.js +0 -159
  102. package/src/class/export.js +0 -37
  103. package/src/class/group.js +0 -565
  104. package/src/class/guide.js +0 -44
  105. package/src/class/hole.js +0 -1359
  106. package/src/class/item.js +0 -2050
  107. package/src/class/layer.js +0 -926
  108. package/src/class/line.js +0 -1780
  109. package/src/class/project.js +0 -875
  110. package/src/class/vertex.js +0 -409
  111. package/src/components/atoms/Snackbar/index.jsx +0 -43
  112. package/src/components/atoms/radio-button/index.jsx +0 -20
  113. package/src/components/atoms/radio-button/styles.js +0 -56
  114. package/src/components/button/MainButton.jsx +0 -157
  115. package/src/components/button/ToggleMeasureButton.jsx +0 -65
  116. package/src/components/catalog-view/catalog-breadcrumb.jsx +0 -53
  117. package/src/components/catalog-view/catalog-item.jsx +0 -229
  118. package/src/components/catalog-view/catalog-list.jsx +0 -173
  119. package/src/components/catalog-view/catalog-page-item.jsx +0 -110
  120. package/src/components/catalog-view/catalog-turn-back-page-item.jsx +0 -80
  121. package/src/components/configurator/custom-configurator.jsx +0 -77
  122. package/src/components/configurator/project-configurator.jsx +0 -120
  123. package/src/components/content.jsx +0 -136
  124. package/src/components/export.js +0 -36
  125. package/src/components/firstsetting/button/styles.js +0 -223
  126. package/src/components/firstsetting/export.js +0 -9
  127. package/src/components/firstsetting/firstsetting-content-button.jsx +0 -198
  128. package/src/components/firstsetting/firstsetting-toggle-button.jsx +0 -101
  129. package/src/components/firstsetting/firstsetting.jsx +0 -814
  130. package/src/components/footerbar/button/ControlButton.jsx +0 -43
  131. package/src/components/footerbar/button/DirectionButton.jsx +0 -54
  132. package/src/components/footerbar/button/DirectionPanSpinButton.jsx +0 -36
  133. package/src/components/footerbar/button/ToggleButton.jsx +0 -58
  134. package/src/components/footerbar/button/ToggleConvertButton.jsx +0 -48
  135. package/src/components/footerbar/button/ToggleMeasureButton.jsx +0 -33
  136. package/src/components/footerbar/button/styles.js +0 -217
  137. package/src/components/footerbar/export.js +0 -9
  138. package/src/components/footerbar/footer-content-button.jsx +0 -198
  139. package/src/components/footerbar/footer-toggle-button.jsx +0 -101
  140. package/src/components/footerbar/footerbar.jsx +0 -1103
  141. package/src/components/footerbar/styles.js +0 -263
  142. package/src/components/header/button/MenuButton.jsx +0 -46
  143. package/src/components/header/button/SaveButton.jsx +0 -54
  144. package/src/components/header/button/styles.js +0 -181
  145. package/src/components/header/export.js +0 -5
  146. package/src/components/header/header.jsx +0 -631
  147. package/src/components/header/header.style.css +0 -47
  148. package/src/components/header/styles.js +0 -320
  149. package/src/components/login/Login.js +0 -77
  150. package/src/components/login/LoginForm/index.js +0 -108
  151. package/src/components/login/Register.js +0 -83
  152. package/src/components/login/RegisterForm/index.js +0 -171
  153. package/src/components/login/jwtService.js +0 -201
  154. package/src/components/login/style.css +0 -158
  155. package/src/components/login/style.scss +0 -260
  156. package/src/components/molecules/slider/index.jsx +0 -15
  157. package/src/components/molecules/slider/styles.js +0 -0
  158. package/src/components/molecules/slider/styles.scss +0 -3
  159. package/src/components/myprojects/export.js +0 -5
  160. package/src/components/myprojects/index.jsx +0 -445
  161. package/src/components/myprojects/styles.js +0 -241
  162. package/src/components/sidebar/custom-accordion.jsx +0 -48
  163. package/src/components/sidebar/export.js +0 -15
  164. package/src/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.jsx +0 -73
  165. package/src/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.jsx +0 -101
  166. package/src/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.jsx +0 -149
  167. package/src/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.jsx +0 -316
  168. package/src/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.jsx +0 -108
  169. package/src/components/sidebar/panel-element-editor/element-editor.jsx +0 -1070
  170. package/src/components/sidebar/panel-element-editor/multi-elements-editor.jsx +0 -0
  171. package/src/components/sidebar/panel-element-editor/panel-element-editor.jsx +0 -104
  172. package/src/components/sidebar/panel-element-editor/panel-multi-elements-editor.jsx +0 -155
  173. package/src/components/sidebar/panel-group-editor.jsx +0 -272
  174. package/src/components/sidebar/panel-groups.jsx +0 -310
  175. package/src/components/sidebar/panel-guides.jsx +0 -192
  176. package/src/components/sidebar/panel-layer-elements.jsx +0 -298
  177. package/src/components/sidebar/panel-layers.jsx +0 -381
  178. package/src/components/sidebar/panel.jsx +0 -71
  179. package/src/components/sidebar/sidebar.jsx +0 -106
  180. package/src/components/sidebar/toolbar-panel.jsx +0 -139
  181. package/src/components/sign/export.js +0 -7
  182. package/src/components/sign/main/index.jsx +0 -523
  183. package/src/components/sign/main/styles.js +0 -163
  184. package/src/components/style/button.jsx +0 -95
  185. package/src/components/style/cancel-button.jsx +0 -20
  186. package/src/components/style/content-container.jsx +0 -29
  187. package/src/components/style/content-title.jsx +0 -20
  188. package/src/components/style/delete-button.jsx +0 -23
  189. package/src/components/style/export.jsx +0 -48
  190. package/src/components/style/form-block.jsx +0 -13
  191. package/src/components/style/form-color-input.jsx +0 -27
  192. package/src/components/style/form-label.jsx +0 -15
  193. package/src/components/style/form-number-input.jsx +0 -196
  194. package/src/components/style/form-number-input_2.jsx +0 -191
  195. package/src/components/style/form-select.jsx +0 -38
  196. package/src/components/style/form-slider.jsx +0 -36
  197. package/src/components/style/form-submit-button.jsx +0 -23
  198. package/src/components/style/form-text-input.jsx +0 -65
  199. package/src/components/toolbar/button/ControlButton.jsx +0 -41
  200. package/src/components/toolbar/button/DirectionButton.jsx +0 -34
  201. package/src/components/toolbar/button/RightButton.jsx +0 -103
  202. package/src/components/toolbar/button/ToggleButton.jsx +0 -41
  203. package/src/components/toolbar/button/index.jsx +0 -55
  204. package/src/components/toolbar/button/styles.js +0 -127
  205. package/src/components/toolbar/components/DoorStyleMenu.jsx +0 -103
  206. package/src/components/toolbar/components/Pricing.jsx +0 -126
  207. package/src/components/toolbar/components/ReviewForQuote.jsx +0 -635
  208. package/src/components/toolbar/export.js +0 -21
  209. package/src/components/toolbar/main/Alert.js +0 -122
  210. package/src/components/toolbar/main/TakePictureModal.jsx +0 -104
  211. package/src/components/toolbar/main/confirm-popup.jsx +0 -99
  212. package/src/components/toolbar/main/index.jsx +0 -5687
  213. package/src/components/toolbar/main/lShaped.json +0 -311
  214. package/src/components/toolbar/main/longNarrow.json +0 -238
  215. package/src/components/toolbar/main/myComponents.js +0 -123
  216. package/src/components/toolbar/main/oRectangle.json +0 -220
  217. package/src/components/toolbar/main/rectangle.json +0 -238
  218. package/src/components/toolbar/main/style.css +0 -107
  219. package/src/components/toolbar/main/styles.js +0 -696
  220. package/src/components/toolbar/plugin-item.jsx +0 -123
  221. package/src/components/toolbar/popup/appliance/appliance-category/index.jsx +0 -73
  222. package/src/components/toolbar/popup/appliance/choose-appliance/index.jsx +0 -102
  223. package/src/components/toolbar/popup/appliance/index.jsx +0 -83
  224. package/src/components/toolbar/popup/autosaveprompt/index.jsx +0 -150
  225. package/src/components/toolbar/popup/autosaveprompt/styles.css +0 -64
  226. package/src/components/toolbar/popup/autosaveprompt/styles.js +0 -40
  227. package/src/components/toolbar/popup/cabinet/cabinet-category/index.jsx +0 -73
  228. package/src/components/toolbar/popup/cabinet/choose-product/index.jsx +0 -119
  229. package/src/components/toolbar/popup/cabinet/index.jsx +0 -85
  230. package/src/components/toolbar/popup/doorStyle/choose-style/index.jsx +0 -63
  231. package/src/components/toolbar/popup/doorStyle/index.jsx +0 -71
  232. package/src/components/toolbar/popup/doorStyle/style-category/index.jsx +0 -139
  233. package/src/components/toolbar/popup/downloadsummary/downloadSummaryContext.js +0 -2
  234. package/src/components/toolbar/popup/downloadsummary/downloadSummaryTemp.jsx +0 -157
  235. package/src/components/toolbar/popup/downloadsummary/index.jsx +0 -643
  236. package/src/components/toolbar/popup/downloadsummary/show2D/show2DView.jsx +0 -51
  237. package/src/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.jsx +0 -175
  238. package/src/components/toolbar/popup/downloadsummary/show3D/show3DView.jsx +0 -283
  239. package/src/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.jsx +0 -2257
  240. package/src/components/toolbar/popup/downloadsummary/showCabinetInfo.js +0 -93
  241. package/src/components/toolbar/popup/downloadsummary/showElevation/showElevationView.jsx +0 -132
  242. package/src/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.jsx +0 -2198
  243. package/src/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.jsx +0 -152
  244. package/src/components/toolbar/popup/downloadsummary/showWarranty.jsx +0 -149
  245. package/src/components/toolbar/popup/downloadsummary/styles.css +0 -177
  246. package/src/components/toolbar/popup/downloadsummary/styles.js +0 -453
  247. package/src/components/toolbar/popup/finishingtouch/category/index.jsx +0 -34
  248. package/src/components/toolbar/popup/finishingtouch/index.jsx +0 -58
  249. package/src/components/toolbar/popup/finishingtouch/material-edit.jsx +0 -112
  250. package/src/components/toolbar/popup/finishingtouch/product/index.jsx +0 -116
  251. package/src/components/toolbar/popup/floorplan/choose-floor/confirm-popup.jsx +0 -101
  252. package/src/components/toolbar/popup/floorplan/choose-floor/index.jsx +0 -254
  253. package/src/components/toolbar/popup/floorplan/choose-floor/lShaped.json +0 -311
  254. package/src/components/toolbar/popup/floorplan/choose-floor/longNarrow.json +0 -238
  255. package/src/components/toolbar/popup/floorplan/choose-floor/oRectangle.json +0 -220
  256. package/src/components/toolbar/popup/floorplan/choose-floor/rectangle.json +0 -238
  257. package/src/components/toolbar/popup/floorplan/choose-floor/styles.js +0 -86
  258. package/src/components/toolbar/popup/floorplan/floor-category/index.jsx +0 -109
  259. package/src/components/toolbar/popup/floorplan/index.jsx +0 -60
  260. package/src/components/toolbar/popup/index.jsx +0 -241
  261. package/src/components/toolbar/popup/newproject/index.jsx +0 -59
  262. package/src/components/toolbar/popup/newproject/styles.css +0 -64
  263. package/src/components/toolbar/popup/newproject/styles.js +0 -41
  264. package/src/components/toolbar/popup/product/appliance.jsx +0 -54
  265. package/src/components/toolbar/popup/product/cabinetproduct.jsx +0 -15
  266. package/src/components/toolbar/popup/product/doorstyle.jsx +0 -58
  267. package/src/components/toolbar/popup/product/doorstyleproduct.jsx +0 -47
  268. package/src/components/toolbar/popup/product/floor.jsx +0 -36
  269. package/src/components/toolbar/popup/product/floorproduct.jsx +0 -42
  270. package/src/components/toolbar/popup/product/index.jsx +0 -36
  271. package/src/components/toolbar/popup/product/primary.jsx +0 -77
  272. package/src/components/toolbar/popup/product/productline.jsx +0 -93
  273. package/src/components/toolbar/popup/product/reviewItem.jsx +0 -427
  274. package/src/components/toolbar/popup/product/reviewMolding.jsx +0 -310
  275. package/src/components/toolbar/popup/product/style.css +0 -54
  276. package/src/components/toolbar/popup/product/styles.js +0 -260
  277. package/src/components/toolbar/popup/savedesign/FullPictureForm.jsx +0 -146
  278. package/src/components/toolbar/popup/savedesign/index.jsx +0 -495
  279. package/src/components/toolbar/popup/savedesign/savedesign.style.css +0 -16
  280. package/src/components/toolbar/popup/savedesign/styles.js +0 -151
  281. package/src/components/toolbar/popup/setDoorStyleOption/index.jsx +0 -87
  282. package/src/components/toolbar/popup/styles.js +0 -909
  283. package/src/components/toolbar/popup/submitforquote/AddToCartOptions.jsx +0 -192
  284. package/src/components/toolbar/popup/submitforquote/CustomerRequestsForm.jsx +0 -96
  285. package/src/components/toolbar/popup/submitforquote/SkipDesignerReview.jsx +0 -54
  286. package/src/components/toolbar/popup/submitforquote/StepDots.jsx +0 -25
  287. package/src/components/toolbar/popup/submitforquote/cart-choice.jsx +0 -116
  288. package/src/components/toolbar/popup/submitforquote/doorstyle-menus.js +0 -38
  289. package/src/components/toolbar/popup/submitforquote/index.jsx +0 -698
  290. package/src/components/toolbar/popup/submitforquote/styles.css +0 -105
  291. package/src/components/toolbar/popup/submitforquote/styles.js +0 -294
  292. package/src/components/toolbar/popup/submitprompt/index.jsx +0 -89
  293. package/src/components/toolbar/popup/submitprompt/styles.css +0 -64
  294. package/src/components/toolbar/popup/submitprompt/styles.js +0 -42
  295. package/src/components/toolbar/toolbar-button.jsx +0 -90
  296. package/src/components/toolbar/toolbar-load-button.jsx +0 -36
  297. package/src/components/toolbar/toolbar-save-button.jsx +0 -32
  298. package/src/components/tutorial-view/Modal.jsx +0 -584
  299. package/src/components/tutorial-view/style.css +0 -111
  300. package/src/components/tutorial-view/styles.js +0 -65
  301. package/src/components/viewer2d/area.jsx +0 -98
  302. package/src/components/viewer2d/export.js +0 -48
  303. package/src/components/viewer2d/grids/grid-horizontal-streak.jsx +0 -40
  304. package/src/components/viewer2d/grids/grid-streak.jsx +0 -32
  305. package/src/components/viewer2d/grids/grid-vertical-streak.jsx +0 -41
  306. package/src/components/viewer2d/grids/grids.jsx +0 -30
  307. package/src/components/viewer2d/group.jsx +0 -57
  308. package/src/components/viewer2d/item.jsx +0 -618
  309. package/src/components/viewer2d/layer.jsx +0 -214
  310. package/src/components/viewer2d/line.jsx +0 -1358
  311. package/src/components/viewer2d/ruler.jsx +0 -136
  312. package/src/components/viewer2d/rulerDist.jsx +0 -192
  313. package/src/components/viewer2d/rulerX.jsx +0 -141
  314. package/src/components/viewer2d/rulerY.jsx +0 -138
  315. package/src/components/viewer2d/scene.jsx +0 -94
  316. package/src/components/viewer2d/snap.jsx +0 -118
  317. package/src/components/viewer2d/state.jsx +0 -77
  318. package/src/components/viewer2d/utils.js +0 -195
  319. package/src/components/viewer2d/vertex.jsx +0 -76
  320. package/src/components/viewer2d/viewer2d.jsx +0 -1830
  321. package/src/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -3078
  322. package/src/components/viewer3d/dcm.js +0 -226
  323. package/src/components/viewer3d/fbm.js +0 -383
  324. package/src/components/viewer3d/front3D.jsx +0 -63
  325. package/src/components/viewer3d/grid-creator.js +0 -25
  326. package/src/components/viewer3d/grids/grid-horizontal-streak.js +0 -41
  327. package/src/components/viewer3d/grids/grid-streak.js +0 -34
  328. package/src/components/viewer3d/grids/grid-vertical-streak.js +0 -42
  329. package/src/components/viewer3d/libs/first-person-controls.js +0 -70
  330. package/src/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1265
  331. package/src/components/viewer3d/libs/mtl-loader.js +0 -462
  332. package/src/components/viewer3d/libs/obj-loader.js +0 -653
  333. package/src/components/viewer3d/libs/orbit-controls.js +0 -945
  334. package/src/components/viewer3d/libs/pointer-lock-controls.js +0 -67
  335. package/src/components/viewer3d/lrm.js +0 -358
  336. package/src/components/viewer3d/model.js +0 -830
  337. package/src/components/viewer3d/pointer-lock-navigation.js +0 -140
  338. package/src/components/viewer3d/ruler-utils/itemRect.jsx +0 -91
  339. package/src/components/viewer3d/ruler-utils/layer3D.jsx +0 -528
  340. package/src/components/viewer3d/ruler-utils/ruler3D.jsx +0 -218
  341. package/src/components/viewer3d/ruler-utils/scene3D.jsx +0 -87
  342. package/src/components/viewer3d/ruler-utils/state3D.jsx +0 -25
  343. package/src/components/viewer3d/scene-creator.js +0 -5172
  344. package/src/components/viewer3d/three-memory-cleaner.js +0 -65
  345. package/src/components/viewer3d/viewer3d-first-person.js +0 -395
  346. package/src/components/viewer3d/viewer3d.js +0 -3376
  347. package/src/components/wizardstep/button/styles.js +0 -677
  348. package/src/components/wizardstep/export.js +0 -5
  349. package/src/components/wizardstep/index.jsx +0 -1372
  350. package/src/components/wizardstep/styles.js +0 -688
  351. package/src/components/wizardstep/wizardstep-content-button.jsx +0 -198
  352. package/src/components/wizardstep/wizardstep-toggle-button.jsx +0 -101
  353. package/src/constants.js +0 -731
  354. package/src/hooks/useCheckCart.js +0 -38
  355. package/src/hooks/useGetPricesBySku.js +0 -59
  356. package/src/hooks/useValidateToken.js +0 -181
  357. package/src/index.js +0 -32
  358. package/src/models.js +0 -541
  359. package/src/plugins/SVGLoader.js +0 -1991
  360. package/src/plugins/autosave.js +0 -39
  361. package/src/plugins/console-debugger.js +0 -36
  362. package/src/plugins/export.js +0 -11
  363. package/src/plugins/keyboard.js +0 -194
  364. package/src/reducers/areas-reducer.js +0 -13
  365. package/src/reducers/export.js +0 -39
  366. package/src/reducers/groups-reducer.js +0 -73
  367. package/src/reducers/holes-reducer.js +0 -125
  368. package/src/reducers/items-reducer.js +0 -286
  369. package/src/reducers/lines-reducer.js +0 -96
  370. package/src/reducers/project-reducer.js +0 -239
  371. package/src/reducers/reducer.js +0 -59
  372. package/src/reducers/scene-reducer.js +0 -41
  373. package/src/reducers/user-reducer.js +0 -30
  374. package/src/reducers/vertices-reducer.js +0 -34
  375. package/src/reducers/viewer2d-reducer.js +0 -81
  376. package/src/reducers/viewer3d-reducer.js +0 -65
  377. package/src/shared-style.js +0 -72
  378. package/src/styles/export.js +0 -7
  379. package/src/styles/tabs.css +0 -40
  380. package/src/translator/en.js +0 -106
  381. package/src/translator/it.js +0 -80
  382. package/src/translator/ru.js +0 -80
  383. package/src/translator/translator.js +0 -81
  384. package/src/utils/browser.js +0 -36
  385. package/src/utils/email-validator.js +0 -5
  386. package/src/utils/export.js +0 -39
  387. package/src/utils/geometry.js +0 -2572
  388. package/src/utils/get-edges-of-subgraphs.js +0 -29
  389. package/src/utils/graph-cycles.js +0 -259
  390. package/src/utils/graph-inner-cycles.js +0 -49
  391. package/src/utils/graph.js +0 -147
  392. package/src/utils/helper.js +0 -431
  393. package/src/utils/history.js +0 -37
  394. package/src/utils/id-broker.js +0 -9
  395. package/src/utils/logger.js +0 -8
  396. package/src/utils/math.js +0 -51
  397. package/src/utils/molding.js +0 -973
  398. package/src/utils/name-generator.js +0 -5
  399. package/src/utils/objects-utils.js +0 -56
  400. package/src/utils/phone-validator.js +0 -4
  401. package/src/utils/process-black-list.js +0 -10
  402. package/src/utils/react-if.jsx +0 -20
  403. package/src/utils/snap-scene.js +0 -102
  404. package/src/utils/snap.js +0 -184
  405. package/src/utils/threeCSG.es6.js +0 -578
  406. package/src/version.js +0 -1
@@ -1,2122 +0,0 @@
1
- import convert from 'convert-units';
2
- import { fromJS, Map } from 'immutable';
3
- import React, { useState } from 'react';
4
- import * as Three from 'three';
5
- import * as SceneCreator from '../../../src/components/viewer3d/scene-creator';
6
- import {
7
- ARROW_COLOR,
8
- BASE_CABINET_LAYOUTPOS,
9
- OBJTYPE_GROUP,
10
- OBJTYPE_MESH,
11
- SHADE_DARK_PURPLE_COLOR,
12
- SHAPE_SVG_DEPTH,
13
- SHAPE_SVG_PADDING,
14
- SHAPE_SVG_WIDTH,
15
- STATUS_WARNING_COLOR,
16
- STATUS_WARNING_LIGHT_COLOR,
17
- TALL_CABINET_LAYOUTPOS,
18
- UNIT_CENTIMETER,
19
- UNIT_INCH,
20
- WALL_CABINET_LAYOUTPOS
21
- } from '../../../src/constants';
22
- import { Item } from '../../../src/models';
23
- import * as GeomUtils from './geom-utils';
24
- import { loadGLTF } from './load-obj';
25
- import { animateDoor, translateDrawer } from '../../../src/utils/helper';
26
-
27
- // env Map ///////////////
28
- const paramsCounter = {
29
- envMap: 'HDR',
30
- roughness: 0.6,
31
- metalness: 0.3,
32
- exposure: 1
33
- // debug: true
34
- };
35
- const params = {
36
- envMap: 'HDR',
37
- roughness: 0.9,
38
- metalness: 0.1,
39
- metalness_glossy: 0.2,
40
- exposure: 1.0
41
- // debug: false
42
- };
43
-
44
- const paramsModel = {
45
- envMap: 'HDR',
46
- roughness: 0.9,
47
- metalness: 0.2,
48
- exposure: 1.0
49
- // debug: false
50
- };
51
-
52
- // /////////////////////////
53
-
54
- let cachedObject = {}; // cached Object for quickly load-3d
55
-
56
- // render 2d function//////
57
- export function render2DItem(
58
- element,
59
- layer,
60
- scene,
61
- sizeinfo,
62
- layoutpos,
63
- is_corner,
64
- shape_svg
65
- ) {
66
- const [hover, setHover] = useState(false);
67
- let { x, y, rotation } = element;
68
- let el_DSN = 'el_DSN',
69
- doorStylesKeys = [];
70
- let _element = element.toJS();
71
- if (_element.doorStyle !== undefined) {
72
- if (_element.doorStyle.doorStyles !== undefined) {
73
- doorStylesKeys = Object.keys(_element.doorStyle.doorStyles);
74
- }
75
- }
76
- if (
77
- (doorStylesKeys.includes('euro_length') ||
78
- doorStylesKeys.includes('euro_width') ||
79
- doorStylesKeys.includes('euro_shape_svg')) &&
80
- _element.doorStyle.doorStyles.is_euro_cds
81
- ) {
82
- el_DSN = _element.doorStyle.door_style_name;
83
- } else {
84
- el_DSN = 'el_DSN';
85
- }
86
- let width,
87
- depth,
88
- el_euro_length,
89
- el_euro_width,
90
- el_euro_length_unit,
91
- el_euro_width_unit,
92
- el_is_euro_cds,
93
- el_euro_shape_svg;
94
- if (doorStylesKeys.length > 0) {
95
- el_euro_length = _element.doorStyle.doorStyles.euro_length;
96
- el_euro_width = _element.doorStyle.doorStyles.euro_width;
97
- el_is_euro_cds = _element.doorStyle.doorStyles.is_euro_cds;
98
- el_euro_shape_svg = _element.doorStyle.doorStyles.euro_shape_svg;
99
- }
100
- if (el_euro_length === undefined && el_euro_width === undefined) {
101
- el_DSN = 'el_DSN';
102
- }
103
- if (el_DSN === 'Euro & Frameless') {
104
- // sizeinfo["depth"] = el_euro_length;
105
- // sizeinfo["width"] = el_euro_width;
106
- }
107
- let tempWidth = element.properties.get('width');
108
- let tempDepth = element.properties.get('depth');
109
- width = tempWidth && {
110
- length: tempWidth.get('_length'),
111
- unit: tempWidth.get('_unit')
112
- };
113
- depth = tempDepth && {
114
- length: tempDepth.get('_length'),
115
- unit: tempDepth.get('_unit')
116
- };
117
- let originalWidth = convert(sizeinfo.width).from('in').to('cm');
118
- let originalDepth = convert(sizeinfo.depth).from('in').to('cm');
119
- let newWidth = convert(width.length).from(width.unit).to('cm');
120
- let newDepth = convert(depth.length).from(depth.unit).to('cm');
121
- let padding = convert(SHAPE_SVG_PADDING).from(UNIT_INCH).to(UNIT_CENTIMETER);
122
- let angle = element.rotation + 90;
123
- let textRotation = 0;
124
- if (Math.sin((angle * Math.PI) / 180) < 0) {
125
- textRotation = 180;
126
- }
127
- let color = '#eee';
128
- if (layoutpos == BASE_CABINET_LAYOUTPOS) {
129
- color = '#3f8db3';
130
- }
131
- if (layoutpos == TALL_CABINET_LAYOUTPOS) {
132
- color = '#93b3be';
133
- }
134
- if (layoutpos == WALL_CABINET_LAYOUTPOS) {
135
- color = '#48b08dcc';
136
- }
137
-
138
- const splitStr = [];
139
- const txtContent = [];
140
- const lineCount = 0; //parseInt(((newWidth) / 8 - 0.51).toFixed(), 10) - 1;
141
- const rowCount = 0; //parseInt((element.type.length / lineCount - 0.51).toFixed(), 10);
142
-
143
- // Get type
144
- let type = element.type;
145
- let objSKU = this.obj.sku_number;
146
- if (objSKU.length !== 0) {
147
- let dcId,
148
- doorStyle = element.doorStyle;
149
- if (doorStyle instanceof Map) {
150
- dcId = doorStyle.get('id');
151
- } else {
152
- dcId = doorStyle.id;
153
- }
154
- let skuItem = this.obj.skuArray.find(el => el.door_color_id === dcId);
155
- if (skuItem !== undefined) {
156
- type = skuItem.sku;
157
- }
158
- }
159
-
160
- if (rowCount > 0) {
161
- for (let x = 0; x < rowCount; x++) {
162
- splitStr.push(type.slice(lineCount * x, lineCount * (x + 1)));
163
- }
164
- }
165
- splitStr.push(type.slice(lineCount * rowCount));
166
- splitStr.forEach((el, key) => {
167
- txtContent.push(
168
- <text
169
- key={'text' + key}
170
- x="0"
171
- y={newDepth / 2 - 12}
172
- dy={16 * key}
173
- transform={`translate(${newWidth / 2}, ${
174
- newDepth / 2 + 5
175
- }) scale(1,-1) rotate(${textRotation})`}
176
- // textLength={newWidth - 10}
177
- // lengthAdjust="spacingAndGlyphs"
178
- style={{
179
- fontWeight: 500,
180
- fontSize: '7px',
181
- textAnchor: 'middle',
182
- fill: '#FFF',
183
- display: 'block'
184
- }}
185
- >
186
- {el}
187
- </text>
188
- );
189
- });
190
- let style = {
191
- stroke: element.selected ? '#565658' : '#565658',
192
- strokeWidth: '2px',
193
- fill: color
194
- };
195
- // let arrow_style = { stroke: element.selected ? '#0096fd' : null, strokeWidth: "2px", fill: "#84e1ce" };
196
-
197
- let rendered = null;
198
-
199
- if (shape_svg || el_euro_shape_svg) {
200
- let svg_url, svg_width, svg_depth;
201
- if (typeof shape_svg == 'string' || typeof el_euro_shape_svg == 'string') {
202
- if (el_DSN === 'Euro & Frameless' && el_is_euro_cds) {
203
- svg_url = el_euro_shape_svg;
204
- svg_width = newWidth;
205
- svg_depth = newDepth;
206
- } else {
207
- svg_url = shape_svg;
208
- svg_width = originalWidth;
209
- svg_depth = originalDepth;
210
- }
211
- } else {
212
- // if (el_DSN === "Euro & Frameless" && el_is_euro_cds) {
213
- // // svg_url = el_euro_shape_svg.url;
214
- // } else {
215
- // }
216
- svg_url = shape_svg.url;
217
- svg_width = convert(SHAPE_SVG_WIDTH).from(UNIT_INCH).to(UNIT_CENTIMETER);
218
- svg_depth = convert(SHAPE_SVG_DEPTH).from(UNIT_INCH).to(UNIT_CENTIMETER);
219
- }
220
-
221
- let padding_width = (padding * newWidth) / svg_width;
222
- let padding_depth = (padding * newDepth) / svg_depth;
223
-
224
- rendered = (
225
- <g
226
- onMouseOver={event => {
227
- setHover(true);
228
- }}
229
- onMouseOut={event => {
230
- setHover(false);
231
- }}
232
- transform={`translate(${x},${y})`}
233
- >
234
- <g transform={`rotate(${rotation})`}>
235
- <g
236
- transform={`translate(${-newWidth / 2 - padding_width},${
237
- -newDepth / 2 - padding_depth
238
- })`}
239
- >
240
- <image
241
- preserveAspectRatio="none"
242
- style={{ pointerEvents: 'none' }}
243
- href={svg_url}
244
- width={`${newWidth + 2 * padding_width}`}
245
- height={`${newDepth + 2 * padding_depth}`}
246
- transform={`scale(1, -1)`}
247
- x="0"
248
- y={`${-newDepth - 2 * padding_depth}`}
249
- />
250
- <rect
251
- x={`${padding_width}`}
252
- y={`${padding_depth}`}
253
- width={`${newWidth}`}
254
- height={`${newDepth}`}
255
- visibility={
256
- element.toJS().doorStyle.doorStyles !== undefined
257
- ? element.toJS().doorStyle.doorStyles &&
258
- element.toJS().doorStyle.doorStyles.cds &&
259
- element.toJS().doorStyle.doorStyles.cds.length != 0 &&
260
- element
261
- .toJS()
262
- .doorStyle.doorStyles.cds.filter(
263
- cd => cd.itemID == element.getIn(['itemID'])
264
- )
265
- ? 'hidden'
266
- : 'visible'
267
- : 'hidden'
268
- }
269
- style={{
270
- pointerEvents: 'all',
271
- opacity: 0.7,
272
- postion: 'relative'
273
- }}
274
- fill={STATUS_WARNING_LIGHT_COLOR}
275
- stroke={STATUS_WARNING_COLOR}
276
- strokeWidth="2px"
277
- ></rect>
278
- <g transform={`translate(${padding_width},${padding_depth})`}>
279
- {txtContent}
280
- </g>
281
- </g>
282
- </g>
283
- </g>
284
- );
285
- } else {
286
- rendered = (
287
- <g
288
- onMouseOver={event => {
289
- setHover(true);
290
- }}
291
- onMouseOut={event => {
292
- setHover(false);
293
- }}
294
- transform={`translate(${x},${y})`}
295
- >
296
- <g transform={`rotate(${rotation})`}>
297
- <g transform={`translate(${-newWidth / 2},${-newDepth / 2})`}>
298
- {newDepth > 15 ? (
299
- [
300
- <rect
301
- key="base"
302
- x="0"
303
- y="12"
304
- width={newWidth}
305
- height={newDepth - 12}
306
- style={style}
307
- />,
308
- <polygon
309
- key="door"
310
- style={style}
311
- points={`0,9 ${newWidth},9 ${newWidth},6 ${newWidth - 5},6 ${
312
- newWidth - 5
313
- },3 ${newWidth - 2},3 ${newWidth - 2} 0 ${newWidth - 10} 0 ${
314
- newWidth - 10
315
- },3 ${newWidth - 7},3 ${newWidth - 7},6 0 6`}
316
- />
317
- ]
318
- ) : (
319
- <rect
320
- key="base"
321
- x="0"
322
- y="0"
323
- width={newWidth}
324
- height={newDepth}
325
- style={style}
326
- />
327
- )}
328
- {/* {<text key="text"
329
- x="0"
330
- y="0"
331
- // dx="10"
332
- // dy="10"
333
- transform={`translate(${newWidth / 2}, ${newDepth / 2 + 5}) scale(1,-1) rotate(${textRotation})`}
334
- // textLength={newWidth - 10}
335
- // lengthAdjust="spacingAndGlyphs"
336
- style={{ fontWeight:800, fontSize:'16px', textAnchor: "middle", fill:'#FFF', display: hover || element.selected? 'block' : 'none'}}>
337
- {element.type}
338
- </text>} */}
339
- {txtContent}
340
- {/* { element.selected &&
341
- (<g key="duplicated" style={{cursor:'pointer'}}>
342
- <image transform={`scale(1,-1)`} href="/assets/img/svg/duplicate_object_left.svg" x={-10} y={-newDepth/2 - 15} height="20" width="20" />
343
- <image transform={`scale(1,-1)`} href="/assets/img/svg/duplicate_object_right.svg" x={newWidth - 10} y={-newDepth / 2 - 15} height="20" width="20" />
344
- </g>)
345
- } */}
346
- </g>
347
- </g>
348
- {/* { element.selected &&
349
- (
350
- <g key="action" transform={`translate(${-newWidth / 2},${newDepth / 2})`} style={{cursor:'pointer'}}>
351
- <image transform={`rotate(180, 10 ,15) `} href="/assets/img/svg/2d_delete_object1.svg" x="0" y="5" height="20" width="20" data-part='remove'/>
352
- <image transform={`rotate(180, ${newWidth - 10} ,15)`} href="/assets/img/svg/duplicate_object_right.svg" x={newWidth-20} y="5" height="20" width="20" data-part='duplicate'/>
353
- </g>
354
- )
355
- } */}
356
- </g>
357
- );
358
- }
359
-
360
- return rendered;
361
- }
362
- // end of render 2d function /////////////////////////
363
-
364
- export function loadTexture(url) {
365
- let texture = new Three.TextureLoader().load(url);
366
- texture.colorSpace = Three.SRGBColorSpace;
367
- texture.wrapS = Three.MirroredRepeatWrapping;
368
- texture.wrapT = Three.MirroredRepeatWrapping;
369
- return texture;
370
- }
371
-
372
- const applyTexture = (material, texture, length, height) => {
373
- if (texture) {
374
- material.map = texture;
375
- material.needsUpdate = true;
376
- material.map.wrapS = Three.RepeatWrapping;
377
- material.map.wrapT = Three.RepeatWrapping;
378
- material.map.repeat.set(length * 0.01, height * 0.01);
379
-
380
- if (texture.normal) {
381
- material.normalMap = loadTexture(texture.normal.uri);
382
- material.normalScale = new Vector2(
383
- texture.normal.normalScaleX,
384
- texture.normal.normalScaleY
385
- );
386
- material.normalMap.wrapS = Three.RepeatWrapping;
387
- material.normalMap.wrapT = Three.RepeatWrapping;
388
- material.normalMap.repeat.set(
389
- length * texture.normal.lengthRepeatScale,
390
- height * texture.normal.heightRepeatScale
391
- );
392
- }
393
- }
394
- };
395
-
396
- const assignUVs = geometry => {
397
- geometry.computeBoundingBox();
398
-
399
- let { min, max } = geometry.boundingBox;
400
-
401
- let offset = new Three.Vector3(0 - min.x, 0 - min.y, 0 - min.z);
402
- let range = new Three.Vector3(max.x - min.x, max.y - min.y, max.z - min.z);
403
- geometry.faceVertexUvs[0] = geometry.faces.map(face => {
404
- let v1 = geometry.vertices[face.a];
405
- let v2 = geometry.vertices[face.b];
406
- let v3 = geometry.vertices[face.c];
407
-
408
- return [
409
- new Three.Vector3(
410
- (v1.x + offset.x) / range.x,
411
- (v1.y + offset.y) / range.y,
412
- (v1.z + offset.z) / range.z
413
- ),
414
- new Three.Vector3(
415
- (v2.x + offset.x) / range.x,
416
- (v2.y + offset.y) / range.y,
417
- (v1.z + offset.z) / range.z
418
- ),
419
- new Three.Vector3(
420
- (v3.x + offset.x) / range.x,
421
- (v3.y + offset.y) / range.y,
422
- (v1.z + offset.z) / range.z
423
- )
424
- ];
425
- });
426
-
427
- geometry.uvsNeedUpdate = true;
428
- };
429
-
430
- /**
431
- * Render 3D Item
432
- * @param {Item} element Rendering item
433
- * @param sizeinfo Dimesion of the item
434
- * @param structure_json Structure of the item such as place holders and meshes, etc
435
- */
436
- export function render3DItem(
437
- element,
438
- layer,
439
- scene,
440
- sizeinfo,
441
- structure_json,
442
- is_corner,
443
- mode = null
444
- ) {
445
- if (element.doorStyle.constructor !== Map) {
446
- element = element.set('doorStyle', fromJS(element.doorStyle));
447
- }
448
-
449
- if (element.doorStyle.toJS().handle_gltf !== '') {
450
- // Check element has doorHandle
451
- for (var i = 1; i < 10; i++) {
452
- element = element.setIn(
453
- ['doorStyle', 'doorStyles', 'door_handle_' + i + '_gltf'],
454
- element.doorStyle.toJS().handle_gltf
455
- );
456
- element = element.setIn(
457
- ['doorStyle', 'doorStyles', 'fixed_drawer_door_handle_' + i + '_gltf'],
458
- element.doorStyle.toJS().handle_gltf
459
- );
460
- element = element.setIn(
461
- ['doorStyle', 'doorStyles', 'drawer_door_handle_' + i + '_gltf'],
462
- element.doorStyle.toJS().handle_gltf
463
- );
464
- }
465
- }
466
- let width = { length: sizeinfo.width, unit: 'in' };
467
- let depth = { length: sizeinfo.depth, unit: 'in' };
468
- let height = { length: sizeinfo.height, unit: 'in' };
469
- let newWidth = convert(width.length).from(width.unit).to('in');
470
- let newDepth = convert(depth.length).from(depth.unit).to('in');
471
- let newHeight = convert(height.length).from(height.unit).to('in');
472
- let mainName = ''; // to get name structure//
473
- if (element.properties.get('width'))
474
- newWidth = element.getIn(['properties', 'width', '_length']);
475
- if (element.properties.get('depth'))
476
- newDepth = element.getIn(['properties', 'depth', '_length']);
477
- if (element.properties.get('height'))
478
- newHeight = element.getIn(['properties', 'height', '_length']);
479
-
480
- var structure = structure_json;
481
- // structure.push({name:'model', url: '/assets/model/DCM.gltf'});
482
- structure.model = '/assets/model/DCM.gltf';
483
- var placeholders = structure.placeholders;
484
- let doorStyles = null;
485
- let color = 0xffffff,
486
- glossness = 1,
487
- handleMaterial = {};
488
- let counterTop = element.counterTop;
489
- if (layer.toJS().counterTop.uri) {
490
- counterTop.uri = layer.toJS().counterTop.uri;
491
- }
492
-
493
- if ('name' in element.doorStyle) {
494
- doorStyles = new Map(element.doorStyle.doorStyles);
495
- color = element.doorStyle.color;
496
- glossness = element.doorStyle.glossness;
497
- handleMaterial.metalness = element.doorStyle.metalness;
498
- handleMaterial.roughness = element.doorStyle.roughness;
499
- } else if (element.doorStyle != null && element.doorStyle) {
500
- doorStyles = element.doorStyle.get('doorStyles');
501
- color = element.doorStyle.get('color');
502
- glossness = element.doorStyle.get('glossness');
503
- handleMaterial.metalness = element.doorStyle.get('metalness');
504
- handleMaterial.roughness = element.doorStyle.get('roughness');
505
- }
506
- if (color === undefined) color = '#ffffff';
507
- if (glossness === undefined) glossness = 1;
508
- const tempDoorStyles = doorStyles.toJS();
509
- let tempPlaceholders = structure.tempPlaceholders;
510
- var tPlaceholders = tempPlaceholders.find(el => {
511
- return el.id === tempDoorStyles.cabinet_door_style_id;
512
- });
513
- if (tPlaceholders !== undefined) {
514
- placeholders = tPlaceholders.placeholders;
515
- const tempStructure = {
516
- ...tPlaceholders.structure,
517
- animation: structure.animation,
518
- placeholders: structure.placeholders,
519
- tempPlaceholders: structure.tempPlaceholders,
520
- model: structure.model
521
- };
522
- structure = tempStructure;
523
- }
524
- let userData = structure.animation;
525
- // ///////////////////////////
526
- let onLoadItem = object => {
527
- var areaMaterial = new Three.MeshStandardMaterial();
528
- areaMaterial.side = Three.DoubleSide;
529
- // areaMaterial.envMap = textureCube;
530
- if (doorStyles != null)
531
- if (doorStyles.get('base') != undefined) {
532
- let normalMap = doorStyles.get('base');
533
- let interiortexture = loadTexture(normalMap);
534
- applyTexture(areaMaterial, interiortexture, 100, 100);
535
- }
536
- let object1 = object;
537
- let newAltitude = element.properties.get('altitude').get('_length');
538
- let newUnit = element.properties.get('altitude').get('_unit') || 'in';
539
- newAltitude = convert(newAltitude).from(newUnit).to(scene.unit);
540
- let _element = element.toJS();
541
- if (!_element.doorStyle.doorStyles.is_euro_cds) {
542
- object1.scale.set(
543
- (100 * newWidth) / sizeinfo.width,
544
- (100 * newHeight) / sizeinfo.height,
545
- (100 * newDepth) / sizeinfo.depth
546
- );
547
- } else {
548
- object1.scale.set(100, 100, 100);
549
- }
550
- // Normalize the origin of the object
551
- let boundingBox = GeomUtils.baseBox3FromObject(object1);
552
- object1.userData = boundingBox;
553
- let door_animate_offset = {};
554
- const matchStr = /\d_(door[^LR1-9]*)(_[LR])?(_[1-9])?$/;
555
- object1.children.forEach(child => {
556
- let door_match = child.name.match(matchStr);
557
- if (door_match && door_match.length > 2) {
558
- let rotate_match_text = element.properties.toJS().flip_doorhandle
559
- ? 'rotate_L'
560
- : 'rotate_R';
561
- if (door_match[2] === '_L') {
562
- rotate_match_text = element.properties.toJS().flip_doorhandle
563
- ? 'rotate_R'
564
- : 'rotate_L';
565
- }
566
- let isDoubleDoor = door_match && door_match[2] !== undefined;
567
- child.children[0]?.children.forEach(it => {
568
- if (
569
- it?.name?.includes('handle') &&
570
- it.children?.length &&
571
- is_corner === 1 &&
572
- isDoubleDoor
573
- ) {
574
- const tname = child?.name?.endsWith('_L')
575
- ? child.name.replace('_L', '_R')
576
- : child?.name?.replace('_R', '_L');
577
-
578
- const tmp =
579
- object1?.children?.filter(item => item?.name === tname) || [];
580
- const t0 = tmp[0];
581
- const filterStr = t0?.name?.endsWith('_L')
582
- ? 'rotate_L'
583
- : 'rotate_R';
584
-
585
- const tposArr =
586
- t0?.children?.[0]?.children?.filter(item =>
587
- item?.name?.endsWith(filterStr)
588
- ) || [];
589
- const tpos0 = tposArr[0];
590
-
591
- if (it.name.includes('base_end')) {
592
- door_animate_offset[child.name] = {
593
- x: -2 * (it.position?.x ?? 0) - 0.12,
594
- y: it.position?.y ?? 0,
595
- z: -(tpos0?.position?.x ?? 0) + 0.12,
596
- isCorner: true
597
- };
598
- } else {
599
- door_animate_offset[child.name] = {
600
- x: -(it.position?.x ?? 0) - 0.04,
601
- y: it.position?.y ?? 0,
602
- z: 2 * (tpos0?.position?.x ?? 0) - 0.01,
603
- isCorner: true
604
- };
605
- }
606
- } else if (
607
- it.name.endsWith(rotate_match_text) &&
608
- door_animate_offset[child.name] == undefined
609
- ) {
610
- door_animate_offset[child.name] = {
611
- x: it.position.x,
612
- y: it.position.y,
613
- z: it.position.z,
614
- isCorner: false
615
- };
616
- }
617
- });
618
- }
619
- });
620
- object1.userData.door_animate_offset = door_animate_offset;
621
- object1.userData.animation = userData;
622
-
623
- let center = [
624
- (boundingBox.max.x - boundingBox.min.x) / 2 + boundingBox.min.x,
625
- (boundingBox.max.y - boundingBox.min.y) / 2 + boundingBox.min.y,
626
- (boundingBox.max.z - boundingBox.min.z) / 2 + boundingBox.min.z
627
- ];
628
- object1.position.x -= center[0];
629
- object1.position.y -=
630
- center[1] - (boundingBox.max.y - boundingBox.min.y) / 2;
631
- object1.position.z -= center[2];
632
- object1.position.y += newAltitude;
633
-
634
- if (element.selected) {
635
- // if object is selected
636
- // save object transform info///
637
- let scalevec = new Three.Vector3(
638
- object1.scale.x,
639
- object1.scale.y,
640
- object1.scale.z
641
- );
642
- let posVec = new Three.Vector3(
643
- object1.position.x,
644
- object1.position.y,
645
- object1.position.z
646
- );
647
-
648
- object.scale.set(
649
- (1 * newWidth) / sizeinfo.width,
650
- (1 * newHeight) / sizeinfo.height,
651
- (1 * newDepth) / sizeinfo.depth
652
- );
653
- object1.position.set(0, 0, 0);
654
- object1.rotation.set(0, 0, 0);
655
-
656
- //let box = new Three.BoxHelper(object, 0xffffff);
657
- //box.material.lineWidth = 5;
658
- //box.renderOrder = 1000;
659
- //box.material.depthTest = false;
660
- //object.add(box);
661
- let boundingBox = GeomUtils.baseBox3FromObject(object);
662
- let max = boundingBox.max;
663
- let min = boundingBox.min;
664
- let radius =
665
- Math.sqrt(
666
- (boundingBox.max.x - boundingBox.min.x) *
667
- (boundingBox.max.x - boundingBox.min.x) +
668
- (boundingBox.max.z - boundingBox.min.z) *
669
- (boundingBox.max.z - boundingBox.min.z)
670
- ) / 2;
671
- let moveBox = new Three.BoxGeometry(
672
- max.x - min.x,
673
- max.y - min.y,
674
- max.z - min.z
675
- );
676
-
677
- // translate Object
678
- let controlGeom = GeomUtils.controlGeom();
679
-
680
- // rotate Object //////////
681
- let rotGeom = GeomUtils.rotGeoms(radius + 0.05);
682
- // //////////////////////////////////
683
-
684
- // upwards Geometry/////////// Move up Object
685
- let upwardsGeom = GeomUtils.upwardsGeom();
686
-
687
- // vertical line - 4 lines around object//////////////////////////
688
- let vLineGeom = new Three.BufferGeometry();
689
-
690
- let vertices = [
691
- (max.x - min.x) / 2 + min.x,
692
- 0,
693
- max.z,
694
- (max.x - min.x) / 2 + min.x,
695
- 0,
696
- max.z + 1.3
697
- ];
698
-
699
- vLineGeom.setAttribute(
700
- 'position',
701
- new Three.BufferAttribute(new Float32Array(vertices), 3)
702
- );
703
-
704
- let vLineGeom1 = new Three.BufferGeometry();
705
-
706
- let vertices1 = [
707
- (max.x - min.x) / 2 + min.x,
708
- 0,
709
- min.z,
710
- (max.x - min.x) / 2 + min.x,
711
- 0,
712
- min.z - 1.3
713
- ];
714
-
715
- vLineGeom1.setAttribute(
716
- 'position',
717
- new Three.BufferAttribute(new Float32Array(vertices1), 3)
718
- );
719
-
720
- let vLineGeom2 = new Three.BufferGeometry();
721
-
722
- let vertices2 = [
723
- max.x,
724
- 0,
725
- max.z - (max.z - min.z) / 2,
726
- max.x + 1.3,
727
- 0,
728
- max.z - (max.z - min.z) / 2
729
- ];
730
-
731
- vLineGeom2.setAttribute(
732
- 'position',
733
- new Three.BufferAttribute(new Float32Array(vertices2), 3)
734
- );
735
-
736
- let vLineGeom3 = new Three.BufferGeometry();
737
-
738
- let vertices3 = [
739
- min.x,
740
- 0,
741
- max.z - (max.z - min.z) / 2,
742
- min.x - 1.3,
743
- 0,
744
- max.z - (max.z - min.z) / 2
745
- ];
746
-
747
- vLineGeom3.setAttribute(
748
- 'position',
749
- new Three.BufferAttribute(new Float32Array(vertices3), 3)
750
- );
751
- // ///////////////////////////////////////
752
-
753
- // set names of transform object
754
- let rotFillObj = new Three.Mesh(
755
- rotGeom.rotFill,
756
- new Three.MeshPhongMaterial({
757
- color: new Three.Color(0x000000).convertLinearToSRGB(),
758
- side: Three.DoubleSide,
759
- colorWrite: true
760
- })
761
- );
762
- let rotStrokeObj = new Three.Line(
763
- rotGeom.rotStroke,
764
- new Three.LineBasicMaterial({
765
- color: new Three.Color(0xffffff).convertLinearToSRGB(),
766
- colorWrite: true
767
- })
768
- );
769
- rotFillObj.name = 'rotate';
770
-
771
- let upObj = new Three.Mesh(
772
- upwardsGeom,
773
- new Three.MeshBasicMaterial({
774
- color: new Three.Color(0xffffff).convertLinearToSRGB(),
775
- side: Three.DoubleSide
776
- })
777
- );
778
- upObj.name = 'transUp';
779
-
780
- let mBox = new Three.Mesh(
781
- moveBox,
782
- new Three.MeshBasicMaterial({
783
- color: new Three.Color(0xdd6699).convertLinearToSRGB(),
784
- side: Three.DoubleSide,
785
- transparent: true,
786
- opacity: 0.4
787
- })
788
- );
789
-
790
- let color = new Three.Color(
791
- SHADE_DARK_PURPLE_COLOR
792
- ).convertLinearToSRGB();
793
- let vLine = new Three.Line(
794
- vLineGeom,
795
- new Three.LineBasicMaterial({ color })
796
- );
797
- let vLine1 = new Three.Line(
798
- vLineGeom1,
799
- new Three.LineBasicMaterial({ color })
800
- );
801
- let vLine2 = new Three.Line(
802
- vLineGeom2,
803
- new Three.LineBasicMaterial({ color })
804
- );
805
- let vLine3 = new Three.Line(
806
- vLineGeom3,
807
- new Three.LineBasicMaterial({ color })
808
- );
809
- vLine.renderOrder = 1;
810
- vLine1.renderOrder = 1;
811
- vLine2.renderOrder = 1;
812
- vLine3.renderOrder = 1;
813
- vLine.material.transparent = true;
814
- vLine1.material.transparent = true;
815
- vLine2.material.transparent = true;
816
- vLine3.material.transparent = true;
817
- vLine.material.depthTest = false;
818
- vLine1.material.depthTest = false;
819
- vLine2.material.depthTest = false;
820
- vLine3.material.depthTest = false;
821
- // translate vector to center of object
822
- let uVec = new Three.Vector3(
823
- -posVec.x / scalevec.x,
824
- -posVec.y / scalevec.y,
825
- -posVec.z / scalevec.z
826
- );
827
-
828
- vLine.translateY(0.1);
829
- vLine1.translateY(0.1);
830
- vLine2.translateY(0.1);
831
- vLine3.translateY(0.1);
832
-
833
- //rotObj.translateOnAxis(uVec, 1);
834
- upObj.translateOnAxis(uVec, 1);
835
- upObj.translateY(max.y - min.y);
836
-
837
- mBox.name = 'TransformBox';
838
- mBox.translateOnAxis(
839
- new Three.Vector3(uVec.x, uVec.y + (max.y - min.y) / 2, uVec.z),
840
- 1
841
- );
842
- mBox.scale.set(1.01, 1.01, 1.01);
843
-
844
- // other side rotate object
845
- let rotFillObj1 = rotFillObj.clone();
846
- let rotStrokeObj1 = rotStrokeObj.clone();
847
- rotFillObj1.rotateY(Math.PI);
848
- rotStrokeObj1.rotateY(Math.PI);
849
- rotFillObj.translateY(0.1);
850
- rotFillObj1.translateY(0.1);
851
- rotStrokeObj.translateY(0.1);
852
- rotStrokeObj1.translateY(0.1);
853
-
854
- // assets Objects group includes rotate objects...
855
- let asrtObj = new Three.Group();
856
- // asrtObj.add(rotFillObj);
857
- // asrtObj.add(rotFillObj1);
858
- // asrtObj.add(rotStrokeObj);
859
- // asrtObj.add(rotStrokeObj1);
860
- //asrtObj.add(upObj);
861
- asrtObj.add(vLine);
862
- asrtObj.add(vLine1);
863
- asrtObj.add(vLine2);
864
- asrtObj.add(vLine3);
865
- mBox.visible = false;
866
- asrtObj.add(mBox);
867
- asrtObj.scale.set(1 / object.scale.x, object.scale.y, 1 / object.scale.z);
868
- //asrtObj.translateY(newAltitude / scalevec.y);
869
- asrtObj.name = 'TransformGizmo';
870
- // add assets Objects Group
871
- object1.add(asrtObj);
872
-
873
- // recover objects transform
874
- object1.position.x = posVec.x;
875
- object1.position.y = posVec.y;
876
- object1.position.z = posVec.z;
877
- object1.scale.set(scalevec.x, scalevec.y, scalevec.z);
878
- setTimeout(() => {
879
- SceneCreator.getDistances(layer);
880
- }, 100);
881
- }
882
-
883
- let flip_doorhandle = element.properties.get('flip_doorhandle');
884
- if (flip_doorhandle) {
885
- SceneCreator.updateDoorHandleMesh(element, object1, true);
886
- }
887
-
888
- object1.traverse(obj => {
889
- if (obj.type === OBJTYPE_MESH) {
890
- const { name } = obj;
891
- if (name.match(/_door_.*_glass_/)) {
892
- let material = new Three.MeshPhysicalMaterial({
893
- roughness: 0,
894
- transmission: 1,
895
- thickness: 0.5, // Add refraction!
896
- transparency: 0.8
897
- });
898
- obj.material = material;
899
- } else if (name.startsWith('sink_')) {
900
- // texture = loadTexture('/assets/img/texture/steel.jpg');
901
-
902
- let material;
903
- // Get color from name
904
- if (name.includes('black') || name.includes('white')) {
905
- let color;
906
- if (name.includes('black')) {
907
- color = new Three.Color(0x555555).convertLinearToSRGB();
908
- } else {
909
- color = 0xffffff;
910
- }
911
- material = new Three.MeshPhysicalMaterial({
912
- roughness: 0.5,
913
- metalness: 0,
914
- // transmission: 1,
915
- transparent: true,
916
- opacity: 1,
917
- thickness: 0.5, // Add refraction!
918
- // transparency: 0.8,
919
- color: color,
920
- side: Three.DoubleSide
921
- });
922
- } else {
923
- // if (name.includes('chrome')) {
924
- material = new Three.MeshPhysicalMaterial({
925
- roughness: 0.2,
926
- metalness: 1,
927
- reflectivity: 0.5,
928
- color: new Three.Color(0xdddddd).convertLinearToSRGB()
929
- });
930
- }
931
- obj.material = material;
932
- }
933
- }
934
- if (element.toJS().properties.open_doors) {
935
- let open_doors = element.toJS().properties.open_doors;
936
- let object_match =
937
- obj.name.match(/\d_(interior_drawer[^LR1-9]*)(_[LR1-9])?$/) ||
938
- obj.name.match(matchStr);
939
- if (object_match && object_match.length > 2) {
940
- const isDoor = object_match[1] === 'door';
941
- if (isDoor) {
942
- const offsetData = object1.userData.door_animate_offset[obj.name];
943
- // Open Door
944
- animateDoor(
945
- offsetData,
946
- obj,
947
- open_doors,
948
- element.toJS(),
949
- is_corner,
950
- 'Opened2D'
951
- );
952
- } else {
953
- // Open Drawer
954
- translateDrawer(element.toJS(), obj, open_doors, 'Opened2D');
955
- }
956
- }
957
- }
958
- });
959
-
960
- return object1;
961
- };
962
- // keys in structure
963
- let keys = Object.keys(structure);
964
- // if exist in cached Objects
965
- if (
966
- element.type +
967
- color +
968
- 'doorStyle' +
969
- JSON.stringify(doorStyles.toJS()) +
970
- element.counterTop.uri in
971
- cachedObject
972
- ) {
973
- let objGroup =
974
- cachedObject[
975
- element.type + color + 'doorStyle' + JSON.stringify(doorStyles.toJS())
976
- ].clone();
977
- return Promise.resolve(onLoadItem(objGroup.clone()));
978
- }
979
-
980
- // base Object/////
981
- let objGroup = null;
982
-
983
- let loadGLTFs = function (i) {
984
- if (keys[i] === 'animation') {
985
- // if animation info
986
- i++;
987
- return loadGLTFs(i);
988
- }
989
- if (keys[i] === 'placeholders') {
990
- // if placeholders group
991
- i++;
992
- return loadGLTFs(i);
993
- }
994
- if (i === keys.length) {
995
- // if end of keys
996
- cachedObject[
997
- element.type + color + 'doorStyle' + JSON.stringify(doorStyles.toJS())
998
- ] = objGroup.clone(); //register to cachedObject
999
- return onLoadItem(
1000
- cachedObject[
1001
- element.type + color + 'doorStyle' + JSON.stringify(doorStyles.toJS())
1002
- ].clone()
1003
- );
1004
- }
1005
- if (keys[i] === 'base') {
1006
- // if base Objects
1007
- i++;
1008
- return loadGLTFs(i);
1009
- }
1010
-
1011
- let phsArray = [];
1012
- let placeholderStructure = placeholders[keys[i]];
1013
- if (placeholderStructure == undefined || placeholderStructure.length == 0) {
1014
- i++;
1015
- return loadGLTFs(i);
1016
- }
1017
-
1018
- for (let j = 0; j < placeholderStructure.length; j++) {
1019
- let phData = placeholderStructure[j];
1020
- let phs = phData.split('/');
1021
-
1022
- let temp = phData.split('/');
1023
- // placeholder remake////////////////
1024
- for (let k = 0; k < phs.length; k++) {
1025
- if (phs[k] in placeholders) {
1026
- let placeholderphs = placeholders[phs[k]];
1027
- let key = placeholderStructure.length / placeholderphs.length;
1028
- phs[k] = placeholderphs[Math.floor(j / key)];
1029
- let splitedData = phs[k].split('/');
1030
-
1031
- if (splitedData.length > 1) {
1032
- phs[k] = splitedData[splitedData.length - 1];
1033
-
1034
- for (let m = splitedData.length - 2; m >= 0; m--) {
1035
- phs.unshift(splitedData[m]);
1036
- temp.unshift(splitedData[m]);
1037
- }
1038
- }
1039
-
1040
- k = -1;
1041
- continue;
1042
- }
1043
- if (phs[k].indexOf('ph') == -1) {
1044
- let url = structure[temp[k - 1]];
1045
-
1046
- if (
1047
- temp[k - 1] +
1048
- '_doorStyle' +
1049
- element.type +
1050
- 'doorStyle' +
1051
- JSON.stringify(doorStyles.toJS()) in
1052
- structure
1053
- ) {
1054
- if (
1055
- structure[
1056
- temp[k - 1] +
1057
- '_doorStyle' +
1058
- element.type +
1059
- 'doorStyle' +
1060
- JSON.stringify(doorStyles.toJS())
1061
- ] != null
1062
- ) {
1063
- url =
1064
- structure[
1065
- temp[k - 1] +
1066
- '_doorStyle' +
1067
- element.type +
1068
- 'doorStyle' +
1069
- JSON.stringify(doorStyles.toJS())
1070
- ];
1071
- }
1072
- }
1073
- if (typeof url == Array) url = url[0];
1074
-
1075
- let uData = url.split('/');
1076
- uData = uData[uData.length - 1];
1077
- uData = uData.slice(0, -5);
1078
- let datas = uData.split('_');
1079
- uData = datas[1];
1080
-
1081
- for (let i = 2; i < datas.length; i++) {
1082
- uData += '_';
1083
- uData += datas[i];
1084
- }
1085
-
1086
- uData = mainName.replace('main', uData);
1087
- phs[k] = 'ph_' + uData + '_' + phs[k];
1088
- }
1089
- }
1090
- phsArray.push(phs);
1091
- }
1092
- let url = structure[keys[i]];
1093
- let normalMap = '';
1094
- let urlData = url.split('/');
1095
- for (let j = 0; j < element.submodule.size; j++) {
1096
- let replaceUrlData = element.submodule.get(j).split('/');
1097
- if (urlData.includes(replaceUrlData[replaceUrlData.length - 2])) {
1098
- url = element.submodule.get(j);
1099
- break;
1100
- }
1101
- }
1102
-
1103
- for (let j = 0; j < element.normalMap.size; j++) {
1104
- let normalMapData = element.normalMap.get(j).split('/');
1105
- if (urlData.includes(normalMapData[normalMapData.length - 2])) {
1106
- normalMap = element.normalMap.get(j);
1107
- break;
1108
- }
1109
- }
1110
-
1111
- // replace submodule gltf file
1112
- // if (placeholderTree.length > 0) {
1113
- if (phsArray.length > 0) {
1114
- // let loadUrl = dirName + url;
1115
- let loadUrl = url;
1116
-
1117
- if (doorStyles.get(keys[i] + '_gltf') != undefined) {
1118
- loadUrl = doorStyles.get(keys[i] + '_gltf');
1119
- structure[
1120
- keys[i] +
1121
- '_doorStyle' +
1122
- element.type +
1123
- 'doorStyle' +
1124
- JSON.stringify(doorStyles.toJS())
1125
- ] = loadUrl;
1126
- } else {
1127
- structure[
1128
- keys[i] +
1129
- '_doorStyle' +
1130
- element.type +
1131
- 'doorStyle' +
1132
- JSON.stringify(doorStyles.toJS())
1133
- ] = null;
1134
- }
1135
- return loadGLTF(loadUrl)
1136
- .then(
1137
- object => {
1138
- if (normalMap !== '') {
1139
- let normalUrl =
1140
- normalMap.split('.')[0] + '-normal.' + normalMap.split('.')[1];
1141
- let t = loadTexture(normalMap);
1142
- let m = loadTexture(normalUrl);
1143
- let mat2 = new Three.MeshStandardMaterial({
1144
- metalness:
1145
- glossness === 1 ? params.metalness : params.metalness_glossy,
1146
- roughness: glossness || params.roughness
1147
- });
1148
- mat2.map = t;
1149
- mat2.normalMap = m;
1150
- // mat2.envMap = textureCube;
1151
- for (let j = 0; j < object.children.length; j++) {
1152
- if (object.children[j].type === OBJTYPE_MESH) {
1153
- object.children[j].material = mat2;
1154
- object.children[j].receiveShadow = true;
1155
- }
1156
- }
1157
- }
1158
-
1159
- // set Door Style////
1160
- if (doorStyles != null)
1161
- if (doorStyles.get(keys[i]) != undefined) {
1162
- // let normalMap = "catalog/items/doorstyle/" + doorStyles.get(keys[i]);
1163
- let normalMap = doorStyles.get(keys[i]);
1164
- let mat2;
1165
- if (normalMap === '') {
1166
- const examplecolor = new Three.Color(
1167
- parseInt(color.slice(1), 16)
1168
- ).convertLinearToSRGB();
1169
- mat2 = new Three.MeshStandardMaterial({
1170
- color: examplecolor,
1171
- metalness:
1172
- glossness === 1
1173
- ? params.metalness
1174
- : params.metalness_glossy,
1175
- roughness: glossness || params.roughness
1176
- });
1177
- } else {
1178
- let t = loadTexture(normalMap);
1179
- mat2 = new Three.MeshStandardMaterial({
1180
- // NOTE : this is for cabinets (wood) frontface
1181
- metalness: 0.1,
1182
- roughness: 0.5
1183
- // metalness: glossness === 1 ? params.metalness : params.metalness_glossy,
1184
- // roughness: glossness || params.roughness
1185
- });
1186
- mat2.map = t;
1187
- }
1188
- // mat2.envMap = textureCube;
1189
- for (let j = 0; j < object.children.length; j++) {
1190
- if (object.children[j].type === OBJTYPE_MESH) {
1191
- object.children[j].material = mat2;
1192
- object.children[j].receiveShadow = true;
1193
- object.children[j].castShadow = true;
1194
- !object.children[j].name.includes('handle') &&
1195
- addEdgesToMesh(object.children[j]);
1196
- } else if (
1197
- !object.children[j].name.startsWith('ph_') &&
1198
- object.children[j].type === OBJTYPE_GROUP
1199
- ) {
1200
- object.children[j].traverse(prim => {
1201
- prim.material = mat2;
1202
- prim.receiveShadow = true;
1203
- });
1204
- }
1205
- }
1206
- } else {
1207
- let mat2 = new Three.MeshStandardMaterial({
1208
- metalness:
1209
- glossness === 1
1210
- ? params.metalness
1211
- : params.metalness_glossy,
1212
- roughness: glossness || params.roughness
1213
- });
1214
- // mat2.envMap = textureCube;
1215
- for (let j = 0; j < object.children.length; j++) {
1216
- if (object.children[j].type === OBJTYPE_MESH) {
1217
- object.children[j].material = mat2;
1218
- object.children[j].receiveShadow = true;
1219
- }
1220
- }
1221
- }
1222
-
1223
- for (let i = 0; i < phsArray.length; i++) {
1224
- let phs = phsArray[i];
1225
- let parent = objGroup;
1226
- for (let j = 0; j < phs.length; j++) {
1227
- let placeholder = phs[j];
1228
- for (let k = 0; k < parent?.children.length; k++) {
1229
- if (j != phs.length - 1) {
1230
- if (parent.children[k].name == placeholder) {
1231
- parent = parent.children[k].children[0];
1232
- break;
1233
- }
1234
- } else {
1235
- if (parent.children[k].name == placeholder) {
1236
- var tmp = object.clone();
1237
- if (
1238
- placeholder.includes('drawer_door') &&
1239
- placeholder.includes('_handle')
1240
- ) {
1241
- tmp.rotateZ(Math.PI / 2);
1242
- }
1243
- if (
1244
- placeholder.includes('_handle') &&
1245
- tmp.children[0].type === OBJTYPE_MESH
1246
- ) {
1247
- // NOTE: change metalness of handle
1248
- tmp.children[0].material.metalness = 1;
1249
- // handleMaterial.metalness || 0.2;
1250
- tmp.children[0].material.roughness =
1251
- handleMaterial.roughness || 0.1;
1252
- //tmp.children[0].material.map = loadTexture('catalog/areas/area/textures/grass.jpg');
1253
- }
1254
- parent.children[k].add(tmp);
1255
- }
1256
- }
1257
- }
1258
- }
1259
- }
1260
- },
1261
- reason => {
1262
- console.log('loadGLTF failed for reason:', reason);
1263
- }
1264
- )
1265
- .then(() => {
1266
- i++;
1267
- return loadGLTFs(i);
1268
- });
1269
- }
1270
- };
1271
- return loadGLTF(structure['base'])
1272
- .then(
1273
- object => {
1274
- object.name = 'MainObject';
1275
- object.receiveShadow = true;
1276
- objGroup = object;
1277
- if (doorStyles != null)
1278
- if (doorStyles.get('base') != undefined) {
1279
- let normalMap = doorStyles.get('base');
1280
- if (counterTop.uri === undefined) {
1281
- try {
1282
- counterTop = counterTop.toJS();
1283
- } catch (error) {
1284
- console.log(error);
1285
- }
1286
- }
1287
- if (
1288
- counterTop.uri === undefined &&
1289
- layer.toJS().counterTop.uri !== undefined
1290
- ) {
1291
- counterTop.uri = layer.toJS().counterTop.uri;
1292
- }
1293
- let countTopMap = counterTop.uri;
1294
- let interiorMap = doorStyles.get('interior');
1295
- let countT = loadTexture(countTopMap);
1296
- countT.wrapS = Three.RepeatWrapping;
1297
- countT.wrapT = Three.RepeatWrapping;
1298
- countT.repeat.set(1, 1);
1299
- const examplecolor = new Three.Color(
1300
- parseInt(color.slice(1), 16)
1301
- ).convertLinearToSRGB();
1302
- let mat2 = null,
1303
- mat3 = null,
1304
- mat4 = null;
1305
-
1306
- if (normalMap === '') {
1307
- mat2 = new Three.MeshStandardMaterial({
1308
- color: examplecolor,
1309
- metalness:
1310
- glossness === 1 ? params.metalness : params.metalness_glossy,
1311
- roughness: glossness || params.roughness
1312
- });
1313
- } else {
1314
- mat2 = new Three.MeshStandardMaterial({
1315
- // TODO: changes in metalness and roughness of base_main (cabinet wood)
1316
- metalness: 0.1,
1317
- roughness: 0.5
1318
- // metalness: glossness === 1 ? params.metalness : params.metalness_glossy,
1319
- // roughness: glossness || params.roughness
1320
- });
1321
- }
1322
- // mat2.envMap = textureCube;
1323
-
1324
- if (normalMap !== '') {
1325
- let t = loadTexture(normalMap);
1326
- mat2.map = t;
1327
- }
1328
-
1329
- if (normalMap === '') {
1330
- mat3 = new Three.MeshStandardMaterial({
1331
- // color: examplecolor,
1332
- metalness: counterTop.metalness,
1333
- roughness: counterTop.roughness
1334
- });
1335
- } else {
1336
- mat3 = new Three.MeshStandardMaterial({
1337
- // metalness: counterTop.metalness,
1338
- // roughness: counterTop.roughness
1339
- metalness: 0.3,
1340
- roughness: 0.8
1341
- });
1342
- }
1343
- mat3.map = countT;
1344
- // mat3.envMap = textureCube;
1345
- mat4 = new Three.MeshStandardMaterial({
1346
- metalness: params.metalness,
1347
- roughness: params.roughness
1348
- });
1349
- mat4.map = loadTexture(interiorMap);
1350
- for (let j = 0; j < object.children.length; j++) {
1351
- if (object.children[j].name.includes('main')) {
1352
- }
1353
- if (object.children[j].name.includes('countertop')) {
1354
- object.children[j].material = mat3;
1355
- object.children[j].receiveShadow = true;
1356
- object.children[j].castShadow = true;
1357
- addEdgesToMesh(object.children[j]);
1358
- } else if (object.children[j].name.includes('_interior_')) {
1359
- object.children[j].material = mat4;
1360
- } else if (object.children[j].type === OBJTYPE_MESH) {
1361
- object.children[j].material = mat2;
1362
- object.children[j].receiveShadow = true;
1363
- object.children[j].castShadow = true;
1364
- }
1365
- }
1366
- }
1367
- },
1368
- reason => {
1369
- console.log('loadGLTF failed for reason:', reason);
1370
- objGroup = GeomUtils.emptyBoxHolder(newWidth, newHeight, newDepth);
1371
- }
1372
- )
1373
- .then(() => {
1374
- return loadGLTFs(0);
1375
- });
1376
- }
1377
-
1378
- // render 3d appliance function ////////////////////////////////
1379
- export function render3DApplianceItem(
1380
- element,
1381
- layer,
1382
- scene,
1383
- sizeinfo,
1384
- structure_json,
1385
- mode = null
1386
- ) {
1387
- let structure = structure_json;
1388
- let { applianceMaterial } = element;
1389
- if (applianceMaterial.metalness == undefined)
1390
- applianceMaterial = applianceMaterial.toJS();
1391
- let onLoadItem = object => {
1392
- let newAltitude = element.properties.get('altitude').get('_length');
1393
- let newUnit = element.properties.get('altitude').get('_unit') || 'in';
1394
- newAltitude = convert(newAltitude).from(newUnit).to(scene.unit);
1395
-
1396
- let newWidth = element.properties.get('width').get('_length');
1397
- let newWidthUnit = element.properties.get('width').get('_unit') || 'in';
1398
- newWidth = convert(newWidth).from(newWidthUnit).to('in');
1399
-
1400
- let newHeight = element.properties.get('height').get('_length');
1401
- let newHeightUnit = element.properties.get('height').get('_unit') || 'in';
1402
- newHeight = convert(newHeight).from(newHeightUnit).to('in');
1403
-
1404
- let newDepth = element.properties.get('depth').get('_length');
1405
- let newDepthUnit = element.properties.get('depth').get('_unit') || 'in';
1406
- newDepth = convert(newDepth).from(newDepthUnit).to('in');
1407
-
1408
- object.scale.set(
1409
- (100 * newWidth) / sizeinfo.width,
1410
- (100 * newHeight) / sizeinfo.height,
1411
- (100 * newDepth) / sizeinfo.depth
1412
- );
1413
- // Normalize the origin of the object
1414
- let boundingBox = new Three.Box3().setFromObject(object);
1415
- object.userData = boundingBox;
1416
-
1417
- let center = [
1418
- (boundingBox.max.x - boundingBox.min.x) / 2 + boundingBox.min.x,
1419
- (boundingBox.max.y - boundingBox.min.y) / 2 + boundingBox.min.y,
1420
- (boundingBox.max.z - boundingBox.min.z) / 2 + boundingBox.min.z
1421
- ];
1422
- object.position.x -= center[0];
1423
- object.position.y -=
1424
- center[1] - (boundingBox.max.y - boundingBox.min.y) / 2;
1425
- object.position.z -= center[2];
1426
- object.position.y += newAltitude;
1427
-
1428
- object.traverse(obj => {
1429
- if (obj.type === OBJTYPE_MESH) {
1430
- const { name } = obj;
1431
- let texture,
1432
- textureLoader = new Three.TextureLoader();
1433
- if (name.includes('_black')) {
1434
- obj.material.roughness = 0.4;
1435
- obj.material.metalness = 1.0;
1436
- obj.material.color = new Three.Color(0, 0, 0);
1437
- obj.castShadow = true;
1438
- obj.receiveShadow = true;
1439
- return object;
1440
- } else if (name.includes('_wood')) {
1441
- texture = loadTexture('/assets/img/texture/wood.jpg');
1442
- } else if (name.includes('_glass')) {
1443
- // texture = loadTexture('/assets/img/texture/glass.jpg');
1444
- const material = new Three.MeshPhysicalMaterial({
1445
- transparent: true,
1446
- opacity: 0.5,
1447
- roughness: 0,
1448
- transmission: 1,
1449
- thickness: 0.5, // Add refraction!
1450
- transparency: 0.8
1451
- });
1452
- obj.material = material;
1453
- obj.castShadow = true;
1454
- obj.receiveShadow = true;
1455
- return object;
1456
- } else if (name.includes('_steel')) {
1457
- // texture = loadTexture('/assets/img/texture/steel.jpg');
1458
- const material = new Three.MeshPhysicalMaterial({
1459
- roughness: 0.2,
1460
- metalness: 0.5,
1461
- reflectivity: 0.5,
1462
- color: new Three.Color(0xdddddd).convertLinearToSRGB()
1463
- });
1464
- obj.material = material;
1465
- obj.castShadow = true;
1466
- obj.receiveShadow = true;
1467
- return object;
1468
- }
1469
-
1470
- let mat = new Three.MeshStandardMaterial({
1471
- metalness: 0.1,
1472
- roughness: 0.9,
1473
- map: texture
1474
- });
1475
- obj.material = mat;
1476
- }
1477
- });
1478
-
1479
- if (element.selected) {
1480
- // if object is selected
1481
- // save object transform info///
1482
- let scalevec = new Three.Vector3(
1483
- object.scale.x,
1484
- object.scale.y,
1485
- object.scale.z
1486
- );
1487
- let posVec = new Three.Vector3(
1488
- object.position.x,
1489
- object.position.y,
1490
- object.position.z
1491
- );
1492
-
1493
- object.scale.set(
1494
- (1 * newWidth) / sizeinfo.width,
1495
- (1 * newHeight) / sizeinfo.height,
1496
- (1 * newDepth) / sizeinfo.depth
1497
- );
1498
- object.position.set(0, 0, 0);
1499
- object.rotation.set(0, 0, 0);
1500
- let boundingBox = new Three.Box3().setFromObject(object);
1501
- let max = boundingBox.max;
1502
- let min = boundingBox.min;
1503
- let radius =
1504
- Math.sqrt(
1505
- (boundingBox.max.x - boundingBox.min.x) *
1506
- (boundingBox.max.x - boundingBox.min.x) +
1507
- (boundingBox.max.z - boundingBox.min.z) *
1508
- (boundingBox.max.z - boundingBox.min.z)
1509
- ) / 2;
1510
- let moveBox = new Three.BoxGeometry(
1511
- max.x - min.x,
1512
- max.y - min.y,
1513
- max.z - min.z
1514
- );
1515
-
1516
- // translate Object
1517
- let controlGeom = GeomUtils.controlGeom();
1518
- // ////////////////////////
1519
-
1520
- // rotate Object //////////
1521
- let rotGeom = GeomUtils.rotGeoms(radius + 0.05);
1522
- // //////////////////////////////////
1523
-
1524
- // upwards Geometry/////////// Move up Object
1525
- let upwardsGeom = GeomUtils.upwardsGeom();
1526
- // ///////////////////////////////////////
1527
-
1528
- // vertical line - 4 lines around object//////////////////////////
1529
- let vLineGeom = new Three.BufferGeometry();
1530
- let vertices = [
1531
- (max.x - min.x) / 2 + min.x,
1532
- 0,
1533
- min.z,
1534
- (max.x - min.x) / 2 + min.x,
1535
- 0,
1536
- min.z + 1.3
1537
- ];
1538
-
1539
- vLineGeom.setAttribute(
1540
- 'position',
1541
- new Three.BufferAttribute(new Float32Array(vertices), 3)
1542
- );
1543
-
1544
- let vLineGeom1 = new Three.BufferGeometry();
1545
-
1546
- let vertices1 = [
1547
- (max.x - min.x) / 2 + min.x,
1548
- 0,
1549
- min.z,
1550
- (max.x - min.x) / 2 + min.x,
1551
- 0,
1552
- min.z - 1.3
1553
- ];
1554
-
1555
- vLineGeom1.setAttribute(
1556
- 'position',
1557
- new Three.BufferAttribute(new Float32Array(vertices1), 3)
1558
- );
1559
-
1560
- let vLineGeom2 = new Three.BufferGeometry();
1561
- let vertices2 = [
1562
- max.x,
1563
- 0,
1564
- max.z - (max.z - min.z) / 2,
1565
- max.x + 1.3,
1566
- 0,
1567
- max.z - (max.z - min.z) / 2
1568
- ];
1569
-
1570
- vLineGeom1.setAttribute(
1571
- 'position',
1572
- new Three.BufferAttribute(new Float32Array(vertices2), 3)
1573
- );
1574
-
1575
- let vLineGeom3 = new Three.BufferGeometry();
1576
- let vertices3 = [
1577
- min.x,
1578
- 0,
1579
- max.z - (max.z - min.z) / 2,
1580
- min.x - 1.3,
1581
- 0,
1582
- max.z - (max.z - min.z) / 2
1583
- ];
1584
-
1585
- vLineGeom1.setAttribute(
1586
- 'position',
1587
- new Three.BufferAttribute(new Float32Array(vertices3), 3)
1588
- );
1589
- // ///////////////////////////////////////
1590
-
1591
- // set names of transform object
1592
- let rotFillObj = new Three.Mesh(
1593
- rotGeom.rotFill,
1594
- new Three.MeshPhongMaterial({
1595
- color: 0x000000,
1596
- side: Three.DoubleSide,
1597
- colorWrite: true
1598
- })
1599
- );
1600
- let rotStrokeObj = new Three.Line(
1601
- rotGeom.rotStroke,
1602
- new Three.LineBasicMaterial({ color: 0xffffff, colorWrite: true })
1603
- );
1604
- rotFillObj.name = 'rotate';
1605
-
1606
- let upObj = new Three.Mesh(
1607
- upwardsGeom,
1608
- new Three.MeshBasicMaterial({ color: 0xffffff, side: Three.DoubleSide })
1609
- );
1610
- upObj.name = 'transUp';
1611
-
1612
- let mBox = new Three.Mesh(
1613
- moveBox,
1614
- new Three.MeshBasicMaterial({
1615
- color: new Three.Color(0xdd6699).convertLinearToSRGB(),
1616
- side: Three.DoubleSide,
1617
- transparent: true,
1618
- opacity: 0.4
1619
- })
1620
- );
1621
-
1622
- let color = new Three.Color(ARROW_COLOR).convertLinearToSRGB();
1623
- let vLine = new Three.Line(
1624
- vLineGeom,
1625
- new Three.LineBasicMaterial({ color })
1626
- );
1627
- let vLine1 = new Three.Line(
1628
- vLineGeom1,
1629
- new Three.LineBasicMaterial({ color })
1630
- );
1631
- let vLine2 = new Three.Line(
1632
- vLineGeom2,
1633
- new Three.LineBasicMaterial({ color })
1634
- );
1635
- let vLine3 = new Three.Line(
1636
- vLineGeom3,
1637
- new Three.LineBasicMaterial({ color })
1638
- );
1639
-
1640
- vLine.renderOrder = 1;
1641
- vLine1.renderOrder = 1;
1642
- vLine2.renderOrder = 1;
1643
- vLine3.renderOrder = 1;
1644
- vLine.material.transparent = true;
1645
- vLine1.material.transparent = true;
1646
- vLine2.material.transparent = true;
1647
- vLine3.material.transparent = true;
1648
- vLine.material.depthTest = false;
1649
- vLine1.material.depthTest = false;
1650
- vLine2.material.depthTest = false;
1651
- vLine3.material.depthTest = false;
1652
- // translate vector to center of object
1653
- let uVec = new Three.Vector3(
1654
- -posVec.x / scalevec.x,
1655
- -posVec.y / scalevec.y,
1656
- -posVec.z / scalevec.z
1657
- );
1658
-
1659
- vLine.translateY(0.1);
1660
- vLine1.translateY(0.1);
1661
- vLine2.translateY(0.1);
1662
- vLine3.translateY(0.1);
1663
-
1664
- upObj.translateOnAxis(uVec, 1);
1665
- upObj.translateY(max.y - min.y + 0.05);
1666
-
1667
- mBox.name = 'TransformBox';
1668
- mBox.translateOnAxis(
1669
- new Three.Vector3(uVec.x, uVec.y + (max.y - min.y) / 2, uVec.z),
1670
- 1
1671
- );
1672
- mBox.scale.set(1.01, 1.01, 1.01);
1673
-
1674
- // other side rotate object
1675
- let rotFillObj1 = rotFillObj.clone();
1676
- let rotStrokeObj1 = rotStrokeObj.clone();
1677
- rotFillObj1.rotateY(Math.PI);
1678
- rotStrokeObj1.rotateY(Math.PI);
1679
- rotFillObj.translateY(0.1);
1680
- rotFillObj1.translateY(0.1);
1681
- rotStrokeObj.translateY(0.1);
1682
- rotStrokeObj1.translateY(0.1);
1683
-
1684
- // assets Objects group includes rotate objects...
1685
- let asrtObj = new Three.Group();
1686
- // asrtObj.add(rotFillObj);
1687
- // asrtObj.add(rotFillObj1);
1688
- // asrtObj.add(rotStrokeObj);
1689
- // asrtObj.add(rotStrokeObj1);
1690
- asrtObj.add(vLine);
1691
- asrtObj.add(vLine1);
1692
- asrtObj.add(vLine2);
1693
- asrtObj.add(vLine3);
1694
- mBox.visible = false;
1695
- asrtObj.add(mBox);
1696
- asrtObj.scale.set(1 / object.scale.x, object.scale.y, 1 / object.scale.z);
1697
- // asrtObj.translateY(newAltitude / scalevec.y);
1698
- asrtObj.name = 'TransformGizmo';
1699
- // add assets Objects Group
1700
- object.add(asrtObj);
1701
-
1702
- // recover objects transform
1703
- object.position.x = posVec.x;
1704
- object.position.y = posVec.y;
1705
- object.position.z = posVec.z;
1706
- object.scale.set(scalevec.x, scalevec.y, scalevec.z);
1707
- }
1708
-
1709
- return object;
1710
- };
1711
-
1712
- // keys in structure
1713
- let keys = Object.keys(structure);
1714
-
1715
- // if exist in cached Objects
1716
- if (element.type in cachedObject) {
1717
- let objGroup = cachedObject[element.type].clone();
1718
- return Promise.resolve(onLoadItem(objGroup.clone()));
1719
- }
1720
-
1721
- // base Object/////
1722
- let objGroup = null;
1723
-
1724
- let loadGLTFs = function (i) {
1725
- if (i === keys.length) {
1726
- // if end of keys
1727
- cachedObject[element.type] = objGroup.clone(); //register to cachedObject
1728
- return onLoadItem(cachedObject[element.type].clone());
1729
- }
1730
- if (keys[i] === 'base') {
1731
- // if base Objects
1732
- i++;
1733
- return loadGLTFs(i);
1734
- }
1735
- };
1736
-
1737
- // load base to start //
1738
- // return loadGLTF(dirName + structure["base"])
1739
- return loadGLTF(structure['base'])
1740
- .then(
1741
- object => {
1742
- // let textureURL = `${API_SERVER_URL}/uploads/assets/default/steel.jpg`;
1743
- // let texture = loadTexture(textureURL);
1744
- // texture.wrapS = Three.MirroredRepeatWrapping;
1745
- // texture.wrapT = Three.MirroredRepeatWrapping;
1746
-
1747
- object.name = 'MainObject';
1748
- // NOTE: changed appliance emissive color to black
1749
- let mat2 = new Three.MeshStandardMaterial({
1750
- emissive: new Three.Color(0x0d0d0d).convertLinearToSRGB(),
1751
- metalness: applianceMaterial.metalness,
1752
- roughness: applianceMaterial.roughness
1753
- });
1754
- // mat2.envMap = textureCube;
1755
- object.material = mat2;
1756
-
1757
- for (let j = 0; j < object.children.length; j++) {
1758
- if (object.children[j].type === OBJTYPE_MESH) {
1759
- object.children[j].material = mat2;
1760
- object.children[j].receiveShadow = true;
1761
- object.children[j].castShadow = true; // change
1762
- }
1763
- }
1764
- objGroup = object;
1765
- },
1766
- reason => {
1767
- console.log('loadGLTF failed for reason:', reason);
1768
- objGroup = GeomUtils.emptyBoxHolder(newWidth, newHeight, newDepth);
1769
- }
1770
- )
1771
- .then(() => {
1772
- return loadGLTFs(0);
1773
- });
1774
- }
1775
- // render 3d appliance function ////////////////////////////////
1776
- export function render3DLightingItem(
1777
- element,
1778
- layer,
1779
- scene,
1780
- sizeinfo,
1781
- structure_json,
1782
- mode = null
1783
- ) {
1784
- let structure = structure_json;
1785
- let onLoadItem = object => {
1786
- let width = { length: sizeinfo.width, unit: 'in' };
1787
- let depth = { length: sizeinfo.depth, unit: 'in' };
1788
- let height = { length: sizeinfo.height, unit: 'in' };
1789
- let newWidth = convert(width.length).from(width.unit).to('cm');
1790
- let newDepth = convert(depth.length).from(depth.unit).to('cm');
1791
- let newHeight = convert(height.length).from(height.unit).to('cm');
1792
-
1793
- let newAltitude = element.properties.get('altitude').get('_length');
1794
- let newUnit = element.properties.get('altitude').get('_unit') || 'in';
1795
- newAltitude = convert(newAltitude).from(newUnit).to(scene.unit);
1796
-
1797
- //object.scale.set(newWidth, newHeight, newDepth);
1798
- object.scale.set(100, 100, 100);
1799
- // Normalize the origin of the object
1800
- let boundingBox = new Three.Box3().setFromObject(object);
1801
- object.userData = boundingBox;
1802
-
1803
- let objectHeight = boundingBox.max.y - boundingBox.min.y;
1804
- let objectYPos = boundingBox.min.y;
1805
-
1806
- let center = [
1807
- (boundingBox.max.x - boundingBox.min.x) / 2 + boundingBox.min.x,
1808
- (boundingBox.max.y - boundingBox.min.y) / 2 + boundingBox.min.y,
1809
- (boundingBox.max.z - boundingBox.min.z) / 2 + boundingBox.min.z
1810
- ];
1811
-
1812
- object.position.x = center[0];
1813
- object.position.y = newHeight + newAltitude - boundingBox.max.y;
1814
- object.position.z = center[2];
1815
-
1816
- if (element.selected) {
1817
- // if object is selected
1818
- // save object transform info///
1819
- let scalevec = new Three.Vector3(
1820
- object.scale.x,
1821
- object.scale.y,
1822
- object.scale.z
1823
- );
1824
- let posVec = new Three.Vector3(
1825
- object.position.x,
1826
- object.position.y,
1827
- object.position.z
1828
- );
1829
-
1830
- object.scale.set(1, 1, 1);
1831
- object.position.set(0, 0, 0);
1832
- object.rotation.set(0, 0, 0);
1833
-
1834
- //let box = new Three.BoxHelper(object, 0xffffff);
1835
- //box.material.lineWidth = 5;
1836
- //box.renderOrder = 1000;
1837
- //box.material.depthTest = false;
1838
- //object.add(box);
1839
- let boundingBox = new Three.Box3().setFromObject(object);
1840
- let max = boundingBox.max;
1841
- let min = boundingBox.min;
1842
- let radius =
1843
- Math.sqrt(
1844
- (boundingBox.max.x - boundingBox.min.x) *
1845
- (boundingBox.max.x - boundingBox.min.x) +
1846
- (boundingBox.max.z - boundingBox.min.z) *
1847
- (boundingBox.max.z - boundingBox.min.z)
1848
- ) / 2;
1849
- let moveBox = new Three.BoxGeometry(
1850
- max.x - min.x,
1851
- max.y - min.y,
1852
- max.z - min.z
1853
- );
1854
-
1855
- // translate Object
1856
- let controlGeom = GeomUtils.controlGeom();
1857
-
1858
- // rotate Object //////////
1859
- let rotGeom = GeomUtils.rotGeoms(radius + 0.05);
1860
- // //////////////////////////////////
1861
-
1862
- // upwards Geometry/////////// Move up Object
1863
- let upwardsGeom = GeomUtils.upwardsGeom();
1864
-
1865
- // vertical line - 4 lines around object//////////////////////////
1866
- let vLineGeom = new Three.BufferGeometry();
1867
- let vertices = [
1868
- (max.x - min.x) / 2 + min.x,
1869
- 0,
1870
- min.z,
1871
- (max.x - min.x) / 2 + min.x,
1872
- 0,
1873
- min.z + 1.3
1874
- ];
1875
-
1876
- vLineGeom.setAttribute(
1877
- 'position',
1878
- new Three.BufferAttribute(new Float32Array(vertices), 3)
1879
- );
1880
-
1881
- let vLineGeom1 = new Three.BufferGeometry();
1882
- let vertices1 = [
1883
- (max.x - min.x) / 2 + min.x,
1884
- 0,
1885
- min.z,
1886
- (max.x - min.x) / 2 + min.x,
1887
- 0,
1888
- min.z - 1.3
1889
- ];
1890
-
1891
- vLineGeom1.setAttribute(
1892
- 'position',
1893
- new Three.BufferAttribute(new Float32Array(vertices1), 3)
1894
- );
1895
-
1896
- let vLineGeom2 = new Three.BufferGeometry();
1897
- let vertices2 = [
1898
- min.x,
1899
- 0,
1900
- max.z - (max.z - min.z) / 2,
1901
- min.x + 1.3,
1902
- 0,
1903
- max.z - (max.z - min.z) / 2
1904
- ];
1905
-
1906
- vLineGeom2.setAttribute(
1907
- 'position',
1908
- new Three.BufferAttribute(new Float32Array(vertices2), 3)
1909
- );
1910
-
1911
- let vLineGeom3 = new Three.BufferGeometry();
1912
- let vertices3 = [
1913
- min.x,
1914
- 0,
1915
- max.z - (max.z - min.z) / 2,
1916
- min.x - 1.3,
1917
- 0,
1918
- max.z - (max.z - min.z) / 2
1919
- ];
1920
-
1921
- vLineGeom3.setAttribute(
1922
- 'position',
1923
- new Three.BufferAttribute(new Float32Array(vertices3), 3)
1924
- );
1925
- // ///////////////////////////////////////
1926
-
1927
- // set names of transform object
1928
- let rotFillObj = new Three.Mesh(
1929
- rotGeom.rotFill,
1930
- new Three.MeshPhongMaterial({
1931
- color: 0x000000,
1932
- side: Three.DoubleSide,
1933
- colorWrite: true
1934
- })
1935
- );
1936
- let rotStrokeObj = new Three.Line(
1937
- rotGeom.rotStroke,
1938
- new Three.LineBasicMaterial({ color: 0xffffff, colorWrite: true })
1939
- );
1940
- rotFillObj.name = 'rotate';
1941
-
1942
- let upObj = new Three.Mesh(
1943
- upwardsGeom,
1944
- new Three.MeshBasicMaterial({ color: 0xffffff, side: Three.DoubleSide })
1945
- );
1946
- upObj.name = 'transUp';
1947
-
1948
- let mBox = new Three.Mesh(
1949
- moveBox,
1950
- new Three.MeshBasicMaterial({
1951
- color: 0xdd6699,
1952
- side: Three.DoubleSide,
1953
- transparent: true,
1954
- opacity: 0.4
1955
- })
1956
- );
1957
-
1958
- let color = new Three.Color(ARROW_COLOR).convertLinearToSRGB();
1959
- let vLine = new Three.Line(
1960
- vLineGeom,
1961
- new Three.LineBasicMaterial({ color })
1962
- );
1963
- let vLine1 = new Three.Line(
1964
- vLineGeom1,
1965
- new Three.LineBasicMaterial({ color })
1966
- );
1967
- let vLine2 = new Three.Line(
1968
- vLineGeom2,
1969
- new Three.LineBasicMaterial({ color })
1970
- );
1971
- let vLine3 = new Three.Line(
1972
- vLineGeom3,
1973
- new Three.LineBasicMaterial({ color })
1974
- );
1975
- vLine.renderOrder = 1;
1976
- vLine1.renderOrder = 1;
1977
- vLine2.renderOrder = 1;
1978
- vLine3.renderOrder = 1;
1979
- vLine.material.transparent = true;
1980
- vLine1.material.transparent = true;
1981
- vLine2.material.transparent = true;
1982
- vLine3.material.transparent = true;
1983
- vLine.material.depthTest = false;
1984
- vLine1.material.depthTest = false;
1985
- vLine2.material.depthTest = false;
1986
- vLine3.material.depthTest = false;
1987
- // translate vector to center of object
1988
- let uVec = new Three.Vector3(
1989
- -posVec.x / scalevec.x,
1990
- -posVec.y / scalevec.y,
1991
- -posVec.z / scalevec.z
1992
- );
1993
-
1994
- vLine.translateY(1.6);
1995
- vLine1.translateY(1.6);
1996
- vLine2.translateY(1.6);
1997
- vLine3.translateY(1.6);
1998
-
1999
- //rotObj.translateOnAxis(uVec, 1);
2000
- upObj.translateOnAxis(uVec, 1);
2001
- upObj.translateY(max.y - min.y);
2002
-
2003
- mBox.name = 'TransformBox';
2004
- mBox.translateOnAxis(
2005
- new Three.Vector3(uVec.x, uVec.y + (max.y - min.y) / 2, uVec.z),
2006
- 1
2007
- );
2008
- mBox.scale.set(1.01, 1.01, 1.01);
2009
-
2010
- // other side rotate object
2011
- let rotFillObj1 = rotFillObj.clone();
2012
- let rotStrokeObj1 = rotStrokeObj.clone();
2013
- rotFillObj1.rotateY(Math.PI);
2014
- rotStrokeObj1.rotateY(Math.PI);
2015
- rotFillObj.translateY(1.6);
2016
- rotFillObj1.translateY(1.6);
2017
- rotStrokeObj.translateY(1.6);
2018
- rotStrokeObj1.translateY(1.6);
2019
-
2020
- // assets Objects group includes rotate objects...
2021
- let asrtObj = new Three.Group();
2022
- // asrtObj.add(rotFillObj);
2023
- // asrtObj.add(rotFillObj1);
2024
- // asrtObj.add(rotStrokeObj);
2025
- // asrtObj.add(rotStrokeObj1);
2026
- //asrtObj.add(upObj);
2027
- asrtObj.add(vLine);
2028
- asrtObj.add(vLine1);
2029
- asrtObj.add(vLine2);
2030
- asrtObj.add(vLine3);
2031
- mBox.visible = false;
2032
- asrtObj.add(mBox);
2033
- asrtObj.scale.set(1, 1, 1);
2034
- //asrtObj.translateY(newAltitude / scalevec.y);
2035
- asrtObj.name = 'TransformGizmo';
2036
- // add assets Objects Group
2037
- object.add(asrtObj);
2038
-
2039
- // recover objects transform
2040
- object.position.x = posVec.x;
2041
- object.position.y = posVec.y;
2042
- object.position.z = posVec.z;
2043
- object.scale.set(scalevec.x, scalevec.y, scalevec.z);
2044
- setTimeout(() => {
2045
- SceneCreator.getDistances(layer);
2046
- }, 100);
2047
- }
2048
- return object;
2049
- };
2050
-
2051
- // keys in structure
2052
- let keys = Object.keys(structure);
2053
-
2054
- // if exist in cached Objects
2055
- if (element.type in cachedObject) {
2056
- let objGroup = cachedObject[element.type].clone();
2057
- return Promise.resolve(onLoadItem(objGroup.clone()));
2058
- }
2059
-
2060
- // base Object/////
2061
- let objGroup = null;
2062
-
2063
- let loadGLTFs = function (i) {
2064
- if (i === keys.length) {
2065
- // if end of keys
2066
- cachedObject[element.type] = objGroup.clone(); //register to cachedObject
2067
- return onLoadItem(cachedObject[element.type].clone());
2068
- }
2069
- if (keys[i] === 'base') {
2070
- // if base Objects
2071
- i++;
2072
- return loadGLTFs(i);
2073
- }
2074
- };
2075
-
2076
- // load base to start //
2077
- // return loadGLTF(dirName + structure["base"])
2078
- return loadGLTF(structure['base'])
2079
- .then(
2080
- object => {
2081
- // let textureURL = `${API_SERVER_URL}/uploads/assets/default/steel.jpg`;
2082
- // let texture = loadTexture(textureURL);
2083
- // texture.wrapS = Three.MirroredRepeatWrapping;
2084
- // texture.wrapT = Three.MirroredRepeatWrapping;
2085
-
2086
- object.name = 'MainObject';
2087
- let mat2 = new Three.MeshStandardMaterial({
2088
- emissive: new Three.Color(0x666666).convertLinearToSRGB(),
2089
- metalness: 0.7,
2090
- roughness: 0.3
2091
- });
2092
- // mat2.envMap = textureCube;
2093
- object.material = mat2;
2094
-
2095
- for (let j = 0; j < object.children.length; j++) {
2096
- if (object.children[j].type === OBJTYPE_MESH) {
2097
- object.children[j].material = mat2;
2098
- object.children[j].receiveShadow = true;
2099
- }
2100
- }
2101
- objGroup = object;
2102
- },
2103
- reason => {
2104
- console.log('loadGLTF failed for reason:', reason);
2105
- objGroup = GeomUtils.emptyBoxHolder(newWidth, newHeight, newDepth);
2106
- }
2107
- )
2108
- .then(() => {
2109
- return loadGLTFs(0);
2110
- });
2111
- }
2112
-
2113
- export function addEdgesToMesh(inChild) {
2114
- let boxEdge = new Three.EdgesGeometry(inChild.geometry, 10);
2115
- let boxEdgeMaterial = new Three.LineBasicMaterial({
2116
- color: 0x000000,
2117
- transparent: true,
2118
- opacity: 0.09
2119
- });
2120
- let boxEdgeLine = new Three.LineSegments(boxEdge, boxEdgeMaterial);
2121
- // inChild.add(boxEdgeLine);
2122
- }