@predy-js/render-interface 0.1.64-beta.4 → 0.1.64-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/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.64-beta.4
5
+ * Version: v0.1.64-beta.6
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -2,10 +2,6 @@ import type { GPUBuffer } from './GPUBuffer';
2
2
  import type { IGPUResource, IGPURenderer } from './IGPURenderer';
3
3
  import type { Immutable, TypedArray } from './type';
4
4
  import type { GPURenderer } from './Renderer';
5
- export interface GeometryBufferLayout {
6
- index: number;
7
- name: string;
8
- }
9
5
  /**
10
6
  * Attribute binding information,
11
7
  * size:attribute size. the size attribute of vec4|vec3|vec2 is 4|3|2
@@ -65,7 +61,6 @@ export interface GeometryOptions {
65
61
  attributes: {
66
62
  [key: string]: Attribute;
67
63
  };
68
- bufferLayouts?: GeometryBufferLayout[];
69
64
  index?: {
70
65
  data: GeometryIndexData;
71
66
  releasable?: boolean;
@@ -15,4 +15,6 @@ export declare abstract class AndGLContext {
15
15
  * @param param
16
16
  */
17
17
  abstract getParameter_i1(param: GLenum): number;
18
+ abstract getParameter_f4(param: GLenum): [number, number, number, number];
19
+ abstract getParameter_f2(param: GLenum): [number, number];
18
20
  }
@@ -1,9 +1,14 @@
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
+ }
4
8
  export interface GeometryInternalOptions extends Omit<GeometryOptions, 'attributes' | 'index'> {
5
9
  attributes: Record<string, AttributeWithType>;
6
10
  buffers: Record<string, GPUBufferInternal>;
11
+ bufferLayouts: GeometryBufferLayout[];
7
12
  indexBuffer?: GPUBufferInternal;
8
13
  indexBufferType?: IndexBufferType;
9
14
  }
@@ -33,3 +38,4 @@ export declare abstract class GeometryInternal implements ResourceInternal {
33
38
  */
34
39
  abstract destroy(): void;
35
40
  }
41
+ export {};
@@ -13,5 +13,11 @@ export declare abstract class MaterialInternal implements ResourceInternal {
13
13
  readonly shaderCacheId: string;
14
14
  dataBlocks: DataBlockInternal[];
15
15
  protected constructor(options: MaterialInternalOptions);
16
+ /**
17
+ * 将Material的状态设置到GPU
18
+ * 这个方法会在Native端调用, 在RI中不会调用
19
+ * 为了Android 测试,会主动调用设置状态到GPU, IOS 暂不调用
20
+ */
21
+ abstract setupStates(): void;
16
22
  abstract destroy(): void;
17
23
  }
@@ -0,0 +1,9 @@
1
+ import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
2
+ declare abstract class PredyNativeInternal {
3
+ abstract createImageBitmap(data: ArrayBuffer | string, //图片文件的数据
4
+ options: ImageBitmapConstructor, callback: ImageBitmapCallback): void;
5
+ }
6
+ declare global {
7
+ var predyNative: PredyNativeInternal;
8
+ }
9
+ export {};
@@ -0,0 +1,3 @@
1
+ declare abstract class PredyNativeModule {
2
+ static install(): void;
3
+ }
@@ -36,6 +36,9 @@ export declare abstract class RendererInternal implements ResourceInternal {
36
36
  readonly shaderLibrary: ShaderLibraryInternal;
37
37
  readonly width: number;
38
38
  readonly height: number;
39
+ /**
40
+ * 用于Android的GL上下文, 用于测试, 不会在RI中使用
41
+ */
39
42
  readonly gl?: AndGLContext;
40
43
  abstract destroy(): void;
41
44
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.1.64-beta.4",
3
+ "version": "0.1.64-beta.6",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
package/types/Geometry.ts CHANGED
@@ -3,11 +3,6 @@ import type { IGPUResource, IGPURenderer } from './IGPURenderer';
3
3
  import type { Immutable, TypedArray } from './type';
4
4
  import type { GPURenderer } from './Renderer';
5
5
 
6
- export interface GeometryBufferLayout {
7
- index: number,
8
- name: string,
9
- }
10
-
11
6
  /**
12
7
  * Attribute binding information,
13
8
  * size:attribute size. the size attribute of vec4|vec3|vec2 is 4|3|2
@@ -86,8 +81,6 @@ export interface GeometryOptions {
86
81
 
87
82
  attributes: { [key: string]: Attribute },
88
83
 
89
- bufferLayouts?: GeometryBufferLayout[],
90
-
91
84
  index?: { data: GeometryIndexData, releasable?: boolean },
92
85
 
93
86
  mode?: GeometryDrawMode,
@@ -97,7 +90,6 @@ export interface GeometryOptions {
97
90
  drawStart?: number,
98
91
 
99
92
  bufferUsage?: GLenum,
100
-
101
93
  }
102
94
 
103
95
  /**
@@ -19,4 +19,9 @@ export abstract class AndGLContext {
19
19
  * @param param
20
20
  */
21
21
  abstract getParameter_i1 (param: GLenum): number;
22
+
23
+ abstract getParameter_f4 (param: GLenum): [number, number, number, number];
24
+
25
+ abstract getParameter_f2 (param: GLenum): [number, number];
26
+
22
27
  }
@@ -2,9 +2,14 @@ import type { AttributeWithType, GeometryOptions } from '../Geometry';
2
2
  import type { ResourceInternal } from './ResourceInternal';
3
3
  import type { GPUBufferInternal } from './GPUBufferInternal';
4
4
 
5
+ interface GeometryBufferLayout {
6
+ index: number,
7
+ name: string,
8
+ }
5
9
  export interface GeometryInternalOptions extends Omit<GeometryOptions, 'attributes' | 'index'> {
6
10
  attributes: Record<string, AttributeWithType>,
7
11
  buffers: Record<string, GPUBufferInternal>,
12
+ bufferLayouts: GeometryBufferLayout[],
8
13
  indexBuffer?: GPUBufferInternal,
9
14
  indexBufferType?: IndexBufferType,
10
15
  }
@@ -16,5 +16,12 @@ export abstract class MaterialInternal implements ResourceInternal {
16
16
 
17
17
  protected constructor (options: MaterialInternalOptions) {
18
18
  }
19
+
20
+ /**
21
+ * 将Material的状态设置到GPU
22
+ * 这个方法会在Native端调用, 在RI中不会调用
23
+ * 为了Android 测试,会主动调用设置状态到GPU, IOS 暂不调用
24
+ */
25
+ abstract setupStates (): void;
19
26
  abstract destroy (): void;
20
27
  }
@@ -0,0 +1,10 @@
1
+ import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
2
+
3
+ declare abstract class PredyNativeInternal {
4
+ abstract createImageBitmap (data: ArrayBuffer | string, //图片文件的数据
5
+ options: ImageBitmapConstructor, callback: ImageBitmapCallback): void;
6
+ }
7
+ // 给全局global 添加 predyNative: PredyNativeInternal
8
+ declare global {
9
+ var predyNative: PredyNativeInternal;
10
+ }
@@ -0,0 +1,4 @@
1
+
2
+ declare abstract class PredyNativeModule {
3
+ static install (): void;
4
+ }
@@ -42,6 +42,9 @@ export abstract class RendererInternal implements ResourceInternal {
42
42
  readonly shaderLibrary: ShaderLibraryInternal;
43
43
  readonly width: number;
44
44
  readonly height: number;
45
+ /**
46
+ * 用于Android的GL上下文, 用于测试, 不会在RI中使用
47
+ */
45
48
  readonly gl?: AndGLContext;
46
49
 
47
50
  abstract destroy (): void;