@predy-js/render-interface 0.3.0-beta.1 → 0.3.0-beta.100

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ export declare class MarsTextureFactory implements TextureFactory {
5
5
  [key: string]: Promise<Texture>;
6
6
  };
7
7
  constructor();
8
- loadMipmapImagesAsync(pointers: vec2[], bin: ArrayBuffer): Promise<(HTMLImageElement | ImageBitmap)[]>;
8
+ loadMipmapImagesAsync(pointers: vec2[], bin: ArrayBuffer): Promise<(ImageBitmap | HTMLImageElement)[]>;
9
9
  loadImageAsync(url: string | HTMLImageElement | Blob): Promise<HTMLImageElement | ImageBitmap>;
10
10
  requestBinaryAsync(url: string): Promise<ArrayBuffer>;
11
11
  loadImageBinaryAsync(binary: ArrayBuffer | TypedArray | Blob, mime?: string): Promise<HTMLImageElement | ImageBitmap>;
@@ -36,7 +36,7 @@ export declare class GLProgram {
36
36
  constructor(renderer: GLGPURenderer, program: WebGLProgram, shared: boolean, id: string);
37
37
  init(renderer: GLGPURenderer, program: WebGLProgram): void;
38
38
  bind(): void;
39
- getSemanticValue(state: RenderState, semanticName: string): UniformValue | import("../../types").GPUBuffer | null | undefined;
39
+ getSemanticValue(state: RenderState, semanticName: string): import("../../types").GPUBuffer | UniformValue | null | undefined;
40
40
  setupUniforms(state: RenderState): void;
41
41
  setGLUniformValue(name: string, value: any, info: ProgramUniformInfo, gl: WebGL2RenderingContext | WebGLRenderingContext): void;
42
42
  setupAttributes(geometry: GLGeometry): GLVertexArrayObject;
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.3.0-beta.1
5
+ * Version: v0.3.0-beta.100
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -1,7 +1,5 @@
1
- import type { RenderFrame, RenderFrameOptions } from './RenderFrame';
2
1
  import type { ShaderLibrary } from './ShaderLibrary';
3
2
  import type { GPUCapability } from './GPUCapability';
4
- import type { GPUBuffer, GPUBufferOptions } from './GPUBuffer';
5
3
  import type { IGPURenderer } from './IGPURenderer';
6
4
  import type { Canvas } from './Canvas';
7
5
  import type { Texture } from './Texture';
@@ -34,8 +32,6 @@ export declare class GPURenderer implements IGPURenderer {
34
32
  readonly extension: RendererExtensions;
35
33
  readonly isDestroyed: boolean;
36
34
  constructor(options: RendererOptions);
37
- createRenderFrame(options?: RenderFrameOptions): RenderFrame;
38
- createBuffer(options: GPUBufferOptions): GPUBuffer;
39
35
  /**
40
36
  * 根据不同平台封装实现 requestAnimationFrame,
41
37
  * FrameRequestCallback函数回调中进行渲染数据更新,
@@ -4,6 +4,12 @@ import type { TextureInternal } from './TextureInternal';
4
4
  export interface DataBlockInternalOptions {
5
5
  name: string;
6
6
  }
7
+ /**
8
+ * struct uniform的数据结构
9
+ */
10
+ export interface NativeUniformStruct {
11
+ [key: string]: TypedArray;
12
+ }
7
13
  export declare abstract class DataBlockInternal implements ResourceInternal {
8
14
  readonly isDestroyed: boolean;
9
15
  /**
@@ -27,6 +33,15 @@ export declare abstract class DataBlockInternal implements ResourceInternal {
27
33
  * @param value
28
34
  */
29
35
  abstract getUniformValue(name: string, value: TypedArray): boolean;
36
+ /**
37
+ * 设置uniform的结构体数据,对于数据进行深拷贝,修改原始数据,不会影响已经传入的数据,
38
+ * 如果要修改数据,必须重新调用setUniformStructValues
39
+ */
40
+ abstract setUniformStructValues(name: string, values: NativeUniformStruct[]): boolean;
41
+ /**
42
+ * 获取uniform的结构体数据,获取的数据进行深拷贝,传入的数据将
43
+ */
44
+ abstract getUniformStructValue(name: string, idx: number): Record<string, ArrayBuffer> | undefined;
30
45
  abstract setUniformTextures(uniformName: string, texture: TextureInternal[] | undefined): void;
31
46
  abstract getUniformTextures(uniformName: string): TextureInternal[] | undefined;
32
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.3.0-beta.1",
3
+ "version": "0.3.0-beta.100",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
package/types/Renderer.ts CHANGED
@@ -1,7 +1,5 @@
1
- import type { RenderFrame, RenderFrameOptions } from './RenderFrame';
2
1
  import type { ShaderLibrary } from './ShaderLibrary';
3
2
  import type { GPUCapability } from './GPUCapability';
4
- import type { GPUBuffer, GPUBufferOptions } from './GPUBuffer';
5
3
  import type { IGPURenderer } from './IGPURenderer';
6
4
  import type { Canvas } from './Canvas';
7
5
  import type { Texture } from './Texture';
@@ -40,10 +38,6 @@ export declare class GPURenderer implements IGPURenderer {
40
38
 
41
39
  constructor (options: RendererOptions);
42
40
 
43
- createRenderFrame (options?: RenderFrameOptions): RenderFrame;
44
-
45
- createBuffer (options: GPUBufferOptions): GPUBuffer;
46
-
47
41
  /**
48
42
  * 根据不同平台封装实现 requestAnimationFrame,
49
43
  * FrameRequestCallback函数回调中进行渲染数据更新,
@@ -5,6 +5,12 @@ import type { TextureInternal } from './TextureInternal';
5
5
  export interface DataBlockInternalOptions {
6
6
  name: string,
7
7
  }
8
+
9
+ /**
10
+ * struct uniform的数据结构
11
+ */
12
+ export interface NativeUniformStruct { [key: string]: TypedArray }
13
+
8
14
  export abstract class DataBlockInternal implements ResourceInternal {
9
15
  readonly isDestroyed: boolean;
10
16
  /**
@@ -33,6 +39,17 @@ export abstract class DataBlockInternal implements ResourceInternal {
33
39
  */
34
40
  abstract getUniformValue (name: string, value: TypedArray): boolean;
35
41
 
42
+ /**
43
+ * 设置uniform的结构体数据,对于数据进行深拷贝,修改原始数据,不会影响已经传入的数据,
44
+ * 如果要修改数据,必须重新调用setUniformStructValues
45
+ */
46
+ abstract setUniformStructValues (name: string, values: NativeUniformStruct[]): boolean;
47
+
48
+ /**
49
+ * 获取uniform的结构体数据,获取的数据进行深拷贝,传入的数据将
50
+ */
51
+ abstract getUniformStructValue (name: string, idx: number): Record<string, ArrayBuffer> | undefined;
52
+
36
53
  abstract setUniformTextures (uniformName: string, texture: TextureInternal[] | undefined): void;
37
54
 
38
55
  abstract getUniformTextures (uniformName: string): TextureInternal[] | undefined;