关闭JSONLoader默认纹理检查?

时间:2016-03-02 09:32:25

标签: javascript three.js textures texture-mapping

我从不同的位置加载纹理,但JSONLoader会自动从目录加载纹理。是否有选项使JSONLoader跳过其默认纹理加载?

1 个答案:

答案 0 :(得分:0)

使用以下代码实现此目的

jsonLoader.load(' model.js',addModelToScene);

function addModelToScene(geometry) {
            var wall_lamp_texture = new THREE.ImageUtils.loadTexture(obj_path + "bathroom/bathroom_lamp_texture.jpg");
            var wallLampMaterial = new THREE.MeshPhongMaterial({
                map: wall_lamp_texture,
                side: THREE.DoubleSide
            });
            wall_lamp_model = new THREE.Mesh(geometry, wallLampMaterial);
            wall_lamp_model.position.set(wallWidth / 2, wallHeight - 150, 0);
            wall_lamp_model.rotation.y = -Math.PI / 2;
            wall_lamp_model.scale.set(5, 5, 5);
            scene.add(wall_lamp_model);
        }