我正在使用下面的代码来渲染一个 Blender 模型(默认的立方体模型刚刚开始)并且没有显示任何内容:
<html>
<head>
<title>Test page for the </title>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<body>
<div id="container"></div>
<script src="src/three.min.js"></script>
<script src="src/Stats.js"></script>
<script>
var camera, scene, renderer, loader;
init();
render();
function init(){
var container = document.getElementById('container');
camera = new THREE.PerspectiveCamera(10, window.innerWidth/window.innerHeight, 1, 500);
camera.position.y = 100;
camera.position.z = 100;
controls = new THREE.TrackballControls( camera );
scene = new THREE.Scene();
loader = new THREE.JSONLoader();
loader.load('obj/one.js', function (geometry){
mesh = new THREE.Mesh( geometry, new THREE.MeshNormalMaterial({overdraw: true}));
scene.add(mesh);
});
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
container.appendChild(renderer.domElement);
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
container.appendChild( stats.domElement );
window.addEventListener( 'resize', onWindowResize, false );
}
function render(){
renderer.render(scene, camera);
controls.update();
stats.update();
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
</script>
</body>
</html>
一切都正确放置在他们的路径中,我得到的只是一个空白屏幕。建议?