gputex 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/three.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TextureHint, EncodeQuality, TextureFormat, Encoder, EncoderImageSource } from './index.js';
1
+ import { TextureHint, PreferredFormat, EncodeQuality, TextureFormat, Encoder, EncoderImageSource } from './index.js';
2
2
  export { ASTC4x4Encoder, ASTC4x4WebGLEncoder, BC1Encoder, BC1WebGLEncoder, BC5Encoder, BC5WebGLEncoder, BC7Encoder, BC7WebGLEncoder, Capabilities, EncodeBytesResult, EncodeCallOptions, EncoderConstructor, EncoderOptions, ExtensionProvider, FeatureProvider, FormatSelection, FormatVariant, MipLevel, RawPixelSource, SelectFormatOptions, WebGLBlockEncoder, WebGLCapabilities, WebGLEncodeBytesResult, WebGLEncoderConstructor, WebGLEncoderImageSource, WebGLEncoderOptions, WebGLFormatSelection, WebGPUFeature, createWebGLContext, detectCapabilities, detectWebGLCapabilities, generateMipChain, getSharedWebGLContext, isWebGLAvailable, padToBlockMultiple, selectFormat, selectWebGLFormat } from './index.js';
3
3
  import { Texture, CompressedTexture, Loader, CompressedPixelFormat } from 'three';
4
4
 
@@ -11,6 +11,14 @@ type CompressTextureSource = string | Blob | File | ImageBitmap | HTMLImageEleme
11
11
  interface CompressOptions {
12
12
  /** How the texture will be used. Drives format selection. Default 'color'. */
13
13
  hint?: TextureHint;
14
+ /**
15
+ * Prefer a specific format over the default choice when the device
16
+ * supports it; falls back to the normal selection (BC7 → ASTC → RGBA8)
17
+ * when it doesn't. Currently only 'bc1': half the memory of BC7 for
18
+ * opaque colour textures, at lower quality. Only honoured with
19
+ * `hint: 'color'` — BC1 can't carry real alpha or normal maps.
20
+ */
21
+ preferredFormat?: PreferredFormat;
14
22
  /** Pick the sRGB or linear variant of the chosen format. Default 'srgb'. */
15
23
  colorSpace?: 'srgb' | 'linear';
16
24
  /** Flip the image vertically before encoding. Default true (matches Three.js convention). */
@@ -63,6 +71,12 @@ declare function compressTexture(source: CompressTextureSource, options?: Compre
63
71
  declare class GputexLoader extends Loader<Texture> {
64
72
  /** Format-selection hint. Default 'color'. */
65
73
  hint: TextureHint;
74
+ /**
75
+ * Prefer a specific format (currently only 'bc1') when the device
76
+ * supports it; normal selection otherwise. See
77
+ * `CompressOptions.preferredFormat`.
78
+ */
79
+ preferredFormat?: PreferredFormat;
66
80
  /** Pick the sRGB or linear variant of the chosen format. Default 'srgb'. */
67
81
  colorSpace: 'srgb' | 'linear';
68
82
  /** Flip the image vertically before encoding. Default true (matches Three.js convention). */
@@ -138,4 +152,4 @@ interface EncodeToTextureOptions {
138
152
  */
139
153
  declare function encodeToTexture(encoder: Encoder, source: EncoderImageSource, { colorSpace, quality, flipY }?: EncodeToTextureOptions): Promise<EncodeResult>;
140
154
 
141
- export { type CompressOptions, type CompressResult, type CompressTextureSource, EncodeQuality, type EncodeResult, type EncodeToTextureOptions, Encoder, EncoderImageSource, GputexLoader, TextureFormat, TextureHint, buildCompressedTexture, compressTexture, encodeToTexture, threeFormatFor };
155
+ export { type CompressOptions, type CompressResult, type CompressTextureSource, EncodeQuality, type EncodeResult, type EncodeToTextureOptions, Encoder, EncoderImageSource, GputexLoader, PreferredFormat, TextureFormat, TextureHint, buildCompressedTexture, compressTexture, encodeToTexture, threeFormatFor };