@predy-js/render-interface 0.1.30-beta.5 → 0.1.30

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.30-beta.5
5
+ * Version: v0.1.30
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -1,15 +1,11 @@
1
1
  import type { AttributeWithType, GeometryOptions } from '../Geometry';
2
2
  import type { ResourceInternal, ResourcePlatform } from './ResourceInternal';
3
- import type { AttributeBase } from '../Geometry';
4
3
  import type { GPUBufferInternal } from './GPUBufferInternal';
5
- interface AttributeWithBuffer extends AttributeBase {
6
- buffer: GPUBufferInternal;
7
- }
8
- export interface GeometryInternalOptions extends Omit<GeometryOptions, 'attributes'> {
9
- attributes: {
10
- attr: AttributeWithBuffer | AttributeWithType;
11
- name: string;
12
- }[];
4
+ export interface GeometryInternalOptions extends Omit<GeometryOptions, 'attributes' | 'index'> {
5
+ attributes: AttributeWithType[];
6
+ buffers: Record<string, GPUBufferInternal>;
7
+ index?: GPUBufferInternal;
8
+ indexType?: IndexBufferType;
13
9
  }
14
10
  export type IndexBufferType = WebGLRenderingContext['UNSIGNED_SHORT'] | WebGLRenderingContext['UNSIGNED_INT'];
15
11
  /**
@@ -18,13 +14,23 @@ export type IndexBufferType = WebGLRenderingContext['UNSIGNED_SHORT'] | WebGLRen
18
14
  export declare abstract class GeometryInternal implements ResourceInternal {
19
15
  readonly isDestroyed: boolean;
20
16
  readonly platform: ResourcePlatform;
17
+ name: string;
21
18
  drawStart: number;
22
19
  drawCount: number;
23
20
  mode: GLenum;
24
21
  protected constructor(options: GeometryInternalOptions);
25
22
  abstract setAttributeBuffer(name: string, buffer: GPUBufferInternal | undefined): void;
26
23
  abstract getAttributeBuffer(name: string): GPUBufferInternal | undefined;
27
- abstract setIndexBuffer(buffer: GPUBufferInternal | undefined, bufferType: IndexBufferType): void;
24
+ abstract getIndexBuffer(): [buffer: GPUBufferInternal | undefined, type: number];
25
+ /**
26
+ * 获得当前所有的attributeBuffer
27
+ */
28
+ abstract getAttributeBufferMap(): Record<string, GPUBufferInternal>;
29
+ abstract setIndexBuffer(buffer: GPUBufferInternal | undefined, bufferType?: IndexBufferType): void;
30
+ /**
31
+ * 并不会销毁attributeBuffers和IndexBuffer,
32
+ * 但会清除内部buffer的引用,如果需要销毁buffers,
33
+ * 调用destroy之前,需要手动调用 getAttributeBufferMap 和 getIndexBuffer 将获得的buffer显式销毁
34
+ */
28
35
  abstract destroy(): void;
29
36
  }
30
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.1.30-beta.5",
3
+ "version": "0.1.30",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",