@thatopen/components 2.0.0-alpha.5 → 2.0.0-alpha.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/core/Cullers/src/culler-renderer.d.ts +3 -2
- package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +1 -0
- package/dist/core/Types/src/async-event.d.ts +34 -0
- package/dist/core/Types/src/index.d.ts +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +150 -114
- package/dist/namespace.d.ts +789 -753
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import { Components } from "../../Components";
|
|
3
|
-
import { Event, World } from "../../Types";
|
|
3
|
+
import { AsyncEvent, Event, World } from "../../Types";
|
|
4
4
|
export interface CullerRendererSettings {
|
|
5
5
|
updateInterval?: number;
|
|
6
6
|
width?: number;
|
|
@@ -18,7 +18,7 @@ export declare class CullerRenderer {
|
|
|
18
18
|
* meshes that are currently visible, and the ones that were visible
|
|
19
19
|
* just before but not anymore.
|
|
20
20
|
*/
|
|
21
|
-
readonly onViewUpdated: Event<any>;
|
|
21
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
22
22
|
/** {@link Component.enabled} */
|
|
23
23
|
enabled: boolean;
|
|
24
24
|
/**
|
|
@@ -44,6 +44,7 @@ export declare class CullerRenderer {
|
|
|
44
44
|
private readonly renderTarget;
|
|
45
45
|
private readonly bufferSize;
|
|
46
46
|
private readonly _buffer;
|
|
47
|
+
protected _isWorkerBusy: boolean;
|
|
47
48
|
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
48
49
|
/** {@link Disposable.dispose} */
|
|
49
50
|
dispose(): void;
|
|
@@ -17,6 +17,7 @@ export declare class MeshCullerRenderer extends CullerRenderer {
|
|
|
17
17
|
private _meshIDColorCodeMap;
|
|
18
18
|
private _currentVisibleMeshes;
|
|
19
19
|
private _recentlyHiddenMeshes;
|
|
20
|
+
private _intervalID;
|
|
20
21
|
private readonly _transparentMat;
|
|
21
22
|
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
22
23
|
dispose(): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple event handler by
|
|
3
|
+
* [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
|
|
4
|
+
* Keep in mind that:
|
|
5
|
+
* - If you want to remove it later, you might want to declare the callback as
|
|
6
|
+
* an object.
|
|
7
|
+
* - If you want to maintain the reference to `this`, you will need to declare
|
|
8
|
+
* the callback as an arrow function.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AsyncEvent<T> {
|
|
11
|
+
/**
|
|
12
|
+
* Add a callback to this event instance.
|
|
13
|
+
* @param handler - the callback to be added to this event.
|
|
14
|
+
*/
|
|
15
|
+
add(handler: T extends void ? {
|
|
16
|
+
(): Promise<void>;
|
|
17
|
+
} : {
|
|
18
|
+
(data: T): Promise<void>;
|
|
19
|
+
}): void;
|
|
20
|
+
/**
|
|
21
|
+
* Removes a callback from this event instance.
|
|
22
|
+
* @param handler - the callback to be removed from this event.
|
|
23
|
+
*/
|
|
24
|
+
remove(handler: T extends void ? {
|
|
25
|
+
(): Promise<void>;
|
|
26
|
+
} : {
|
|
27
|
+
(data: T): Promise<void>;
|
|
28
|
+
}): void;
|
|
29
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
30
|
+
trigger: (data?: T) => Promise<void>;
|
|
31
|
+
/** Gets rid of all the suscribed events. */
|
|
32
|
+
reset(): void;
|
|
33
|
+
private handlers;
|
|
34
|
+
}
|