Skip to content

Commit

Permalink
fix m-light cast-shadows (#196)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcus Longmuir <[email protected]>
  • Loading branch information
TheCodeTherapy and MarcusLongmuir authored Aug 22, 2024
1 parent e77bb46 commit 9a392b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/mml-web/src/elements/Light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const defaultLightAngle = 45;
const defaultLightEnabled = true;
const defaultLightDebug = false;
const defaultLightDistance = 0;
const defaultLightCastShadow = true;
const defaultLightCastShadows = true;
const defaultLightType = lightTypes.spotlight;

export class Light extends TransformableElement {
Expand Down Expand Up @@ -63,7 +63,7 @@ export class Light extends TransformableElement {
enabled: defaultLightEnabled,
angleDeg: defaultLightAngle,
distance: defaultLightDistance,
castShadow: defaultLightCastShadow,
castShadows: defaultLightCastShadows,
debug: defaultLightDebug,
type: defaultLightType as lightTypes,
};
Expand Down Expand Up @@ -104,9 +104,9 @@ export class Light extends TransformableElement {
(instance.light as THREE.PointLight).distance = instance.props.distance;
}
},
"cast-shadow": (instance, newValue) => {
instance.props.castShadow = parseBoolAttribute(newValue, defaultLightCastShadow);
instance.light.castShadow = instance.props.castShadow;
"cast-shadows": (instance, newValue) => {
instance.props.castShadows = parseBoolAttribute(newValue, defaultLightCastShadows);
instance.light.castShadow = instance.props.castShadows;
},
debug: (instance, newValue) => {
instance.props.debug = parseBoolAttribute(newValue, defaultLightDebug);
Expand Down Expand Up @@ -210,7 +210,7 @@ export class Light extends TransformableElement {
}

if (this.light.shadow) {
this.light.castShadow = this.props.castShadow;
this.light.castShadow = this.props.castShadows;
this.light.shadow.mapSize.width = 512;
this.light.shadow.mapSize.height = 512;
if (this.light.shadow.camera instanceof THREE.PerspectiveCamera) {
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/src/schema-src/mml.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cast-shadow" type="xs:boolean">
<xs:attribute name="cast-shadows" type="xs:boolean">
<xs:annotation>
<xs:documentation>
Whether the light cast shadows (true) or not (false). Default value is true.
Expand Down

0 comments on commit 9a392b1

Please sign in to comment.