提交 ae02c24c 编写于 作者: E Eric Burns

Differentiate between heightfields and normalmaps and treat each appropriately

上级 e7f97fa5
......@@ -3370,11 +3370,33 @@ THREE.ColladaLoader = function () {
case 'diffuse':
case 'specular':
case 'transparent':
case 'bump':
this[ child.nodeName ] = ( new ColorOrTexture() ).parse( child );
break;
case 'bump':
// If 'bumptype' is 'heightfield', create a 'bump' property
// Else if 'bumptype' is 'normalmap', create a 'normal' property
// (Default to 'bump')
var bumpType = child.getAttribute( 'bumptype' );
if ( bumpType ) {
if ( bumpType.toLowerCase() === "heightfield" ) {
this[ 'bump' ] = ( new ColorOrTexture() ).parse( child );
} else if ( bumpType.toLowerCase() === "normalmap" ) {
this[ 'normal' ] = ( new ColorOrTexture() ).parse( child );
} else {
console.error( "Shader.prototype.parse: Invalid value for attribute 'bumptype' (" + bumpType +
") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'" );
this[ 'bump' ] = ( new ColorOrTexture() ).parse( child );
}
} else {
console.warn( "Shader.prototype.parse: Attribute 'bumptype' missing from bump node - defaulting to 'HEIGHTFIELD'" );
this[ 'bump' ] = ( new ColorOrTexture() ).parse( child );
}
break;
case 'shininess':
case 'reflectivity':
case 'index_of_refraction':
......@@ -3424,10 +3446,11 @@ THREE.ColladaLoader = function () {
var keys = {
'diffuse':'map',
'ambient':"lightMap" ,
'ambient':'lightMap' ,
'specular':'specularMap',
'emission':'emissionMap',
'bump':'normalMap'
'bump':'bumpMap',
'normal':'normalMap'
};
for ( var prop in this ) {
......@@ -3439,6 +3462,7 @@ THREE.ColladaLoader = function () {
case 'diffuse':
case 'specular':
case 'bump':
case 'normal':
var cot = this[ prop ];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册