Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing sky for Editor #5901

Merged
merged 7 commits into from Dec 19, 2023
2 changes: 2 additions & 0 deletions src/scene/scene.js
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
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