Skip to content

Commit

Permalink
Convert env backgroundColor to Color
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Jun 2, 2023
1 parent 6a51665 commit 3676ddd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/inflators/environment-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export interface EnvironmentSettingsParams {
export function inflateEnvironmentSettings(world: HubsWorld, eid: number, props: EnvironmentSettingsParams) {
addComponent(world, EnvironmentSettings, eid);
const map = (EnvironmentSettings as any).map as Map<number, EnvironmentSettingsParams>;
if (props.backgroundColor) {
props.backgroundColor = new Color(props.backgroundColor);
}
const settings = Object.assign(map.get(eid) || {}, props);
map.set(eid, settings);
}
Expand All @@ -55,7 +58,7 @@ export function inflateFog(world: HubsWorld, eid: number, props: FogParams) {
);
inflateEnvironmentSettings(world, eid, {
fogType: props.type,
fogColor: new THREE.Color(props.color),
fogColor: new Color(props.color),
fogNear: props.near,
fogFar: props.far,
fogDensity: props.density
Expand All @@ -74,6 +77,6 @@ export function inflateBackground(world: HubsWorld, eid: number, props: Backgrou
"The `background` component is deprecated. Use the `backgroundColor` on the `environment-settings` component instead."
);
inflateEnvironmentSettings(world, eid, {
backgroundColor: new THREE.Color(props.backgroundColor)
backgroundColor: new Color(props.backgroundColor)
});
}

0 comments on commit 3676ddd

Please sign in to comment.