javascript - Java script preload contents three.js -
simply pre-load contents bar or ever in three.js project or javascript either way should fine, im familiar action-script task cant seem manage in javascript:
heres code:
var loader = new three.objmtlloader(); loader.load( 'myobject.obj', 'myobject.mtl', function ( object ) { for(k in object.children){ object.children[k].position.z =-5; console.log("position changed"); } scene.add( object ); console.log("the item loaded");
i have looked @ loader examples three.js sample files dont follow well, there way check file size vs file bytes received , implement above, have tried returns under-fine. jquery welcomed
i have similar problem. have created array
preload , store objects in there. passed , returned currentid
, able store them after that. in objects3dlistjson
put info paths
for (var curobj = 0; curobj < objects3dlistjson.length; curobj++) { loadermtl.load(curobj, objpath, mtlpath, function (object, currentid) { var obj3d = new obj3d(objects3dlistjson[currentid].objectname, object) objects3d.push(obj3d); } }
of course changed objmtlloader
return current id. hope on way.
Comments
Post a Comment