@dcl/sdk 7.0.0-3548419522.commit-ddcf4b7 → 7.0.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.
Files changed (75) hide show
  1. package/ecs.d.ts +1 -0
  2. package/ecs.js +2 -0
  3. package/index.d.ts +1 -0
  4. package/index.js +11 -0
  5. package/internal/Observable.d.ts +36 -0
  6. package/internal/Observable.js +190 -0
  7. package/internal/transports/networkTransport.d.ts +2 -0
  8. package/internal/transports/networkTransport.js +16 -0
  9. package/internal/transports/rendererTransport.d.ts +7 -0
  10. package/internal/transports/rendererTransport.js +39 -0
  11. package/math.d.ts +3 -0
  12. package/math.js +4 -0
  13. package/messageBus.d.ts +10 -0
  14. package/messageBus.js +43 -0
  15. package/observables.d.ts +225 -0
  16. package/observables.js +75 -0
  17. package/package.json +12 -18
  18. package/react-ecs.d.ts +3 -0
  19. package/react-ecs.js +4 -0
  20. package/src/ecs.ts +1 -0
  21. package/src/index.ts +18 -0
  22. package/src/internal/Observable.ts +425 -0
  23. package/src/internal/transports/networkTransport.ts +24 -0
  24. package/src/internal/transports/rendererTransport.ts +60 -0
  25. package/src/math.ts +3 -0
  26. package/src/messageBus.ts +62 -0
  27. package/src/observables.ts +579 -0
  28. package/src/react-ecs.ts +3 -0
  29. package/tsconfig.json +11 -0
  30. package/types/tsconfig.ecs7.json +3 -8
  31. package/dist/ecs7/index.d.ts +0 -4679
  32. package/dist/ecs7/index.js +0 -15202
  33. package/dist/ecs7/index.min.js +0 -1
  34. package/dist/ecs7/index.min.js.map +0 -1
  35. package/dist/ecs7/proto-definitions/README.md +0 -32
  36. package/dist/ecs7/proto-definitions/Transform.md +0 -25
  37. package/dist/ecs7/proto-definitions/animator.proto +0 -19
  38. package/dist/ecs7/proto-definitions/audio_source.proto +0 -13
  39. package/dist/ecs7/proto-definitions/audio_stream.proto +0 -11
  40. package/dist/ecs7/proto-definitions/avatar_attach.proto +0 -19
  41. package/dist/ecs7/proto-definitions/avatar_modifier_area.proto +0 -19
  42. package/dist/ecs7/proto-definitions/avatar_shape.proto +0 -32
  43. package/dist/ecs7/proto-definitions/billboard.proto +0 -17
  44. package/dist/ecs7/proto-definitions/camera_mode.proto +0 -10
  45. package/dist/ecs7/proto-definitions/camera_mode_area.proto +0 -14
  46. package/dist/ecs7/proto-definitions/common/camera_type.proto +0 -8
  47. package/dist/ecs7/proto-definitions/common/id.md +0 -2
  48. package/dist/ecs7/proto-definitions/common/id.proto +0 -8
  49. package/dist/ecs7/proto-definitions/common/input_action.proto +0 -20
  50. package/dist/ecs7/proto-definitions/common/texts.proto +0 -20
  51. package/dist/ecs7/proto-definitions/gltf_container.proto +0 -13
  52. package/dist/ecs7/proto-definitions/material.proto +0 -56
  53. package/dist/ecs7/proto-definitions/mesh_collider.proto +0 -35
  54. package/dist/ecs7/proto-definitions/mesh_renderer.proto +0 -30
  55. package/dist/ecs7/proto-definitions/nft_shape.proto +0 -40
  56. package/dist/ecs7/proto-definitions/pointer_events_result.proto +0 -25
  57. package/dist/ecs7/proto-definitions/pointer_hover_feedback.proto +0 -31
  58. package/dist/ecs7/proto-definitions/pointer_lock.proto +0 -9
  59. package/dist/ecs7/proto-definitions/raycast.proto +0 -20
  60. package/dist/ecs7/proto-definitions/raycast_result.proto +0 -25
  61. package/dist/ecs7/proto-definitions/text_shape.proto +0 -33
  62. package/dist/ecs7/proto-definitions/ui_background.proto +0 -11
  63. package/dist/ecs7/proto-definitions/ui_text.proto +0 -17
  64. package/dist/ecs7/proto-definitions/ui_transform.proto +0 -141
  65. package/dist/ecs7/proto-definitions/visibility_component.proto +0 -9
  66. package/dist/playground/snippets/billboard.ts +0 -108
  67. package/dist/playground/snippets/cube-spawner.ts +0 -39
  68. package/dist/playground/snippets/info.json +0 -1
  69. package/dist/playground/snippets/material.ts +0 -48
  70. package/dist/playground/snippets/mesh.ts +0 -68
  71. package/dist/playground/snippets/pointer-events.ts +0 -50
  72. package/dist/playground/snippets/raycast-hit-many.ts +0 -63
  73. package/dist/playground/snippets/raycast-hit.ts +0 -62
  74. package/dist/playground/snippets/ui.tsx +0 -134
  75. package/types/ecs7/index.d.ts +0 -4679
@@ -1,4679 +0,0 @@
1
- /// <reference types="@dcl/posix" />
2
-
3
- /** @public */
4
- declare const Animator: AnimatorComponentDefinitionExtended;
5
-
6
- /**
7
- * @public
8
- */
9
- declare type AnimatorComponentDefinition = ComponentDefinition<ISchema<PBAnimator>, PBAnimator>;
10
-
11
- /**
12
- * @public
13
- */
14
- declare interface AnimatorComponentDefinitionExtended extends AnimatorComponentDefinition {
15
- /**
16
- * @public
17
- *
18
- * Get a `mutable` version of animator clip
19
- * @param entity - entity with Animator component
20
- * @param name - the field `name` of the component
21
- * @returns the clip or fails if it isn't found
22
- */
23
- getClip(entity: Entity, name: string): PBAnimationState;
24
- /**
25
- * @public
26
- *
27
- * Get a `mutable` version of animator clip
28
- * @param entity - entity with Animator component
29
- * @param name - the field `name` of the component
30
- * @returns the clip or null if it isn't found
31
- */
32
- getClipOrNull(entity: Entity, name: string): PBAnimationState | null;
33
- /**
34
- * @public
35
- *
36
- * Set playing=true the animation `$name`
37
- * @param entity - entity with Animator component
38
- * @param name - animation name
39
- * @param resetCursor - the animation starts at 0 or continues from the current cursor position
40
- * @returns true in successful playing, false if it doesn't find the Animator or clip
41
- */
42
- playSingleAnimation(entity: Entity, name: string, resetCursor?: boolean): boolean;
43
- /**
44
- * @public
45
- *
46
- * Set playing=false all animations
47
- * @param entity - entity with Animator component
48
- * @param resetCursor - the animation stops at 0 or at the current cursor position
49
- * @returns true in successful playing, false if it doesn't find the Animator
50
- */
51
- stopAllAnimations(entity: Entity, resetCursor?: boolean): boolean;
52
- }
53
-
54
- /** @public */
55
- declare const AudioSource: ComponentDefinition<ISchema<PBAudioSource>, PBAudioSource>;
56
-
57
- /** @public */
58
- declare const AudioStream: ComponentDefinition<ISchema<PBAudioStream>, PBAudioStream>;
59
-
60
- declare const enum AvatarAnchorPointType {
61
- AAPT_POSITION = 0,
62
- AAPT_NAME_TAG = 1,
63
- AAPT_LEFT_HAND = 2,
64
- AAPT_RIGHT_HAND = 3
65
- }
66
-
67
- /** @public */
68
- declare const AvatarAttach: ComponentDefinition<ISchema<PBAvatarAttach>, PBAvatarAttach>;
69
-
70
- /** @public */
71
- declare const AvatarModifierArea: ComponentDefinition<ISchema<PBAvatarModifierArea>, PBAvatarModifierArea>;
72
-
73
- declare const enum AvatarModifierType {
74
- AMT_HIDE_AVATARS = 0,
75
- AMT_DISABLE_PASSPORTS = 1
76
- }
77
-
78
- /** @public */
79
- declare const AvatarShape: ComponentDefinition<ISchema<PBAvatarShape>, PBAvatarShape>;
80
-
81
- declare interface AvatarTexture {
82
- userId: string;
83
- /** default = TextureWrapMode.Clamp */
84
- wrapMode?: TextureWrapMode | undefined;
85
- /** default = FilterMode.Bilinear */
86
- filterMode?: TextureFilterMode | undefined;
87
- }
88
-
89
- /** @public */
90
- declare const Billboard: ComponentDefinition<ISchema<PBBillboard>, PBBillboard>;
91
-
92
- declare const enum BillboardMode {
93
- BM_ALL_AXES = 0,
94
- BM_Y_AXE = 1
95
- }
96
-
97
- /**
98
- * @public
99
- */
100
- declare type ByteBuffer = {
101
- /**
102
- * @returns The entire current Uint8Array.
103
- *
104
- * WARNING: if the buffer grows, the view had changed itself,
105
- * and the reference will be a invalid one.
106
- */
107
- buffer(): Uint8Array;
108
- /**
109
- * @returns The capacity of the current buffer
110
- */
111
- bufferLength(): number;
112
- /**
113
- * Resets byteBuffer to avoid creating a new one
114
- */
115
- resetBuffer(): void;
116
- /**
117
- * @returns The current read offset
118
- */
119
- currentReadOffset(): number;
120
- /**
121
- * @returns The current write offset
122
- */
123
- currentWriteOffset(): number;
124
- /**
125
- * Reading purpose
126
- * Returns the previuos offsset size before incrementing
127
- */
128
- incrementReadOffset(amount: number): number;
129
- /**
130
- * @returns How many bytes are available to read.
131
- */
132
- remainingBytes(): number;
133
- readFloat32(): number;
134
- readFloat64(): number;
135
- readInt8(): number;
136
- readInt16(): number;
137
- readInt32(): number;
138
- readInt64(): bigint;
139
- readUint8(): number;
140
- readUint16(): number;
141
- readUint32(): number;
142
- readUint64(): bigint;
143
- readBuffer(): Uint8Array;
144
- /**
145
- * Writing purpose
146
- */
147
- /**
148
- * Increment offset
149
- * @param amount - how many bytes
150
- * @returns The offset when this reserving starts.
151
- */
152
- incrementWriteOffset(amount: number): number;
153
- /**
154
- * @returns The total number of bytes writen in the buffer.
155
- */
156
- size(): number;
157
- /**
158
- * Take care using this function, if you modify the data after, the
159
- * returned subarray will change too. If you'll modify the content of the
160
- * bytebuffer, maybe you want to use toCopiedBinary()
161
- *
162
- * @returns The subarray from 0 to offset as reference.
163
- */
164
- toBinary(): Uint8Array;
165
- /**
166
- * Safe copied buffer of the current data of ByteBuffer
167
- *
168
- * @returns The subarray from 0 to offset.
169
- */
170
- toCopiedBinary(): Uint8Array;
171
- writeBuffer(value: Uint8Array, writeLength?: boolean): void;
172
- writeFloat32(value: number): void;
173
- writeFloat64(value: number): void;
174
- writeInt8(value: number): void;
175
- writeInt16(value: number): void;
176
- writeInt32(value: number): void;
177
- writeInt64(value: bigint): void;
178
- writeUint8(value: number): void;
179
- writeUint16(value: number): void;
180
- writeUint32(value: number): void;
181
- writeUint64(value: bigint): void;
182
- getFloat32(offset: number): number;
183
- getFloat64(offset: number): number;
184
- getInt8(offset: number): number;
185
- getInt16(offset: number): number;
186
- getInt32(offset: number): number;
187
- getInt64(offset: number): bigint;
188
- getUint8(offset: number): number;
189
- getUint16(offset: number): number;
190
- getUint32(offset: number): number;
191
- getUint64(offset: number): bigint;
192
- setFloat32(offset: number, value: number): void;
193
- setFloat64(offset: number, value: number): void;
194
- setInt8(offset: number, value: number): void;
195
- setInt16(offset: number, value: number): void;
196
- setInt32(offset: number, value: number): void;
197
- setInt64(offset: number, value: bigint): void;
198
- setUint8(offset: number, value: number): void;
199
- setUint16(offset: number, value: number): void;
200
- setUint32(offset: number, value: number): void;
201
- setUint64(offset: number, value: bigint): void;
202
- };
203
-
204
- /** @public */
205
- declare const CameraMode: ComponentDefinition<ISchema<PBCameraMode>, PBCameraMode>;
206
-
207
- /** @public */
208
- declare const CameraModeArea: ComponentDefinition<ISchema<PBCameraModeArea>, PBCameraModeArea>;
209
-
210
- declare const enum CameraType {
211
- CT_FIRST_PERSON = 0,
212
- CT_THIRD_PERSON = 1
213
- }
214
-
215
- declare const enum ColliderLayer {
216
- CL_NONE = 0,
217
- CL_POINTER = 1,
218
- CL_PHYSICS = 2
219
- }
220
-
221
- /**
222
- * @public
223
- * Color3 is a type and a namespace.
224
- * - The namespace contains all types and functions to operates with Color3
225
- * - The type Color3 is an alias to Color3.ReadonlyColor3
226
- * ```
227
- *
228
- * // Namespace usage example
229
- * Color3.add(blue, red) // sum component by component resulting pink
230
- *
231
- * // Type usage example
232
- * const readonlyBlue: Color3 = Color3.Blue()
233
- * readonlyBlue.r = 0.1 // this FAILS
234
- *
235
- * // For mutable usage, use `Color3.Mutable`
236
- * const blue: Color3.Mutable = Color3.Blue()
237
- * blue.r = 0.1 // this WORKS
238
- * ```
239
- */
240
- declare type Color3 = Color3.ReadonlyColor3;
241
-
242
- /**
243
- * @public
244
- * Color3 is a type and a namespace.
245
- * ```
246
- * // The namespace contains all types and functions to operates with Color3
247
- * Color3.add(blue, red) // sum component by component resulting pink
248
- * // The type Color3 is an alias to Color3.ReadonlyColor3
249
- * const readonlyBlue: Color3 = Color3.Blue()
250
- * readonlyBlue.r = 0.1 // this FAILS
251
- *
252
- * // For mutable usage, use `Color3.Mutable`
253
- * const blue: Color3.Mutable = Color3.Blue()
254
- * blue.r = 0.1 // this WORKS
255
- * ```
256
- */
257
- declare namespace Color3 {
258
- /**
259
- * @public
260
- * For external use, type with `Color3`, e.g. `const blackColor: Color3 = Color3.Black()`.
261
- * For mutable typing, use `Color3.Mutable`, e.g. `const redColor: Color3.Mutable = Color3.Red()`.
262
- */
263
- export type ReadonlyColor3 = {
264
- readonly r: number;
265
- readonly g: number;
266
- readonly b: number;
267
- };
268
- /**
269
- * @public
270
- * For external usage, type with `Color3`, e.g. `const blackColor: Color3 = Color3.Black()`.
271
- * For mutable typing, use `Color3.Mutable`, e.g. `const redColor: Color3.Mutable = Color3.Red()`.
272
- */
273
- export type MutableColor3 = {
274
- r: number;
275
- g: number;
276
- b: number;
277
- };
278
- /**
279
- * @public
280
- * Type with `Color3` for readonly usage, e.g. `const blackColor: Color3 = Color3.Black()`.
281
- * For mutable, use `Color3.Mutable`, e.g. `const redColor: Color3.Mutable = Color3.Red()`.
282
- */
283
- export type Mutable = MutableColor3;
284
- /**
285
- * Creates Color3 object from red, green, blue values, all between 0 and 1
286
- * @param r - defines the red component (between 0 and 1, default is 0)
287
- * @param g - defines the green component (between 0 and 1, default is 0)
288
- * @param b - defines the blue component (between 0 and 1, default is 0)
289
- */
290
- export function create(
291
- /**
292
- * Defines the red component (between 0 and 1, default is 0)
293
- */
294
- r?: number,
295
- /**
296
- * Defines the green component (between 0 and 1, default is 0)
297
- */
298
- g?: number,
299
- /**
300
- * Defines the blue component (between 0 and 1, default is 0)
301
- */
302
- b?: number): {
303
- r: number;
304
- g: number;
305
- b: number;
306
- };
307
- /**
308
- * Creates a Vector3 from the string containing valid hexadecimal values
309
- * @param hex - defines a string containing valid hexadecimal values
310
- * @returns a new Vector3
311
- */
312
- export function fromHexString(hex: string): MutableColor3;
313
- /**
314
- * Creates a new Vector3 from the starting index of the given array
315
- * @param array - defines the source array
316
- * @param offset - defines an offset in the source array
317
- * @returns a new Vector3
318
- */
319
- export function fromArray(array: ArrayLike<number>, offset?: number): MutableColor3;
320
- /**
321
- * Creates a Vector3 from integer values (less than 256)
322
- * @param r - defines the red component to read from (value between 0 and 255)
323
- * @param g - defines the green component to read from (value between 0 and 255)
324
- * @param b - defines the blue component to read from (value between 0 and 255)
325
- * @returns a new Vector3
326
- */
327
- export function fromInts(r: number, g: number, b: number): MutableColor3;
328
- /**
329
- * Creates a Vector3 with values linearly interpolated of "amount" between the start Color3 and the end Color3
330
- * @param start - defines the start Color3 value
331
- * @param end - defines the end Color3 value
332
- * @param amount - defines the gradient value between start and end
333
- * @returns a new Vector3
334
- */
335
- export function lerp(start: ReadonlyColor3, end: ReadonlyColor3, amount: number): MutableColor3;
336
- /**
337
- * Creates a Vector3 with values linearly interpolated of "amount" between the start Color3 and the end Color3
338
- * @param left - defines the start value
339
- * @param right - defines the end value
340
- * @param amount - defines the gradient factor
341
- * @param result - defines the Color3 object where to store the result
342
- */
343
- export function lerpToRef(left: ReadonlyColor3, right: ReadonlyColor3, amount: number, result: MutableColor3): void;
344
- /**
345
- * Returns a Color3 value containing a red color
346
- * @returns a new Vector3
347
- */
348
- export function Red(): MutableColor3;
349
- /**
350
- * Returns a Color3 value containing a green color
351
- * @returns a new Vector3
352
- */
353
- export function Green(): MutableColor3;
354
- /**
355
- * Returns a Color3 value containing a blue color
356
- * @returns a new Vector3
357
- */
358
- export function Blue(): MutableColor3;
359
- /**
360
- * Returns a Color3 value containing a black color
361
- * @returns a new Vector3
362
- */
363
- export function Black(): MutableColor3;
364
- /**
365
- * Returns a Color3 value containing a white color
366
- * @returns a new Vector3
367
- */
368
- export function White(): MutableColor3;
369
- /**
370
- * Returns a Color3 value containing a purple color
371
- * @returns a new Vector3
372
- */
373
- export function Purple(): MutableColor3;
374
- /**
375
- * Returns a Color3 value containing a magenta color
376
- * @returns a new Vector3
377
- */
378
- export function Magenta(): MutableColor3;
379
- /**
380
- * Returns a Color3 value containing a yellow color
381
- * @returns a new Vector3
382
- */
383
- export function Yellow(): MutableColor3;
384
- /**
385
- * Returns a Color3 value containing a gray color
386
- * @returns a new Vector3
387
- */
388
- export function Gray(): MutableColor3;
389
- /**
390
- * Returns a Color3 value containing a teal color
391
- * @returns a new Vector3
392
- */
393
- export function Teal(): MutableColor3;
394
- /**
395
- * Returns a Color3 value containing a random color
396
- * @returns a new Vector3
397
- */
398
- export function Random(): MutableColor3;
399
- /**
400
- * Creates a string with the Color3 current values
401
- * @returns the string representation of the Color3 object
402
- */
403
- export function toString(value: ReadonlyColor3): string;
404
- /**
405
- * Compute the Color3 hash code
406
- * @returns an unique number that can be used to hash Color3 objects
407
- */
408
- export function getHashCode(value: ReadonlyColor3): number;
409
- /**
410
- * Stores in the given array from the given starting index the red, green, blue values as successive elements
411
- * @param array - defines the array where to store the r,g,b components
412
- * @param index - defines an optional index in the target array to define where to start storing values
413
- *
414
- */
415
- export function toArray(value: ReadonlyColor3, array: FloatArray, index?: number): void;
416
- /**
417
- * Returns a new Color4 object from the current Color3 and the given alpha
418
- * @param alpha - defines the alpha component on the new Color4 object (default is 1)
419
- * @returns a new Color4 object
420
- */
421
- export function toColor4(value: ReadonlyColor3, alpha?: number): Color4.MutableColor4;
422
- /**
423
- * Returns a new array populated with 3 numeric elements : red, green and blue values
424
- * @returns the new array
425
- */
426
- export function asArray(value: ReadonlyColor3): number[];
427
- /**
428
- * Returns the luminance value
429
- * @returns a float value
430
- */
431
- export function toLuminance(value: ReadonlyColor3): number;
432
- /**
433
- * Multiply each Color3 rgb values by the given Color3 rgb values in Color3 object
434
- * @param otherColor - defines the second operand
435
- * @returns the create object
436
- */
437
- export function multiply(value: ReadonlyColor3, otherColor: ReadonlyColor3): MutableColor3;
438
- /**
439
- * Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object "result"
440
- * @param otherColor - defines the second operand
441
- * @param result - defines the Color3 object where to store the result
442
- * @returns the current Color3
443
- */
444
- export function multiplyToRef(value: ReadonlyColor3, otherColor: ReadonlyColor3, result: MutableColor3): void;
445
- /**
446
- * Determines equality between Color3 objects
447
- * @param otherColor - defines the second operand
448
- * @returns true if the rgb values are equal to the given ones
449
- */
450
- export function equals(value: ReadonlyColor3, otherColor: ReadonlyColor3): boolean;
451
- /**
452
- * Determines equality between the current Color3 object and a set of r,b,g values
453
- * @param r - defines the red component to check
454
- * @param g - defines the green component to check
455
- * @param b - defines the blue component to check
456
- * @returns true if the rgb values are equal to the given ones
457
- */
458
- export function equalsFloats(value: ReadonlyColor3, r: number, g: number, b: number): boolean;
459
- /**
460
- * Multiplies in place each rgb value by scale
461
- * @param scale - defines the scaling factor
462
- * @returns the updated Color3
463
- */
464
- export function scale(value: ReadonlyColor3, scale: number): MutableColor3;
465
- /**
466
- * Multiplies the rgb values by scale and stores the result into "result"
467
- * @param scale - defines the scaling factor
468
- * @param result - defines the Color3 object where to store the result
469
- * @returns the unmodified current Color3
470
- */
471
- export function scaleToRef(value: ReadonlyColor3, scale: number, result: MutableColor3): void;
472
- /**
473
- * Scale the current Color3 values by a factor and add the result to a given Color3
474
- * @param scale - defines the scale factor
475
- * @param result - defines color to store the result into
476
- * @returns the unmodified current Color3
477
- */
478
- export function scaleAndAddToRef(value: ReadonlyColor3, scale: number, result: MutableColor3): void;
479
- /**
480
- * Clamps the rgb values by the min and max values and stores the result into "result"
481
- * @param min - defines minimum clamping value (default is 0)
482
- * @param max - defines maximum clamping value (default is 1)
483
- * @param result - defines color to store the result into
484
- * @returns the original Color3
485
- */
486
- export function clampToRef(value: ReadonlyColor3, min: number | undefined, max: number | undefined, result: MutableColor3): void;
487
- /**
488
- * Clamps the rgb values by the min and max values and returns the result
489
- * @param min - defines minimum clamping value (default is 0)
490
- * @param max - defines maximum clamping value (default is 1)
491
- * @returns result
492
- */
493
- export function clamp(value: ReadonlyColor3, min?: number, max?: number): MutableColor3;
494
- /**
495
- * Creates Color3 set with the added values of the current Color3 and of the given one
496
- * @param otherColor - defines the second operand
497
- * @returns the create
498
- */
499
- export function add(value: ReadonlyColor3, otherColor: ReadonlyColor3): MutableColor3;
500
- /**
501
- * Stores the result of the addition of the current Color3 and given one rgb values into "result"
502
- * @param otherColor - defines the second operand
503
- * @param result - defines Color3 object to store the result into
504
- * @returns the unmodified current Color3
505
- */
506
- export function addToRef(value: ReadonlyColor3, otherColor: ReadonlyColor3, result: MutableColor3): void;
507
- /**
508
- * Returns Color3 set with the subtracted values of the given one from the current Color3
509
- * @param otherColor - defines the second operand
510
- * @returns the create
511
- */
512
- export function subtract(value: ReadonlyColor3, otherColor: ReadonlyColor3): MutableColor3;
513
- /**
514
- * Stores the result of the subtraction of given one from the current Color3 rgb values into "result"
515
- * @param otherColor - defines the second operand
516
- * @param result - defines Color3 object to store the result into
517
- * @returns the unmodified current Color3
518
- */
519
- export function subtractToRef(value: ReadonlyColor3, otherColor: ReadonlyColor3, result: MutableColor3): void;
520
- /**
521
- * Copy the current object
522
- * @returns Color3 copied the current one
523
- */
524
- export function clone(value: ReadonlyColor3): MutableColor3;
525
- /**
526
- * Copies the rgb values from the source in the current Color3
527
- * @param source - defines the source Color3 object
528
- * @returns the updated Color3 object
529
- */
530
- export function copyFrom(source: ReadonlyColor3, dest: MutableColor3): void;
531
- /**
532
- * Updates the Color3 rgb values from the given floats
533
- * @param dest -
534
- * @param r - defines the red component to read from
535
- * @param g - defines the green component to read from
536
- * @param b - defines the blue component to read from
537
- * @returns
538
- */
539
- export function set(dest: MutableColor3, r: number, g: number, b: number): void;
540
- /**
541
- * Compute the Color3 hexadecimal code as a string
542
- * @returns a string containing the hexadecimal representation of the Color3 object
543
- */
544
- export function toHexString(value: ReadonlyColor3): string;
545
- /**
546
- * Computes Color3 converted from the current one to linear space
547
- * @returns a new Vector3
548
- */
549
- export function toLinearSpace(value: ReadonlyColor3): MutableColor3;
550
- /**
551
- * Converts the Color3 values to linear space and stores the result in "convertedColor"
552
- * @param convertedColor - defines the Color3 object where to store the linear space version
553
- * @returns the unmodified Color3
554
- */
555
- export function toLinearSpaceToRef(value: ReadonlyColor3, convertedColor: MutableColor3): void;
556
- /**
557
- * Computes Color3 converted from the current one to gamma space
558
- * @returns a new Vector3
559
- */
560
- export function toGammaSpace(value: ReadonlyColor3): ReadonlyColor3;
561
- /**
562
- * Converts the Color3 values to gamma space and stores the result in "convertedColor"
563
- * @param convertedColor - defines the Color3 object where to store the gamma space version
564
- * @returns the unmodified Color3
565
- */
566
- export function toGammaSpaceToRef(value: ReadonlyColor3, convertedColor: MutableColor3): void;
567
- }
568
-
569
- /**
570
- * @public
571
- */
572
- declare type Color3Type = {
573
- r: number;
574
- g: number;
575
- b: number;
576
- };
577
-
578
- /**
579
- * @public
580
- * Color4 is a type and a namespace.
581
- * - The namespace contains all types and functions to operates with Color4
582
- * - The type Color4 is an alias to Color4.ReadonlyColor4
583
- * ```
584
- *
585
- * // Namespace usage example
586
- * Color4.add(blue, red) // sum component by component resulting pink
587
- *
588
- * // Type usage example
589
- * const readonlyBlue: Color4 = Color4.Blue()
590
- * readonlyBlue.a = 0.1 // this FAILS
591
- *
592
- * // For mutable usage, use `Color4.Mutable`
593
- * const blue: Color4.Mutable = Color4.Blue()
594
- * blue.a = 0.1 // this WORKS
595
- * ```
596
- */
597
- declare type Color4 = Color4.ReadonlyColor4;
598
-
599
- /**
600
- * @public
601
- * Color4 is a type and a namespace.
602
- * ```
603
- * // The namespace contains all types and functions to operates with Color4
604
- * Color4.add(blue, red) // sum component by component resulting pink
605
- * // The type Color4 is an alias to Color4.ReadonlyColor4
606
- * const readonlyBlue: Color4 = Color4.Blue()
607
- * readonlyBlue.a = 0.1 // this FAILS
608
- *
609
- * // For mutable usage, use `Color4.Mutable`
610
- * const blue: Color4.Mutable = Color4.Blue()
611
- * blue.a = 0.1 // this WORKS
612
- * ```
613
- */
614
- declare namespace Color4 {
615
- /**
616
- * @public
617
- * For external use, type with `Color4`, e.g. `const blackColor: Color4 = Color4.Black()`.
618
- * For mutable typing, use `Color4.Mutable`, e.g. `const redColor: Color4.Mutable = Color4.Red()`.
619
- */
620
- export type ReadonlyColor4 = {
621
- readonly r: number;
622
- readonly g: number;
623
- readonly b: number;
624
- readonly a: number;
625
- };
626
- /**
627
- * @public
628
- * For external usage, type with `Color4`, e.g. `const blackColor: Color4 = Color4.Black()`.
629
- * For mutable typing, use `Color4.Mutable`, e.g. `const redColor: Color4.Mutable = Color4.Red()`.
630
- */
631
- export type MutableColor4 = {
632
- r: number;
633
- g: number;
634
- b: number;
635
- a: number;
636
- };
637
- /**
638
- * @public
639
- * Type with `Color4` for readonly usage, e.g. `const blackColor: Color4 = Color4.Black()`.
640
- * For mutable, use `Color4.Mutable`, e.g. `const redColor: Color4.Mutable = Color4.Red()`.
641
- */
642
- export type Mutable = MutableColor4;
643
- /**
644
- * Creates create mutable Color4 from red, green, blue values, all between 0 and 1
645
- * @param r - defines the red component (between 0 and 1, default is 0)
646
- * @param g - defines the green component (between 0 and 1, default is 0)
647
- * @param b - defines the blue component (between 0 and 1, default is 0)
648
- * @param a - defines the alpha component (between 0 and 1, default is 1)
649
- */
650
- export function create(
651
- /**
652
- * Defines the red component (between 0 and 1, default is 0)
653
- */
654
- r?: number,
655
- /**
656
- * Defines the green component (between 0 and 1, default is 0)
657
- */
658
- g?: number,
659
- /**
660
- * Defines the blue component (between 0 and 1, default is 0)
661
- */
662
- b?: number,
663
- /**
664
- * Defines the alpha component (between 0 and 1, default is 1)
665
- */
666
- a?: number): MutableColor4;
667
- /**
668
- * Creates a Color4 from the string containing valid hexadecimal values
669
- * @param hex - defines a string containing valid hexadecimal values
670
- * @returns create mutable Color4
671
- */
672
- export function fromHexString(hex: string): MutableColor4;
673
- /**
674
- * Creates create mutable Color4 set with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object
675
- * @param left - defines the start value
676
- * @param right - defines the end value
677
- * @param amount - defines the gradient factor
678
- * @returns create mutable Color4
679
- */
680
- export function lerp(left: ReadonlyColor4, right: ReadonlyColor4, amount: number): MutableColor4;
681
- /**
682
- * Set the given "result" with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object
683
- * @param left - defines the start value
684
- * @param right - defines the end value
685
- * @param amount - defines the gradient factor
686
- * @param result - defines the Color4 object where to store data
687
- */
688
- export function lerpToRef(left: ReadonlyColor4, right: ReadonlyColor4, amount: number, result: MutableColor4): void;
689
- /**
690
- * Returns a Color4 value containing a red color
691
- * @returns a new Color4
692
- */
693
- export function Red(): MutableColor4;
694
- /**
695
- * Returns a Color4 value containing a green color
696
- * @returns create mutable Color4
697
- */
698
- export function Green(): MutableColor4;
699
- /**
700
- * Returns a Color4 value containing a blue color
701
- * @returns create mutable Color4
702
- */
703
- export function Blue(): MutableColor4;
704
- /**
705
- * Returns a Color4 value containing a black color
706
- * @returns create mutable Color4
707
- */
708
- export function Black(): MutableColor4;
709
- /**
710
- * Returns a Color4 value containing a white color
711
- * @returns create mutable Color4
712
- */
713
- export function White(): MutableColor4;
714
- /**
715
- * Returns a Color4 value containing a purple color
716
- * @returns create mutable Color4
717
- */
718
- export function Purple(): MutableColor4;
719
- /**
720
- * Returns a Color4 value containing a magenta color
721
- * @returns create mutable Color4
722
- */
723
- export function Magenta(): MutableColor4;
724
- /**
725
- * Returns a Color4 value containing a yellow color
726
- * @returns create mutable Color4
727
- */
728
- export function Yellow(): MutableColor4;
729
- /**
730
- * Returns a Color4 value containing a gray color
731
- * @returns create mutable Color4
732
- */
733
- export function Gray(): MutableColor4;
734
- /**
735
- * Returns a Color4 value containing a teal color
736
- * @returns create mutable Color4
737
- */
738
- export function Teal(): MutableColor4;
739
- /**
740
- * Returns a Color4 value containing a transparent color
741
- * @returns create mutable Color4
742
- */
743
- export function Clear(): MutableColor4;
744
- /**
745
- * Creates a Color4 from a Color3 and an alpha value
746
- * @param color3 - defines the source Color3 to read from
747
- * @param alpha - defines the alpha component (1.0 by default)
748
- * @returns create mutable Color4
749
- */
750
- export function fromColor3(color3: Color3.ReadonlyColor3, alpha?: number): MutableColor4;
751
- /**
752
- * Creates a Color4 from the starting index element of the given array
753
- * @param array - defines the source array to read from
754
- * @param offset - defines the offset in the source array
755
- * @returns create mutable Color4
756
- */
757
- export function fromArray(array: ArrayLike<number>, offset?: number): ReadonlyColor4;
758
- /**
759
- * Creates a new Color3 from integer values (less than 256)
760
- * @param r - defines the red component to read from (value between 0 and 255)
761
- * @param g - defines the green component to read from (value between 0 and 255)
762
- * @param b - defines the blue component to read from (value between 0 and 255)
763
- * @param a - defines the alpha component to read from (value between 0 and 255)
764
- * @returns a new Color4
765
- */
766
- export function fromInts(r: number, g: number, b: number, a: number): MutableColor4;
767
- /**
768
- * Check the content of a given array and convert it to an array containing RGBA data
769
- * If the original array was already containing count * 4 values then it is returned directly
770
- * @param colors - defines the array to check
771
- * @param count - defines the number of RGBA data to expect
772
- * @returns an array containing count * 4 values (RGBA)
773
- */
774
- export function checkColors4(colors: number[], count: number): number[];
775
- /**
776
- * Adds the given Color4 values to the ref Color4 object
777
- * @param a - defines the first operand
778
- * @param b - defines the second operand
779
- * @param ref - defines the result rference
780
- * @returns
781
- */
782
- export function addToRef(a: ReadonlyColor4, b: ReadonlyColor4, ref: MutableColor4): void;
783
- /**
784
- * Stores from the starting index in the given array the Color4 successive values
785
- * @param array - defines the array where to store the r,g,b components
786
- * @param index - defines an optional index in the target array to define where to start storing values
787
- * @returns the current Color4 object
788
- */
789
- export function toArray(value: ReadonlyColor4, array: number[], index?: number): void;
790
- /**
791
- * Creates a Color4 set with the added values of the current Color4 and of the given one
792
- * @param right - defines the second operand
793
- * @returns create mutable Color4
794
- */
795
- export function add(value: ReadonlyColor4, right: ReadonlyColor4): MutableColor4;
796
- /**
797
- * Creates a Color4 set with the subtracted values of the given one from the current Color4
798
- * @param right - defines the second operand
799
- * @returns create mutable Color4
800
- */
801
- export function subtract(value: ReadonlyColor4, right: ReadonlyColor4): ReadonlyColor4;
802
- /**
803
- * Subtracts the given ones from the current Color4 values and stores the results in "result"
804
- * @param right - defines the second operand
805
- * @param result - defines the Color4 object where to store the result
806
- * @returns the current Color4 object
807
- */
808
- export function subtractToRef(a: ReadonlyColor4, b: ReadonlyColor4, result: MutableColor4): void;
809
- /**
810
- * Creates a Color4 with the current Color4 values multiplied by scale
811
- * @param scale - defines the scaling factor to apply
812
- * @returns create mutable Color4
813
- */
814
- export function scale(value: ReadonlyColor4, scale: number): ReadonlyColor4;
815
- /**
816
- * Multiplies the current Color4 values by scale and stores the result in "result"
817
- * @param scale - defines the scaling factor to apply
818
- * @param result - defines the Color4 object where to store the result
819
- */
820
- export function scaleToRef(value: ReadonlyColor4, scale: number, result: MutableColor4): void;
821
- /**
822
- * Scale the current Color4 values by a factor and add the result to a given Color4
823
- * @param scale - defines the scale factor
824
- * @param result - defines the Color4 object where to store the result
825
- */
826
- export function scaleAndAddToRef(value: ReadonlyColor4, scale: number, result: MutableColor4): void;
827
- /**
828
- * Clamps the rgb values by the min and max values and stores the result into "result"
829
- * @param min - defines minimum clamping value (default is 0)
830
- * @param max - defines maximum clamping value (default is 1)
831
- * @param result - defines color to store the result into.
832
- */
833
- export function clampToRef(value: ReadonlyColor4, min: number | undefined, max: number | undefined, result: MutableColor4): void;
834
- /**
835
- * Multipy an Color4 value by another and return create mutable Color4
836
- * @param color - defines the Color4 value to multiply by
837
- * @returns create mutable Color4
838
- */
839
- export function multiply(value: ReadonlyColor4, color: ReadonlyColor4): ReadonlyColor4;
840
- /**
841
- * Multipy a Color4 value by another and push the result in a reference value
842
- * @param color - defines the Color4 value to multiply by
843
- * @param result - defines the Color4 to fill the result in
844
- * @returns the result Color4
845
- */
846
- export function multiplyToRef(value: ReadonlyColor4, color: ReadonlyColor4, result: MutableColor4): void;
847
- /**
848
- * Creates a string with the Color4 current values
849
- * @returns the string representation of the Color4 object
850
- */
851
- export function toString(value: ReadonlyColor4): string;
852
- /**
853
- * Compute the Color4 hash code
854
- * @returns an unique number that can be used to hash Color4 objects
855
- */
856
- export function getHashCode(value: ReadonlyColor4): number;
857
- /**
858
- * Creates a Color4 copied from the current one
859
- * @returns create mutable Color4
860
- */
861
- export function clone(value: ReadonlyColor4): MutableColor4;
862
- /**
863
- * Copies the given Color4 values into the destination
864
- * @param source - defines the source Color4 object
865
- * @param dest - defines the destination Color4 object
866
- * @returns
867
- */
868
- export function copyFrom(source: ReadonlyColor4, dest: MutableColor4): void;
869
- /**
870
- * Copies the given float values into the current one
871
- * @param r - defines the red component to read from
872
- * @param g - defines the green component to read from
873
- * @param b - defines the blue component to read from
874
- * @param a - defines the alpha component to read from
875
- * @returns the current updated Color4 object
876
- */
877
- export function copyFromFloats(r: number, g: number, b: number, a: number, dest: MutableColor4): void;
878
- /**
879
- * Copies the given float values into the current one
880
- * @param r - defines the red component to read from
881
- * @param g - defines the green component to read from
882
- * @param b - defines the blue component to read from
883
- * @param a - defines the alpha component to read from
884
- * @returns the current updated Color4 object
885
- */
886
- export function set(r: number, g: number, b: number, a: number, dest: MutableColor4): void;
887
- /**
888
- * Compute the Color4 hexadecimal code as a string
889
- * @returns a string containing the hexadecimal representation of the Color4 object
890
- */
891
- export function toHexString(value: ReadonlyColor4): string;
892
- /**
893
- * Computes a Color4 converted from the current one to linear space
894
- * @returns create mutable Color4
895
- */
896
- export function toLinearSpace(value: ReadonlyColor4): MutableColor4;
897
- /**
898
- * Converts the Color4 values to linear space and stores the result in "convertedColor"
899
- * @param convertedColor - defines the Color4 object where to store the linear space version
900
- * @returns the unmodified Color4
901
- */
902
- export function toLinearSpaceToRef(value: ReadonlyColor4, ref: MutableColor4): void;
903
- /**
904
- * Computes a Color4 converted from the current one to gamma space
905
- * @returns create mutable Color4
906
- */
907
- export function toGammaSpace(value: ReadonlyColor4): ReadonlyColor4;
908
- /**
909
- * Converts the Color4 values to gamma space and stores the result in "convertedColor"
910
- * @param convertedColor - defines the Color4 object where to store the gamma space version
911
- * @returns the unmodified Color4
912
- */
913
- export function toGammaSpaceToRef(value: ReadonlyColor4, convertedColor: MutableColor4): void;
914
- }
915
-
916
- /**
917
- * @public
918
- */
919
- declare type Color4Type = {
920
- r: number;
921
- g: number;
922
- b: number;
923
- a: number;
924
- };
925
-
926
- /**
927
- * @public
928
- */
929
- declare type ComponentDefinition<T extends ISchema = ISchema<any>, ConstructorType = ComponentType<T>> = {
930
- _id: number;
931
- /**
932
- * Return the default value of the current component
933
- */
934
- default(): DeepReadonly<ComponentType<T>>;
935
- /**
936
- * Get if the entity has this component
937
- * @param entity
938
- *
939
- * Example:
940
- * ```ts
941
- * const myEntity = engine.addEntity()
942
- * Transform.has(myEntity) // return false
943
- * Transform.create(myEntity)
944
- * Transform.has(myEntity) // return true
945
- * ```
946
- */
947
- has(entity: Entity): boolean;
948
- /**
949
- * Get the readonly component of the entity (to mutate it, use getMutable instead), throw an error if the entity doesn't have the component.
950
- * @param entity
951
- * @return
952
- * Example:
953
- * ```ts
954
- * const myEntity = engine.addEntity()
955
- * Transform.create(myEntity)
956
- * const transform = Transform.get(myEntity) // return true
957
- * log(transform.position.x === 0) // log 'true'
958
- *
959
- * transform.position.y = 10 // illegal statement, to mutate the component use getMutable
960
- * ```
961
- *
962
- * ```ts
963
- * const otherEntity = engine.addEntity()
964
- * Transform.get(otherEntity) // throw an error!!
965
- * ```
966
- */
967
- get(entity: Entity): DeepReadonly<ComponentType<T>>;
968
- /**
969
- * Get the readonly component of the entity (to mutate it, use getMutable instead), or null if the entity doesn't have the component.
970
- * @param entity
971
- * @return
972
- *
973
- * Example:
974
- * ```ts
975
- * const otherEntity = engine.addEntity()
976
- * log(Transform.get(otherEntity) === null) // log 'true'
977
- * ```
978
- */
979
- getOrNull(entity: Entity): DeepReadonly<ComponentType<T>> | null;
980
- /**
981
- * Add the current component to an entity, throw an error if the component already exists (use `createOrReplace` instead).
982
- * - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
983
- * @param entity
984
- * @param val The initial value
985
- *
986
- * Example:
987
- * ```ts
988
- * const myEntity = engine.addEntity()
989
- * Transform.create(myEntity, { ...Transform.default(), position: {x: 4, y: 0, z: 4} }) // ok!
990
- * Transform.create(myEntity) // throw an error, the `Transform` component already exists in `myEntity`
991
- * ````
992
- */
993
- create(entity: Entity, val?: ConstructorType): ComponentType<T>;
994
- /**
995
- * Add the current component to an entity or replace the content if the entity already has the component
996
- * - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
997
- * @param entity
998
- * @param val The initial or new value
999
- *
1000
- * Example:
1001
- * ```ts
1002
- * const myEntity = engine.addEntity()
1003
- * Transform.create(myEntity) // ok!
1004
- * Transform.createOrReplace(myEntity, { ...Transform.default(), position: {x: 4, y: 0, z: 4} }) // ok!
1005
- * ````
1006
- */
1007
- createOrReplace(entity: Entity, val?: ConstructorType): ComponentType<T>;
1008
- /**
1009
- * Delete the current component to an entity, return null if the entity doesn't have the current component.
1010
- * - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
1011
- * @param entity
1012
- *
1013
- * Example:
1014
- * ```ts
1015
- * const myEntity = engine.addEntity()
1016
- * Transform.create(myEntity) // ok!
1017
- * Transform.deleteFrom(myEntity) // return the component
1018
- * Transform.deleteFrom(myEntity) // return null
1019
- * ````
1020
- */
1021
- deleteFrom(entity: Entity): ComponentType<T> | null;
1022
- /**
1023
- * Get the mutable component of the entity, throw an error if the entity doesn't have the component.
1024
- * - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
1025
- * @param entity
1026
- *
1027
- * Example:
1028
- * ```ts
1029
- * const myEntity = engine.addEntity()
1030
- * Transform.create(myEntity)
1031
- * Transform.getMutable(myEntity).position = {x: 4, y: 0, z: 4}
1032
- * ````
1033
- */
1034
- getMutable(entity: Entity): ComponentType<T>;
1035
- /**
1036
- * Get the mutable component of the entity, return null if the entity doesn't have the component.
1037
- * - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
1038
- * @param entity
1039
- *
1040
- * Example:
1041
- * ```ts
1042
- * const transform = Transform.getMutableOrNull(myEntity)
1043
- * if (transform) {
1044
- * transform.position = {x: 4, y: 0, z: 4}
1045
- * }
1046
- * ````
1047
- */
1048
- getMutableOrNull(entity: Entity): ComponentType<T> | null;
1049
- writeToByteBuffer(entity: Entity, buffer: ByteBuffer): void;
1050
- };
1051
-
1052
- /** @public */
1053
- declare namespace Components {
1054
- /** @public */
1055
- const Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
1056
- /** @public */
1057
- const Animator: AnimatorComponentDefinitionExtended;
1058
- /** @public */
1059
- const AudioSource: ComponentDefinition<ISchema<PBAudioSource>, PBAudioSource>;
1060
- /** @public */
1061
- const AudioStream: ComponentDefinition<ISchema<PBAudioStream>, PBAudioStream>;
1062
- /** @public */
1063
- const AvatarAttach: ComponentDefinition<ISchema<PBAvatarAttach>, PBAvatarAttach>;
1064
- /** @public */
1065
- const AvatarModifierArea: ComponentDefinition<ISchema<PBAvatarModifierArea>, PBAvatarModifierArea>;
1066
- /** @public */
1067
- const AvatarShape: ComponentDefinition<ISchema<PBAvatarShape>, PBAvatarShape>;
1068
- /** @public */
1069
- const Billboard: ComponentDefinition<ISchema<PBBillboard>, PBBillboard>;
1070
- /** @public */
1071
- const CameraMode: ComponentDefinition<ISchema<PBCameraMode>, PBCameraMode>;
1072
- /** @public */
1073
- const CameraModeArea: ComponentDefinition<ISchema<PBCameraModeArea>, PBCameraModeArea>;
1074
- /** @public */
1075
- const GltfContainer: ComponentDefinition<ISchema<PBGltfContainer>, PBGltfContainer>;
1076
- /** @public */
1077
- const Material: MaterialComponentDefinitionExtended;
1078
- /** @public */
1079
- const MeshCollider: MeshColliderComponentDefinitionExtended;
1080
- /** @public */
1081
- const MeshRenderer: MeshRendererComponentDefinitionExtended;
1082
- /** @public */
1083
- const NftShape: ComponentDefinition<ISchema<PBNftShape>, PBNftShape>;
1084
- /** @public */
1085
- const PointerEventsResult: ComponentDefinition<ISchema<PBPointerEventsResult>, PBPointerEventsResult>;
1086
- /** @public */
1087
- const PointerHoverFeedback: ComponentDefinition<ISchema<PBPointerHoverFeedback>, PBPointerHoverFeedback>;
1088
- /** @public */
1089
- const PointerLock: ComponentDefinition<ISchema<PBPointerLock>, PBPointerLock>;
1090
- /** @public */
1091
- const Raycast: ComponentDefinition<ISchema<PBRaycast>, PBRaycast>;
1092
- /** @public */
1093
- const RaycastResult: ComponentDefinition<ISchema<PBRaycastResult>, PBRaycastResult>;
1094
- /** @public */
1095
- const TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
1096
- /** @public */
1097
- const UiBackground: ComponentDefinition<ISchema<PBUiBackground>, PBUiBackground>;
1098
- /** @public */
1099
- const UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
1100
- /** @public */
1101
- const UiTransform: ComponentDefinition<ISchema<PBUiTransform>, PBUiTransform>;
1102
- /** @public */
1103
- const VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
1104
- }
1105
-
1106
- /**
1107
- * @public
1108
- */
1109
- declare type ComponentSchema<T extends [ComponentDefinition, ...ComponentDefinition[]]> = {
1110
- [K in keyof T]: T[K] extends ComponentDefinition ? ReturnType<T[K]['getMutable']> : never;
1111
- };
1112
-
1113
- /**
1114
- * @public
1115
- */
1116
- declare type ComponentType<T extends ISchema> = EcsResult<T>;
1117
-
1118
- /**
1119
- * Transform parenting: cyclic dependency checker
1120
- * It checks only in modified Transforms
1121
- *
1122
- * Add this system with:
1123
- * ```ts
1124
- * engine.addSystem(cyclicParentingChecker(engine))
1125
- * ````
1126
- * And then it will check every tick the parenting.
1127
- *
1128
- * @public
1129
- *
1130
- * @params engine
1131
- * @returns a system
1132
- */
1133
- declare function cyclicParentingChecker(engine: IEngine): () => void;
1134
-
1135
- /**
1136
- * @public
1137
- */
1138
- declare type DeepReadonly<T> = T extends ReadonlyPrimitive ? T : T extends Map<infer K, infer V> ? DeepReadonlyMap<K, V> : T extends Set<infer M> ? DeepReadonlySet<M> : DeepReadonlyObject<T>;
1139
-
1140
- /**
1141
- * @public
1142
- */
1143
- declare type DeepReadonlyMap<K, V> = ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>;
1144
-
1145
- /**
1146
- * @public
1147
- */
1148
- declare type DeepReadonlyObject<T> = {
1149
- readonly [K in keyof T]: DeepReadonly<T[K]>;
1150
- };
1151
-
1152
- /**
1153
- * @public
1154
- */
1155
- declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
1156
-
1157
- declare function defineComponent<T extends ISchema, ConstructorType = ComponentType<T>>(componentId: number, spec: T, constructorDefault?: ConstructorType): ComponentDefinition<T, ConstructorType>;
1158
-
1159
- declare function defineLibraryComponents({ defineComponentFromSchema }: Pick<IEngine, 'defineComponentFromSchema'>): {
1160
- Animator: ComponentDefinition<ISchema<PBAnimator>, PBAnimator>;
1161
- AudioSource: ComponentDefinition<ISchema<PBAudioSource>, PBAudioSource>;
1162
- AudioStream: ComponentDefinition<ISchema<PBAudioStream>, PBAudioStream>;
1163
- AvatarAttach: ComponentDefinition<ISchema<PBAvatarAttach>, PBAvatarAttach>;
1164
- AvatarModifierArea: ComponentDefinition<ISchema<PBAvatarModifierArea>, PBAvatarModifierArea>;
1165
- AvatarShape: ComponentDefinition<ISchema<PBAvatarShape>, PBAvatarShape>;
1166
- Billboard: ComponentDefinition<ISchema<PBBillboard>, PBBillboard>;
1167
- CameraMode: ComponentDefinition<ISchema<PBCameraMode>, PBCameraMode>;
1168
- CameraModeArea: ComponentDefinition<ISchema<PBCameraModeArea>, PBCameraModeArea>;
1169
- GltfContainer: ComponentDefinition<ISchema<PBGltfContainer>, PBGltfContainer>;
1170
- Material: ComponentDefinition<ISchema<PBMaterial>, PBMaterial>;
1171
- MeshCollider: ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
1172
- MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, PBMeshRenderer>;
1173
- NftShape: ComponentDefinition<ISchema<PBNftShape>, PBNftShape>;
1174
- PointerEventsResult: ComponentDefinition<ISchema<PBPointerEventsResult>, PBPointerEventsResult>;
1175
- PointerHoverFeedback: ComponentDefinition<ISchema<PBPointerHoverFeedback>, PBPointerHoverFeedback>;
1176
- PointerLock: ComponentDefinition<ISchema<PBPointerLock>, PBPointerLock>;
1177
- Raycast: ComponentDefinition<ISchema<PBRaycast>, PBRaycast>;
1178
- RaycastResult: ComponentDefinition<ISchema<PBRaycastResult>, PBRaycastResult>;
1179
- TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
1180
- UiBackground: ComponentDefinition<ISchema<PBUiBackground>, PBUiBackground>;
1181
- UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
1182
- UiTransform: ComponentDefinition<ISchema<PBUiTransform>, PBUiTransform>;
1183
- VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
1184
- };
1185
-
1186
- declare function defineSdkComponents(engine: Pick<IEngine, 'defineComponentFromSchema' | 'getComponent'>): {
1187
- Material: MaterialComponentDefinitionExtended;
1188
- Animator: AnimatorComponentDefinitionExtended;
1189
- MeshRenderer: MeshRendererComponentDefinitionExtended;
1190
- MeshCollider: MeshColliderComponentDefinitionExtended;
1191
- Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
1192
- AudioSource: ComponentDefinition<ISchema<PBAudioSource>, PBAudioSource>;
1193
- AudioStream: ComponentDefinition<ISchema<PBAudioStream>, PBAudioStream>;
1194
- AvatarAttach: ComponentDefinition<ISchema<PBAvatarAttach>, PBAvatarAttach>;
1195
- AvatarModifierArea: ComponentDefinition<ISchema<PBAvatarModifierArea>, PBAvatarModifierArea>;
1196
- AvatarShape: ComponentDefinition<ISchema<PBAvatarShape>, PBAvatarShape>;
1197
- Billboard: ComponentDefinition<ISchema<PBBillboard>, PBBillboard>;
1198
- CameraMode: ComponentDefinition<ISchema<PBCameraMode>, PBCameraMode>;
1199
- CameraModeArea: ComponentDefinition<ISchema<PBCameraModeArea>, PBCameraModeArea>;
1200
- GltfContainer: ComponentDefinition<ISchema<PBGltfContainer>, PBGltfContainer>;
1201
- NftShape: ComponentDefinition<ISchema<PBNftShape>, PBNftShape>;
1202
- PointerEventsResult: ComponentDefinition<ISchema<PBPointerEventsResult>, PBPointerEventsResult>;
1203
- PointerHoverFeedback: ComponentDefinition<ISchema<PBPointerHoverFeedback>, PBPointerHoverFeedback>;
1204
- PointerLock: ComponentDefinition<ISchema<PBPointerLock>, PBPointerLock>;
1205
- Raycast: ComponentDefinition<ISchema<PBRaycast>, PBRaycast>;
1206
- RaycastResult: ComponentDefinition<ISchema<PBRaycastResult>, PBRaycastResult>;
1207
- TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
1208
- UiBackground: ComponentDefinition<ISchema<PBUiBackground>, PBUiBackground>;
1209
- UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
1210
- UiTransform: ComponentDefinition<ISchema<PBUiTransform>, PBUiTransform>;
1211
- VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
1212
- };
1213
-
1214
- /**
1215
- * Constant used to convert from Euler degrees to radians
1216
- * @public
1217
- */
1218
- declare const DEG2RAD: number;
1219
-
1220
- /**
1221
- * @public
1222
- */
1223
- declare type EcsResult<T extends ISchema> = T extends ISchema ? ReturnType<T['deserialize']> : never;
1224
-
1225
- /**
1226
- * @public
1227
- */
1228
- declare function Engine({ transports }?: IEngineParams): IEngine;
1229
-
1230
- declare const engine: IEngine;
1231
-
1232
- /**
1233
- * @public
1234
- */
1235
- declare type Entity = number & {
1236
- [entitySymbol]: true;
1237
- };
1238
-
1239
- declare const entitySymbol: unique symbol;
1240
-
1241
- /**
1242
- * Error function. Prints a console error. Only works in debug mode, otherwise it does nothing.
1243
- * @param error - string or Error object.
1244
- * @param data - any debug information.
1245
- * @public
1246
- */
1247
- declare const error: (message: string | Error, data?: any) => void;
1248
-
1249
- declare type EventsSystem = typeof EventsSystem;
1250
-
1251
- declare namespace EventsSystem {
1252
- export type Callback = (event: PBPointerEventsResult_PointerCommand) => void | Promise<void>;
1253
- export type Options = {
1254
- button?: InputAction;
1255
- hoverText?: string;
1256
- maxDistance?: number;
1257
- };
1258
- /**
1259
- * @public
1260
- * Remove the callback for onPointerDown event
1261
- * @param entity Entity where the callback was attached
1262
- */
1263
- export function removeOnPointerDown(entity: Entity): void;
1264
- /**
1265
- * @public
1266
- * Remove the callback for onPointerUp event
1267
- * @param entity Entity where the callback was attached
1268
- */
1269
- export function removeOnPointerUp(entity: Entity): void;
1270
- /**
1271
- * @public
1272
- * Execute callback when the user press the InputButton pointing at the entity
1273
- * @param entity Entity to attach the callback
1274
- * @param cb Function to execute when click fires
1275
- * @param opts Opts to trigger Feedback and Button
1276
- */
1277
- export function onPointerDown(entity: Entity, cb: Callback, opts?: Options): void;
1278
- /**
1279
- * @public
1280
- * Execute callback when the user releases the InputButton pointing at the entity
1281
- * @param entity Entity to attach the callback
1282
- * @param cb Function to execute when click fires
1283
- * @param opts Opts to trigger Feedback and Button
1284
- */
1285
- export function onPointerUp(entity: Entity, cb: Callback, opts?: Options): void;
1286
- }
1287
-
1288
- /** Excludes property keys from T where the property is assignable to U */
1289
- declare type ExcludeUndefined<T> = {
1290
- [P in keyof T]: undefined extends T[P] ? never : P;
1291
- }[keyof T];
1292
-
1293
- /**
1294
- * @public
1295
- * Execute async task
1296
- */
1297
- declare const executeTask: (task: Task<unknown>) => void;
1298
-
1299
- /** @public */
1300
- declare type FloatArray = number[];
1301
-
1302
- declare const enum Font {
1303
- F_LIBERATION_SANS = 0,
1304
- F_SANS_SERIF = 1
1305
- }
1306
-
1307
- /** @public */
1308
- declare const GltfContainer: ComponentDefinition<ISchema<PBGltfContainer>, PBGltfContainer>;
1309
-
1310
- /**
1311
- * @public
1312
- */
1313
- declare function IArray<T>(type: ISchema<T>): ISchema<Array<T>>;
1314
-
1315
- /**
1316
- * @public
1317
- */
1318
- declare type IEngine = {
1319
- /**
1320
- * Increment the used entity counter and return the next one.
1321
- * @param dynamic
1322
- * @return the next entity unused
1323
- */
1324
- addEntity(dynamic?: boolean): Entity;
1325
- /**
1326
- * An alias of engine.addEntity(true)
1327
- */
1328
- addDynamicEntity(): Entity;
1329
- /**
1330
- * Remove all components of an entity
1331
- * @param entity
1332
- */
1333
- removeEntity(entity: Entity): void;
1334
- /**
1335
- * Remove all components of each entity in the tree made with Transform parenting
1336
- * @param firstEntity - the root entity of the tree
1337
- */
1338
- removeEntityWithChildren(firstEntity: Entity): void;
1339
- /**
1340
- * Check if an entity exists in the engine
1341
- * @param entity - the entity to validate
1342
- * @returns true if the entity exists in the engine
1343
- */
1344
- entityExists(entity: Entity): boolean;
1345
- /**
1346
- * Add the system to the engine. It will be called every tick updated.
1347
- * @param system function that receives the delta time between last tick and current one.
1348
- * @param priority a number with the priority, big number are called before smaller ones
1349
- * @param name optional: a unique name to identify it
1350
- *
1351
- * Example:
1352
- * ```ts
1353
- * function mySystem(dt: number) {
1354
- * const entitiesWithMeshRenderer = engine.getEntitiesWith(MeshRenderer, Transform)
1355
- * for (const [entity, _meshRenderer, _transform] of engine.getEntitiesWith(MeshRenderer, Transform)) {
1356
- * // do stuffs
1357
- * }
1358
- * }
1359
- * engine.addSystem(mySystem, 10)
1360
- * ```
1361
- */
1362
- addSystem(system: SystemFn, priority?: number, name?: string): void;
1363
- /**
1364
- * Remove a system from the engine.
1365
- * @param selector the function or the unique name to identify
1366
- * @returns if it was found and removed
1367
- */
1368
- removeSystem(selector: string | SystemFn): boolean;
1369
- /**
1370
- * Define a component and add it to the engine.
1371
- * @param spec An object with schema fields
1372
- * @param componentId unique id to identify the component, if the component id already exist, it will fail.
1373
- * @param constructorDefault the initial value prefilled when a component is created without a value
1374
- * @return The component definition
1375
- *
1376
- * ```ts
1377
- * const DoorComponentId = 10017
1378
- * const Door = engine.defineComponent({
1379
- * id: Schemas.Int,
1380
- * name: Schemas.String
1381
- * }, DoorComponentId)
1382
- *
1383
- * ```
1384
- */
1385
- defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: ConstructorType): ComponentDefinition<ISchema<Result<T>>, Partial<Result<T>>>;
1386
- /**
1387
- * Define a component and add it to the engine.
1388
- * @param spec An object with schema fields
1389
- * @param componentId unique id to identify the component, if the component id already exist, it will fail.
1390
- * @return The component definition
1391
- *
1392
- * ```ts
1393
- * const StateComponentId = 10023
1394
- * const StateComponent = engine.defineComponent(Schemas.Bool, VisibleComponentId)
1395
- * ```
1396
- */
1397
- defineComponentFromSchema<T extends ISchema<Record<string, any>>, ConstructorType = ComponentType<T>>(spec: T, componentId: number, constructorDefault?: ConstructorType): ComponentDefinition<T, ConstructorType>;
1398
- /**
1399
- * Get the component definition from the component id.
1400
- * @param componentId
1401
- * @return the component definition, throw an error if it doesn't exist
1402
- * ```ts
1403
- * const StateComponentId = 10023
1404
- * const StateComponent = engine.getComponent(StateComponentId)
1405
- * ```
1406
- */
1407
- getComponent<T extends ISchema>(componentId: number): ComponentDefinition<T>;
1408
- /**
1409
- * Get a iterator of entities that has all the component requested.
1410
- * @param components a list of component definitions
1411
- * @return An iterator of an array with the [entity, component1, component2, ...]
1412
- *
1413
- * Example:
1414
- * ```ts
1415
- * for (const [entity, meshRenderer, transform] of engine.getEntitiesWith(MeshRenderer, Transform)) {
1416
- * // the properties of meshRenderer and transform are read only
1417
- * }
1418
- * ```
1419
- */
1420
- getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ReadonlyComponentSchema<T>]>;
1421
- /**
1422
- * @public
1423
- * Refer to the root of the scene, all Transforms without a parent are parenting with RootEntity.
1424
- */
1425
- RootEntity: Entity;
1426
- /**
1427
- * @public
1428
- * The current player entity
1429
- */
1430
- PlayerEntity: Entity;
1431
- /**
1432
- * @public
1433
- * Camera entity of current player.
1434
- */
1435
- CameraEntity: Entity;
1436
- baseComponents: ReturnType<typeof defineSdkComponents>;
1437
- };
1438
-
1439
- /**
1440
- * @public
1441
- */
1442
- declare type IEngineParams = {
1443
- transports?: Transport[];
1444
- };
1445
-
1446
- /**
1447
- * @public
1448
- */
1449
- declare function IEnum<T>(type: ISchema<any>): ISchema<T>;
1450
-
1451
- /**
1452
- * @public
1453
- */
1454
- declare type IInput = {
1455
- /**
1456
- * @public
1457
- * Check if a pointer event has been emitted in the last tick-update.
1458
- * @param inputAction - the input action to query
1459
- * @param pointerEventType - the pointer event type to query
1460
- * @param entity - the entity to query, ignore for global
1461
- * @returns boolean
1462
- */
1463
- isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity?: Entity) => boolean;
1464
- /**
1465
- * @public
1466
- * Check if an input action is currently being pressed.
1467
- * @param inputAction - the input action to query
1468
- * @returns boolean
1469
- */
1470
- isPressed: (inputAction: InputAction) => boolean;
1471
- /**
1472
- * @public
1473
- * Get the input command info if a pointer event has been emitted in the last tick-update.
1474
- * @param inputAction - the input action to query
1475
- * @param pointerEventType - the pointer event type to query
1476
- * @param entity - the entity to query, ignore for global
1477
- * @returns the input command info or undefined if there is no command in the last tick-update
1478
- */
1479
- getInputCommand: (inputAction: InputAction, pointerEventType: PointerEventType, entity?: Entity) => PBPointerEventsResult_PointerCommand | null;
1480
- };
1481
-
1482
- /**
1483
- * @public
1484
- */
1485
- declare function IMap<T extends Spec>(spec: T): ISchema<Result<T>>;
1486
-
1487
- /** Include property keys from T where the property is assignable to U */
1488
- declare type IncludeUndefined<T> = {
1489
- [P in keyof T]: undefined extends T[P] ? P : never;
1490
- }[keyof T];
1491
-
1492
- /**
1493
- * @public
1494
- */
1495
- declare const Input: IInput;
1496
-
1497
- declare const enum InputAction {
1498
- IA_POINTER = 0,
1499
- IA_PRIMARY = 1,
1500
- IA_SECONDARY = 2,
1501
- IA_ANY = 3,
1502
- IA_FORWARD = 4,
1503
- IA_BACKWARD = 5,
1504
- IA_RIGHT = 6,
1505
- IA_LEFT = 7,
1506
- IA_JUMP = 8,
1507
- IA_WALK = 9,
1508
- IA_ACTION_3 = 10,
1509
- IA_ACTION_4 = 11,
1510
- IA_ACTION_5 = 12,
1511
- IA_ACTION_6 = 13
1512
- }
1513
-
1514
- /**
1515
- * @public
1516
- */
1517
- declare function IOptional<T>(spec: ISchema<T>): ISchema<T | undefined>;
1518
-
1519
- /**
1520
- * @public
1521
- */
1522
- declare type ISchema<T = any> = {
1523
- serialize(value: T, builder: ByteBuffer): void;
1524
- deserialize(reader: ByteBuffer): T;
1525
- create(): T;
1526
- };
1527
-
1528
- /**
1529
- * Log function. Only works in debug mode, otherwise it does nothing.
1530
- * @param args - any loggable parameter
1531
- * @public
1532
- */
1533
- declare const log: (...a: any[]) => void;
1534
-
1535
- /** @public */
1536
- declare const Material: MaterialComponentDefinitionExtended;
1537
-
1538
- /**
1539
- * @public
1540
- */
1541
- declare type MaterialComponentDefinition = ComponentDefinition<ISchema<PBMaterial>, PBMaterial>;
1542
-
1543
- /**
1544
- * @public
1545
- */
1546
- declare interface MaterialComponentDefinitionExtended extends MaterialComponentDefinition {
1547
- /**
1548
- * Texture helpers with constructor
1549
- */
1550
- Texture: TextureHelper;
1551
- /**
1552
- * Create or replace the component Material in the entity specified
1553
- * @param entity - the entity to link the component
1554
- * @param material - the Unlit data for this material
1555
- */
1556
- setBasicMaterial: (entity: Entity, material: PBMaterial_UnlitMaterial) => void;
1557
- /**
1558
- * Create or replace the component Material in the entity specified
1559
- * @param entity - the entity to link the component
1560
- * @param material - the PBR data for this material
1561
- */
1562
- setPbrMaterial: (entity: Entity, material: PBMaterial_PbrMaterial) => void;
1563
- }
1564
-
1565
- declare const enum MaterialTransparencyMode {
1566
- MTM_OPAQUE = 0,
1567
- MTM_ALPHA_TEST = 1,
1568
- MTM_ALPHA_BLEND = 2,
1569
- MTM_ALPHA_TEST_AND_ALPHA_BLEND = 3,
1570
- MTM_AUTO = 4
1571
- }
1572
-
1573
- /**
1574
- * Class used to store matrix data (4x4)
1575
- * @public
1576
- */
1577
- declare namespace Matrix {
1578
- export type Matrix4x4 = [
1579
- number,
1580
- number,
1581
- number,
1582
- number,
1583
- number,
1584
- number,
1585
- number,
1586
- number,
1587
- number,
1588
- number,
1589
- number,
1590
- number,
1591
- number,
1592
- number,
1593
- number,
1594
- number
1595
- ];
1596
- export type MutableMatrix = {
1597
- /**
1598
- * Gets the update flag of the matrix which is an unique number for the matrix.
1599
- * It will be incremented every time the matrix data change.
1600
- * You can use it to speed the comparison between two versions of the same matrix.
1601
- */
1602
- updateFlag: number;
1603
- isIdentity: boolean;
1604
- isIdentity3x2: boolean;
1605
- _isIdentityDirty: boolean;
1606
- _isIdentity3x2Dirty: boolean;
1607
- _m: Matrix4x4;
1608
- };
1609
- export type ReadonlyMatrix = {
1610
- /**
1611
- * Gets the update flag of the matrix which is an unique number for the matrix.
1612
- * It will be incremented every time the matrix data change.
1613
- * You can use it to speed the comparison between two versions of the same matrix.
1614
- */
1615
- readonly updateFlag: number;
1616
- readonly isIdentity: boolean;
1617
- readonly isIdentity3x2: boolean;
1618
- readonly _isIdentityDirty: boolean;
1619
- readonly _isIdentity3x2Dirty: boolean;
1620
- readonly _m: Matrix4x4;
1621
- };
1622
- /**
1623
- * Gets the internal data of the matrix
1624
- */
1625
- export function m(self: MutableMatrix): Matrix4x4;
1626
- /**
1627
- * Gets an identity matrix that must not be updated
1628
- */
1629
- export function IdentityReadonly(): ReadonlyMatrix;
1630
- /**
1631
- * Creates an empty matrix (filled with zeros)
1632
- */
1633
- export function create(): MutableMatrix;
1634
- /**
1635
- * Creates a matrix from an array
1636
- * @param array - defines the source array
1637
- * @param offset - defines an offset in the source array
1638
- * @returns a new Matrix set from the starting index of the given array
1639
- */
1640
- export function fromArray(array: Matrix4x4, offset?: number): MutableMatrix;
1641
- /**
1642
- * Copy the content of an array into a given matrix
1643
- * @param array - defines the source array
1644
- * @param offset - defines an offset in the source array
1645
- * @param result - defines the target matrix
1646
- */
1647
- export function fromArrayToRef(array: Matrix4x4, offset: number, result: MutableMatrix): void;
1648
- /**
1649
- * Stores an array into a matrix after having multiplied each component by a given factor
1650
- * @param array - defines the source array
1651
- * @param offset - defines the offset in the source array
1652
- * @param scale - defines the scaling factor
1653
- * @param result - defines the target matrix
1654
- */
1655
- export function fromFloatArrayToRefScaled(array: FloatArray, offset: number, scale: number, result: MutableMatrix): void;
1656
- /**
1657
- * Stores a list of values (16) inside a given matrix
1658
- * @param initialM11 - defines 1st value of 1st row
1659
- * @param initialM12 - defines 2nd value of 1st row
1660
- * @param initialM13 - defines 3rd value of 1st row
1661
- * @param initialM14 - defines 4th value of 1st row
1662
- * @param initialM21 - defines 1st value of 2nd row
1663
- * @param initialM22 - defines 2nd value of 2nd row
1664
- * @param initialM23 - defines 3rd value of 2nd row
1665
- * @param initialM24 - defines 4th value of 2nd row
1666
- * @param initialM31 - defines 1st value of 3rd row
1667
- * @param initialM32 - defines 2nd value of 3rd row
1668
- * @param initialM33 - defines 3rd value of 3rd row
1669
- * @param initialM34 - defines 4th value of 3rd row
1670
- * @param initialM41 - defines 1st value of 4th row
1671
- * @param initialM42 - defines 2nd value of 4th row
1672
- * @param initialM43 - defines 3rd value of 4th row
1673
- * @param initialM44 - defines 4th value of 4th row
1674
- * @param result - defines the target matrix
1675
- */
1676
- export function fromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: MutableMatrix): void;
1677
- /**
1678
- * Creates new matrix from a list of values (16)
1679
- * @param initialM11 - defines 1st value of 1st row
1680
- * @param initialM12 - defines 2nd value of 1st row
1681
- * @param initialM13 - defines 3rd value of 1st row
1682
- * @param initialM14 - defines 4th value of 1st row
1683
- * @param initialM21 - defines 1st value of 2nd row
1684
- * @param initialM22 - defines 2nd value of 2nd row
1685
- * @param initialM23 - defines 3rd value of 2nd row
1686
- * @param initialM24 - defines 4th value of 2nd row
1687
- * @param initialM31 - defines 1st value of 3rd row
1688
- * @param initialM32 - defines 2nd value of 3rd row
1689
- * @param initialM33 - defines 3rd value of 3rd row
1690
- * @param initialM34 - defines 4th value of 3rd row
1691
- * @param initialM41 - defines 1st value of 4th row
1692
- * @param initialM42 - defines 2nd value of 4th row
1693
- * @param initialM43 - defines 3rd value of 4th row
1694
- * @param initialM44 - defines 4th value of 4th row
1695
- * @returns the new matrix
1696
- */
1697
- export function fromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): MutableMatrix;
1698
- /**
1699
- * Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3)
1700
- * @param scale - defines the scale vector3
1701
- * @param rotation - defines the rotation quaternion
1702
- * @param translation - defines the translation vector3
1703
- * @returns a new matrix
1704
- */
1705
- export function compose(scale: Vector3.ReadonlyVector3, rotation: Quaternion.ReadonlyQuaternion, translation: Vector3.ReadonlyVector3): MutableMatrix;
1706
- /**
1707
- * Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3)
1708
- * @param scale - defines the scale vector3
1709
- * @param rotation - defines the rotation quaternion
1710
- * @param translation - defines the translation vector3
1711
- * @param result - defines the target matrix
1712
- */
1713
- export function composeToRef(scale: Vector3.ReadonlyVector3, rotation: Quaternion.ReadonlyQuaternion, translation: Vector3.ReadonlyVector3, result: MutableMatrix): void;
1714
- /**
1715
- * Creates a new identity matrix
1716
- * @returns a new identity matrix
1717
- */
1718
- export function Identity(): MutableMatrix;
1719
- /**
1720
- * Creates a new identity matrix and stores the result in a given matrix
1721
- * @param result - defines the target matrix
1722
- */
1723
- export function IdentityToRef(result: MutableMatrix): void;
1724
- /**
1725
- * Creates a new zero matrix
1726
- * @returns a new zero matrix
1727
- */
1728
- export function Zero(): MutableMatrix;
1729
- /**
1730
- * Creates a new rotation matrix for "angle" radians around the X axis
1731
- * @param angle - defines the angle (in radians) to use
1732
- * @returns the new matrix
1733
- */
1734
- export function RotationX(angle: number): MutableMatrix;
1735
- /**
1736
- * Creates a new rotation matrix for "angle" radians around the X axis and stores it in a given matrix
1737
- * @param angle - defines the angle (in radians) to use
1738
- * @param result - defines the target matrix
1739
- */
1740
- export function rotationXToRef(angle: number, result: MutableMatrix): void;
1741
- /**
1742
- * Creates a new rotation matrix for "angle" radians around the Y axis
1743
- * @param angle - defines the angle (in radians) to use
1744
- * @returns the new matrix
1745
- */
1746
- export function rotationY(angle: number): MutableMatrix;
1747
- /**
1748
- * Creates a new rotation matrix for "angle" radians around the Y axis and stores it in a given matrix
1749
- * @param angle - defines the angle (in radians) to use
1750
- * @param result - defines the target matrix
1751
- */
1752
- export function rotationYToRef(angle: number, result: MutableMatrix): void;
1753
- /**
1754
- * Creates a new rotation matrix for "angle" radians around the Z axis
1755
- * @param angle - defines the angle (in radians) to use
1756
- * @returns the new matrix
1757
- */
1758
- export function rotationZ(angle: number): MutableMatrix;
1759
- /**
1760
- * Creates a new rotation matrix for "angle" radians around the Z axis and stores it in a given matrix
1761
- * @param angle - defines the angle (in radians) to use
1762
- * @param result - defines the target matrix
1763
- */
1764
- export function rotationZToRef(angle: number, result: MutableMatrix): void;
1765
- /**
1766
- * Creates a new rotation matrix for "angle" radians around the given axis
1767
- * @param axis - defines the axis to use
1768
- * @param angle - defines the angle (in radians) to use
1769
- * @returns the new matrix
1770
- */
1771
- export function rotationAxis(axis: Vector3.ReadonlyVector3, angle: number): MutableMatrix;
1772
- /**
1773
- * Creates a new rotation matrix for "angle" radians around the given axis and stores it in a given matrix
1774
- * @param axis - defines the axis to use
1775
- * @param angle - defines the angle (in radians) to use
1776
- * @param result - defines the target matrix
1777
- */
1778
- export function rotationAxisToRef(_axis: Vector3.ReadonlyVector3, angle: number, result: MutableMatrix): void;
1779
- /**
1780
- * Creates a rotation matrix
1781
- * @param yaw - defines the yaw angle in radians (Y axis)
1782
- * @param pitch - defines the pitch angle in radians (X axis)
1783
- * @param roll - defines the roll angle in radians (X axis)
1784
- * @returns the new rotation matrix
1785
- */
1786
- export function rotationYawPitchRoll(yaw: number, pitch: number, roll: number): MutableMatrix;
1787
- /**
1788
- * Creates a rotation matrix and stores it in a given matrix
1789
- * @param yaw - defines the yaw angle in radians (Y axis)
1790
- * @param pitch - defines the pitch angle in radians (X axis)
1791
- * @param roll - defines the roll angle in radians (X axis)
1792
- * @param result - defines the target matrix
1793
- */
1794
- export function rotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: MutableMatrix): void;
1795
- /**
1796
- * Creates a scaling matrix
1797
- * @param x - defines the scale factor on X axis
1798
- * @param y - defines the scale factor on Y axis
1799
- * @param z - defines the scale factor on Z axis
1800
- * @returns the new matrix
1801
- */
1802
- export function scaling(x: number, y: number, z: number): MutableMatrix;
1803
- /**
1804
- * Creates a scaling matrix and stores it in a given matrix
1805
- * @param x - defines the scale factor on X axis
1806
- * @param y - defines the scale factor on Y axis
1807
- * @param z - defines the scale factor on Z axis
1808
- * @param result - defines the target matrix
1809
- */
1810
- export function scalingToRef(x: number, y: number, z: number, result: MutableMatrix): void;
1811
- /**
1812
- * Creates a translation matrix
1813
- * @param x - defines the translation on X axis
1814
- * @param y - defines the translation on Y axis
1815
- * @param z - defines the translationon Z axis
1816
- * @returns the new matrix
1817
- */
1818
- export function translation(x: number, y: number, z: number): MutableMatrix;
1819
- /**
1820
- * Creates a translation matrix and stores it in a given matrix
1821
- * @param x - defines the translation on X axis
1822
- * @param y - defines the translation on Y axis
1823
- * @param z - defines the translationon Z axis
1824
- * @param result - defines the target matrix
1825
- */
1826
- export function translationToRef(x: number, y: number, z: number, result: MutableMatrix): void;
1827
- /**
1828
- * Returns a new Matrix whose values are the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue".
1829
- * @param startValue - defines the start value
1830
- * @param endValue - defines the end value
1831
- * @param gradient - defines the gradient factor
1832
- * @returns the new matrix
1833
- */
1834
- export function lerp(startValue: ReadonlyMatrix, endValue: ReadonlyMatrix, gradient: number): MutableMatrix;
1835
- /**
1836
- * Set the given matrix "result" as the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue".
1837
- * @param startValue - defines the start value
1838
- * @param endValue - defines the end value
1839
- * @param gradient - defines the gradient factor
1840
- * @param result - defines the Matrix object where to store data
1841
- */
1842
- export function lerpToRef(startValue: ReadonlyMatrix, endValue: ReadonlyMatrix, gradient: number, result: MutableMatrix): void;
1843
- /**
1844
- * Builds a new matrix whose values are computed by:
1845
- * * decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices
1846
- * * interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end
1847
- * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices
1848
- * @param startValue - defines the first matrix
1849
- * @param endValue - defines the second matrix
1850
- * @param gradient - defines the gradient between the two matrices
1851
- * @returns the new matrix
1852
- */
1853
- export function decomposeLerp(startValue: ReadonlyMatrix, endValue: ReadonlyMatrix, gradient: number): MutableMatrix;
1854
- /**
1855
- * Update a matrix to values which are computed by:
1856
- * * decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices
1857
- * * interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end
1858
- * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices
1859
- * @param startValue - defines the first matrix
1860
- * @param endValue - defines the second matrix
1861
- * @param gradient - defines the gradient between the two matrices
1862
- * @param result - defines the target matrix
1863
- */
1864
- export function decomposeLerpToRef(startValue: ReadonlyMatrix, endValue: ReadonlyMatrix, gradient: number, result: MutableMatrix): void;
1865
- /**
1866
- * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up"
1867
- * self function works in left handed mode
1868
- * @param eye - defines the final position of the entity
1869
- * @param target - defines where the entity should look at
1870
- * @param up - defines the up vector for the entity
1871
- * @returns the new matrix
1872
- */
1873
- export function LookAtLH(eye: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, up: Vector3.ReadonlyVector3): MutableMatrix;
1874
- /**
1875
- * Sets the given "result" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up".
1876
- * self function works in left handed mode
1877
- * @param eye - defines the final position of the entity
1878
- * @param target - defines where the entity should look at
1879
- * @param up - defines the up vector for the entity
1880
- * @param result - defines the target matrix
1881
- */
1882
- export function lookAtLHToRef(eye: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, up: Vector3.ReadonlyVector3, result: MutableMatrix): void;
1883
- /**
1884
- * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up"
1885
- * self function works in right handed mode
1886
- * @param eye - defines the final position of the entity
1887
- * @param target - defines where the entity should look at
1888
- * @param up - defines the up vector for the entity
1889
- * @returns the new matrix
1890
- */
1891
- export function lookAtRH(eye: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, up: Vector3.ReadonlyVector3): MutableMatrix;
1892
- /**
1893
- * Sets the given "result" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up".
1894
- * self function works in right handed mode
1895
- * @param eye - defines the final position of the entity
1896
- * @param target - defines where the entity should look at
1897
- * @param up - defines the up vector for the entity
1898
- * @param result - defines the target matrix
1899
- */
1900
- export function lookAtRHToRef(eye: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, up: Vector3.ReadonlyVector3, result: MutableMatrix): void;
1901
- /**
1902
- * Create a left-handed orthographic projection matrix
1903
- * @param width - defines the viewport width
1904
- * @param height - defines the viewport height
1905
- * @param znear - defines the near clip plane
1906
- * @param zfar - defines the far clip plane
1907
- * @returns a new matrix as a left-handed orthographic projection matrix
1908
- */
1909
- export function orthoLH(width: number, height: number, znear: number, zfar: number): MutableMatrix;
1910
- /**
1911
- * Store a left-handed orthographic projection to a given matrix
1912
- * @param width - defines the viewport width
1913
- * @param height - defines the viewport height
1914
- * @param znear - defines the near clip plane
1915
- * @param zfar - defines the far clip plane
1916
- * @param result - defines the target matrix
1917
- */
1918
- export function orthoLHToRef(width: number, height: number, znear: number, zfar: number, result: MutableMatrix): void;
1919
- /**
1920
- * Create a left-handed orthographic projection matrix
1921
- * @param left - defines the viewport left coordinate
1922
- * @param right - defines the viewport right coordinate
1923
- * @param bottom - defines the viewport bottom coordinate
1924
- * @param top - defines the viewport top coordinate
1925
- * @param znear - defines the near clip plane
1926
- * @param zfar - defines the far clip plane
1927
- * @returns a new matrix as a left-handed orthographic projection matrix
1928
- */
1929
- export function OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): MutableMatrix;
1930
- /**
1931
- * Stores a left-handed orthographic projection into a given matrix
1932
- * @param left - defines the viewport left coordinate
1933
- * @param right - defines the viewport right coordinate
1934
- * @param bottom - defines the viewport bottom coordinate
1935
- * @param top - defines the viewport top coordinate
1936
- * @param znear - defines the near clip plane
1937
- * @param zfar - defines the far clip plane
1938
- * @param result - defines the target matrix
1939
- */
1940
- export function orthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: MutableMatrix): void;
1941
- /**
1942
- * Creates a right-handed orthographic projection matrix
1943
- * @param left - defines the viewport left coordinate
1944
- * @param right - defines the viewport right coordinate
1945
- * @param bottom - defines the viewport bottom coordinate
1946
- * @param top - defines the viewport top coordinate
1947
- * @param znear - defines the near clip plane
1948
- * @param zfar - defines the far clip plane
1949
- * @returns a new matrix as a right-handed orthographic projection matrix
1950
- */
1951
- export function orthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): MutableMatrix;
1952
- /**
1953
- * Stores a right-handed orthographic projection into a given matrix
1954
- * @param left - defines the viewport left coordinate
1955
- * @param right - defines the viewport right coordinate
1956
- * @param bottom - defines the viewport bottom coordinate
1957
- * @param top - defines the viewport top coordinate
1958
- * @param znear - defines the near clip plane
1959
- * @param zfar - defines the far clip plane
1960
- * @param result - defines the target matrix
1961
- */
1962
- export function orthoOffCenterRHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: MutableMatrix): void;
1963
- /**
1964
- * Creates a left-handed perspective projection matrix
1965
- * @param width - defines the viewport width
1966
- * @param height - defines the viewport height
1967
- * @param znear - defines the near clip plane
1968
- * @param zfar - defines the far clip plane
1969
- * @returns a new matrix as a left-handed perspective projection matrix
1970
- */
1971
- export function perspectiveLH(width: number, height: number, znear: number, zfar: number): MutableMatrix;
1972
- /**
1973
- * Creates a left-handed perspective projection matrix
1974
- * @param fov - defines the horizontal field of view
1975
- * @param aspect - defines the aspect ratio
1976
- * @param znear - defines the near clip plane
1977
- * @param zfar - defines the far clip plane
1978
- * @returns a new matrix as a left-handed perspective projection matrix
1979
- */
1980
- export function perspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): MutableMatrix;
1981
- /**
1982
- * Stores a left-handed perspective projection into a given matrix
1983
- * @param fov - defines the horizontal field of view
1984
- * @param aspect - defines the aspect ratio
1985
- * @param znear - defines the near clip plane
1986
- * @param zfar - defines the far clip plane
1987
- * @param result - defines the target matrix
1988
- * @param isVerticalFovFixed - defines it the fov is vertically fixed (default) or horizontally
1989
- */
1990
- export function perspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: MutableMatrix, isVerticalFovFixed?: boolean): void;
1991
- /**
1992
- * Creates a right-handed perspective projection matrix
1993
- * @param fov - defines the horizontal field of view
1994
- * @param aspect - defines the aspect ratio
1995
- * @param znear - defines the near clip plane
1996
- * @param zfar - defines the far clip plane
1997
- * @returns a new matrix as a right-handed perspective projection matrix
1998
- */
1999
- export function PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): MutableMatrix;
2000
- /**
2001
- * Stores a right-handed perspective projection into a given matrix
2002
- * @param fov - defines the horizontal field of view
2003
- * @param aspect - defines the aspect ratio
2004
- * @param znear - defines the near clip plane
2005
- * @param zfar - defines the far clip plane
2006
- * @param result - defines the target matrix
2007
- * @param isVerticalFovFixed - defines it the fov is vertically fixed (default) or horizontally
2008
- */
2009
- export function perspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: MutableMatrix, isVerticalFovFixed?: boolean): void;
2010
- /**
2011
- * Stores a perspective projection for WebVR info a given matrix
2012
- * @param fov - defines the field of view
2013
- * @param znear - defines the near clip plane
2014
- * @param zfar - defines the far clip plane
2015
- * @param result - defines the target matrix
2016
- * @param rightHanded - defines if the matrix must be in right-handed mode (false by default)
2017
- */
2018
- export function perspectiveFovWebVRToRef(fov: {
2019
- upDegrees: number;
2020
- downDegrees: number;
2021
- leftDegrees: number;
2022
- rightDegrees: number;
2023
- }, znear: number, zfar: number, result: MutableMatrix, rightHanded?: boolean): void;
2024
- /**
2025
- * Extracts a 2x2 matrix from a given matrix and store the result in a FloatArray
2026
- * @param matrix - defines the matrix to use
2027
- * @returns a new FloatArray array with 4 elements : the 2x2 matrix extracted from the given matrix
2028
- */
2029
- export function GetAsMatrix2x2(matrix: ReadonlyMatrix): FloatArray;
2030
- /**
2031
- * Extracts a 3x3 matrix from a given matrix and store the result in a FloatArray
2032
- * @param matrix - defines the matrix to use
2033
- * @returns a new FloatArray array with 9 elements : the 3x3 matrix extracted from the given matrix
2034
- */
2035
- export function GetAsMatrix3x3(matrix: ReadonlyMatrix): FloatArray;
2036
- /**
2037
- * Compute the transpose of a given matrix
2038
- * @param matrix - defines the matrix to transpose
2039
- * @returns the new matrix
2040
- */
2041
- export function transpose(matrix: ReadonlyMatrix): MutableMatrix;
2042
- /**
2043
- * Compute the transpose of a matrix and store it in a target matrix
2044
- * @param matrix - defines the matrix to transpose
2045
- * @param result - defines the target matrix
2046
- */
2047
- export function transposeToRef(matrix: ReadonlyMatrix, result: MutableMatrix): void;
2048
- /**
2049
- * Computes a reflection matrix from a plane
2050
- * @param plane - defines the reflection plane
2051
- * @returns a new matrix
2052
- */
2053
- export function reflection(plane: Plane.ReadonlyPlane): MutableMatrix;
2054
- /**
2055
- * Computes a reflection matrix from a plane
2056
- * @param plane - defines the reflection plane
2057
- * @param result - defines the target matrix
2058
- */
2059
- export function reflectionToRef(_plane: Plane.ReadonlyPlane, result: MutableMatrix): void;
2060
- /**
2061
- * Sets the given matrix as a rotation matrix composed from the 3 left handed axes
2062
- * @param xaxis - defines the value of the 1st axis
2063
- * @param yaxis - defines the value of the 2nd axis
2064
- * @param zaxis - defines the value of the 3rd axis
2065
- * @param result - defines the target matrix
2066
- */
2067
- export function fromXYZAxesToRef(xaxis: Vector3.ReadonlyVector3, yaxis: Vector3.ReadonlyVector3, zaxis: Vector3.ReadonlyVector3, result: MutableMatrix): void;
2068
- /**
2069
- * Creates a rotation matrix from a quaternion and stores it in a target matrix
2070
- * @param quat - defines the quaternion to use
2071
- * @param result - defines the target matrix
2072
- */
2073
- export function fromQuaternionToRef(quat: Quaternion.ReadonlyQuaternion, result: MutableMatrix): void;
2074
- /**
2075
- * Check if the current matrix is identity
2076
- * @returns true is the matrix is the identity matrix
2077
- */
2078
- export function isIdentityUpdate(self: MutableMatrix): boolean;
2079
- /**
2080
- * Check if the current matrix is identity as a texture matrix (3x2 store in 4x4)
2081
- * @returns true is the matrix is the identity matrix
2082
- */
2083
- export function isIdentityAs3x2Update(self: MutableMatrix): boolean;
2084
- /**
2085
- * Gets the determinant of the matrix
2086
- * @returns the matrix determinant
2087
- */
2088
- export function determinant(self: ReadonlyMatrix): number;
2089
- /**
2090
- * Returns the matrix as a FloatArray
2091
- * @returns the matrix underlying array
2092
- */
2093
- export function toArray(self: ReadonlyMatrix): Matrix4x4;
2094
- /**
2095
- * Returns the matrix as a FloatArray
2096
- * @returns the matrix underlying array.
2097
- */
2098
- export function asArray(self: ReadonlyMatrix): Matrix4x4;
2099
- /**
2100
- * Sets all the matrix elements to zero
2101
- * @returns the current matrix
2102
- */
2103
- export function reset(self: MutableMatrix): void;
2104
- /**
2105
- * Adds the current matrix with a second one
2106
- * @param other - defines the matrix to add
2107
- * @returns a new matrix as the addition of the current matrix and the given one
2108
- */
2109
- export function add(self: ReadonlyMatrix, other: ReadonlyMatrix): MutableMatrix;
2110
- /**
2111
- * Sets the given matrix "result" to the addition of the current matrix and the given one
2112
- * @param other - defines the matrix to add
2113
- * @param result - defines the target matrix
2114
- * @returns the current matrix
2115
- */
2116
- export function addToRef(self: ReadonlyMatrix, other: ReadonlyMatrix, result: MutableMatrix): void;
2117
- /**
2118
- * Adds in place the given matrix to the current matrix
2119
- * @param other - defines the second operand
2120
- * @returns the current updated matrix
2121
- */
2122
- export function addToSelf(self: MutableMatrix, other: ReadonlyMatrix): void;
2123
- /**
2124
- * Creates a new matrix as the invert of a given matrix
2125
- * @param source - defines the source matrix
2126
- * @returns the new matrix
2127
- */
2128
- export function invert(source: ReadonlyMatrix): MutableMatrix;
2129
- /**
2130
- * Sets the given matrix to the current inverted Matrix
2131
- * @param other - defines the target matrix
2132
- * @returns the unmodified current matrix
2133
- */
2134
- export function invertToRef(source: ReadonlyMatrix, result: MutableMatrix): void;
2135
- /**
2136
- * add a value at the specified position in the current Matrix
2137
- * @param index - the index of the value within the matrix. between 0 and 15.
2138
- * @param value - the value to be added
2139
- * @returns the current updated matrix
2140
- */
2141
- export function addAtIndex(self: MutableMatrix, index: number, value: number): void;
2142
- /**
2143
- * mutiply the specified position in the current Matrix by a value
2144
- * @param index - the index of the value within the matrix. between 0 and 15.
2145
- * @param value - the value to be added
2146
- * @returns the current updated matrix
2147
- */
2148
- export function multiplyAtIndex(self: MutableMatrix, index: number, value: number): MutableMatrix;
2149
- /**
2150
- * Inserts the translation vector (using 3 floats) in the current matrix
2151
- * @param x - defines the 1st component of the translation
2152
- * @param y - defines the 2nd component of the translation
2153
- * @param z - defines the 3rd component of the translation
2154
- * @returns the current updated matrix
2155
- */
2156
- export function setTranslationFromFloats(self: MutableMatrix, x: number, y: number, z: number): void;
2157
- /**
2158
- * Inserts the translation vector in the current matrix
2159
- * @param vector3 - defines the translation to insert
2160
- * @returns the current updated matrix
2161
- */
2162
- export function setTranslation(self: MutableMatrix, vector3: Vector3.ReadonlyVector3): void;
2163
- /**
2164
- * Gets the translation value of the current matrix
2165
- * @returns a new Vector3 as the extracted translation from the matrix
2166
- */
2167
- export function getTranslation(self: MutableMatrix): Vector3.MutableVector3;
2168
- /**
2169
- * Fill a Vector3 with the extracted translation from the matrix
2170
- * @param result - defines the Vector3 where to store the translation
2171
- * @returns the current matrix
2172
- */
2173
- export function getTranslationToRef(self: MutableMatrix, result: Vector3.MutableVector3): void;
2174
- /**
2175
- * Remove rotation and scaling part from the matrix
2176
- * @returns the updated matrix
2177
- */
2178
- export function removeRotationAndScaling(self: MutableMatrix): MutableMatrix;
2179
- /**
2180
- * Multiply two matrices
2181
- * @param other - defines the second operand
2182
- * @returns a new matrix set with the multiplication result of the current Matrix and the given one
2183
- */
2184
- export function multiply(self: MutableMatrix, other: ReadonlyMatrix): MutableMatrix;
2185
- /**
2186
- * Copy the current matrix from the given one
2187
- * @param other - defines the source matrix
2188
- * @returns the current updated matrix
2189
- */
2190
- export function copy(from: ReadonlyMatrix, dest: MutableMatrix): void;
2191
- /**
2192
- * Populates the given array from the starting index with the current matrix values
2193
- * @param array - defines the target array
2194
- * @param offset - defines the offset in the target array where to start storing values
2195
- * @returns the current matrix
2196
- */
2197
- export function copyToArray(self: ReadonlyMatrix, arrayDest: FloatArray, offsetDest?: number): void;
2198
- /**
2199
- * Sets the given matrix "result" with the multiplication result of the current Matrix and the given one
2200
- * @param other - defines the second operand
2201
- * @param result - defines the matrix where to store the multiplication
2202
- * @returns the current matrix
2203
- */
2204
- export function multiplyToRef(self: ReadonlyMatrix, other: ReadonlyMatrix, result: MutableMatrix): void;
2205
- /**
2206
- * Sets the FloatArray "result" from the given index "offset" with the multiplication of the current matrix and the given one
2207
- * @param other - defines the second operand
2208
- * @param result - defines the array where to store the multiplication
2209
- * @param offset - defines the offset in the target array where to start storing values
2210
- * @returns the current matrix
2211
- */
2212
- export function multiplyToArray(self: ReadonlyMatrix, other: ReadonlyMatrix, result: FloatArray, offset: number): void;
2213
- /**
2214
- * Check equality between self matrix and a second one
2215
- * @param value - defines the second matrix to compare
2216
- * @returns true is the current matrix and the given one values are strictly equal
2217
- */
2218
- export function equals(self: ReadonlyMatrix, value: ReadonlyMatrix): boolean;
2219
- /**
2220
- * Clone the current matrix
2221
- * @returns a new matrix from the current matrix
2222
- */
2223
- export function clone(self: ReadonlyMatrix): MutableMatrix;
2224
- /**
2225
- * Gets the hash code of the current matrix
2226
- * @returns the hash code
2227
- */
2228
- export function getHashCode(self: ReadonlyMatrix): number;
2229
- /**
2230
- * Decomposes the current Matrix into a translation, rotation and scaling components
2231
- * @param scale - defines the scale vector3 given as a reference to update
2232
- * @param rotation - defines the rotation quaternion given as a reference to update
2233
- * @param translation - defines the translation vector3 given as a reference to update
2234
- * @returns true if operation was successful
2235
- */
2236
- export function decompose(self: ReadonlyMatrix, scale?: Vector3.MutableVector3, rotation?: Quaternion.MutableQuaternion, translation?: Vector3.MutableVector3): boolean;
2237
- /**
2238
- * Gets specific row of the matrix
2239
- * @param index - defines the number of the row to get
2240
- * @returns the index-th row of the current matrix as a new Vector4
2241
- */
2242
- /**
2243
- * Sets the index-th row of the current matrix to the vector4 values
2244
- * @param index - defines the number of the row to set
2245
- * @param row - defines the target vector4
2246
- * @returns the updated current matrix
2247
- */
2248
- /**
2249
- * Sets the index-th row of the current matrix with the given 4 x float values
2250
- * @param index - defines the row index
2251
- * @param x - defines the x component to set
2252
- * @param y - defines the y component to set
2253
- * @param z - defines the z component to set
2254
- * @param w - defines the w component to set
2255
- * @returns the updated current matrix
2256
- */
2257
- export function setRowFromFloats(self: MutableMatrix, index: number, x: number, y: number, z: number, w: number): void;
2258
- /**
2259
- * Compute a new matrix set with the current matrix values multiplied by scale (float)
2260
- * @param scale - defines the scale factor
2261
- * @returns a new matrix
2262
- */
2263
- export function scale(self: ReadonlyMatrix, scale: number): MutableMatrix;
2264
- /**
2265
- * Scale the current matrix values by a factor to a given result matrix
2266
- * @param scale - defines the scale factor
2267
- * @param result - defines the matrix to store the result
2268
- * @returns the current matrix
2269
- */
2270
- export function scaleToRef(self: ReadonlyMatrix, scale: number, result: MutableMatrix): void;
2271
- /**
2272
- * Scale the current matrix values by a factor and add the result to a given matrix
2273
- * @param scale - defines the scale factor
2274
- * @param result - defines the Matrix to store the result
2275
- * @returns the current matrix
2276
- */
2277
- export function scaleAndAddToRef(self: ReadonlyMatrix, scale: number, result: MutableMatrix): void;
2278
- /**
2279
- * Writes to the given matrix a normal matrix, computed from self one (using values from identity matrix for fourth row and column).
2280
- * @param ref - matrix to store the result
2281
- */
2282
- export function normalMatrixToRef(self: ReadonlyMatrix, ref: MutableMatrix): void;
2283
- /**
2284
- * Gets only rotation part of the current matrix
2285
- * @returns a new matrix sets to the extracted rotation matrix from the current one
2286
- */
2287
- export function getRotationMatrix(self: ReadonlyMatrix): MutableMatrix;
2288
- /**
2289
- * Extracts the rotation matrix from the current one and sets it as the given "result"
2290
- * @param result - defines the target matrix to store data to
2291
- * @returns the current matrix
2292
- */
2293
- export function getRotationMatrixToRef(self: ReadonlyMatrix, result: MutableMatrix): void;
2294
- /**
2295
- * Toggles model matrix from being right handed to left handed in place and vice versa
2296
- */
2297
- export function toggleModelMatrixHandInPlace(self: MutableMatrix): void;
2298
- /**
2299
- * Toggles projection matrix from being right handed to left handed in place and vice versa
2300
- */
2301
- export function toggleProjectionMatrixHandInPlace(self: MutableMatrix): void;
2302
- }
2303
-
2304
- /** @public */
2305
- declare const MeshCollider: MeshColliderComponentDefinitionExtended;
2306
-
2307
- /**
2308
- * @public
2309
- */
2310
- declare type MeshColliderComponentDefinition = ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
2311
-
2312
- /**
2313
- * @public
2314
- */
2315
- declare interface MeshColliderComponentDefinitionExtended extends MeshColliderComponentDefinition {
2316
- /**
2317
- * @public
2318
- * Set a box in the MeshCollider component
2319
- * @param entity - entity to create or replace the MeshCollider component
2320
- * @param colliderMask - the set of layer where the collider reacts, default: Physics and Pointer
2321
- */
2322
- setBox(entity: Entity, colliderLayers?: ColliderLayer | ColliderLayer[]): void;
2323
- /**
2324
- * @public
2325
- * Set a plane in the MeshCollider component
2326
- * @param entity - entity to create or replace the MeshCollider component
2327
- * @param colliderMask - the set of layer where the collider reacts, default: Physics and Pointer
2328
- */
2329
- setPlane(entity: Entity, colliderLayers?: ColliderLayer | ColliderLayer[]): void;
2330
- /**
2331
- * @public
2332
- * Set a cylinder in the MeshCollider component
2333
- * @param entity - entity to create or replace the MeshCollider component
2334
- * @param radiusBottom - radius of bottom of cylinder
2335
- * @param radiusTop - radius of top of cylinder
2336
- * @param colliderMask - the set of layer where the collider reacts, default: Physics and Pointer
2337
- */
2338
- setCylinder(entity: Entity, radiusBottom?: number, radiusTop?: number, colliderLayers?: ColliderLayer | ColliderLayer[]): void;
2339
- /**
2340
- * @public
2341
- * Set a sphere in the MeshCollider component
2342
- * @param entity - entity to create or replace the MeshCollider component
2343
- * @param colliderMask - the set of layer where the collider reacts, default: Physics and Pointer
2344
- */
2345
- setSphere(entity: Entity, colliderLayers?: ColliderLayer | ColliderLayer[]): void;
2346
- }
2347
-
2348
- /** @public */
2349
- declare const MeshRenderer: MeshRendererComponentDefinitionExtended;
2350
-
2351
- /**
2352
- * @public
2353
- */
2354
- declare type MeshRendererComponentDefinition = ComponentDefinition<ISchema<PBMeshRenderer>, PBMeshRenderer>;
2355
-
2356
- /**
2357
- * @public
2358
- */
2359
- declare interface MeshRendererComponentDefinitionExtended extends MeshRendererComponentDefinition {
2360
- /**
2361
- * @public
2362
- * Set a box in the MeshRenderer component
2363
- * @param entity - entity to create or replace the MeshRenderer component
2364
- * @param uvs - uvs coord
2365
- */
2366
- setBox(entity: Entity, uvs?: number[]): void;
2367
- /**
2368
- * @public
2369
- * Set a plane in the MeshRenderer component
2370
- * @param entity - entity to create or replace the MeshRenderer component
2371
- * @param uvs - uvs coord
2372
- */
2373
- setPlane(entity: Entity, uvs?: number[]): void;
2374
- /**
2375
- * @public
2376
- * Set a cylinder in the MeshRenderer component
2377
- * @param entity - entity to create or replace the MeshRenderer component
2378
- * @param radiusBottom -
2379
- * @param radiusTop -
2380
- */
2381
- setCylinder(entity: Entity, radiusBottom?: number, radiusTop?: number): void;
2382
- /**
2383
- * @public
2384
- * Set a sphere in the MeshRenderer component
2385
- * @param entity - entity to create or replace the MeshRenderer component
2386
- */
2387
- setSphere(entity: Entity): void;
2388
- }
2389
-
2390
- /**
2391
- * @public
2392
- * @deprecated
2393
- */
2394
- declare class MessageBus {
2395
- private messageQueue;
2396
- private connected;
2397
- private flushing;
2398
- constructor();
2399
- on(message: string, callback: (value: any, sender: string) => void): Observer<IEvents['comms']>;
2400
- emit(message: string, payload: Record<any, any>): void;
2401
- private flush;
2402
- }
2403
-
2404
- declare const enum NftFrameType {
2405
- NFT_CLASSIC = 0,
2406
- NFT_BAROQUE_ORNAMENT = 1,
2407
- NFT_DIAMOND_ORNAMENT = 2,
2408
- NFT_MINIMAL_WIDE = 3,
2409
- NFT_MINIMAL_GREY = 4,
2410
- NFT_BLOCKY = 5,
2411
- NFT_GOLD_EDGES = 6,
2412
- NFT_GOLD_CARVED = 7,
2413
- NFT_GOLD_WIDE = 8,
2414
- NFT_GOLD_ROUNDED = 9,
2415
- NFT_METAL_MEDIUM = 10,
2416
- NFT_METAL_WIDE = 11,
2417
- NFT_METAL_SLIM = 12,
2418
- NFT_METAL_ROUNDED = 13,
2419
- NFT_PINS = 14,
2420
- NFT_MINIMAL_BLACK = 15,
2421
- NFT_MINIMAL_WHITE = 16,
2422
- NFT_TAPE = 17,
2423
- NFT_WOOD_SLIM = 18,
2424
- NFT_WOOD_WIDE = 19,
2425
- NFT_WOOD_TWIGS = 20,
2426
- NFT_CANVAS = 21,
2427
- NFT_NONE = 22
2428
- }
2429
-
2430
- /** @public */
2431
- declare const NftShape: ComponentDefinition<ISchema<PBNftShape>, PBNftShape>;
2432
-
2433
- /**
2434
- * The Observable class is a simple implementation of the Observable pattern.
2435
- *
2436
- * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.
2437
- * This enable a more fine grained execution without having to rely on multiple different Observable objects.
2438
- * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).
2439
- * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.
2440
- *
2441
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed
2442
- */
2443
- declare class Observable<T> {
2444
- private _observers;
2445
- private _eventState;
2446
- private _onObserverAdded;
2447
- /**
2448
- * Creates a new observable
2449
- * @param onObserverAdded - defines a callback to call when a new observer is added
2450
- */
2451
- constructor(onObserverAdded?: (observer: Observer<T>) => void);
2452
- /**
2453
- * Create a new Observer with the specified callback
2454
- * @param callback - the callback that will be executed for that Observer
2455
- * @param mask - the mask used to filter observers
2456
- * @param insertFirst - if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
2457
- * @param scope - optional scope for the callback to be called from
2458
- * @param unregisterOnFirstCall - defines if the observer as to be unregistered after the next notification
2459
- * @returns the new observer created for the callback
2460
- */
2461
- add(callback: (eventData: T, eventState: ObserverEventState) => void, mask?: number, insertFirst?: boolean, scope?: any, unregisterOnFirstCall?: boolean): null | Observer<T>;
2462
- /**
2463
- * Create a new Observer with the specified callback and unregisters after the next notification
2464
- * @param callback - the callback that will be executed for that Observer
2465
- * @returns the new observer created for the callback
2466
- */
2467
- addOnce(callback: (eventData: T, eventState: ObserverEventState) => void): null | Observer<T>;
2468
- /**
2469
- * Remove an Observer from the Observable object
2470
- * @param observer - the instance of the Observer to remove
2471
- * @returns false if it doesn't belong to this Observable
2472
- */
2473
- remove(observer: null | Observer<T>): boolean;
2474
- /**
2475
- * Remove a callback from the Observable object
2476
- * @param callback - the callback to remove
2477
- * @param scope - optional scope. If used only the callbacks with this scope will be removed
2478
- * @returns false if it doesn't belong to this Observable
2479
- */
2480
- removeCallback(callback: (eventData: T, eventState: ObserverEventState) => void, scope?: any): boolean;
2481
- /**
2482
- * Notify all Observers by calling their respective callback with the given data
2483
- * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
2484
- * @param eventData - defines the data to send to all observers
2485
- * @param mask - defines the mask of the current notification (observers with incompatible mask (ie mask & observer.mask === 0) will not be notified)
2486
- * @param target - defines the original target of the state
2487
- * @param currentTarget - defines the current target of the state
2488
- * @returns false if the complete observer chain was not processed (because one observer set the skipNextObservers to true)
2489
- */
2490
- notifyObservers(eventData: T, mask?: number, target?: any, currentTarget?: any): boolean;
2491
- /**
2492
- * Calling this will execute each callback, expecting it to be a promise or return a value.
2493
- * If at any point in the chain one function fails, the promise will fail and the execution will not continue.
2494
- * This is useful when a chain of events (sometimes async events) is needed to initialize a certain object
2495
- * and it is crucial that all callbacks will be executed.
2496
- * The order of the callbacks is kept, callbacks are not executed parallel.
2497
- *
2498
- * @param eventData - The data to be sent to each callback
2499
- * @param mask - is used to filter observers defaults to -1
2500
- * @param target - defines the callback target (see EventState)
2501
- * @param currentTarget - defines he current object in the bubbling phase
2502
- * @returns will return a Promise than resolves when all callbacks executed successfully.
2503
- */
2504
- notifyObserversWithPromise(eventData: T, mask?: number, target?: any, currentTarget?: any): Promise<T>;
2505
- /**
2506
- * Notify a specific observer
2507
- * @param observer - defines the observer to notify
2508
- * @param eventData - defines the data to be sent to each callback
2509
- * @param mask - is used to filter observers defaults to -1
2510
- */
2511
- notifyObserver(observer: Observer<T>, eventData: T, mask?: number): void;
2512
- /**
2513
- * Gets a boolean indicating if the observable has at least one observer
2514
- * @returns true is the Observable has at least one Observer registered
2515
- */
2516
- hasObservers(): boolean;
2517
- /**
2518
- * Clear the list of observers
2519
- */
2520
- clear(): void;
2521
- /**
2522
- * Clone the current observable
2523
- * @returns a new observable
2524
- */
2525
- clone(): Observable<T>;
2526
- /**
2527
- * Does this observable handles observer registered with a given mask
2528
- * @param mask - defines the mask to be tested
2529
- * @returns whether or not one observer registered with the given mask is handeled
2530
- */
2531
- hasSpecificMask(mask?: number): boolean;
2532
- private _deferUnregister;
2533
- private _remove;
2534
- }
2535
-
2536
- /**
2537
- * Represent an Observer registered to a given Observable object.
2538
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed
2539
- */
2540
- declare class Observer<T> {
2541
- /**
2542
- * Defines the callback to call when the observer is notified
2543
- */
2544
- callback: (eventData: T, eventState: ObserverEventState) => void;
2545
- /**
2546
- * Defines the mask of the observer (used to filter notifications)
2547
- */
2548
- mask: number;
2549
- /**
2550
- * Defines the current scope used to restore the JS context
2551
- */
2552
- scope: any;
2553
- /**
2554
- * Gets or sets a property defining that the observer as to be unregistered after the next notification
2555
- */
2556
- unregisterOnNextCall: boolean;
2557
- /** For internal usage */
2558
- _willBeUnregistered: boolean;
2559
- /**
2560
- * Creates a new observer
2561
- * @param callback - defines the callback to call when the observer is notified
2562
- * @param mask - defines the mask of the observer (used to filter notifications)
2563
- * @param scope - defines the current scope used to restore the JS context
2564
- */
2565
- constructor(
2566
- /**
2567
- * Defines the callback to call when the observer is notified
2568
- */
2569
- callback: (eventData: T, eventState: ObserverEventState) => void,
2570
- /**
2571
- * Defines the mask of the observer (used to filter notifications)
2572
- */
2573
- mask: number,
2574
- /**
2575
- * Defines the current scope used to restore the JS context
2576
- */
2577
- scope?: any);
2578
- }
2579
-
2580
- /**
2581
- * A class serves as a medium between the observable and its observers
2582
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed
2583
- */
2584
- declare class ObserverEventState {
2585
- /**
2586
- * An Observer can set this property to true to prevent subsequent observers of being notified
2587
- */
2588
- skipNextObservers: boolean;
2589
- /**
2590
- * Get the mask value that were used to trigger the event corresponding to this EventState object
2591
- */
2592
- mask: number;
2593
- /**
2594
- * The object that originally notified the event
2595
- */
2596
- target?: any;
2597
- /**
2598
- * The current object in the bubbling phase
2599
- */
2600
- currentTarget?: any;
2601
- /**
2602
- * This will be populated with the return value of the last function that was executed.
2603
- * If it is the first function in the callback chain it will be the event data.
2604
- */
2605
- lastReturnValue?: any;
2606
- /**
2607
- * Create a new EventState
2608
- * @param mask - defines the mask associated with this state
2609
- * @param skipNextObservers - defines a flag which will instruct the observable to skip following observers when set to true
2610
- * @param target - defines the original target of the state
2611
- * @param currentTarget - defines the current target of the state
2612
- */
2613
- constructor(mask: number, skipNextObservers?: boolean, target?: any, currentTarget?: any);
2614
- /**
2615
- * Initialize the current event state
2616
- * @param mask - defines the mask associated with this state
2617
- * @param skipNextObservers - defines a flag which will instruct the observable to skip following observers when set to true
2618
- * @param target - defines the original target of the state
2619
- * @param currentTarget - defines the current target of the state
2620
- * @returns the current event state
2621
- */
2622
- initalize(mask: number, skipNextObservers?: boolean, target?: any, currentTarget?: any): ObserverEventState;
2623
- }
2624
-
2625
- /** @public
2626
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2627
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed. Use onEnterSceneObservable instead. */
2628
- declare const onEnterScene: Observable<{
2629
- userId: string;
2630
- }>;
2631
-
2632
- /**
2633
- * These events are triggered after your character enters the scene.
2634
- * @public
2635
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2636
- */
2637
- declare const onEnterSceneObservable: Observable<{
2638
- userId: string;
2639
- }>;
2640
-
2641
- /** @public
2642
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2643
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed. Use onLeaveSceneObservable instead. */
2644
- declare const onLeaveScene: Observable<{
2645
- userId: string;
2646
- }>;
2647
-
2648
- /**
2649
- * These events are triggered after your character leaves the scene.
2650
- * @public
2651
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2652
- */
2653
- declare const onLeaveSceneObservable: Observable<{
2654
- userId: string;
2655
- }>;
2656
-
2657
- declare type OnlyNonUndefinedTypes<T> = {
2658
- [K in ExcludeUndefined<T>]: T[K];
2659
- };
2660
-
2661
- declare type OnlyOptionalUndefinedTypes<T> = {
2662
- [K in IncludeUndefined<T>]?: T[K];
2663
- };
2664
-
2665
- /**
2666
- * @public
2667
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2668
- */
2669
- declare const onPlayerClickedObservable: Observable<{
2670
- userId: string;
2671
- ray: {
2672
- origin: ReadOnlyVector3;
2673
- direction: ReadOnlyVector3;
2674
- distance: number;
2675
- };
2676
- }>;
2677
-
2678
- /**
2679
- * @public
2680
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2681
- */
2682
- declare const onPlayerConnectedObservable: Observable<{
2683
- userId: string;
2684
- }>;
2685
-
2686
- /**
2687
- * @public
2688
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2689
- */
2690
- declare const onPlayerDisconnectedObservable: Observable<{
2691
- userId: string;
2692
- }>;
2693
-
2694
- /**
2695
- * @public
2696
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2697
- */
2698
- declare const onPlayerExpressionObservable: Observable<{
2699
- expressionId: string;
2700
- }>;
2701
-
2702
- /**
2703
- * @public
2704
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2705
- */
2706
- declare const onProfileChanged: Observable<{
2707
- ethAddress: string;
2708
- version: number;
2709
- }>;
2710
-
2711
- /**
2712
- * @public
2713
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2714
- */
2715
- declare const onRealmChangedObservable: Observable<{
2716
- domain: string;
2717
- room: string;
2718
- serverName: string;
2719
- displayName: string;
2720
- }>;
2721
-
2722
- /**
2723
- * This event is triggered after all the resources of the scene were loaded (models, textures, etc...)
2724
- * @public
2725
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2726
- */
2727
- declare const onSceneReadyObservable: Observable<{}>;
2728
-
2729
- /**
2730
- * @public
2731
- * @deprecated This function is an inheritance of ECS6, it's here temporary for the feature parity, please read the news and docs to know how handle when it's removed.
2732
- */
2733
- declare const onVideoEvent: Observable<{
2734
- componentId: string;
2735
- videoClipId: string;
2736
- videoStatus: number;
2737
- currentOffset: number;
2738
- totalVideoLength: number;
2739
- }>;
2740
-
2741
- declare interface PBAnimationState {
2742
- name: string;
2743
- clip: string;
2744
- playing?: boolean | undefined;
2745
- /** default=1.0s */
2746
- weight?: number | undefined;
2747
- /** default=1.0 */
2748
- speed?: number | undefined;
2749
- /** default=true */
2750
- loop?: boolean | undefined;
2751
- shouldReset?: boolean | undefined;
2752
- }
2753
-
2754
- declare interface PBAnimator {
2755
- states: PBAnimationState[];
2756
- }
2757
-
2758
- declare interface PBAudioSource {
2759
- playing?: boolean | undefined;
2760
- /** default=1.0f */
2761
- volume?: number | undefined;
2762
- loop?: boolean | undefined;
2763
- /** default=1.0f */
2764
- pitch?: number | undefined;
2765
- audioClipUrl: string;
2766
- }
2767
-
2768
- declare interface PBAudioStream {
2769
- playing?: boolean | undefined;
2770
- /** default=1.0f */
2771
- volume?: number | undefined;
2772
- url: string;
2773
- }
2774
-
2775
- declare interface PBAvatarAttach {
2776
- avatarId: string;
2777
- anchorPointId: AvatarAnchorPointType;
2778
- }
2779
-
2780
- declare interface PBAvatarModifierArea {
2781
- area: PBVector3 | undefined;
2782
- excludeIds: string[];
2783
- modifiers: AvatarModifierType[];
2784
- }
2785
-
2786
- declare interface PBAvatarShape {
2787
- id: string;
2788
- /** default = NPC */
2789
- name?: string | undefined;
2790
- /** default = urn:decentraland:off-chain:base-avatars:BaseFemale */
2791
- bodyShape?: string | undefined;
2792
- /** default = decentraland.common.Color3(R = 0.6f, G = 0.462f, B = 0.356f) */
2793
- skinColor?: PBColor3 | undefined;
2794
- /** default = decentraland.common.Color3(R = 0.283f, G = 0.142f, B = 0f) */
2795
- hairColor?: PBColor3 | undefined;
2796
- /** default = decentraland.common.Color3(R = 0.6f, G = 0.462f, B = 0.356f) */
2797
- eyeColor?: PBColor3 | undefined;
2798
- expressionTriggerId?: string | undefined;
2799
- /** default = timestamp */
2800
- expressionTriggerTimestamp?: number | undefined;
2801
- talking?: boolean | undefined;
2802
- /**
2803
- * default = ["urn:decentraland:off-chain:base-avatars:f_eyes_00",
2804
- * "urn:decentraland:off-chain:base-avatars:f_eyebrows_00",
2805
- * "urn:decentraland:off-chain:base-avatars:f_mouth_00"
2806
- * "urn:decentraland:off-chain:base-avatars:standard_hair",
2807
- * "urn:decentraland:off-chain:base-avatars:f_simple_yellow_tshirt",
2808
- * "urn:decentraland:off-chain:base-avatars:f_brown_trousers",
2809
- * "urn:decentraland:off-chain:base-avatars:bun_shoes"]
2810
- */
2811
- wearables: string[];
2812
- /** default = [] */
2813
- emotes: string[];
2814
- }
2815
-
2816
- declare interface PBBillboard {
2817
- /** default=BM_ALL_AXES */
2818
- billboardMode?: BillboardMode | undefined;
2819
- /** default=false */
2820
- oppositeDirection?: boolean | undefined;
2821
- }
2822
-
2823
- declare interface PBCameraMode {
2824
- mode: CameraType;
2825
- }
2826
-
2827
- declare interface PBCameraModeArea {
2828
- area: PBVector3 | undefined;
2829
- mode: CameraType;
2830
- }
2831
-
2832
- declare interface PBColor3 {
2833
- r: number;
2834
- g: number;
2835
- b: number;
2836
- }
2837
-
2838
- declare interface PBColor4 {
2839
- r: number;
2840
- g: number;
2841
- b: number;
2842
- a: number;
2843
- }
2844
-
2845
- declare interface PBGltfContainer {
2846
- /** which file to load */
2847
- src: string;
2848
- }
2849
-
2850
- declare interface PBMaterial {
2851
- material?: {
2852
- $case: 'unlit';
2853
- unlit: PBMaterial_UnlitMaterial;
2854
- } | {
2855
- $case: 'pbr';
2856
- pbr: PBMaterial_PbrMaterial;
2857
- };
2858
- }
2859
-
2860
- declare interface PBMaterial_PbrMaterial {
2861
- /** default = null */
2862
- texture?: TextureUnion | undefined;
2863
- /** default = 0.5. range value: from 0 to 1 */
2864
- alphaTest?: number | undefined;
2865
- /** default = true */
2866
- castShadows?: boolean | undefined;
2867
- /** default = null */
2868
- alphaTexture?: TextureUnion | undefined;
2869
- /** default = null */
2870
- emissiveTexture?: TextureUnion | undefined;
2871
- /** default = null */
2872
- bumpTexture?: TextureUnion | undefined;
2873
- /** default = white; */
2874
- albedoColor?: PBColor3 | undefined;
2875
- /** default = black; */
2876
- emissiveColor?: PBColor3 | undefined;
2877
- /** default = white; */
2878
- reflectivityColor?: PBColor3 | undefined;
2879
- /** default = TransparencyMode.Auto */
2880
- transparencyMode?: MaterialTransparencyMode | undefined;
2881
- /** default = 0.5 */
2882
- metallic?: number | undefined;
2883
- /** default = 0.5 */
2884
- roughness?: number | undefined;
2885
- /** default = 1 */
2886
- glossiness?: number | undefined;
2887
- /** default = 1 */
2888
- specularIntensity?: number | undefined;
2889
- /** default = 2 */
2890
- emissiveIntensity?: number | undefined;
2891
- /** default = 1 */
2892
- directIntensity?: number | undefined;
2893
- }
2894
-
2895
- declare interface PBMaterial_UnlitMaterial {
2896
- /** default = null */
2897
- texture?: TextureUnion | undefined;
2898
- /** default = 0.5. range value: from 0 to 1 */
2899
- alphaTest?: number | undefined;
2900
- /** default = true */
2901
- castShadows?: boolean | undefined;
2902
- }
2903
-
2904
- declare interface PBMeshCollider {
2905
- /** default = ColliderLayer.Physics | ColliderLayer.Pointer */
2906
- collisionMask?: number | undefined;
2907
- mesh?: {
2908
- $case: 'box';
2909
- box: PBMeshCollider_BoxMesh;
2910
- } | {
2911
- $case: 'sphere';
2912
- sphere: PBMeshCollider_SphereMesh;
2913
- } | {
2914
- $case: 'cylinder';
2915
- cylinder: PBMeshCollider_CylinderMesh;
2916
- } | {
2917
- $case: 'plane';
2918
- plane: PBMeshCollider_PlaneMesh;
2919
- };
2920
- }
2921
-
2922
- declare interface PBMeshCollider_BoxMesh {
2923
- }
2924
-
2925
- declare interface PBMeshCollider_CylinderMesh {
2926
- /** default=1.0 */
2927
- radiusTop?: number | undefined;
2928
- /** default=1.0 */
2929
- radiusBottom?: number | undefined;
2930
- }
2931
-
2932
- declare interface PBMeshCollider_PlaneMesh {
2933
- }
2934
-
2935
- declare interface PBMeshCollider_SphereMesh {
2936
- }
2937
-
2938
- declare interface PBMeshRenderer {
2939
- mesh?: {
2940
- $case: 'box';
2941
- box: PBMeshRenderer_BoxMesh;
2942
- } | {
2943
- $case: 'sphere';
2944
- sphere: PBMeshRenderer_SphereMesh;
2945
- } | {
2946
- $case: 'cylinder';
2947
- cylinder: PBMeshRenderer_CylinderMesh;
2948
- } | {
2949
- $case: 'plane';
2950
- plane: PBMeshRenderer_PlaneMesh;
2951
- };
2952
- }
2953
-
2954
- declare interface PBMeshRenderer_BoxMesh {
2955
- uvs: number[];
2956
- }
2957
-
2958
- declare interface PBMeshRenderer_CylinderMesh {
2959
- /** default=1.0 */
2960
- radiusTop?: number | undefined;
2961
- /** default=1.0 */
2962
- radiusBottom?: number | undefined;
2963
- }
2964
-
2965
- declare interface PBMeshRenderer_PlaneMesh {
2966
- uvs: number[];
2967
- }
2968
-
2969
- declare interface PBMeshRenderer_SphereMesh {
2970
- }
2971
-
2972
- declare interface PBNftShape {
2973
- src: string;
2974
- /** default = PictureFrameStyle.Classic */
2975
- style?: NftFrameType | undefined;
2976
- /** default = decentraland.common.Color3(0.6404918, 0.611472, 0.8584906) */
2977
- color?: PBColor3 | undefined;
2978
- }
2979
-
2980
- /** the renderer will set this component to the root entity once per frame with all the events */
2981
- declare interface PBPointerEventsResult {
2982
- /** a list of the last N pointer commands (from the engine) */
2983
- commands: PBPointerEventsResult_PointerCommand[];
2984
- }
2985
-
2986
- /** this message represents a pointer event, used both for UP and DOWN actions */
2987
- declare interface PBPointerEventsResult_PointerCommand {
2988
- /** identifier of the input */
2989
- button: InputAction;
2990
- hit: RaycastHit | undefined;
2991
- state: PointerEventType;
2992
- /** could be a Lamport timestamp */
2993
- timestamp: number;
2994
- /** if the input is analog then we store it here */
2995
- analog?: number | undefined;
2996
- }
2997
-
2998
- declare interface PBPointerHoverFeedback {
2999
- pointerEvents: PBPointerHoverFeedback_Entry[];
3000
- }
3001
-
3002
- declare interface PBPointerHoverFeedback_Entry {
3003
- eventType: PointerEventType;
3004
- eventInfo: PBPointerHoverFeedback_Info | undefined;
3005
- }
3006
-
3007
- declare interface PBPointerHoverFeedback_Info {
3008
- /** default=InputAction.ANY */
3009
- button?: InputAction | undefined;
3010
- /** default='Interact' */
3011
- hoverText?: string | undefined;
3012
- /** default=10 */
3013
- maxDistance?: number | undefined;
3014
- /** default=true */
3015
- showFeedback?: boolean | undefined;
3016
- }
3017
-
3018
- declare interface PBPointerLock {
3019
- isPointerLocked: boolean;
3020
- }
3021
-
3022
- declare interface PBPosition {
3023
- x: number;
3024
- y: number;
3025
- z: number;
3026
- }
3027
-
3028
- declare interface PBRaycast {
3029
- origin: PBVector3 | undefined;
3030
- direction: PBVector3 | undefined;
3031
- maxDistance: number;
3032
- queryType: RaycastQueryType;
3033
- }
3034
-
3035
- declare interface PBRaycastResult {
3036
- timestamp: number;
3037
- origin: PBVector3 | undefined;
3038
- direction: PBVector3 | undefined;
3039
- hits: RaycastHit[];
3040
- }
3041
-
3042
- declare interface PBTextShape {
3043
- text: string;
3044
- /** default=F_SANS_SERIF */
3045
- font?: Font | undefined;
3046
- /** default=10 */
3047
- fontSize?: number | undefined;
3048
- fontAutoSize?: boolean | undefined;
3049
- /** default=TAM_CENTER_CENTER */
3050
- textAlign?: TextAlignMode | undefined;
3051
- /** default=1 */
3052
- width?: number | undefined;
3053
- /** default=1 */
3054
- height?: number | undefined;
3055
- paddingTop?: number | undefined;
3056
- paddingRight?: number | undefined;
3057
- paddingBottom?: number | undefined;
3058
- paddingLeft?: number | undefined;
3059
- lineSpacing?: number | undefined;
3060
- lineCount?: number | undefined;
3061
- textWrapping?: boolean | undefined;
3062
- shadowBlur?: number | undefined;
3063
- shadowOffsetX?: number | undefined;
3064
- shadowOffsetY?: number | undefined;
3065
- outlineWidth?: number | undefined;
3066
- /** default=(1.0,1.0,1.0) */
3067
- shadowColor?: PBColor3 | undefined;
3068
- /** default=(1.0,1.0,1.0) */
3069
- outlineColor?: PBColor3 | undefined;
3070
- /** default=(1.0,1.0,1.0) */
3071
- textColor?: PBColor4 | undefined;
3072
- }
3073
-
3074
- declare interface PBUiBackground {
3075
- /** default=(0.0, 0.0, 0.0, 0.0) */
3076
- backgroundColor?: PBColor4 | undefined;
3077
- }
3078
-
3079
- declare interface PBUiText {
3080
- value: string;
3081
- /** default=(1.0,1.0,1.0,1.0) */
3082
- color?: PBColor4 | undefined;
3083
- /** default='center' */
3084
- textAlign?: TextAlignMode | undefined;
3085
- /** default=0 */
3086
- font?: Font | undefined;
3087
- /** default=10 */
3088
- fontSize?: number | undefined;
3089
- }
3090
-
3091
- declare interface PBUiTransform {
3092
- parent: number;
3093
- rightOf: number;
3094
- /** default: YGAlign.YGA_FLEX_START */
3095
- alignContent?: YGAlign | undefined;
3096
- /** default: YGAlign.YGA_STRETCH */
3097
- alignItems?: YGAlign | undefined;
3098
- /** default: YGWrap.YGW_WRAP */
3099
- flexWrap?: YGWrap | undefined;
3100
- /** default: 1 */
3101
- flexShrink?: number | undefined;
3102
- /** YGPositionType.YGPT_RELATIVE */
3103
- positionType: YGPositionType;
3104
- /** YGAlign.YGA_AUTO */
3105
- alignSelf: YGAlign;
3106
- /** YGFlexDirection.YGFD_ROW */
3107
- flexDirection: YGFlexDirection;
3108
- /** YGJustify.YGJ_FLEX_START */
3109
- justifyContent: YGJustify;
3110
- /** YGOverflow.YGO_VISIBLE */
3111
- overflow: YGOverflow;
3112
- /** YGDisplay.YGD_FLEX */
3113
- display: YGDisplay;
3114
- /** YGUnit.YGU_UNDEFINED */
3115
- flexBasisUnit: YGUnit;
3116
- flexBasis: number;
3117
- flexGrow: number;
3118
- /** YGUnit.YGU_UNDEFINED */
3119
- widthUnit: YGUnit;
3120
- width: number;
3121
- /** YGUnit.YGU_UNDEFINED */
3122
- heightUnit: YGUnit;
3123
- height: number;
3124
- /** YGUnit.YGU_UNDEFINED */
3125
- minWidthUnit: YGUnit;
3126
- minWidth: number;
3127
- /** YGUnit.YGU_UNDEFINED */
3128
- minHeightUnit: YGUnit;
3129
- minHeight: number;
3130
- /** YGUnit.YGU_UNDEFINED */
3131
- maxWidthUnit: YGUnit;
3132
- maxWidth: number;
3133
- /** YGUnit.YGU_UNDEFINED */
3134
- maxHeightUnit: YGUnit;
3135
- maxHeight: number;
3136
- /** YGUnit.YGU_UNDEFINED */
3137
- positionLeftUnit: YGUnit;
3138
- positionLeft: number;
3139
- /** YGUnit.YGU_UNDEFINED */
3140
- positionTopUnit: YGUnit;
3141
- positionTop: number;
3142
- /** YGUnit.YGU_UNDEFINED */
3143
- positionRightUnit: YGUnit;
3144
- positionRight: number;
3145
- /** YGUnit.YGU_UNDEFINED */
3146
- positionBottomUnit: YGUnit;
3147
- positionBottom: number;
3148
- /** YGUnit.YGU_UNDEFINED */
3149
- marginLeftUnit: YGUnit;
3150
- marginLeft: number;
3151
- /** YGUnit.YGU_UNDEFINED */
3152
- marginTopUnit: YGUnit;
3153
- marginTop: number;
3154
- /** YGUnit.YGU_UNDEFINED */
3155
- marginRightUnit: YGUnit;
3156
- marginRight: number;
3157
- /** YGUnit.YGU_UNDEFINED */
3158
- marginBottomUnit: YGUnit;
3159
- marginBottom: number;
3160
- /** YGUnit.YGU_UNDEFINED */
3161
- paddingLeftUnit: YGUnit;
3162
- paddingLeft: number;
3163
- /** YGUnit.YGU_UNDEFINED */
3164
- paddingTopUnit: YGUnit;
3165
- paddingTop: number;
3166
- /** YGUnit.YGU_UNDEFINED */
3167
- paddingRightUnit: YGUnit;
3168
- paddingRight: number;
3169
- /** YGUnit.YGU_UNDEFINED */
3170
- paddingBottomUnit: YGUnit;
3171
- paddingBottom: number;
3172
- }
3173
-
3174
- declare interface PBVector2 {
3175
- x: number;
3176
- y: number;
3177
- }
3178
-
3179
- declare interface PBVector3 {
3180
- x: number;
3181
- y: number;
3182
- z: number;
3183
- }
3184
-
3185
- declare interface PBVisibilityComponent {
3186
- /** default=true */
3187
- visible?: boolean | undefined;
3188
- }
3189
-
3190
- /**
3191
- * Represens a plane by the equation ax + by + cz + d = 0
3192
- * @public
3193
- */
3194
- declare namespace Plane {
3195
- export type MutablePlane = {
3196
- /**
3197
- * Normal of the plane (a,b,c)
3198
- */
3199
- normal: Vector3.MutableVector3;
3200
- /**
3201
- * d component of the plane
3202
- */
3203
- d: number;
3204
- };
3205
- export type ReadonlyPlane = {
3206
- /**
3207
- * Normal of the plane (a,b,c)
3208
- */
3209
- normal: Vector3.ReadonlyVector3;
3210
- /**
3211
- * d component of the plane
3212
- */
3213
- d: number;
3214
- };
3215
- /**
3216
- * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0
3217
- * @param a - a component of the plane
3218
- * @param b - b component of the plane
3219
- * @param c - c component of the plane
3220
- * @param d - d component of the plane
3221
- */
3222
- export function create(a: number, b: number, c: number, d: number): {
3223
- normal: Vector3.MutableVector3;
3224
- d: number;
3225
- };
3226
- /**
3227
- * Creates a plane from an array
3228
- * @param array - the array to create a plane from
3229
- * @returns a new Plane from the given array.
3230
- */
3231
- export function fromArray(array: number[]): MutablePlane;
3232
- /**
3233
- * Creates a plane from three points
3234
- * @param point1 - point used to create the plane
3235
- * @param point2 - point used to create the plane
3236
- * @param point3 - point used to create the plane
3237
- * @returns a new Plane defined by the three given points.
3238
- */
3239
- export function fromPoints(_point1: Vector3.ReadonlyVector3, _point2: Vector3.ReadonlyVector3, _point3: Vector3.ReadonlyVector3): MutablePlane;
3240
- /**
3241
- * Creates a plane from an origin point and a normal
3242
- * @param origin - origin of the plane to be constructed
3243
- * @param normal - normal of the plane to be constructed
3244
- * @returns a new Plane the normal vector to this plane at the given origin point.
3245
- * Note : the vector "normal" is updated because normalized.
3246
- */
3247
- export function romPositionAndNormal(origin: Vector3.ReadonlyVector3, normal: Vector3.ReadonlyVector3): MutablePlane;
3248
- /**
3249
- * Calculates the distance from a plane and a point
3250
- * @param origin - origin of the plane to be constructed
3251
- * @param normal - normal of the plane to be constructed
3252
- * @param point - point to calculate distance to
3253
- * @returns the signed distance between the plane defined by the normal vector at the "origin"" point and the given other point.
3254
- */
3255
- export function signedDistanceToPlaneFromPositionAndNormal(origin: Vector3.ReadonlyVector3, normal: Vector3.ReadonlyVector3, point: Vector3.ReadonlyVector3): number;
3256
- /**
3257
- * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].
3258
- */
3259
- export function asArray(plane: ReadonlyPlane): number[];
3260
- /**
3261
- * @returns a new plane copied from the current Plane.
3262
- */
3263
- export function clone(plane: ReadonlyPlane): MutablePlane;
3264
- /**
3265
- * @returns the Plane hash code.
3266
- */
3267
- export function getHashCode(_plane: ReadonlyPlane): number;
3268
- /**
3269
- * Normalize the current Plane in place.
3270
- * @returns the updated Plane.
3271
- */
3272
- export function normalize(plane: ReadonlyPlane): MutablePlane;
3273
- /**
3274
- * Applies a transformation the plane and returns the result
3275
- * @param transformation - the transformation matrix to be applied to the plane
3276
- * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.
3277
- */
3278
- export function transform(plane: ReadonlyPlane, transformation: Matrix.ReadonlyMatrix): MutablePlane;
3279
- /**
3280
- * Calcualtte the dot product between the point and the plane normal
3281
- * @param point - point to calculate the dot product with
3282
- * @returns the dot product (float) of the point coordinates and the plane normal.
3283
- */
3284
- export function dotCoordinate(plane: ReadonlyPlane, point: Vector3.ReadonlyVector3): number;
3285
- /**
3286
- * Updates the current Plane from the plane defined by the three given points.
3287
- * @param point1 - one of the points used to contruct the plane
3288
- * @param point2 - one of the points used to contruct the plane
3289
- * @param point3 - one of the points used to contruct the plane
3290
- * @returns the updated Plane.
3291
- */
3292
- export function copyFromPoints(point1: Vector3.ReadonlyVector3, point2: Vector3.ReadonlyVector3, point3: Vector3.ReadonlyVector3): MutablePlane;
3293
- /**
3294
- * Checks if the plane is facing a given direction
3295
- * @param direction - the direction to check if the plane is facing
3296
- * @param epsilon - value the dot product is compared against (returns true if dot &lt;= epsilon)
3297
- * @returns True is the vector "direction" is the same side than the plane normal.
3298
- */
3299
- export function isFrontFacingTo(plane: ReadonlyPlane, direction: Vector3.ReadonlyVector3, epsilon: number): boolean;
3300
- /**
3301
- * Calculates the distance to a point
3302
- * @param point - point to calculate distance to
3303
- * @returns the signed distance (float) from the given point to the Plane.
3304
- */
3305
- export function signedDistanceTo(plane: ReadonlyPlane, point: Vector3.ReadonlyVector3): number;
3306
- }
3307
-
3308
- /** @public */
3309
- declare const PointerEventsResult: ComponentDefinition<ISchema<PBPointerEventsResult>, PBPointerEventsResult>;
3310
-
3311
- declare const enum PointerEventType {
3312
- PET_UP = 0,
3313
- PET_DOWN = 1,
3314
- PET_HOVER_ENTER = 2,
3315
- PET_HOVER_LEAVE = 3
3316
- }
3317
-
3318
- /** @public */
3319
- declare const PointerHoverFeedback: ComponentDefinition<ISchema<PBPointerHoverFeedback>, PBPointerHoverFeedback>;
3320
-
3321
- /** @public */
3322
- declare const PointerLock: ComponentDefinition<ISchema<PBPointerLock>, PBPointerLock>;
3323
-
3324
- /**
3325
- * @public
3326
- * Quaternion is a type and a namespace.
3327
- * - The namespace contains all types and functions to operates with Quaternion
3328
- * - The type Quaternion is an alias to Quaternion.ReadonlyQuaternion
3329
- * ```
3330
- *
3331
- * // Namespace usage example
3332
- * const next = Quaternion.add(pointA, velocityA)
3333
- *
3334
- * // Type usage example
3335
- * const readonlyRotation: Quaternion = Quaternion.Zero()
3336
- * readonlyRotation.x = 0.1 // this FAILS
3337
- *
3338
- * // For mutable usage, use `Quaternion.Mutable`
3339
- * const rotation: Quaternion.Mutable = Quaternion.Identity()
3340
- * rotation.x = 3.0 // this WORKS
3341
- * ```
3342
- */
3343
- declare type Quaternion = Quaternion.ReadonlyQuaternion;
3344
-
3345
- /**
3346
- * @public
3347
- * Quaternion is a type and a namespace.
3348
- * ```
3349
- * // The namespace contains all types and functions to operates with Quaternion
3350
- * const next = Quaternion.add(pointA, velocityA)
3351
- * // The type Quaternion is an alias to Quaternion.ReadonlyQuaternion
3352
- * const readonlyRotation: Quaternion = Quaternion.Zero()
3353
- * readonlyRotation.x = 0.1 // this FAILS
3354
- *
3355
- * // For mutable usage, use `Quaternion.Mutable`
3356
- * const rotation: Quaternion.Mutable = Quaternion.Identity()
3357
- * rotation.x = 3.0 // this WORKS
3358
- * ```
3359
- */
3360
- declare namespace Quaternion {
3361
- /**
3362
- * @public
3363
- * For external use, type with `Quaternion`, e.g. `const zeroRotation: Quaternion = Quaternion.Zero()`.
3364
- * For mutable typing, use `Quaternion.Mutable`, e.g. `const identityQuaternion: Quaternion.Mutable = Quaternion.Identity()`.
3365
- */
3366
- export type ReadonlyQuaternion = {
3367
- readonly x: number;
3368
- readonly y: number;
3369
- readonly z: number;
3370
- readonly w: number;
3371
- };
3372
- /**
3373
- * @public
3374
- * For external usage, type with `Quaternion`, e.g. `const zeroRotation: Quaternion = Quaternion.Zero()`.
3375
- * For mutable typing, use `Quaternion.Mutable`, e.g. `const identityQuaternion: Quaternion.Mutable = Quaternion.Identity()`.
3376
- */
3377
- export type MutableQuaternion = {
3378
- x: number;
3379
- y: number;
3380
- z: number;
3381
- w: number;
3382
- };
3383
- /**
3384
- * @public
3385
- * Type with `Quaternion` for readonly usage, e.g. `const zeroRotation: Quaternion = Quaternion.Zero()`.
3386
- * For mutable, use `Quaternion.Mutable`, e.g. `const identityQuaternion: Quaternion.Mutable = Quaternion.Identity()`.
3387
- */
3388
- export type Mutable = MutableQuaternion;
3389
- /**
3390
- * Creates a new Quaternion from the given floats
3391
- * @param x - defines the first component (0 by default)
3392
- * @param y - defines the second component (0 by default)
3393
- * @param z - defines the third component (0 by default)
3394
- * @param w - defines the fourth component (1.0 by default)
3395
- */
3396
- export function create(
3397
- /** defines the first component (0 by default) */
3398
- x?: number,
3399
- /** defines the second component (0 by default) */
3400
- y?: number,
3401
- /** defines the third component (0 by default) */
3402
- z?: number,
3403
- /** defines the fourth component (1.0 by default) */
3404
- w?: number): MutableQuaternion;
3405
- /**
3406
- * Returns a new Quaternion as the result of the addition of the two given quaternions.
3407
- * @param q1 - the first quaternion
3408
- * @param q2 - the second quaternion
3409
- * @returns the resulting quaternion
3410
- */
3411
- export function add(q1: ReadonlyQuaternion, q2: ReadonlyQuaternion): MutableQuaternion;
3412
- /**
3413
- * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion
3414
- * @param yaw - defines the rotation around Y axis (radians)
3415
- * @param pitch - defines the rotation around X axis (radians)
3416
- * @param roll - defines the rotation around Z axis (radians)
3417
- * @returns result quaternion
3418
- */
3419
- export function fromRotationYawPitchRoll(yaw: number, pitch: number, roll: number): MutableQuaternion;
3420
- /**
3421
- * Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis.
3422
- * @param x - the rotation on the x axis in euler degrees
3423
- * @param y - the rotation on the y axis in euler degrees
3424
- * @param z - the rotation on the z axis in euler degrees
3425
- */
3426
- export function fromEulerDegrees(x: number, y: number, z: number): MutableQuaternion;
3427
- /**
3428
- * Gets length of current quaternion
3429
- * @returns the quaternion length (float)
3430
- */
3431
- export function length(q: ReadonlyQuaternion): number;
3432
- /**
3433
- * Gets length of current quaternion
3434
- * @returns the quaternion length (float)
3435
- */
3436
- export function lengthSquared(q: ReadonlyQuaternion): number;
3437
- /**
3438
- * Returns the dot product (float) between the quaternions "left" and "right"
3439
- * @param left - defines the left operand
3440
- * @param right - defines the right operand
3441
- * @returns the dot product
3442
- */
3443
- export function dot(left: ReadonlyQuaternion, right: ReadonlyQuaternion): number;
3444
- /**
3445
- * Returns the angle in degrees between two rotations a and b.
3446
- * @param quat1 - defines the first quaternion
3447
- * @param quat2 - defines the second quaternion
3448
- * @returns the degrees angle
3449
- */
3450
- export function angle(quat1: ReadonlyQuaternion, quat2: ReadonlyQuaternion): number;
3451
- /**
3452
- * The from quaternion is rotated towards to by an angular step of maxDegreesDelta.
3453
- * @param from - defines the first quaternion
3454
- * @param to - defines the second quaternion
3455
- * @param maxDegreesDelta - the interval step
3456
- */
3457
- export function rotateTowards(from: ReadonlyQuaternion, to: ReadonlyQuaternion, maxDegreesDelta: number): MutableQuaternion;
3458
- /**
3459
- * Creates a rotation with the specified forward and upwards directions.
3460
- * @param forward - the direction to look in
3461
- * @param up - the vector that defines in which direction up is
3462
- */
3463
- export function lookRotation(forward: Vector3.ReadonlyVector3, up?: Vector3.ReadonlyVector3): MutableQuaternion;
3464
- /**
3465
- * Normalize in place the current quaternion
3466
- * @returns the current updated quaternion
3467
- */
3468
- export function normalize(q: ReadonlyQuaternion): MutableQuaternion;
3469
- /**
3470
- * Creates a rotation which rotates from fromDirection to toDirection.
3471
- * @param from - defines the first direction Vector
3472
- * @param to - defines the target direction Vector
3473
- */
3474
- export function fromToRotation(from: Vector3.ReadonlyVector3, to: Vector3.ReadonlyVector3, up?: Vector3.ReadonlyVector3): MutableQuaternion;
3475
- /**
3476
- * Creates an identity quaternion
3477
- * @returns - the identity quaternion
3478
- */
3479
- export function Identity(): MutableQuaternion;
3480
- /**
3481
- * Gets or sets the euler angle representation of the rotation.
3482
- * Implemented unity-based calculations from: https://stackoverflow.com/a/56055813
3483
- * @public
3484
- * @returns a new Vector3 with euler angles degrees
3485
- */
3486
- export function toEulerAngles(q: MutableQuaternion): Vector3.Mutable;
3487
- /**
3488
- * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion
3489
- * @param yaw - defines the rotation around Y axis (radians)
3490
- * @param pitch - defines the rotation around X axis (radians)
3491
- * @param roll - defines the rotation around Z axis (radians)
3492
- * @param result - defines the target quaternion
3493
- */
3494
- export function fromRotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion.MutableQuaternion): void;
3495
- /**
3496
- * Updates the given quaternion with the given rotation matrix values
3497
- * @param matrix - defines the source matrix
3498
- * @param result - defines the target quaternion
3499
- */
3500
- export function fromRotationMatrixToRef(matrix: Matrix.ReadonlyMatrix, result: Quaternion.MutableQuaternion): void;
3501
- /**
3502
- * Interpolates between two quaternions
3503
- * @param left - defines first quaternion
3504
- * @param right - defines second quaternion
3505
- * @param amount - defines the gradient to use
3506
- * @returns the new interpolated quaternion
3507
- */
3508
- export function slerp(left: ReadonlyQuaternion, right: ReadonlyQuaternion, amount: number): MutableQuaternion;
3509
- /**
3510
- * Interpolates between two quaternions and stores it into a target quaternion
3511
- * @param left - defines first quaternion
3512
- * @param right - defines second quaternion
3513
- * @param amount - defines the gradient to use
3514
- * @param result - defines the target quaternion
3515
- */
3516
- export function slerpToRef(left: ReadonlyQuaternion, right: ReadonlyQuaternion, amount: number, result: MutableQuaternion): void;
3517
- /**
3518
- * Multiplies two quaternions
3519
- * @param self - defines the first operand
3520
- * @param q1 - defines the second operand
3521
- * @returns a new quaternion set as the multiplication result of the self one with the given one "q1"
3522
- */
3523
- export function multiply(self: ReadonlyQuaternion, q1: ReadonlyQuaternion): MutableQuaternion;
3524
- /**
3525
- * Sets the given "result" as the the multiplication result of the self one with the given one "q1"
3526
- * @param self - defines the first operand
3527
- * @param q1 - defines the second operand
3528
- * @param result - defines the target quaternion
3529
- * @returns the current quaternion
3530
- */
3531
- export function multiplyToRef(self: ReadonlyQuaternion, q1: ReadonlyQuaternion, result: MutableQuaternion): void;
3532
- /**
3533
- *
3534
- * @param degrees - the angle degrees
3535
- * @param axis - vector3
3536
- * @returns a new Quaternion
3537
- */
3538
- export function fromAngleAxis(degrees: number, axis: Vector3.ReadonlyVector3): MutableQuaternion;
3539
- /**
3540
- * Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)
3541
- * @param axis1 - defines the first axis
3542
- * @param axis2 - defines the second axis
3543
- * @param axis3 - defines the third axis
3544
- * @returns the new quaternion
3545
- */
3546
- export function fromAxisToRotationQuaternion(axis1: Vector3.ReadonlyVector3, axis2: Vector3.ReadonlyVector3, axis3: Vector3.ReadonlyVector3): MutableQuaternion;
3547
- /**
3548
- * Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion
3549
- * @param axis1 - defines the first axis
3550
- * @param axis2 - defines the second axis
3551
- * @param axis3 - defines the third axis
3552
- * @param ref - defines the target quaternion
3553
- */
3554
- export function fromAxisToRotationQuaternionToRef(axis1: Vector3.ReadonlyVector3, axis2: Vector3.ReadonlyVector3, axis3: Vector3.ReadonlyVector3, ref: MutableQuaternion): void;
3555
- /**
3556
- * Returns a zero filled quaternion
3557
- */
3558
- export function Zero(): MutableQuaternion;
3559
- /**
3560
- * @public
3561
- * Rotates the transform so the forward vector points at target's current position.
3562
- */
3563
- export function fromLookAt(position: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, worldUp?: Vector3.ReadonlyVector3): MutableQuaternion;
3564
- /**
3565
- * @public
3566
- * Rotates the transform so the forward vector points at target's current position.
3567
- */
3568
- export function fromLookAtToRef(position: Vector3.ReadonlyVector3, target: Vector3.ReadonlyVector3, worldUp: Vector3.ReadonlyVector3 | undefined, result: MutableQuaternion): void;
3569
- }
3570
-
3571
- /**
3572
- * @public
3573
- */
3574
- declare type QuaternionType = {
3575
- x: number;
3576
- y: number;
3577
- z: number;
3578
- w: number;
3579
- };
3580
-
3581
- /**
3582
- * Constant used to convert from radians to Euler degrees
3583
- * @public
3584
- */
3585
- declare const RAD2DEG: number;
3586
-
3587
- /** @public */
3588
- declare const Raycast: ComponentDefinition<ISchema<PBRaycast>, PBRaycast>;
3589
-
3590
- /** Position will be relative to the scene */
3591
- declare interface RaycastHit {
3592
- position: PBVector3 | undefined;
3593
- origin: PBVector3 | undefined;
3594
- direction: PBVector3 | undefined;
3595
- normalHit: PBVector3 | undefined;
3596
- length: number;
3597
- meshName?: string | undefined;
3598
- entityId?: number | undefined;
3599
- }
3600
-
3601
- declare const enum RaycastQueryType {
3602
- RQT_HIT_FIRST = 0,
3603
- RQT_QUERY_ALL = 1
3604
- }
3605
-
3606
- /** @public */
3607
- declare const RaycastResult: ComponentDefinition<ISchema<PBRaycastResult>, PBRaycastResult>;
3608
-
3609
- /**
3610
- * @public
3611
- */
3612
- declare type ReadonlyComponentSchema<T extends [ComponentDefinition, ...ComponentDefinition[]]> = {
3613
- [K in keyof T]: T[K] extends ComponentDefinition ? ReturnType<T[K]['get']> : never;
3614
- };
3615
-
3616
- /**
3617
- * @public
3618
- */
3619
- declare type ReadonlyPrimitive = number | string | number[] | string[] | boolean | boolean[];
3620
-
3621
- declare type ReceiveMessage = {
3622
- type: WireMessage.Enum;
3623
- entity: Entity;
3624
- componentId: number;
3625
- timestamp: number;
3626
- transportType?: string;
3627
- data?: Uint8Array;
3628
- messageBuffer: Uint8Array;
3629
- };
3630
-
3631
- /**
3632
- * @public
3633
- */
3634
- declare type Result<T extends Spec> = ToOptional<{
3635
- [K in keyof T]: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? Result<T[K]> : never;
3636
- }>;
3637
-
3638
- /**
3639
- * Scalar computation library
3640
- * @public
3641
- */
3642
- declare namespace Scalar {
3643
- /**
3644
- * Two pi constants convenient for computation.
3645
- */
3646
- const TwoPi: number;
3647
- /**
3648
- * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
3649
- * @param a - number
3650
- * @param b - number
3651
- * @param epsilon - (default = 1.401298E-45)
3652
- * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
3653
- */
3654
- export function withinEpsilon(a: number, b: number, epsilon?: number): boolean;
3655
- /**
3656
- * Returns a string : the upper case translation of the number i to hexadecimal.
3657
- * @param i - number
3658
- * @returns the upper case translation of the number i to hexadecimal.
3659
- */
3660
- export function toHex(i: number): string;
3661
- /**
3662
- * Returns -1 if value is negative and +1 is value is positive.
3663
- * @param _value - the value
3664
- * @returns the value itself if it's equal to zero.
3665
- */
3666
- export function sign(value: number): number;
3667
- /**
3668
- * Returns the value itself if it's between min and max.
3669
- * Returns min if the value is lower than min.
3670
- * Returns max if the value is greater than max.
3671
- * @param value - the value to clmap
3672
- * @param min - the min value to clamp to (default: 0)
3673
- * @param max - the max value to clamp to (default: 1)
3674
- * @returns the clamped value
3675
- */
3676
- export function clamp(value: number, min?: number, max?: number): number;
3677
- /**
3678
- * the log2 of value.
3679
- * @param value - the value to compute log2 of
3680
- * @returns the log2 of value.
3681
- */
3682
- export function log2(value: number): number;
3683
- /**
3684
- * Loops the value, so that it is never larger than length and never smaller than 0.
3685
- *
3686
- * This is similar to the modulo operator but it works with floating point numbers.
3687
- * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.
3688
- * With t = 5 and length = 2.5, the result would be 0.0.
3689
- * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
3690
- * @param value - the value
3691
- * @param length - the length
3692
- * @returns the looped value
3693
- */
3694
- export function repeat(value: number, length: number): number;
3695
- /**
3696
- * Normalize the value between 0.0 and 1.0 using min and max values
3697
- * @param value - value to normalize
3698
- * @param min - max to normalize between
3699
- * @param max - min to normalize between
3700
- * @returns the normalized value
3701
- */
3702
- export function normalize(value: number, min: number, max: number): number;
3703
- /**
3704
- * Denormalize the value from 0.0 and 1.0 using min and max values
3705
- * @param normalized - value to denormalize
3706
- * @param min - max to denormalize between
3707
- * @param max - min to denormalize between
3708
- * @returns the denormalized value
3709
- */
3710
- export function denormalize(normalized: number, min: number, max: number): number;
3711
- /**
3712
- * Calculates the shortest difference between two given angles given in degrees.
3713
- * @param current - current angle in degrees
3714
- * @param target - target angle in degrees
3715
- * @returns the delta
3716
- */
3717
- export function deltaAngle(current: number, target: number): number;
3718
- /**
3719
- * PingPongs the value t, so that it is never larger than length and never smaller than 0.
3720
- * @param tx - value
3721
- * @param length - length
3722
- * @returns The returned value will move back and forth between 0 and length
3723
- */
3724
- export function pingPong(tx: number, length: number): number;
3725
- /**
3726
- * Interpolates between min and max with smoothing at the limits.
3727
- *
3728
- * This export function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up
3729
- * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.
3730
- * @param from - from
3731
- * @param to - to
3732
- * @param tx - value
3733
- * @returns the smooth stepped value
3734
- */
3735
- export function smoothStep(from: number, to: number, tx: number): number;
3736
- /**
3737
- * Moves a value current towards target.
3738
- *
3739
- * This is essentially the same as Mathf.Lerp but instead the export function will ensure that the speed never exceeds maxDelta.
3740
- * Negative values of maxDelta pushes the value away from target.
3741
- * @param current - current value
3742
- * @param target - target value
3743
- * @param maxDelta - max distance to move
3744
- * @returns resulting value
3745
- */
3746
- export function moveTowards(current: number, target: number, maxDelta: number): number;
3747
- /**
3748
- * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
3749
- *
3750
- * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta
3751
- * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.
3752
- * @param current - current value
3753
- * @param target - target value
3754
- * @param maxDelta - max distance to move
3755
- * @returns resulting angle
3756
- */
3757
- export function moveTowardsAngle(current: number, target: number, maxDelta: number): number;
3758
- /**
3759
- * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar
3760
- * @param start - start value
3761
- * @param end - target value
3762
- * @param amount - amount to lerp between
3763
- * @returns the lerped value
3764
- */
3765
- export function lerp(start: number, end: number, amount: number): number;
3766
- /**
3767
- * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
3768
- * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.
3769
- * @param start - start value
3770
- * @param end - target value
3771
- * @param amount - amount to lerp between
3772
- * @returns the lerped value
3773
- */
3774
- export function lerpAngle(start: number, end: number, amount: number): number;
3775
- /**
3776
- * Calculates the linear parameter t that produces the interpolant value within the range [a, b].
3777
- * @param a - start value
3778
- * @param b - target value
3779
- * @param value - value between a and b
3780
- * @returns the inverseLerp value
3781
- */
3782
- export function inverseLerp(a: number, b: number, value: number): number;
3783
- /**
3784
- * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
3785
- * {@link http://mathworld.wolfram.com/HermitePolynomial.html}
3786
- * @param value1 - spline value
3787
- * @param tangent1 - spline value
3788
- * @param value2 - spline value
3789
- * @param tangent2 - spline value
3790
- * @param amount - input value
3791
- * @returns hermite result
3792
- */
3793
- export function hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number;
3794
- /**
3795
- * Returns a random float number between and min and max values
3796
- * @param min - min value of random
3797
- * @param max - max value of random
3798
- * @returns random value
3799
- */
3800
- export function randomRange(min: number, max: number): number;
3801
- /**
3802
- * This export function returns percentage of a number in a given range.
3803
- *
3804
- * RangeToPercent(40,20,60) will return 0.5 (50%)
3805
- * RangeToPercent(34,0,100) will return 0.34 (34%)
3806
- * @param num - to convert to percentage
3807
- * @param min - min range
3808
- * @param max - max range
3809
- * @returns the percentage
3810
- */
3811
- export function rangeToPercent(num: number, min: number, max: number): number;
3812
- /**
3813
- * This export function returns number that corresponds to the percentage in a given range.
3814
- *
3815
- * PercentToRange(0.34,0,100) will return 34.
3816
- * @param percent - to convert to number
3817
- * @param min - min range
3818
- * @param max - max range
3819
- * @returns the number
3820
- */
3821
- export function percentToRange(percent: number, min: number, max: number): number;
3822
- /**
3823
- * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.
3824
- * @param angle - The angle to normalize in radian.
3825
- * @returns The converted angle.
3826
- */
3827
- export function normalizeRadians(angle: number): number;
3828
- }
3829
-
3830
- /**
3831
- * @public
3832
- */
3833
- declare namespace Schemas {
3834
- export type SchemaType = ISchema;
3835
- const Boolean: ISchema<boolean>;
3836
- const String: ISchema<string>;
3837
- const Float: ISchema<number>;
3838
- const Double: ISchema<number>;
3839
- const Byte: ISchema<number>;
3840
- const Short: ISchema<number>;
3841
- const Int: ISchema<number>;
3842
- const Int64: ISchema<number>;
3843
- const Number: ISchema<number>;
3844
- const Vector3: ISchema<Vector3Type>;
3845
- const Quaternion: ISchema<QuaternionType>;
3846
- const Color3: ISchema<Color3Type>;
3847
- const Color4: ISchema<Color4Type>;
3848
- const Entity: ISchema<Entity>;
3849
- const Enum: typeof IEnum;
3850
- const Array: typeof IArray;
3851
- const Map: typeof IMap;
3852
- const Optional: typeof IOptional;
3853
- }
3854
-
3855
- /**
3856
- * @public
3857
- */
3858
- declare interface Spec {
3859
- [key: string]: ISchema;
3860
- }
3861
-
3862
- /**
3863
- * @public
3864
- */
3865
- declare type SystemFn = (dt: number) => void;
3866
-
3867
- declare type Task<T = unknown> = () => Promise<T>;
3868
-
3869
- declare const enum TextAlignMode {
3870
- TAM_TOP_LEFT = 0,
3871
- TAM_TOP_CENTER = 1,
3872
- TAM_TOP_RIGHT = 2,
3873
- TAM_MIDDLE_LEFT = 3,
3874
- TAM_MIDDLE_CENTER = 4,
3875
- TAM_MIDDLE_RIGHT = 5,
3876
- TAM_BOTTOM_LEFT = 6,
3877
- TAM_BOTTOM_CENTER = 7,
3878
- TAM_BOTTOM_RIGHT = 8
3879
- }
3880
-
3881
- /** @public */
3882
- declare const TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
3883
-
3884
- declare interface Texture {
3885
- src: string;
3886
- /** default = TextureWrapMode.Clamp */
3887
- wrapMode?: TextureWrapMode | undefined;
3888
- /** default = FilterMode.Bilinear */
3889
- filterMode?: TextureFilterMode | undefined;
3890
- }
3891
-
3892
- declare const enum TextureFilterMode {
3893
- TFM_POINT = 0,
3894
- TFM_BILINEAR = 1,
3895
- TFM_TRILINEAR = 2
3896
- }
3897
-
3898
- /**
3899
- * @public
3900
- */
3901
- declare type TextureHelper = {
3902
- /**
3903
- * @returns a common texture with a source file
3904
- */
3905
- Common: (texture: Texture) => TextureUnion;
3906
- /**
3907
- * @returns the avatar texture of userId specified
3908
- */
3909
- Avatar: (avatarTexture: AvatarTexture) => TextureUnion;
3910
- };
3911
-
3912
- declare interface TextureUnion {
3913
- tex?: {
3914
- $case: 'texture';
3915
- texture: Texture;
3916
- } | {
3917
- $case: 'avatarTexture';
3918
- avatarTexture: AvatarTexture;
3919
- };
3920
- }
3921
-
3922
- declare const enum TextureWrapMode {
3923
- TWM_REPEAT = 0,
3924
- TWM_CLAMP = 1,
3925
- TWM_MIRROR = 2,
3926
- TWM_MIRROR_ONCE = 3
3927
- }
3928
-
3929
- declare type ToOptional<T> = OnlyOptionalUndefinedTypes<T> & OnlyNonUndefinedTypes<T>;
3930
-
3931
- /** @public */
3932
- declare const Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
3933
-
3934
- /**
3935
- * @public
3936
- */
3937
- declare type TransformType = {
3938
- position: {
3939
- x: number;
3940
- y: number;
3941
- z: number;
3942
- };
3943
- rotation: {
3944
- x: number;
3945
- y: number;
3946
- z: number;
3947
- w: number;
3948
- };
3949
- scale: {
3950
- x: number;
3951
- y: number;
3952
- z: number;
3953
- };
3954
- parent?: Entity;
3955
- };
3956
-
3957
- declare type Transport = {
3958
- type: string;
3959
- send(message: Uint8Array): void;
3960
- onmessage?(message: Uint8Array): void;
3961
- filter(message: Omit<TransportMessage, 'messageBuffer'>): boolean;
3962
- };
3963
-
3964
- declare type TransportMessage = Omit<ReceiveMessage, 'data'>;
3965
-
3966
- /** @public */
3967
- declare const UiBackground: ComponentDefinition<ISchema<PBUiBackground>, PBUiBackground>;
3968
-
3969
- /** @public */
3970
- declare const UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
3971
-
3972
- /** @public */
3973
- declare const UiTransform: ComponentDefinition<ISchema<PBUiTransform>, PBUiTransform>;
3974
-
3975
- /**
3976
- * @public
3977
- */
3978
- declare type Unpacked<T> = T extends (infer U)[] ? U : T;
3979
-
3980
- /**
3981
- * @public
3982
- * Vector3 is a type and a namespace.
3983
- * - The namespace contains all types and functions to operates with Vector3
3984
- * - The type Vector3 is an alias to Vector3.ReadonlyVector3
3985
- * ```
3986
- *
3987
- * // Namespace usage example
3988
- * const next = Vector3.add(pointA, velocityA)
3989
- *
3990
- * // Type usage example
3991
- * const readonlyPosition: Vector3 = Vector3.Zero()
3992
- * readonlyPosition.x = 0.1 // this FAILS
3993
- *
3994
- * // For mutable usage, use `Vector3.Mutable`
3995
- * const position: Vector3.Mutable = Vector3.One()
3996
- * position.x = 3.0 // this WORKS
3997
- * ```
3998
- */
3999
- declare type Vector3 = Vector3.ReadonlyVector3;
4000
-
4001
- /**
4002
- * @public
4003
- * Vector3 is a type and a namespace.
4004
- * ```
4005
- * // The namespace contains all types and functions to operates with Vector3
4006
- * const next = Vector3.add(pointA, velocityA)
4007
- * // The type Vector3 is an alias to Vector3.ReadonlyVector3
4008
- * const readonlyPosition: Vector3 = Vector3.Zero()
4009
- * readonlyPosition.x = 0.1 // this FAILS
4010
- *
4011
- * // For mutable usage, use `Vector3.Mutable`
4012
- * const position: Vector3.Mutable = Vector3.One()
4013
- * position.x = 3.0 // this WORKS
4014
- * ```
4015
- */
4016
- declare namespace Vector3 {
4017
- /**
4018
- * @public
4019
- * For external use, type with `Vector3`, e.g. `const zeroPosition: Vector3 = Vector3.Zero()`.
4020
- * For mutable typing, use `Vector3.Mutable`, e.g. `const upVector: Vector3.Mutable = Vector3.Up()`.
4021
- */
4022
- export type ReadonlyVector3 = {
4023
- readonly x: number;
4024
- readonly y: number;
4025
- readonly z: number;
4026
- };
4027
- /**
4028
- * @public
4029
- * For external usage, type with `Vector3`, e.g. `const zeroPosition: Vector3 = Vector3.Zero()`.
4030
- * For mutable typing, use `Vector3.Mutable`, e.g. `const upVector: Vector3.Mutable = Vector3.Up()`.
4031
- */
4032
- export type MutableVector3 = {
4033
- x: number;
4034
- y: number;
4035
- z: number;
4036
- };
4037
- /**
4038
- * @public
4039
- * Type with `Vector3` for readonly usage, e.g. `const zeroPosition: Vector3 = Vector3.Zero()`.
4040
- * For mutable, use `Vector3.Mutable`, e.g. `const upVector: Vector3.Mutable = Vector3.Up()`.
4041
- */
4042
- export type Mutable = MutableVector3;
4043
- /**
4044
- * Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same
4045
- * @param vector - vector to check
4046
- */
4047
- export function isNonUniform(vector: ReadonlyVector3): boolean;
4048
- /**
4049
- * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
4050
- * @param x - defines the first coordinates (on X axis)
4051
- * @param y - defines the second coordinates (on Y axis)
4052
- * @param z - defines the third coordinates (on Z axis)
4053
- */
4054
- export function create(
4055
- /**
4056
- * Defines the first coordinates (on X axis)
4057
- */
4058
- x?: number,
4059
- /**
4060
- * Defines the second coordinates (on Y axis)
4061
- */
4062
- y?: number,
4063
- /**
4064
- * Defines the third coordinates (on Z axis)
4065
- */
4066
- z?: number): MutableVector3;
4067
- /**
4068
- * Returns a new Vector3 as the result of the addition of the two given vectors.
4069
- * @param vector1 - the first vector
4070
- * @param vector2 - the second vector
4071
- * @returns the resulting vector
4072
- */
4073
- export function add(vector1: ReadonlyVector3, vector2: ReadonlyVector3): MutableVector3;
4074
- /**
4075
- * Add component by component the vector2 into dest
4076
- * @param dest - the first vector and destination of addition
4077
- * @param vector2 - the second vector
4078
- */
4079
- export function addToRef(vector1: ReadonlyVector3, vector2: ReadonlyVector3, result: MutableVector3): void;
4080
- /**
4081
- * Returns a new Vector3 as the result of the substraction of the two given vectors.
4082
- * @returns the resulting vector
4083
- */
4084
- export function subtract(vector1: ReadonlyVector3, vector2: ReadonlyVector3): MutableVector3;
4085
- /**
4086
- * Returns a new Vector3 as the result of the substraction of the two given vectors.
4087
- * @returns the resulting vector
4088
- */
4089
- export function subtractToRef(vector1: ReadonlyVector3, vector2: ReadonlyVector3, result: MutableVector3): void;
4090
- /**
4091
- * Subtracts the given floats from the current Vector3 coordinates and set the given vector "result" with this result
4092
- * @param x - defines the x coordinate of the operand
4093
- * @param y - defines the y coordinate of the operand
4094
- * @param z - defines the z coordinate of the operand
4095
- * @param result - defines the Vector3 object where to store the result
4096
- */
4097
- export function subtractFromFloatsToRef(vector1: ReadonlyVector3, x: number, y: number, z: number, result: MutableVector3): void;
4098
- /**
4099
- * Returns a new Vector3 with the other sign
4100
- * @returns the resulting vector
4101
- */
4102
- export function negate(value: ReadonlyVector3): MutableVector3;
4103
- /**
4104
- * Copy source into dest
4105
- *
4106
- */
4107
- export function copyFrom(source: ReadonlyVector3, dest: MutableVector3): void;
4108
- /**
4109
- * Sets the given vector "dest" with the given floats.
4110
- * @param x - defines the x coordinate of the source
4111
- * @param y - defines the y coordinate of the source
4112
- * @param z - defines the z coordinate of the source
4113
- * @param dest - defines the Vector3 where to store the result
4114
- */
4115
- export function copyFromFloats(x: number, y: number, z: number, dest: MutableVector3): void;
4116
- /**
4117
- * Returns a new Vector3 with the same value
4118
- * @returns the resulting vector
4119
- */
4120
- export function clone(source: ReadonlyVector3): MutableVector3;
4121
- /**
4122
- * Get the clip factor between two vectors
4123
- * @param vector0 - defines the first operand
4124
- * @param vector1 - defines the second operand
4125
- * @param axis - defines the axis to use
4126
- * @param size - defines the size along the axis
4127
- * @returns the clip factor
4128
- */
4129
- export function getClipFactor(vector0: ReadonlyVector3, vector1: ReadonlyVector3, axis: ReadonlyVector3, size: number): number;
4130
- /**
4131
- * Get angle between two vectors
4132
- * @param vector0 - angle between vector0 and vector1
4133
- * @param vector1 - angle between vector0 and vector1
4134
- * @param normal - direction of the normal
4135
- * @returns the angle between vector0 and vector1
4136
- */
4137
- export function getAngleBetweenVectors(vector0: ReadonlyVector3, vector1: ReadonlyVector3, normal: ReadonlyVector3): number;
4138
- /**
4139
- * Returns a new Vector3 set from the index "offset" of the given array
4140
- * @param array - defines the source array
4141
- * @param offset - defines the offset in the source array
4142
- * @returns the new Vector3
4143
- */
4144
- export function fromArray(array: FloatArray, offset?: number): MutableVector3;
4145
- /**
4146
- * Returns a new Vector3 set from the index "offset" of the given FloatArray
4147
- * This function is deprecated. Use FromArray instead
4148
- * @param array - defines the source array
4149
- * @param offset - defines the offset in the source array
4150
- * @returns the new Vector3
4151
- */
4152
- export function fromFloatArray(array: FloatArray, offset?: number): MutableVector3;
4153
- /**
4154
- * Sets the given vector "result" with the element values from the index "offset" of the given array
4155
- * @param array - defines the source array
4156
- * @param offset - defines the offset in the source array
4157
- * @param result - defines the Vector3 where to store the result
4158
- */
4159
- export function fromArrayToRef(array: number[], offset: number, result: MutableVector3): void;
4160
- /**
4161
- * Sets the given vector "result" with the element values from the index "offset" of the given FloatArray
4162
- * This function is deprecated. Use FromArrayToRef instead.
4163
- * @param array - defines the source array
4164
- * @param offset - defines the offset in the source array
4165
- * @param result - defines the Vector3 where to store the result
4166
- */
4167
- export function fromFloatArrayToRef(array: FloatArray, offset: number, result: MutableVector3): void;
4168
- /**
4169
- * Gets the length of the Vector3
4170
- * @returns the length of the Vector3
4171
- */
4172
- export function length(vector: ReadonlyVector3): number;
4173
- /**
4174
- * Gets the squared length of the Vector3
4175
- * @returns squared length of the Vector3
4176
- */
4177
- export function lengthSquared(vector: ReadonlyVector3): number;
4178
- /**
4179
- * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale"
4180
- * @param scale - defines the multiplier factor
4181
- * @returns a new Vector3
4182
- */
4183
- export function scaleToRef(vector: ReadonlyVector3, scale: number, result: MutableVector3): void;
4184
- /**
4185
- * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale"
4186
- * @param scale - defines the multiplier factor
4187
- * @returns a new Vector3
4188
- */
4189
- export function scale(vector: ReadonlyVector3, scale: number): MutableVector3;
4190
- /**
4191
- * Normalize the current Vector3 with the given input length.
4192
- * Please note that this is an in place operation.
4193
- * @param len - the length of the vector
4194
- * @returns the current updated Vector3
4195
- */
4196
- export function normalizeFromLength(vector: ReadonlyVector3, len: number): MutableVector3;
4197
- /**
4198
- * Normalize the current Vector3 with the given input length.
4199
- * Please note that this is an in place operation.
4200
- * @param len - the length of the vector
4201
- * @returns the current updated Vector3
4202
- */
4203
- export function normalizeFromLengthToRef(vector: ReadonlyVector3, len: number, result: MutableVector3): void;
4204
- /**
4205
- * Normalize the current Vector3.
4206
- * Please note that this is an in place operation.
4207
- * @returns the current updated Vector3
4208
- */
4209
- export function normalize(vector: ReadonlyVector3): MutableVector3;
4210
- /**
4211
- * Normalize the current Vector3.
4212
- * Please note that this is an in place operation.
4213
- * @returns the current updated Vector3
4214
- */
4215
- export function normalizeToRef(vector: ReadonlyVector3, result: MutableVector3): void;
4216
- /**
4217
- * Returns the dot product (float) between the vectors "left" and "right"
4218
- * @param left - defines the left operand
4219
- * @param right - defines the right operand
4220
- * @returns the dot product
4221
- */
4222
- export function dot(left: ReadonlyVector3, right: ReadonlyVector3): number;
4223
- /**
4224
- * Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective
4225
- * @param matrix - The transformation matrix
4226
- * @returns result Vector3
4227
- */
4228
- export function applyMatrix4(vector: ReadonlyVector3, matrix: Matrix.ReadonlyMatrix): MutableVector3;
4229
- /**
4230
- * Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective and set the given vector "result" with this result
4231
- * @param matrix - The transformation matrix
4232
- * @param result - defines the Vector3 object where to store the result
4233
- */
4234
- export function applyMatrix4ToRef(vector: ReadonlyVector3, matrix: Matrix.ReadonlyMatrix, result: MutableVector3): void;
4235
- /**
4236
- * Rotates the current Vector3 based on the given quaternion
4237
- * @param q - defines the Quaternion
4238
- * @returns the current Vector3
4239
- */
4240
- export function rotate(vector: ReadonlyVector3, q: Quaternion.ReadonlyQuaternion): MutableVector3;
4241
- /**
4242
- * Rotates current Vector3 based on the given quaternion, but applies the rotation to target Vector3.
4243
- * @param q - defines the Quaternion
4244
- * @param result - defines the target Vector3
4245
- * @returns the current Vector3
4246
- */
4247
- export function rotateToRef(vector: ReadonlyVector3, q: Quaternion.ReadonlyQuaternion, result: MutableVector3): void;
4248
- /**
4249
- * Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end"
4250
- * @param start - defines the start value
4251
- * @param end - defines the end value
4252
- * @param amount - max defines amount between both (between 0 and 1)
4253
- * @returns the new Vector3
4254
- */
4255
- export function lerp(start: ReadonlyVector3, end: ReadonlyVector3, amount: number): MutableVector3;
4256
- /**
4257
- * Sets the given vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end"
4258
- * @param start - defines the start value
4259
- * @param end - defines the end value
4260
- * @param amount - max defines amount between both (between 0 and 1)
4261
- * @param result - defines the Vector3 where to store the result
4262
- */
4263
- export function lerpToRef(start: ReadonlyVector3, end: ReadonlyVector3, amount: number, result: MutableVector3): void;
4264
- /**
4265
- * Returns a new Vector3 as the cross product of the vectors "left" and "right"
4266
- * The cross product is then orthogonal to both "left" and "right"
4267
- * @param left - defines the left operand
4268
- * @param right - defines the right operand
4269
- * @returns the cross product
4270
- */
4271
- export function cross(left: ReadonlyVector3, right: ReadonlyVector3): MutableVector3;
4272
- /**
4273
- * Sets the given vector "result" with the cross product of "left" and "right"
4274
- * The cross product is then orthogonal to both "left" and "right"
4275
- * @param left - defines the left operand
4276
- * @param right - defines the right operand
4277
- * @param result - defines the Vector3 where to store the result
4278
- */
4279
- export function crossToRef(left: ReadonlyVector3, right: ReadonlyVector3, result: MutableVector3): void;
4280
- /**
4281
- * Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector.
4282
- * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)
4283
- * @param vector - defines the Vector3 to transform
4284
- * @param transformation - defines the transformation matrix
4285
- * @returns the transformed Vector3
4286
- */
4287
- export function transformCoordinates(vector: ReadonlyVector3, transformation: Matrix.ReadonlyMatrix): MutableVector3;
4288
- /**
4289
- * Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given vector
4290
- * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)
4291
- * @param vector - defines the Vector3 to transform
4292
- * @param transformation - defines the transformation matrix
4293
- * @param result - defines the Vector3 where to store the result
4294
- */
4295
- export function transformCoordinatesToRef(vector: ReadonlyVector3, transformation: Matrix.ReadonlyMatrix, result: MutableVector3): void;
4296
- /**
4297
- * Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z)
4298
- * This method computes tranformed coordinates only, not transformed direction vectors
4299
- * @param x - define the x coordinate of the source vector
4300
- * @param y - define the y coordinate of the source vector
4301
- * @param z - define the z coordinate of the source vector
4302
- * @param transformation - defines the transformation matrix
4303
- * @param result - defines the Vector3 where to store the result
4304
- */
4305
- export function transformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix.ReadonlyMatrix, result: MutableVector3): void;
4306
- /**
4307
- * Returns a new Vector3 set with the result of the normal transformation by the given matrix of the given vector
4308
- * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)
4309
- * @param vector - defines the Vector3 to transform
4310
- * @param transformation - defines the transformation matrix
4311
- * @returns the new Vector3
4312
- */
4313
- export function transformNormal(vector: ReadonlyVector3, transformation: Matrix.ReadonlyMatrix): MutableVector3;
4314
- /**
4315
- * Sets the given vector "result" with the result of the normal transformation by the given matrix of the given vector
4316
- * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)
4317
- * @param vector - defines the Vector3 to transform
4318
- * @param transformation - defines the transformation matrix
4319
- * @param result - defines the Vector3 where to store the result
4320
- */
4321
- export function transformNormalToRef(vector: ReadonlyVector3, transformation: Matrix.ReadonlyMatrix, result: MutableVector3): void;
4322
- /**
4323
- * Sets the given vector "result" with the result of the normal transformation by the given matrix of the given floats (x, y, z)
4324
- * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)
4325
- * @param x - define the x coordinate of the source vector
4326
- * @param y - define the y coordinate of the source vector
4327
- * @param z - define the z coordinate of the source vector
4328
- * @param transformation - defines the transformation matrix
4329
- * @param result - defines the Vector3 where to store the result
4330
- */
4331
- export function transformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix.ReadonlyMatrix, result: MutableVector3): void;
4332
- /**
4333
- * Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4"
4334
- * @param value1 - defines the first control point
4335
- * @param value2 - defines the second control point
4336
- * @param value3 - defines the third control point
4337
- * @param value4 - defines the fourth control point
4338
- * @param amount - defines the amount on the spline to use
4339
- * @returns the new Vector3
4340
- */
4341
- export function catmullRom(value1: ReadonlyVector3, value2: ReadonlyVector3, value3: ReadonlyVector3, value4: ReadonlyVector3, amount: number): MutableVector3;
4342
- /**
4343
- * Returns a new Vector3 set with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max"
4344
- * If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one
4345
- * If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one
4346
- * @param value - defines the current value
4347
- * @param min - defines the lower range value
4348
- * @param max - defines the upper range value
4349
- * @returns the new Vector3
4350
- */
4351
- export function clamp(value: ReadonlyVector3, min: ReadonlyVector3, max: ReadonlyVector3): MutableVector3;
4352
- /**
4353
- * Sets the given vector "result" with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max"
4354
- * If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one
4355
- * If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one
4356
- * @param value - defines the current value
4357
- * @param min - defines the lower range value
4358
- * @param max - defines the upper range value
4359
- * @param result - defines the Vector3 where to store the result
4360
- */
4361
- export function clampToRef(value: ReadonlyVector3, min: ReadonlyVector3, max: ReadonlyVector3, result: MutableVector3): void;
4362
- /**
4363
- * Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2"
4364
- * @param value1 - defines the first control point
4365
- * @param tangent1 - defines the first tangent vector
4366
- * @param value2 - defines the second control point
4367
- * @param tangent2 - defines the second tangent vector
4368
- * @param amount - defines the amount on the interpolation spline (between 0 and 1)
4369
- * @returns the new Vector3
4370
- */
4371
- export function hermite(value1: ReadonlyVector3, tangent1: ReadonlyVector3, value2: ReadonlyVector3, tangent2: ReadonlyVector3, amount: number): MutableVector3;
4372
- /**
4373
- * Gets the minimal coordinate values between two Vector3
4374
- * @param left - defines the first operand
4375
- * @param right - defines the second operand
4376
- * @returns the new Vector3
4377
- */
4378
- export function minimize(left: ReadonlyVector3, right: ReadonlyVector3): MutableVector3;
4379
- /**
4380
- * Gets the maximal coordinate values between two Vector3
4381
- * @param left - defines the first operand
4382
- * @param right - defines the second operand
4383
- * @returns the new Vector3
4384
- */
4385
- export function maximize(left: MutableVector3, right: MutableVector3): MutableVector3;
4386
- /**
4387
- * Returns the distance between the vectors "value1" and "value2"
4388
- * @param value1 - defines the first operand
4389
- * @param value2 - defines the second operand
4390
- * @returns the distance
4391
- */
4392
- export function distance(value1: ReadonlyVector3, value2: ReadonlyVector3): number;
4393
- /**
4394
- * Returns the squared distance between the vectors "value1" and "value2"
4395
- * @param value1 - defines the first operand
4396
- * @param value2 - defines the second operand
4397
- * @returns the squared distance
4398
- */
4399
- export function distanceSquared(value1: ReadonlyVector3, value2: ReadonlyVector3): number;
4400
- /**
4401
- * Returns a new Vector3 located at the center between "value1" and "value2"
4402
- * @param value1 - defines the first operand
4403
- * @param value2 - defines the second operand
4404
- * @returns the new Vector3
4405
- */
4406
- export function center(value1: ReadonlyVector3, value2: ReadonlyVector3): MutableVector3;
4407
- /**
4408
- * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
4409
- * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
4410
- * to something in order to rotate it from its local system to the given target system
4411
- * Note: axis1, axis2 and axis3 are normalized during this operation
4412
- * @param axis1 - defines the first axis
4413
- * @param axis2 - defines the second axis
4414
- * @param axis3 - defines the third axis
4415
- * @returns a new Vector3
4416
- */
4417
- export function rotationFromAxis(axis1: MutableVector3, axis2: MutableVector3, axis3: MutableVector3): MutableVector3;
4418
- /**
4419
- * The same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3
4420
- * @param axis1 - defines the first axis
4421
- * @param axis2 - defines the second axis
4422
- * @param axis3 - defines the third axis
4423
- * @param ref - defines the Vector3 where to store the result
4424
- */
4425
- export function rotationFromAxisToRef(axis1: MutableVector3, axis2: MutableVector3, axis3: MutableVector3, result: MutableVector3): void;
4426
- /**
4427
- * Creates a string representation of the Vector3
4428
- * @returns a string with the Vector3 coordinates.
4429
- */
4430
- export function toString(vector: ReadonlyVector3): string;
4431
- /**
4432
- * Creates the Vector3 hash code
4433
- * @returns a number which tends to be unique between Vector3 instances
4434
- */
4435
- export function getHashCode(vector: ReadonlyVector3): number;
4436
- /**
4437
- * Returns true if the vector1 and the vector2 coordinates are strictly equal
4438
- * @param vector1 - defines the first operand
4439
- * @param vector2 - defines the second operand
4440
- * @returns true if both vectors are equals
4441
- */
4442
- export function equals(vector1: ReadonlyVector3, vector2: ReadonlyVector3): boolean;
4443
- /**
4444
- * Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon
4445
- * @param otherVector - defines the second operand
4446
- * @param epsilon - defines the minimal distance to define values as equals
4447
- * @returns true if both vectors are distant less than epsilon
4448
- */
4449
- export function equalsWithEpsilon(vector1: ReadonlyVector3, vector2: ReadonlyVector3, epsilon?: number): boolean;
4450
- /**
4451
- * Returns true if the current Vector3 coordinates equals the given floats
4452
- * @param x - defines the x coordinate of the operand
4453
- * @param y - defines the y coordinate of the operand
4454
- * @param z - defines the z coordinate of the operand
4455
- * @returns true if both vectors are equals
4456
- */
4457
- export function equalsToFloats(vector: ReadonlyVector3, x: number, y: number, z: number): boolean;
4458
- /**
4459
- * Returns a new Vector3, result of the multiplication of vector1 by the vector2
4460
- * @param vector1 - defines the first operand
4461
- * @param vector2 - defines the second operand
4462
- * @returns the new Vector3
4463
- */
4464
- export function multiply(vector1: ReadonlyVector3, vector2: ReadonlyVector3): MutableVector3;
4465
- /**
4466
- * Multiplies the current Vector3 by the given one and stores the result in the given vector "result"
4467
- * @param otherVector - defines the second operand
4468
- * @param result - defines the Vector3 object where to store the result
4469
- * @returns the current Vector3
4470
- */
4471
- export function multiplyToRef(vector1: ReadonlyVector3, vector2: ReadonlyVector3, result: MutableVector3): void;
4472
- /**
4473
- * Returns a new Vector3 set with the result of the mulliplication of the current Vector3 coordinates by the given floats
4474
- * @param x - defines the x coordinate of the operand
4475
- * @param y - defines the y coordinate of the operand
4476
- * @param z - defines the z coordinate of the operand
4477
- * @returns the new Vector3
4478
- */
4479
- export function multiplyByFloatsToRef(vector1: ReadonlyVector3, x: number, y: number, z: number, result: MutableVector3): void;
4480
- /**
4481
- * Returns a new Vector3 set with the result of the mulliplication of the current Vector3 coordinates by the given floats
4482
- * @param x - defines the x coordinate of the operand
4483
- * @param y - defines the y coordinate of the operand
4484
- * @param z - defines the z coordinate of the operand
4485
- * @returns the new Vector3
4486
- */
4487
- export function multiplyByFloats(vector1: ReadonlyVector3, x: number, y: number, z: number): MutableVector3;
4488
- /**
4489
- * Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones
4490
- * @param otherVector - defines the second operand
4491
- * @returns the new Vector3
4492
- */
4493
- export function divide(vector1: ReadonlyVector3, vector2: ReadonlyVector3): MutableVector3;
4494
- /**
4495
- * Divides the current Vector3 coordinates by the given ones and stores the result in the given vector "result"
4496
- * @param otherVector - defines the second operand
4497
- * @param result - defines the Vector3 object where to store the result
4498
- * @returns the current Vector3
4499
- */
4500
- export function divideToRef(vector1: ReadonlyVector3, vector2: ReadonlyVector3, result: MutableVector3): void;
4501
- /**
4502
- * Set result Vector3 with the maximal coordinate values between vector1 and the given coordinates
4503
- * @param x - defines the x coordinate of the operand
4504
- * @param y - defines the y coordinate of the operand
4505
- * @param z - defines the z coordinate of the operand
4506
- * @param result - the set Vector3
4507
- */
4508
- export function maximizeInPlaceFromFloatsToRef(vector1: ReadonlyVector3, x: number, y: number, z: number, result: MutableVector3): void;
4509
- /**
4510
- * Set result Vector3 with the minimal coordinate values between vector1 and the given coordinates
4511
- * @param x - defines the x coordinate of the operand
4512
- * @param y - defines the y coordinate of the operand
4513
- * @param z - defines the z coordinate of the operand
4514
- * @param result - the set Vector3
4515
- */
4516
- export function minimizeInPlaceFromFloatsToRef(vector1: ReadonlyVector3, x: number, y: number, z: number, result: MutableVector3): void;
4517
- /**
4518
- * Gets a new Vector3 from vector1 floored values
4519
- * @returns a new Vector3
4520
- */
4521
- export function floor(vector1: ReadonlyVector3): MutableVector3;
4522
- /**
4523
- * Gets a new Vector3 from vector1 floored values
4524
- * @returns a new Vector3
4525
- */
4526
- export function fract(vector1: ReadonlyVector3): MutableVector3;
4527
- /**
4528
- * Returns a new Vector3 set to (0.0, 0.0, 0.0)
4529
- * @returns a new empty Vector3
4530
- */
4531
- export function Zero(): MutableVector3;
4532
- /**
4533
- * Returns a new Vector3 set to (1.0, 1.0, 1.0)
4534
- * @returns a new unit Vector3
4535
- */
4536
- export function One(): MutableVector3;
4537
- /**
4538
- * Returns a new Vector3 set tolengthSquared (0.0, 1.0, 0.0)
4539
- * @returns a new up Vector3
4540
- */
4541
- export function Up(): MutableVector3;
4542
- /**
4543
- * Returns a new Vector3 set to (0.0, -1.0, 0.0)
4544
- * @returns a new down Vector3
4545
- */
4546
- export function Down(): MutableVector3;
4547
- /**
4548
- * Returns a new Vector3 set to (0.0, 0.0, 1.0)
4549
- * @returns a new forward Vector3
4550
- */
4551
- export function Forward(): MutableVector3;
4552
- /**
4553
- * Returns a new Vector3 set to (0.0, 0.0, -1.0)
4554
- * @returns a new forward Vector3
4555
- */
4556
- export function Backward(): MutableVector3;
4557
- /**
4558
- * Returns a new Vector3 set to (1.0, 0.0, 0.0)
4559
- * @returns a new right Vector3
4560
- */
4561
- export function Right(): MutableVector3;
4562
- /**
4563
- * Returns a new Vector3 set to (-1.0, 0.0, 0.0)
4564
- * @returns a new left Vector3
4565
- */
4566
- export function Left(): MutableVector3;
4567
- /**
4568
- * Returns a new random Vector3
4569
- * @returns a random Vector3
4570
- */
4571
- export function Random(): MutableVector3;
4572
- }
4573
-
4574
- /**
4575
- * @public
4576
- */
4577
- declare type Vector3Type = {
4578
- x: number;
4579
- y: number;
4580
- z: number;
4581
- };
4582
-
4583
- /** @public */
4584
- declare const VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
4585
-
4586
- declare namespace WireMessage {
4587
- export type Uint32 = number;
4588
- export enum Enum {
4589
- RESERVED = 0,
4590
- PUT_COMPONENT = 1,
4591
- DELETE_COMPONENT = 2,
4592
- MAX_MESSAGE_TYPE = 3
4593
- }
4594
- /**
4595
- * @param length - Uint32 the length of all message (including the header)
4596
- * @param type - define the function which handles the data
4597
- */
4598
- export type Header = {
4599
- length: Uint32;
4600
- type: Uint32;
4601
- };
4602
- const HEADER_LENGTH = 8;
4603
- /**
4604
- * Validate if the message incoming is completed
4605
- * @param buf - ByteBuffer
4606
- */
4607
- export function validate(buf: ByteBuffer): boolean;
4608
- export function readHeader(buf: ByteBuffer): Header | null;
4609
- }
4610
-
4611
- declare const enum YGAlign {
4612
- YGA_AUTO = 0,
4613
- YGA_FLEX_START = 1,
4614
- YGA_CENTER = 2,
4615
- YGA_FLEX_END = 3,
4616
- YGA_STRETCH = 4,
4617
- YGA_BASELINE = 5,
4618
- YGA_SPACE_BETWEEN = 6,
4619
- YGA_SPACE_AROUND = 7
4620
- }
4621
-
4622
- declare const enum YGDisplay {
4623
- YGD_FLEX = 0,
4624
- YGD_NONE = 1
4625
- }
4626
-
4627
- declare const enum YGEdge {
4628
- YGE_LEFT = 0,
4629
- YGE_TOP = 1,
4630
- YGE_RIGHT = 2,
4631
- YGE_BOTTOM = 3,
4632
- YGE_START = 4,
4633
- YGE_END = 5,
4634
- YGE_HORIZONTAL = 6,
4635
- YGE_VERTICAL = 7,
4636
- YGE_ALL = 8
4637
- }
4638
-
4639
- declare const enum YGFlexDirection {
4640
- YGFD_ROW = 0,
4641
- YGFD_COLUMN = 1,
4642
- YGFD_COLUMN_REVERSE = 2,
4643
- YGFD_ROW_REVERSE = 3
4644
- }
4645
-
4646
- declare const enum YGJustify {
4647
- YGJ_FLEX_START = 0,
4648
- YGJ_CENTER = 1,
4649
- YGJ_FLEX_END = 2,
4650
- YGJ_SPACE_BETWEEN = 3,
4651
- YGJ_SPACE_AROUND = 4,
4652
- YGJ_SPACE_EVENLY = 5
4653
- }
4654
-
4655
- declare const enum YGOverflow {
4656
- YGO_VISIBLE = 0,
4657
- YGO_HIDDEN = 1,
4658
- YGO_SCROLL = 2
4659
- }
4660
-
4661
- declare const enum YGPositionType {
4662
- YGPT_RELATIVE = 0,
4663
- YGPT_ABSOLUTE = 1
4664
- }
4665
-
4666
- declare const enum YGUnit {
4667
- YGU_UNDEFINED = 0,
4668
- YGU_POINT = 1,
4669
- YGU_PERCENT = 2,
4670
- YGU_AUTO = 3
4671
- }
4672
-
4673
- declare const enum YGWrap {
4674
- YGW_NO_WRAP = 0,
4675
- YGW_WRAP = 1,
4676
- YGW_WRAP_REVERSE = 2
4677
- }
4678
-
4679
-