@@ -12,7 +12,9 @@ import { AssetElement } from '../asset';
12
12
* @category Components
13
13
*/
14
14
class SplatComponentElement extends ComponentElement {
15
- private _asset : string = '' ;
15
+ private _asset = '' ;
16
+
17
+ private _castShadows = false ;
16
18
17
19
/** @ignore */
18
20
constructor ( ) {
@@ -21,7 +23,8 @@ class SplatComponentElement extends ComponentElement {
21
23
22
24
getInitialComponentData ( ) {
23
25
return {
24
- asset : AssetElement . get ( this . _asset )
26
+ asset : AssetElement . get ( this . _asset ) ,
27
+ castShadows : this . _castShadows
25
28
} ;
26
29
}
27
30
@@ -53,8 +56,31 @@ class SplatComponentElement extends ComponentElement {
53
56
return this . _asset ;
54
57
}
55
58
59
+ /**
60
+ * Sets whether the splat casts shadows.
61
+ * @param value - Whether the splat casts shadows.
62
+ */
63
+ set castShadows ( value : boolean ) {
64
+ this . _castShadows = value ;
65
+ if ( this . component ) {
66
+ this . component . castShadows = value ;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Gets whether the splat casts shadows.
72
+ * @returns Whether the splat casts shadows.
73
+ */
74
+ get castShadows ( ) {
75
+ return this . _castShadows ;
76
+ }
77
+
56
78
static get observedAttributes ( ) {
57
- return [ ...super . observedAttributes , 'asset' ] ;
79
+ return [
80
+ ...super . observedAttributes ,
81
+ 'asset' ,
82
+ 'cast-shadows'
83
+ ] ;
58
84
}
59
85
60
86
attributeChangedCallback ( name : string , _oldValue : string , newValue : string ) {
@@ -64,6 +90,9 @@ class SplatComponentElement extends ComponentElement {
64
90
case 'asset' :
65
91
this . asset = newValue ;
66
92
break ;
93
+ case 'cast-shadows' :
94
+ this . castShadows = this . hasAttribute ( 'cast-shadows' ) ;
95
+ break ;
67
96
}
68
97
}
69
98
}
0 commit comments