Skip to content

Commit

Permalink
Exposing sky for Editor (#5901)
Browse files Browse the repository at this point in the history
* Added new properties to scene for new skybox

* Reordered scene setting skybox scale definition

* Removed forwarding of skyType component - already exposed in sky

* Moved applying properties for position, scale and tripod to applySettings in sky class

* set position and scale properties directy onto node in sky; renamed tripod to center

* added node rotation setting

* Rename sky mesh properties to include mesh in their names
  • Loading branch information
kpal81xd authored Dec 19, 2023
1 parent eb7f939 commit 64c0fad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/scene/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@ class Scene extends EventHandler {
this.skyboxRotation = (new Quat()).setFromEulerAngles(render.skyboxRotation[0], render.skyboxRotation[1], render.skyboxRotation[2]);
}

this.sky.applySettings(render);

this.clusteredLightingEnabled = render.clusteredLightingEnabled ?? false;
this.lighting.applySettings(render);

Expand Down
10 changes: 10 additions & 0 deletions src/scene/skybox/sky.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ class Sky {
this.projectedSkydomeCenterId = this.device.scope.resolve('projectedSkydomeCenter');
}


applySettings(render) {
this.node.setLocalPosition(new Vec3(render.skyMeshPosition ?? [0, 0, 0]));
this.node.setLocalEulerAngles(new Vec3(render.skyMeshRotation ?? [0, 0, 0]));
this.node.setLocalScale(new Vec3(render.skyMeshScale ?? [1, 1, 1]));
if (render.skyCenter) {
this._center = new Vec3(render.skyCenter);
}
}

/**
* The type of the sky. One of the SKYMESH_* constants. Defaults to {@link SKYTYPE_INFINITE}.
* Can be:
Expand Down

0 comments on commit 64c0fad

Please sign in to comment.