加载多个geometry的方式:
(可以利用three.js自带convert_obj_three.py文件将obj文件转换成json文件)
function loadModel() { loader = new THREE.JSONLoader(); loader.load("js/your_model.js", function( geometry ) { box = []; group = new THREE.Object3D(); scene.add(group); // here i‘m creating 3 objects of same model for (var i = 0; i < 3; i++) { box[i] = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture("js/your_texture.jpg")})); box[i].scale.set(20,20,20); box[i].position.x = (120*i) - 150; group.add(box[i]); } callSomeFunctionOnceLoaded(); },"js" ); }
附一个学习地址:
http://stemkoski.github.io/Three.js/
http://helloenjoy.com/2013/from-unity-to-three-js/
时间: 2024-10-07 04:17:22