我很新BabylonJs
,我目前正在边做边学。
我正在尝试插入图像作为场景的背景:
但是我浏览了整个互联网,但没有描述我如何插入图像作为背景?
如果需要这里是我的代码:
// Global variables
var canvas, engine, scene, camera,assetsManger;
var CHATROOMS = [];
var CHATCLIENTS = [];
/*
* Load the scene when the canvas is fully loaded
*/
document.addEventListener("DOMContentLoaded", function () {
if (BABYLON.Engine.isSupported()) {
initScene();
initGame();
}
}, false);
/**
* Creates a new BABYLON Engine and initialize the scene
*/
function initScene() {
// Get canvas
canvas = document.getElementById("chatCanvas");
// Create babylon engine
engine = new BABYLON.Engine(canvas, true);
// Create scene
scene = new BABYLON.Scene(engine);
assetsManger = new BABYLON.AssetsManager(scene);
// Create the camera
camera = new BABYLON.TargetCamera("camera", new BABYLON.Vector3(0,4,-10), scene);
camera.setTarget(new BABYLON.Vector3(0,0,0));
camera.attachControl(canvas);
// Create light
var light = new BABYLON.PointLight("light", new BABYLON.Vector3(0,5,-5), scene);
engine.runRenderLoop(function () {
scene.render();
});
}
function initGame() {
}