Skip to content

Commit

Permalink
[esp/bindings_js] add back support for semantic information
Browse files Browse the repository at this point in the history
My earlier change where I allowed specifying the scene broke
semantic mesh support. Adding back semantic mesh support as
a URL parameter.
  • Loading branch information
Mandeep Singh Baines authored and msbaines committed Sep 25, 2019
1 parent 08550b2 commit 5524f5f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/esp/bindings_js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,31 @@

import WebDemo from "./modules/web_demo";
import VRDemo from "./modules/vr_demo";
import { defaultScene } from "./modules/defaults";
import "./bindings.css";

function preload(file) {
FS.createPreloadedFile("/", file, file, true, false);
}

Module.preRun.push(() => {
let scene = "skokloster-castle.glb";
let config = {};
config.scene = defaultScene;
for (let arg of window.location.search.substr(1).split("&")) {
let [key, value] = arg.split("=");
if (key === "scene" && value) {
scene = value;
if (key && value) {
config[key] = value;
}
}
FS.createPreloadedFile("/", scene, scene, true, false);
const scene = config.scene;
preload(scene);
Module.scene = scene;
const navmesh = scene.substr(0, scene.lastIndexOf(".")) + ".navmesh";
FS.createPreloadedFile("/", navmesh, navmesh, true, false);
const fileNoExtension = scene.substr(0, scene.lastIndexOf("."));
preload(fileNoExtension + ".navmesh");
if (config.semantic === "mp3d") {
preload(fileNoExtension + ".house");
preload(fileNoExtension + "_semantic.ply");
}
});

Module.onRuntimeInitialized = () => {
Expand Down
2 changes: 2 additions & 0 deletions src/esp/bindings_js/modules/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ export const defaultEpisode = {
};

export const defaultResolution = { height: 480, width: 640 };

export const defaultScene = "skokloster-castle.glb";

0 comments on commit 5524f5f

Please sign in to comment.