-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathbit-components.js
More file actions
343 lines (332 loc) · 10.6 KB
/
bit-components.js
File metadata and controls
343 lines (332 loc) · 10.6 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
import { defineComponent, setDefaultSize, setRemovedRecycleThreshold, Types } from "bitecs";
// TODO this has to happen before all components are defined. Is there a better spot to be doing this?
setDefaultSize(10000);
setRemovedRecycleThreshold(0.2);
export const $isStringType = Symbol("isStringType");
export const Networked = defineComponent({
id: Types.ui32,
creator: Types.ui32,
owner: Types.ui32,
lastOwnerTime: Types.ui32,
timestamp: Types.ui32
});
Networked.id[$isStringType] = true;
Networked.creator[$isStringType] = true;
Networked.owner[$isStringType] = true;
export const Owned = defineComponent();
export const EntityStateDirty = defineComponent();
export const NetworkedMediaFrame = defineComponent({
capturedNid: Types.ui32,
scale: [Types.f32, 3]
});
NetworkedMediaFrame.capturedNid[$isStringType] = true;
export const MediaFrame = defineComponent({
capturedNid: Types.ui32,
scale: [Types.f32, 3],
mediaType: Types.ui8,
bounds: [Types.f32, 3],
guide: Types.eid,
preview: Types.eid,
previewingNid: Types.eid
});
export const TextTag = defineComponent();
export const ReflectionProbe = defineComponent();
export const Slice9 = defineComponent({
insets: [Types.ui32, 4],
size: [Types.f32, 2]
});
export const NetworkedTransform = defineComponent({
position: [Types.f32, 3],
rotation: [Types.f32, 4],
scale: [Types.f32, 3]
});
export const AEntity = defineComponent();
export const Object3DTag = defineComponent();
export const GLTFModel = defineComponent();
export const LightTag = defineComponent();
export const AmbientLightTag = defineComponent();
export const DirectionalLight = defineComponent();
export const HemisphereLightTag = defineComponent();
export const PointLightTag = defineComponent();
export const SpotLightTag = defineComponent();
export const CursorRaycastable = defineComponent();
export const RemoteHoverTarget = defineComponent();
export const NotRemoteHoverTarget = defineComponent();
export const Holdable = defineComponent();
export const RemoveNetworkedEntityButton = defineComponent();
export const Interacted = defineComponent();
export const HandRight = defineComponent();
export const HandLeft = defineComponent();
export const RemoteRight = defineComponent();
export const RemoteLeft = defineComponent();
export const HoveredHandRight = defineComponent();
export const HoveredHandLeft = defineComponent();
export const HoveredRemoteRight = defineComponent();
export const HoveredRemoteLeft = defineComponent();
export const HeldHandRight = defineComponent();
export const HeldHandLeft = defineComponent();
export const HeldRemoteRight = defineComponent();
export const HeldRemoteLeft = defineComponent();
export const Held = defineComponent();
export const Constraint = defineComponent();
export const ConstraintHandRight = defineComponent();
export const ConstraintHandLeft = defineComponent();
export const ConstraintRemoteRight = defineComponent();
export const ConstraintRemoteLeft = defineComponent();
export const OffersRemoteConstraint = defineComponent();
export const HandCollisionTarget = defineComponent();
export const OffersHandConstraint = defineComponent();
export const TogglesHoveredActionSet = defineComponent();
export const HoverButton = defineComponent({ type: Types.ui8 });
export const TextButton = defineComponent({ labelRef: Types.eid });
export const HoldableButton = defineComponent();
export const SingleActionButton = defineComponent();
export const Pen = defineComponent();
export const HoverMenuChild = defineComponent();
export const Static = defineComponent();
export const Inspectable = defineComponent();
export const PreventAudioBoost = defineComponent();
export const IgnoreSpaceBubble = defineComponent();
export const Rigidbody = defineComponent({
bodyId: Types.ui16,
mass: Types.f32,
gravity: [Types.f32, 3],
linearDamping: Types.f32,
angularDamping: Types.f32,
linearSleepingThreshold: Types.f32,
angularSleepingThreshold: Types.f32,
angularFactor: [Types.f32, 3],
type: Types.ui8,
activationState: Types.ui8,
collisionFilterGroup: Types.ui32,
collisionFilterMask: Types.ui32,
flags: Types.ui8
});
export const PhysicsShape = defineComponent({
bodyId: Types.ui16,
shapeId: Types.ui16,
type: Types.ui8,
fit: Types.ui8,
halfExtents: [Types.f32, 3],
minHalfExtent: Types.f32,
maxHalfExtent: Types.f32,
sphereRadius: Types.f32,
cylinderAxis: Types.ui8,
margin: Types.f32,
offset: [Types.f32, 3],
orientation: [Types.f32, 4],
heightfieldData: [Types.f32],
heightfieldDistance: Types.f32,
flags: Types.ui8
});
export const Pinnable = defineComponent();
export const Pinned = defineComponent();
export const DestroyAtExtremeDistance = defineComponent();
export const MediaLoading = defineComponent();
export const FloatyObject = defineComponent({ flags: Types.ui8, releaseGravity: Types.f32 });
export const NetworkedFloatyObject = defineComponent({ flags: Types.ui8 });
export const MakeKinematicOnRelease = defineComponent();
export const CameraTool = defineComponent({
snapTime: Types.f32,
state: Types.ui8,
captureDurIdx: Types.ui8,
trackTarget: Types.eid,
snapMenuRef: Types.eid,
nextButtonRef: Types.eid,
prevButtonRef: Types.eid,
snapRef: Types.eid,
cancelRef: Types.eid,
recVideoRef: Types.eid,
screenRef: Types.eid,
selfieScreenRef: Types.eid,
cameraRef: Types.eid,
countdownLblRef: Types.eid,
captureDurLblRef: Types.eid,
sndToggleRef: Types.eid
});
export const MyCameraTool = defineComponent();
export const MediaLoader = defineComponent({
src: Types.ui32,
flags: Types.ui8
});
MediaLoader.src[$isStringType] = true;
export const MediaLoaded = defineComponent();
export const MediaContentBounds = defineComponent({
bounds: [Types.f32, 3]
});
export const SceneRoot = defineComponent();
export const NavMesh = defineComponent();
export const SceneLoader = defineComponent({ src: Types.ui32 });
SceneLoader.src[$isStringType] = true;
export const MediaImage = defineComponent({
cacheKey: Types.ui32
});
MediaImage.cacheKey[$isStringType] = true;
export const NetworkedPDF = defineComponent({
pageNumber: Types.ui8
});
export const MediaPDF = defineComponent({
pageNumber: Types.ui8
});
MediaPDF.map = new Map();
export const MediaVideo = defineComponent({
autoPlay: Types.ui8,
ratio: Types.f32
});
export const MixerAnimatableInitialize = defineComponent({});
export const MixerAnimatable = defineComponent({});
/**
* @type {Map<EntityId, AnimationMixer}>}
*/
export const MixerAnimatableData = new Map();
export const LoopAnimationInitialize = defineComponent({});
/**
* @type {Map<EntityId, {
* activeClipIndices: number[],
* clip: number,
* paused: boolean,
* startOffset: number,
* timeScale: number
* }[]>}
*/
export const LoopAnimationInitializeData = new Map();
export const LoopAnimation = defineComponent();
/**
* @type {Map<EntityId, AnimationAction[]>}
*/
export const LoopAnimationData = new Map();
export const NetworkedVideo = defineComponent({
time: Types.f32,
flags: Types.ui8
});
export const VideoMenuItem = defineComponent();
export const VideoMenu = defineComponent({
videoRef: Types.eid,
sliderRef: Types.eid,
timeLabelRef: Types.eid,
trackRef: Types.eid,
headRef: Types.eid,
playIndicatorRef: Types.eid,
pauseIndicatorRef: Types.eid
});
export const AudioEmitter = defineComponent({
flags: Types.ui8
});
AudioEmitter.params = new Map();
export const AudioSettingsChanged = defineComponent();
export const Deletable = defineComponent();
export const Deleting = defineComponent();
export const EnvironmentSettings = defineComponent();
EnvironmentSettings.map = new Map();
// TODO: Store this data elsewhere, since only one or two will ever exist.
export const ObjectMenu = defineComponent({
pinButtonRef: Types.eid,
unpinButtonRef: Types.eid,
cameraFocusButtonRef: Types.eid,
cameraTrackButtonRef: Types.eid,
removeButtonRef: Types.eid,
dropButtonRef: Types.eid,
inspectButtonRef: Types.eid,
deserializeDrawingButtonRef: Types.eid,
openLinkButtonRef: Types.eid,
refreshButtonRef: Types.eid,
cloneButtonRef: Types.eid,
rotateButtonRef: Types.eid,
mirrorButtonRef: Types.eid,
scaleButtonRef: Types.eid,
targetRef: Types.eid
});
// TODO: Store this data elsewhere, since only one or two will ever exist.
export const LinkHoverMenu = defineComponent({
targetObjectRef: Types.eid,
linkButtonRef: Types.eid
});
export const LinkHoverMenuItem = defineComponent();
export const Link = defineComponent({
url: Types.ui32
});
Link.url[$isStringType] = true;
// TODO: Store this data elsewhere, since only one or two will ever exist.
export const PDFMenu = defineComponent({
prevButtonRef: Types.eid,
nextButtonRef: Types.eid,
pageLabelRef: Types.eid,
targetRef: Types.eid,
clearTargetTimer: Types.f64
});
export const ObjectMenuTarget = defineComponent();
export const NetworkDebug = defineComponent();
export const NetworkDebugRef = defineComponent({
ref: Types.eid
});
export const Waypoint = defineComponent({
flags: Types.ui8
});
export const NetworkedWaypoint = defineComponent({
occupied: Types.ui8
});
export const WaypointPreview = defineComponent();
export const Skybox = defineComponent();
export const ObjectSpawner = defineComponent({
src: Types.ui32,
flags: Types.ui8
});
export const Billboard = defineComponent({
onlyY: Types.ui8
});
export const MaterialTag = defineComponent();
export const UVScroll = defineComponent({
speed: [Types.f32, 2],
increment: [Types.f32, 2],
offset: [Types.f32, 2]
});
export const VideoTextureSource = defineComponent({
fps: Types.ui8,
resolution: [Types.ui16, 2]
});
export const VideoTextureTarget = defineComponent({
source: Types.eid,
flags: Types.ui8
});
export const SimpleWater = defineComponent();
export const Mirror = defineComponent();
export const ParticleEmitterTag = defineComponent({
src: Types.ui32
});
export const AudioZone = defineComponent({
flags: Types.ui8
});
export const AudioTarget = defineComponent({
minDelay: Types.ui32,
maxDelay: Types.ui32,
source: Types.eid,
flags: Types.ui8
});
export const AudioSource = defineComponent({
flags: Types.ui8
});
export const AudioParams = defineComponent();
export const ScenePreviewCamera = defineComponent({
duration: Types.f32,
positionOnly: Types.ui8
});
export const LinearTranslate = defineComponent({
duration: Types.f32,
targetX: Types.f32,
targetY: Types.f32,
targetZ: Types.f32
});
export const LinearRotate = defineComponent({
duration: Types.f32,
targetX: Types.f32,
targetY: Types.f32,
targetZ: Types.f32,
targetW: Types.f32
});
export const LinearScale = defineComponent({
duration: Types.f32,
targetX: Types.f32,
targetY: Types.f32,
targetZ: Types.f32
});
export const AudioListenerTag = defineComponent();