@operato/scene-visualizer 1.2.12 → 1.2.13

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 (75) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/db.sqlite +0 -0
  3. package/dist/cube.d.ts +1 -3
  4. package/dist/cube.js +1 -5
  5. package/dist/cube.js.map +1 -1
  6. package/dist/cylinder.d.ts +1 -3
  7. package/dist/cylinder.js +1 -5
  8. package/dist/cylinder.js.map +1 -1
  9. package/dist/rack.js +3 -3
  10. package/dist/rack.js.map +1 -1
  11. package/dist/sphere.d.ts +1 -3
  12. package/dist/sphere.js +1 -8
  13. package/dist/sphere.js.map +1 -1
  14. package/dist/sprite.js +0 -6
  15. package/dist/sprite.js.map +1 -1
  16. package/dist/threed/common.js +3 -2
  17. package/dist/threed/common.js.map +1 -1
  18. package/dist/threed/real-object-camera-meshed.d.ts +1 -1
  19. package/dist/threed/real-object-camera-meshed.js +1 -1
  20. package/dist/threed/real-object-camera-meshed.js.map +1 -1
  21. package/dist/threed/real-object-dom-element.d.ts +0 -3
  22. package/dist/threed/real-object-dom-element.js +0 -51
  23. package/dist/threed/real-object-dom-element.js.map +1 -1
  24. package/dist/threed/real-object-extrude.d.ts +2 -3
  25. package/dist/threed/real-object-extrude.js +27 -66
  26. package/dist/threed/real-object-extrude.js.map +1 -1
  27. package/dist/threed/real-object-gltf.d.ts +0 -2
  28. package/dist/threed/real-object-gltf.js +2 -8
  29. package/dist/threed/real-object-gltf.js.map +1 -1
  30. package/dist/threed/real-object-mesh.d.ts +3 -2
  31. package/dist/threed/real-object-mesh.js +22 -13
  32. package/dist/threed/real-object-mesh.js.map +1 -1
  33. package/dist/threed/real-object-plane.d.ts +2 -3
  34. package/dist/threed/real-object-plane.js +6 -7
  35. package/dist/threed/real-object-plane.js.map +1 -1
  36. package/dist/threed/real-object-sprite-2d.js +0 -1
  37. package/dist/threed/real-object-sprite-2d.js.map +1 -1
  38. package/dist/threed/real-object-text.d.ts +3 -4
  39. package/dist/threed/real-object-text.js +41 -47
  40. package/dist/threed/real-object-text.js.map +1 -1
  41. package/dist/threed/real-object.d.ts +0 -1
  42. package/dist/threed/real-object.js +14 -18
  43. package/dist/threed/real-object.js.map +1 -1
  44. package/dist/wall.d.ts +2 -3
  45. package/dist/wall.js +4 -5
  46. package/dist/wall.js.map +1 -1
  47. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +6 -21
  48. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +10 -0
  49. package/logs/application-2023-03-05-12.log +6 -0
  50. package/logs/application-2023-03-05-23.log +6 -0
  51. package/logs/connections-2023-03-05-12.log +35 -0
  52. package/logs/connections-2023-03-05-23.log +35 -0
  53. package/package.json +2 -2
  54. package/src/cube.ts +1 -7
  55. package/src/cylinder.ts +1 -7
  56. package/src/rack.ts +3 -4
  57. package/src/sphere.ts +1 -10
  58. package/src/sprite.ts +0 -8
  59. package/src/threed/common.ts +3 -2
  60. package/src/threed/real-object-camera-meshed.ts +1 -1
  61. package/src/threed/real-object-dom-element.ts +0 -71
  62. package/src/threed/real-object-extrude.ts +31 -69
  63. package/src/threed/real-object-gltf.ts +2 -10
  64. package/src/threed/real-object-mesh.ts +21 -14
  65. package/src/threed/real-object-plane.ts +6 -9
  66. package/src/threed/real-object-sprite-2d.ts +0 -2
  67. package/src/threed/real-object-text.ts +49 -60
  68. package/src/threed/real-object.ts +15 -22
  69. package/src/wall.ts +5 -6
  70. package/tsconfig.tsbuildinfo +1 -1
  71. package/logs/application-2023-03-01-03.log +0 -6
  72. package/logs/application-2023-03-01-13.log +0 -6
  73. package/logs/application-2023-03-01-15.log +0 -6
  74. package/logs/application-2023-03-03-00.log +0 -25
  75. package/logs/application-2023-03-03-01.log +0 -6
package/dist/wall.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { Shape } from '@hatiolab/things-scene';
2
- import * as THREE from 'three';
3
2
  import { RealObject } from './threed/real-object';
4
3
  import { RealObjectMesh } from './threed/real-object-mesh';
5
4
  export declare class Wall3D extends RealObjectMesh {
6
- buildGeometry(): THREE.BoxGeometry;
7
- buildMaterial(): THREE.MeshStandardMaterial;
5
+ buildGeometry(): void;
6
+ updateDimension(): void;
8
7
  }
9
8
  declare const Wall_base: typeof Shape;
10
9
  export declare class Wall extends Wall_base {
package/dist/wall.js CHANGED
@@ -20,12 +20,11 @@ const NATURE = {
20
20
  };
21
21
  export class Wall3D extends RealObjectMesh {
22
22
  buildGeometry() {
23
- var { width, height, depth = 1 } = this.component.state;
24
- return new THREE.BoxGeometry(width, depth, height);
23
+ this.object3d.geometry = new THREE.BoxGeometry(1, 1, 1);
25
24
  }
26
- buildMaterial() {
27
- var { fillStyle = 'gray' } = this.component.state;
28
- return new THREE.MeshStandardMaterial({ color: fillStyle, side: THREE.FrontSide });
25
+ updateDimension() {
26
+ var { width, height, depth = 1 } = this.component.state;
27
+ this.object3d.scale.set(width, depth, height);
29
28
  }
30
29
  }
31
30
  export class Wall extends RectPath(Shape) {
package/dist/wall.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"wall.js","sourceRoot":"","sources":["../src/wall.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE1D,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,OAAO;SAClB;KACF;IACD,IAAI,EAAE,sBAAsB;CAC7B,CAAA;AAED,MAAM,OAAO,MAAO,SAAQ,cAAc;IACxC,aAAa;QACX,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QACvD,OAAO,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACpD,CAAC;IAED,aAAa;QACX,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAEjD,OAAO,IAAI,KAAK,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAA;IACpF,CAAC;CACF;AAED,MAAM,OAAO,IAAK,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACvC,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe;QACb,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, RectPath, Shape } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { RealObject } from './threed/real-object'\nimport { RealObjectMesh } from './threed/real-object-mesh'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'depth',\n name: 'depth',\n property: 'depth'\n }\n ],\n help: 'scene/component/wall'\n}\n\nexport class Wall3D extends RealObjectMesh {\n buildGeometry() {\n var { width, height, depth = 1 } = this.component.state\n return new THREE.BoxGeometry(width, depth, height)\n }\n\n buildMaterial() {\n var { fillStyle = 'gray' } = this.component.state\n\n return new THREE.MeshStandardMaterial({ color: fillStyle, side: THREE.FrontSide })\n }\n}\n\nexport class Wall extends RectPath(Shape) {\n is3dish() {\n return true\n }\n\n buildRealObject(): RealObject | undefined {\n return new Wall3D(this)\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.register('wall', Wall)\n"]}
1
+ {"version":3,"file":"wall.js","sourceRoot":"","sources":["../src/wall.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAc,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE1D,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,OAAO;SAClB;KACF;IACD,IAAI,EAAE,sBAAsB;CAC7B,CAAA;AAED,MAAM,OAAO,MAAO,SAAQ,cAAc;IACxC,aAAa;QACX,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACzD,CAAC;IAED,eAAe;QACb,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA;QAEvD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAC/C,CAAC;CACF;AAED,MAAM,OAAO,IAAK,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACvC,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe;QACb,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, Properties, RectPath, Shape } from '@hatiolab/things-scene'\nimport * as THREE from 'three'\nimport { RealObject } from './threed/real-object'\nimport { RealObjectMesh } from './threed/real-object-mesh'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'depth',\n name: 'depth',\n property: 'depth'\n }\n ],\n help: 'scene/component/wall'\n}\n\nexport class Wall3D extends RealObjectMesh {\n buildGeometry() {\n this.object3d.geometry = new THREE.BoxGeometry(1, 1, 1)\n }\n\n updateDimension(): void {\n var { width, height, depth = 1 } = this.component.state\n\n this.object3d.scale.set(width, depth, height)\n }\n}\n\nexport class Wall extends RectPath(Shape) {\n is3dish() {\n return true\n }\n\n buildRealObject(): RealObject | undefined {\n return new Wall3D(this)\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.register('wall', Wall)\n"]}
@@ -6,29 +6,14 @@
6
6
  "auditLog": "logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json",
7
7
  "files": [
8
8
  {
9
- "date": 1677609045030,
10
- "name": "logs/application-2023-03-01-03.log",
11
- "hash": "cbb1c94289188b68ae183ae07ad473504bbe4a945b6cca05d72a119ea99bcb95"
9
+ "date": 1677986779847,
10
+ "name": "logs/application-2023-03-05-12.log",
11
+ "hash": "b1491e6040f9ae51f97238e436babcce355a8fcfb99640f0e6291efa2dcb4fa1"
12
12
  },
13
13
  {
14
- "date": 1677645356970,
15
- "name": "logs/application-2023-03-01-13.log",
16
- "hash": "2e4fa8c5b0be391ddcf9ea0e3777d0d9879f750168ea0bcf14b686417166135d"
17
- },
18
- {
19
- "date": 1677651216796,
20
- "name": "logs/application-2023-03-01-15.log",
21
- "hash": "0632ba06863b1caa1df0f1e955f7cd363f3b0b0f0a93ba8a45ee6eb66430813c"
22
- },
23
- {
24
- "date": 1677769390251,
25
- "name": "logs/application-2023-03-03-00.log",
26
- "hash": "3fe90aa25fcc912b5b407fcc5e5daf3c95233a379872c3a4b66ad446b53417ff"
27
- },
28
- {
29
- "date": 1677772961148,
30
- "name": "logs/application-2023-03-03-01.log",
31
- "hash": "604655a0040727b80c6c4b55aacdb4013b09a98256e273e47e8a8940c3053c53"
14
+ "date": 1678026248957,
15
+ "name": "logs/application-2023-03-05-23.log",
16
+ "hash": "d76e61c4122d462e689279e776a5adccb0d78492a54a2410e86c85f3cebdc37d"
32
17
  }
33
18
  ],
34
19
  "hashType": "sha256"
@@ -89,6 +89,16 @@
89
89
  "date": 1677772962126,
90
90
  "name": "logs/connections-2023-03-03-01.log",
91
91
  "hash": "fc5531e11c4749dfce844fbb20984c87511eb069cda9d105048aa09e4a5f50d9"
92
+ },
93
+ {
94
+ "date": 1677986781600,
95
+ "name": "logs/connections-2023-03-05-12.log",
96
+ "hash": "a49891708de1da2d8dd2aef1fdd7dacb049daa2a80973bf57d9ca3d6f42ea105"
97
+ },
98
+ {
99
+ "date": 1678026250498,
100
+ "name": "logs/connections-2023-03-05-23.log",
101
+ "hash": "f0755fba64d96b7ddaf4a77da762e735bed176f67a348c4b6079a55857543572"
92
102
  }
93
103
  ],
94
104
  "hashType": "sha256"
@@ -0,0 +1,6 @@
1
+ 2023-03-05T12:26:20+09:00 info: File Storage is Ready.
2
+ 2023-03-05T12:26:21+09:00 error: oracledb module loading failed
3
+ 2023-03-05T12:26:22+09:00 info: Default DataSource established
4
+ 2023-03-05T12:26:22+09:00 info: Transaction DataSource established
5
+ 2023-03-05T12:26:23+09:00 info: 🚀 Server ready at http://0.0.0.0:3000/graphql
6
+ 2023-03-05T12:26:23+09:00 info: 🚀 Subscriptions ready at ws://0.0.0.0:3000/graphql
@@ -0,0 +1,6 @@
1
+ 2023-03-05T23:24:09+09:00 info: File Storage is Ready.
2
+ 2023-03-05T23:24:10+09:00 error: oracledb module loading failed
3
+ 2023-03-05T23:24:11+09:00 info: Default DataSource established
4
+ 2023-03-05T23:24:11+09:00 info: Transaction DataSource established
5
+ 2023-03-05T23:24:12+09:00 info: 🚀 Server ready at http://0.0.0.0:3000/graphql
6
+ 2023-03-05T23:24:12+09:00 info: 🚀 Subscriptions ready at ws://0.0.0.0:3000/graphql
@@ -0,0 +1,35 @@
1
+ 2023-03-05T12:26:23+09:00 info: Initializing ConnectionManager...
2
+ 2023-03-05T12:26:23+09:00 info: Connector 'echo-back-server' started to ready
3
+ 2023-03-05T12:26:23+09:00 info: Connector 'echo-back' started to ready
4
+ 2023-03-05T12:26:23+09:00 info: Connector 'http-connector' started to ready
5
+ 2023-03-05T12:26:23+09:00 info: Connector 'graphql-connector' started to ready
6
+ 2023-03-05T12:26:23+09:00 info: Connector 'sqlite-connector' started to ready
7
+ 2023-03-05T12:26:23+09:00 info: Connector 'postgresql-connector' started to ready
8
+ 2023-03-05T12:26:23+09:00 info: Connector 'mqtt-connector' started to ready
9
+ 2023-03-05T12:26:23+09:00 info: Connector 'mssql-connector' started to ready
10
+ 2023-03-05T12:26:23+09:00 info: Connector 'oracle-connector' started to ready
11
+ 2023-03-05T12:26:23+09:00 info: Connector 'mysql-connector' started to ready
12
+ 2023-03-05T12:26:23+09:00 info: Connector 'socket-server' started to ready
13
+ 2023-03-05T12:26:23+09:00 info: echo-back-servers are ready
14
+ 2023-03-05T12:26:23+09:00 info: echo-back connections are ready
15
+ 2023-03-05T12:26:23+09:00 info: http-connector connections are ready
16
+ 2023-03-05T12:26:23+09:00 info: graphql-connector connections are ready
17
+ 2023-03-05T12:26:23+09:00 info: sqlite-connector connections are ready
18
+ 2023-03-05T12:26:23+09:00 info: postgresql-connector connections are ready
19
+ 2023-03-05T12:26:23+09:00 info: mqtt-connector connections are ready
20
+ 2023-03-05T12:26:23+09:00 info: mssql-connector connections are ready
21
+ 2023-03-05T12:26:23+09:00 info: oracle-connector connections are ready
22
+ 2023-03-05T12:26:23+09:00 info: mysql-connector connections are ready
23
+ 2023-03-05T12:26:23+09:00 info: socket servers are ready
24
+ 2023-03-05T12:26:23+09:00 info: All connector for 'echo-back-server' ready
25
+ 2023-03-05T12:26:23+09:00 info: All connector for 'echo-back' ready
26
+ 2023-03-05T12:26:23+09:00 info: All connector for 'http-connector' ready
27
+ 2023-03-05T12:26:23+09:00 info: All connector for 'graphql-connector' ready
28
+ 2023-03-05T12:26:23+09:00 info: All connector for 'sqlite-connector' ready
29
+ 2023-03-05T12:26:23+09:00 info: All connector for 'postgresql-connector' ready
30
+ 2023-03-05T12:26:23+09:00 info: All connector for 'mqtt-connector' ready
31
+ 2023-03-05T12:26:23+09:00 info: All connector for 'mssql-connector' ready
32
+ 2023-03-05T12:26:23+09:00 info: All connector for 'oracle-connector' ready
33
+ 2023-03-05T12:26:23+09:00 info: All connector for 'mysql-connector' ready
34
+ 2023-03-05T12:26:23+09:00 info: All connector for 'socket-server' ready
35
+ 2023-03-05T12:26:23+09:00 info: ConnectionManager initialization done:
@@ -0,0 +1,35 @@
1
+ 2023-03-05T23:24:12+09:00 info: Initializing ConnectionManager...
2
+ 2023-03-05T23:24:12+09:00 info: Connector 'echo-back-server' started to ready
3
+ 2023-03-05T23:24:12+09:00 info: Connector 'echo-back' started to ready
4
+ 2023-03-05T23:24:12+09:00 info: Connector 'http-connector' started to ready
5
+ 2023-03-05T23:24:12+09:00 info: Connector 'graphql-connector' started to ready
6
+ 2023-03-05T23:24:12+09:00 info: Connector 'sqlite-connector' started to ready
7
+ 2023-03-05T23:24:12+09:00 info: Connector 'postgresql-connector' started to ready
8
+ 2023-03-05T23:24:12+09:00 info: Connector 'mqtt-connector' started to ready
9
+ 2023-03-05T23:24:12+09:00 info: Connector 'mssql-connector' started to ready
10
+ 2023-03-05T23:24:12+09:00 info: Connector 'oracle-connector' started to ready
11
+ 2023-03-05T23:24:12+09:00 info: Connector 'mysql-connector' started to ready
12
+ 2023-03-05T23:24:12+09:00 info: Connector 'socket-server' started to ready
13
+ 2023-03-05T23:24:12+09:00 info: echo-back-servers are ready
14
+ 2023-03-05T23:24:12+09:00 info: echo-back connections are ready
15
+ 2023-03-05T23:24:12+09:00 info: http-connector connections are ready
16
+ 2023-03-05T23:24:12+09:00 info: graphql-connector connections are ready
17
+ 2023-03-05T23:24:12+09:00 info: sqlite-connector connections are ready
18
+ 2023-03-05T23:24:12+09:00 info: postgresql-connector connections are ready
19
+ 2023-03-05T23:24:12+09:00 info: mqtt-connector connections are ready
20
+ 2023-03-05T23:24:12+09:00 info: mssql-connector connections are ready
21
+ 2023-03-05T23:24:12+09:00 info: oracle-connector connections are ready
22
+ 2023-03-05T23:24:12+09:00 info: mysql-connector connections are ready
23
+ 2023-03-05T23:24:12+09:00 info: socket servers are ready
24
+ 2023-03-05T23:24:12+09:00 info: All connector for 'echo-back-server' ready
25
+ 2023-03-05T23:24:12+09:00 info: All connector for 'echo-back' ready
26
+ 2023-03-05T23:24:12+09:00 info: All connector for 'http-connector' ready
27
+ 2023-03-05T23:24:12+09:00 info: All connector for 'graphql-connector' ready
28
+ 2023-03-05T23:24:12+09:00 info: All connector for 'sqlite-connector' ready
29
+ 2023-03-05T23:24:12+09:00 info: All connector for 'postgresql-connector' ready
30
+ 2023-03-05T23:24:12+09:00 info: All connector for 'mqtt-connector' ready
31
+ 2023-03-05T23:24:12+09:00 info: All connector for 'mssql-connector' ready
32
+ 2023-03-05T23:24:12+09:00 info: All connector for 'oracle-connector' ready
33
+ 2023-03-05T23:24:12+09:00 info: All connector for 'mysql-connector' ready
34
+ 2023-03-05T23:24:12+09:00 info: All connector for 'socket-server' ready
35
+ 2023-03-05T23:24:12+09:00 info: ConnectionManager initialization done:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/scene-visualizer",
3
3
  "description": "visualizer component for operato-scene",
4
4
  "author": "heartyoh",
5
- "version": "1.2.12",
5
+ "version": "1.2.13",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "things-scene": true,
@@ -61,5 +61,5 @@
61
61
  "prettier --write"
62
62
  ]
63
63
  },
64
- "gitHead": "423f23b929f9f4f0121cc3a740613858a7110015"
64
+ "gitHead": "d76930ef9a26e55feee352511f6a7c5c0e74ed90"
65
65
  }
package/src/cube.ts CHANGED
@@ -18,13 +18,7 @@ export class Cube3D extends RealObjectMesh {
18
18
  buildGeometry() {
19
19
  var { width = 0, height = 0, depth = 0 } = this.component.state
20
20
 
21
- return new THREE.BoxGeometry(width, depth, height)
22
- }
23
-
24
- buildMaterial() {
25
- var { fillStyle = 'lightgray' } = this.component.state
26
-
27
- return new THREE.MeshStandardMaterial({ color: fillStyle, side: THREE.FrontSide })
21
+ this.object3d.geometry = new THREE.BoxGeometry(width, depth, height)
28
22
  }
29
23
  }
30
24
 
package/src/cylinder.ts CHANGED
@@ -18,13 +18,7 @@ export class Cylinder3D extends RealObjectMesh {
18
18
  buildGeometry() {
19
19
  var { depth = 0, rx = 0 } = this.component.state
20
20
 
21
- return new THREE.CylinderGeometry(rx, rx, depth, 25)
22
- }
23
-
24
- buildMaterial() {
25
- var { fillStyle = 'lightgray' } = this.component.state
26
-
27
- return new THREE.MeshStandardMaterial({ color: fillStyle, side: THREE.FrontSide })
21
+ this.object3d.geometry = new THREE.CylinderGeometry(rx, rx, depth, 25)
28
22
  }
29
23
  }
30
24
 
package/src/rack.ts CHANGED
@@ -55,11 +55,10 @@ export class Rack extends RealObject {
55
55
  if (!Rack._boardMaterial) {
56
56
  Rack._boardMaterial = new THREE.MeshStandardMaterial({
57
57
  color: '#dedede',
58
- side: THREE.DoubleSide
58
+ side: THREE.DoubleSide,
59
+ polygonOffset: true,
60
+ polygonOffsetFactor: -0.1
59
61
  })
60
-
61
- Rack._boardMaterial.polygonOffset = true
62
- Rack._boardMaterial.polygonOffsetFactor = -0.1
63
62
  }
64
63
 
65
64
  return Rack._boardMaterial
package/src/sphere.ts CHANGED
@@ -18,16 +18,7 @@ export class Sphere3D extends RealObjectMesh {
18
18
  buildGeometry() {
19
19
  var { rx = 0 } = this.component.state
20
20
 
21
- return new THREE.SphereGeometry(rx, 20, 20)
22
- }
23
-
24
- buildMaterial() {
25
- var { fillStyle = 'gray' } = this.component.state
26
-
27
- return new THREE.MeshStandardMaterial({
28
- color: fillStyle,
29
- side: THREE.FrontSide
30
- })
21
+ this.object3d.geometry = new THREE.SphereGeometry(rx, 20, 20)
31
22
  }
32
23
  }
33
24
 
package/src/sprite.ts CHANGED
@@ -22,14 +22,6 @@ export class Sprite extends RectPath(Shape) {
22
22
  return new RealObjectSprite2D(this)
23
23
  }
24
24
 
25
- // ready() {
26
- // super.ready()
27
-
28
- // setInterval(() => {
29
- // this.text = String(Math.random())
30
- // }, 1000)
31
- // }
32
-
33
25
  get nature() {
34
26
  return NATURE
35
27
  }
@@ -4,14 +4,15 @@ export const SCALE_MIN = 0.001
4
4
 
5
5
  export function applyAlpha(material: any, alpha: number, fillStyle: any) {
6
6
  var opacity = 1
7
- if (!fillStyle || fillStyle == 'none') {
8
- opacity = alpha
7
+ if (!fillStyle || fillStyle == 'none' || fillStyle == 'transparent') {
8
+ opacity = 0
9
9
  } else {
10
10
  var fillAlpha = typeof fillStyle == 'string' ? tinycolor(fillStyle).getAlpha() : 1
11
11
  opacity = alpha * fillAlpha
12
12
  }
13
13
 
14
14
  material.opacity = opacity
15
+ material.transparent = opacity < 1
15
16
  }
16
17
 
17
18
  export const UNIT_DIMENSION = { width: 1, height: 1, depth: 1 }
@@ -62,6 +62,6 @@ export class RealObjectCamera extends RealObjectMesh {
62
62
 
63
63
  var radius = Math.min(width, height, depth) / 2
64
64
 
65
- return new THREE.SphereGeometry(radius, 32, 32)
65
+ this.object3d.geometry = new THREE.SphereGeometry(radius, 32, 32)
66
66
  }
67
67
  }
@@ -15,32 +15,6 @@ export class RealObjectDomElement extends RealObject<CSS3DObject> {
15
15
  return new CSS3DObject((this.component as HTMLOverlayElement | HTMLOverlayContainer).element)
16
16
  }
17
17
 
18
- // private _cssObject3d?: THREE.Object3D
19
-
20
- // buildGeometry() {
21
- // var { width, height } = this.component.bounds
22
-
23
- // return new THREE.PlaneGeometry(width, height)
24
- // }
25
-
26
- // buildMaterial() /* : THREE.MeshMaterialType | THREE.MeshMaterialType[] */ {
27
- // var material = new THREE.MeshBasicMaterial()
28
-
29
- // material.color.set('black')
30
- // material.opacity = 0
31
- // material.side = THREE.DoubleSide
32
- // material.blending = THREE.NoBlending
33
-
34
- // return material
35
- // }
36
-
37
- // get cssObject3d(): THREE.Object3D {
38
- // if (!this._cssObject3d) {
39
- // this._cssObject3d = this.buildCSS3DObject()
40
- // }
41
- // return this._cssObject3d
42
- // }
43
-
44
18
  build() {
45
19
  super.build()
46
20
 
@@ -53,53 +27,8 @@ export class RealObjectDomElement extends RealObject<CSS3DObject> {
53
27
 
54
28
  element.style.left = ''
55
29
  element.style.top = ''
56
-
57
- // this.object3d.add()
58
-
59
- // const cssobj = new CSS3DObject(element)
60
- // cssobj.position.set(-1, -1, 0)
61
-
62
- // this.object3d.add(cssobj)
63
-
64
- // return cssobj
65
30
  }
66
31
 
67
- /**
68
- * Component의 상태값의 변화를 Object3D에 반영 - translate, rotation, scale
69
- */
70
- // updateTransform() {
71
- // super.updateTransform()
72
-
73
- // var { x: tx, y: ty, z: tz } = this.position
74
- // var { x: rx, y: ry, z: rz } = this.rotation
75
- // var { x: sx, y: sy, z: sz } = this.scale
76
-
77
- // this.cssObject3d.position.set(tx, ty, tz)
78
- // this.cssObject3d.rotation.set(rx, ry, rz)
79
- // this.cssObject3d.scale.set(Math.max(sx, SCALE_MIN), Math.max(sy, SCALE_MIN), Math.max(sz, SCALE_MIN))
80
- // }
81
-
82
- // updatePosition() {
83
- // super.updatePosition()
84
-
85
- // var { x: tx, y: ty, z: tz } = this.position
86
- // this.cssObject3d.position.set(tx, ty, tz)
87
- // }
88
-
89
- // updateRotate() {
90
- // super.updateRotate()
91
-
92
- // var { x: rx, y: ry, z: rz } = this.rotation
93
- // this.cssObject3d.rotation.set(rx, ry, rz)
94
- // }
95
-
96
- // updateScale() {
97
- // super.updateScale()
98
-
99
- // var { x: sx, y: sy, z: sz } = this.scale
100
- // this.cssObject3d.scale.set(Math.max(sx, SCALE_MIN), Math.max(sy, SCALE_MIN), Math.max(sz, SCALE_MIN))
101
- // }
102
-
103
32
  updateDimension() {
104
33
  super.updateDimension()
105
34
 
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  import * as THREE from 'three'
6
- import tinycolor from 'tinycolor2'
7
6
 
8
7
  import { RealObject } from './real-object'
9
8
 
@@ -33,7 +32,7 @@ export class RealObjectExtrude extends RealObject {
33
32
  build() {
34
33
  super.build()
35
34
 
36
- var { depth = 1, fillStyle = 0xffffff, strokeStyle = 0x636363, lineWidth = 1, alpha = 1 } = this.component.state
35
+ var { depth = 1 } = this.component.state
37
36
 
38
37
  // 다각형 그리기
39
38
  var shape = this.shape
@@ -54,20 +53,19 @@ export class RealObjectExtrude extends RealObject {
54
53
 
55
54
  var geometry = this.createGeometry(shape)
56
55
 
57
- if (fillStyle && fillStyle != 'none') {
58
- var material = this.createMaterial()
59
- this._mainMesh = this.createMesh(geometry, material as THREE.Material)
60
- this._mainMesh.castShadow = true
56
+ var material = this.createMainMaterial()
57
+ this._mainMesh = this.createMainMesh(geometry, material as THREE.Material)
58
+ this._mainMesh.castShadow = true
61
59
 
62
- this.object3d.add(this._mainMesh)
63
- }
60
+ this.object3d.add(this._mainMesh)
64
61
 
65
- if (strokeStyle && strokeStyle != 'transparent' && lineWidth > 0) {
66
- this._sideMesh = this.createSideMesh(geometry, shape /* FIXME , extrudeSettings */)
67
- this._sideMesh.castShadow = true
62
+ this._sideMesh = this.createSideMesh(geometry, shape /* FIXME , extrudeSettings */)
63
+ this._sideMesh.castShadow = true
68
64
 
69
- this.object3d.add(this._sideMesh)
70
- }
65
+ this.object3d.add(this._sideMesh)
66
+
67
+ this.updateFillStyle()
68
+ this.updateStrokeStyle()
71
69
  }
72
70
 
73
71
  createGeometry(shape: THREE.Shape): THREE.BufferGeometry {
@@ -86,37 +84,14 @@ export class RealObjectExtrude extends RealObject {
86
84
  return geometry as any
87
85
  }
88
86
 
89
- createMaterial() {
90
- var { fillStyle = 'black', alpha = 1 } = this.component.state
91
-
92
- var params = {} as any
93
- var opacity = alpha
94
- const texture = RealObject.buildFillStyleTexture(this.component)
95
-
96
- if (texture) {
97
- params = {
98
- map: texture,
99
- side: THREE.FrontSide
100
- }
101
- } else if (typeof fillStyle == 'string') {
102
- if (fillStyle !== 'transparent') {
103
- params.color = fillStyle
104
- opacity *= tinycolor(fillStyle).getAlpha()
105
- } else {
106
- opacity = 0
107
- }
108
- }
109
-
87
+ createMainMaterial() {
110
88
  return new THREE.MeshStandardMaterial({
111
- ...params,
112
- opacity,
113
- transparent: opacity < 1,
114
89
  metalness: 0.5,
115
90
  roughness: 0.5
116
91
  })
117
92
  }
118
93
 
119
- createMesh(geometry: THREE.BufferGeometry, material: THREE.Material) {
94
+ createMainMesh(geometry: THREE.BufferGeometry, material: THREE.Material) {
120
95
  var mesh = new THREE.Mesh(geometry, material)
121
96
  mesh.rotation.x = -Math.PI / 2
122
97
  mesh.rotation.y = -Math.PI
@@ -126,26 +101,19 @@ export class RealObjectExtrude extends RealObject {
126
101
  }
127
102
 
128
103
  createSideMesh(geometry: THREE.BufferGeometry, shape: THREE.Shape) {
129
- var { strokeStyle = 0x000000, depth = 1, lineWidth = 0, alpha = 1 } = this.component.state
104
+ var { depth = 1, lineWidth = 0 } = this.component.state
130
105
 
131
106
  var hole = new THREE.Path()
132
107
  hole.setFromPoints(shape.getPoints())
133
108
 
134
109
  var sideMaterial = new THREE.MeshStandardMaterial({
135
- color: strokeStyle,
136
110
  metalness: 0.5,
137
- roughness: 0.5
111
+ roughness: 0.5,
112
+ // prevent overlapped layers flickering
113
+ polygonOffset: true,
114
+ polygonOffsetFactor: -0.1
138
115
  })
139
116
 
140
- var tinyStrokeStyle = tinycolor(strokeStyle)
141
- var strokeAlpha = tinyStrokeStyle.getAlpha()
142
- sideMaterial.opacity = alpha * strokeAlpha
143
- sideMaterial.transparent = alpha < 1 || strokeAlpha < 1
144
-
145
- // prevent overlapped layers flickering
146
- sideMaterial.polygonOffset = true
147
- sideMaterial.polygonOffsetFactor = -0.1
148
-
149
117
  shape = this.sideShape || shape
150
118
  shape.holes.push(hole)
151
119
 
@@ -187,7 +155,6 @@ export class RealObjectExtrude extends RealObject {
187
155
 
188
156
  var { width, height } = this.component.bounds
189
157
 
190
- // TODO component.text의 heavy한 로직을 반복적으로 실행하지 않도록, 캐싱하자.
191
158
  var poweredWidth = nextPowerOf2(width)
192
159
  var poweredHeight = nextPowerOf2(height)
193
160
 
@@ -207,23 +174,27 @@ export class RealObjectExtrude extends RealObject {
207
174
  }
208
175
 
209
176
  updateAlpha() {
210
- var { alpha = 1, fillStyle, lineStyle } = this.component.state
177
+ var { alpha = 1, fillStyle, strokeStyle } = this.component.state
211
178
 
212
179
  this._mainMesh && applyAlpha(this._mainMesh.material, alpha, fillStyle)
213
- this._sideMesh && applyAlpha(this._sideMesh.material, alpha, lineStyle && lineStyle.strokeStyle)
180
+ this._sideMesh && applyAlpha(this._sideMesh.material, alpha, strokeStyle)
214
181
  }
215
182
 
216
183
  updateStrokeStyle() {
184
+ const material = this._sideMesh?.material as THREE.MeshStandardMaterial
185
+ if (!material) {
186
+ return
187
+ }
188
+
217
189
  var { strokeStyle } = this.component.state
218
190
 
219
- if (typeof strokeStyle == 'string') {
220
- ;(this._sideMesh?.material as THREE.MeshStandardMaterial).color.set(strokeStyle)
221
- }
191
+ material.color.set(strokeStyle)
222
192
  }
223
193
 
224
194
  updateFillStyle() {
225
- var { fillStyle } = this.component.state
226
- var material = this._mainMesh?.material as THREE.MeshLambertMaterial
195
+ var { fillStyle, alpha = 1 } = this.component.state
196
+
197
+ var material = this._mainMesh?.material as THREE.MeshStandardMaterial
227
198
  if (!material) {
228
199
  return
229
200
  }
@@ -232,17 +203,8 @@ export class RealObjectExtrude extends RealObject {
232
203
 
233
204
  if (texture) {
234
205
  material.map = texture
235
- } else if (typeof fillStyle == 'string') {
236
- if (fillStyle !== 'transparent') {
237
- material.color.set(fillStyle)
238
- } else {
239
- // material.color.set(fillStyle)
240
- material.opacity = 0
241
- }
206
+ } else {
207
+ material.color.set(fillStyle)
242
208
  }
243
209
  }
244
-
245
- get rebuildingProperties(): string[] {
246
- return ['width', 'height', 'depth', 'text', 'path']
247
- }
248
210
  }
@@ -91,7 +91,7 @@ export class RealObjectGLTF extends RealObject {
91
91
  this.object3d.add(this.pivot)
92
92
  this.pivot.add(object)
93
93
 
94
- this._rescale()
94
+ this.updateDimension()
95
95
 
96
96
  if (animations && animations.length) {
97
97
  for (var i = 0; i < animations.length; i++) {
@@ -111,7 +111,7 @@ export class RealObjectGLTF extends RealObject {
111
111
  return super.clear()
112
112
  }
113
113
 
114
- _rescale() {
114
+ updateDimension() {
115
115
  var { width = 1, height = 1, depth = 1 } = this.component.state
116
116
 
117
117
  var { x = 1, y = 1, z = 1 } = this.objectSize || {}
@@ -120,12 +120,4 @@ export class RealObjectGLTF extends RealObject {
120
120
 
121
121
  this.component.invalidate()
122
122
  }
123
-
124
- updateDimension() {
125
- this._rescale()
126
- }
127
-
128
- get rebuildingProperties(): string[] {
129
- return ['fillStyle', 'lineStyle', 'text']
130
- }
131
123
  }