Browse Source

Add stencil write mask field

Garrett Johnson 5 years ago
parent
commit
b4883a5814
2 changed files with 4 additions and 2 deletions
  1. 2 1
      src/materials/Material.js
  2. 2 1
      src/renderers/webgl/WebGLState.js

+ 2 - 1
src/materials/Material.js

@@ -41,9 +41,10 @@ function Material() {
 	this.depthTest = true;
 	this.depthWrite = true;
 
+	this.stencilWriteMask = 0xff;
 	this.stencilFunc = AlwaysStencilFunc;
+	this.stencilFuncMask = 0xff;
 	this.stencilRef = 0;
-	this.stencilMask = 0xff;
 	this.stencilFail = KeepStencilOp;
 	this.stencilZFail = KeepStencilOp;
 	this.stencilZPass = KeepStencilOp;

+ 2 - 1
src/renderers/webgl/WebGLState.js

@@ -685,7 +685,8 @@ function WebGLState( gl, extensions, utils, capabilities ) {
 		stencilBuffer.setTest( stencilWrite );
 		if ( stencilWrite ) {
 
-			stencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilMask );
+			stencilBuffer.setMask( material.stencilWriteMask );
+			stencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );
 			stencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );
 
 		}