@operato/scene-visualizer 8.0.0-beta.1 → 8.0.0

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 (95) hide show
  1. package/package.json +6 -6
  2. package/CHANGELOG.md +0 -649
  3. package/attachments/0d91a37d-c2d7-4c6d-88dc-a29e5bbea361.png +0 -0
  4. package/attachments/1b07c8d3-07d5-4007-b02e-031ee1755539.glb +0 -0
  5. package/attachments/226c6c23-c4fd-46c8-93e3-3d3d9c4bb8a9.glb +0 -0
  6. package/attachments/4425ca46-cf1d-476d-9185-dcb881ecad1f.glb +0 -0
  7. package/attachments/51e7c45d-6eae-4baf-a4e2-ba979b7e77cd.glb +0 -0
  8. package/attachments/54427925-c109-4499-875c-fb14207b95c5.glb +0 -0
  9. package/attachments/8cc70a65-e20f-4187-83c8-64deb3faf3d9.glb +0 -0
  10. package/attachments/964d004d-1fe7-4224-89a6-2b6e86db233c.glb +0 -0
  11. package/attachments/ff47fd63-6f1c-4a69-b965-9bb03797a415.png +0 -0
  12. package/db.sqlite +0 -0
  13. package/demo/index-modeller.html +0 -112
  14. package/demo/index.html +0 -109
  15. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -25
  16. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -25
  17. package/logs/application-2025-01-07-10.log +0 -106
  18. package/logs/application-2025-01-07-14.log +0 -4
  19. package/logs/application-2025-01-07-15.log +0 -4
  20. package/logs/connections-2025-01-07-10.log +0 -106
  21. package/logs/connections-2025-01-07-14.log +0 -53
  22. package/logs/connections-2025-01-07-15.log +0 -53
  23. package/schema.graphql +0 -4552
  24. package/src/banner.ts +0 -88
  25. package/src/camera.ts +0 -132
  26. package/src/component.d.ts +0 -10
  27. package/src/cube.ts +0 -39
  28. package/src/cylinder.ts +0 -39
  29. package/src/desk.ts +0 -135
  30. package/src/editors/index.ts +0 -13
  31. package/src/editors/property-editor-gltf-info.ts +0 -135
  32. package/src/editors/property-editor-location-increase-pattern.ts +0 -260
  33. package/src/effects/outline.ts +0 -54
  34. package/src/ellipse.ts +0 -37
  35. package/src/gltf-object.ts +0 -117
  36. package/src/html-overlay-element.ts +0 -13
  37. package/src/index.ts +0 -29
  38. package/src/light.ts +0 -155
  39. package/src/polygon.ts +0 -88
  40. package/src/rack-table-cell.ts +0 -386
  41. package/src/rack-table.ts +0 -1296
  42. package/src/rack.ts +0 -232
  43. package/src/rect.ts +0 -39
  44. package/src/scene/component.ts +0 -38
  45. package/src/sphere.ts +0 -39
  46. package/src/sprite.ts +0 -30
  47. package/src/stock.ts +0 -262
  48. package/src/templates/3d-container.ts +0 -21
  49. package/src/templates/banner.ts +0 -21
  50. package/src/templates/camera.ts +0 -25
  51. package/src/templates/cube.ts +0 -20
  52. package/src/templates/cylinder.ts +0 -20
  53. package/src/templates/desk.ts +0 -20
  54. package/src/templates/gltf-object.ts +0 -20
  55. package/src/templates/index.ts +0 -29
  56. package/src/templates/light.ts +0 -23
  57. package/src/templates/pallet.ts +0 -20
  58. package/src/templates/rack-table.ts +0 -21
  59. package/src/templates/sphere.ts +0 -20
  60. package/src/templates/sprite.ts +0 -21
  61. package/src/templates/visualizer.ts +0 -21
  62. package/src/templates/wall.ts +0 -20
  63. package/src/text.ts +0 -10
  64. package/src/three-container-editor.ts +0 -187
  65. package/src/three-container.ts +0 -724
  66. package/src/three-controls.ts +0 -778
  67. package/src/three-layout.ts +0 -25
  68. package/src/three-space.ts +0 -732
  69. package/src/threed/common.ts +0 -21
  70. package/src/threed/floor/floor.ts +0 -62
  71. package/src/threed/html/elements.ts +0 -27
  72. package/src/threed/index.ts +0 -15
  73. package/src/threed/real-object-camera-meshed.ts +0 -67
  74. package/src/threed/real-object-camera.ts +0 -41
  75. package/src/threed/real-object-dom-element.ts +0 -55
  76. package/src/threed/real-object-dummy.ts +0 -13
  77. package/src/threed/real-object-extrude.ts +0 -210
  78. package/src/threed/real-object-gltf.ts +0 -136
  79. package/src/threed/real-object-group.ts +0 -35
  80. package/src/threed/real-object-mesh.ts +0 -74
  81. package/src/threed/real-object-plane.ts +0 -27
  82. package/src/threed/real-object-scene.ts +0 -84
  83. package/src/threed/real-object-sprite-2d.ts +0 -54
  84. package/src/threed/real-object-sprite.ts +0 -64
  85. package/src/threed/real-object-text.ts +0 -86
  86. package/src/threed/real-object.ts +0 -326
  87. package/src/threed/texture/canvas-texture.ts +0 -67
  88. package/src/threed/texture/text-texture.ts +0 -100
  89. package/src/threed/three-dimensional-container.ts +0 -9
  90. package/src/threed/utils/bound-uv-generator.ts +0 -80
  91. package/src/visualizer.ts +0 -319
  92. package/src/wall.ts +0 -50
  93. package/tsconfig.json +0 -24
  94. package/tsconfig.tsbuildinfo +0 -1
  95. package/web-dev-server.config.mjs +0 -27
@@ -1,260 +0,0 @@
1
- import '@operato/i18n/ox-i18n.js'
2
-
3
- import { css, html, TemplateResult } from 'lit'
4
- import { customElement, property } from 'lit/decorators.js'
5
-
6
- import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
7
-
8
- @customElement('property-editor-location-increase-pattern')
9
- export default class LocationIncreasePatternEditor extends OxPropertyEditor {
10
- static styles = [
11
- ...OxPropertyEditor.styles,
12
- css`
13
- fieldset {
14
- border: none;
15
- border-bottom: 1px solid #cfd8dc;
16
- color: var(--primary-text-color);
17
- font-size: 12px;
18
- padding: 0 0 10px 0;
19
- margin: 0 0 10px 0;
20
- }
21
-
22
- fieldset legend {
23
- padding: 5px 0 0 5px;
24
- font-size: 11px;
25
- color: #e46c2e;
26
- font-weight: bold;
27
- text-transform: capitalize;
28
- }
29
-
30
- .property-grid {
31
- display: grid;
32
- grid-template-columns: repeat(10, 1fr);
33
- grid-gap: 5px;
34
- grid-auto-rows: minmax(24px, auto);
35
- margin: 10px 0 0 0;
36
- }
37
-
38
- .property-grid > * {
39
- line-height: 1.5;
40
- }
41
-
42
- #border-set > mwc-icon {
43
- grid-column: span 2;
44
- margin: 0 0 0 8px;
45
- width: 32px;
46
- height: 32px;
47
- }
48
-
49
- .property-grid > label {
50
- grid-column: span 3;
51
- text-align: right;
52
- text-transform: capitalize;
53
- }
54
-
55
- .property-grid > paper-dropdown-menu,
56
- .property-grid > input {
57
- grid-column: span 7;
58
- padding: 0;
59
- margin: 0;
60
- }
61
-
62
- .property-grid > .checkbox-row {
63
- grid-column: span 10;
64
-
65
- display: grid;
66
- grid-template-columns: repeat(10, 1fr);
67
- grid-gap: 5px;
68
- grid-auto-rows: minmax(24px, auto);
69
- align-items: center;
70
- }
71
-
72
- .checkbox-row > input {
73
- grid-column: span 4 / auto;
74
- order: 1;
75
- place-self: center end;
76
- }
77
-
78
- .checkbox-row > label {
79
- grid-column: span 6;
80
- text-align: left;
81
- }
82
-
83
- #pattern-set {
84
- overflow: hidden;
85
- grid-column: 1 / -1;
86
- }
87
-
88
- #pattern-set paper-button {
89
- background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAASwCAMAAABo/yIHAAAAxlBMVEVHcEx8fHx8fHy8nIC7nIC8nIC8nID///+7nIC7nIG8nIC7nIDHrZd8fHy8nIDby7zu5t+8nIHbyr3ayrz////S0tK8nIGzs7N8fHzR0dFnZ2eysrK7nICdgWu9n4X9/PzOuKV/f3+7u7vm2tD49/a0tLSkpKSCgoLAo4qrq6vX1tbQ0NCWlpafn5/HrpmHh4fUwbHEqZLt5d6urq7czb+6oo+3qZ3z7unr6+vb2tqOjo7e3t62raf28O3g1MmLi4u9vb3Ozs62VZOkAAAAFHRSTlMAYLjOuhKBgGD3pOTc9T2wsK6wsCxSu/EAAAnrSURBVHja7Z2NWts2FIazQhtoWdd28XEyH5ykwRDaEAI4SaFAy/3f1CzJP7ItJ5ZKu1G+9ykgPH9IthL25NWJ6HR+E1h8OjxUH3u7+7t7LXNc5Pb2ucf7WtD3/SAIbm9Xq+UyDEPiEr5/eBgkH/6Skxzvarlebzg8urucxIuL+cW0muwdHvbER9gT7FvnRub+1g05kRH0JqHI7ZVyGV6lKW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
- display: block;
92
- float: left;
93
- margin: 0 7px 10px 0 !important;
94
- width: 55px;
95
- height: 40px;
96
- min-width: inherit;
97
- }
98
- #pattern-set paper-button iron-icon {
99
- display: none;
100
- }
101
- #pattern-set paper-button[data-value='+u+s'] {
102
- background-position: 50% 3px;
103
- }
104
- #pattern-set paper-button[data-value='+u-s'] {
105
- background-position: 50% -97px;
106
- }
107
- #pattern-set paper-button[data-value='-u+s'] {
108
- background-position: 50% -197px;
109
- }
110
- #pattern-set paper-button[data-value='-u-s'] {
111
- background-position: 50% -297px;
112
- }
113
- #pattern-set paper-button[data-value='+s+u'] {
114
- background-position: 50% -397px;
115
- }
116
- #pattern-set paper-button[data-value='+s-u'] {
117
- background-position: 50% -497px;
118
- }
119
- #pattern-set paper-button[data-value='-s+u'] {
120
- background-position: 50% -597px;
121
- }
122
- #pattern-set paper-button[data-value='-s-u'] {
123
- background-position: 50% -697px;
124
- }
125
- #pattern-set paper-button[data-value='cw'] {
126
- background-position: 50% -797px;
127
- }
128
- #pattern-set paper-button[data-value='ccw'] {
129
- background-position: 50% -897px;
130
- }
131
- #pattern-set paper-button[data-value='zigzag'] {
132
- background-position: 50% -997px;
133
- }
134
- #pattern-set paper-button[data-value='zigzag-reverse'] {
135
- background-position: 50% -1097px;
136
- }
137
-
138
- label {
139
- order: initial;
140
- }
141
-
142
- input {
143
- order: initial;
144
- }
145
-
146
- #skip-numbering {
147
- order: initial;
148
- grid-column: span 4;
149
- }
150
- label[for='skip-numbering'] {
151
- order: 1;
152
- grid-column: span 5;
153
- text-align: left;
154
- }
155
- `
156
- ]
157
-
158
- editorTemplate(value: any, spec: PropertySpec): TemplateResult {
159
- // TODO: background image change to use the url-loader
160
- return html`
161
- <fieldset fullwidth>
162
- <legend><ox-i18n msgid="label.location-increase-pattern">Increase Pattern</ox-i18n></legend>
163
-
164
- <div class="property-grid">
165
- <label> <ox-i18n msgid="label.start-section">Start Section</ox-i18n> </label>
166
- <input
167
- type="number"
168
- data-start-section
169
- value="${this.startSection}"
170
- @change=${(e: Event) => (this.startSection = (e.target! as HTMLInputElement).valueAsNumber)}
171
- />
172
-
173
- <label> <ox-i18n msgid="label.start-unit">Start Unit</ox-i18n> </label>
174
- <input
175
- type="number"
176
- data-start-unit
177
- value="${this.startUnit}"
178
- @change=${(e: Event) => (this.startUnit = (e.target! as HTMLInputElement).valueAsNumber)}
179
- />
180
-
181
- <div class="checkbox-row" fullwidth>
182
- <input id="skip-numbering" type="checkbox" data-skip-numbering ?checked="${this.skipNumbering}" />
183
- <label for="skip-numbering">
184
- <ox-i18n msgid="label.skip-numbering">Skip Numbering</ox-i18n>
185
- </label>
186
- </div>
187
-
188
- <div
189
- id="pattern-set"
190
- class="property-grid location-increase-pattern-btn"
191
- @click=${(e: Event) => this._onTapType(e)}
192
- >
193
- <paper-button data-value="cw"> <iron-icon icon="editor:border-outer"></iron-icon> </paper-button>
194
- <paper-button data-value="ccw">
195
- <iron-icon icon="editor:border-inner"></iron-icon>
196
- </paper-button>
197
- <paper-button data-value="zigzag">
198
- <iron-icon icon="editor:border-inner"></iron-icon>
199
- </paper-button>
200
- <paper-button data-value="zigzag-reverse">
201
- <iron-icon icon="editor:border-inner"></iron-icon>
202
- </paper-button>
203
- </div>
204
- </div>
205
- </fieldset>
206
- `
207
- }
208
-
209
- @property({ type: Number }) startSection: number = 1
210
- @property({ type: Number }) startUnit: number = 1
211
- @property({ type: Boolean }) skipNumbering: boolean = true
212
- @property({ type: Object }) _specificPropEl: HTMLElement | null = null
213
-
214
- connectedCallback() {
215
- super.connectedCallback()
216
- if (this.property && this.property.event) {
217
- Object.entries(this.property.event).forEach(entry => {
218
- if (entry[0]) {
219
- document.addEventListener(entry[0] as any, entry[1] as any)
220
- }
221
- })
222
- }
223
- }
224
-
225
- disconnectedCallback() {
226
- super.disconnectedCallback()
227
-
228
- if (this.property && this.property.event) {
229
- Object.entries(this.property.event).forEach(entry => {
230
- if (entry[0]) {
231
- document.removeEventListener(entry[0] as any, entry[1] as any)
232
- }
233
- })
234
- }
235
- }
236
-
237
- _onTapType(e: Event) {
238
- var target = e.target as HTMLElement
239
-
240
- const increasingDirection = target?.closest('[data-value]')?.getAttribute('data-value')
241
- if (!increasingDirection) {
242
- return
243
- }
244
-
245
- this.dispatchEvent(
246
- new CustomEvent('i-need-selected', {
247
- bubbles: true,
248
- composed: true,
249
- detail: {
250
- callback: (selected: any[]) => {
251
- const table = selected[0].parent
252
- table.increaseLocation(increasingDirection, this.skipNumbering, this.startSection, this.startUnit)
253
- }
254
- }
255
- })
256
- )
257
-
258
- e.stopPropagation()
259
- }
260
- }
@@ -1,54 +0,0 @@
1
- import * as THREE from 'three'
2
- import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js'
3
-
4
- const vertexShader = `
5
- uniform float outline;
6
- void main() {
7
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position + normal * outline, 1.0);
8
- }
9
- `
10
-
11
- const fragmentShader = `
12
- uniform vec3 color;
13
- uniform float opacity;
14
- void main() {
15
- gl_FragColor = vec4(color, opacity);
16
- }
17
- `
18
- const outlineMaterial = new THREE.ShaderMaterial({
19
- uniforms: {
20
- color: { value: new THREE.Color('#f00') },
21
- opacity: { value: 1.0 },
22
- outline: { value: 0.2 }
23
- },
24
- vertexShader,
25
- fragmentShader,
26
- side: THREE.BackSide
27
- })
28
-
29
- function outlineMesh(mesh: THREE.Mesh) {
30
- // let outlineGeometry
31
- // if (mesh.geometry.isBufferGeometry) {
32
- // outlineGeometry = new THREE.BufferGeometry().fromBufferGeometry(mesh.geometry)
33
- // } else {
34
- let outlineGeometry = mesh.geometry.clone()
35
- // }
36
- BufferGeometryUtils.mergeBufferGeometries([mesh.geometry, outlineGeometry]) //.mergeVertices()
37
- outlineGeometry.computeVertexNormals()
38
- const newMesh = new THREE.Mesh(outlineGeometry, outlineMaterial.clone())
39
- mesh.add(newMesh)
40
- newMesh.name = 'outline'
41
- return newMesh
42
- }
43
-
44
- // function outlineAnimate(mesh, t) {
45
- // mesh.rotation.x += 0.01
46
- // mesh.rotation.y += 0.02
47
- // mesh.rotation.z += 0.01
48
- // let color = mesh.getObjectByName('outline').material.uniforms.color.value
49
- // color.r = Math.sin(t * 0.01 + Math.PI) * 0.5 + 0.5
50
- // color.g = Math.sin(t * 0.01 + Math.PI * 0.5) * 0.5 + 0.5
51
- // color.b = Math.sin(t * 0.01 + Math.PI) * 0.5 + 0.5
52
- // renderer.render(scene, camera)
53
- // window.requestAnimationFrame(animate)
54
- // }
package/src/ellipse.ts DELETED
@@ -1,37 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import { Ellipse } from '@hatiolab/things-scene'
5
- import * as THREE from 'three'
6
- import { RealObjectExtrude } from './threed/real-object-extrude'
7
-
8
- export class EllipseExtrude extends RealObjectExtrude {
9
- get shape() {
10
- var {
11
- cx = 0,
12
- cy = 0,
13
- rx = 1,
14
- ry = 1,
15
- startAngle = 0,
16
- endAngle = 2 * Math.PI,
17
- anticlockwise = false
18
- } = this.component.state
19
-
20
- const curve = new THREE.EllipseCurve(
21
- cx,
22
- cy, // ax, aY
23
- Math.abs(rx),
24
- Math.abs(ry), // xRadius, yRadius
25
- startAngle,
26
- endAngle, // aStartAngle, aEndAngle
27
- anticlockwise, // aClockwise
28
- 0 // aRotation
29
- )
30
-
31
- return new THREE.Shape(curve.getPoints(50))
32
- }
33
- }
34
-
35
- Ellipse.prototype.buildRealObject = function () {
36
- return new EllipseExtrude(this)
37
- }
@@ -1,117 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { Component, ComponentNature, Control, RectPath, Shape } from '@hatiolab/things-scene'
6
- import { RealObject } from './threed/real-object'
7
-
8
- import { RealObjectGLTF } from './threed/real-object-gltf'
9
-
10
- const BASE_URL_ALIAS = '$base_url'
11
-
12
- const NATURE: ComponentNature = {
13
- mutable: false,
14
- resizable: true,
15
- rotatable: true,
16
- properties: [
17
- {
18
- type: 'gltf-selector',
19
- label: 'url',
20
- name: 'src',
21
- property: {
22
- displayField: 'id',
23
- displayFullUrl: true,
24
- baseUrlAlias: BASE_URL_ALIAS,
25
- defaultStorage: '3d-model',
26
- storageFilters: {
27
- type: Array,
28
- value: [
29
- {
30
- name: 'category',
31
- value: 'image'
32
- }
33
- ]
34
- },
35
- useUpload: true,
36
- category: 'application'
37
- },
38
- observe: function (this: HTMLElement, src: string) {
39
- const info: any = this.parentNode!.querySelector('[name=gltfInfo]')
40
- info.src = src
41
- }
42
- },
43
- {
44
- type: 'gltf-info',
45
- label: '',
46
- name: 'gltfInfo',
47
- readonly: true,
48
- property: {
49
- action: (component: GLTFObject, options: any) => {
50
- component.set(options)
51
- }
52
- },
53
- editor: {
54
- fullwidth: true
55
- }
56
- }
57
- ],
58
- 'value-property': 'source',
59
- help: 'scene/component/gltf-object'
60
- }
61
-
62
- export class GLTFObject extends RectPath(Shape) {
63
- static _image: HTMLImageElement
64
-
65
- is3dish() {
66
- return true
67
- }
68
-
69
- static get image() {
70
- if (!GLTFObject._image) {
71
- GLTFObject._image = new Image()
72
- GLTFObject._image.src = new URL('../icons/canvasicon-gltf.png', import.meta.url).href
73
- }
74
-
75
- return GLTFObject._image
76
- }
77
-
78
- get controls(): Array<Control> | undefined {
79
- return []
80
- }
81
-
82
- render(context: CanvasRenderingContext2D) {
83
- var { left, top, width, height } = this.bounds
84
-
85
- context.beginPath()
86
- this.drawImage(context, GLTFObject.image, left, top, width, height)
87
- }
88
-
89
- buildRealObject(): RealObject | undefined {
90
- return new RealObjectGLTF(this)
91
- }
92
-
93
- get nature() {
94
- return NATURE
95
- }
96
-
97
- get source() {
98
- return this.getState('src')
99
- }
100
-
101
- set source(source) {
102
- this.setState('src', source)
103
- }
104
-
105
- set dimension(dimension: { width: number; height: number; depth: number }) {
106
- const { width = 1, height = 1, depth = 1 } = dimension
107
- this.setState({
108
- width,
109
- height,
110
- depth
111
- })
112
-
113
- this.realObject?.updateDimension()
114
- }
115
- }
116
-
117
- Component.register('gltf-object', GLTFObject)
@@ -1,13 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import { HTMLOverlayContainer, HTMLOverlayElement } from '@hatiolab/things-scene'
5
- import { RealObjectDomElement } from './threed/real-object-dom-element'
6
-
7
- HTMLOverlayElement.prototype.buildRealObject = function () {
8
- return new RealObjectDomElement(this)
9
- }
10
-
11
- HTMLOverlayContainer.prototype.buildRealObject = function () {
12
- return new RealObjectDomElement(this)
13
- }
package/src/index.ts DELETED
@@ -1,29 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import './scene/component'
6
-
7
- import './text'
8
- import './html-overlay-element'
9
-
10
- export * from './threed'
11
- export * from './gltf-object'
12
-
13
- export * from './camera'
14
- export * from './banner'
15
- export * from './sprite'
16
- export * from './cube'
17
- export * from './cylinder'
18
- export * from './desk'
19
- export * from './ellipse'
20
- export * from './polygon'
21
- export * from './rack'
22
- export * from './rack-table'
23
- export * from './rack-table-cell'
24
- export * from './rect'
25
- export * from './sphere'
26
- export * from './visualizer'
27
- export * from './three-container'
28
- export * from './wall'
29
- export * from './light'
package/src/light.ts DELETED
@@ -1,155 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import { Anchor, Component, ComponentNature, Ellipse } from '@hatiolab/things-scene'
5
- import * as THREE from 'three'
6
- import { RealObject } from './threed/real-object'
7
-
8
- const NATURE: ComponentNature = {
9
- mutable: false,
10
- resizable: true,
11
- rotatable: true,
12
- properties: [
13
- {
14
- type: 'select',
15
- label: 'light-type',
16
- name: 'lightType',
17
- property: {
18
- options: ['', 'point', 'directional']
19
- }
20
- },
21
- {
22
- type: 'number',
23
- label: 'intensity',
24
- name: 'intensity'
25
- },
26
- {
27
- type: 'number',
28
- label: 'distance',
29
- name: 'distance'
30
- },
31
- {
32
- type: 'number',
33
- label: 'decay',
34
- name: 'decay'
35
- },
36
- {
37
- type: 'checkbox',
38
- label: 'cast-shadow',
39
- name: 'castShadow'
40
- },
41
- {
42
- type: 'number',
43
- label: 'near',
44
- name: 'near',
45
- placeholder: '0.5'
46
- },
47
- {
48
- type: 'number',
49
- label: 'far',
50
- name: 'far',
51
- placeholder: '1000'
52
- },
53
- {
54
- type: 'number',
55
- label: 'fov',
56
- name: 'fov',
57
- placeholder: '90'
58
- },
59
- {
60
- type: 'number',
61
- label: 'zoom',
62
- name: 'zoom',
63
- placeholder: '1'
64
- },
65
- {
66
- type: 'checkbox',
67
- label: 'show-helper',
68
- name: 'showHelper'
69
- }
70
- ],
71
- help: 'scene/component/light'
72
- }
73
-
74
- export class LightObject extends RealObject<THREE.Light> {
75
- helper?: THREE.CameraHelper
76
-
77
- updatePointLight() {
78
- var {
79
- lightType = 'point',
80
- distance = 0, // unlimited
81
- intensity = 10,
82
- decay = 1,
83
- fillStyle: color = 'white',
84
- castShadow,
85
- near = 0.5,
86
- far = 1000,
87
- fov = 90,
88
- zoom = 1,
89
- showHelper
90
- } = this.component.state
91
-
92
- this.object3d!.color = new THREE.Color(color)
93
- if (lightType == 'point') {
94
- ;(this.object3d as THREE.PointLight)!.distance = distance
95
- ;(this.object3d as THREE.PointLight)!.decay = decay
96
- }
97
- this.object3d!.intensity = intensity
98
- this.object3d!.castShadow = castShadow
99
- if (castShadow) {
100
- const camera = this.object3d!.shadow?.camera as THREE.PerspectiveCamera
101
- camera.far = far
102
- camera.near = near
103
- camera.fov = fov
104
- camera.zoom = zoom
105
- }
106
-
107
- if (showHelper) {
108
- const camera = this.object3d!.shadow?.camera as THREE.PerspectiveCamera
109
-
110
- if (!this.helper) {
111
- this.helper = new THREE.CameraHelper(camera!)
112
- this.object3d.add(this.helper)
113
- }
114
- } else if (this.helper) {
115
- this.object3d.remove(this.helper)
116
- delete this.helper
117
- }
118
- }
119
-
120
- protected getObject3dInstance(): THREE.Light {
121
- var { lightType = 'point' } = this.component.state
122
-
123
- return lightType == 'point' ? new THREE.PointLight() : new THREE.DirectionalLight()
124
- }
125
-
126
- update() {
127
- this.clear()
128
- this.build()
129
-
130
- this.updateDimension()
131
- this.updateHidden()
132
-
133
- this.updatePointLight()
134
- }
135
- }
136
-
137
- export class PointLight extends Ellipse {
138
- is3dish() {
139
- return true
140
- }
141
-
142
- buildRealObject(): RealObject | undefined {
143
- return new LightObject(this)
144
- }
145
-
146
- get anchors(): Array<Anchor> {
147
- return []
148
- }
149
-
150
- get nature(): ComponentNature {
151
- return NATURE
152
- }
153
- }
154
-
155
- Component.register('light', PointLight)