@predy-js/render-interface 0.1.61-beta.2 → 0.1.61-beta.22
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 +231 -136
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +231 -137
- package/dist/index.mjs.map +1 -1
- package/dist/src/render/MarsGeometry.d.ts +4 -3
- package/dist/src/render/MarsMaterial.d.ts +2 -3
- package/dist/src/render/MarsMaterialDataBlock.d.ts +12 -3
- package/dist/src/render/MarsRenderer.d.ts +3 -0
- package/dist/src/webgl/GLGPUBuffer.d.ts +2 -4
- package/dist/src/webgl/GLGPURenderer.d.ts +2 -0
- package/dist/src/webgl/GLGeometry.d.ts +6 -2
- package/dist/src/webgl/GLProgram.d.ts +2 -0
- package/dist/statistic.js +1 -1
- package/dist/types/GPUBuffer.d.ts +14 -14
- package/dist/types/Geometry.d.ts +9 -4
- package/dist/types/Material.d.ts +27 -24
- package/dist/types/RenderFrame.d.ts +3 -5
- package/dist/types/RenderPass.d.ts +2 -2
- package/dist/types/Renderer.d.ts +21 -12
- package/dist/types/ShaderLibrary.d.ts +4 -4
- package/dist/types/native/DataBlockInternal.d.ts +3 -0
- package/dist/types/native/GPUBufferInternal.d.ts +1 -1
- package/dist/types/native/ImageBitmapInternal.d.ts +0 -2
- package/dist/types/native/MaterialInternal.d.ts +0 -9
- package/dist/types/native/RenderFrameInternal.d.ts +3 -7
- package/dist/types/native/RendererInternal.d.ts +10 -0
- package/dist/types/native/TextureInternal.d.ts +1 -0
- package/package.json +1 -1
- package/types/GPUBuffer.ts +16 -19
- package/types/Geometry.ts +11 -4
- package/types/Material.ts +37 -31
- package/types/RenderFrame.ts +3 -5
- package/types/RenderPass.ts +2 -2
- package/types/Renderer.ts +24 -13
- package/types/ShaderLibrary.ts +4 -4
- package/types/native/DataBlockInternal.ts +5 -0
- package/types/native/GPUBufferInternal.ts +1 -2
- package/types/native/ImageBitmapInternal.ts +0 -2
- package/types/native/MaterialInternal.ts +0 -11
- package/types/native/RenderFrameInternal.ts +3 -7
- package/types/native/RendererInternal.ts +13 -0
- package/types/native/TextureInternal.ts +1 -0
package/types/GPUBuffer.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { TypedArray } from './type';
|
2
2
|
import type { IGPUResource, IGPURenderer } from './IGPURenderer';
|
3
3
|
import type { GPURenderer } from './Renderer';
|
4
|
-
|
4
|
+
export const GPUBufferOptionsMemoryShared = 1 << 1;
|
5
5
|
export type GPUBufferTarget =
|
6
6
|
| WebGLRenderingContext['ARRAY_BUFFER']
|
7
7
|
| WebGLRenderingContext['ELEMENT_ARRAY_BUFFER']
|
@@ -12,20 +12,23 @@ export type GPUBufferTarget =
|
|
12
12
|
| WebGL2RenderingContext['PIXEL_PACK_BUFFER']
|
13
13
|
| WebGL2RenderingContext['PIXEL_UNPACK_BUFFER'];
|
14
14
|
|
15
|
-
type GPUBufferType = WebGLRenderingContext['FLOAT'] | WebGLRenderingContext['INT'] | WebGLRenderingContext['SHORT'];
|
16
15
|
export interface GPUBufferOptions {
|
17
16
|
name?: string,
|
18
|
-
|
19
|
-
target?: GPUBufferTarget,
|
20
|
-
|
21
|
-
type?: GPUBufferType,
|
22
17
|
/**
|
23
|
-
*
|
18
|
+
* 数据长度,如果提供了data,忽略此参数
|
24
19
|
*/
|
25
|
-
|
20
|
+
byteLength?: number,
|
26
21
|
|
27
22
|
data?: TypedArray,
|
28
23
|
|
24
|
+
/**
|
25
|
+
* GL需要设置,Vulkan和Metal此属性忽略
|
26
|
+
*/
|
27
|
+
target?: GPUBufferTarget,
|
28
|
+
|
29
|
+
/**
|
30
|
+
* GL需要设置,Vulkan和Metal此属性忽略
|
31
|
+
*/
|
29
32
|
usage?: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'],
|
30
33
|
}
|
31
34
|
|
@@ -41,23 +44,15 @@ export declare class GPUBuffer implements IGPUResource {
|
|
41
44
|
|
42
45
|
readonly level: number;
|
43
46
|
|
44
|
-
readonly target: GPUBufferTarget;
|
45
|
-
|
46
|
-
readonly type: GPUBufferOptions['type'];
|
47
|
-
|
48
47
|
readonly byteLength: number;
|
49
48
|
|
50
|
-
readonly
|
49
|
+
readonly target: GPUBufferTarget;
|
51
50
|
|
52
|
-
|
51
|
+
readonly usage?: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'];
|
53
52
|
|
54
53
|
constructor (options: GPUBufferOptions, renderer?: IGPURenderer);
|
55
54
|
|
56
|
-
|
57
|
-
* 数据元素的总量
|
58
|
-
*/
|
59
|
-
readonly elementCount: number;
|
60
|
-
|
55
|
+
getElementCount (bytePerElement: number): number;
|
61
56
|
/**
|
62
57
|
* 根据TypedArray容量,重新分配Buffer内存
|
63
58
|
* @param typedArray
|
@@ -81,5 +76,7 @@ export declare class GPUBuffer implements IGPUResource {
|
|
81
76
|
readSubData (elementOffset: number, typedArray: TypedArray, elementCount?: number): boolean;
|
82
77
|
|
83
78
|
assignRenderer (renderer: GPURenderer): GPUBuffer;
|
79
|
+
|
80
|
+
destroy (): void;
|
84
81
|
}
|
85
82
|
|
package/types/Geometry.ts
CHANGED
@@ -81,7 +81,7 @@ export interface GeometryOptions {
|
|
81
81
|
|
82
82
|
attributes: { [key: string]: Attribute },
|
83
83
|
|
84
|
-
index?: { data:
|
84
|
+
index?: { data: GeometryIndexData, releasable?: boolean },
|
85
85
|
|
86
86
|
mode?: GeometryDrawMode,
|
87
87
|
|
@@ -92,6 +92,11 @@ export interface GeometryOptions {
|
|
92
92
|
bufferUsage?: GLenum,
|
93
93
|
}
|
94
94
|
|
95
|
+
/**
|
96
|
+
* 不兼容Uint8的Index,只能使用Uin16和Uin32
|
97
|
+
*/
|
98
|
+
export type GeometryIndexData = Uint16Array | Uint32Array;
|
99
|
+
|
95
100
|
export declare class Geometry implements IGPUResource {
|
96
101
|
|
97
102
|
readonly renderer?: IGPURenderer;
|
@@ -105,6 +110,8 @@ export declare class Geometry implements IGPUResource {
|
|
105
110
|
|
106
111
|
readonly options?: Immutable<GeometryOptions>;
|
107
112
|
|
113
|
+
indexDataType?: WebGLRenderingContext['UNSIGNED_INT'] | WebGLRenderingContext['UNSIGNED_SHORT'];
|
114
|
+
|
108
115
|
drawStart: number;
|
109
116
|
|
110
117
|
drawCount: number;
|
@@ -133,9 +140,9 @@ export declare class Geometry implements IGPUResource {
|
|
133
140
|
|
134
141
|
setAttributeSubData (name: string, offset: number, data: TypedArray): void;
|
135
142
|
|
136
|
-
getIndexData ():
|
143
|
+
getIndexData (): GeometryIndexData | undefined;
|
137
144
|
|
138
|
-
setIndexData (data:
|
145
|
+
setIndexData (data: GeometryIndexData | undefined,): void;
|
139
146
|
|
140
147
|
setIndexSubData (offset: number, data: TypedArray): void;
|
141
148
|
|
@@ -167,7 +174,7 @@ export interface SharedGeometryOptions {
|
|
167
174
|
|
168
175
|
mode?: number,
|
169
176
|
|
170
|
-
index?: { data:
|
177
|
+
index?: { data: GeometryIndexData, releasable?: boolean },
|
171
178
|
|
172
179
|
geometry: Geometry,
|
173
180
|
}
|
package/types/Material.ts
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
import type { Texture } from './Texture';
|
2
1
|
import type { ShaderUseCacheId, ShaderWithSource } from './ShaderLibrary';
|
3
2
|
import type { IGPUResource, IGPURenderer } from './IGPURenderer';
|
4
3
|
import type { Immutable, TypedArray } from './type';
|
5
4
|
import type { GPURenderer } from './Renderer';
|
6
5
|
import type { DestroyOptions } from './constants';
|
6
|
+
import type { Texture } from './Texture';
|
7
7
|
|
8
8
|
export type UniformSemantic =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
| 'VIEW'
|
10
|
+
| 'MODEL'
|
11
|
+
| 'MODELVIEW'
|
12
|
+
| 'PROJECTION'
|
13
|
+
| 'VIEWPROJECTION'
|
14
|
+
| 'MODELVIEWPROJECTION'
|
15
|
+
| string;
|
16
16
|
|
17
17
|
export interface MaterialRenderStates {
|
18
18
|
sampleAlphaToCoverage?: boolean,
|
@@ -24,13 +24,13 @@ export interface MaterialRenderStates {
|
|
24
24
|
blendSrc?: number,
|
25
25
|
blendDst?: number,
|
26
26
|
/**
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
* The blend color is a state value,
|
28
|
+
* like the blend equations and blend parameters. Therefore,
|
29
|
+
* it cannot change within a single draw call;
|
30
|
+
* fragment shaders cannot write to, modify,
|
31
|
+
* or even access the blend color.
|
32
|
+
* All buffers share the same blend color.
|
33
|
+
*/
|
34
34
|
blendColor?: [r: number, g: number, b: number, a: number],
|
35
35
|
colorMask?: [r: boolean, g: boolean, b: boolean, a: boolean],
|
36
36
|
depthTest?: boolean,
|
@@ -63,8 +63,6 @@ export interface MaterialOptions {
|
|
63
63
|
shader: ShaderWithSource | ShaderUseCacheId,
|
64
64
|
name?: string,
|
65
65
|
dataBlocks?: MaterialDataBlockOptions[],
|
66
|
-
uniformSemantics?: { [key: string]: UniformSemantic },
|
67
|
-
uniformValues?: { [key: string]: UniformValue },
|
68
66
|
}
|
69
67
|
|
70
68
|
//使用shader即时编译,此参数会调用 shaderLibrary.addShader() 为 Material提供shaderCacheId属性值,
|
@@ -97,12 +95,12 @@ export interface MaterialOptions {
|
|
97
95
|
* });
|
98
96
|
* mtl2 use the same program with mtl0
|
99
97
|
*/
|
100
|
-
export type UniformValueDataType = TypedArray | number | number[] |
|
98
|
+
export type UniformValueDataType = TypedArray | number | number[] | number[][];
|
101
99
|
// 支持结构体Uniform数据
|
102
100
|
export type UniformValue =
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
UniformValueDataType
|
102
|
+
| UniformStruct
|
103
|
+
| UniformStruct[];
|
106
104
|
|
107
105
|
export type UniformStruct = { [key: string]: UniformValueDataType };
|
108
106
|
|
@@ -137,14 +135,14 @@ export declare class Material implements IGPUResource {
|
|
137
135
|
|
138
136
|
destroy (options?: MaterialDestroyOptions): void;
|
139
137
|
|
140
|
-
setUniformSemantic (uniformName: string, semantic: string | undefined): void;
|
141
|
-
|
142
138
|
assignRenderer (renderer: GPURenderer): Material;
|
143
139
|
}
|
144
140
|
|
145
141
|
export interface MaterialDataBlockOptions {
|
146
142
|
uniformValues?: { [key: string]: UniformValue },
|
143
|
+
uniformTextures?: Record<string, Texture | Texture[]>,
|
147
144
|
name?: string,
|
145
|
+
uniformSemantics?: { [key: string]: UniformSemantic },
|
148
146
|
}
|
149
147
|
|
150
148
|
export interface MaterialDataBlockDestroyOptions {
|
@@ -159,10 +157,14 @@ export declare class MaterialDataBlock implements IGPUResource {
|
|
159
157
|
|
160
158
|
readonly name: string;
|
161
159
|
|
160
|
+
readonly uniformSemantics?: { [key: string]: UniformSemantic };
|
161
|
+
|
162
162
|
constructor (options: MaterialDataBlockOptions);
|
163
163
|
|
164
164
|
hasUniformValue (name: string): boolean;
|
165
165
|
|
166
|
+
setUniformSemantic (name: string, semantic: string | undefined): void;
|
167
|
+
|
166
168
|
setUniformValue (name: string, value: UniformValue): boolean;
|
167
169
|
|
168
170
|
getUniformValue (name: string): UniformValue;
|
@@ -171,15 +173,19 @@ export declare class MaterialDataBlock implements IGPUResource {
|
|
171
173
|
|
172
174
|
setUniformValues (map: { [key: string]: UniformValue }): void;
|
173
175
|
|
176
|
+
setUniformTexture (uniformName: string, texture: Texture | Texture[] | undefined): void;
|
177
|
+
|
178
|
+
getUniformTexture<T extends Texture[] | Texture = Texture>(uniformName: string): T | undefined;
|
179
|
+
|
174
180
|
/**
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
181
|
+
* indicate uniform data should be resent to GPU, but not the full range,
|
182
|
+
* only works for ubo,if not an ubo, this method has no side effect
|
183
|
+
* offset and count are counted by typed entry, not the number elements
|
184
|
+
* entry means matrix or vector in shader
|
185
|
+
* @param name uniform name
|
186
|
+
* @param offset entry offset,first entry to send to gpu, default 0
|
187
|
+
* @param count entry count,entry count to send to gpu,default to end
|
188
|
+
*/
|
183
189
|
updateUniformSubData (name: string, offset: number, count: number): void;
|
184
190
|
|
185
191
|
destroy (options?: MaterialDataBlockDestroyOptions): void;
|
package/types/RenderFrame.ts
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
import type { UniformValue } from './Material';
|
2
1
|
import type {
|
3
2
|
RenderPass,
|
4
3
|
RenderPassLoadAction,
|
5
|
-
RenderPassDestroyOptions, SemanticMap,
|
4
|
+
RenderPassDestroyOptions, SemanticMap, SemanticGetter,
|
6
5
|
} from './RenderPass';
|
7
6
|
import type { Mesh } from './Mesh';
|
8
|
-
import type { GPUBuffer } from './GPUBuffer';
|
9
7
|
import type { vec4 } from './type';
|
10
8
|
import type { GPURenderer } from './index';
|
11
9
|
import type { IGPURenderer, IGPUResource } from './IGPURenderer';
|
@@ -21,12 +19,12 @@ export interface RenderState {
|
|
21
19
|
export interface RenderFrameOptions {
|
22
20
|
renderPasses?: RenderPass[],
|
23
21
|
viewport?: vec4,
|
24
|
-
semantics?: { [key: string]:
|
22
|
+
semantics?: { [key: string]: SemanticGetter },
|
25
23
|
loadAction?: RenderPassLoadAction,
|
26
24
|
name?: string,
|
27
25
|
}
|
28
26
|
|
29
|
-
export type SemanticFunc = (state: RenderState) =>
|
27
|
+
export type SemanticFunc = (state: RenderState) => SemanticGetter | null | undefined;
|
30
28
|
|
31
29
|
export type RenderFrameDestroyOptions = {
|
32
30
|
passes?: RenderPassDestroyOptions | DestroyOptions.keep,
|
package/types/RenderPass.ts
CHANGED
@@ -117,7 +117,7 @@ export interface RenderPassAttachmentOptions {
|
|
117
117
|
multiSample?: number,
|
118
118
|
}
|
119
119
|
|
120
|
-
export type SemanticGetter = UniformValue | SemanticFunc | GPUBuffer;
|
120
|
+
export type SemanticGetter = UniformValue | SemanticFunc | GPUBuffer | Texture | Texture[];
|
121
121
|
|
122
122
|
export interface RenderPassOptions extends RenderPassAttachmentOptions {
|
123
123
|
name?: string,
|
@@ -163,7 +163,7 @@ export interface RenderPassDelegate {
|
|
163
163
|
willBeginRenderPass?: (renderPass: RenderPass, state: RenderState) => void,
|
164
164
|
didEndRenderPass?: (renderPass: RenderPass, state: RenderState) => void,
|
165
165
|
willRenderMesh?: (mesh: Mesh, state: RenderState) => void,
|
166
|
-
|
166
|
+
didRenderMesh?: (mesh: Mesh, state: RenderState) => void,
|
167
167
|
}
|
168
168
|
|
169
169
|
export declare class RenderPass implements IGPUResource {
|
package/types/Renderer.ts
CHANGED
@@ -23,13 +23,12 @@ export interface RendererExtensions {
|
|
23
23
|
copyTexture?: (source: Texture, tex: Texture) => void,
|
24
24
|
resetColorAttachments?: (rp: RenderPass, colorAttachments: Texture[]) => void,
|
25
25
|
}
|
26
|
-
|
27
26
|
export declare class GPURenderer implements IGPURenderer {
|
28
27
|
readonly height: number;
|
29
28
|
readonly width: number;
|
30
29
|
/**
|
31
|
-
|
32
|
-
|
30
|
+
* if webgl not support, gpu.level will be 0
|
31
|
+
*/
|
33
32
|
readonly shaderLibrary: ShaderLibrary;
|
34
33
|
readonly gpu: GPUCapability;
|
35
34
|
readonly canvas: Canvas;
|
@@ -44,19 +43,31 @@ export declare class GPURenderer implements IGPURenderer {
|
|
44
43
|
createBuffer (options: GPUBufferOptions): GPUBuffer;
|
45
44
|
|
46
45
|
/**
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
46
|
+
* 根据不同平台封装实现 requestAnimationFrame,
|
47
|
+
* FrameRequestCallback函数回调中进行渲染数据更新,
|
48
|
+
* OpenGL/WebGL在绘制开始之前(传递此帧数据)
|
49
|
+
* Metal在commandBuffer提交后(传递下一帧数据)
|
50
|
+
* @param cb
|
51
|
+
*/
|
52
|
+
requestAnimationFrame (cb: FrameRequestCallback): number;
|
53
|
+
|
54
|
+
//todo
|
55
|
+
cancelAnimationFrame (id: number): void;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* only resize when width or height is different from now,
|
59
|
+
* when resized,all full-screen renderPasses attached to this renderer should be resized as well
|
60
|
+
* 只有当宽高不同的时候,才实际进行函数
|
61
|
+
* 当重新调整宽高后,这个renderer创建的renderPasses,如果没有被指定 viewport(全屏),那么需要resize 所有的renderPass
|
62
|
+
* @param width
|
63
|
+
* @param height
|
64
|
+
*/
|
54
65
|
resize (width: number, height: number): void;
|
55
66
|
|
56
67
|
/**
|
57
|
-
|
58
|
-
|
59
|
-
|
68
|
+
* destroy all resources created by this renderer
|
69
|
+
* @param haltGL if true, this method will call webgl lose context extension which leads webgl absolutely halt
|
70
|
+
*/
|
60
71
|
destroy (haltGL?: boolean): void;
|
61
72
|
|
62
73
|
}
|
package/types/ShaderLibrary.ts
CHANGED
@@ -2,7 +2,7 @@ export type Shader = ShaderWithSource | ShaderUseCacheId;
|
|
2
2
|
export type ShaderWithSource = InstancedShaderWithSource | SharedShaderWithSource;
|
3
3
|
|
4
4
|
export interface MetaShaderSpec {
|
5
|
-
mtlBinary?: ArrayBuffer,
|
5
|
+
mtlBinary?: ArrayBuffer | string,
|
6
6
|
mtlSource?: string,
|
7
7
|
|
8
8
|
mtlVertex?: string,
|
@@ -72,9 +72,9 @@ export interface ShaderLibrary {
|
|
72
72
|
getShaderResult(cacheId: string): ShaderCompileResult | undefined,
|
73
73
|
|
74
74
|
/**
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
* 添加shader
|
76
|
+
* @param shader
|
77
|
+
*/
|
78
78
|
addShader(shader: Shader): string,
|
79
79
|
|
80
80
|
/**
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ResourceInternal } from './ResourceInternal';
|
2
2
|
import type { TypedArray } from '../type';
|
3
|
+
import type { TextureInternal } from './TextureInternal';
|
3
4
|
|
4
5
|
export interface DataBlockInternalOptions {
|
5
6
|
name: string,
|
@@ -32,4 +33,8 @@ export abstract class DataBlockInternal implements ResourceInternal {
|
|
32
33
|
*/
|
33
34
|
abstract getUniformValue (name: string, value: TypedArray): boolean;
|
34
35
|
|
36
|
+
abstract setUniformTextures (uniformName: string, texture: TextureInternal[] | undefined): void;
|
37
|
+
|
38
|
+
abstract getUniformTextures (uniformName: string): TextureInternal[] | undefined;
|
39
|
+
|
35
40
|
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import type { ResourceInternal } from './ResourceInternal';
|
2
2
|
import type { TypedArray } from '../type';
|
3
|
-
|
4
|
-
export const GPUBufferOptionsMemoryShared = 1 << 1;
|
3
|
+
import type { GPUBufferOptionsMemoryShared } from '../GPUBuffer';
|
5
4
|
|
6
5
|
export interface GPUBufferInternalOptions {
|
7
6
|
data?: TypedArray,
|
@@ -1,7 +1,6 @@
|
|
1
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';
|
5
4
|
export interface MaterialInternalOptions {
|
6
5
|
states: MaterialRenderStates,
|
7
6
|
dataBlocks: DataBlockInternal[],
|
@@ -18,14 +17,4 @@ export abstract class MaterialInternal implements ResourceInternal {
|
|
18
17
|
protected constructor (options: MaterialInternalOptions) {
|
19
18
|
}
|
20
19
|
abstract destroy (): void;
|
21
|
-
|
22
|
-
/**
|
23
|
-
* 对于 uniform sampler2D uTex
|
24
|
-
* 和 uniform sampler2D uTextures[4] 都使用此函数
|
25
|
-
* @param name
|
26
|
-
* @param value
|
27
|
-
*/
|
28
|
-
abstract setUniformTextures (name: string, value: TextureInternal[]): void;
|
29
|
-
|
30
|
-
abstract getUniformTextures (name: string): TextureInternal[];
|
31
20
|
}
|
@@ -19,16 +19,12 @@ export abstract class RenderFrameInternal implements ResourceInternal {
|
|
19
19
|
protected constructor (options: RenderFrameInternalOptions) {
|
20
20
|
}
|
21
21
|
abstract destroy (): void;
|
22
|
-
/**
|
23
|
-
* warp层完成所有数据传输后,通知客户端,可以进行实际渲染,
|
24
|
-
* 实际渲染根据客户端时机进行,在调用end()之前,客户端会根据实际刷新进行绘制
|
25
|
-
*/
|
26
|
-
abstract begin (): void;
|
27
22
|
|
28
23
|
/**
|
29
|
-
*
|
24
|
+
* 代表此帧会在渲染队列的下一帧被渲染,调用此函数,也会调用renderer.invalid方法
|
25
|
+
* 由于渲染是异步的,此函数在Metal/Vulkan实现中,并不会直接绘制
|
30
26
|
*/
|
31
|
-
abstract
|
27
|
+
abstract render (): void;
|
32
28
|
|
33
29
|
abstract updateLoadAction (action: RenderPassLoadAction): void;
|
34
30
|
}
|
@@ -35,6 +35,11 @@ export abstract class RendererInternal implements ResourceInternal {
|
|
35
35
|
|
36
36
|
abstract destroy (): void;
|
37
37
|
|
38
|
+
/**
|
39
|
+
* 需要进行重新渲染
|
40
|
+
*/
|
41
|
+
abstract invalid (): void;
|
42
|
+
|
38
43
|
abstract createBuffer (options: GPUBufferInternalOptions): GPUBufferInternal;
|
39
44
|
|
40
45
|
abstract createGeometry (options: GeometryInternalOptions): GeometryInternal;
|
@@ -57,6 +62,14 @@ export abstract class RendererInternal implements ResourceInternal {
|
|
57
62
|
|
58
63
|
abstract cancelAnimationFrame (id: number): void;
|
59
64
|
|
65
|
+
/**
|
66
|
+
* 获取错误信息,目前支持最大获取5条,
|
67
|
+
* 每次调用此函数后,清空错误队列
|
68
|
+
*/
|
69
|
+
abstract getErrors (): string[];
|
70
|
+
|
71
|
+
abstract resize (width: number, height: number): void;
|
72
|
+
|
60
73
|
abstract createImageBitmap (
|
61
74
|
data: ArrayBuffer | string, //图片文件的数据
|
62
75
|
options: ImageBitmapConstructor,
|
@@ -5,6 +5,7 @@ import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
|
5
5
|
|
6
6
|
export interface TextureInternalOptions extends TextureFormatOptions, Omit<TextureConfigOptionsBase, 'keepImageSource'> {
|
7
7
|
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'] | WebGLRenderingContext['TEXTURE_2D'],
|
8
|
+
generateMipmap?: boolean,
|
8
9
|
}
|
9
10
|
|
10
11
|
export interface TextureInternalConstructOptions extends TextureInternalOptions {
|