提交 707d9471 编写于 作者: M Mugen87

Material: Clean up serialization/deserialization.

上级 6a7784dd
......@@ -93,6 +93,7 @@ Object.assign( MaterialLoader.prototype, {
if ( json.skinning !== undefined ) material.skinning = json.skinning;
if ( json.morphTargets !== undefined ) material.morphTargets = json.morphTargets;
if ( json.morphNormals !== undefined ) material.morphNormals = json.morphNormals;
if ( json.dithering !== undefined ) material.dithering = json.dithering;
if ( json.visible !== undefined ) material.visible = json.visible;
......@@ -218,6 +219,7 @@ Object.assign( MaterialLoader.prototype, {
if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
if ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;
if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );
if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;
......
......@@ -160,7 +160,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if ( this.metalness !== undefined ) data.metalness = this.metalness;
if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
if ( this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
if ( this.shininess !== undefined ) data.shininess = this.shininess;
......@@ -212,6 +212,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
data.envMap = this.envMap.toJSON( meta ).uuid;
data.reflectivity = this.reflectivity; // Scale behind envMap
data.refractionRatio = this.refractionRatio;
if ( this.combine !== undefined ) data.combine = this.combine;
if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;
......@@ -240,13 +241,13 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
data.depthWrite = this.depthWrite;
// rotation (SpriteMaterial)
if ( this.rotation !== 0 ) data.rotation = this.rotation;
if ( this.rotation && this.rotation !== 0 ) data.rotation = this.rotation;
if ( this.polygonOffset === true ) data.polygonOffset = true;
if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
if ( this.linewidth !== 1 ) data.linewidth = this.linewidth;
if ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth;
if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
if ( this.scale !== undefined ) data.scale = this.scale;
......@@ -262,6 +263,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
if ( this.morphTargets === true ) data.morphTargets = true;
if ( this.morphNormals === true ) data.morphNormals = true;
if ( this.skinning === true ) data.skinning = true;
if ( this.visible === false ) data.visible = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册