0

Is there a comfortable way to load many files (1.000 files, all together ~ 30MB) from a Folder? I wrote JavaScript and use the OBJLoader.js from the three.js framework. Loading one or two of those obj files won't be a problem, thanks to the nice examples on threejs.org, but how can I load this bunch of files?

ATM I work with this (basic) function:

    function loadModellByNameOBJ(name){

    var meshMat = new THREE.MeshLambertMaterial({color: 0x339933,side:THREE.DoubleSide});
    
    loader = new THREE.OBJLoader(loadingManager);
    loadingManager.onProgress = function( item, loaded, total)
    {
        console.log(item,loaded,total);
    }
    loader.load(name+".obj",function(object){
                    
                    for(var i = 0; i < object.children.length;i++)
                    {                        
                        object.children[i].material = meshMat;
                        object.children[i].geometry.computeFaceNormals();
                        object.children[i].geometry.computeVertexNormals();
                    }                
                    
                    objectGroup.add(object);
    },onProgress,onError);
}

But how can I pass it a folder instead of every single file?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • 1
    What I understand is that your question has nothing to see with three.js : the problem is how to acess to the files of a server directory... To do that you need either to know the names of each file and load them into a loop, either to write a PHP script that make the list of file names and will be requested (XHR) by the client. AFAIK You can not access to a server directory with js – jeum Nov 09 '14 at 14:15
  • If you are in the second case you'll find a solution [here](http://stackoverflow.com/questions/15774669/list-all-files-in-one-directory-php), and then make a basic (or jquery) XHR – jeum Nov 09 '14 at 14:27

0 Answers0