@@ -61,24 +61,35 @@ class GSplatComponentSystem extends ComponentSystem {
6161 /**
6262 * Fired every frame for each camera and layer combination rendering GSplats in unified mode.
6363 * The handler is passed the {@link CameraComponent}, the {@link Layer}, a boolean indicating
64- * if the current frame has up-to-date sorting, and a boolean indicating if resources are loading.
64+ * if the current frame has up-to-date sorting, and a number indicating how many resources are
65+ * loading.
6566 *
6667 * The `ready` parameter indicates whether the current frame reflects all recent changes (camera
67- * movement, splat transforms, lod updates, etc.) with the latest sorting applied. The `loading `
68- * parameter indicates if octree LOD resources are still being loaded .
68+ * movement, splat transforms, lod updates, etc.) with the latest sorting applied. The `loadingCount `
69+ * parameter reports the total number of octree LOD resources currently loading or queued to load .
6970 *
7071 * This event is useful for video capture or other workflows that need to wait for frames
7172 * to be fully ready. Only capture frames and move camera to next position when both
72- * `ready === true` and `loading === false`.
73+ * `ready === true` and `loadingCount === 0`. Note that `loadingCount` can be used as a boolean
74+ * in conditionals (0 is falsy, non-zero is truthy) for backward compatibility.
7375 *
7476 * @event
7577 * @example
76- * app.systems.gsplat.on('frame:ready', (camera, layer, ready, loading) => {
77- * if (ready && !loading) {
78+ * // Wait for frame to be ready before capturing
79+ * app.systems.gsplat.on('frame:ready', (camera, layer, ready, loadingCount) => {
80+ * if (ready && !loadingCount) {
7881 * console.log(`Frame ready to capture for camera ${camera.entity.name}`);
7982 * // Capture frame here
8083 * }
8184 * });
85+ * @example
86+ * // Track loading progress (0..1)
87+ * let maxLoadingCount = 0;
88+ * app.systems.gsplat.on('frame:ready', (camera, layer, ready, loadingCount) => {
89+ * maxLoadingCount = Math.max(maxLoadingCount, loadingCount);
90+ * const progress = maxLoadingCount > 0 ? (maxLoadingCount - loadingCount) / maxLoadingCount : 1;
91+ * console.log(`Loading progress: ${(progress * 100).toFixed(1)}%`);
92+ * });
8293 */
8394 static EVENT_FRAMEREADY = 'frame:ready' ;
8495
0 commit comments