@playcanvas/web-components 0.2.12 → 0.5.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.
- package/LICENSE +21 -21
- package/README.md +84 -84
- package/dist/components/element-component.d.ts +12 -0
- package/dist/components/light-component.d.ts +48 -0
- package/dist/components/splat-component.d.ts +0 -13
- package/dist/pwc.cjs +298 -207
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +298 -207
- package/dist/pwc.js.map +1 -1
- package/dist/pwc.min.js +1 -1
- package/dist/pwc.min.js.map +1 -1
- package/dist/pwc.mjs +299 -208
- package/dist/pwc.mjs.map +1 -1
- package/package.json +76 -64
- package/src/app.ts +612 -606
- package/src/asset.ts +159 -159
- package/src/async-element.ts +46 -46
- package/src/colors.ts +150 -150
- package/src/components/camera-component.ts +557 -557
- package/src/components/collision-component.ts +183 -183
- package/src/components/component.ts +97 -97
- package/src/components/element-component.ts +367 -341
- package/src/components/light-component.ts +570 -466
- package/src/components/listener-component.ts +30 -30
- package/src/components/particlesystem-component.ts +155 -155
- package/src/components/render-component.ts +147 -147
- package/src/components/rigidbody-component.ts +227 -227
- package/src/components/screen-component.ts +157 -157
- package/src/components/script-component.ts +270 -270
- package/src/components/script.ts +90 -90
- package/src/components/sound-component.ts +230 -230
- package/src/components/sound-slot.ts +288 -288
- package/src/components/splat-component.ts +102 -133
- package/src/entity.ts +360 -360
- package/src/index.ts +63 -63
- package/src/material.ts +141 -141
- package/src/model.ts +111 -111
- package/src/module.ts +43 -43
- package/src/scene.ts +217 -217
- package/src/sky.ts +293 -293
- package/src/utils.ts +71 -71
package/src/module.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { basisInitialize, WasmModule } from 'playcanvas';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The ModuleElement interface provides properties and methods for manipulating
|
|
5
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/ | `<pc-module>`} elements.
|
|
6
|
-
* The ModuleElement interface also inherits the properties and methods of the
|
|
7
|
-
* {@link HTMLElement} interface.
|
|
8
|
-
*/
|
|
9
|
-
class ModuleElement extends HTMLElement {
|
|
10
|
-
private loadPromise: Promise<void>;
|
|
11
|
-
|
|
12
|
-
/** @ignore */
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
this.loadPromise = this.loadModule();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private async loadModule(): Promise<void> {
|
|
19
|
-
const name = this.getAttribute('name')!;
|
|
20
|
-
const glueUrl = this.getAttribute('glue')!;
|
|
21
|
-
const wasmUrl = this.getAttribute('wasm')!;
|
|
22
|
-
const fallbackUrl = this.getAttribute('fallback')!;
|
|
23
|
-
const config = { glueUrl, wasmUrl, fallbackUrl };
|
|
24
|
-
|
|
25
|
-
if (name === 'Basis') {
|
|
26
|
-
basisInitialize(config);
|
|
27
|
-
} else {
|
|
28
|
-
WasmModule.setConfig(name, config);
|
|
29
|
-
|
|
30
|
-
await new Promise<void>((resolve) => {
|
|
31
|
-
WasmModule.getInstance(name, () => resolve());
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public getLoadPromise(): Promise<void> {
|
|
37
|
-
return this.loadPromise;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
customElements.define('pc-module', ModuleElement);
|
|
42
|
-
|
|
43
|
-
export { ModuleElement };
|
|
1
|
+
import { basisInitialize, WasmModule } from 'playcanvas';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The ModuleElement interface provides properties and methods for manipulating
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/ | `<pc-module>`} elements.
|
|
6
|
+
* The ModuleElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
8
|
+
*/
|
|
9
|
+
class ModuleElement extends HTMLElement {
|
|
10
|
+
private loadPromise: Promise<void>;
|
|
11
|
+
|
|
12
|
+
/** @ignore */
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.loadPromise = this.loadModule();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private async loadModule(): Promise<void> {
|
|
19
|
+
const name = this.getAttribute('name')!;
|
|
20
|
+
const glueUrl = this.getAttribute('glue')!;
|
|
21
|
+
const wasmUrl = this.getAttribute('wasm')!;
|
|
22
|
+
const fallbackUrl = this.getAttribute('fallback')!;
|
|
23
|
+
const config = { glueUrl, wasmUrl, fallbackUrl };
|
|
24
|
+
|
|
25
|
+
if (name === 'Basis') {
|
|
26
|
+
basisInitialize(config);
|
|
27
|
+
} else {
|
|
28
|
+
WasmModule.setConfig(name, config);
|
|
29
|
+
|
|
30
|
+
await new Promise<void>((resolve) => {
|
|
31
|
+
WasmModule.getInstance(name, () => resolve());
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public getLoadPromise(): Promise<void> {
|
|
37
|
+
return this.loadPromise;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
customElements.define('pc-module', ModuleElement);
|
|
42
|
+
|
|
43
|
+
export { ModuleElement };
|
package/src/scene.ts
CHANGED
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
import { Color, Scene, Vec3 } from 'playcanvas';
|
|
2
|
-
|
|
3
|
-
import { AppElement } from './app';
|
|
4
|
-
import { AsyncElement } from './async-element';
|
|
5
|
-
import { parseColor, parseVec3 } from './utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The SceneElement interface provides properties and methods for manipulating
|
|
9
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
|
|
10
|
-
* The SceneElement interface also inherits the properties and methods of the
|
|
11
|
-
* {@link HTMLElement} interface.
|
|
12
|
-
*/
|
|
13
|
-
class SceneElement extends AsyncElement {
|
|
14
|
-
/**
|
|
15
|
-
* The fog type of the scene.
|
|
16
|
-
*/
|
|
17
|
-
private _fog = 'none'; // possible values: 'none', 'linear', 'exp', 'exp2'
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The color of the fog.
|
|
21
|
-
*/
|
|
22
|
-
private _fogColor = new Color(1, 1, 1);
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The density of the fog.
|
|
26
|
-
*/
|
|
27
|
-
private _fogDensity = 0;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The start distance of the fog.
|
|
31
|
-
*/
|
|
32
|
-
private _fogStart = 0;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The end distance of the fog.
|
|
36
|
-
*/
|
|
37
|
-
private _fogEnd = 1000;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The gravity of the scene.
|
|
41
|
-
*/
|
|
42
|
-
private _gravity = new Vec3(0, -9.81, 0);
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The PlayCanvas scene instance.
|
|
46
|
-
*/
|
|
47
|
-
scene: Scene | null = null;
|
|
48
|
-
|
|
49
|
-
async connectedCallback() {
|
|
50
|
-
await this.closestApp?.ready();
|
|
51
|
-
|
|
52
|
-
this.scene = this.closestApp!.app!.scene;
|
|
53
|
-
this.updateSceneSettings();
|
|
54
|
-
|
|
55
|
-
this._onReady();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
updateSceneSettings() {
|
|
59
|
-
if (this.scene) {
|
|
60
|
-
this.scene.fog.type = this._fog;
|
|
61
|
-
this.scene.fog.color = this._fogColor;
|
|
62
|
-
this.scene.fog.density = this._fogDensity;
|
|
63
|
-
this.scene.fog.start = this._fogStart;
|
|
64
|
-
this.scene.fog.end = this._fogEnd;
|
|
65
|
-
|
|
66
|
-
const appElement = this.parentElement as AppElement;
|
|
67
|
-
appElement.app!.systems.rigidbody!.gravity.copy(this._gravity);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Sets the fog type of the scene.
|
|
73
|
-
* @param value - The fog type.
|
|
74
|
-
*/
|
|
75
|
-
set fog(value) {
|
|
76
|
-
this._fog = value;
|
|
77
|
-
if (this.scene) {
|
|
78
|
-
this.scene.fog.type = value;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Gets the fog type of the scene.
|
|
84
|
-
* @returns The fog type.
|
|
85
|
-
*/
|
|
86
|
-
get fog() {
|
|
87
|
-
return this._fog;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Sets the fog color of the scene.
|
|
92
|
-
* @param value - The fog color.
|
|
93
|
-
*/
|
|
94
|
-
set fogColor(value: Color) {
|
|
95
|
-
this._fogColor = value;
|
|
96
|
-
if (this.scene) {
|
|
97
|
-
this.scene.fog.color = value;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Gets the fog color of the scene.
|
|
103
|
-
* @returns The fog color.
|
|
104
|
-
*/
|
|
105
|
-
get fogColor() {
|
|
106
|
-
return this._fogColor;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Sets the fog density of the scene.
|
|
111
|
-
* @param value - The fog density.
|
|
112
|
-
*/
|
|
113
|
-
set fogDensity(value: number) {
|
|
114
|
-
this._fogDensity = value;
|
|
115
|
-
if (this.scene) {
|
|
116
|
-
this.scene.fog.density = value;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Gets the fog density of the scene.
|
|
122
|
-
* @returns The fog density.
|
|
123
|
-
*/
|
|
124
|
-
get fogDensity() {
|
|
125
|
-
return this._fogDensity;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Sets the fog start distance of the scene.
|
|
130
|
-
* @param value - The fog start distance.
|
|
131
|
-
*/
|
|
132
|
-
set fogStart(value: number) {
|
|
133
|
-
this._fogStart = value;
|
|
134
|
-
if (this.scene) {
|
|
135
|
-
this.scene.fog.start = value;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Gets the fog start distance of the scene.
|
|
141
|
-
* @returns The fog start distance.
|
|
142
|
-
*/
|
|
143
|
-
get fogStart() {
|
|
144
|
-
return this._fogStart;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Sets the fog end distance of the scene.
|
|
149
|
-
* @param value - The fog end distance.
|
|
150
|
-
*/
|
|
151
|
-
set fogEnd(value: number) {
|
|
152
|
-
this._fogEnd = value;
|
|
153
|
-
if (this.scene) {
|
|
154
|
-
this.scene.fog.end = value;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Gets the fog end distance of the scene.
|
|
160
|
-
* @returns The fog end distance.
|
|
161
|
-
*/
|
|
162
|
-
get fogEnd() {
|
|
163
|
-
return this._fogEnd;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Sets the gravity of the scene.
|
|
168
|
-
* @param value - The gravity.
|
|
169
|
-
*/
|
|
170
|
-
set gravity(value: Vec3) {
|
|
171
|
-
this._gravity = value;
|
|
172
|
-
if (this.scene) {
|
|
173
|
-
const appElement = this.parentElement as AppElement;
|
|
174
|
-
appElement.app!.systems.rigidbody!.gravity.copy(value);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Gets the gravity of the scene.
|
|
180
|
-
* @returns The gravity.
|
|
181
|
-
*/
|
|
182
|
-
get gravity() {
|
|
183
|
-
return this._gravity;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
static get observedAttributes() {
|
|
187
|
-
return ['fog', 'fog-color', 'fog-density', 'fog-start', 'fog-end', 'gravity'];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
|
|
191
|
-
switch (name) {
|
|
192
|
-
case 'fog':
|
|
193
|
-
this.fog = newValue;
|
|
194
|
-
break;
|
|
195
|
-
case 'fog-color':
|
|
196
|
-
this.fogColor = parseColor(newValue);
|
|
197
|
-
break;
|
|
198
|
-
case 'fog-density':
|
|
199
|
-
this.fogDensity = parseFloat(newValue);
|
|
200
|
-
break;
|
|
201
|
-
case 'fog-start':
|
|
202
|
-
this.fogStart = parseFloat(newValue);
|
|
203
|
-
break;
|
|
204
|
-
case 'fog-end':
|
|
205
|
-
this.fogEnd = parseFloat(newValue);
|
|
206
|
-
break;
|
|
207
|
-
case 'gravity':
|
|
208
|
-
this.gravity = parseVec3(newValue);
|
|
209
|
-
break;
|
|
210
|
-
// ... handle other attributes as well
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
customElements.define('pc-scene', SceneElement);
|
|
216
|
-
|
|
217
|
-
export { SceneElement };
|
|
1
|
+
import { Color, Scene, Vec3 } from 'playcanvas';
|
|
2
|
+
|
|
3
|
+
import { AppElement } from './app';
|
|
4
|
+
import { AsyncElement } from './async-element';
|
|
5
|
+
import { parseColor, parseVec3 } from './utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The SceneElement interface provides properties and methods for manipulating
|
|
9
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
|
|
10
|
+
* The SceneElement interface also inherits the properties and methods of the
|
|
11
|
+
* {@link HTMLElement} interface.
|
|
12
|
+
*/
|
|
13
|
+
class SceneElement extends AsyncElement {
|
|
14
|
+
/**
|
|
15
|
+
* The fog type of the scene.
|
|
16
|
+
*/
|
|
17
|
+
private _fog = 'none'; // possible values: 'none', 'linear', 'exp', 'exp2'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The color of the fog.
|
|
21
|
+
*/
|
|
22
|
+
private _fogColor = new Color(1, 1, 1);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The density of the fog.
|
|
26
|
+
*/
|
|
27
|
+
private _fogDensity = 0;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The start distance of the fog.
|
|
31
|
+
*/
|
|
32
|
+
private _fogStart = 0;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The end distance of the fog.
|
|
36
|
+
*/
|
|
37
|
+
private _fogEnd = 1000;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The gravity of the scene.
|
|
41
|
+
*/
|
|
42
|
+
private _gravity = new Vec3(0, -9.81, 0);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The PlayCanvas scene instance.
|
|
46
|
+
*/
|
|
47
|
+
scene: Scene | null = null;
|
|
48
|
+
|
|
49
|
+
async connectedCallback() {
|
|
50
|
+
await this.closestApp?.ready();
|
|
51
|
+
|
|
52
|
+
this.scene = this.closestApp!.app!.scene;
|
|
53
|
+
this.updateSceneSettings();
|
|
54
|
+
|
|
55
|
+
this._onReady();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
updateSceneSettings() {
|
|
59
|
+
if (this.scene) {
|
|
60
|
+
this.scene.fog.type = this._fog;
|
|
61
|
+
this.scene.fog.color = this._fogColor;
|
|
62
|
+
this.scene.fog.density = this._fogDensity;
|
|
63
|
+
this.scene.fog.start = this._fogStart;
|
|
64
|
+
this.scene.fog.end = this._fogEnd;
|
|
65
|
+
|
|
66
|
+
const appElement = this.parentElement as AppElement;
|
|
67
|
+
appElement.app!.systems.rigidbody!.gravity.copy(this._gravity);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Sets the fog type of the scene.
|
|
73
|
+
* @param value - The fog type.
|
|
74
|
+
*/
|
|
75
|
+
set fog(value) {
|
|
76
|
+
this._fog = value;
|
|
77
|
+
if (this.scene) {
|
|
78
|
+
this.scene.fog.type = value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Gets the fog type of the scene.
|
|
84
|
+
* @returns The fog type.
|
|
85
|
+
*/
|
|
86
|
+
get fog() {
|
|
87
|
+
return this._fog;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Sets the fog color of the scene.
|
|
92
|
+
* @param value - The fog color.
|
|
93
|
+
*/
|
|
94
|
+
set fogColor(value: Color) {
|
|
95
|
+
this._fogColor = value;
|
|
96
|
+
if (this.scene) {
|
|
97
|
+
this.scene.fog.color = value;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Gets the fog color of the scene.
|
|
103
|
+
* @returns The fog color.
|
|
104
|
+
*/
|
|
105
|
+
get fogColor() {
|
|
106
|
+
return this._fogColor;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Sets the fog density of the scene.
|
|
111
|
+
* @param value - The fog density.
|
|
112
|
+
*/
|
|
113
|
+
set fogDensity(value: number) {
|
|
114
|
+
this._fogDensity = value;
|
|
115
|
+
if (this.scene) {
|
|
116
|
+
this.scene.fog.density = value;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Gets the fog density of the scene.
|
|
122
|
+
* @returns The fog density.
|
|
123
|
+
*/
|
|
124
|
+
get fogDensity() {
|
|
125
|
+
return this._fogDensity;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Sets the fog start distance of the scene.
|
|
130
|
+
* @param value - The fog start distance.
|
|
131
|
+
*/
|
|
132
|
+
set fogStart(value: number) {
|
|
133
|
+
this._fogStart = value;
|
|
134
|
+
if (this.scene) {
|
|
135
|
+
this.scene.fog.start = value;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Gets the fog start distance of the scene.
|
|
141
|
+
* @returns The fog start distance.
|
|
142
|
+
*/
|
|
143
|
+
get fogStart() {
|
|
144
|
+
return this._fogStart;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Sets the fog end distance of the scene.
|
|
149
|
+
* @param value - The fog end distance.
|
|
150
|
+
*/
|
|
151
|
+
set fogEnd(value: number) {
|
|
152
|
+
this._fogEnd = value;
|
|
153
|
+
if (this.scene) {
|
|
154
|
+
this.scene.fog.end = value;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Gets the fog end distance of the scene.
|
|
160
|
+
* @returns The fog end distance.
|
|
161
|
+
*/
|
|
162
|
+
get fogEnd() {
|
|
163
|
+
return this._fogEnd;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Sets the gravity of the scene.
|
|
168
|
+
* @param value - The gravity.
|
|
169
|
+
*/
|
|
170
|
+
set gravity(value: Vec3) {
|
|
171
|
+
this._gravity = value;
|
|
172
|
+
if (this.scene) {
|
|
173
|
+
const appElement = this.parentElement as AppElement;
|
|
174
|
+
appElement.app!.systems.rigidbody!.gravity.copy(value);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Gets the gravity of the scene.
|
|
180
|
+
* @returns The gravity.
|
|
181
|
+
*/
|
|
182
|
+
get gravity() {
|
|
183
|
+
return this._gravity;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
static get observedAttributes() {
|
|
187
|
+
return ['fog', 'fog-color', 'fog-density', 'fog-start', 'fog-end', 'gravity'];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
|
|
191
|
+
switch (name) {
|
|
192
|
+
case 'fog':
|
|
193
|
+
this.fog = newValue;
|
|
194
|
+
break;
|
|
195
|
+
case 'fog-color':
|
|
196
|
+
this.fogColor = parseColor(newValue);
|
|
197
|
+
break;
|
|
198
|
+
case 'fog-density':
|
|
199
|
+
this.fogDensity = parseFloat(newValue);
|
|
200
|
+
break;
|
|
201
|
+
case 'fog-start':
|
|
202
|
+
this.fogStart = parseFloat(newValue);
|
|
203
|
+
break;
|
|
204
|
+
case 'fog-end':
|
|
205
|
+
this.fogEnd = parseFloat(newValue);
|
|
206
|
+
break;
|
|
207
|
+
case 'gravity':
|
|
208
|
+
this.gravity = parseVec3(newValue);
|
|
209
|
+
break;
|
|
210
|
+
// ... handle other attributes as well
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
customElements.define('pc-scene', SceneElement);
|
|
216
|
+
|
|
217
|
+
export { SceneElement };
|