2025-03-11 08:25:45 +00:00
|
|
|
<!--********************************************************************
|
|
|
|
* by jiawanlong
|
|
|
|
*********************************************************************-->
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8" />
|
2025-03-19 03:00:22 +00:00
|
|
|
<script src="./../../libs/babylon/babylon.js"></script>
|
2025-03-11 08:25:45 +00:00
|
|
|
|
|
|
|
<style>
|
|
|
|
* {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
html,
|
|
|
|
body {
|
|
|
|
overflow: hidden;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#renderCanvas {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
touch-action: none;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<canvas id="renderCanvas" touch-action="none"></canvas>
|
|
|
|
<script>
|
|
|
|
const createScene = () => {
|
|
|
|
const scene = new BABYLON.Scene(engine);
|
|
|
|
const camera = new BABYLON.ArcRotateCamera("Camera", -Math.PI / 2, Math.PI / 2.5, 3, new BABYLON.Vector3(0, 0, 0));
|
|
|
|
const light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0));
|
|
|
|
camera.attachControl(canvas, true);
|
|
|
|
const sphere = BABYLON.MeshBuilder.CreateSphere("sphere", { diameter: 2, segments: 32 }, scene);
|
|
|
|
sphere.position.y = 1;
|
|
|
|
return scene;
|
|
|
|
};
|
|
|
|
|
|
|
|
const engine = new BABYLON.Engine(document.getElementById('renderCanvas') , true);
|
|
|
|
const canvas = document.getElementById('renderCanvas') ;
|
|
|
|
const scene = createScene();
|
|
|
|
engine.runRenderLoop(() => {
|
|
|
|
scene.render();
|
|
|
|
});
|
|
|
|
window.addEventListener('resize', () => {
|
|
|
|
engine.resize();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|