فهرست منبع

WebGLState: Removed currentDepthTest and currentPolygonOffset.

Mr.doob 10 سال پیش
والد
کامیت
4fd018b69f
1فایلهای تغییر یافته به همراه12 افزوده شده و 26 حذف شده
  1. 12 26
      src/renderers/webgl/WebGLState.js

+ 12 - 26
src/renderers/webgl/WebGLState.js

@@ -20,7 +20,6 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
 	var currentBlendDstAlpha = null;
 
 	var currentDepthFunc = null;
-	var currentDepthTest = null;
 	var currentDepthWrite = null;
 
 	var currentColorWrite = null;
@@ -29,7 +28,6 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
 
 	var currentLineWidth = null;
 
-	var currentPolygonOffset = null;
 	var currentPolygonOffsetFactor = null;
 	var currentPolygonOffsetUnits = null;
 
@@ -44,7 +42,7 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
 		gl.clearDepth( 1 );
 		gl.clearStencil( 0 );
 
-		gl.enable( gl.DEPTH_TEST );
+		this.enable( gl.DEPTH_TEST );
 		gl.depthFunc( gl.LEQUAL );
 
 		gl.frontFace( gl.CCW );
@@ -270,19 +268,13 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
 
 	this.setDepthTest = function ( depthTest ) {
 
-		if ( currentDepthTest !== depthTest ) {
+		if ( depthTest ) {
 
-			if ( depthTest ) {
+			this.enable( gl.DEPTH_TEST );
 
-				gl.enable( gl.DEPTH_TEST );
-
-			} else {
-
-				gl.disable( gl.DEPTH_TEST );
-
-			}
+		} else {
 
-			currentDepthTest = depthTest;
+			this.disable( gl.DEPTH_TEST );
 
 		}
 
@@ -342,25 +334,19 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
 
 	};
 
-	this.setPolygonOffset = function ( polygonoffset, factor, units ) {
-
-		if ( currentPolygonOffset !== polygonoffset ) {
+	this.setPolygonOffset = function ( polygonOffset, factor, units ) {
 
-			if ( polygonoffset ) {
+		if ( polygonOffset ) {
 
-				gl.enable( gl.POLYGON_OFFSET_FILL );
+			this.enable( gl.POLYGON_OFFSET_FILL );
 
-			} else {
-
-				gl.disable( gl.POLYGON_OFFSET_FILL );
-
-			}
+		} else {
 
-			currentPolygonOffset = polygonoffset;
+			this.disable( gl.POLYGON_OFFSET_FILL );
 
 		}
 
-		if ( polygonoffset && ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) ) {
+		if ( polygonOffset && ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) ) {
 
 			gl.polygonOffset( factor, units );
 
@@ -460,7 +446,7 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
 		capabilities = {};
 
 		currentBlending = null;
-		currentDepthTest = null;
+
 		currentDepthWrite = null;
 		currentColorWrite = null;