|
@@ -156,7 +156,7 @@ THREE.Loader.prototype = {
|
|
|
// defaults
|
|
|
|
|
|
var mtype = 'MeshLambertMaterial';
|
|
|
- var mpars = { color: 0xeeeeee, opacity: 1.0, map: null, lightMap: null, normalMap: null, bumpMap: null, wireframe: false };
|
|
|
+ var mpars = {};
|
|
|
|
|
|
// parameters from model file
|
|
|
|
|
@@ -249,15 +249,25 @@ THREE.Loader.prototype = {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( m.colorSpecular ) {
|
|
|
+ if ( m.colorEmissive ) {
|
|
|
|
|
|
- mpars.specular = rgb2hex( m.colorSpecular );
|
|
|
+ mpars.emissive = rgb2hex( m.colorEmissive );
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( m.colorEmissive ) {
|
|
|
+ if ( mtype === 'MeshPhongMaterial' ) {
|
|
|
|
|
|
- mpars.emissive = rgb2hex( m.colorEmissive );
|
|
|
+ if ( m.colorSpecular ) {
|
|
|
+
|
|
|
+ mpars.specular = rgb2hex( m.colorSpecular );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( m.specularCoef ) {
|
|
|
+
|
|
|
+ mpars.shininess = m.specularCoef;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -276,53 +286,51 @@ THREE.Loader.prototype = {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( m.specularCoef ) {
|
|
|
-
|
|
|
- mpars.shininess = m.specularCoef;
|
|
|
+ // textures
|
|
|
|
|
|
- }
|
|
|
+ if ( texturePath ) {
|
|
|
|
|
|
- // textures
|
|
|
+ if ( m.mapDiffuse ) {
|
|
|
|
|
|
- if ( m.mapDiffuse && texturePath ) {
|
|
|
+ create_texture( mpars, 'map', m.mapDiffuse, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy );
|
|
|
|
|
|
- create_texture( mpars, 'map', m.mapDiffuse, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy );
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ if ( m.mapLight ) {
|
|
|
|
|
|
- if ( m.mapLight && texturePath ) {
|
|
|
+ create_texture( mpars, 'lightMap', m.mapLight, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy );
|
|
|
|
|
|
- create_texture( mpars, 'lightMap', m.mapLight, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy );
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ if ( m.mapAO ) {
|
|
|
|
|
|
- if ( m.mapAO && texturePath ) {
|
|
|
+ create_texture( mpars, 'aoMap', m.mapAO, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy );
|
|
|
|
|
|
- create_texture( mpars, 'aoMap', m.mapAO, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy );
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ if ( m.mapBump ) {
|
|
|
|
|
|
- if ( m.mapBump && texturePath ) {
|
|
|
+ create_texture( mpars, 'bumpMap', m.mapBump, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy );
|
|
|
|
|
|
- create_texture( mpars, 'bumpMap', m.mapBump, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy );
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ if ( m.mapNormal ) {
|
|
|
|
|
|
- if ( m.mapNormal && texturePath ) {
|
|
|
+ create_texture( mpars, 'normalMap', m.mapNormal, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy );
|
|
|
|
|
|
- create_texture( mpars, 'normalMap', m.mapNormal, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy );
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ if ( m.mapSpecular ) {
|
|
|
|
|
|
- if ( m.mapSpecular && texturePath ) {
|
|
|
+ create_texture( mpars, 'specularMap', m.mapSpecular, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy );
|
|
|
|
|
|
- create_texture( mpars, 'specularMap', m.mapSpecular, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy );
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ if ( m.mapAlpha ) {
|
|
|
|
|
|
- if ( m.mapAlpha && texturePath ) {
|
|
|
+ create_texture( mpars, 'alphaMap', m.mapAlpha, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy );
|
|
|
|
|
|
- create_texture( mpars, 'alphaMap', m.mapAlpha, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy );
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|