@predy-js/render-interface 0.1.52-beta.5 → 0.1.52-beta.6
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 +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/statistic.js +1 -1
- package/dist/types/Geometry.d.ts +2 -3
- package/dist/types/ShaderLibrary.d.ts +1 -5
- package/dist/types/Texture.d.ts +0 -1
- package/dist/types/native/DataBlockInternal.d.ts +0 -4
- package/dist/types/native/GeometryInternal.d.ts +0 -6
- package/dist/types/native/MaterialInternal.d.ts +3 -2
- package/dist/types/native/RenderPassInternal.d.ts +5 -4
- package/dist/types/native/RendererInternal.d.ts +0 -6
- package/dist/types/native/TextureInternal.d.ts +4 -11
- package/package.json +1 -1
package/dist/statistic.js
CHANGED
package/dist/types/Geometry.d.ts
CHANGED
@@ -8,12 +8,11 @@ import type { GPURenderer } from './Renderer';
|
|
8
8
|
* stride:used for interleaved attributes, 2 vec4 stride is 4 * 2 * Float32Array.BYTES_PER_ELEMENTS
|
9
9
|
* offset: offset for interleaved attributes, 1 vec4 offset is 4 * Float32Array.BYTES_PER_ELEMENTS
|
10
10
|
* normalize: attributed should be normalized
|
11
|
-
* location: attribute location
|
12
11
|
* Attribute的绑定信息
|
13
12
|
* size:向量的大小,vec4|vec3|vec2的大小分别为 4|3|2
|
14
13
|
* stride:如果使用交错存储顶点,2个vec4的stride为 2 * 4 * Float32Array.BYTES_PER_ELEMENTS
|
15
14
|
* offset:交错顶点的数据偏移,1个vec4的偏移为 4*Float32Array.BYTES_PER_ELEMENTS
|
16
|
-
*
|
15
|
+
* bufferIndex: 用于metal提交bufferIndex
|
17
16
|
*/
|
18
17
|
export interface AttributeBase {
|
19
18
|
size: number;
|
@@ -21,7 +20,7 @@ export interface AttributeBase {
|
|
21
20
|
offset?: number;
|
22
21
|
instanceDivisor?: number;
|
23
22
|
normalize?: boolean;
|
24
|
-
|
23
|
+
bufferIndex?: number;
|
25
24
|
}
|
26
25
|
/**
|
27
26
|
* if data provided, type can be inferred from its data
|
@@ -34,8 +34,8 @@ export interface ShaderCompileResult {
|
|
34
34
|
status: ShaderCompileResultStatus;
|
35
35
|
cacheId?: string;
|
36
36
|
error?: string | null;
|
37
|
-
compileTime?: number;
|
38
37
|
shared?: boolean;
|
38
|
+
compileTime?: number;
|
39
39
|
}
|
40
40
|
/**
|
41
41
|
* @example
|
@@ -50,10 +50,6 @@ export interface ShaderCompileResult {
|
|
50
50
|
export interface ShaderLibrary {
|
51
51
|
readonly cacheIds: string[];
|
52
52
|
getShaderResult(cacheId: string): ShaderCompileResult | undefined;
|
53
|
-
/**
|
54
|
-
* 添加shader
|
55
|
-
* @param shader
|
56
|
-
*/
|
57
53
|
addShader(shader: Shader): string;
|
58
54
|
/**
|
59
55
|
* @param cacheId
|
package/dist/types/Texture.d.ts
CHANGED
@@ -203,7 +203,6 @@ export interface TextureFormatOptions {
|
|
203
203
|
type?: GLenum;
|
204
204
|
}
|
205
205
|
export interface TextureOptionsBase extends TextureConfigOptions, TextureFormatOptions {
|
206
|
-
sourceType?: TextureSourceType;
|
207
206
|
}
|
208
207
|
export type TextureCubeSourceOptions = TextureCubeSourceOptionsImage | TextureCubeSourceOptionsImageMipmaps;
|
209
208
|
export type Texture2DSourceOptions = Texture2DSourceOptionsImage | Texture2DSourceOptionsData | Texture2DSourceOptionsVideo | Texture2DSourceOptionsImageMipmaps | Texture2DSourceOptionsCompressed | Texture2DSourceOptionsFrameBuffer;
|
@@ -5,10 +5,6 @@ export interface DataBlockInternalOptions {
|
|
5
5
|
}
|
6
6
|
export declare abstract class DataBlockInternal implements ResourceInternal {
|
7
7
|
readonly isDestroyed: boolean;
|
8
|
-
/**
|
9
|
-
* UBO的name,如果没有找到对应的UBO就用setUniform
|
10
|
-
* UBO的Layout只有一种,如果不同shader中使用同名UBO,请创建不同的DataBlock对象
|
11
|
-
*/
|
12
8
|
readonly name: string;
|
13
9
|
protected constructor(options: DataBlockInternalOptions);
|
14
10
|
abstract destroy(): void;
|
@@ -1,14 +1,9 @@
|
|
1
1
|
import type { AttributeWithType, GeometryOptions } from '../Geometry';
|
2
2
|
import type { ResourceInternal } from './ResourceInternal';
|
3
3
|
import type { GPUBufferInternal } from './GPUBufferInternal';
|
4
|
-
interface GeometryBufferLayout {
|
5
|
-
index: number;
|
6
|
-
name: string;
|
7
|
-
}
|
8
4
|
export interface GeometryInternalOptions extends Omit<GeometryOptions, 'attributes' | 'index'> {
|
9
5
|
attributes: Record<string, AttributeWithType>;
|
10
6
|
buffers: Record<string, GPUBufferInternal>;
|
11
|
-
bufferLayouts: GeometryBufferLayout[];
|
12
7
|
indexBuffer?: GPUBufferInternal;
|
13
8
|
indexBufferType?: IndexBufferType;
|
14
9
|
}
|
@@ -38,4 +33,3 @@ export declare abstract class GeometryInternal implements ResourceInternal {
|
|
38
33
|
*/
|
39
34
|
abstract destroy(): void;
|
40
35
|
}
|
41
|
-
export {};
|
@@ -5,13 +5,14 @@ import type { TextureInternal } from './TextureInternal';
|
|
5
5
|
export interface MaterialInternalOptions {
|
6
6
|
states: MaterialRenderStates;
|
7
7
|
dataBlocks: DataBlockInternal[];
|
8
|
-
shaderCacheId
|
8
|
+
shaderCacheId?: string;
|
9
|
+
_mtlFrag?: string;
|
10
|
+
_mtlVert?: string;
|
9
11
|
name: string;
|
10
12
|
}
|
11
13
|
export declare abstract class MaterialInternal implements ResourceInternal {
|
12
14
|
readonly isDestroyed: boolean;
|
13
15
|
readonly name: string;
|
14
|
-
readonly shaderCacheId: string;
|
15
16
|
dataBlocks: DataBlockInternal[];
|
16
17
|
protected constructor(options: MaterialInternalOptions);
|
17
18
|
abstract destroy(): void;
|
@@ -4,6 +4,7 @@ import type { RenderPassClearAction, RenderPassStoreAction } from '../RenderPass
|
|
4
4
|
import type { TextureInternal } from './TextureInternal';
|
5
5
|
import type { RenderPassStorageObject } from '../RenderPass';
|
6
6
|
import type { RenderPassAttachmentStorageType } from '../RenderPass';
|
7
|
+
import type { Mesh } from '../Mesh';
|
7
8
|
export interface RenderPassColorAttachmentInternal {
|
8
9
|
readonly storageType: RenderPassAttachmentStorageType.color;
|
9
10
|
readonly texture: TextureInternal;
|
@@ -28,12 +29,12 @@ export interface RenderPassDepthStencilAttachmentOptionsInternal {
|
|
28
29
|
}
|
29
30
|
export interface RenderPassOptionsInternal {
|
30
31
|
clearAction: RenderPassClearAction;
|
32
|
+
storeAction: RenderPassStoreAction;
|
31
33
|
attachments: RenderPassColorAttachmentInternal[];
|
34
|
+
depthStencilAttachment: RenderPassDepthStencilAttachmentOptionsInternal;
|
32
35
|
name: string;
|
33
|
-
meshes:
|
34
|
-
multiSample
|
35
|
-
storeAction?: RenderPassStoreAction;
|
36
|
-
depthStencilAttachment?: RenderPassDepthStencilAttachmentOptionsInternal;
|
36
|
+
meshes: Mesh[];
|
37
|
+
multiSample: number;
|
37
38
|
viewport?: [x: number, y: number, width: number, height: number];
|
38
39
|
}
|
39
40
|
export declare abstract class RenderPassInternal implements ResourceInternal {
|
@@ -16,12 +16,6 @@ import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapI
|
|
16
16
|
export interface InternalResInfo {
|
17
17
|
buffer: number;
|
18
18
|
geometry: number;
|
19
|
-
material: number;
|
20
|
-
texture: number;
|
21
|
-
dataBlock: number;
|
22
|
-
mesh: number;
|
23
|
-
renderPass: number;
|
24
|
-
frame: number;
|
25
19
|
}
|
26
20
|
export declare abstract class RendererInternal implements ResourceInternal {
|
27
21
|
readonly isDestroyed: boolean;
|
@@ -4,29 +4,22 @@ import type { TypedArray } from '../type';
|
|
4
4
|
import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
5
5
|
export interface TextureInternalOptions extends TextureFormatOptions, Omit<TextureConfigOptionsBase, 'keepImageSource'> {
|
6
6
|
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'] | WebGLRenderingContext['TEXTURE_2D'];
|
7
|
-
}
|
8
|
-
export interface TextureInternalConstructOptions extends TextureInternalOptions {
|
9
7
|
width: number;
|
10
8
|
height: number;
|
11
|
-
image?: ImageBitmapInternal;
|
12
9
|
}
|
13
10
|
export declare abstract class TextureInternal implements ResourceInternal {
|
14
11
|
readonly isDestroyed: boolean;
|
15
12
|
readonly width: number;
|
16
13
|
readonly height: number;
|
17
14
|
readonly name: string;
|
18
|
-
readonly options: TextureInternalOptions
|
15
|
+
readonly options: Omit<TextureInternalOptions, 'cube' | 'image'>;
|
19
16
|
protected constructor(options: TextureInternalOptions);
|
20
|
-
abstract
|
17
|
+
abstract reset(options: TextureInternalOptions): boolean;
|
21
18
|
abstract destroy(): void;
|
22
19
|
/**
|
23
|
-
*
|
24
|
-
*/
|
25
|
-
abstract update2DImageData(data: TypedArray, mipmapLevel?: number): void;
|
26
|
-
/**
|
27
|
-
* 上传压缩纹理数据
|
20
|
+
* 上传整张图片数据,数据尺寸必须和Texture尺寸定义相同
|
28
21
|
*/
|
29
|
-
abstract
|
22
|
+
abstract update2DData(data: TypedArray, mipmapLevel?: number): void;
|
30
23
|
/**
|
31
24
|
* imageBitmap的尺寸也必须和Texture相同
|
32
25
|
* @param image
|