@predy-js/render-interface 0.1.46-beta.2 → 0.1.46-beta.21
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 +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -2
- package/dist/index.mjs.map +1 -1
- package/dist/statistic.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/native/DataBlockInternal.d.ts +15 -8
- package/dist/types/native/GPUBufferInternal.d.ts +1 -2
- package/dist/types/native/GeometryInternal.d.ts +4 -5
- package/dist/types/native/ImageBitmapInternal.d.ts +22 -0
- package/dist/types/native/MaterialInternal.d.ts +8 -4
- package/dist/types/native/MeshInternal.d.ts +3 -3
- package/dist/types/native/RenderFrameInternal.d.ts +1 -2
- package/dist/types/native/RenderPassInternal.d.ts +1 -2
- package/dist/types/native/RendererInternal.d.ts +5 -0
- package/dist/types/native/ResourceInternal.d.ts +0 -1
- package/dist/types/native/TextureInternal.d.ts +16 -12
- package/dist/types/native/index.d.ts +12 -0
- package/package.json +1 -1
package/dist/statistic.js
CHANGED
package/dist/types/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { TextureFactory, Texture, TextureConfigOptions, TextureOptions, TextureFactorySourceFrom } from './Texture';
|
2
2
|
import type { GPUCapability } from './GPUCapability';
|
3
3
|
import type { TypedArray } from './type';
|
4
|
+
export * from './native/index';
|
4
5
|
export * from './constants';
|
5
6
|
export * from './GPUCapability';
|
6
7
|
export * from './Renderer';
|
@@ -1,18 +1,25 @@
|
|
1
|
-
import type { ResourceInternal
|
1
|
+
import type { ResourceInternal } from './ResourceInternal';
|
2
2
|
import type { TypedArray } from '../type';
|
3
|
-
import type { TextureInternal } from './TextureInternal';
|
4
|
-
export type UniformValueInternal = TypedArray | number | number[];
|
5
3
|
export interface DataBlockInternalOptions {
|
6
4
|
name: string;
|
7
5
|
}
|
8
6
|
export declare abstract class DataBlockInternal implements ResourceInternal {
|
9
7
|
readonly isDestroyed: boolean;
|
10
|
-
readonly platform: ResourcePlatform;
|
11
8
|
readonly name: string;
|
12
9
|
protected constructor(options: DataBlockInternalOptions);
|
13
10
|
abstract destroy(): void;
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
/**
|
12
|
+
* uniform 的数据都以TypedArray形式传入,
|
13
|
+
* 在OpenGL中,使用UBO时,作为UBO的数据buffer,
|
14
|
+
* 不使用UBO时根据反射类型进行数据转化
|
15
|
+
* Metal中,直接当作 argument buffer
|
16
|
+
*/
|
17
|
+
abstract setUniformValue(name: string, value: TypedArray): void;
|
18
|
+
/**
|
19
|
+
* 将uniform的数据拷贝到指定的TypedArray中,
|
20
|
+
* 如果传入的TypedArray buffer 长度不足,将只写入传入长度的数据
|
21
|
+
* @param name
|
22
|
+
* @param value
|
23
|
+
*/
|
24
|
+
abstract getUniformValue(name: string, value: TypedArray): boolean;
|
18
25
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { ResourceInternal
|
1
|
+
import type { ResourceInternal } from './ResourceInternal';
|
2
2
|
import type { TypedArray } from '../type';
|
3
3
|
export declare const GPUBufferOptionsMemoryShared: number;
|
4
4
|
export interface GPUBufferInternalOptions {
|
@@ -10,7 +10,6 @@ export interface GPUBufferInternalOptions {
|
|
10
10
|
*/
|
11
11
|
export declare abstract class GPUBufferInternal implements ResourceInternal {
|
12
12
|
readonly isDestroyed: boolean;
|
13
|
-
readonly platform: ResourcePlatform;
|
14
13
|
readonly byteLength: number;
|
15
14
|
protected constructor(options: GPUBufferInternalOptions);
|
16
15
|
abstract destroy(): void;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import type { AttributeWithType, GeometryOptions } from '../Geometry';
|
2
|
-
import type { ResourceInternal
|
2
|
+
import type { ResourceInternal } from './ResourceInternal';
|
3
3
|
import type { GPUBufferInternal } from './GPUBufferInternal';
|
4
4
|
export interface GeometryInternalOptions extends Omit<GeometryOptions, 'attributes' | 'index'> {
|
5
|
-
attributes: AttributeWithType
|
5
|
+
attributes: Record<string, AttributeWithType>;
|
6
6
|
buffers: Record<string, GPUBufferInternal>;
|
7
|
-
|
8
|
-
|
7
|
+
indexBuffer?: GPUBufferInternal;
|
8
|
+
indexBufferType?: IndexBufferType;
|
9
9
|
}
|
10
10
|
export type IndexBufferType = WebGLRenderingContext['UNSIGNED_SHORT'] | WebGLRenderingContext['UNSIGNED_INT'];
|
11
11
|
/**
|
@@ -13,7 +13,6 @@ export type IndexBufferType = WebGLRenderingContext['UNSIGNED_SHORT'] | WebGLRen
|
|
13
13
|
*/
|
14
14
|
export declare abstract class GeometryInternal implements ResourceInternal {
|
15
15
|
readonly isDestroyed: boolean;
|
16
|
-
readonly platform: ResourcePlatform;
|
17
16
|
name: string;
|
18
17
|
drawStart: number;
|
19
18
|
drawCount: number;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
export interface ImageBitmapConstructor {
|
2
|
+
flipY?: boolean;
|
3
|
+
premultiplyAlpha?: boolean;
|
4
|
+
resizeWidth?: number;
|
5
|
+
resizeHeight?: number;
|
6
|
+
}
|
7
|
+
export declare abstract class ImageBitmapInternal {
|
8
|
+
/**
|
9
|
+
* 释放内存,释放后不可再用,
|
10
|
+
* 释放后 width,height,byteLength都为0
|
11
|
+
*/
|
12
|
+
abstract close(): void;
|
13
|
+
/**
|
14
|
+
* 将内存拷贝到指定的Uint8Array中
|
15
|
+
* @param target
|
16
|
+
*/
|
17
|
+
abstract copyTo(target: Uint8Array): void;
|
18
|
+
abstract readonly width: number;
|
19
|
+
abstract readonly height: number;
|
20
|
+
abstract readonly byteLength: number;
|
21
|
+
}
|
22
|
+
export type ImageBitmapCallback = (error: Error | undefined, image: ImageBitmapInternal) => void;
|
@@ -1,17 +1,21 @@
|
|
1
|
-
import type { ResourceInternal
|
1
|
+
import type { ResourceInternal } from './ResourceInternal';
|
2
2
|
import type { MaterialRenderStates } from '../Material';
|
3
3
|
import type { DataBlockInternal } from './DataBlockInternal';
|
4
|
+
import type { TextureInternal } from './TextureInternal';
|
4
5
|
export interface MaterialInternalOptions {
|
5
6
|
states: MaterialRenderStates;
|
6
|
-
shaderCacheId: string;
|
7
7
|
dataBlocks: DataBlockInternal[];
|
8
|
-
|
8
|
+
shaderCacheId?: string;
|
9
|
+
_mtlFrag?: string;
|
10
|
+
_mtlVert?: string;
|
11
|
+
name: string;
|
9
12
|
}
|
10
13
|
export declare abstract class MaterialInternal implements ResourceInternal {
|
11
14
|
readonly isDestroyed: boolean;
|
12
|
-
readonly platform: ResourcePlatform;
|
13
15
|
readonly name: string;
|
14
16
|
dataBlocks: DataBlockInternal[];
|
15
17
|
protected constructor(options: MaterialInternalOptions);
|
16
18
|
abstract destroy(): void;
|
19
|
+
abstract setUniformTexture(name: string, value: TextureInternal): void;
|
20
|
+
abstract getUniformTexture(name: string): TextureInternal;
|
17
21
|
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import type { ResourceInternal
|
1
|
+
import type { ResourceInternal } from './ResourceInternal';
|
2
2
|
import type { GeometryInternal } from './GeometryInternal';
|
3
3
|
import type { MaterialInternal } from './MaterialInternal';
|
4
4
|
export interface MeshInternalOptions {
|
5
|
-
name
|
5
|
+
name: string;
|
6
6
|
geometries: GeometryInternal[];
|
7
7
|
material: MaterialInternal;
|
8
8
|
priority?: number;
|
9
|
+
hide?: boolean;
|
9
10
|
}
|
10
11
|
export declare abstract class MeshInternal implements ResourceInternal {
|
11
12
|
readonly isDestroyed: boolean;
|
12
|
-
readonly platform: ResourcePlatform;
|
13
13
|
readonly name: string;
|
14
14
|
geometries: GeometryInternal[];
|
15
15
|
material: MaterialInternal;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { ResourceInternal
|
1
|
+
import type { ResourceInternal } from './ResourceInternal';
|
2
2
|
import type { RenderPassInternal } from './RenderPassInternal';
|
3
3
|
import type { RenderPassClearAction } from '../RenderPass';
|
4
4
|
export interface RenderFrameInternalOptions {
|
@@ -8,7 +8,6 @@ export interface RenderFrameInternalOptions {
|
|
8
8
|
}
|
9
9
|
export declare abstract class RenderFrameInternal implements ResourceInternal {
|
10
10
|
readonly isDestroyed: boolean;
|
11
|
-
readonly platform: ResourcePlatform;
|
12
11
|
readonly clearAction: RenderPassClearAction;
|
13
12
|
readonly name: string;
|
14
13
|
/**
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { ResourceInternal
|
1
|
+
import type { ResourceInternal } from './ResourceInternal';
|
2
2
|
import type { MeshInternal } from './MeshInternal';
|
3
3
|
import type { RenderPassClearAction, RenderPassStoreAction } from '../RenderPass';
|
4
4
|
import type { TextureInternal } from './TextureInternal';
|
@@ -39,7 +39,6 @@ export interface RenderPassOptionsInternal {
|
|
39
39
|
}
|
40
40
|
export declare abstract class RenderPassInternal implements ResourceInternal {
|
41
41
|
readonly isDestroyed: boolean;
|
42
|
-
readonly platform: ResourcePlatform;
|
43
42
|
readonly name: string;
|
44
43
|
readonly storeAction: RenderPassStoreAction;
|
45
44
|
readonly clearAction: RenderPassClearAction;
|
@@ -8,6 +8,8 @@ import type { MeshInternal, MeshInternalOptions } from './MeshInternal';
|
|
8
8
|
import type { RenderPassInternal, RenderPassOptionsInternal } from './RenderPassInternal';
|
9
9
|
import type { RenderFrameInternal, RenderFrameInternalOptions } from './RenderFrameInternal';
|
10
10
|
import type { GPUCapability } from '../GPUCapability';
|
11
|
+
import type { TextureInternal, TextureInternalOptions } from './TextureInternal';
|
12
|
+
import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
|
11
13
|
/**
|
12
14
|
* renderer 内部创建的对象,用来统计信息,排查资源泄漏的问题
|
13
15
|
*/
|
@@ -28,5 +30,8 @@ export declare abstract class RendererInternal implements ResourceInternal {
|
|
28
30
|
abstract createMesh(options: MeshInternalOptions): MeshInternal;
|
29
31
|
abstract createRenderPass(options: RenderPassOptionsInternal): RenderPassInternal;
|
30
32
|
abstract createRenderFrame(options: RenderFrameInternalOptions): RenderFrameInternal;
|
33
|
+
abstract createTexture(options: TextureInternalOptions): TextureInternal;
|
31
34
|
abstract getResourceInfo(): InternalResInfo;
|
35
|
+
abstract createImageBitmap(data: ArrayBuffer, //图片文件的数据
|
36
|
+
options: ImageBitmapConstructor, callback: ImageBitmapCallback): void;
|
32
37
|
}
|
@@ -1,25 +1,29 @@
|
|
1
1
|
import type { TextureFormatOptions, TextureConfigOptionsBase } from '../Texture';
|
2
|
-
import type { ResourceInternal
|
3
|
-
|
4
|
-
|
5
|
-
width: number;
|
6
|
-
height: number;
|
7
|
-
}
|
2
|
+
import type { ResourceInternal } from './ResourceInternal';
|
3
|
+
import type { TypedArray } from '../type';
|
4
|
+
import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
8
5
|
export interface TextureInternalOptions extends TextureFormatOptions, Omit<TextureConfigOptionsBase, 'keepImageSource'> {
|
9
6
|
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'] | WebGLRenderingContext['TEXTURE_2D'];
|
10
|
-
|
11
|
-
|
7
|
+
width: number;
|
8
|
+
height: number;
|
12
9
|
}
|
13
10
|
export declare abstract class TextureInternal implements ResourceInternal {
|
14
11
|
readonly isDestroyed: boolean;
|
15
|
-
readonly platform: ResourcePlatform;
|
16
12
|
readonly width: number;
|
17
13
|
readonly height: number;
|
18
14
|
readonly name: string;
|
19
15
|
readonly options: Omit<TextureInternalOptions, 'cube' | 'image'>;
|
20
16
|
protected constructor(options: TextureInternalOptions);
|
21
|
-
abstract reset(options: TextureInternalOptions):
|
17
|
+
abstract reset(options: TextureInternalOptions): boolean;
|
22
18
|
abstract destroy(): void;
|
23
|
-
|
24
|
-
|
19
|
+
/**
|
20
|
+
* 上传整张图片数据,数据尺寸必须和Texture尺寸定义相同
|
21
|
+
*/
|
22
|
+
abstract update2DData(data: TypedArray, mipmapLevel?: number): void;
|
23
|
+
/**
|
24
|
+
* imageBitmap的尺寸也必须和Texture相同
|
25
|
+
* @param image
|
26
|
+
* @param mipmapLevel
|
27
|
+
*/
|
28
|
+
abstract update2DImage(image: ImageBitmapInternal, mipmapLevel?: number): void;
|
25
29
|
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export * from './RendererInternal';
|
2
|
+
export * from './DataBlockInternal';
|
3
|
+
export * from './GeometryInternal';
|
4
|
+
export * from './GPUBufferInternal';
|
5
|
+
export * from './ImageBitmapInternal';
|
6
|
+
export * from './MaterialInternal';
|
7
|
+
export * from './MeshInternal';
|
8
|
+
export * from './RenderFrameInternal';
|
9
|
+
export * from './RenderPassInternal';
|
10
|
+
export * from './ResourceInternal';
|
11
|
+
export * from './ShaderLibraryInternal';
|
12
|
+
export * from './TextureInternal';
|