提交 67f084e1 编写于 作者: M Mugen87

ColladaLoader2: Handling missing material definitions

上级 996775b6
......@@ -1980,7 +1980,11 @@ THREE.ColladaLoader.prototype = {
// material
materialKeys.push( primitive.material );
if ( primitive.material ) {
materialKeys.push( primitive.material );
}
// geometry data
......@@ -3122,6 +3126,24 @@ THREE.ColladaLoader.prototype = {
var materials = resolveMaterialBinding( geometry.materialKeys, instanceMaterials );
// handle case if no materials are defined
if ( materials.length === 0 ) {
if ( type === 'lines' || type === 'linestrips' ) {
materials.push( new THREE.LineBasicMaterial() );
} else {
materials.push( new THREE.MeshPhongMaterial() );
}
}
// regard skinning
var skinning = ( geometry.data.attributes.skinIndex !== undefined );
if ( skinning ) {
......@@ -3134,8 +3156,12 @@ THREE.ColladaLoader.prototype = {
}
// choose between a single or multi materials (material array)
var material = ( materials.length === 1 ) ? materials[ 0 ] : materials;
// now create a specific 3D object
switch ( type ) {
case 'lines':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册