var container;
var camera;
var scene;
var renderer;
var mesh;
var loader;
init();
function init(){
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHieght, 1 , 10000);
camera.position.z = 1000;
//scene
scene = new THREE.Scene();
loader = new THREE.ObjectLoader();
loader.load( "chesstable.js", function( mesh ) {
mesh.scale.set( 1,1,1);
scene.add(mesh);
} );
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
renderer.render(scene, camera);
}
您好,我正在尝试将从THREE.js编辑器导出的场景(一些多边形和灯光)作为json文件加载。浏览器似乎加载json文件,但我得到的只是空白页。可能是什么问题呢?提前谢谢!
答案 0 :(得分:0)
我认为它应该是这样的
loader.load( "chesstable.js", function( geom ){
mesh = new THREE.Mesh( geom, material);
scene.add(mesh);
});