kitchen-simulator 1.1.1-test.48 → 1.1.1-test.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/KitchenConfiguratorApp.js +3 -0
- package/package.json +1 -1
- package/es/@history.js +0 -2
- package/es/AppContext.js +0 -3
- package/es/KitchenConfigurator.js +0 -645
- package/es/KitchenConfiguratorApp.js +0 -478
- package/es/actions/area-actions.js +0 -14
- package/es/actions/export.js +0 -23
- package/es/actions/groups-actions.js +0 -89
- package/es/actions/holes-actions.js +0 -119
- package/es/actions/items-actions.js +0 -313
- package/es/actions/lines-actions.js +0 -81
- package/es/actions/project-actions.js +0 -281
- package/es/actions/scene-actions.js +0 -33
- package/es/actions/vertices-actions.js +0 -27
- package/es/actions/viewer2d-actions.js +0 -58
- package/es/actions/viewer3d-actions.js +0 -23
- package/es/catalog/areas/area/planner-element.js +0 -40
- package/es/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
- package/es/catalog/areas/area/textures/grass.jpg +0 -0
- package/es/catalog/areas/area/textures/parquet.jpg +0 -0
- package/es/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
- package/es/catalog/areas/area/textures/tile1.jpg +0 -0
- package/es/catalog/catalog.js +0 -277
- package/es/catalog/envMap/nx.hdr +0 -0
- package/es/catalog/envMap/ny.hdr +0 -0
- package/es/catalog/envMap/nz.hdr +0 -0
- package/es/catalog/envMap/px.hdr +0 -0
- package/es/catalog/envMap/py.hdr +0 -0
- package/es/catalog/envMap/pz.hdr +0 -0
- package/es/catalog/factories/area-factory-3d.js +0 -181
- package/es/catalog/factories/area-factory.js +0 -81
- package/es/catalog/factories/export.js +0 -7
- package/es/catalog/factories/wall-factory-3d.js +0 -202
- package/es/catalog/factories/wall-factory.js +0 -268
- package/es/catalog/holes/door-closet/planner-element.js +0 -222
- package/es/catalog/holes/door-double/door_double.png +0 -0
- package/es/catalog/holes/door-double/planner-element.js +0 -315
- package/es/catalog/holes/door-exterior/planner-element.js +0 -215
- package/es/catalog/holes/door-interior/planner-element.js +0 -227
- package/es/catalog/holes/door-panic/panicDoor.png +0 -0
- package/es/catalog/holes/door-panic/planner-element.js +0 -503
- package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
- package/es/catalog/holes/door-panic-double/planner-element.js +0 -463
- package/es/catalog/holes/door-sliding/planner-element.js +0 -225
- package/es/catalog/holes/doorway-framed/planner-element.js +0 -145
- package/es/catalog/holes/doorway-frameless/planner-element.js +0 -104
- package/es/catalog/holes/export.js +0 -13
- package/es/catalog/holes/gate/gate.jpg +0 -0
- package/es/catalog/holes/window-clear/planner-element.js +0 -166
- package/es/catalog/holes/window-clear/texture.png +0 -0
- package/es/catalog/holes/window-cross/planner-element.js +0 -165
- package/es/catalog/holes/window-cross/texture.png +0 -0
- package/es/catalog/holes/window-double-hung/planner-element.js +0 -303
- package/es/catalog/holes/window-double-hung/texture.png +0 -0
- package/es/catalog/holes/window-vertical/planner-element.js +0 -276
- package/es/catalog/holes/window-vertical/texture.png +0 -0
- package/es/catalog/lines/wall/planner-element.js +0 -70
- package/es/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster.jpg +0 -0
- package/es/catalog/lines/wall/wall.png +0 -0
- package/es/catalog/molding/molding-dcm/planner-element.js +0 -28
- package/es/catalog/molding/molding-dcm/texture.png +0 -0
- package/es/catalog/molding/molding-fbm/planner-element.js +0 -28
- package/es/catalog/molding/molding-fbm/texture.png +0 -0
- package/es/catalog/molding/molding-lrm/planner-element.js +0 -28
- package/es/catalog/molding/molding-lrm/texture.png +0 -0
- package/es/catalog/properties/export.js +0 -21
- package/es/catalog/properties/property-checkbox.js +0 -116
- package/es/catalog/properties/property-color.js +0 -39
- package/es/catalog/properties/property-enum.js +0 -97
- package/es/catalog/properties/property-hidden.js +0 -19
- package/es/catalog/properties/property-lenght-measure.js +0 -101
- package/es/catalog/properties/property-length-measure.js +0 -134
- package/es/catalog/properties/property-length-measure_hole.js +0 -101
- package/es/catalog/properties/property-number.js +0 -48
- package/es/catalog/properties/property-read-only.js +0 -26
- package/es/catalog/properties/property-string.js +0 -48
- package/es/catalog/properties/property-toggle.js +0 -39
- package/es/catalog/properties/shared-property-style.js +0 -14
- package/es/catalog/utils/FuseUtils.js +0 -82
- package/es/catalog/utils/exporter.js +0 -148
- package/es/catalog/utils/geom-utils.js +0 -189
- package/es/catalog/utils/item-loader.js +0 -1521
- package/es/catalog/utils/load-obj.js +0 -91
- package/es/catalog/utils/mtl-loader.js +0 -358
- package/es/catalog/utils/obj-loader.js +0 -477
- package/es/class/FuseUtils.js +0 -82
- package/es/class/area.js +0 -145
- package/es/class/export.js +0 -24
- package/es/class/group.js +0 -440
- package/es/class/guide.js +0 -62
- package/es/class/hole.js +0 -929
- package/es/class/item.js +0 -1883
- package/es/class/layer.js +0 -667
- package/es/class/line.js +0 -1180
- package/es/class/project.js +0 -793
- package/es/class/vertex.js +0 -202
- package/es/components/content.js +0 -107
- package/es/components/disclaimer/disclaimer.js +0 -97
- package/es/components/export.js +0 -9
- package/es/components/style/button.js +0 -113
- package/es/components/style/cancel-button.js +0 -22
- package/es/components/style/content-container.js +0 -33
- package/es/components/style/content-title.js +0 -29
- package/es/components/style/delete-button.js +0 -25
- package/es/components/style/export.js +0 -31
- package/es/components/style/form-block.js +0 -24
- package/es/components/style/form-color-input.js +0 -27
- package/es/components/style/form-label.js +0 -26
- package/es/components/style/form-number-input.js +0 -213
- package/es/components/style/form-number-input_2.js +0 -206
- package/es/components/style/form-select.js +0 -68
- package/es/components/style/form-slider.js +0 -61
- package/es/components/style/form-submit-button.js +0 -26
- package/es/components/style/form-text-input.js +0 -95
- package/es/components/viewer2d/area.js +0 -81
- package/es/components/viewer2d/export.js +0 -31
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +0 -37
- package/es/components/viewer2d/grids/grid-streak.js +0 -37
- package/es/components/viewer2d/grids/grid-vertical-streak.js +0 -37
- package/es/components/viewer2d/grids/grids.js +0 -35
- package/es/components/viewer2d/group.js +0 -53
- package/es/components/viewer2d/item.js +0 -513
- package/es/components/viewer2d/layer.js +0 -164
- package/es/components/viewer2d/line.js +0 -882
- package/es/components/viewer2d/ruler.js +0 -100
- package/es/components/viewer2d/rulerDist.js +0 -146
- package/es/components/viewer2d/rulerX.js +0 -151
- package/es/components/viewer2d/rulerY.js +0 -153
- package/es/components/viewer2d/scene.js +0 -140
- package/es/components/viewer2d/snap.js +0 -74
- package/es/components/viewer2d/state.js +0 -78
- package/es/components/viewer2d/utils.js +0 -198
- package/es/components/viewer2d/vertex.js +0 -65
- package/es/components/viewer2d/viewer2d.js +0 -1398
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -2592
- package/es/components/viewer3d/dcm.js +0 -401
- package/es/components/viewer3d/fbm.js +0 -414
- package/es/components/viewer3d/front3D.js +0 -66
- package/es/components/viewer3d/grid-creator.js +0 -25
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +0 -36
- package/es/components/viewer3d/grids/grid-streak.js +0 -27
- package/es/components/viewer3d/grids/grid-vertical-streak.js +0 -36
- package/es/components/viewer3d/libs/first-person-controls.js +0 -67
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1281
- package/es/components/viewer3d/libs/mtl-loader.js +0 -357
- package/es/components/viewer3d/libs/obj-loader.js +0 -462
- package/es/components/viewer3d/libs/orbit-controls.js +0 -699
- package/es/components/viewer3d/libs/pointer-lock-controls.js +0 -46
- package/es/components/viewer3d/lrm.js +0 -305
- package/es/components/viewer3d/model.js +0 -708
- package/es/components/viewer3d/pointer-lock-navigation.js +0 -115
- package/es/components/viewer3d/ruler-utils/itemRect.js +0 -61
- package/es/components/viewer3d/ruler-utils/layer3D.js +0 -495
- package/es/components/viewer3d/ruler-utils/ruler3D.js +0 -227
- package/es/components/viewer3d/ruler-utils/scene3D.js +0 -60
- package/es/components/viewer3d/ruler-utils/state3D.js +0 -18
- package/es/components/viewer3d/scene-creator.js +0 -3608
- package/es/components/viewer3d/three-memory-cleaner.js +0 -51
- package/es/components/viewer3d/viewer3d-first-person.js +0 -315
- package/es/components/viewer3d/viewer3d.js +0 -2527
- package/es/constants.js +0 -636
- package/es/index.js +0 -16
- package/es/models.js +0 -510
- package/es/plugins/SVGLoader.js +0 -1412
- package/es/plugins/autosave.js +0 -33
- package/es/plugins/console-debugger.js +0 -37
- package/es/plugins/export.js +0 -9
- package/es/plugins/keyboard.js +0 -101
- package/es/reducers/areas-reducer.js +0 -12
- package/es/reducers/export.js +0 -25
- package/es/reducers/groups-reducer.js +0 -38
- package/es/reducers/holes-reducer.js +0 -62
- package/es/reducers/items-reducer.js +0 -140
- package/es/reducers/lines-reducer.js +0 -45
- package/es/reducers/project-reducer.js +0 -129
- package/es/reducers/reducer.js +0 -19
- package/es/reducers/scene-reducer.js +0 -28
- package/es/reducers/user-reducer.js +0 -40
- package/es/reducers/vertices-reducer.js +0 -19
- package/es/reducers/viewer2d-reducer.js +0 -75
- package/es/reducers/viewer3d-reducer.js +0 -56
- package/es/shared-style.js +0 -66
- package/es/styles/export.js +0 -5
- package/es/styles/tabs.css +0 -40
- package/es/translator/en.js +0 -104
- package/es/translator/it.js +0 -79
- package/es/translator/ru.js +0 -79
- package/es/translator/translator.js +0 -84
- package/es/utils/browser.js +0 -33
- package/es/utils/email-validator.js +0 -4
- package/es/utils/export.js +0 -25
- package/es/utils/geometry.js +0 -2420
- package/es/utils/get-edges-of-subgraphs.js +0 -27
- package/es/utils/graph-cycles.js +0 -237
- package/es/utils/graph-inner-cycles.js +0 -46
- package/es/utils/graph.js +0 -150
- package/es/utils/helper.js +0 -268
- package/es/utils/history.js +0 -29
- package/es/utils/id-broker.js +0 -19
- package/es/utils/logger.js +0 -8
- package/es/utils/math.js +0 -50
- package/es/utils/molding.js +0 -871
- package/es/utils/name-generator.js +0 -18
- package/es/utils/objects-utils.js +0 -50
- package/es/utils/phone-validator.js +0 -4
- package/es/utils/process-black-list.js +0 -18
- package/es/utils/react-if.js +0 -18
- package/es/utils/snap-scene.js +0 -99
- package/es/utils/snap.js +0 -237
- package/es/utils/summarizeCart.js +0 -24
- package/es/utils/threeCSG.es6.js +0 -498
- package/es/version.js +0 -2
- package/lib/catalog/properties/property-string.js +0 -55
- package/lib/catalog/properties/property-toggle.js +0 -46
- package/lib/catalog/properties/shared-property-style.js +0 -20
- package/lib/catalog/utils/FuseUtils.js +0 -88
- package/lib/catalog/utils/exporter.js +0 -155
- package/lib/catalog/utils/geom-utils.js +0 -205
- package/lib/catalog/utils/item-loader.js +0 -1533
- package/lib/catalog/utils/load-obj.js +0 -99
- package/lib/catalog/utils/mtl-loader.js +0 -363
- package/lib/catalog/utils/obj-loader.js +0 -482
- package/lib/class/FuseUtils.js +0 -88
- package/lib/class/area.js +0 -150
- package/lib/class/export.js +0 -96
- package/lib/class/group.js +0 -445
- package/lib/class/guide.js +0 -67
- package/lib/class/hole.js +0 -934
- package/lib/class/item.js +0 -1889
- package/lib/class/layer.js +0 -672
- package/lib/class/line.js +0 -1186
- package/lib/class/project.js +0 -799
- package/lib/class/vertex.js +0 -207
- package/lib/components/content.js +0 -116
- package/lib/components/disclaimer/disclaimer.js +0 -105
- package/lib/components/export.js +0 -33
- package/lib/components/style/button.js +0 -120
- package/lib/components/style/cancel-button.js +0 -29
- package/lib/components/style/content-container.js +0 -40
- package/lib/components/style/content-title.js +0 -37
- package/lib/components/style/delete-button.js +0 -34
- package/lib/components/style/export.js +0 -121
- package/lib/components/style/form-block.js +0 -31
- package/lib/components/style/form-color-input.js +0 -34
- package/lib/components/style/form-label.js +0 -33
- package/lib/components/style/form-number-input.js +0 -220
- package/lib/components/style/form-number-input_2.js +0 -213
- package/lib/components/style/form-select.js +0 -75
- package/lib/components/style/form-slider.js +0 -68
- package/lib/components/style/form-submit-button.js +0 -35
- package/lib/components/style/form-text-input.js +0 -101
- package/lib/components/viewer2d/area.js +0 -88
- package/lib/components/viewer2d/export.js +0 -121
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +0 -44
- package/lib/components/viewer2d/grids/grid-streak.js +0 -44
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +0 -44
- package/lib/components/viewer2d/grids/grids.js +0 -44
- package/lib/components/viewer2d/group.js +0 -62
- package/lib/components/viewer2d/item.js +0 -521
- package/lib/components/viewer2d/layer.js +0 -171
- package/lib/components/viewer2d/line.js +0 -892
- package/lib/components/viewer2d/ruler.js +0 -107
- package/lib/components/viewer2d/rulerDist.js +0 -153
- package/lib/components/viewer2d/rulerX.js +0 -158
- package/lib/components/viewer2d/rulerY.js +0 -160
- package/lib/components/viewer2d/scene.js +0 -147
- package/lib/components/viewer2d/snap.js +0 -83
- package/lib/components/viewer2d/state.js +0 -87
- package/lib/components/viewer2d/utils.js +0 -210
- package/lib/components/viewer2d/vertex.js +0 -74
- package/lib/components/viewer2d/viewer2d.js +0 -1405
- package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -2597
- package/lib/components/viewer3d/dcm.js +0 -407
- package/lib/components/viewer3d/fbm.js +0 -420
- package/lib/components/viewer3d/front3D.js +0 -75
- package/lib/components/viewer3d/grid-creator.js +0 -34
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +0 -44
- package/lib/components/viewer3d/grids/grid-streak.js +0 -35
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +0 -44
- package/lib/components/viewer3d/libs/first-person-controls.js +0 -74
- package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1287
- package/lib/components/viewer3d/libs/mtl-loader.js +0 -363
- package/lib/components/viewer3d/libs/obj-loader.js +0 -468
- package/lib/components/viewer3d/libs/orbit-controls.js +0 -705
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +0 -52
- package/lib/components/viewer3d/lrm.js +0 -311
- package/lib/components/viewer3d/model.js +0 -714
- package/lib/components/viewer3d/pointer-lock-navigation.js +0 -122
- package/lib/components/viewer3d/ruler-utils/itemRect.js +0 -68
- package/lib/components/viewer3d/ruler-utils/layer3D.js +0 -502
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +0 -234
- package/lib/components/viewer3d/ruler-utils/scene3D.js +0 -68
- package/lib/components/viewer3d/ruler-utils/state3D.js +0 -25
- package/lib/components/viewer3d/scene-creator.js +0 -3642
- package/lib/components/viewer3d/three-memory-cleaner.js +0 -60
- package/lib/components/viewer3d/viewer3d-first-person.js +0 -320
- package/lib/components/viewer3d/viewer3d.js +0 -2532
- package/lib/constants.js +0 -645
- package/lib/index.js +0 -96
- package/lib/models.js +0 -517
- package/lib/plugins/SVGLoader.js +0 -1417
- package/lib/plugins/autosave.js +0 -39
- package/lib/plugins/console-debugger.js +0 -44
- package/lib/plugins/export.js +0 -33
- package/lib/plugins/keyboard.js +0 -107
- package/lib/reducers/areas-reducer.js +0 -18
- package/lib/reducers/export.js +0 -97
- package/lib/reducers/groups-reducer.js +0 -44
- package/lib/reducers/holes-reducer.js +0 -68
- package/lib/reducers/items-reducer.js +0 -146
- package/lib/reducers/lines-reducer.js +0 -51
- package/lib/reducers/project-reducer.js +0 -135
- package/lib/reducers/reducer.js +0 -26
- package/lib/reducers/scene-reducer.js +0 -34
- package/lib/reducers/user-reducer.js +0 -46
- package/lib/reducers/vertices-reducer.js +0 -25
- package/lib/reducers/viewer2d-reducer.js +0 -82
- package/lib/reducers/viewer3d-reducer.js +0 -63
- package/lib/shared-style.js +0 -72
- package/lib/styles/export.js +0 -13
- package/lib/translator/en.js +0 -110
- package/lib/translator/it.js +0 -85
- package/lib/translator/ru.js +0 -85
- package/lib/translator/translator.js +0 -90
- package/lib/utils/browser.js +0 -40
- package/lib/utils/email-validator.js +0 -10
- package/lib/utils/export.js +0 -56
- package/lib/utils/geometry.js +0 -2516
- package/lib/utils/get-edges-of-subgraphs.js +0 -34
- package/lib/utils/graph-cycles.js +0 -240
- package/lib/utils/graph-inner-cycles.js +0 -54
- package/lib/utils/graph.js +0 -157
- package/lib/utils/helper.js +0 -291
- package/lib/utils/history.js +0 -36
- package/lib/utils/id-broker.js +0 -25
- package/lib/utils/logger.js +0 -14
- package/lib/utils/math.js +0 -57
- package/lib/utils/molding.js +0 -895
- package/lib/utils/name-generator.js +0 -23
- package/lib/utils/objects-utils.js +0 -60
- package/lib/utils/phone-validator.js +0 -10
- package/lib/utils/process-black-list.js +0 -24
- package/lib/utils/react-if.js +0 -24
- package/lib/utils/snap-scene.js +0 -105
- package/lib/utils/snap.js +0 -249
- package/lib/utils/summarizeCart.js +0 -30
- package/lib/utils/threeCSG.es6.js +0 -503
- package/lib/version.js +0 -8
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import * as Three from 'three';
|
|
2
|
-
import { BoxGeometry, Group, Mesh, MeshBasicMaterial, MeshStandardMaterial, RepeatWrapping, TextureLoader, Vector2 } from 'three';
|
|
3
|
-
import { verticesDistance } from "../../utils/geometry";
|
|
4
|
-
import { isElevationView } from "../../utils/helper";
|
|
5
|
-
import * as SharedStyle from "../../shared-style";
|
|
6
|
-
import { LINE_THICKNESS, UNIT_CENTIMETER } from "../../constants";
|
|
7
|
-
import convert from 'convert-units';
|
|
8
|
-
import ThreeBSP from "../../utils/threeCSG.es6";
|
|
9
|
-
var params = {
|
|
10
|
-
envMap: 'HDR',
|
|
11
|
-
roughness: 0.1,
|
|
12
|
-
metalness: 0.1,
|
|
13
|
-
exposure: 0.1
|
|
14
|
-
// debug: false
|
|
15
|
-
};
|
|
16
|
-
var halfPI = Math.PI / 2;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Apply a texture to a wall face
|
|
20
|
-
* @param material: The material of the face
|
|
21
|
-
* @param texture: The texture to load
|
|
22
|
-
* @param length: The lenght of the face
|
|
23
|
-
* @param height: The height of the face
|
|
24
|
-
*/
|
|
25
|
-
var applyTexture = function applyTexture(material, texture, length, height) {
|
|
26
|
-
var loader = new TextureLoader();
|
|
27
|
-
if (texture) {
|
|
28
|
-
material.map = loader.load(texture.uri["default"]);
|
|
29
|
-
material.map.colorSpace = Three.SRGBColorSpace, material.needsUpdate = true;
|
|
30
|
-
material.map.wrapS = RepeatWrapping;
|
|
31
|
-
material.map.wrapT = RepeatWrapping;
|
|
32
|
-
material.map.repeat.set(length * texture.lengthRepeatScale, height * texture.heightRepeatScale);
|
|
33
|
-
if (texture.normal) {
|
|
34
|
-
material.normalMap = loader.load(texture.normal.uri["default"]);
|
|
35
|
-
material.normalScale = new Vector2(texture.normal.normalScaleX, texture.normal.normalScaleY);
|
|
36
|
-
material.normalMap.wrapS = RepeatWrapping;
|
|
37
|
-
material.normalMap.wrapT = RepeatWrapping;
|
|
38
|
-
material.normalMap.repeat.set(length * texture.normal.lengthRepeatScale, height * texture.normal.heightRepeatScale);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
export function buildWall(element, layer, scene, textures, mode) {
|
|
43
|
-
// Get the two vertices of the wall
|
|
44
|
-
var vetName0 = element.vertices.get(0);
|
|
45
|
-
var vetName1 = element.vertices.get(1);
|
|
46
|
-
// let invert = element.toJS().invert;
|
|
47
|
-
|
|
48
|
-
// As long as its two ending points is same. This is no longer a line.
|
|
49
|
-
if (vetName0 === vetName1) {
|
|
50
|
-
return Promise.resolve(null);
|
|
51
|
-
}
|
|
52
|
-
var wallColor;
|
|
53
|
-
layer.lines.forEach(function (data) {
|
|
54
|
-
wallColor = data.wallColor;
|
|
55
|
-
});
|
|
56
|
-
var vertex0 = layer.vertices.get(vetName0);
|
|
57
|
-
var vertex1 = layer.vertices.get(vetName1);
|
|
58
|
-
|
|
59
|
-
// Get height and thickness of the wall converting them into the current scene units
|
|
60
|
-
// let height = element.properties.getIn(['height', 'length']);
|
|
61
|
-
// let thickness = element.properties.getIn(['thickness', 'length']);
|
|
62
|
-
var height = convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER);
|
|
63
|
-
var thickness = 2.0;
|
|
64
|
-
var distance = verticesDistance(vertex0, vertex1);
|
|
65
|
-
var soulMaterial = new Three.MeshPhongMaterial({
|
|
66
|
-
color: new Three.Color(wallColor).convertLinearToSRGB()
|
|
67
|
-
}); //element.selected ? SharedStyle.MESH_SELECTED : 0xD3D3D3
|
|
68
|
-
var soulVertices = [];
|
|
69
|
-
soulVertices.push(new Three.Vector2(-distance / 2, height / 2));
|
|
70
|
-
soulVertices.push(new Three.Vector2(distance / 2, height / 2));
|
|
71
|
-
soulVertices.push(new Three.Vector2(distance / 2, -height / 2));
|
|
72
|
-
soulVertices.push(new Three.Vector2(-distance / 2, -height / 2));
|
|
73
|
-
var soulShape = new Three.Shape(soulVertices);
|
|
74
|
-
var soulMesh = new Mesh(new BoxGeometry(distance, height, thickness), soulMaterial);
|
|
75
|
-
if (element.userData.stateMode !== 'MODE_DRAWING_HOLE_3D') {
|
|
76
|
-
element.holes.forEach(function (holeID) {
|
|
77
|
-
var holeData = layer.holes.get(holeID);
|
|
78
|
-
if (holeData !== undefined) {
|
|
79
|
-
var holeWidth = holeData.properties.getIn(['width', 'length']);
|
|
80
|
-
var holeHeight = holeData.properties.getIn(['height', 'length']);
|
|
81
|
-
var holeAltitude = holeData.properties.getIn(['altitude', 'length']);
|
|
82
|
-
var offset = holeData.offset;
|
|
83
|
-
// if (vertex0.x > vertex1.x) offset = 1 - offset;
|
|
84
|
-
// if (invert) offset = 1 - offset;
|
|
85
|
-
var holeDistance = offset * distance;
|
|
86
|
-
var holeVertices = [];
|
|
87
|
-
holeVertices.push(new Three.Vector2(0, holeHeight));
|
|
88
|
-
holeVertices.push(new Three.Vector2(holeWidth, holeHeight));
|
|
89
|
-
holeVertices.push(new Three.Vector2(holeWidth, 0));
|
|
90
|
-
holeVertices.push(new Three.Vector2(0, 0));
|
|
91
|
-
for (var i = 0; i < holeVertices.length; i++) {
|
|
92
|
-
holeVertices[i].x += holeDistance - distance / 2 - holeWidth / 2;
|
|
93
|
-
holeVertices[i].y -= height / 2 - holeAltitude;
|
|
94
|
-
}
|
|
95
|
-
var shapeHole = new Three.Shape(holeVertices);
|
|
96
|
-
soulShape.holes.push(shapeHole);
|
|
97
|
-
var holeGeometry = new BoxGeometry(holeWidth, holeHeight, thickness);
|
|
98
|
-
var holeMesh = new Mesh(holeGeometry);
|
|
99
|
-
holeMesh.position.x += holeWidth / 2;
|
|
100
|
-
holeMesh.position.y += holeHeight / 2;
|
|
101
|
-
holeMesh.position.x += holeDistance - distance / 2 - holeWidth / 2;
|
|
102
|
-
holeMesh.position.y -= height / 2 - holeAltitude;
|
|
103
|
-
var wallBSP = new ThreeBSP(soulMesh);
|
|
104
|
-
var holeBSP = new ThreeBSP(holeMesh);
|
|
105
|
-
var wallWithHoleBSP = wallBSP.subtract(holeBSP);
|
|
106
|
-
soulMesh = wallWithHoleBSP.toMesh(soulMaterial);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
var cAlpha = new Three.Vector2(vertex0.x - vertex1.x, vertex0.y - vertex1.y).angle();
|
|
111
|
-
var soulGeometry = new Three.ShapeGeometry(soulShape);
|
|
112
|
-
var soul = new Mesh(soulGeometry, soulMaterial);
|
|
113
|
-
soul.receiveShadow = true;
|
|
114
|
-
soul.castShadow = true;
|
|
115
|
-
soul.position.y += height / 2;
|
|
116
|
-
soul.rotation.y = cAlpha + Math.PI;
|
|
117
|
-
soul.name = 'soulFace';
|
|
118
|
-
soulMesh.position.y += height / 2;
|
|
119
|
-
soulMesh.rotation.y = cAlpha + Math.PI;
|
|
120
|
-
soulMesh.name = 'soul';
|
|
121
|
-
soulMesh.castShadow = true;
|
|
122
|
-
var frontMaterial = new MeshStandardMaterial({
|
|
123
|
-
color: new Three.Color(wallColor).convertLinearToSRGB(),
|
|
124
|
-
metalness: 0.1,
|
|
125
|
-
roughness: 0.9
|
|
126
|
-
// envMap: textureCube,
|
|
127
|
-
});
|
|
128
|
-
var backMaterial = new MeshStandardMaterial({
|
|
129
|
-
color: new Three.Color(wallColor).convertLinearToSRGB(),
|
|
130
|
-
metalness: 0.1,
|
|
131
|
-
roughness: 0.9
|
|
132
|
-
// envMap: textureCube,
|
|
133
|
-
});
|
|
134
|
-
applyTexture(frontMaterial, textures[element.properties.get('textureB')], distance, height);
|
|
135
|
-
applyTexture(backMaterial, textures[element.properties.get('textureB')], distance, height);
|
|
136
|
-
var frontFace = soul.clone();
|
|
137
|
-
frontFace.material = frontMaterial;
|
|
138
|
-
frontFace.name = 'frontFace';
|
|
139
|
-
soulMesh.material = frontMaterial;
|
|
140
|
-
var merged = new Group();
|
|
141
|
-
merged.add(frontFace, soulMesh);
|
|
142
|
-
|
|
143
|
-
// if this wall is front of camera, show/hide
|
|
144
|
-
if (!isElevationView(mode)) {
|
|
145
|
-
frontFace.onBeforeRender = function (renderer, scene, camera, geometry, material, group) {
|
|
146
|
-
var soulMesh = this.parent.getObjectByName('soul');
|
|
147
|
-
if (geometry.attributes.normal === undefined) return soulMesh.visible = false;
|
|
148
|
-
geometry.computeVertexNormals();
|
|
149
|
-
var normals = geometry.attributes.normal.array;
|
|
150
|
-
var pos = new Three.Vector4(0, 0, 0, 1);
|
|
151
|
-
pos = pos.applyMatrix4(this.matrixWorld);
|
|
152
|
-
pos = pos.applyMatrix4(camera.matrixWorldInverse);
|
|
153
|
-
var normal = new Three.Vector4(normals[0], normals[1], normals[2], 0);
|
|
154
|
-
normal = normal.applyMatrix4(this.matrixWorld);
|
|
155
|
-
normal = normal.applyMatrix4(camera.matrixWorldInverse);
|
|
156
|
-
if (soulMesh) {
|
|
157
|
-
if (pos.dot(normal) >= 0) soulMesh.visible = false;else soulMesh.visible = true;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
return Promise.resolve(merged);
|
|
162
|
-
}
|
|
163
|
-
export function updatedWall(element, layer, scene, textures, mesh, oldElement, differences, selfDestroy, selfBuild) {
|
|
164
|
-
var noPerf = function noPerf() {
|
|
165
|
-
selfDestroy();
|
|
166
|
-
return selfBuild();
|
|
167
|
-
};
|
|
168
|
-
var soul = mesh.getObjectByName('soul');
|
|
169
|
-
var frontFace = mesh.getObjectByName('frontFace');
|
|
170
|
-
var backFace = mesh.getObjectByName('backFace');
|
|
171
|
-
if (differences[0] == 'selected') {
|
|
172
|
-
if (soul !== undefined) {
|
|
173
|
-
if (element.selected) {
|
|
174
|
-
soul.material = new MeshBasicMaterial({
|
|
175
|
-
color: new Three.Color(SharedStyle.MESH_SELECTED).convertLinearToSRGB()
|
|
176
|
-
});
|
|
177
|
-
} else {
|
|
178
|
-
var soulMaterial = frontFace ? frontFace.material : backFace.material;
|
|
179
|
-
soul.material = soulMaterial;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
} else if (differences[0] == 'properties') {
|
|
183
|
-
if (differences[1] == 'thickness') {
|
|
184
|
-
var newThickness = LINE_THICKNESS / 2;
|
|
185
|
-
var oldThickness = LINE_THICKNESS / 2;
|
|
186
|
-
// let newThickness = element.getIn(['properties', 'thickness', 'length']);
|
|
187
|
-
// let oldThickness = oldElement.getIn(['properties', 'thickness', 'length']);
|
|
188
|
-
var halfNewThickness = newThickness / 2;
|
|
189
|
-
var texturedFaceDistance = halfNewThickness + 1;
|
|
190
|
-
var originalThickness = oldThickness / soul.scale.z;
|
|
191
|
-
var alpha = soul.rotation.y;
|
|
192
|
-
var xTemp = texturedFaceDistance * Math.cos(alpha - halfPI);
|
|
193
|
-
var zTemp = texturedFaceDistance * Math.sin(alpha - halfPI);
|
|
194
|
-
soul.scale.set(1, 1, newThickness / originalThickness);
|
|
195
|
-
frontFace.position.x = soul.position.x + xTemp;
|
|
196
|
-
frontFace.position.z = soul.position.z + zTemp;
|
|
197
|
-
backFace.position.x = soul.position.x - xTemp;
|
|
198
|
-
backFace.position.z = soul.position.z - zTemp;
|
|
199
|
-
} else return noPerf();
|
|
200
|
-
} else return noPerf();
|
|
201
|
-
return Promise.resolve(mesh);
|
|
202
|
-
}
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { buildWall, updatedWall } from "./wall-factory-3d";
|
|
3
|
-
import * as SharedStyle from "../../shared-style";
|
|
4
|
-
import * as Geometry from "../../utils/geometry";
|
|
5
|
-
import Translator from "../../translator/translator";
|
|
6
|
-
import { LINE_THICKNESS } from "../../constants";
|
|
7
|
-
// import Line from 'src/class/line';
|
|
8
|
-
import Line from "../../class/line";
|
|
9
|
-
var epsilon = 20;
|
|
10
|
-
var STYLE_TEXT = {
|
|
11
|
-
textAnchor: 'middle'
|
|
12
|
-
};
|
|
13
|
-
var STYLE_LINE = {
|
|
14
|
-
stroke: SharedStyle.LINE_MESH_COLOR.unselected
|
|
15
|
-
// stroke: "red" ,
|
|
16
|
-
|
|
17
|
-
// strokeWidth:1
|
|
18
|
-
};
|
|
19
|
-
var STYLE_INTERIOR_LINE = {
|
|
20
|
-
strokeWidth: 1,
|
|
21
|
-
stroke: SharedStyle.INTERIOR_LINE.unselected
|
|
22
|
-
};
|
|
23
|
-
var STYLE_INTERIOR_LINE_SELECTED = {
|
|
24
|
-
strokeWidth: 2,
|
|
25
|
-
stroke: SharedStyle.INTERIOR_LINE.selected,
|
|
26
|
-
fill: SharedStyle.INTERIOR_LINE.selected,
|
|
27
|
-
rx: '2px'
|
|
28
|
-
};
|
|
29
|
-
var STYLE = {
|
|
30
|
-
fill: '#0096fd',
|
|
31
|
-
stroke: SharedStyle.COLORS.white,
|
|
32
|
-
cursor: 'move'
|
|
33
|
-
};
|
|
34
|
-
var STYLE_POLYGON = {
|
|
35
|
-
strokeWidth: 1,
|
|
36
|
-
strokeLinejoin: 'round',
|
|
37
|
-
stroke: SharedStyle.LINE_MESH_COLOR.unselected,
|
|
38
|
-
rx: '2px',
|
|
39
|
-
fill: SharedStyle.LINE_MESH_COLOR.unselected
|
|
40
|
-
};
|
|
41
|
-
var STYLE_POLYGON_SELECTED = {
|
|
42
|
-
strokeWidth: 1,
|
|
43
|
-
strokeLinejoin: 'round',
|
|
44
|
-
rx: '2px',
|
|
45
|
-
stroke: SharedStyle.LINE_MESH_COLOR.selected,
|
|
46
|
-
fill: SharedStyle.LINE_MESH_COLOR.selected
|
|
47
|
-
};
|
|
48
|
-
var translator = new Translator();
|
|
49
|
-
|
|
50
|
-
/** Create Lines from State */
|
|
51
|
-
var createLineGeometry = function createLineGeometry(scene, state) {
|
|
52
|
-
var wall_thickness = LINE_THICKNESS / 2;
|
|
53
|
-
var layerID = scene.selectedLayer;
|
|
54
|
-
var layer = scene.getIn(['layers', layerID]);
|
|
55
|
-
var lines = layer.lines;
|
|
56
|
-
lines.toArray().forEach(function (line) {
|
|
57
|
-
var vertex0Id = line.vertices.get(0);
|
|
58
|
-
var vertex1Id = line.vertices.get(1);
|
|
59
|
-
var _layer$vertices$get = layer.vertices.get(vertex0Id),
|
|
60
|
-
x0 = _layer$vertices$get.x,
|
|
61
|
-
y0 = _layer$vertices$get.y;
|
|
62
|
-
var _layer$vertices$get2 = layer.vertices.get(vertex1Id),
|
|
63
|
-
x1 = _layer$vertices$get2.x,
|
|
64
|
-
y1 = _layer$vertices$get2.y;
|
|
65
|
-
if (x0 == x1 && y0 == y1) return;
|
|
66
|
-
var allLines = layer.lines.toArray();
|
|
67
|
-
var relatedLineArray = [];
|
|
68
|
-
var relatedLine0 = allLines.filter(function (allLine) {
|
|
69
|
-
return allLine.vertices.toArray().includes(vertex0Id) && line.id != allLine.id;
|
|
70
|
-
})[0];
|
|
71
|
-
var relatedLine1 = allLines.filter(function (allLine) {
|
|
72
|
-
return allLine.vertices.toArray().includes(vertex1Id) && line.id != allLine.id;
|
|
73
|
-
})[0];
|
|
74
|
-
var normalVertice = Geometry.getNormaline(x0, y0, x1, y1);
|
|
75
|
-
var rx0 = x0 + normalVertice.x * wall_thickness;
|
|
76
|
-
var ry0 = y0 + normalVertice.y * wall_thickness;
|
|
77
|
-
var rx1 = x1 + normalVertice.x * wall_thickness;
|
|
78
|
-
var ry1 = y1 + normalVertice.y * wall_thickness;
|
|
79
|
-
var intersection = [];
|
|
80
|
-
relatedLine0 ? relatedLineArray.push({
|
|
81
|
-
index: 0,
|
|
82
|
-
line: relatedLine0
|
|
83
|
-
}) : intersection.push({
|
|
84
|
-
index: 0,
|
|
85
|
-
point: {
|
|
86
|
-
x: rx0,
|
|
87
|
-
y: ry0
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
relatedLine1 ? relatedLineArray.push({
|
|
91
|
-
index: 1,
|
|
92
|
-
line: relatedLine1
|
|
93
|
-
}) : intersection.push({
|
|
94
|
-
index: 1,
|
|
95
|
-
point: {
|
|
96
|
-
x: rx1,
|
|
97
|
-
y: ry1
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
var originalLineFunction = Geometry.linePassingThroughTwoPoints(x0, y0, x1, y1);
|
|
101
|
-
originalLineFunction.c -= Math.sqrt(originalLineFunction.b * originalLineFunction.b + originalLineFunction.a * originalLineFunction.a) * wall_thickness;
|
|
102
|
-
relatedLineArray.forEach(function (lineInfo) {
|
|
103
|
-
var vertexId, originx, originy;
|
|
104
|
-
var index = lineInfo.index,
|
|
105
|
-
relatedLine = lineInfo.line;
|
|
106
|
-
index == 0 ? (vertexId = vertex0Id, originx = x0, originy = y0) : (vertexId = vertex1Id, originx = x1, originy = y1);
|
|
107
|
-
var relatedVertices = relatedLine.vertices.toArray();
|
|
108
|
-
var relatedOtherVertexID = relatedVertices[0] == vertexId ? relatedVertices[1] : relatedVertices[0];
|
|
109
|
-
var relatedVertex = layer.getIn(['vertices', relatedOtherVertexID]);
|
|
110
|
-
if (originx == relatedVertex.x && originy == relatedVertex.y) return;
|
|
111
|
-
var relatedLineFunction = Geometry.linePassingThroughTwoPoints(originx, originy, relatedVertex.x, relatedVertex.y);
|
|
112
|
-
var delta = Geometry.distancePointFromLine(relatedLineFunction.a, relatedLineFunction.b, relatedLineFunction.c, index == 0 ? x1 : x0, index == 0 ? y1 : y0);
|
|
113
|
-
// console.log(relatedLineFunction,"relatedLinefunction")
|
|
114
|
-
if (delta < 0.01) {
|
|
115
|
-
// if the directions of the current line and related line, then no need to calculate the inteersection point
|
|
116
|
-
// let rx = originx + normalVertice.x * wall_thickness;
|
|
117
|
-
// let ry = originy + normalVertice.y * wall_thickness;
|
|
118
|
-
var rx = originx + normalVertice.x * wall_thickness;
|
|
119
|
-
var ry = originy + normalVertice.y * wall_thickness;
|
|
120
|
-
intersection.push({
|
|
121
|
-
index: index,
|
|
122
|
-
point: {
|
|
123
|
-
x: rx,
|
|
124
|
-
y: ry
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
} else {
|
|
128
|
-
relatedLineFunction.c -= (relatedVertices[0] == vertexId ? 1 : -1) * Math.sqrt(relatedLineFunction.b * relatedLineFunction.b + relatedLineFunction.a * relatedLineFunction.a) * wall_thickness;
|
|
129
|
-
var point = Geometry.twoLinesIntersection(originalLineFunction.a, originalLineFunction.b, originalLineFunction.c, relatedLineFunction.a, relatedLineFunction.b, relatedLineFunction.c);
|
|
130
|
-
point && intersection.push({
|
|
131
|
-
index: index,
|
|
132
|
-
point: point
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
state = Line.setRelatedLine(state, layer.id, line.id, intersection).updatedState;
|
|
137
|
-
});
|
|
138
|
-
return {
|
|
139
|
-
updatedState: state
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
export default function WallFactory(name, info, textures) {
|
|
143
|
-
var wallElement = {
|
|
144
|
-
name: name,
|
|
145
|
-
prototype: 'lines',
|
|
146
|
-
info: info,
|
|
147
|
-
height: {
|
|
148
|
-
label: translator.t('height'),
|
|
149
|
-
type: 'length-measure',
|
|
150
|
-
defaultValue: {
|
|
151
|
-
length: 243.84
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
thickness: {
|
|
155
|
-
label: translator.t('thickness'),
|
|
156
|
-
type: 'length-measure',
|
|
157
|
-
defaultValue: {
|
|
158
|
-
length: LINE_THICKNESS / 2
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
properties: {},
|
|
162
|
-
render2D: function render2D(element, layer, scene, state) {
|
|
163
|
-
state = createLineGeometry(scene, state).updatedState;
|
|
164
|
-
scene = state.getIn(['scene']);
|
|
165
|
-
layer = scene.getIn(['layers', scene.selectedLayer]);
|
|
166
|
-
element = layer.getIn(['lines', element['id']]);
|
|
167
|
-
// let element = layer.lines[telement.id];
|
|
168
|
-
var _layer$vertices$get3 = layer.vertices.get(element.vertices.get(0)),
|
|
169
|
-
x1 = _layer$vertices$get3.x,
|
|
170
|
-
y1 = _layer$vertices$get3.y;
|
|
171
|
-
var _layer$vertices$get4 = layer.vertices.get(element.vertices.get(1)),
|
|
172
|
-
x2 = _layer$vertices$get4.x,
|
|
173
|
-
y2 = _layer$vertices$get4.y;
|
|
174
|
-
var layertemp = state.sceneHistory.getIn(['last', 'layers', 'layer-1']);
|
|
175
|
-
var verticesinfo = layer.vertices.get(element.vertices.get(0));
|
|
176
|
-
var length = Geometry.pointsDistance(x1, y1, x2, y2);
|
|
177
|
-
var length_5 = length / 5;
|
|
178
|
-
var thickness = LINE_THICKNESS;
|
|
179
|
-
// let thickness = element.getIn(['properties', 'thickness', 'length']);
|
|
180
|
-
var half_thickness = thickness / 2;
|
|
181
|
-
var half_thickness_eps = half_thickness + epsilon;
|
|
182
|
-
var char_height = 11;
|
|
183
|
-
var extra_epsilon = 5;
|
|
184
|
-
var textDistance = half_thickness + epsilon + extra_epsilon;
|
|
185
|
-
var related0x = x1,
|
|
186
|
-
related0y = y1,
|
|
187
|
-
related1x = x2,
|
|
188
|
-
related1y = y2;
|
|
189
|
-
element.relatedVertices.forEach(function (relatedVertice, index) {
|
|
190
|
-
if (relatedVertice.index == undefined) relatedVertice = relatedVertice.toJSON();
|
|
191
|
-
if (relatedVertice.index == 0) {
|
|
192
|
-
related0x = relatedVertice.point.x;
|
|
193
|
-
related0y = relatedVertice.point.y;
|
|
194
|
-
} else {
|
|
195
|
-
related1x = relatedVertice.point.x;
|
|
196
|
-
related1y = relatedVertice.point.y;
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
//Fill a polygon with the pattern specified by the polygon's id.(For example:fill='url(#pat) =><pattern id="pat">)
|
|
201
|
-
var outwall = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("pattern", {
|
|
202
|
-
id: "pat",
|
|
203
|
-
x: "0",
|
|
204
|
-
y: "0",
|
|
205
|
-
width: "5",
|
|
206
|
-
height: "5",
|
|
207
|
-
patternUnits: "userSpaceOnUse"
|
|
208
|
-
}, /*#__PURE__*/React.createElement("line", {
|
|
209
|
-
x1: "0",
|
|
210
|
-
y1: "0",
|
|
211
|
-
x2: "3",
|
|
212
|
-
y2: "3",
|
|
213
|
-
style: STYLE_LINE
|
|
214
|
-
})));
|
|
215
|
-
return !element.selected ? /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("polygon", {
|
|
216
|
-
points: "".concat(x1, ",").concat(y1, " ").concat(related0x, ",").concat(related0y, " ").concat(related1x, ",").concat(related1y, " ").concat(x2, ",").concat(y2),
|
|
217
|
-
fill: "url(#pat)",
|
|
218
|
-
fillRule: "evenodd"
|
|
219
|
-
}), outwall, /*#__PURE__*/React.createElement("line", {
|
|
220
|
-
x1: x1,
|
|
221
|
-
y1: y1,
|
|
222
|
-
x2: x2,
|
|
223
|
-
y2: y2,
|
|
224
|
-
style: STYLE_INTERIOR_LINE
|
|
225
|
-
})) : /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("polygon", {
|
|
226
|
-
points: "".concat(x1, ",").concat(y1, " ").concat(related0x, ",").concat(related0y, " ").concat(related1x, ",").concat(related1y, " ").concat(x2, ",").concat(y2),
|
|
227
|
-
fill: "url(#pat)",
|
|
228
|
-
fillRule: "evenodd"
|
|
229
|
-
}), outwall, /*#__PURE__*/React.createElement("line", {
|
|
230
|
-
x1: x1,
|
|
231
|
-
y1: y1,
|
|
232
|
-
x2: x2,
|
|
233
|
-
y2: y2,
|
|
234
|
-
style: STYLE_INTERIOR_LINE_SELECTED
|
|
235
|
-
}));
|
|
236
|
-
},
|
|
237
|
-
render3D: function render3D(element, layer, scene, mode) {
|
|
238
|
-
return buildWall(element, layer, scene, textures, mode);
|
|
239
|
-
},
|
|
240
|
-
updateRender3D: function updateRender3D(element, layer, scene, mesh, oldElement, differences, selfDestroy, selfBuild) {
|
|
241
|
-
return updatedWall(element, layer, scene, textures, mesh, oldElement, differences, selfDestroy, selfBuild);
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
if (textures && textures !== {}) {
|
|
245
|
-
var textureValues = {
|
|
246
|
-
none: 'None'
|
|
247
|
-
};
|
|
248
|
-
for (var textureName in textures) {
|
|
249
|
-
textureValues[textureName] = textures[textureName].name;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/* wallElement.properties.textureA = {
|
|
253
|
-
label:'Fronts ' + translator.t('texture'),
|
|
254
|
-
type: 'enum',
|
|
255
|
-
defaultValue: textureValues.bricks ? 'bricks' : 'none',
|
|
256
|
-
values: textureValues
|
|
257
|
-
};
|
|
258
|
-
*/
|
|
259
|
-
wallElement.properties.textureB = {
|
|
260
|
-
//label:'Back ' + translator.t('texture'),
|
|
261
|
-
label: 'Walls',
|
|
262
|
-
type: 'enum',
|
|
263
|
-
defaultValue: textureValues.bricks ? 'bricks' : 'none',
|
|
264
|
-
values: textureValues
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
return wallElement;
|
|
268
|
-
}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as Three from 'three';
|
|
3
|
-
import { loadGLTF } from "../../utils/load-obj";
|
|
4
|
-
import { OBJTYPE_MESH } from "../../../constants";
|
|
5
|
-
var cached3DDoor = null;
|
|
6
|
-
var STYLE_HOLE_BASE = {
|
|
7
|
-
stroke: 'rgb(73, 73, 73)',
|
|
8
|
-
strokeWidth: '1px',
|
|
9
|
-
strokeDasharray: '9,5',
|
|
10
|
-
fill: 'rgb(73, 73, 73)'
|
|
11
|
-
};
|
|
12
|
-
var STYLE_HOLE_SELECTED = {
|
|
13
|
-
stroke: '#0096fd',
|
|
14
|
-
strokeWidth: '1px',
|
|
15
|
-
strokeDasharray: '9,5',
|
|
16
|
-
fill: '#0096fd',
|
|
17
|
-
cursor: 'move'
|
|
18
|
-
};
|
|
19
|
-
var STYLE_ARC_BASE = {
|
|
20
|
-
stroke: 'rgb(73, 73, 73)',
|
|
21
|
-
strokeWidth: '1px',
|
|
22
|
-
strokeDasharray: '9,5',
|
|
23
|
-
fill: 'none'
|
|
24
|
-
};
|
|
25
|
-
var STYLE_ARC_SELECTED = {
|
|
26
|
-
stroke: '#0096fd',
|
|
27
|
-
strokeWidth: '1px',
|
|
28
|
-
strokeDasharray: '9,5',
|
|
29
|
-
fill: 'none',
|
|
30
|
-
cursor: 'move'
|
|
31
|
-
};
|
|
32
|
-
var STYLE_STR0 = {
|
|
33
|
-
fill: 'rgb(185, 185, 185)',
|
|
34
|
-
stroke: '#494949',
|
|
35
|
-
strokeWidth: '1',
|
|
36
|
-
strokeMiterlimit: '2.61313'
|
|
37
|
-
};
|
|
38
|
-
var STYLE_STR0_S = {
|
|
39
|
-
fill: 'rgb(185, 185, 185)',
|
|
40
|
-
stroke: '#0096fd',
|
|
41
|
-
strokeWidth: '1',
|
|
42
|
-
strokeMiterlimit: '2.61313'
|
|
43
|
-
};
|
|
44
|
-
var STYLE_STR1 = {
|
|
45
|
-
fill: 'none',
|
|
46
|
-
stroke: '#494949',
|
|
47
|
-
strokeWidth: '1',
|
|
48
|
-
strokeLinecap: 'round',
|
|
49
|
-
strokeLinejoin: 'round',
|
|
50
|
-
strokeMiterlimit: '2.61313',
|
|
51
|
-
strokeDasharray: '23.860041 11.930021'
|
|
52
|
-
};
|
|
53
|
-
var STYLE_FILL2 = {
|
|
54
|
-
fill: '#1183B7'
|
|
55
|
-
};
|
|
56
|
-
var STYLE_FNT0 = {
|
|
57
|
-
fill: 'white',
|
|
58
|
-
fontWeight: 'normal',
|
|
59
|
-
fontSize: '13px',
|
|
60
|
-
fontFamily: 'Proxima Nova Rg'
|
|
61
|
-
};
|
|
62
|
-
var EPSILON = 3;
|
|
63
|
-
export default {
|
|
64
|
-
name: 'Closet',
|
|
65
|
-
prototype: 'holes',
|
|
66
|
-
info: {
|
|
67
|
-
title: 'Closet',
|
|
68
|
-
tag: ['door'],
|
|
69
|
-
description: 'Closet door(Wooden)',
|
|
70
|
-
image: '/assets/img/svg/door/Closet.svg',
|
|
71
|
-
url: '/assets/gltf/door_closet.gltf'
|
|
72
|
-
},
|
|
73
|
-
properties: {
|
|
74
|
-
width: {
|
|
75
|
-
label: 'Width',
|
|
76
|
-
type: 'length-measure',
|
|
77
|
-
defaultValue: {
|
|
78
|
-
length: 91.44
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
height: {
|
|
82
|
-
label: 'Height',
|
|
83
|
-
type: 'length-measure',
|
|
84
|
-
defaultValue: {
|
|
85
|
-
length: 215
|
|
86
|
-
},
|
|
87
|
-
length: 215
|
|
88
|
-
},
|
|
89
|
-
altitude: {
|
|
90
|
-
label: 'Altitude',
|
|
91
|
-
type: 'length-measure',
|
|
92
|
-
defaultValue: {
|
|
93
|
-
length: 0
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
thickness: {
|
|
97
|
-
label: 'Thickness',
|
|
98
|
-
type: 'length-measure',
|
|
99
|
-
defaultValue: {
|
|
100
|
-
length: 6
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
flip_orizzontal: {
|
|
104
|
-
label: 'Flip Door',
|
|
105
|
-
type: 'checkbox',
|
|
106
|
-
defaultValue: false,
|
|
107
|
-
values: {
|
|
108
|
-
none: false,
|
|
109
|
-
yes: true
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
render2D: function render2D(element, layer, scene) {
|
|
114
|
-
var flip = element.properties.get('flip_orizzontal');
|
|
115
|
-
var lineWidth = 6;
|
|
116
|
-
var holeWidth = element.properties.get('width').get('length');
|
|
117
|
-
var holePath = "M".concat(0, " ", -EPSILON, " L").concat(holeWidth, " ").concat(-EPSILON, " L").concat(holeWidth, " ").concat(EPSILON, " L", 0, " ").concat(EPSILON, " z");
|
|
118
|
-
var arcPath = "M".concat(0, ",", 0, " A", holeWidth, ",").concat(holeWidth, " 0 0,1 ").concat(holeWidth, ",").concat(holeWidth);
|
|
119
|
-
var holeStyle = element.selected ? STYLE_HOLE_SELECTED : STYLE_HOLE_BASE;
|
|
120
|
-
var arcStyle = element.selected ? STYLE_ARC_SELECTED : STYLE_ARC_BASE;
|
|
121
|
-
var rectStyle = element.selected ? STYLE_STR0_S : STYLE_STR0;
|
|
122
|
-
var length = element.properties.get('width').get('length');
|
|
123
|
-
if (flip == false) {
|
|
124
|
-
return /*#__PURE__*/React.createElement("g", {
|
|
125
|
-
transform: "translate(".concat(-length / 2, ", 0)")
|
|
126
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
127
|
-
d: arcPath,
|
|
128
|
-
style: arcStyle,
|
|
129
|
-
transform: "translate(".concat(0, ",", holeWidth, ") scale(", 1, ",").concat(-1, ") rotate(", 0, ")")
|
|
130
|
-
}), /*#__PURE__*/React.createElement("line", {
|
|
131
|
-
x1: 0,
|
|
132
|
-
y1: holeWidth - EPSILON,
|
|
133
|
-
x2: 0,
|
|
134
|
-
y2: 0 - EPSILON,
|
|
135
|
-
style: holeStyle,
|
|
136
|
-
transform: "scale(".concat(-1, ",", 1, ")")
|
|
137
|
-
}), /*#__PURE__*/React.createElement("rect", {
|
|
138
|
-
style: rectStyle,
|
|
139
|
-
x: "0",
|
|
140
|
-
y: -lineWidth / 2,
|
|
141
|
-
width: holeWidth,
|
|
142
|
-
height: lineWidth
|
|
143
|
-
}));
|
|
144
|
-
} else {
|
|
145
|
-
return /*#__PURE__*/React.createElement("g", {
|
|
146
|
-
transform: "translate(".concat(-length / 2, ", 0)")
|
|
147
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
148
|
-
d: arcPath,
|
|
149
|
-
style: arcStyle,
|
|
150
|
-
transform: "translate(".concat(0, ",", -holeWidth, ") scale(", 1, ",", 1, ") rotate(", 0, ")")
|
|
151
|
-
}), /*#__PURE__*/React.createElement("line", {
|
|
152
|
-
x1: 0,
|
|
153
|
-
y1: -holeWidth - EPSILON,
|
|
154
|
-
x2: 0,
|
|
155
|
-
y2: 0 - EPSILON,
|
|
156
|
-
style: holeStyle,
|
|
157
|
-
transform: "scale(".concat(1, ",", 1, ")")
|
|
158
|
-
}), /*#__PURE__*/React.createElement("rect", {
|
|
159
|
-
style: rectStyle,
|
|
160
|
-
x: "0",
|
|
161
|
-
y: -lineWidth / 2,
|
|
162
|
-
width: holeWidth,
|
|
163
|
-
height: lineWidth
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
render3D: function render3D(element, layer, scene) {
|
|
168
|
-
var onLoadItem = function onLoadItem(object) {
|
|
169
|
-
var boundingBox = new Three.Box3().setFromObject(object);
|
|
170
|
-
var initialWidth = boundingBox.max.x - boundingBox.min.x;
|
|
171
|
-
var initialHeight = boundingBox.max.y - boundingBox.min.y;
|
|
172
|
-
var initialThickness = boundingBox.max.z - boundingBox.min.z;
|
|
173
|
-
if (element.selected) {
|
|
174
|
-
var box = new Three.BoxHelper(object, 0x99c3fb);
|
|
175
|
-
box.material.linewidth = 2;
|
|
176
|
-
box.material.depthTest = false;
|
|
177
|
-
box.renderOrder = 1000;
|
|
178
|
-
object.add(box);
|
|
179
|
-
}
|
|
180
|
-
var params = {
|
|
181
|
-
envMap: 'HDR',
|
|
182
|
-
roughness: 0.9,
|
|
183
|
-
metalness: 0.1,
|
|
184
|
-
exposure: 1.0
|
|
185
|
-
};
|
|
186
|
-
var examplecolor = new Three.Color(0xffffff);
|
|
187
|
-
var mat2 = new Three.MeshStandardMaterial({
|
|
188
|
-
color: examplecolor,
|
|
189
|
-
metalness: params.metalness,
|
|
190
|
-
roughness: params.roughness
|
|
191
|
-
});
|
|
192
|
-
// let normalMap = require('./texture.png');
|
|
193
|
-
// let t = new Three.TextureLoader().load(normalMap);
|
|
194
|
-
// let mat2 = new Three.MeshStandardMaterial({
|
|
195
|
-
// metalness: params.metalness,
|
|
196
|
-
// roughness: params.roughness
|
|
197
|
-
// });
|
|
198
|
-
// mat2.map = t;
|
|
199
|
-
// mat2.envMap = textureCube;
|
|
200
|
-
for (var j = 0; j < object.children.length; j++) {
|
|
201
|
-
if (object.children[j].type === OBJTYPE_MESH) {
|
|
202
|
-
object.children[j].material = mat2;
|
|
203
|
-
object.children[j].receiveShadow = true;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
var width = element.properties.get('width').get('length');
|
|
207
|
-
var height = element.properties.get('height').get('length');
|
|
208
|
-
var thickness = element.properties.get('thickness').get('length');
|
|
209
|
-
// console.log(width, height, thickness)
|
|
210
|
-
|
|
211
|
-
object.scale.set(width / initialWidth, height / initialHeight, thickness / initialThickness);
|
|
212
|
-
return object;
|
|
213
|
-
};
|
|
214
|
-
if (cached3DDoor) {
|
|
215
|
-
return Promise.resolve(onLoadItem(cached3DDoor.clone()));
|
|
216
|
-
}
|
|
217
|
-
return loadGLTF(element.url).then(function (object) {
|
|
218
|
-
cached3DDoor = object;
|
|
219
|
-
return onLoadItem(cached3DDoor.clone());
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
};
|
|
Binary file
|