@predy-js/render-interface 0.3.0-beta.187 → 0.3.0-beta.189
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/index.js +514 -203
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +514 -203
- package/dist/index.mjs.map +1 -1
- package/dist/src/webgl/KhronosTextureContainer.d.ts +3 -25
- package/dist/src/webgl/constants.d.ts +1 -1
- package/dist/statistic.js +1 -1
- package/dist/types/Texture.d.ts +5 -5
- package/package.json +1 -1
- package/types/Texture.ts +41 -41
@@ -1,25 +1,3 @@
|
|
1
|
-
import type { TextureOptions
|
2
|
-
export declare
|
3
|
-
|
4
|
-
baseOffset: number;
|
5
|
-
glType: number;
|
6
|
-
glTypeSize: number;
|
7
|
-
glFormat: number;
|
8
|
-
glInternalFormat: number;
|
9
|
-
glBaseInternalFormat: number;
|
10
|
-
pixelWidth: number;
|
11
|
-
pixelHeight: number;
|
12
|
-
loadType: number;
|
13
|
-
pixelDepth: number;
|
14
|
-
numberOfArrayElements: number;
|
15
|
-
numberOfFaces: number;
|
16
|
-
numberOfMipmapLevels: number;
|
17
|
-
bytesOfKeyValueData: number;
|
18
|
-
constructor(arrayBuffer: ArrayBuffer, facesExpected: number, baseOffset?: number);
|
19
|
-
mipmaps(loadMipmaps: boolean): Array<{
|
20
|
-
data: TypedArray;
|
21
|
-
width: number;
|
22
|
-
height: number;
|
23
|
-
}>;
|
24
|
-
}
|
25
|
-
export declare function getCompressedTextureOptions(data: ArrayBuffer): TextureOptions;
|
1
|
+
import type { TextureOptions } from '../../types';
|
2
|
+
export declare const formatMap: Record<number, [type: number, format: number]>;
|
3
|
+
export declare function getCompressedTextureOptions(data: Uint8Array): TextureOptions;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { TypedArray, vec2 } from '../../types/type';
|
2
|
-
export declare
|
2
|
+
export declare const constants: WebGL2RenderingContext & WEBGL_compressed_texture_astc;
|
3
3
|
export declare function createTypedArrayByGLType(type: number, elementCount: number | ArrayBuffer): TypedArray;
|
4
4
|
export declare function getBytesPerElementByGLType(type: number): number;
|
5
5
|
export declare function getMatAttrLocPair(type: number): vec2;
|
package/dist/statistic.js
CHANGED
package/dist/types/Texture.d.ts
CHANGED
@@ -64,10 +64,10 @@ export interface TextureFactorySource2DMipmapsFrom {
|
|
64
64
|
export type TextureFactorySourceFrom = TextureFactorySource2DBinaryMipmapsFrom | TextureFactorySourceCubeBinaryMipmapsFrom | TextureFactorySource2DFrom | TextureFactorySourceCubeFrom | TextureFactorySourceCubeMipmapsFrom | TextureFactorySource2DMipmapsFrom | TextureFactorySourceFromCompressed;
|
65
65
|
export interface TextureFactory {
|
66
66
|
/**
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
* 通过TextureConfigOptions可以决定图片解码时使用的格式
|
68
|
+
* @param options
|
69
|
+
* @param config texture的属性
|
70
|
+
*/
|
71
71
|
loadSourceAsync(options: TextureFactorySourceFrom, config?: TextureConfigOptions): Promise<TextureOptions>;
|
72
72
|
canOffloadTexture(texture: Texture): boolean;
|
73
73
|
reloadTextureAsync(texture: Texture): Promise<Texture>;
|
@@ -150,7 +150,7 @@ export interface Texture2DSourceOptionsImageMipmaps extends TextureOptionsBase {
|
|
150
150
|
export interface Texture2DSourceOptionsCompressed extends TextureOptionsBase {
|
151
151
|
sourceType: TextureSourceType.compressed;
|
152
152
|
mipmaps: Array<{
|
153
|
-
data:
|
153
|
+
data: Uint8Array;
|
154
154
|
width: number;
|
155
155
|
height: number;
|
156
156
|
}>;
|
package/package.json
CHANGED
package/types/Texture.ts
CHANGED
@@ -9,7 +9,7 @@ import type { GPURenderer } from './Renderer';
|
|
9
9
|
*/
|
10
10
|
export type ImageBitmapPixelFormat = WebGL2RenderingContext['RGBA8'] |
|
11
11
|
WebGL2RenderingContext['RGBA16F'] |
|
12
|
-
WebGL2RenderingContext['RGBA32F']
|
12
|
+
WebGL2RenderingContext['RGBA32F'];
|
13
13
|
|
14
14
|
export enum TextureSourceType {
|
15
15
|
none,
|
@@ -46,12 +46,12 @@ export type TextureFactorySourceCubeBinaryMipmapsFrom = {
|
|
46
46
|
type: TextureSourceType.mipmaps,
|
47
47
|
bin: string,
|
48
48
|
mipmaps: Array<[
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: DataRange,
|
50
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: DataRange,
|
51
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: DataRange,
|
52
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: DataRange,
|
53
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: DataRange,
|
54
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: DataRange
|
55
55
|
]>,
|
56
56
|
};
|
57
57
|
|
@@ -75,27 +75,27 @@ export interface TextureFactorySource2DMipmapsFrom {
|
|
75
75
|
}
|
76
76
|
|
77
77
|
export type TextureFactorySourceFrom =
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
TextureFactorySource2DBinaryMipmapsFrom
|
79
|
+
| TextureFactorySourceCubeBinaryMipmapsFrom
|
80
|
+
| TextureFactorySource2DFrom
|
81
|
+
| TextureFactorySourceCubeFrom
|
82
|
+
| TextureFactorySourceCubeMipmapsFrom
|
83
|
+
| TextureFactorySource2DMipmapsFrom
|
84
|
+
| TextureFactorySourceFromCompressed;
|
85
85
|
|
86
86
|
export interface TextureFactory {
|
87
87
|
/**
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
loadSourceAsync
|
88
|
+
* 通过TextureConfigOptions可以决定图片解码时使用的格式
|
89
|
+
* @param options
|
90
|
+
* @param config texture的属性
|
91
|
+
*/
|
92
|
+
loadSourceAsync(options: TextureFactorySourceFrom, config?: TextureConfigOptions): Promise<TextureOptions>,
|
93
93
|
|
94
|
-
canOffloadTexture
|
94
|
+
canOffloadTexture(texture: Texture): boolean,
|
95
95
|
|
96
|
-
reloadTextureAsync
|
96
|
+
reloadTextureAsync(texture: Texture): Promise<Texture>,
|
97
97
|
|
98
|
-
loadCompressedTextureFromArrayBuffer
|
98
|
+
loadCompressedTextureFromArrayBuffer(arrayBuffer: ArrayBuffer, options?: TextureOptions): TextureOptions,
|
99
99
|
}
|
100
100
|
|
101
101
|
export declare class Texture implements IGPUResource {
|
@@ -133,12 +133,12 @@ export interface ImageData {
|
|
133
133
|
}
|
134
134
|
|
135
135
|
export type TextureSourceCubeData = [
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
136
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: ImageSource | ImageData,
|
137
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: ImageSource | ImageData,
|
138
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: ImageSource | ImageData,
|
139
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: ImageSource | ImageData,
|
140
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: ImageSource | ImageData,
|
141
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: ImageSource | ImageData
|
142
142
|
];
|
143
143
|
|
144
144
|
// 为减少内存消耗,除了video之外,其余的数据内容会在texture生成后被置为undefined
|
@@ -186,7 +186,7 @@ export interface Texture2DSourceOptionsImageMipmaps extends TextureOptionsBase {
|
|
186
186
|
|
187
187
|
export interface Texture2DSourceOptionsCompressed extends TextureOptionsBase {
|
188
188
|
sourceType: TextureSourceType.compressed,
|
189
|
-
mipmaps: Array<{ data:
|
189
|
+
mipmaps: Array<{ data: Uint8Array, width: number, height: number }>,
|
190
190
|
target?: WebGLRenderingContext['TEXTURE_2D'],
|
191
191
|
}
|
192
192
|
|
@@ -204,12 +204,12 @@ export interface TextureCubeSourceOptionsImageMipmaps extends TextureOptionsBase
|
|
204
204
|
}
|
205
205
|
|
206
206
|
export type TextureCubeSourceURLMap = [
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
207
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: string,
|
208
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: string,
|
209
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: string,
|
210
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: string,
|
211
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: string,
|
212
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: string
|
213
213
|
];
|
214
214
|
|
215
215
|
export interface TextureConfigOptionsBase {
|
@@ -242,12 +242,12 @@ export interface TextureOptionsBase extends TextureConfigOptions, TextureFormatO
|
|
242
242
|
export type TextureCubeSourceOptions = TextureCubeSourceOptionsImage | TextureCubeSourceOptionsImageMipmaps;
|
243
243
|
|
244
244
|
export type Texture2DSourceOptions =
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
245
|
+
Texture2DSourceOptionsImage
|
246
|
+
| Texture2DSourceOptionsData
|
247
|
+
| Texture2DSourceOptionsVideo
|
248
|
+
| Texture2DSourceOptionsImageMipmaps
|
249
|
+
| Texture2DSourceOptionsCompressed
|
250
|
+
| Texture2DSourceOptionsFrameBuffer;
|
251
251
|
|
252
252
|
export type Texture2DOptions = Texture2DSourceOptions;
|
253
253
|
|