Browse Source

Added support for min/max blend modes extension.

Brett Lawson 11 years ago
parent
commit
6fa783eadf
2 changed files with 24 additions and 0 deletions
  1. 2 0
      src/Three.js
  2. 22 0
      src/renderers/WebGLRenderer.js

+ 2 - 0
src/Three.js

@@ -80,6 +80,8 @@ THREE.CustomBlending = 5;
 THREE.AddEquation = 100;
 THREE.SubtractEquation = 101;
 THREE.ReverseSubtractEquation = 102;
+THREE.MinEquation = 103;
+THREE.MaxEquation = 104;
 
 // custom blending destination factors
 

+ 22 - 0
src/renderers/WebGLRenderer.js

@@ -192,6 +192,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	var _glExtensionCompressedTexturePVRTC;
 	var _glExtensionElementIndexUint;
 	var _glExtensionFragDepth;
+	var _glExtensionBlendMinMax;
 
 
 	initGL();
@@ -290,6 +291,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	this.supportsBlendMinMax = function () {
+
+		return _glExtensionBlendMinMax;
+
+	};
+
 	this.getMaxAnisotropy  = function () {
 
 		return _maxAnisotropy;
@@ -6056,6 +6063,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		if ( _glExtensionBlendMinMax !== undefined ) {
+
+			if ( p === THREE.MinEquation ) return _glExtensionBlendMinMax.MIN_EXT;
+			if ( p === THREE.MaxEquation ) return _glExtensionBlendMinMax.MAX_EXT;
+
+		}
+
 		return 0;
 
 	};
@@ -6184,6 +6198,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		_glExtensionElementIndexUint = _gl.getExtension( 'OES_element_index_uint' );
 
+		_glExtensionBlendMinMax = _gl.getExtension( 'EXT_blend_minmax' );
+
 
 		if ( _glExtensionTextureFloat === null ) {
 
@@ -6221,6 +6237,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		if ( _glExtensionBlendMinMax === null ) {
+
+			console.log( 'THREE.WebGLRenderer: min max blend equations not supported.' );
+
+		}
+
 		if ( _gl.getShaderPrecisionFormat === undefined ) {
 
 			_gl.getShaderPrecisionFormat = function () {