From b069f46c5108520997eaec7095d07b4985205990 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Fri, 28 Feb 2020 10:56:16 +0100 Subject: [PATCH 1/2] CompressedTexture: Add more ASTC formats. --- src/constants.d.ts | 14 ++++++++++++++ src/constants.js | 14 ++++++++++++++ src/renderers/webgl/WebGLUtils.js | 9 +++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/constants.d.ts b/src/constants.d.ts index 436ec87738b47a..268874a8f6543e 100644 --- a/src/constants.d.ts +++ b/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 {} diff --git a/src/constants.js b/src/constants.js index 5ce309dd02ea79..4d5229a17aec3b 100644 --- a/src/constants.js +++ b/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; diff --git a/src/renderers/webgl/WebGLUtils.js b/src/renderers/webgl/WebGLUtils.js index 7decd33973c333..1a39886e8a55e1 100644 --- a/src/renderers/webgl/WebGLUtils.js +++ b/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' ); From 7b60ed590f3cc3a2595c69c54c3accc95f612c46 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Fri, 28 Feb 2020 14:11:58 +0100 Subject: [PATCH 2/2] Docs: Update Texture formats. --- docs/api/en/constants/Textures.html | 36 +++++++++++++++++++++++ docs/api/zh/constants/Textures.html | 45 +++++++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/docs/api/en/constants/Textures.html b/docs/api/en/constants/Textures.html index b779e12d06eaa2..b9908bf42891eb 100644 --- a/docs/api/en/constants/Textures.html +++ b/docs/api/en/constants/Textures.html @@ -272,6 +272,42 @@

ETC Compressed Texture Format

(ETC2) extensions.

+

ASTC Compressed Texture Format

+ + 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 + +

+ 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.

+

+

Internal Formats

'ALPHA' diff --git a/docs/api/zh/constants/Textures.html b/docs/api/zh/constants/Textures.html index fa648783064b25..4aef2061cb1de5 100644 --- a/docs/api/zh/constants/Textures.html +++ b/docs/api/zh/constants/Textures.html @@ -221,11 +221,50 @@

PVRTC 压缩纹理格式(PVRTC Compressed Texture Formats)

ETC 压缩纹理格式

THREE.RGB_ETC1_Format + THREE.RGB_ETC2_Format + THREE.RGBA_ETC2_EAC_Format +

+ 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.

+

+ +

ASTC Compressed Texture Format

+ + 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 +

- 要使用[page:CompressedTexture CompressedTexture]中的[page:Texture.format format]属性,需要获得 - [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc1/ WEBGL_compressed_texture_etc1] - 扩展的支持。

+ 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.

编码