致电' FaceNormalsHelper'导致' TypeError:this.update不是函数'

时间:2014-08-27 19:27:22

标签: javascript three.js

我正在尝试从文件中调用FaceNormalsHelper three.js/src/extras/helpers/FaceNormalsHelper.js但似乎导致错误:

TypeError: this.update is not a function
this.update();

错误发生在上述文件的第32行。 这是我如何进行调用(查看最后一行):

    var mesher = function mesher ( aGeometry, position, color, name, woodTexture, debug ) {
        var texture,
            material,
            mesh;

        if (woodTexture) {
            texture = THREE.ImageUtils.loadTexture( 'crate.gif' );
            texture.anisotropy = makeRenderer.renderer.getMaxAnisotropy();
            material = new THREE.MeshBasicMaterial( { map: texture } );
        } else {
            material = new THREE.MeshBasicMaterial( { color: color, wireframe: true, side: THREE.DoubleSide } );
        }
        mesh = new THREE.Mesh(aGeometry, material);
        if (debug) {
            var normals = THREE.FaceNormalsHelper( mesh );
            console.log("normals: ", normals);
        }
        mesh.position.set = position;
        mesh.name = name;
        mesh.callback = function() { makeDOMelements.info.innerHTML = name; };
        makeScene.scene.add( mesh );

    };
    Object.freeze(mesher);
    return mesher;
}

mesher( myBox3, new THREE.Vector3( 0, 0, 0 ), 0x3bf5de, "my test Box3", true, true );

1 个答案:

答案 0 :(得分:1)

您忘记了new

var normals = new THREE.FaceNormalsHelper( mesh );