瀏覽代碼

Revert "Removed material.skinning references. See #10754."

This reverts commit 0b3497f9a7bae238f6b91845140c9ea6e37124ba.
Mr.doob 8 年之前
父節點
當前提交
a6fcf5bb2c

+ 1 - 0
src/loaders/MaterialLoader.js

@@ -81,6 +81,7 @@ Object.assign( MaterialLoader.prototype, {
 		if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
 		if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;
 		if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;
+		if ( json.skinning !== undefined ) material.skinning = json.skinning;
 		if ( json.morphTargets !== undefined ) material.morphTargets = json.morphTargets;
 
 		// for PointsMaterial

+ 1 - 0
src/materials/Material.js

@@ -232,6 +232,7 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {
 		if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
 		if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
 
+		data.skinning = this.skinning;
 		data.morphTargets = this.morphTargets;
 
 		// TODO: Copied from Object3D.toJSON

+ 3 - 0
src/materials/MeshBasicMaterial.js

@@ -33,6 +33,7 @@ import { Color } from '../math/Color';
  *  wireframe: <boolean>,
  *  wireframeLinewidth: <float>,
  *
+ *  skinning: <bool>,
  *  morphTargets: <bool>
  * }
  */
@@ -67,6 +68,7 @@ function MeshBasicMaterial( parameters ) {
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
+	this.skinning = false;
 	this.morphTargets = false;
 
 	this.lights = false;
@@ -108,6 +110,7 @@ MeshBasicMaterial.prototype.copy = function ( source ) {
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
+	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
 
 	return this;

+ 2 - 0
src/materials/MeshDepthMaterial.js

@@ -32,6 +32,7 @@ function MeshDepthMaterial( parameters ) {
 
 	this.depthPacking = BasicDepthPacking;
 
+	this.skinning = false;
 	this.morphTargets = false;
 
 	this.map = null;
@@ -63,6 +64,7 @@ MeshDepthMaterial.prototype.copy = function ( source ) {
 
 	this.depthPacking = source.depthPacking;
 
+	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
 
 	this.map = source.map;

+ 3 - 0
src/materials/MeshLambertMaterial.js

@@ -34,6 +34,7 @@ import { Color } from '../math/Color';
  *  wireframe: <boolean>,
  *  wireframeLinewidth: <float>,
  *
+ *  skinning: <bool>,
  *  morphTargets: <bool>,
  *  morphNormals: <bool>
  * }
@@ -73,6 +74,7 @@ function MeshLambertMaterial( parameters ) {
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
+	this.skinning = false;
 	this.morphTargets = false;
 	this.morphNormals = false;
 
@@ -117,6 +119,7 @@ MeshLambertMaterial.prototype.copy = function ( source ) {
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
+	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
 	this.morphNormals = source.morphNormals;
 

+ 3 - 0
src/materials/MeshNormalMaterial.js

@@ -21,6 +21,7 @@ import { Vector2 } from '../math/Vector2';
  *  wireframe: <boolean>,
  *  wireframeLinewidth: <float>
  *
+ *  skinning: <bool>,
  *  morphTargets: <bool>,
  *  morphNormals: <bool>
  * }
@@ -48,6 +49,7 @@ function MeshNormalMaterial( parameters ) {
 	this.fog = false;
 	this.lights = false;
 
+	this.skinning = false;
 	this.morphTargets = false;
 	this.morphNormals = false;
 
@@ -77,6 +79,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
 	this.wireframe = source.wireframe;
 	this.wireframeLinewidth = source.wireframeLinewidth;
 
+	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
 	this.morphNormals = source.morphNormals;
 

+ 3 - 0
src/materials/MeshPhongMaterial.js

@@ -47,6 +47,7 @@ import { Color } from '../math/Color';
  *  wireframe: <boolean>,
  *  wireframeLinewidth: <float>,
  *
+ *  skinning: <bool>,
  *  morphTargets: <bool>,
  *  morphNormals: <bool>
  * }
@@ -98,6 +99,7 @@ function MeshPhongMaterial( parameters ) {
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
+	this.skinning = false;
 	this.morphTargets = false;
 	this.morphNormals = false;
 
@@ -154,6 +156,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
+	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
 	this.morphNormals = source.morphNormals;
 

+ 3 - 0
src/materials/MeshStandardMaterial.js

@@ -47,6 +47,7 @@ import { Color } from '../math/Color';
  *  wireframe: <boolean>,
  *  wireframeLinewidth: <float>,
  *
+ *  skinning: <bool>,
  *  morphTargets: <bool>,
  *  morphNormals: <bool>
  * }
@@ -102,6 +103,7 @@ function MeshStandardMaterial( parameters ) {
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
+	this.skinning = false;
 	this.morphTargets = false;
 	this.morphNormals = false;
 
@@ -162,6 +164,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) {
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
+	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
 	this.morphNormals = source.morphNormals;
 

+ 4 - 0
src/materials/ShaderMaterial.js

@@ -16,6 +16,7 @@ import { UniformsUtils } from '../renderers/shaders/UniformsUtils';
  *
  *  lights: <bool>,
  *
+ *  skinning: <bool>,
  *  morphTargets: <bool>,
  *  morphNormals: <bool>
  * }
@@ -42,6 +43,7 @@ function ShaderMaterial( parameters ) {
 	this.lights = false; // set to use scene lights
 	this.clipping = false; // set to use user-defined clipping planes
 
+	this.skinning = false; // set to use skinning attribute streams
 	this.morphTargets = false; // set to use morph targets
 	this.morphNormals = false; // set to use morph normals
 
@@ -98,6 +100,8 @@ ShaderMaterial.prototype.copy = function ( source ) {
 	this.lights = source.lights;
 	this.clipping = source.clipping;
 
+	this.skinning = source.skinning;
+
 	this.morphTargets = source.morphTargets;
 	this.morphNormals = source.morphNormals;
 

+ 1 - 1
src/renderers/webgl/WebGLShadowMap.js

@@ -307,7 +307,7 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
 
 			}
 
-			var useSkinning = object.isSkinnedMesh;
+			var useSkinning = object.isSkinnedMesh && material.skinning;
 
 			var variantIndex = 0;