Skip to content

Commit

Permalink
fix: add shadow parser
Browse files Browse the repository at this point in the history
  • Loading branch information
gz65555 committed Mar 15, 2023
1 parent 9b68d68 commit f625330
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/loader/src/SceneLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class SceneLoader extends Loader<Scene> {
// @ts-ignore
engine.resourceManager.initVirtualResources(data.files);
return SceneParser.parse(engine, data).then((scene) => {
// parse ambient light
const ambient = data.scene.ambient;
let ambientLightPromise = Promise.resolve();
if (ambient.ambientLight) {
Expand Down Expand Up @@ -72,6 +73,16 @@ class SceneLoader extends Loader<Scene> {
}
break;
}

// parse shadow
const shadow = data.scene.shadow;
if (shadow) {
if (shadow.castShadows != undefined) scene.castShadows = shadow.castShadows;
if (shadow.shadowResolution != undefined) scene.shadowResolution = shadow.shadowResolution;
if (shadow.shadowDistance != undefined) scene.shadowDistance = shadow.shadowDistance;
if (shadow.shadowCascades != undefined) scene.shadowCascades = shadow.shadowCascades;
}

return Promise.all([ambientLightPromise, backgroundPromise]).then(() => {
resolve(scene);
});
Expand Down

0 comments on commit f625330

Please sign in to comment.