博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

一些关于three.js的摘抄笔记

Posted on 2017-03-05 14:57  SolHe  阅读(347)  评论(0编辑  收藏  举报

加载多个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/