Browse Source

Merge pull request #18771 from Mugen87/dev43

CompressedTexture: Add more ASTC formats.
Mr.doob 5 years ago
parent
commit
7715d963f1

+ 36 - 0
docs/api/en/constants/Textures.html

@@ -272,6 +272,42 @@
 		(ETC2) extensions. <br /><br />
 		</p>
 
+		<h2>ASTC Compressed Texture Format</h2>
+		<code>
+		THREE.RGBA_ASTC_4x4_Format
+		THREE.RGBA_ASTC_5x4_Format
+		THREE.RGBA_ASTC_5x5_Format
+		THREE.RGBA_ASTC_6x5_Format
+		THREE.RGBA_ASTC_6x6_Format
+		THREE.RGBA_ASTC_8x5_Format
+		THREE.RGBA_ASTC_8x6_Format
+		THREE.RGBA_ASTC_8x8_Format
+		THREE.RGBA_ASTC_10x5_Format
+		THREE.RGBA_ASTC_10x6_Format
+		THREE.RGBA_ASTC_10x8_Format
+		THREE.RGBA_ASTC_10x10_Format
+		THREE.RGBA_ASTC_12x10_Format
+		THREE.RGBA_ASTC_12x12_Format
+		THREE.SRGB8_ALPHA8_ASTC_4x4_Format
+		THREE.SRGB8_ALPHA8_ASTC_5x4_Format
+		THREE.SRGB8_ALPHA8_ASTC_5x5_Format
+		THREE.SRGB8_ALPHA8_ASTC_6x5_Format
+		THREE.SRGB8_ALPHA8_ASTC_6x6_Format
+		THREE.SRGB8_ALPHA8_ASTC_8x5_Format
+		THREE.SRGB8_ALPHA8_ASTC_8x6_Format
+		THREE.SRGB8_ALPHA8_ASTC_8x8_Format
+		THREE.SRGB8_ALPHA8_ASTC_10x5_Format
+		THREE.SRGB8_ALPHA8_ASTC_10x6_Format
+		THREE.SRGB8_ALPHA8_ASTC_10x8_Format
+		THREE.SRGB8_ALPHA8_ASTC_10x10_Format
+		THREE.SRGB8_ALPHA8_ASTC_12x10_Format
+		THREE.SRGB8_ALPHA8_ASTC_12x12_Format
+		</code>
+		<p>
+		For use with a [page:CompressedTexture CompressedTexture]'s [page:Texture.format format]	property,
+		these require support for the [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/ WEBGL_compressed_texture_astc] extension. <br /><br />
+		</p>
+
 		<h2>Internal Formats</h2>
 		<code>
 		'ALPHA'

+ 42 - 3
docs/api/zh/constants/Textures.html

@@ -221,11 +221,50 @@
 	<h2>ETC 压缩纹理格式</h2>
 	<code>
 		THREE.RGB_ETC1_Format
+		THREE.RGB_ETC2_Format
+		THREE.RGBA_ETC2_EAC_Format
 		</code>
+		<p>
+		For use with a [page:CompressedTexture CompressedTexture]'s [page:Texture.format format]	property,
+		these require support for the [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc1/ WEBGL_compressed_texture_etc1]
+		(ETC1) or [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc/ WEBGL_compressed_texture_etc]
+		(ETC2) extensions. <br /><br />
+		</p>
+
+	<h2>ASTC Compressed Texture Format</h2>
+	<code>
+		THREE.RGBA_ASTC_4x4_Format
+		THREE.RGBA_ASTC_5x4_Format
+		THREE.RGBA_ASTC_5x5_Format
+		THREE.RGBA_ASTC_6x5_Format
+		THREE.RGBA_ASTC_6x6_Format
+		THREE.RGBA_ASTC_8x5_Format
+		THREE.RGBA_ASTC_8x6_Format
+		THREE.RGBA_ASTC_8x8_Format
+		THREE.RGBA_ASTC_10x5_Format
+		THREE.RGBA_ASTC_10x6_Format
+		THREE.RGBA_ASTC_10x8_Format
+		THREE.RGBA_ASTC_10x10_Format
+		THREE.RGBA_ASTC_12x10_Format
+		THREE.RGBA_ASTC_12x12_Format
+		THREE.SRGB8_ALPHA8_ASTC_4x4_Format
+		THREE.SRGB8_ALPHA8_ASTC_5x4_Format
+		THREE.SRGB8_ALPHA8_ASTC_5x5_Format
+		THREE.SRGB8_ALPHA8_ASTC_6x5_Format
+		THREE.SRGB8_ALPHA8_ASTC_6x6_Format
+		THREE.SRGB8_ALPHA8_ASTC_8x5_Format
+		THREE.SRGB8_ALPHA8_ASTC_8x6_Format
+		THREE.SRGB8_ALPHA8_ASTC_8x8_Format
+		THREE.SRGB8_ALPHA8_ASTC_10x5_Format
+		THREE.SRGB8_ALPHA8_ASTC_10x6_Format
+		THREE.SRGB8_ALPHA8_ASTC_10x8_Format
+		THREE.SRGB8_ALPHA8_ASTC_10x10_Format
+		THREE.SRGB8_ALPHA8_ASTC_12x10_Format
+		THREE.SRGB8_ALPHA8_ASTC_12x12_Format
+	</code>
 	<p>
-		要使用[page:CompressedTexture CompressedTexture]中的[page:Texture.format format]属性,需要获得
-		[link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc1/ WEBGL_compressed_texture_etc1]
-		扩展的支持。<br /><br />
+	For use with a [page:CompressedTexture CompressedTexture]'s [page:Texture.format format]	property,
+	these require support for the [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/ WEBGL_compressed_texture_astc] extension. <br /><br />
 	</p>
 
 	<h2>编码</h2>

+ 14 - 0
src/constants.d.ts

@@ -270,6 +270,20 @@ export const RGBA_ASTC_10x8_Format: CompressedPixelFormat;
 export const RGBA_ASTC_10x10_Format: CompressedPixelFormat;
 export const RGBA_ASTC_12x10_Format: CompressedPixelFormat;
 export const RGBA_ASTC_12x12_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_4x4_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_5x4_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_5x5_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_6x5_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_6x6_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_8x5_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_8x6_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_8x8_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_10x5_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_10x6_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_10x8_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_10x10_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_12x10_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_12x12_Format: CompressedPixelFormat;
 
 // Loop styles for AnimationAction
 export enum AnimationActionLoopStyles {}

+ 14 - 0
src/constants.js

@@ -129,6 +129,20 @@ export var RGBA_ASTC_10x8_Format = 37818;
 export var RGBA_ASTC_10x10_Format = 37819;
 export var RGBA_ASTC_12x10_Format = 37820;
 export var RGBA_ASTC_12x12_Format = 37821;
+export var SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
+export var SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
+export var SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
+export var SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
+export var SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
+export var SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
+export var SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
+export var SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
+export var SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
+export var SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
+export var SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
+export var SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
+export var SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
+export var SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
 export var LoopOnce = 2200;
 export var LoopRepeat = 2201;
 export var LoopPingPong = 2202;

+ 7 - 2
src/renderers/webgl/WebGLUtils.js

@@ -2,7 +2,7 @@
  * @author thespite / http://www.twitter.com/thespite
  */
 
-import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RedFormat, RGBAFormat, RGBFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort565Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType } from '../../constants.js';
+import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RedFormat, RGBAFormat, RGBFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort565Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, SRGB8_ALPHA8_ASTC_4x4_Format, SRGB8_ALPHA8_ASTC_5x4_Format, SRGB8_ALPHA8_ASTC_5x5_Format, SRGB8_ALPHA8_ASTC_6x5_Format, SRGB8_ALPHA8_ASTC_6x6_Format, SRGB8_ALPHA8_ASTC_8x5_Format, SRGB8_ALPHA8_ASTC_8x6_Format, SRGB8_ALPHA8_ASTC_8x8_Format, SRGB8_ALPHA8_ASTC_10x5_Format, SRGB8_ALPHA8_ASTC_10x6_Format, SRGB8_ALPHA8_ASTC_10x8_Format, SRGB8_ALPHA8_ASTC_10x10_Format, SRGB8_ALPHA8_ASTC_12x10_Format, SRGB8_ALPHA8_ASTC_12x12_Format } from '../../constants.js';
 
 function WebGLUtils( gl, extensions, capabilities ) {
 
@@ -132,7 +132,12 @@ function WebGLUtils( gl, extensions, capabilities ) {
 			p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||
 			p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||
 			p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||
-			p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {
+			p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ||
+			p === SRGB8_ALPHA8_ASTC_4x4_Format || p === SRGB8_ALPHA8_ASTC_5x4_Format || p === SRGB8_ALPHA8_ASTC_5x5_Format ||
+			p === SRGB8_ALPHA8_ASTC_6x5_Format || p === SRGB8_ALPHA8_ASTC_6x6_Format || p === SRGB8_ALPHA8_ASTC_8x5_Format ||
+			p === SRGB8_ALPHA8_ASTC_8x6_Format || p === SRGB8_ALPHA8_ASTC_8x8_Format || p === SRGB8_ALPHA8_ASTC_10x5_Format ||
+			p === SRGB8_ALPHA8_ASTC_10x6_Format || p === SRGB8_ALPHA8_ASTC_10x8_Format || p === SRGB8_ALPHA8_ASTC_10x10_Format ||
+			p === SRGB8_ALPHA8_ASTC_12x10_Format || p === SRGB8_ALPHA8_ASTC_12x12_Format ) {
 
 			extension = extensions.get( 'WEBGL_compressed_texture_astc' );