Published unlisted
Edited
Oct 3, 2021
Insert cell
Insert cell
BABYLON = require('https://raw.githack.com/BabylonJS/Babylon.js/ee7fb62f877de23caf225d4decf103d5c90b9467/dist/preview%20release/babylon.js')
Insert cell
BABYLON_Loaders = require('https://preview.babylonjs.com/loaders/babylonjs.loaders.min.js')
Insert cell
INSPECTOR = require.alias({
babylonjs: BABYLON
})('https://raw.githack.com/BabylonJS/Babylon.js/ee7fb62f877de23caf225d4decf103d5c90b9467/dist/preview%20release/inspector/babylon.inspector.bundle.js');
Insert cell
renderCanvas = html`<canvas style='width: 100%'></canvas>`
Insert cell
render = {
INSPECTOR;
const engine = new BABYLON.Engine(renderCanvas, true); // Generate the BABYLON 3D engine

// Add your code here matching the playground format
const createScene = function () {
const scene = new BABYLON.Scene(engine);

BABYLON.SceneLoader.ImportMeshAsync("", "", url);//, undefined, undefined, undefined, ".babylon");
const camera = new BABYLON.ArcRotateCamera("camera", -Math.PI / 2, Math.PI / 2.5, 15, new BABYLON.Vector3(0, 0, 0));
camera.attachControl(renderCanvas, true);
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0));

return scene;
};

const scene = createScene(); //Call the createScene function
//debugger;
scene.debugLayer.show();

// Register a render loop to repeatedly render the scene
engine.runRenderLoop(function () {
scene.render();
});

// Watch for browser/canvas resize events
window.addEventListener("resize", function () {
engine.resize();
});
return scene;
}
Insert cell
Insert cell
url = {
//const blb = new Blob([boxString], {type: 'text/plain'});
const fle = new File([boxString], "box.babylon", {type: 'text/plain'});
return URL.createObjectURL(fle)
}
Insert cell
dataurl = "data:;base64," + btoa(boxString)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more