提交 18c28b64 编写于 作者: A alteredq

Fixed handling of meshes with multiple materials in SceneLoader.

As per discussion in #1201
上级 24a2c319
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
......@@ -74,7 +74,7 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
g, o, m, l, d, p, r, q, s, c, t, f, tt, pp, u,
geometry, material, camera, fog,
texture, images,
materials, light,
light,
data, binLoader, jsonLoader,
counter_models, counter_textures,
total_models, total_textures,
......@@ -183,13 +183,8 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
// not anymore support for multiple materials
// shouldn't really be array
for( i = 0; i < o.materials.length; i ++ ) {
materials = result.materials[ o.materials[ i ] ];
hasNormals = materials instanceof THREE.ShaderMaterial;
}
material = result.materials[ o.materials[ 0 ] ];
hasNormals = material instanceof THREE.ShaderMaterial;
if ( hasNormals ) {
......@@ -206,22 +201,22 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
q = 0;
if ( materials.length == 0 ) {
if ( o.materials.length == 0 ) {
materials = new THREE.MeshFaceMaterial();
material = new THREE.MeshFaceMaterial();
}
// dirty hack to handle meshes with multiple materials
// just use face materials defined in model
if ( materials.length > 1 ) {
if ( o.materials.length > 1 ) {
materials = new THREE.MeshFaceMaterial();
material = new THREE.MeshFaceMaterial();
}
object = new THREE.Mesh( geometry, materials );
object = new THREE.Mesh( geometry, material );
object.name = dd;
object.position.set( p[0], p[1], p[2] );
......@@ -414,7 +409,7 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
camera = new THREE.OrthographicCamera( c.left, c.right, c.top, c.bottom, c.near, c.far );
}
p = c.position;
t = c.target;
u = c.up;
......@@ -422,7 +417,7 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
camera.position.set( p[0], p[1], p[2] );
camera.target = new THREE.Vector3( t[0], t[1], t[2] );
if ( u ) camera.up.set( u[0], u[1], u[2] );
result.cameras[ dc ] = camera;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册