Skip to content

Commit

Permalink
Merge pull request #18771 from Mugen87/dev43
Browse files Browse the repository at this point in the history
CompressedTexture: Add more ASTC formats.
  • Loading branch information
mrdoob authored Feb 28, 2020
2 parents 790811d + 7b60ed5 commit 7715d96
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 5 deletions.
36 changes: 36 additions & 0 deletions docs/api/en/constants/Textures.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,42 @@ <h2>ETC Compressed Texture Format</h2>
(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'
Expand Down
45 changes: 42 additions & 3 deletions docs/api/zh/constants/Textures.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,50 @@ <h2>PVRTC 压缩纹理格式(PVRTC Compressed Texture Formats)</h2>
<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>
Expand Down
14 changes: 14 additions & 0 deletions src/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
14 changes: 14 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 7 additions & 2 deletions src/renderers/webgl/WebGLUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {

Expand Down Expand Up @@ -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' );

Expand Down

0 comments on commit 7715d96

Please sign in to comment.