I want to show a preview of an STL file using three.js. I followed the following tutorial, because this is exactly what I need:
I get an error called undefined is not a function (near '...loader.addEventListener...') in the following line:
var loader=new THREE.STLLoader();
loader.addEventListener('load', function (event){
var geometry=event.content;
var material=new THREE.MeshLambertMaterial({ ambient: 0xFBB917,color: 0xfdd017 });
var mesh=new THREE.Mesh(geometry, material);
scene.add(mesh);});
I also included all files correctly, what is wrong with my code or is there any alternative for a simple preview of a STL file using javascript?