47 lines
4.0 KiB
TypeScript
47 lines
4.0 KiB
TypeScript
import type { SceneSnapshotIR } from "../../../protocol/scene-ir";
|
|
import type { MeshElementMode, MeshGeometryBuffer } from "../../../protocol/web-engine";
|
|
import type { NonMeshGeometryChunk } from "../../../protocol/nonmesh-binary";
|
|
import type { GPUTextureAsset } from "../../../protocol/render-assets";
|
|
import type { PBRLightingBudgetReport, PBRTextureBudgetReport } from "../../../protocol/render-budget";
|
|
import type { NonMeshElementKind } from "./nonmesh";
|
|
import type { GreasePencilPointPreview, GreasePencilPointRef } from "./grease-pencil";
|
|
import type { CurveGizmoFrameIR, CurveGizmoHandleIR, CurveGizmoScreenFrameIR } from "../../../protocol/nonmesh-interaction";
|
|
import type { NanoVDBViewportAssetIR } from "../volume/nanovdb-viewport";
|
|
import type { ViewportCameraState } from "../../../protocol/viewport-camera";
|
|
import type { GreasePencilDrawingScopeIR, GreasePencilMarqueeBoxIR, GreasePencilMarqueeResultIR } from "../../../protocol/grease-pencil-marquee";
|
|
import type { PaintDepthVisibilityRequestIR, PaintDepthVisibilityResultIR } from "../../../protocol/paint-depth-visibility";
|
|
|
|
export type OffscreenViewportRequest =
|
|
| { type: "init"; canvas: OffscreenCanvas; width: number; height: number; pixelRatio: number }
|
|
| { type: "snapshot"; snapshot: SceneSnapshotIR; geometryBuffers: MeshGeometryBuffer[]; nonMeshGeometryBuffers: NonMeshGeometryChunk[] }
|
|
| { type: "textureAssets"; assets: GPUTextureAsset[] }
|
|
| { type: "volumeAssets"; assets: NanoVDBViewportAssetIR[] }
|
|
| { type: "resize"; width: number; height: number; pixelRatio: number }
|
|
| { type: "selection"; objectIds: string[]; elements: Array<{ dataId: string; kind: NonMeshElementKind; index: number }>; greasePencilPoints: GreasePencilPointRef[]; greasePencilSelectionRevision: number }
|
|
| { type: "interaction"; editMode: boolean; selectionMode: MeshElementMode }
|
|
| { type: "curveHandlePreview"; dataId: string; handles: CurveGizmoHandleIR[] | null }
|
|
| { type: "greasePencilPointPreview"; dataId: string; layerId: string; frame: number; points: GreasePencilPointPreview[] | null }
|
|
| { type: "curveGizmoFrame"; dataId: string | null; frame: CurveGizmoFrameIR | null }
|
|
| { type: "orbit"; deltaX: number; deltaY: number; zoom: number }
|
|
| { type: "pick"; x: number; y: number; additive: boolean; baseSelectionRevision: number }
|
|
| { type: "greasePencilMarquee"; drawing: GreasePencilDrawingScopeIR; box: GreasePencilMarqueeBoxIR; baseRevision: number; baseSelectionRevision: number; additive: boolean }
|
|
| { type: "paintDepthVisibility"; requestId: string; request: PaintDepthVisibilityRequestIR }
|
|
| { type: "dispose" };
|
|
|
|
export type OffscreenViewportResponse =
|
|
| { type: "ready" }
|
|
| { type: "deviceStatus"; status: "ready" | "lost" | "restoring" }
|
|
| { type: "frame"; visiblePixels: number; camera?: ViewportCameraState }
|
|
| { type: "snapshotStatus"; nonMeshCount: number; nonMeshBlockedCount: number; greasePencilCount: number; greasePencilBlockedCount: number; greasePencilOnionStrokeCount: number; renderBudget: PBRLightingBudgetReport }
|
|
| { type: "textureStatus"; loaded: number; rejected: number; bytes: number; errors: string[]; errorCodes: string[]; budget: PBRTextureBudgetReport }
|
|
| { type: "volumeStatus"; status: "none" | "loading" | "ready" | "blocked"; count: number; errorCode?: string }
|
|
| { type: "selected"; objectId: string; additive: boolean }
|
|
| { type: "elementSelected"; meshId: string; mode: MeshElementMode; index: number; additive: boolean; nonMeshKind?: NonMeshElementKind }
|
|
| { type: "greasePencilPointSelected"; point: GreasePencilPointRef; additive: boolean; baseSelectionRevision: number }
|
|
| { type: "greasePencilSelectionStatus"; selectionRevision: number; pointIds: string[] }
|
|
| { type: "greasePencilMarqueeSelected"; result: GreasePencilMarqueeResultIR; additive: boolean }
|
|
| { type: "paintDepthVisibilityResult"; requestId: string; result: PaintDepthVisibilityResultIR }
|
|
| { type: "paintDepthVisibilityError"; requestId: string; message: string }
|
|
| { type: "curveGizmoScreenFrame"; frame: CurveGizmoScreenFrameIR | null }
|
|
| { type: "error"; message: string };
|