2

我正在尝试创建 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>
4

1 回答 1

2

在动画功能中

固定线路renderer.render(scene,camera);

我很抱歉发布这样一个愚蠢的问题,愚蠢的错误:|

于 2013-01-13T15:45:07.557 回答