我正在尝试从文件中调用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 );
答案 0 :(得分:1)
您忘记了new
:
var normals = new THREE.FaceNormalsHelper( mesh );