mujoco-react 9.1.0 → 9.2.0

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/src/types.ts CHANGED
@@ -1104,6 +1104,9 @@ export interface MujocoSimAPI {
1104
1104
  getCanvasSnapshot(width?: number, height?: number, mimeType?: string): string;
1105
1105
  captureFrame(options?: MujocoFrameCaptureOptions): Promise<FrameCaptureResult>;
1106
1106
  captureFrameBlob(options?: MujocoFrameCaptureOptions): Promise<FrameCaptureBlobResult>;
1107
+ captureCameraFrame(options?: CameraFrameCaptureOptions): Promise<CameraFrameCaptureResult>;
1108
+ captureCameraFrameBlob(options?: CameraFrameCaptureOptions): Promise<CameraFrameCaptureBlobResult>;
1109
+ recordCameraSequence(options: CameraFrameSequenceOptions): Promise<CameraFrameSequenceResult>;
1107
1110
  project2DTo3D(
1108
1111
  x: number,
1109
1112
  y: number,
@@ -1164,6 +1167,93 @@ export interface FrameCaptureAPI {
1164
1167
  reset: () => void;
1165
1168
  }
1166
1169
 
1170
+ export type CameraFrameCaptureVector3 =
1171
+ | THREE.Vector3
1172
+ | readonly [number, number, number];
1173
+
1174
+ export type CameraFrameCaptureQuaternion =
1175
+ | THREE.Quaternion
1176
+ | readonly [number, number, number, number];
1177
+
1178
+ export interface CameraFrameCaptureOptions {
1179
+ camera?: THREE.Camera;
1180
+ position?: CameraFrameCaptureVector3;
1181
+ lookAt?: CameraFrameCaptureVector3;
1182
+ quaternion?: CameraFrameCaptureQuaternion;
1183
+ up?: CameraFrameCaptureVector3;
1184
+ width?: number;
1185
+ height?: number;
1186
+ type?: string;
1187
+ quality?: number;
1188
+ fov?: number;
1189
+ near?: number;
1190
+ far?: number;
1191
+ }
1192
+
1193
+ export interface CameraFrameCaptureResult {
1194
+ canvas: HTMLCanvasElement;
1195
+ camera: THREE.Camera;
1196
+ dataUrl: string;
1197
+ type: string;
1198
+ width: number;
1199
+ height: number;
1200
+ }
1201
+
1202
+ export interface CameraFrameCaptureBlobResult {
1203
+ canvas: HTMLCanvasElement;
1204
+ camera: THREE.Camera;
1205
+ blob: Blob;
1206
+ type: string;
1207
+ width: number;
1208
+ height: number;
1209
+ }
1210
+
1211
+ export interface CameraFrameCaptureAPI {
1212
+ status: FrameCaptureStatus;
1213
+ error: Error | null;
1214
+ isCapturing: boolean;
1215
+ capture: (
1216
+ options?: CameraFrameCaptureOptions
1217
+ ) => Promise<CameraFrameCaptureResult>;
1218
+ captureBlob: (
1219
+ options?: CameraFrameCaptureOptions
1220
+ ) => Promise<CameraFrameCaptureBlobResult>;
1221
+ reset: () => void;
1222
+ }
1223
+
1224
+ export interface CameraFrameSequenceCamera extends CameraFrameCaptureOptions {
1225
+ key: string;
1226
+ }
1227
+
1228
+ export interface CameraFrameSequenceFrame {
1229
+ frameIndex: number;
1230
+ time: number;
1231
+ cameras: Record<string, CameraFrameCaptureResult>;
1232
+ }
1233
+
1234
+ export interface CameraFrameSequenceOptions {
1235
+ cameras: readonly CameraFrameSequenceCamera[];
1236
+ frames: number;
1237
+ stepsPerFrame?: number;
1238
+ reset?: boolean;
1239
+ captureInitialFrame?: boolean;
1240
+ onFrame?: (frame: CameraFrameSequenceFrame) => void | Promise<void>;
1241
+ }
1242
+
1243
+ export interface CameraFrameSequenceResult {
1244
+ frames: CameraFrameSequenceFrame[];
1245
+ cameraKeys: string[];
1246
+ frameCount: number;
1247
+ }
1248
+
1249
+ export interface CameraFrameSequenceRecorderAPI {
1250
+ status: FrameCaptureStatus;
1251
+ error: Error | null;
1252
+ isRecording: boolean;
1253
+ record: (options: CameraFrameSequenceOptions) => Promise<CameraFrameSequenceResult>;
1254
+ reset: () => void;
1255
+ }
1256
+
1167
1257
  // ---- Canvas Props ----
1168
1258
 
1169
1259
  export type MujocoCanvasProps = Omit<CanvasProps, 'onError'> & {