gputex 0.3.1 → 0.3.3
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/README.md +36 -9
- package/dist/index.d.ts +24 -1
- package/dist/index.js +151 -12
- package/dist/three.d.ts +22 -3
- package/dist/three.js +199 -18
- package/package.json +1 -1
package/dist/three.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { TextureHint, PreferredFormat, EncodeQuality, TextureFormat, Encoder, EncoderImageSource } from './index.js';
|
|
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';
|
|
1
|
+
import { TextureHint, PreferredFormat, SvgRasterSize, EncodeQuality, TextureFormat, Encoder, EncoderImageSource } from './index.js';
|
|
2
|
+
export { ASTC4x4Encoder, ASTC4x4WebGLEncoder, BC1Encoder, BC1WebGLEncoder, BC5Encoder, BC5WebGLEncoder, BC7Encoder, BC7WebGLEncoder, Capabilities, EncodeBytesResult, EncodeCallOptions, EncoderConstructor, EncoderOptions, ExtensionProvider, FeatureProvider, FormatSelection, FormatVariant, MipLevel, RasterizeSvgOptions, RawPixelSource, SelectFormatOptions, WebGLBlockEncoder, WebGLCapabilities, WebGLEncodeBytesResult, WebGLEncoderConstructor, WebGLEncoderImageSource, WebGLEncoderOptions, WebGLFormatSelection, WebGPUFeature, createWebGLContext, detectCapabilities, detectWebGLCapabilities, generateMipChain, getSharedWebGLContext, isWebGLAvailable, padToBlockMultiple, rasterizeSvg, selectFormat, selectWebGLFormat } from './index.js';
|
|
3
3
|
import { Texture, CompressedTexture, Loader, CompressedPixelFormat } from 'three';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Everything `compressTexture()` can take as an image source. A superset
|
|
7
7
|
* of `EncoderImageSource` (see Encoder.ts) that also accepts URL strings
|
|
8
8
|
* and Blob / File objects — the common cases in a web app.
|
|
9
|
+
*
|
|
10
|
+
* SVG works through all of these: a URL to an `.svg` file, a string of
|
|
11
|
+
* inline SVG markup (detected by a leading `<`), an SVG Blob/File, or an
|
|
12
|
+
* HTMLImageElement whose src is SVG. Vector sources are rasterised to RGBA
|
|
13
|
+
* before encoding — see the `svgSize` option.
|
|
9
14
|
*/
|
|
10
15
|
type CompressTextureSource = string | Blob | File | ImageBitmap | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageData;
|
|
11
16
|
interface CompressOptions {
|
|
@@ -21,6 +26,14 @@ interface CompressOptions {
|
|
|
21
26
|
preferredFormat?: PreferredFormat;
|
|
22
27
|
/** Pick the sRGB or linear variant of the chosen format. Default 'srgb'. */
|
|
23
28
|
colorSpace?: 'srgb' | 'linear';
|
|
29
|
+
/**
|
|
30
|
+
* Rasterisation size for SVG sources. A number scales the SVG so its
|
|
31
|
+
* longest side matches (aspect ratio preserved); `{ width, height }`
|
|
32
|
+
* rasterises at exactly that size. Default: the SVG's intrinsic size
|
|
33
|
+
* (absolute width/height attributes, else the viewBox dimensions).
|
|
34
|
+
* Ignored for non-SVG sources.
|
|
35
|
+
*/
|
|
36
|
+
svgSize?: SvgRasterSize;
|
|
24
37
|
/** Flip the image vertically before encoding. Default true (matches Three.js convention). */
|
|
25
38
|
flipY?: boolean;
|
|
26
39
|
/** Generate a full mip chain down to 1×1 on the CPU, encode every level. */
|
|
@@ -79,6 +92,12 @@ declare class GputexLoader extends Loader<Texture> {
|
|
|
79
92
|
preferredFormat?: PreferredFormat;
|
|
80
93
|
/** Pick the sRGB or linear variant of the chosen format. Default 'srgb'. */
|
|
81
94
|
colorSpace: 'srgb' | 'linear';
|
|
95
|
+
/**
|
|
96
|
+
* Rasterisation size for SVG URLs — a number (longest side, aspect
|
|
97
|
+
* preserved) or exact `{ width, height }`. Default: the SVG's intrinsic
|
|
98
|
+
* size. See `CompressOptions.svgSize`.
|
|
99
|
+
*/
|
|
100
|
+
svgSize?: SvgRasterSize;
|
|
82
101
|
/** Flip the image vertically before encoding. Default true (matches Three.js convention). */
|
|
83
102
|
flipY: boolean;
|
|
84
103
|
/** Generate + encode a full mip chain. Default false. */
|
|
@@ -152,4 +171,4 @@ interface EncodeToTextureOptions {
|
|
|
152
171
|
*/
|
|
153
172
|
declare function encodeToTexture(encoder: Encoder, source: EncoderImageSource, { colorSpace, quality, flipY }?: EncodeToTextureOptions): Promise<EncodeResult>;
|
|
154
173
|
|
|
155
|
-
export { type CompressOptions, type CompressResult, type CompressTextureSource, EncodeQuality, type EncodeResult, type EncodeToTextureOptions, Encoder, EncoderImageSource, GputexLoader, PreferredFormat, TextureFormat, TextureHint, buildCompressedTexture, compressTexture, encodeToTexture, threeFormatFor };
|
|
174
|
+
export { type CompressOptions, type CompressResult, type CompressTextureSource, EncodeQuality, type EncodeResult, type EncodeToTextureOptions, Encoder, EncoderImageSource, GputexLoader, PreferredFormat, SvgRasterSize, TextureFormat, TextureHint, buildCompressedTexture, compressTexture, encodeToTexture, threeFormatFor };
|