Skip to content

Commit

Permalink
Fixed ColladaLoader to create appropriate materials. Updated monster …
Browse files Browse the repository at this point in the history
…DAE to look better with phong shading.
  • Loading branch information
ekitson committed Mar 4, 2012
1 parent 8d33da6 commit 4848c11
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
4 changes: 2 additions & 2 deletions examples/models/monster.dae
Original file line number Diff line number Diff line change
Expand Up @@ -1380,10 +1380,10 @@
</texture>
</diffuse>
<specular>
<color>0.9 0.9 0.9 1</color>
<color>0.1 0.1 0.1 1</color>
</specular>
<shininess>
<float>0.415939</float>
<float>20</float>
</shininess>
<reflective>
<color>0 0 0 1</color>
Expand Down
32 changes: 12 additions & 20 deletions src/extras/loaders/ColladaLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2935,17 +2935,9 @@ THREE.ColladaLoader = function () {

}

} else {

if ( prop == 'diffuse' ) {

props[ 'color' ] = cot.color.getHex();

} else if ( !transparent ) {
} else if ( prop == 'diffuse' || !transparent ) {

props[ prop ] = cot.color.getHex();

}
props[ prop ] = cot.color.getHex();

}

Expand Down Expand Up @@ -2979,27 +2971,27 @@ THREE.ColladaLoader = function () {
}

props[ 'shading' ] = preferredShading;
this.material = new THREE.MeshLambertMaterial( props );

switch ( this.type ) {

case 'constant':
case 'lambert':

props.color = props.emission;
this.material = new THREE.MeshBasicMaterial( props );
break;

case 'phong':
case 'blinn':

default:

/*
if ( !transparent ) {
// this.material = new THREE.MeshPhongMaterial(props);
props.color = props.diffuse;
this.material = new THREE.MeshPhongMaterial( props );
break;

}
*/
case 'lambert':
default:

props.color = props.diffuse;
this.material = new THREE.MeshLambertMaterial( props );
break;

}
Expand Down

0 comments on commit 4848c11

Please sign in to comment.