我正在尝试创建 sun,但是当我测试运行此代码时出现错误
THREE.CanvasRenderer 54 three.min.js:262
102
Uncaught TypeError: Object #<Screen> has no method 'updateMatrixWorld' three.min.js:126
192
Uncaught TypeError: Object #<Screen> has no method 'updateMatrixWorld'
而且我也在使用最新版本,我只在昨天(2013 年 1 月 12 日)下载了。
请帮我找出我做错了什么!
另外,想知道 WebGLRenderer 和 CanvasRenderer 的区别。
<script src="vendor/three.js/three.min.js"></script>
<script src="vendor/three.js/Detector.js"></script>
<script src="vendor/three.js/ShaderExtras.js"></script>
<script src="vendor/three.js/Stats.js"></script>
<script>
var scene, renderer, camera, container, W, H;
W = parseInt(document.body.clientWidth);
H = parseInt(document.body.clientHeight);
container = document.createElement('div');
document.body.appendChild(container);
camera = new THREE.PerspectiveCamera(45, W / H, 1, 10000); //field of view, aspect ratio, near and far clipping plane
camera.position.z = 4300;
scene = new THREE.Scene();
//Sun
var sun, sun_geom, sun_mat;
sun_geom = new THREE.SphereGeometry(430, 30, 30); //radius, second and third parameters how many triangles to generate
sun_mat = new THREE.MeshNormalMaterial();
sun = new THREE.Mesh(sun_geom, sun_mat);
scene.add(sun);
//renderer
renderer = new THREE.CanvasRenderer();
renderer.setSize(W, H);
container.appendChild(renderer.domElement);
animate();
function animate() {
requestAnimationFrame(animate);
renderer.render(screen, camera);
}
</script>