提交 0dd332ed 编写于 作者: P Patrick Chilton

Add ETC1 compressed texture support.

上级 b95396ce
......@@ -102,6 +102,7 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
var FOURCC_DXT1 = fourCCToInt32( "DXT1" );
var FOURCC_DXT3 = fourCCToInt32( "DXT3" );
var FOURCC_DXT5 = fourCCToInt32( "DXT5" );
var FOURCC_ETC1 = fourCCToInt32( "ETC1" );
var headerLengthInt = 31; // The header length in 32 bit ints
......@@ -173,6 +174,12 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
dds.format = THREE.RGBA_S3TC_DXT5_Format;
break;
case FOURCC_ETC1:
blockBytes = 8;
dds.format = THREE.RGB_ETC1_Format;
break;
default:
if ( header[ off_RGBBitCount ] === 32
......
......@@ -352,6 +352,10 @@ THREE.RGB_PVRTC_2BPPV1_Format = 2101;
THREE.RGBA_PVRTC_4BPPV1_Format = 2102;
THREE.RGBA_PVRTC_2BPPV1_Format = 2103;
// ETC compressed texture formats
THREE.RGB_ETC1_Format = 2151;
// Loop styles for AnimationAction
THREE.LoopOnce = 2200;
......
......@@ -3624,6 +3624,14 @@ THREE.WebGLRenderer = function ( parameters ) {
}
extension = extensions.get( 'WEBGL_compressed_texture_etc1' );
if ( extension !== null ) {
if ( p === THREE.RGB_ETC1_Format ) return extension.COMPRESSED_RGB_ETC1_WEBGL;
}
extension = extensions.get( 'EXT_blend_minmax' );
if ( extension !== null ) {
......
......@@ -30,6 +30,10 @@ THREE.WebGLExtensions = function ( gl ) {
extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );
break;
case 'WEBGL_compressed_texture_etc1':
extension = gl.getExtension( 'WEBGL_compressed_texture_etc1' );
break;
default:
extension = gl.getExtension( name );
......
......@@ -167,7 +167,8 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
compressedTextureFormats = [];
if ( extensions.get( 'WEBGL_compressed_texture_pvrtc' ) ||
extensions.get( 'WEBGL_compressed_texture_s3tc' ) ) {
extensions.get( 'WEBGL_compressed_texture_s3tc' ) ||
extensions.get( 'WEBGL_compressed_texture_etc1' )) {
var formats = gl.getParameter( gl.COMPRESSED_TEXTURE_FORMATS );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册