From 9ce5de8119dc18bbad087ebbeb8b0d5f44e8fee3 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 20 Nov 2015 16:58:25 -0500 Subject: [PATCH] Material/MaterialLoader: Handle emissiveMap. --- src/loaders/MaterialLoader.js | 1 + src/materials/Material.js | 3 +++ src/math/Quaternion.js | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/loaders/MaterialLoader.js b/src/loaders/MaterialLoader.js index c0e274e8fd..f22e097c15 100644 --- a/src/loaders/MaterialLoader.js +++ b/src/loaders/MaterialLoader.js @@ -115,6 +115,7 @@ THREE.MaterialLoader.prototype = { if ( json.roughnessMap !== undefined ) material.roughnessMap = this.getTexture( json.roughnessMap ); if ( json.metalnessMap !== undefined ) material.metalnessMap = this.getTexture( json.metalnessMap ); + if ( json.emissiveMap !== undefined ) material.emissiveMap = this.getTexture( json.emissiveMap ); if ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap ); if ( json.envMap !== undefined ) { diff --git a/src/materials/Material.js b/src/materials/Material.js index ae45b19602..c9230bd277 100644 --- a/src/materials/Material.js +++ b/src/materials/Material.js @@ -172,7 +172,10 @@ THREE.Material.prototype = { } if ( this.roughnessMap instanceof THREE.Texture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid; if ( this.metalnessMap instanceof THREE.Texture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid; + + if ( this.emissiveMap instanceof THREE.Texture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid; if ( this.specularMap instanceof THREE.Texture ) data.specularMap = this.specularMap.toJSON( meta ).uuid; + if ( this.envMap instanceof THREE.Texture ) { data.envMap = this.envMap.toJSON( meta ).uuid; diff --git a/src/math/Quaternion.js b/src/math/Quaternion.js index 4fa833a970..fe72141b1a 100644 --- a/src/math/Quaternion.js +++ b/src/math/Quaternion.js @@ -538,7 +538,7 @@ Object.assign( THREE.Quaternion, { cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, - dir = ( cos >= 0 ? 1 : -1 ), + dir = ( cos >= 0 ? 1 : - 1 ), sqrSin = 1 - cos * cos; // Skip the Slerp for tiny steps to avoid numeric problems: @@ -573,7 +573,7 @@ Object.assign( THREE.Quaternion, { } - dst[ dstOffset ] = x0; + dst[ dstOffset ] = x0; dst[ dstOffset + 1 ] = y0; dst[ dstOffset + 2 ] = z0; dst[ dstOffset + 3 ] = w0; -- GitLab