瀏覽代碼

Material: Honor missing properties in toJSON() and MaterialLoader. (#21428)

* add colorWrite to MaterialLoader, and shadowSide to both MaterialLoader and material.toJSON()

* compare shadowSide to null and not undefined
Guillaume Fradin 4 年之前
父節點
當前提交
bd035ab2f6
共有 2 個文件被更改,包括 3 次插入0 次删除
  1. 1 0
      src/loaders/MaterialLoader.js
  2. 2 0
      src/materials/Material.js

+ 1 - 0
src/loaders/MaterialLoader.js

@@ -85,6 +85,7 @@ class MaterialLoader extends Loader {
 		if ( json.blending !== undefined ) material.blending = json.blending;
 		if ( json.combine !== undefined ) material.combine = json.combine;
 		if ( json.side !== undefined ) material.side = json.side;
+		if ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;
 		if ( json.opacity !== undefined ) material.opacity = json.opacity;
 		if ( json.transparent !== undefined ) material.transparent = json.transparent;
 		if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;

+ 2 - 0
src/materials/Material.js

@@ -262,6 +262,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		}
 
 		if ( this.size !== undefined ) data.size = this.size;
+		if ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;
 		if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;
 
 		if ( this.blending !== NormalBlending ) data.blending = this.blending;
@@ -274,6 +275,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		data.depthFunc = this.depthFunc;
 		data.depthTest = this.depthTest;
 		data.depthWrite = this.depthWrite;
+		data.colorWrite = this.colorWrite;
 
 		data.stencilWrite = this.stencilWrite;
 		data.stencilWriteMask = this.stencilWriteMask;