Explorar o código

Merge branch 'dev' of https://github.com/brett19/three.js into dev

Conflicts:
	src/renderers/WebGLRenderer.js
Mr.doob %!s(int64=11) %!d(string=hai) anos
pai
achega
2f86e3dea5
Modificáronse 2 ficheiros con 26 adicións e 2 borrados
  1. 2 0
      src/Three.js
  2. 24 2
      src/renderers/WebGLRenderer.js

+ 2 - 0
src/Three.js

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

+ 24 - 2
src/renderers/WebGLRenderer.js

@@ -192,6 +192,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	var _glExtensionCompressedTexturePVRTC;
 	var _glExtensionCompressedTexturePVRTC;
 	var _glExtensionElementIndexUint;
 	var _glExtensionElementIndexUint;
 	var _glExtensionFragDepth;
 	var _glExtensionFragDepth;
+	var _glExtensionBlendMinMax;
 
 
 
 
 	initGL();
 	initGL();
@@ -300,6 +301,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
+	this.supportsBlendMinMax = function () {
+
+		return _glExtensionBlendMinMax;
+
+	};
+
 	this.getMaxAnisotropy  = function () {
 	this.getMaxAnisotropy  = function () {
 
 
 		return _maxAnisotropy;
 		return _maxAnisotropy;
@@ -5597,7 +5604,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			for ( var i = 0, il = mipmaps.length; i < il; i ++ ) {
 			for ( var i = 0, il = mipmaps.length; i < il; i ++ ) {
 
 
 				mipmap = mipmaps[ i ];
 				mipmap = mipmaps[ i ];
-				if ( texture.format !== THREE.RGBAFormat ) {
+				if ( texture.format !== THREE.RGBAFormat && texture.format !== THREE.RGBFormat ) {
 					if ( _compressedTextureFormats.indexOf( glFormat ) > -1 ) {
 					if ( _compressedTextureFormats.indexOf( glFormat ) > -1 ) {
 						_gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
 						_gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
 					} else {
 					} else {
@@ -5743,7 +5750,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 						for ( var j = 0, jl = mipmaps.length; j < jl; j ++ ) {
 						for ( var j = 0, jl = mipmaps.length; j < jl; j ++ ) {
 
 
 							mipmap = mipmaps[ j ];
 							mipmap = mipmaps[ j ];
-							if ( texture.format !== THREE.RGBAFormat ) {
+							if ( texture.format !== THREE.RGBAFormat && texture.format !== THREE.RGBFormat ) {
 
 
 								if ( _compressedTextureFormats.indexOf( glFormat ) > -1 ) {
 								if ( _compressedTextureFormats.indexOf( glFormat ) > -1 ) {
 									_gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
 									_gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
@@ -6074,6 +6081,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;
 		return 0;
 
 
 	};
 	};
@@ -6202,6 +6216,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		_glExtensionElementIndexUint = _gl.getExtension( 'OES_element_index_uint' );
 		_glExtensionElementIndexUint = _gl.getExtension( 'OES_element_index_uint' );
 
 
+		_glExtensionBlendMinMax = _gl.getExtension( 'EXT_blend_minmax' );
+
 
 
 		if ( _glExtensionTextureFloat === null ) {
 		if ( _glExtensionTextureFloat === null ) {
 
 
@@ -6239,6 +6255,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		}
 		}
 
 
+		if ( _glExtensionBlendMinMax === null ) {
+
+			console.log( 'THREE.WebGLRenderer: min max blend equations not supported.' );
+
+		}
+
 		if ( _gl.getShaderPrecisionFormat === undefined ) {
 		if ( _gl.getShaderPrecisionFormat === undefined ) {
 
 
 			_gl.getShaderPrecisionFormat = function () {
 			_gl.getShaderPrecisionFormat = function () {