I'm tasked to develop a web app where users upload the STL files generated by matlab code and view them. i'm having problem with passing the parameters in the STL load.
I tried following the answers in this link User uploaded textures in three.js
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').html( e.target.result);
console.log(e.target.result);
var loader = new THREE.STLLoader();
loader.load(e.target.result) , function ( geometry ) {
var material = new THREE.MeshPhongMaterial( { color: 0xff5533, specular: 0x111111, shininess: 200 } );
var mesh = new THREE.Mesh( geometry, material );
mesh.position.set( 0, - 0.25, 0.6 );
mesh.rotation.set( 0, - Math.PI / 2, 0 );
mesh.scale.set( 0.005, 0.005, 0.005 );
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add( mesh );
} );
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imgInp").change(function () {
readURL(this);
});
I expect the STL model to be rendered.