Skip to content

Commit

Permalink
Apply environment-settings on scene page
Browse files Browse the repository at this point in the history
  • Loading branch information
netpro2k committed Oct 1, 2021
1 parent 60c73bc commit 3374542
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/gltf-model-plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const extractZipFile = promisifyWorker(new SketchfabZipWorker());

function defaultInflator(el, componentName, componentData) {
if (!AFRAME.components[componentName]) {
throw new Error(`Inflator failed. "${componentName}" component does not exist.`);
console.warn(`Inflator failed. "${componentName}" component does not exist.`);
return;
}
if (AFRAME.components[componentName].multiple && Array.isArray(componentData)) {
for (let i = 0; i < componentData.length; i++) {
Expand Down
6 changes: 6 additions & 0 deletions src/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { disableiOSZoom } from "./utils/disable-ios-zoom";

import "./systems/scene-systems";
import "./gltf-component-mappings";
import { EnvironmentSystem } from "./systems/environment-system";

import { App } from "./App";

Expand Down Expand Up @@ -105,6 +106,8 @@ const onReady = async () => {
});
});

const envSystem = new EnvironmentSystem(scene);

sceneModelEntity.addEventListener("environment-scene-loaded", () => {
remountUI({ sceneLoaded: true });
const previewCamera = gltfEl.object3D.getObjectByName("scene-preview-camera");
Expand All @@ -119,6 +122,9 @@ const onReady = async () => {
}

camera.setAttribute("scene-preview-camera", "");

const environmentEl = sceneModelEntity.childNodes[0];
envSystem.updateEnvironment(environmentEl);
});

const res = await fetchReticulumAuthenticated(`/api/v1/scenes/${sceneId}`);
Expand Down

0 comments on commit 3374542

Please sign in to comment.