简体   繁体   English

调用“ FaceNormalsHelper”会导致“ TypeError:this.update不是函数”

[英]Calling 'FaceNormalsHelper' results in 'TypeError: this.update is not a function'

I'm trying to call FaceNormalsHelper from the file three.js/src/extras/helpers/FaceNormalsHelper.js but it seems to result in an error: 我想打电话给FaceNormalsHelper从文件three.js/src/extras/helpers/FaceNormalsHelper.js但它似乎产生一个错误:

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

The error occurs at line 32 in the mentioned file. 错误发生在提到的文件中的第32行。 This is how I do the calling (look at the last line): 这是我进行呼叫的方式(请看最后一行):

    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 );

你忘了new

var normals = new THREE.FaceNormalsHelper( mesh );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM