with threejs r87 i have a problem calling this : console.log(mesh.geometry.faces.length); that worked fine with threejs r74. what is modified? Anyone can help me?
this is the program:
// start
var loaderF = new THREE.FileLoader();
//load a text file a output the result to the console
loaderF.load(
// resource URL
'segnalibro.stl',
// Function when resource is loaded
function ( data ) {
// output the text to the console
//console.log( data );
console.log("Caricamento modello stl finito");
},
// Function called when download progresses
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '%% loaded' );
},
// Function called when download errors
function ( xhr ) {
console.error( 'An error happened' );
}
);
var loader = new THREE.STLLoader();
STLMaterial = new THREE.MeshPhongMaterial({color: 0x7777ff});
loader.load( 'segnalibro.stl', function (geometry) {
STLMaterial = new THREE.MeshPhongMaterial( { color: 0x999999,specular: 0x111111,shininess: 20} );
mesh = new THREE.Mesh(geometry, STLMaterial);
mesh.geometry.computeBoundingBox();
console.log( mesh);
//console.log(boundingBox);
mesh.rotation.set( - Math.PI / 2, 0, -Math.PI / 2);
mesh.position.set(-125, 0, 125);
mesh.scale.set(1, 1, 1);
scene.add(mesh);
mesh.receiveShadow=true;
mesh.castShadow=true;
console.log(mesh.geometry.faces.length);
This form is for three.js bug reports and feature requests only.
This is NOT a help site. Do not ask help questions here.
If you need help, please use stackoverflow.
Describe the bug or feature request in detail.
A code snippet, screenshot, and small-test help us understand.
You can edit for small-test.
http://jsfiddle.net/akmcv7Lh/ (current revision)
http://jsfiddle.net/hw9rcLL8/ (dev)
Three.js version
- Dev
- [x ] r87
- …
Browser
- All of them
- [x ] Chrome
- Firefox
- Internet Explorer
OS
- All of them
- [x ] Windows
- macOS
- Linux
- Android
- iOS
now it work with: