File size: 3,020 Bytes
40fde09
 
e0c4dc2
 
f4af987
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40fde09
 
 
 
51dbf06
 
 
 
 
 
 
 
 
40fde09
e0c4dc2
 
51dbf06
 
793c1b3
 
f4af987
 
 
 
 
 
 
 
 
 
b1ecc22
 
 
 
 
 
 
 
ab75c71
b1ecc22
 
 
ab75c71
f4af987
40fde09
 
793c1b3
 
f4af987
6311de2
f4af987
b1ecc22
 
 
 
 
 
 
 
 
 
 
 
 
ab75c71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b1ecc22
ab75c71
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
export type ProjectionMode = 'cartesian' | 'spherical'

export type CacheMode = "use" | "renew" | "ignore"

export interface RenderRequest {
  prompt: string

  // whether to use video segmentation
  // disabled (default)
  // firstframe: we only analyze the first frame
  // allframes: we analyze all the frames
  segmentation: 'disabled' | 'firstframe' | 'allframes'

  // segmentation will only be executed if we have a non-empty list of actionnables
  // actionnables are names of things like "chest", "key", "tree", "chair" etc
  actionnables: string[]

  // note: this is the number of frames for Zeroscope,
  // which is currently configured to only output 3 seconds, so:
  // nbFrames=8 -> 1 sec
  // nbFrames=16 -> 2 sec
  // nbFrames=24 -> 3 sec
  nbFrames: number // min: 1, max: 24

  nbSteps: number // min: 1, max: 50

  seed: number

  width: number // fixed at 1024 for now
  height: number // fixed at 512 for now

  // upscaling factor
  // 0: no upscaling
  // 1: no upscaling
  // 2: 2x larger
  // 3: 3x larger
  // 4x: 4x larger, up to 4096x4096 (warning: a PNG of this size can be 50 Mb!)
  upscalingFactor: number


  projection: ProjectionMode

  cache: CacheMode

  wait: boolean // wait until the job is completed

  analyze: boolean // analyze the image to generate a caption (optional)
}

export interface ImageSegment {
  id: number
  box: number[]
  color: number[]
  label: string
  score: number 
}

export type RenderedSceneStatus =
  | "pending"
  | "completed"
  | "error"

export type SceneEvent =
  | "HoveringNothing"
  | "HoveringActionnable"
  // | "ItemIsOverActionnable"
  | "ClickOnNothing"
  | "ClickOnActionnable"

  
export interface RenderedScene {
  renderId: string
  status: RenderedSceneStatus
  assetUrl: string
  alt: string
  error: string
  maskUrl: string
  segments: ImageSegment[]
}

export type InventoryEvent =
  | "Grabbing" // grabbed from the inventory, the item is flying over nothing
  | "HoverAnItem" // hover an item, without dragging it
  | "ClickOnItem" // click on an item, without dragging it
  | "HoveringTheScene" // the item is hover the scene, but not on an actionnable
  | "HoveringActionnable" // the item is hover a scene actionnable, ready to be dropped
  | "DroppedOnActionnable" // the item has been dropped on a scene actionnable
  | "HoveringAnotherItem" // the item is hover another inventory item, ready to be dropped
  | "DroppedOnAnotherItem" // the item has been dropped on another inventory item
  | "DroppedBackToInventory" // the drag & drop is cancelled, the item is back in the inventory

  export interface InventoryItem {
    name: string
    title: string
    caption: string
    description: string
  }

  export interface DropZoneTarget {
    type: "InventoryItem" | "Actionnable"
    name: string
    title?: string
    caption?: string
    description?: string
  }

export type OnInventoryEvent = (event: InventoryEvent, item: InventoryItem, target?: {
  name: string
  title?: string
  description?: string
 }) => void