@predy-js/render-interface 0.1.66-beta.3 → 0.1.66-beta.5

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/statistic.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @predy-js/render-interface
3
3
  * Description: undefined
4
4
  * Author: undefined
5
- * Version: v0.1.66-beta.3
5
+ * Version: v0.1.66-beta.5
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -80,37 +80,18 @@ export declare class Texture implements IGPUResource {
80
80
  assignRenderer(renderer: GPURenderer): Texture;
81
81
  }
82
82
  type ImageSource = ImageBitmap | HTMLImageElement | HTMLCanvasElement;
83
+ export interface ImageData {
84
+ data: TypedArray;
85
+ width: number;
86
+ height: number;
87
+ }
83
88
  export type TextureSourceCubeData = [
84
- TEXTURE_CUBE_MAP_POSITIVE_X: ImageSource | {
85
- data: TypedArray;
86
- width: number;
87
- height: number;
88
- },
89
- TEXTURE_CUBE_MAP_NEGATIVE_X: ImageSource | {
90
- data: TypedArray;
91
- width: number;
92
- height: number;
93
- },
94
- TEXTURE_CUBE_MAP_POSITIVE_Y: ImageSource | {
95
- data: TypedArray;
96
- width: number;
97
- height: number;
98
- },
99
- TEXTURE_CUBE_MAP_NEGATIVE_Y: ImageSource | {
100
- data: TypedArray;
101
- width: number;
102
- height: number;
103
- },
104
- TEXTURE_CUBE_MAP_POSITIVE_Z: ImageSource | {
105
- data: TypedArray;
106
- width: number;
107
- height: number;
108
- },
109
- TEXTURE_CUBE_MAP_NEGATIVE_Z: ImageSource | {
110
- data: TypedArray;
111
- width: number;
112
- height: number;
113
- }
89
+ TEXTURE_CUBE_MAP_POSITIVE_X: ImageSource | ImageData,
90
+ TEXTURE_CUBE_MAP_NEGATIVE_X: ImageSource | ImageData,
91
+ TEXTURE_CUBE_MAP_POSITIVE_Y: ImageSource | ImageData,
92
+ TEXTURE_CUBE_MAP_NEGATIVE_Y: ImageSource | ImageData,
93
+ TEXTURE_CUBE_MAP_POSITIVE_Z: ImageSource | ImageData,
94
+ TEXTURE_CUBE_MAP_NEGATIVE_Z: ImageSource | ImageData
114
95
  ];
115
96
  export type TextureSourceOptions = Texture2DSourceOptions | TextureCubeSourceOptions;
116
97
  export interface Texture2DSourceOptionsNone extends TextureOptionsBase {
@@ -1,6 +1,5 @@
1
- import type { TextureFormatOptions, TextureConfigOptionsBase } from '../Texture';
1
+ import type { TextureFormatOptions, TextureConfigOptionsBase, ImageData } from '../Texture';
2
2
  import type { ResourceInternal } from './ResourceInternal';
3
- import type { TypedArray } from '../type';
4
3
  import type { ImageBitmapInternal } from './ImageBitmapInternal';
5
4
  export interface TextureInternalOptions extends TextureFormatOptions, Omit<TextureConfigOptionsBase, 'keepImageSource'> {
6
5
  target: WebGLRenderingContext['TEXTURE_CUBE_MAP'] | WebGLRenderingContext['TEXTURE_2D'];
@@ -10,7 +9,7 @@ export interface TextureInternalConstructOptions extends TextureInternalOptions
10
9
  width: number;
11
10
  height: number;
12
11
  }
13
- export type TextureInternalCubeImages<T extends ImageBitmapInternal | TypedArray = ImageBitmapInternal> = [
12
+ export type TextureInternalCubeImages<T extends ImageBitmapInternal | ImageData = ImageBitmapInternal> = [
14
13
  positiveX: T,
15
14
  nagtiveX: T,
16
15
  positiveY: T,
@@ -30,7 +29,7 @@ export declare abstract class TextureInternal implements ResourceInternal {
30
29
  /**
31
30
  * 上传cubeImage解码后的数据
32
31
  */
33
- abstract updateCubeImagesData(images: TextureInternalCubeImages<TypedArray>, mipmapLevel?: number): void;
32
+ abstract updateCubeImagesData(images: TextureInternalCubeImages<ImageData>, mipmapLevel?: number): void;
34
33
  /**
35
34
  * 上传cubeImage
36
35
  */
@@ -38,11 +37,11 @@ export declare abstract class TextureInternal implements ResourceInternal {
38
37
  /**
39
38
  * 上传整张解码后图片数据,数据尺寸必须和Texture尺寸定义相同
40
39
  */
41
- abstract update2DImageData(data: TypedArray, mipmapLevel?: number): void;
40
+ abstract update2DImageData(data: ImageData, mipmapLevel?: number): void;
42
41
  /**
43
42
  * 上传压缩纹理数据
44
43
  */
45
- abstract update2DCompressedImage(data: TypedArray, mipmapLevel?: number): void;
44
+ abstract update2DCompressedImage(data: ImageData, mipmapLevel?: number): void;
46
45
  /**
47
46
  * imageBitmap的尺寸也必须和Texture相同
48
47
  * @param image
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.1.66-beta.3",
3
+ "version": "0.1.66-beta.5",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
package/types/Texture.ts CHANGED
@@ -112,13 +112,19 @@ export declare class Texture implements IGPUResource {
112
112
 
113
113
  type ImageSource = ImageBitmap | HTMLImageElement | HTMLCanvasElement;
114
114
 
115
+ export interface ImageData {
116
+ data: TypedArray,
117
+ width: number,
118
+ height: number,
119
+ }
120
+
115
121
  export type TextureSourceCubeData = [
116
- TEXTURE_CUBE_MAP_POSITIVE_X: ImageSource | { data: TypedArray, width: number, height: number },
117
- TEXTURE_CUBE_MAP_NEGATIVE_X: ImageSource | { data: TypedArray, width: number, height: number },
118
- TEXTURE_CUBE_MAP_POSITIVE_Y: ImageSource | { data: TypedArray, width: number, height: number },
119
- TEXTURE_CUBE_MAP_NEGATIVE_Y: ImageSource | { data: TypedArray, width: number, height: number },
120
- TEXTURE_CUBE_MAP_POSITIVE_Z: ImageSource | { data: TypedArray, width: number, height: number },
121
- TEXTURE_CUBE_MAP_NEGATIVE_Z: ImageSource | { data: TypedArray, width: number, height: number }
122
+ TEXTURE_CUBE_MAP_POSITIVE_X: ImageSource | ImageData,
123
+ TEXTURE_CUBE_MAP_NEGATIVE_X: ImageSource | ImageData,
124
+ TEXTURE_CUBE_MAP_POSITIVE_Y: ImageSource | ImageData,
125
+ TEXTURE_CUBE_MAP_NEGATIVE_Y: ImageSource | ImageData,
126
+ TEXTURE_CUBE_MAP_POSITIVE_Z: ImageSource | ImageData,
127
+ TEXTURE_CUBE_MAP_NEGATIVE_Z: ImageSource | ImageData
122
128
  ];
123
129
 
124
130
  // 为减少内存消耗,除了video之外,其余的数据内容会在texture生成后被置为undefined
@@ -1,6 +1,5 @@
1
- import type { TextureFormatOptions, TextureConfigOptionsBase } from '../Texture';
1
+ import type { TextureFormatOptions, TextureConfigOptionsBase, ImageData } from '../Texture';
2
2
  import type { ResourceInternal } from './ResourceInternal';
3
- import type { TypedArray } from '../type';
4
3
  import type { ImageBitmapInternal } from './ImageBitmapInternal';
5
4
 
6
5
  export interface TextureInternalOptions extends TextureFormatOptions, Omit<TextureConfigOptionsBase, 'keepImageSource'> {
@@ -13,7 +12,7 @@ export interface TextureInternalConstructOptions extends TextureInternalOptions
13
12
  height: number,
14
13
  }
15
14
 
16
- export type TextureInternalCubeImages<T extends ImageBitmapInternal | TypedArray = ImageBitmapInternal> = [
15
+ export type TextureInternalCubeImages<T extends ImageBitmapInternal | ImageData = ImageBitmapInternal> = [
17
16
  positiveX: T,
18
17
  nagtiveX: T,
19
18
  positiveY: T,
@@ -43,7 +42,7 @@ export abstract class TextureInternal implements ResourceInternal {
43
42
  /**
44
43
  * 上传cubeImage解码后的数据
45
44
  */
46
- abstract updateCubeImagesData (images: TextureInternalCubeImages<TypedArray>, mipmapLevel?: number): void;
45
+ abstract updateCubeImagesData (images: TextureInternalCubeImages<ImageData>, mipmapLevel?: number): void;
47
46
 
48
47
  /**
49
48
  * 上传cubeImage
@@ -53,13 +52,13 @@ export abstract class TextureInternal implements ResourceInternal {
53
52
  /**
54
53
  * 上传整张解码后图片数据,数据尺寸必须和Texture尺寸定义相同
55
54
  */
56
- abstract update2DImageData (data: TypedArray, mipmapLevel?: number): void;
55
+ abstract update2DImageData (data: ImageData, mipmapLevel?: number): void;
57
56
 
58
57
  /**
59
58
  * 上传压缩纹理数据
60
59
  */
61
60
 
62
- abstract update2DCompressedImage (data: TypedArray, mipmapLevel?: number): void;
61
+ abstract update2DCompressedImage (data: ImageData, mipmapLevel?: number): void;
63
62
 
64
63
  /**
65
64
  * imageBitmap的尺寸也必须和Texture相同