@rings-webgpu/core 1.0.14 → 1.0.16

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.
@@ -0,0 +1,72 @@
1
+ import { Tile } from '../core/Tile';
2
+ /**
3
+ * Priority callback function type
4
+ * Return 1 means a has higher priority, return -1 means b has higher priority, return 0 means equal
5
+ */
6
+ export type PriorityCallback = (a: Tile, b: Tile) => number;
7
+ /**
8
+ * Task callback function type
9
+ */
10
+ export type TaskCallback = (item: Tile) => Promise<void> | void;
11
+ /**
12
+ * Priority queue implementation
13
+ * Used to manage the execution of asynchronous tasks, supports priority sorting and concurrent control
14
+ */
15
+ export declare class PriorityQueue {
16
+ maxJobs: number;
17
+ autoUpdate: boolean;
18
+ priorityCallback: PriorityCallback | null;
19
+ private _items;
20
+ private _callbacks;
21
+ private _currJobs;
22
+ private _scheduled;
23
+ private _schedulingCallback;
24
+ constructor();
25
+ /**
26
+ * Set scheduling callback (can be used to customize scheduling strategy)
27
+ */
28
+ set schedulingCallback(cb: (func: () => void) => void);
29
+ /**
30
+ * Check if there are tasks running or queued
31
+ */
32
+ get running(): boolean;
33
+ /**
34
+ * Sort the queue
35
+ */
36
+ sort(): void;
37
+ /**
38
+ * Check if item is in queue
39
+ */
40
+ has(item: Tile): boolean;
41
+ /**
42
+ * Add task to queue
43
+ */
44
+ add(item: Tile, callback: TaskCallback): Promise<void>;
45
+ /**
46
+ * Remove item from queue
47
+ */
48
+ remove(item: Tile): void;
49
+ /**
50
+ * Remove items by filter
51
+ */
52
+ removeByFilter(filter: (item: Tile) => boolean): void;
53
+ /**
54
+ * Schedule task run
55
+ */
56
+ private _scheduleJobRun;
57
+ /**
58
+ * Try to run tasks
59
+ */
60
+ private _tryRunJobs;
61
+ /**
62
+ * Clear queue
63
+ */
64
+ clear(): void;
65
+ /**
66
+ * Get queue statistics
67
+ */
68
+ getStats(): {
69
+ queued: number;
70
+ running: number;
71
+ };
72
+ }
@@ -0,0 +1,24 @@
1
+ import { Tile } from '../core/Tile';
2
+ /**
3
+ * Pre-order traversal callback function type
4
+ * Return true means early termination of traversal
5
+ */
6
+ export type BeforeCallback = (tile: Tile, parent: Tile | null, depth: number) => boolean | void;
7
+ /**
8
+ * Post-order traversal callback function type
9
+ * Return true means early termination of traversal
10
+ */
11
+ export type AfterCallback = (tile: Tile, parent: Tile | null, depth: number) => boolean | void;
12
+ /**
13
+ * Traverse tile set (depth-first)
14
+ * @param tile Starting tile
15
+ * @param beforeCb Pre-order traversal callback (called before visiting child nodes)
16
+ * @param afterCb Post-order traversal callback (called after visiting child nodes)
17
+ */
18
+ export declare function traverseSet(tile: Tile, beforeCb?: BeforeCallback | null, afterCb?: AfterCallback | null): void;
19
+ /**
20
+ * Traverse ancestors nodes (from current node to root node)
21
+ * @param tile Starting tile
22
+ * @param callback Callback function
23
+ */
24
+ export declare function traverseAncestors(tile: Tile, callback: (tile: Tile, parent: Tile | null, depth: number) => void): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Throttle function
3
+ * Ensure function is executed at most once in the specified time interval
4
+ *
5
+ * @param func The function to throttle
6
+ * @param delay Delay time (milliseconds)
7
+ * @returns The throttled function
8
+ */
9
+ export declare function throttle<T extends (...args: any[]) => any>(func: T, delay: number): (...args: Parameters<T>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rings-webgpu/core",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Rings webgpu Engine",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -1,45 +0,0 @@
1
- export declare class TileSet {
2
- asset: {
3
- generatetool: string;
4
- version: string;
5
- gltfUpAxis?: any;
6
- };
7
- extras: {
8
- scenetree: string;
9
- };
10
- geometricError: number;
11
- properties: any;
12
- refine: any;
13
- root: TileSetRoot;
14
- }
15
- export declare class TileSetRoot {
16
- boundingVolume: {
17
- box: number[];
18
- };
19
- children: TileSetChild[];
20
- geometricError: number;
21
- transform: number[];
22
- }
23
- export declare class TileSetChild {
24
- boundingVolume: {
25
- box: number[];
26
- };
27
- geometricError: number;
28
- refine: string;
29
- content: {
30
- uri: string;
31
- };
32
- contents: TileSetChildContent[];
33
- }
34
- export declare class TileSetChildContent {
35
- uri: string;
36
- group: number;
37
- metadata: TileSetChildContentMetaData;
38
- }
39
- export declare class TileSetChildContentMetaData {
40
- class: string;
41
- properties: {
42
- vertices: number;
43
- materials: number;
44
- };
45
- }