Ver Fonte

LineBasic and LineDashedMaterial serialization

Tentone há 8 anos atrás
pai
commit
fa06533861
2 ficheiros alterados com 11 adições e 0 exclusões
  1. 5 0
      src/loaders/MaterialLoader.js
  2. 6 0
      src/materials/Material.js

+ 5 - 0
src/loaders/MaterialLoader.js

@@ -84,6 +84,11 @@ Object.assign( MaterialLoader.prototype, {
 
 		if ( json.rotation !== undefined ) material.rotation = json.rotation;
 
+		if ( json.linewidth !== 1 ) material.linewidth = json.linewidth;
+		if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
+		if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
+		if ( json.scale !== undefined ) material.scale = json.scale;
+
 		if ( json.skinning !== undefined ) material.skinning = json.skinning;
 		if ( json.morphTargets !== undefined ) material.morphTargets = json.morphTargets;
 		if ( json.dithering !== undefined ) material.dithering = json.dithering;

+ 6 - 0
src/materials/Material.js

@@ -223,8 +223,14 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {
 		data.depthTest = this.depthTest;
 		data.depthWrite = this.depthWrite;
 
+		// rotation (SpriteMaterial)
 		if ( this.rotation !== 0 ) data.rotation = this.rotation;
 
+		if ( 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;
+
 		if ( this.dithering === true ) data.dithering = true;
 
 		if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;