在旧版本的THREE.JS上,这段代码非常合适:
var loader = new THREE.JSONLoader();
loader.load("ns.js", function(geometry){
mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial(geometry.materials));
mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.05;
scene.add(mesh);
loadRestOfScene();
});
但在新版本中,“几何体”没有材质属性。我如何获得该阵列?
答案 0 :(得分:1)
以下是您的案例中的模式:
var loader = new THREE.JSONLoader();
loader.load( 'model.js', function ( geometry, materials ) {
var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) );
scene.add( mesh );
} );
three.js r.63