45 lines
1.4 KiB
Cheetah
45 lines
1.4 KiB
Cheetah
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>kavea</title>
|
|
<link rel="stylesheet" href="/static/kavea.css">
|
|
<script src="/static/babylon-4.2.0.js"></script>
|
|
<script src="/static/babylonjs-4.2.0.loaders.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<canvas id="renderCanvas"></canvas>
|
|
|
|
<script>
|
|
const canvas = document.getElementById("renderCanvas"); // Get the canvas element
|
|
const engine = new BABYLON.Engine(canvas, 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("", "https://assets.babylonjs.com/meshes/", "box.babylon");
|
|
|
|
const camera = new BABYLON.ArcRotateCamera("camera", -Math.PI / 2, Math.PI / 2.5, 15, new BABYLON.Vector3(0, 0, 0));
|
|
camera.attachControl(canvas, true);
|
|
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0));
|
|
|
|
return scene;
|
|
};
|
|
|
|
|
|
const scene = createScene(); //Call the createScene function
|
|
|
|
// 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();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|