Browse Source

Change stencil parameters to be in line with other material parameter and constant names

Garrett Johnson 6 years ago
parent
commit
156c32a163
2 changed files with 24 additions and 20 deletions
  1. 16 18
      src/constants.js
  2. 8 2
      src/materials/Material.js

+ 16 - 18
src/constants.js

@@ -143,22 +143,20 @@ export var RGBADepthPacking = 3201;
 export var TangentSpaceNormalMap = 0;
 export var TangentSpaceNormalMap = 0;
 export var ObjectSpaceNormalMap = 1;
 export var ObjectSpaceNormalMap = 1;
 
 
-// StencilOp
-export var ZERO = 0;
-export var KEEP = 7680;
-export var REPLACE = 7681;
-export var INCR = 7682;
-export var DECR = 7683;
-export var INCR_WRAP = 34055;
-export var DECR_WRAP = 34056;
-export var INVERT = 5386;
+export var ZeroStencilOp = 0;
+export var KeepStencilOp = 7680;
+export var ReplaceStencilOp = 7681;
+export var IncrementStencilOp = 7682;
+export var DecrementStencilOp = 7683;
+export var IncrementWrapStencilOp = 34055;
+export var DecrementWrapStencilOp = 34056;
+export var InvertStencilOp = 5386;
 
 
-// StencilFunc
-export var NEVER = 512;
-export var LESS = 513;
-export var EQUAL = 514;
-export var LEQUAL = 515;
-export var GREATER = 516;
-export var NOTEQUAL = 517;
-export var GEQUAL = 518;
-export var ALWAYS = 519;
+export var NeverStencilFunc = 512;
+export var LessStencilFunc = 513;
+export var EqualStencilFunc = 514;
+export var LessEqualStencilFunc = 515;
+export var GreaterStencilFunc = 516;
+export var NotEqualStencilFunc = 517;
+export var GreaterEqualStencilFunc = 518;
+export var AlwaysStencilFunc = 519;

+ 8 - 2
src/materials/Material.js

@@ -1,5 +1,5 @@
 import { EventDispatcher } from '../core/EventDispatcher.js';
 import { EventDispatcher } from '../core/EventDispatcher.js';
-import { NoColors, FrontSide, FlatShading, NormalBlending, LessEqualDepth, AddEquation, OneMinusSrcAlphaFactor, SrcAlphaFactor } from '../constants.js';
+import { NoColors, FrontSide, FlatShading, NormalBlending, LessEqualDepth, AddEquation, OneMinusSrcAlphaFactor, SrcAlphaFactor, AlwaysStencilFunc, KeepStencilOp } from '../constants.js';
 import { _Math } from '../math/Math.js';
 import { _Math } from '../math/Math.js';
 
 
 /**
 /**
@@ -40,7 +40,13 @@ function Material() {
 	this.depthTest = true;
 	this.depthTest = true;
 	this.depthWrite = true;
 	this.depthWrite = true;
 
 
-	this.stencil = null;
+	this.stencilFunc = AlwaysStencilFunc;
+	this.stencilRef = 0;
+	this.stencilMask = 0xff;
+	this.stencilFail = KeepStencilOp;
+	this.stencilZFail = KeepStencilOp;
+	this.stencilZPass = KeepStencilOp;
+	this.stencilWrite = true;
 
 
 	this.clippingPlanes = null;
 	this.clippingPlanes = null;
 	this.clipIntersection = false;
 	this.clipIntersection = false;